mirror of
https://github.com/izzy2lost/xemu.git
synced 2026-07-06 00:20:22 -07:00
target-or32: Add testcases
Add testcases for OpenRISC. Signed-off-by: Jia Liu <proljc@gmail.com> Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
This commit is contained in:
@@ -0,0 +1,71 @@
|
||||
-include ../../config-host.mak
|
||||
|
||||
CROSS = or32-linux-
|
||||
|
||||
SIM = qemu-or32
|
||||
|
||||
CC = $(CROSS)gcc
|
||||
|
||||
TESTCASES = test_add.tst
|
||||
TESTCASES += test_sub.tst
|
||||
TESTCASES += test_addc.tst
|
||||
TESTCASES += test_addi.tst
|
||||
TESTCASES += test_addic.tst
|
||||
TESTCASES += test_and_or.tst
|
||||
TESTCASES += test_bf.tst
|
||||
TESTCASES += test_bnf.tst
|
||||
TESTCASES += test_div.tst
|
||||
TESTCASES += test_divu.tst
|
||||
TESTCASES += test_extx.tst
|
||||
TESTCASES += test_fx.tst
|
||||
TESTCASES += test_jal.tst
|
||||
TESTCASES += test_j.tst
|
||||
TESTCASES += test_lf_div.tst
|
||||
TESTCASES += test_lf_eqs.tst
|
||||
TESTCASES += test_lf_ges.tst
|
||||
TESTCASES += test_lf_gts.tst
|
||||
TESTCASES += test_lf_les.tst
|
||||
TESTCASES += test_lf_lts.tst
|
||||
TESTCASES += test_lf_mul.tst
|
||||
TESTCASES += test_lf_nes.tst
|
||||
TESTCASES += test_lf_rem.tst
|
||||
TESTCASES += test_lf_sub.tst
|
||||
TESTCASES += test_lf_add.tst
|
||||
TESTCASES += test_logic.tst
|
||||
TESTCASES += test_lx.tst
|
||||
TESTCASES += test_movhi.tst
|
||||
TESTCASES += test_mul.tst
|
||||
TESTCASES += test_mulu.tst
|
||||
TESTCASES += test_muli.tst
|
||||
TESTCASES += test_sfeq.tst
|
||||
TESTCASES += test_sfeqi.tst
|
||||
TESTCASES += test_sfges.tst
|
||||
TESTCASES += test_sfgesi.tst
|
||||
TESTCASES += test_sfgeu.tst
|
||||
TESTCASES += test_sfgeui.tst
|
||||
TESTCASES += test_sfgts.tst
|
||||
TESTCASES += test_sfgtsi.tst
|
||||
TESTCASES += test_sfgtu.tst
|
||||
TESTCASES += test_sfgtui.tst
|
||||
TESTCASES += test_sfles.tst
|
||||
TESTCASES += test_sflesi.tst
|
||||
TESTCASES += test_sfleu.tst
|
||||
TESTCASES += test_sfleui.tst
|
||||
TESTCASES += test_sflts.tst
|
||||
TESTCASES += test_sfltsi.tst
|
||||
TESTCASES += test_sfltu.tst
|
||||
TESTCASES += test_sfltui.tst
|
||||
TESTCASES += test_sfne.tst
|
||||
TESTCASES += test_sfnei.tst
|
||||
|
||||
all: $(TESTCASES)
|
||||
|
||||
%.tst: %.c
|
||||
$(CC) -static $< -o $@
|
||||
|
||||
|
||||
check: $(TESTCASES)
|
||||
@for case in $(TESTCASES); do $(SIM) $$case; echo $$case pass!; sleep 0.2; done
|
||||
|
||||
clean:
|
||||
$(RM) -rf $(TESTCASES)
|
||||
@@ -0,0 +1,43 @@
|
||||
#include <stdio.h>
|
||||
|
||||
int main(void)
|
||||
{
|
||||
int a, b, d;
|
||||
int result;
|
||||
|
||||
a = 0x100;
|
||||
b = 0x100;
|
||||
result = 0x200;
|
||||
__asm
|
||||
("l.add %0, %0, %1\n\t"
|
||||
: "+r"(a)
|
||||
: "r"(b)
|
||||
);
|
||||
if (a != result) {
|
||||
printf("add error\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
a = 0xffff;
|
||||
b = 0x1;
|
||||
result = 0x10000;
|
||||
__asm
|
||||
("l.add %0, %0, %1\n\t"
|
||||
: "+r"(a)
|
||||
: "r"(b)
|
||||
);
|
||||
if (a != result) {
|
||||
printf("add error\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
a = 0x7fffffff;
|
||||
b = 0x1;
|
||||
__asm
|
||||
("l.add %0, %1, %2\n\t"
|
||||
: "=r"(d)
|
||||
: "r"(b), "r"(a)
|
||||
);
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
#include <stdio.h>
|
||||
|
||||
int main(void)
|
||||
{
|
||||
int a, b, c;
|
||||
int result;
|
||||
|
||||
b = 0x01;
|
||||
c = 0xffffffff;
|
||||
result = 1;
|
||||
__asm
|
||||
("l.addc %0, %1, %2\n\t"
|
||||
: "=r"(a)
|
||||
: "r"(b), "r"(c)
|
||||
);
|
||||
if (a != result) {
|
||||
printf("first addc error\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
b = 0x01;
|
||||
c = 0xffffffff;
|
||||
result = 0x80000001;
|
||||
__asm
|
||||
("l.addc %0, %1, %2\n\t"
|
||||
"l.movhi %2, 0x7fff\n\t"
|
||||
"l.ori %2, %2, 0xffff\n\t"
|
||||
"l.addc %0, %1, %2\n\t"
|
||||
: "=r"(a)
|
||||
: "r"(b), "r"(c)
|
||||
);
|
||||
if (a != result) {
|
||||
printf("addc error\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
#include <stdio.h>
|
||||
|
||||
int main(void)
|
||||
{
|
||||
int a, b;
|
||||
int result;
|
||||
|
||||
b = 0x01;
|
||||
result = 0x00;
|
||||
__asm
|
||||
("l.addi %0, %1, 0xffff\n\t"
|
||||
: "=r"(a)
|
||||
: "r"(b)
|
||||
);
|
||||
if (a != result) {
|
||||
printf("addi error\n\t");
|
||||
return -1;
|
||||
}
|
||||
|
||||
b = 0x010000;
|
||||
result = 0xffff;
|
||||
__asm
|
||||
("l.addi %0, %1, 0xffff\n\t"
|
||||
: "=r"(a)
|
||||
: "r"(b)
|
||||
);
|
||||
if (a != result) {
|
||||
printf("addi error\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
#include <stdio.h>
|
||||
|
||||
int main(void)
|
||||
{
|
||||
int a, b, c;
|
||||
int result;
|
||||
|
||||
a = 1;
|
||||
result = 0x1;
|
||||
__asm
|
||||
("l.addic %0, %0, 0xffff\n\t"
|
||||
: "+r"(a)
|
||||
);
|
||||
if (a != result) {
|
||||
printf("first addic error\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
a = 0x1;
|
||||
result = 0x201;
|
||||
__asm
|
||||
("l.addic %0, %0, 0xffff\n\t"
|
||||
"l.ori %0, r0, 0x100\n\t"
|
||||
"l.addic %0, %0, 0x100\n\t"
|
||||
: "+r"(a)
|
||||
);
|
||||
if (a != result) {
|
||||
printf("second addic error\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -0,0 +1,65 @@
|
||||
#include <stdio.h>
|
||||
|
||||
int main(void)
|
||||
{
|
||||
int a, b, c;
|
||||
int result;
|
||||
|
||||
b = 0x2;
|
||||
c = 0x1;
|
||||
result = 0;
|
||||
__asm
|
||||
("l.and %0, %1, %2\n\t"
|
||||
: "=r"(a)
|
||||
: "r"(b), "r"(c)
|
||||
);
|
||||
if (a != result) {
|
||||
printf("and error\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
result = 0x2;
|
||||
__asm
|
||||
("l.andi %0, %1, 0x3\n\t"
|
||||
: "=r"(a)
|
||||
: "r"(b)
|
||||
);
|
||||
if (a != result) {
|
||||
printf("andi error %x\n", a);
|
||||
return -1;
|
||||
}
|
||||
|
||||
result = 0x3;
|
||||
__asm
|
||||
("l.or %0, %1, %2\n\t"
|
||||
: "=r"(a)
|
||||
: "r"(b), "r"(c)
|
||||
);
|
||||
if (a != result) {
|
||||
printf("or error\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
result = 0x3;
|
||||
__asm
|
||||
("l.xor %0, %1, %2\n\t"
|
||||
: "=r"(a)
|
||||
: "r"(b), "r"(c)
|
||||
);
|
||||
if (a != result) {
|
||||
printf("xor error\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
__asm
|
||||
("l.xori %0, %1, 0x1\n\t"
|
||||
: "=r"(a)
|
||||
: "r"(b)
|
||||
);
|
||||
if (a != result) {
|
||||
printf("xori error\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -0,0 +1,47 @@
|
||||
#include <stdio.h>
|
||||
|
||||
int main(void)
|
||||
{
|
||||
int a, b, c;
|
||||
int result;
|
||||
|
||||
a = 0;
|
||||
b = 10;
|
||||
c = 11;
|
||||
result = 0x2;
|
||||
__asm
|
||||
("1:\n\t"
|
||||
"l.addi %1, %1, 0x01\n\t"
|
||||
"l.addi %0, %0, 0x01\n\t"
|
||||
"l.sfeq %1, %2\n\t"
|
||||
"l.bf 1b\n\t"
|
||||
"l.nop\n\t"
|
||||
: "+r"(a)
|
||||
: "r"(b), "r"(c)
|
||||
);
|
||||
if (a != result) {
|
||||
printf("sfeq error\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
a = 0x00;
|
||||
b = 0x11;
|
||||
c = 0x11;
|
||||
result = 0x01;
|
||||
__asm
|
||||
("1:\n\t"
|
||||
"l.addi %1, %1, 0x01\n\t"
|
||||
"l.addi %0, %0, 0x01\n\t"
|
||||
"l.sfeq %1, %2\n\t"
|
||||
"l.bf 1b\n\t"
|
||||
"l.nop\n\t"
|
||||
: "+r"(a)
|
||||
: "r"(b), "r"(c)
|
||||
);
|
||||
if (a != result) {
|
||||
printf("sfeq error\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -0,0 +1,51 @@
|
||||
#include <stdio.h>
|
||||
|
||||
int main(void)
|
||||
{
|
||||
int a, b;
|
||||
int result;
|
||||
|
||||
a = 0;
|
||||
b = 0;
|
||||
result = 0x3;
|
||||
__asm
|
||||
("l.sfeqi %1, 0x0\n\t"
|
||||
"l.bnf 1f\n\t"
|
||||
"l.nop\n\t"
|
||||
"\n\t"
|
||||
"l.addi %0, %0, 0x1\n\t"
|
||||
"l.addi %0, %0, 0x1\n\t"
|
||||
"\n\t"
|
||||
"1:\n\t"
|
||||
"l.addi %0, %0, 0x1\n\t"
|
||||
: "+r"(a)
|
||||
: "r"(b)
|
||||
);
|
||||
if (a != result) {
|
||||
printf("l.bnf error\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
a = 0;
|
||||
b = 0;
|
||||
result = 1;
|
||||
__asm
|
||||
("l.sfeqi %1, 0x1\n\t"
|
||||
"l.bnf 1f\n\t"
|
||||
"l.nop\n\t"
|
||||
"\n\t"
|
||||
"l.addi %0, %0, 0x1\n\t"
|
||||
"l.addi %0, %0, 0x1\n\t"
|
||||
"\n\t"
|
||||
"1:\n\t"
|
||||
"l.addi %0, %0, 0x1\n\t"
|
||||
: "+r"(a)
|
||||
: "r"(b)
|
||||
);
|
||||
if (a != result) {
|
||||
printf("l.bnf error\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -0,0 +1,54 @@
|
||||
#include <stdio.h>
|
||||
|
||||
int main(void)
|
||||
{
|
||||
int a, b, c;
|
||||
int result;
|
||||
|
||||
b = 0x120;
|
||||
c = 0x4;
|
||||
result = 0x48;
|
||||
__asm
|
||||
("l.div %0, %1, %2\n\t"
|
||||
: "=r"(a)
|
||||
: "r"(b), "r"(c)
|
||||
);
|
||||
if (a != result) {
|
||||
printf("div error\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
result = 0x4;
|
||||
__asm
|
||||
("l.div %0, %1, %0\n\t"
|
||||
: "+r"(a)
|
||||
: "r"(b)
|
||||
);
|
||||
if (a != result) {
|
||||
printf("div error\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
b = 0xffffffff;
|
||||
c = 0x80000000;
|
||||
result = 0;
|
||||
__asm
|
||||
("l.div %0, %1, %2\n\t"
|
||||
: "=r"(a)
|
||||
: "r"(b), "r"(c)
|
||||
);
|
||||
if (a != result) {
|
||||
printf("div error\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
b = 0x80000000;
|
||||
c = 0xffffffff;
|
||||
__asm
|
||||
("l.div %0, %1, %2\n\t"
|
||||
: "=r"(a)
|
||||
: "r"(b), "r"(c)
|
||||
);
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
#include <stdio.h>
|
||||
|
||||
int main(void)
|
||||
{
|
||||
int a, b, c;
|
||||
int result;
|
||||
|
||||
b = 0x120;
|
||||
c = 0x4;
|
||||
result = 0x48;
|
||||
|
||||
__asm
|
||||
("l.divu %0, %1, %2\n\t"
|
||||
: "=r"(a)
|
||||
: "r"(b), "r"(c)
|
||||
);
|
||||
if (a != result) {
|
||||
printf("divu error\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
result = 0x4;
|
||||
__asm
|
||||
("l.divu %0, %1, %0\n\t"
|
||||
: "+r"(a)
|
||||
: "r"(b)
|
||||
);
|
||||
if (a != result) {
|
||||
printf("divu error\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -0,0 +1,78 @@
|
||||
#include <stdio.h>
|
||||
|
||||
int main(void)
|
||||
{
|
||||
int a, b;
|
||||
int result;
|
||||
|
||||
b = 0x83;
|
||||
result = 0xffffff83;
|
||||
__asm
|
||||
("l.extbs %0, %1\n\t"
|
||||
: "=r"(a)
|
||||
: "r"(b)
|
||||
);
|
||||
if (a != result) {
|
||||
printf("extbs error\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
result = 0x83;
|
||||
__asm
|
||||
("l.extbz %0, %1\n\t"
|
||||
: "=r"(a)
|
||||
: "r"(b)
|
||||
);
|
||||
if (a != result) {
|
||||
printf("extbz error\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
b = 0x8083;
|
||||
result = 0xffff8083;
|
||||
__asm
|
||||
("l.exths %0, %1\n\t"
|
||||
: "=r"(a)
|
||||
: "r"(b)
|
||||
);
|
||||
if (a != result) {
|
||||
printf("exths error\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
result = 0x8083;
|
||||
__asm
|
||||
("l.exthz %0, %1\n\t"
|
||||
: "=r"(a)
|
||||
: "r"(b)
|
||||
);
|
||||
if (a != result) {
|
||||
printf("exthz error\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
b = 0x11;
|
||||
result = 0x11;
|
||||
__asm
|
||||
("l.extws %0, %1\n\t"
|
||||
: "=r"(a)
|
||||
: "r"(b)
|
||||
);
|
||||
|
||||
if (a != result) {
|
||||
printf("extws error\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
__asm
|
||||
("l.extwz %0, %1\n\t"
|
||||
: "=r"(a)
|
||||
: "r"(b)
|
||||
);
|
||||
if (a != result) {
|
||||
printf("extwz error\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -0,0 +1,57 @@
|
||||
#include <stdio.h>
|
||||
|
||||
int main(void)
|
||||
{
|
||||
int a, b;
|
||||
int result;
|
||||
|
||||
b = 0x123;
|
||||
result = 1;
|
||||
__asm
|
||||
("l.ff1 %0, %1\n\t"
|
||||
: "=r"(a)
|
||||
: "r"(b)
|
||||
);
|
||||
if (a != result) {
|
||||
printf("ff1 error\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
b = 0x0;
|
||||
result = 0;
|
||||
__asm
|
||||
("l.ff1 %0, %1\n\t"
|
||||
: "=r"(a)
|
||||
: "r"(b)
|
||||
);
|
||||
if (a != result) {
|
||||
printf("ff1 error\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
b = 0x123;
|
||||
result = 9;
|
||||
__asm
|
||||
("l.fl1 %0, %1\n\t"
|
||||
: "=r"(a)
|
||||
: "r"(b)
|
||||
);
|
||||
if (a != result) {
|
||||
printf("fl1 error\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
b = 0x0;
|
||||
result = 0;
|
||||
__asm
|
||||
("l.fl1 %0, %1\n\t"
|
||||
: "=r"(a)
|
||||
: "r"(b)
|
||||
);
|
||||
if (a != result) {
|
||||
printf("fl1 error\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
#include <stdio.h>
|
||||
|
||||
int main(void)
|
||||
{
|
||||
int a;
|
||||
int result;
|
||||
|
||||
a = 0;
|
||||
result = 2;
|
||||
__asm
|
||||
("l.addi %0, %0, 1\n\t"
|
||||
"l.j j\n\t"
|
||||
"l.nop\n\t"
|
||||
"l.addi %0, %0, 1\n\t"
|
||||
"l.nop\n\t"
|
||||
"j:\n\t"
|
||||
"l.addi %0, %0, 1\n\t"
|
||||
: "+r"(a)
|
||||
);
|
||||
if (a != result) {
|
||||
printf("j error\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
#include <stdio.h>
|
||||
|
||||
int main(void)
|
||||
{
|
||||
int a;
|
||||
int result;
|
||||
|
||||
a = 0;
|
||||
result = 2;
|
||||
__asm
|
||||
("l.addi %0, %0, 1\n\t"
|
||||
"l.jal jal\n\t"
|
||||
"l.nop\n\t"
|
||||
"l.addi %0, %0, 1\n\t"
|
||||
"l.nop\n\t"
|
||||
"jal:\n\t"
|
||||
"l.addi %0, %0, 1\n\t"
|
||||
: "+r"(a)
|
||||
);
|
||||
if (a != result) {
|
||||
printf("jal error\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
#include <stdio.h>
|
||||
|
||||
int main(void)
|
||||
{
|
||||
float a, b;
|
||||
float res2;
|
||||
|
||||
a = 1.5;
|
||||
b = 2.5;
|
||||
res2 = 4.0;
|
||||
__asm
|
||||
("lf.add.s %0, %0, %1\n\t"
|
||||
: "+r"(a)
|
||||
: "r"(b)
|
||||
);
|
||||
if (a != res2) {
|
||||
printf("lf.add.s error, %f\n", a);
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* double c, d;
|
||||
double res1;
|
||||
|
||||
c = 1.5;
|
||||
d = 1.5;
|
||||
res1 = 3.00;
|
||||
__asm
|
||||
("lf.add.d %0, %1, %2\n\t"
|
||||
: "+r"(c)
|
||||
: "r"(d)
|
||||
);
|
||||
|
||||
if ((e - res1) > 0.002) {
|
||||
printf("lf.add.d error, %f\n", e - res1);
|
||||
return -1;
|
||||
}*/
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
#include <stdio.h>
|
||||
|
||||
int main(void)
|
||||
{
|
||||
float a, b, c;
|
||||
float result;
|
||||
|
||||
b = 1.5;
|
||||
c = 0.5;
|
||||
result = 3.0;
|
||||
__asm
|
||||
("lf.div.s %0, %1, %2\n\t"
|
||||
: "=r"(a)
|
||||
: "r"(b), "r"(c)
|
||||
);
|
||||
if (a != result) {
|
||||
printf("lf.div.s error\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* double a, b, c, res;
|
||||
|
||||
b = 0x80000000;
|
||||
c = 0x40;
|
||||
result = 0x2000000;
|
||||
__asm
|
||||
("lf.div.d %0, %1, %2\n\t"
|
||||
: "=r"(a)
|
||||
: "r"(b), "r"(c)
|
||||
);
|
||||
if (a != result) {
|
||||
printf("lf.div.d error\n");
|
||||
return -1;
|
||||
}*/
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -0,0 +1,88 @@
|
||||
#include <stdio.h>
|
||||
|
||||
int main(void)
|
||||
{
|
||||
int a, result;
|
||||
float b, c;
|
||||
|
||||
a = 0x1;
|
||||
b = 122.5;
|
||||
c = 123.5;
|
||||
result = 0x3;
|
||||
__asm
|
||||
("lfeqd:\n\t"
|
||||
"l.addi %0, %0, 0x1\n\t"
|
||||
"lf.sfeq.s %1, %2\n\t"
|
||||
"l.bf lfeqd\n\t"
|
||||
"l.nop\n\t"
|
||||
"l.addi %0, %0, 0x1\n\t"
|
||||
: "+r"(a)
|
||||
: "r"(b), "r"(c)
|
||||
);
|
||||
if (a != result) {
|
||||
printf("lf.sfeq.s error\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
b = 13.5;
|
||||
c = 13.5;
|
||||
result = 0x3;
|
||||
__asm
|
||||
("lf.sfeq.s %1, %2\n\t"
|
||||
"l.bf 1f\n\t"
|
||||
"l.nop\n\t"
|
||||
"l.addi r4, r4, 0x1\n\t"
|
||||
"1:\n\t"
|
||||
: "+r"(a)
|
||||
: "r"(b), "r"(c)
|
||||
);
|
||||
if (a != result) {
|
||||
printf("lf.sfeq.s error\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* double b, c;
|
||||
double result;
|
||||
int a;
|
||||
|
||||
a = 0x1;
|
||||
b = 122.5;
|
||||
c = 133.5;
|
||||
result = 0x3;
|
||||
|
||||
__asm
|
||||
("lfeqd:\n\t"
|
||||
"l.addi %0, %0, 0x1\n\t"
|
||||
"lf.sfeq.d %1, %2\n\t"
|
||||
"l.bf lfeqd\n\t"
|
||||
"l.nop\n\t"
|
||||
"l.addi %0, %0, 0x1\n\t"
|
||||
: "+r"(a)
|
||||
: "r"(b), "r"(c)
|
||||
);
|
||||
if (a != result) {
|
||||
printf("lf.sfeq.d error\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
double c, d, res;
|
||||
int e = 0;
|
||||
c = 11.5;
|
||||
d = 11.5;
|
||||
res = 1;
|
||||
__asm
|
||||
("lf.sfeq.d %1, %2\n\t"
|
||||
"l.bf 1f\n\t"
|
||||
"l.nop\n\t"
|
||||
"l.addi %0, %0, 0x1\n\t"
|
||||
"1:\n\t"
|
||||
: "+r"(e)
|
||||
: "r"(c), "r"(d)
|
||||
);
|
||||
if (e != res) {
|
||||
printf("lf.sfeq.d error\n");
|
||||
return -1;
|
||||
}*/
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -0,0 +1,88 @@
|
||||
#include <stdio.h>
|
||||
|
||||
int main(void)
|
||||
{
|
||||
int a, result;
|
||||
float b, c;
|
||||
|
||||
a = 0;
|
||||
b = 122.5;
|
||||
c = 123.5;
|
||||
result = 0x1;
|
||||
__asm
|
||||
("lfges:\n\t"
|
||||
"l.addi %0, %0, 0x1\n\t"
|
||||
"lf.sfge.s %1, %2\n\t"
|
||||
"l.bf lfges\n\t"
|
||||
"l.nop\n\t"
|
||||
: "+r"(a)
|
||||
: "r"(b), "r"(c)
|
||||
);
|
||||
if (a != result) {
|
||||
printf("lf.sfge.s error\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
b = 133.5;
|
||||
c = 13.5;
|
||||
result = 0x3;
|
||||
__asm
|
||||
("l.addi %0, %0, 0x1\n\t"
|
||||
"l.addi %0, %0, 0x1\n\t"
|
||||
"lf.sfge.s %1, %2\n\t"
|
||||
"l.bf 1f\n\t"
|
||||
"l.nop\n\t"
|
||||
"l.addi %0, %0, 0x1\n\t"
|
||||
"l.addi %0, %0, 0x1\n\t"
|
||||
"1:\n\t"
|
||||
: "+r"(a)
|
||||
: "r"(b), "r"(c)
|
||||
);
|
||||
if (a != result) {
|
||||
printf("lf.sfge.s error\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* int a, result;
|
||||
double b, c;
|
||||
|
||||
a = 0x1;
|
||||
b = 122.5;
|
||||
c = 123.5;
|
||||
result = 0x2;
|
||||
__asm
|
||||
("lfged:\n\t"
|
||||
"l.addi %0, %0, 0x1\n\t"
|
||||
"lf.sfge.d %1, %2\n\t"
|
||||
"l.bf lfged\n\t"
|
||||
"l.nop\n\t"
|
||||
: "+r"(a)
|
||||
: "r"(b), "r"(c)
|
||||
);
|
||||
if (a != result) {
|
||||
printf("lf.sfge.d error\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
b = 133.5;
|
||||
c = 13.5;
|
||||
result = 0x4;
|
||||
__asm
|
||||
("lf.sfge.d %1, %2\n\t"
|
||||
"l.bf 1f\n\t"
|
||||
"l.nop\n\t"
|
||||
"l.addi %0, %0, 0x1\n\t"
|
||||
"l.addi %0, %0, 0x1\n\t"
|
||||
"1:\n\t"
|
||||
"l.addi %0, %0, 0x1\n\t"
|
||||
"l.addi %0, %0, 0x1\n\t"
|
||||
: "+r"(a)
|
||||
: "r"(b), "r"(c)
|
||||
);
|
||||
if (a != result) {
|
||||
printf("lf.sfge.d error\n");
|
||||
return -1;
|
||||
}*/
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -0,0 +1,86 @@
|
||||
#include <stdio.h>
|
||||
|
||||
int main(void)
|
||||
{
|
||||
int a, result;
|
||||
float b, c;
|
||||
|
||||
a = 0;
|
||||
b = 122.5;
|
||||
c = 123.5;
|
||||
result = 0x1;
|
||||
__asm
|
||||
("lfgts:\n\t"
|
||||
"l.addi %0, %0, 0x1\n\t"
|
||||
"lf.sfgt.s %1, %2\n\t"
|
||||
"l.bf lfgts\n\t"
|
||||
"l.nop\n\t"
|
||||
: "+r"(a)
|
||||
: "r"(b), "r"(c)
|
||||
);
|
||||
if (a != result) {
|
||||
printf("lf.sfgt.s error\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
b = 133.5;
|
||||
c = 13.5;
|
||||
result = 0x1;
|
||||
__asm
|
||||
("lf.sfgt.s %1, %2\n\t"
|
||||
"l.bf 1f\n\t"
|
||||
"l.nop\n\t"
|
||||
"l.addi %0, %0, 0x1\n\t"
|
||||
"l.addi %0, %0, 0x1\n\t"
|
||||
"1:\n\t"
|
||||
: "+r"(a)
|
||||
: "r"(b), "r"(c)
|
||||
);
|
||||
if (a != result) {
|
||||
printf("lf.sfgt.s error\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* int a, result;
|
||||
double b, c;
|
||||
|
||||
a = 0;
|
||||
b = 122.5;
|
||||
c = 123.5;
|
||||
result = 0x1;
|
||||
__asm
|
||||
("lfgtd:\n\t"
|
||||
"l.addi %0, %0, 0x1\n\t"
|
||||
"lf.sfgt.d %1, %2\n\t"
|
||||
"l.bf lfgtd\n\t"
|
||||
"l.nop\n\t"
|
||||
: "+r"(a)
|
||||
: "r"(b), "r"(c)
|
||||
);
|
||||
if (a != result) {
|
||||
printf("lf.sfgt.d error\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
b = 133.5;
|
||||
c = 13.5;
|
||||
result = 0x3;
|
||||
__asm
|
||||
("l.addi %0, %0, 0x1\n\t"
|
||||
"l.addi %0, %0, 0x1\n\t"
|
||||
"lf.sfgt.d %1, %2\n\t"
|
||||
"l.bf 1f\n\t"
|
||||
"l.nop\n\t"
|
||||
"l.addi %0, %0, 0x1\n\t"
|
||||
"l.addi %0, %0, 0x1\n\t"
|
||||
"1:\n\t"
|
||||
: "+r"(a)
|
||||
: "r"(b), "r"(c)
|
||||
);
|
||||
if (a != result) {
|
||||
printf("lf.sfgt.d error, %x\n", a);
|
||||
return -1;
|
||||
}*/
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -0,0 +1,88 @@
|
||||
#include <stdio.h>
|
||||
|
||||
int main(void)
|
||||
{
|
||||
int a;
|
||||
float b, c;
|
||||
int result;
|
||||
|
||||
a = 0;
|
||||
b = 1234.2;
|
||||
c = 12.4;
|
||||
result = 0x1;
|
||||
__asm
|
||||
("lfles:\n\t"
|
||||
"l.addi %0, %0, 0x1\n\t"
|
||||
"lf.sfle.s %1, %2\n\t"
|
||||
"l.bf lfles\n\t"
|
||||
"l.nop\n\t"
|
||||
: "+r"(a)
|
||||
: "r"(b), "r"(c)
|
||||
);
|
||||
if (a != result) {
|
||||
printf("lf.sfle.s error\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
b = 1.1;
|
||||
c = 19.4;
|
||||
result = 0x3;
|
||||
__asm
|
||||
("l.addi %0, %0, 0x1\n\t"
|
||||
"l.addi %0, %0, 0x1\n\t"
|
||||
"lf.sfle.s %1, %2\n\t"
|
||||
"l.bf 1f\n\t"
|
||||
"l.nop\n\t"
|
||||
"l.addi %0, %0, 0x1\n\t"
|
||||
"l.addi %0, %0, 0x1\n\t"
|
||||
"1:\n\t"
|
||||
: "+r"(a)
|
||||
: "r"(b), "r"(c)
|
||||
);
|
||||
if (a != result) {
|
||||
printf("lf.sfle.s error\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* int a;
|
||||
double b, c;
|
||||
int result;
|
||||
|
||||
a = 0;
|
||||
b = 1212.5;
|
||||
c = 123.5;
|
||||
result = 0x1;
|
||||
__asm
|
||||
("lfled:\n\t"
|
||||
"l.addi %0, %0, 0x1\n\t"
|
||||
"lf.sfle.d %1, %2\n\t"
|
||||
"l.bf lfled\n\t"
|
||||
"l.nop\n\t"
|
||||
: "+r"(a)
|
||||
: "r"(b), "r"(c)
|
||||
);
|
||||
if (a != result) {
|
||||
printf("lf.sfle.d error\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
b = 13.5;
|
||||
c = 113.5;
|
||||
result = 0x2;
|
||||
__asm
|
||||
("l.addi %0, %0, 0x1\n\t"
|
||||
"lf.sfle.d %1, %2\n\t"
|
||||
"l.bf 1f\n\t"
|
||||
"l.nop\n\t"
|
||||
"l.addi %0, %0, 0x1\n\t"
|
||||
"1:\n\t"
|
||||
: "+r"(a)
|
||||
: "r"(b), "r"(c)
|
||||
);
|
||||
if (a != result) {
|
||||
printf("lf.sfle.d error\n");
|
||||
return -1;
|
||||
}*/
|
||||
|
||||
return 0;
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user