Revision c09015dd
b/Makefile | ||
---|---|---|
241 | 241 |
rm -f trace-dtrace.h trace-dtrace.h-timestamp |
242 | 242 |
rm -f $(GENERATED_SOURCES) |
243 | 243 |
rm -rf $(qapi-dir) |
244 |
$(MAKE) -C tests clean |
|
244 |
$(MAKE) -C tests/tcg clean
|
|
245 | 245 |
for d in $(ALL_SUBDIRS) $(QEMULIBS) libcacard; do \ |
246 | 246 |
if test -d $$d; then $(MAKE) -C $$d $@ || exit 1; fi; \ |
247 | 247 |
rm -f $$d/qemu-options.def; \ |
... | ... | |
319 | 319 |
|
320 | 320 |
# various test targets |
321 | 321 |
test speed: all |
322 |
$(MAKE) -C tests $@ |
|
322 |
$(MAKE) -C tests/tcg $@
|
|
323 | 323 |
|
324 | 324 |
.PHONY: check |
325 | 325 |
check: $(patsubst %,run-check-%,$(CHECKS)) |
b/configure | ||
---|---|---|
3809 | 3809 |
done # for target in $targets |
3810 | 3810 |
|
3811 | 3811 |
# build tree in object directory in case the source is not in the current directory |
3812 |
DIRS="tests tests/cris slirp audio block net pc-bios/optionrom" |
|
3812 |
DIRS="tests tests/tcg tests/tcg/cris slirp audio block net pc-bios/optionrom"
|
|
3813 | 3813 |
DIRS="$DIRS pc-bios/spapr-rtas" |
3814 | 3814 |
DIRS="$DIRS roms/seabios roms/vgabios" |
3815 | 3815 |
DIRS="$DIRS fsdev ui" |
3816 | 3816 |
DIRS="$DIRS qapi qapi-generated" |
3817 | 3817 |
DIRS="$DIRS qga trace" |
3818 |
FILES="Makefile tests/Makefile qdict-test-data.txt" |
|
3819 |
FILES="$FILES tests/cris/Makefile tests/cris/.gdbinit"
|
|
3818 |
FILES="Makefile tests/tcg/Makefile qdict-test-data.txt"
|
|
3819 |
FILES="$FILES tests/tcg/cris/Makefile tests/tcg/cris/.gdbinit"
|
|
3820 | 3820 |
FILES="$FILES pc-bios/optionrom/Makefile pc-bios/keymaps" |
3821 | 3821 |
FILES="$FILES pc-bios/spapr-rtas/Makefile" |
3822 | 3822 |
FILES="$FILES roms/seabios/Makefile roms/vgabios/Makefile" |
/dev/null | ||
---|---|---|
1 |
-include ../config-host.mak |
|
2 |
-include $(SRC_PATH)/rules.mak |
|
3 |
|
|
4 |
$(call set-vpath, $(SRC_PATH)/tests) |
|
5 |
|
|
6 |
QEMU=../i386-linux-user/qemu-i386 |
|
7 |
QEMU_X86_64=../x86_64-linux-user/qemu-x86_64 |
|
8 |
CC_X86_64=$(CC_I386) -m64 |
|
9 |
|
|
10 |
QEMU_INCLUDES += -I.. |
|
11 |
CFLAGS=-Wall -O2 -g -fno-strict-aliasing |
|
12 |
#CFLAGS+=-msse2 |
|
13 |
LDFLAGS= |
|
14 |
|
|
15 |
# TODO: automatically detect ARM and MIPS compilers, and run those too |
|
16 |
|
|
17 |
# runcom maps page 0, so it requires root privileges |
|
18 |
# also, pi_10.com runs indefinitely |
|
19 |
|
|
20 |
I386_TESTS=hello-i386 \ |
|
21 |
linux-test \ |
|
22 |
testthread \ |
|
23 |
sha1-i386 \ |
|
24 |
test-i386 \ |
|
25 |
test-mmap \ |
|
26 |
# runcom |
|
27 |
|
|
28 |
# native i386 compilers sometimes are not biarch. assume cross-compilers are |
|
29 |
ifneq ($(ARCH),i386) |
|
30 |
I386_TESTS+=run-test-x86_64 |
|
31 |
endif |
|
32 |
|
|
33 |
TESTS = test_path |
|
34 |
ifneq ($(call find-in-path, $(CC_I386)),) |
|
35 |
TESTS += $(I386_TESTS) |
|
36 |
endif |
|
37 |
|
|
38 |
all: $(patsubst %,run-%,$(TESTS)) |
|
39 |
|
|
40 |
# rules to run tests |
|
41 |
|
|
42 |
.PHONY: $(patsubst %,run-%,$(TESTS)) |
|
43 |
|
|
44 |
run-%: % |
|
45 |
-$(QEMU) ./$* |
|
46 |
|
|
47 |
run-hello-i386: hello-i386 |
|
48 |
run-linux-test: linux-test |
|
49 |
run-testthread: testthread |
|
50 |
run-sha1-i386: sha1-i386 |
|
51 |
|
|
52 |
run-test-i386: test-i386 |
|
53 |
./test-i386 > test-i386.ref |
|
54 |
-$(QEMU) test-i386 > test-i386.out |
|
55 |
@if diff -u test-i386.ref test-i386.out ; then echo "Auto Test OK"; fi |
|
56 |
|
|
57 |
run-test-x86_64: test-x86_64 |
|
58 |
./test-x86_64 > test-x86_64.ref |
|
59 |
-$(QEMU_X86_64) test-x86_64 > test-x86_64.out |
|
60 |
@if diff -u test-x86_64.ref test-x86_64.out ; then echo "Auto Test OK"; fi |
|
61 |
|
|
62 |
run-test-mmap: test-mmap |
|
63 |
-$(QEMU) ./test-mmap |
|
64 |
-$(QEMU) -p 8192 ./test-mmap 8192 |
|
65 |
-$(QEMU) -p 16384 ./test-mmap 16384 |
|
66 |
-$(QEMU) -p 32768 ./test-mmap 32768 |
|
67 |
|
|
68 |
run-runcom: runcom |
|
69 |
-$(QEMU) ./runcom $(SRC_PATH)/tests/pi_10.com |
|
70 |
|
|
71 |
run-test_path: test_path |
|
72 |
./test_path |
|
73 |
|
|
74 |
# rules to compile tests |
|
75 |
|
|
76 |
test_path: test_path.o |
|
77 |
test_path.o: test_path.c |
|
78 |
|
|
79 |
hello-i386: hello-i386.c |
|
80 |
$(CC_I386) -nostdlib $(CFLAGS) -static $(LDFLAGS) -o $@ $< |
|
81 |
strip $@ |
|
82 |
|
|
83 |
testthread: testthread.c |
|
84 |
$(CC_I386) $(CFLAGS) $(LDFLAGS) -o $@ $< -lpthread |
|
85 |
|
|
86 |
# i386/x86_64 emulation test (test various opcodes) */ |
|
87 |
test-i386: test-i386.c test-i386-code16.S test-i386-vm86.S \ |
|
88 |
test-i386.h test-i386-shift.h test-i386-muldiv.h |
|
89 |
$(CC_I386) $(CFLAGS) $(LDFLAGS) -o $@ \ |
|
90 |
$(<D)/test-i386.c $(<D)/test-i386-code16.S $(<D)/test-i386-vm86.S -lm |
|
91 |
|
|
92 |
test-x86_64: test-i386.c \ |
|
93 |
test-i386.h test-i386-shift.h test-i386-muldiv.h |
|
94 |
$(CC_X86_64) $(CFLAGS) $(LDFLAGS) -o $@ $(<D)/test-i386.c -lm |
|
95 |
|
|
96 |
# generic Linux and CPU test |
|
97 |
linux-test: linux-test.c |
|
98 |
$(CC_I386) $(CFLAGS) $(LDFLAGS) -o $@ $< -lm |
|
99 |
|
|
100 |
# vm86 test |
|
101 |
runcom: runcom.c |
|
102 |
$(CC_I386) $(CFLAGS) $(LDFLAGS) -o $@ $< |
|
103 |
|
|
104 |
test-mmap: test-mmap.c |
|
105 |
$(CC_I386) -m32 $(CFLAGS) -Wall -O2 $(LDFLAGS) -o $@ $< |
|
106 |
|
|
107 |
# speed test |
|
108 |
sha1-i386: sha1.c |
|
109 |
$(CC_I386) $(CFLAGS) $(LDFLAGS) -o $@ $< |
|
110 |
|
|
111 |
sha1: sha1.c |
|
112 |
$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $< |
|
113 |
|
|
114 |
speed: sha1 sha1-i386 |
|
115 |
time ./sha1 |
|
116 |
time $(QEMU) ./sha1-i386 |
|
117 |
|
|
118 |
# arm test |
|
119 |
hello-arm: hello-arm.o |
|
120 |
arm-linux-ld -o $@ $< |
|
121 |
|
|
122 |
hello-arm.o: hello-arm.c |
|
123 |
arm-linux-gcc -Wall -g -O2 -c -o $@ $< |
|
124 |
|
|
125 |
test-arm-iwmmxt: test-arm-iwmmxt.s |
|
126 |
cpp < $< | arm-linux-gnu-gcc -Wall -static -march=iwmmxt -mabi=aapcs -x assembler - -o $@ |
|
127 |
|
|
128 |
# MIPS test |
|
129 |
hello-mips: hello-mips.c |
|
130 |
mips-linux-gnu-gcc -nostdlib -static -mno-abicalls -fno-PIC -mabi=32 -Wall -Wextra -g -O2 -o $@ $< |
|
131 |
|
|
132 |
hello-mipsel: hello-mips.c |
|
133 |
mipsel-linux-gnu-gcc -nostdlib -static -mno-abicalls -fno-PIC -mabi=32 -Wall -Wextra -g -O2 -o $@ $< |
|
134 |
|
|
135 |
# testsuite for the CRIS port. |
|
136 |
test-cris: |
|
137 |
$(MAKE) -C cris check |
|
138 |
|
|
139 |
# testsuite for the LM32 port. |
|
140 |
test-lm32: |
|
141 |
$(MAKE) -C lm32 check |
|
142 |
|
|
143 |
clean: |
|
144 |
rm -f *~ *.o test-i386.out test-i386.ref \ |
|
145 |
test-x86_64.log test-x86_64.ref qruncom $(TESTS) |
/dev/null | ||
---|---|---|
1 |
CROSS=alpha-linux-gnu- |
|
2 |
CC=$(CROSS)gcc |
|
3 |
AS=$(CROSS)as |
|
4 |
|
|
5 |
SIM=../../alpha-linux-user/qemu-alpha |
|
6 |
|
|
7 |
CFLAGS=-O |
|
8 |
LINK=$(CC) -o $@ crt.o $< -nostdlib |
|
9 |
|
|
10 |
TESTS=test-cond test-cmov |
|
11 |
|
|
12 |
all: hello-alpha $(TESTS) |
|
13 |
|
|
14 |
hello-alpha: hello-alpha.o crt.o |
|
15 |
$(LINK) |
|
16 |
|
|
17 |
test-cond: test-cond.o crt.o |
|
18 |
$(LINK) |
|
19 |
|
|
20 |
test-cmov.o: test-cond.c |
|
21 |
$(CC) -c $(CFLAGS) -DTEST_CMOV -o $@ $< |
|
22 |
|
|
23 |
test-cmov: test-cmov.o crt.o |
|
24 |
$(LINK) |
|
25 |
|
|
26 |
test-ovf: test-ovf.o crt.o |
|
27 |
$(LINK) |
|
28 |
|
|
29 |
check: $(TESTS) |
|
30 |
for f in $(TESTS); do $(SIM) $$f || exit 1; done |
|
31 |
|
|
32 |
clean: |
|
33 |
$(RM) *.o *~ hello-alpha $(TESTS) |
|
34 |
|
|
35 |
.PHONY: clean all check |
/dev/null | ||
---|---|---|
1 |
.text |
|
2 |
|
|
3 |
.globl _start |
|
4 |
.ent _start,0 |
|
5 |
_start: |
|
6 |
.frame $15,0,$15 |
|
7 |
br $29,1f |
|
8 |
1: ldgp $29, 0($29) |
|
9 |
.prologue 0 |
|
10 |
ldq $27,main($29) !literal!1 |
|
11 |
jsr $26,($27) |
|
12 |
or $0,$0,$16 |
|
13 |
.end _start |
|
14 |
|
|
15 |
.globl _exit |
|
16 |
_exit: |
|
17 |
lda $0,1 |
|
18 |
callsys |
|
19 |
|
|
20 |
call_pal 0 |
|
21 |
|
|
22 |
.globl write |
|
23 |
write: |
|
24 |
lda $0,4 |
|
25 |
callsys |
|
26 |
ret |
/dev/null | ||
---|---|---|
1 |
int main (void) |
|
2 |
{ |
|
3 |
write (1, "hello\n", 6); |
|
4 |
return 0; |
|
5 |
} |
/dev/null | ||
---|---|---|
1 |
|
|
2 |
#ifdef TEST_CMOV |
|
3 |
|
|
4 |
#define TEST_COND(N) \ |
|
5 |
int test_##N (long a) \ |
|
6 |
{ \ |
|
7 |
int res = 1; \ |
|
8 |
\ |
|
9 |
asm ("cmov"#N" %1,$31,%0" \ |
|
10 |
: "+r" (res) : "r" (a)); \ |
|
11 |
return !res; \ |
|
12 |
} |
|
13 |
|
|
14 |
#else |
|
15 |
|
|
16 |
#define TEST_COND(N) \ |
|
17 |
int test_##N (long a) \ |
|
18 |
{ \ |
|
19 |
int res = 1; \ |
|
20 |
\ |
|
21 |
asm ("b"#N" %1,1f\n\t" \ |
|
22 |
"addq $31,$31,%0\n\t" \ |
|
23 |
"1: unop\n" \ |
|
24 |
: "+r" (res) : "r" (a)); \ |
|
25 |
return res; \ |
|
26 |
} |
|
27 |
|
|
28 |
#endif |
|
29 |
|
|
30 |
TEST_COND(eq) |
|
31 |
TEST_COND(ne) |
|
32 |
TEST_COND(ge) |
|
33 |
TEST_COND(gt) |
|
34 |
TEST_COND(lbc) |
|
35 |
TEST_COND(lbs) |
|
36 |
TEST_COND(le) |
|
37 |
TEST_COND(lt) |
|
38 |
|
|
39 |
static struct { |
|
40 |
int (*func)(long); |
|
41 |
long v; |
|
42 |
int r; |
|
43 |
} vectors[] = |
|
44 |
{ |
|
45 |
{test_eq, 0, 1}, |
|
46 |
{test_eq, 1, 0}, |
|
47 |
|
|
48 |
{test_ne, 0, 0}, |
|
49 |
{test_ne, 1, 1}, |
|
50 |
|
|
51 |
{test_ge, 0, 1}, |
|
52 |
{test_ge, 1, 1}, |
|
53 |
{test_ge, -1, 0}, |
|
54 |
|
|
55 |
{test_gt, 0, 0}, |
|
56 |
{test_gt, 1, 1}, |
|
57 |
{test_gt, -1, 0}, |
|
58 |
|
|
59 |
{test_lbc, 0, 1}, |
|
60 |
{test_lbc, 1, 0}, |
|
61 |
{test_lbc, -1, 0}, |
|
62 |
|
|
63 |
{test_lbs, 0, 0}, |
|
64 |
{test_lbs, 1, 1}, |
|
65 |
{test_lbs, -1, 1}, |
|
66 |
|
|
67 |
{test_le, 0, 1}, |
|
68 |
{test_le, 1, 0}, |
|
69 |
{test_le, -1, 1}, |
|
70 |
|
|
71 |
{test_lt, 0, 0}, |
|
72 |
{test_lt, 1, 0}, |
|
73 |
{test_lt, -1, 1}, |
|
74 |
}; |
|
75 |
|
|
76 |
int main (void) |
|
77 |
{ |
|
78 |
int i; |
|
79 |
|
|
80 |
for (i = 0; i < sizeof (vectors)/sizeof(vectors[0]); i++) |
|
81 |
if ((*vectors[i].func)(vectors[i].v) != vectors[i].r) { |
|
82 |
write(1, "Failed\n", 7); |
|
83 |
return 1; |
|
84 |
} |
|
85 |
write(1, "OK\n", 3); |
|
86 |
return 0; |
|
87 |
} |
/dev/null | ||
---|---|---|
1 |
static long test_subqv (long a, long b) |
|
2 |
{ |
|
3 |
long res; |
|
4 |
|
|
5 |
asm ("subq/v %1,%2,%0" |
|
6 |
: "=r" (res) : "r" (a), "r" (b)); |
|
7 |
return res; |
|
8 |
} |
|
9 |
static struct { |
|
10 |
long (*func)(long, long); |
|
11 |
long a; |
|
12 |
long b; |
|
13 |
long r; |
|
14 |
} vectors[] = |
|
15 |
{ |
|
16 |
{test_subqv, 0, 0x7d54000, 0xfffffffff82ac000L} |
|
17 |
}; |
|
18 |
|
|
19 |
int main (void) |
|
20 |
{ |
|
21 |
int i; |
|
22 |
|
|
23 |
for (i = 0; i < sizeof (vectors)/sizeof(vectors[0]); i++) |
|
24 |
if ((*vectors[i].func)(vectors[i].a, vectors[i].b) != vectors[i].r) { |
|
25 |
write(1, "Failed\n", 7); |
|
26 |
} |
|
27 |
write(1, "OK\n", 3); |
|
28 |
return 0; |
|
29 |
} |
/dev/null | ||
---|---|---|
1 |
b main |
|
2 |
b _fail |
|
3 |
b exit |
|
4 |
display /i $pc |
|
5 |
display /x $srp |
|
6 |
display /x $r0 |
|
7 |
display /x $r1 |
|
8 |
display /x $r2 |
|
9 |
display /x $r3 |
|
10 |
display /x $r4 |
|
11 |
display /t $ccs |
/dev/null | ||
---|---|---|
1 |
-include ../../config-host.mak |
|
2 |
|
|
3 |
CROSS=crisv32-axis-linux-gnu- |
|
4 |
SIM=../../cris-linux-user/qemu-cris -L ./ |
|
5 |
SIMG=cris-axis-linux-gnu-run --sysroot=./ |
|
6 |
|
|
7 |
CC = $(CROSS)gcc |
|
8 |
#AS = $(CROSS)as |
|
9 |
AS = $(CC) -x assembler-with-cpp |
|
10 |
SIZE = $(CROSS)size |
|
11 |
LD = $(CC) |
|
12 |
OBJCOPY = $(CROSS)objcopy |
|
13 |
|
|
14 |
# we rely on GCC inline:ing the stuff we tell it to in many places here. |
|
15 |
CFLAGS = -Winline -Wall -g -O2 -static |
|
16 |
NOSTDFLAGS = -nostartfiles -nostdlib |
|
17 |
ASFLAGS += -g -Wa,-I,$(SRC_PATH)/tests/cris/ |
|
18 |
LDLIBS = |
|
19 |
NOSTDLIBS = -lgcc |
|
20 |
|
|
21 |
CRT = crt.o |
|
22 |
SYS = sys.o |
|
23 |
TESTCASES += check_abs.tst |
|
24 |
TESTCASES += check_addc.tst |
|
25 |
TESTCASES += check_addcm.tst |
|
26 |
TESTCASES += check_addo.tst |
|
27 |
TESTCASES += check_addoq.tst |
|
28 |
TESTCASES += check_addi.tst |
|
29 |
TESTCASES += check_addiv32.tst |
|
30 |
TESTCASES += check_addm.tst |
|
31 |
TESTCASES += check_addr.tst |
|
32 |
TESTCASES += check_addq.tst |
|
33 |
TESTCASES += check_addxc.tst |
|
34 |
TESTCASES += check_addxm.tst |
|
35 |
TESTCASES += check_addxr.tst |
|
36 |
TESTCASES += check_andc.tst |
|
37 |
TESTCASES += check_andm.tst |
|
38 |
TESTCASES += check_andr.tst |
|
39 |
TESTCASES += check_andq.tst |
|
40 |
TESTCASES += check_asr.tst |
|
41 |
TESTCASES += check_ba.tst |
|
42 |
TESTCASES += check_bas.tst |
|
43 |
TESTCASES += check_bcc.tst |
|
44 |
TESTCASES += check_bound.tst |
|
45 |
TESTCASES += check_boundc.tst |
|
46 |
TESTCASES += check_boundr.tst |
|
47 |
TESTCASES += check_btst.tst |
|
48 |
TESTCASES += check_clearfv32.tst |
|
49 |
TESTCASES += check_cmpc.tst |
|
50 |
TESTCASES += check_cmpr.tst |
|
51 |
TESTCASES += check_cmpq.tst |
|
52 |
TESTCASES += check_cmpm.tst |
|
53 |
TESTCASES += check_cmpxc.tst |
|
54 |
TESTCASES += check_cmpxm.tst |
|
55 |
TESTCASES += check_cmp-2.tst |
|
56 |
TESTCASES += check_clrjmp1.tst |
|
57 |
TESTCASES += check_dstep.tst |
|
58 |
TESTCASES += check_ftag.tst |
|
59 |
TESTCASES += check_int64.tst |
|
60 |
# check_jsr is broken. |
|
61 |
#TESTCASES += check_jsr.tst |
|
62 |
TESTCASES += check_mcp.tst |
|
63 |
TESTCASES += check_movei.tst |
|
64 |
TESTCASES += check_mover.tst |
|
65 |
TESTCASES += check_moverm.tst |
|
66 |
TESTCASES += check_moveq.tst |
|
67 |
TESTCASES += check_movemr.tst |
|
68 |
TESTCASES += check_movemrv32.tst |
|
69 |
TESTCASES += check_movecr.tst |
|
70 |
TESTCASES += check_movmp.tst |
|
71 |
TESTCASES += check_movpr.tst |
|
72 |
TESTCASES += check_movprv32.tst |
|
73 |
TESTCASES += check_movdelsr1.tst |
|
74 |
TESTCASES += check_movpmv32.tst |
|
75 |
TESTCASES += check_movsr.tst |
|
76 |
TESTCASES += check_movsm.tst |
|
77 |
TESTCASES += check_movscr.tst |
|
78 |
TESTCASES += check_movur.tst |
|
79 |
TESTCASES += check_movum.tst |
|
80 |
TESTCASES += check_movucr.tst |
|
81 |
TESTCASES += check_mulx.tst |
|
82 |
TESTCASES += check_mulv32.tst |
|
83 |
TESTCASES += check_neg.tst |
|
84 |
TESTCASES += check_not.tst |
|
85 |
TESTCASES += check_lz.tst |
|
86 |
TESTCASES += check_lapc.tst |
|
87 |
TESTCASES += check_lsl.tst |
|
88 |
TESTCASES += check_lsr.tst |
|
89 |
TESTCASES += check_orc.tst |
|
90 |
TESTCASES += check_orm.tst |
|
91 |
TESTCASES += check_orr.tst |
|
92 |
TESTCASES += check_orq.tst |
|
93 |
TESTCASES += check_ret.tst |
|
94 |
TESTCASES += check_swap.tst |
|
95 |
TESTCASES += check_scc.tst |
|
96 |
TESTCASES += check_subc.tst |
|
97 |
TESTCASES += check_subq.tst |
|
98 |
TESTCASES += check_subr.tst |
|
99 |
TESTCASES += check_subm.tst |
|
100 |
TESTCASES += check_glibc_kernelversion.tst |
|
101 |
TESTCASES += check_xarith.tst |
|
102 |
|
|
103 |
TESTCASES += check_hello.ctst |
|
104 |
TESTCASES += check_stat1.ctst |
|
105 |
TESTCASES += check_stat2.ctst |
|
106 |
TESTCASES += check_stat3.ctst |
|
107 |
TESTCASES += check_stat4.ctst |
|
108 |
TESTCASES += check_openpf1.ctst |
|
109 |
TESTCASES += check_openpf2.ctst |
|
110 |
TESTCASES += check_openpf3.ctst |
|
111 |
TESTCASES += check_openpf4.ctst |
|
112 |
TESTCASES += check_openpf5.ctst |
|
113 |
TESTCASES += check_mapbrk.ctst |
|
114 |
TESTCASES += check_mmap1.ctst |
|
115 |
TESTCASES += check_mmap2.ctst |
|
116 |
TESTCASES += check_mmap3.ctst |
|
117 |
TESTCASES += check_sigalrm.ctst |
|
118 |
TESTCASES += check_time1.ctst |
|
119 |
TESTCASES += check_time2.ctst |
|
120 |
TESTCASES += check_settls1.ctst |
|
121 |
|
|
122 |
TESTCASES += check_gcctorture_pr28634-1.ctst |
|
123 |
#TESTCASES += check_gcctorture_pr28634.ctst |
|
124 |
|
|
125 |
all: build |
|
126 |
|
|
127 |
%.o: $(SRC_PATH)/tests/cris/%.c |
|
128 |
$(CC) $(CFLAGS) -c $< -o $@ |
|
129 |
|
|
130 |
%.o: $(SRC_PATH)/tests/cris/%.s |
|
131 |
$(AS) $(ASFLAGS) -c $< -o $@ |
|
132 |
|
|
133 |
%.tst: %.o |
|
134 |
$(CC) $(CFLAGS) $(NOSTDFLAGS) $(LDLIBS) $(NOSTDLIBS) $(CRT) $< $(SYS) -o $@ |
|
135 |
|
|
136 |
%.ctst: %.o |
|
137 |
$(CC) $(CFLAGS) $(LDLIBS) $< -o $@ |
|
138 |
|
|
139 |
build: $(CRT) $(SYS) $(TESTCASES) |
|
140 |
|
|
141 |
check: $(CRT) $(SYS) $(TESTCASES) |
|
142 |
@echo -e "\nQEMU simulator." |
|
143 |
for case in $(TESTCASES); do \ |
|
144 |
echo -n "$$case "; \ |
|
145 |
$(SIM) ./$$case; \ |
|
146 |
done |
|
147 |
check-g: $(CRT) $(SYS) $(TESTCASES) |
|
148 |
@echo -e "\nGDB simulator." |
|
149 |
@for case in $(TESTCASES); do \ |
|
150 |
echo -n "$$case "; \ |
|
151 |
$(SIMG) $$case; \ |
|
152 |
done |
|
153 |
|
|
154 |
clean: |
|
155 |
$(RM) -fr $(TESTCASES) $(CRT) $(SYS) |
/dev/null | ||
---|---|---|
1 |
Test-suite for the cris port. Heavily based on the test-suite for the CRIS port of sim by Hans-Peter Nilsson. |
/dev/null | ||
---|---|---|
1 |
#include <stdio.h> |
|
2 |
#include <stdlib.h> |
|
3 |
#include <stdint.h> |
|
4 |
#include "sys.h" |
|
5 |
#include "crisutils.h" |
|
6 |
|
|
7 |
static inline int cris_abs(int n) |
|
8 |
{ |
|
9 |
int r; |
|
10 |
asm ("abs\t%1, %0\n" : "=r" (r) : "r" (n)); |
|
11 |
return r; |
|
12 |
} |
|
13 |
|
|
14 |
static inline void |
|
15 |
verify_abs(int val, int res, |
|
16 |
const int n, const int z, const int v, const int c) |
|
17 |
{ |
|
18 |
int r; |
|
19 |
|
|
20 |
cris_tst_cc_init(); |
|
21 |
r = cris_abs(val); |
|
22 |
cris_tst_cc(n, z, v, c); |
|
23 |
if (r != res) |
|
24 |
err(); |
|
25 |
} |
|
26 |
|
|
27 |
int main(void) |
|
28 |
{ |
|
29 |
verify_abs(-1, 1, 0, 0, 0, 0); |
|
30 |
verify_abs(0x80000000, 0x80000000, 1, 0, 0, 0); |
|
31 |
verify_abs(0x7fffffff, 0x7fffffff, 0, 0, 0, 0); |
|
32 |
verify_abs(42, 42, 0, 0, 0, 0); |
|
33 |
verify_abs(1, 1, 0, 0, 0, 0); |
|
34 |
verify_abs(0xffff, 0xffff, 0, 0, 0, 0); |
|
35 |
verify_abs(0xffff, 0xffff, 0, 0, 0, 0); |
|
36 |
verify_abs(-31, 0x1f, 0, 0, 0, 0); |
|
37 |
verify_abs(0, 0, 0, 1, 0, 0); |
|
38 |
pass(); |
|
39 |
return 0; |
|
40 |
} |
/dev/null | ||
---|---|---|
1 |
#include <stdio.h> |
|
2 |
#include <stdlib.h> |
|
3 |
#include <stdint.h> |
|
4 |
#include "sys.h" |
|
5 |
#include "crisutils.h" |
|
6 |
|
|
7 |
static inline int cris_addc(int a, const int b) |
|
8 |
{ |
|
9 |
asm ("addc\t%1, %0\n" : "+r" (a) : "r" (b)); |
|
10 |
return a; |
|
11 |
} |
|
12 |
|
|
13 |
#define verify_addc(a, b, res, n, z, v, c) \ |
|
14 |
{ \ |
|
15 |
int r; \ |
|
16 |
r = cris_addc((a), (b)); \ |
|
17 |
cris_tst_cc((n), (z), (v), (c)); \ |
|
18 |
if (r != (res)) \ |
|
19 |
err(); \ |
|
20 |
} |
|
21 |
|
|
22 |
int main(void) |
|
23 |
{ |
|
24 |
cris_tst_cc_init(); |
|
25 |
asm volatile ("clearf cz"); |
|
26 |
verify_addc(0, 0, 0, 0, 0, 0, 0); |
|
27 |
|
|
28 |
cris_tst_cc_init(); |
|
29 |
asm volatile ("setf z"); |
|
30 |
verify_addc(0, 0, 0, 0, 1, 0, 0); |
|
31 |
|
|
32 |
cris_tst_cc_init(); |
|
33 |
asm volatile ("setf cz"); |
|
34 |
verify_addc(0, 0, 1, 0, 0, 0, 0); |
|
35 |
cris_tst_cc_init(); |
|
36 |
asm volatile ("clearf c"); |
|
37 |
verify_addc(-1, 2, 1, 0, 0, 0, 1); |
|
38 |
|
|
39 |
cris_tst_cc_init(); |
|
40 |
asm volatile ("clearf nzv"); |
|
41 |
asm volatile ("setf c"); |
|
42 |
verify_addc(-1, 2, 2, 0, 0, 0, 1); |
|
43 |
|
|
44 |
cris_tst_cc_init(); |
|
45 |
asm volatile ("setf c"); |
|
46 |
verify_addc(0xffff, 0xffff, 0x1ffff, 0, 0, 0, 0); |
|
47 |
|
|
48 |
cris_tst_cc_init(); |
|
49 |
asm volatile ("clearf nzvc"); |
|
50 |
verify_addc(-1, -1, 0xfffffffe, 1, 0, 0, 1); |
|
51 |
|
|
52 |
cris_tst_cc_init(); |
|
53 |
asm volatile ("setf c"); |
|
54 |
verify_addc(0x78134452, 0x5432f789, 0xcc463bdc, 1, 0, 1, 0); |
|
55 |
|
|
56 |
pass(); |
|
57 |
return 0; |
|
58 |
} |
/dev/null | ||
---|---|---|
1 |
#include <stdio.h> |
|
2 |
#include <stdlib.h> |
|
3 |
#include <stdint.h> |
|
4 |
#include "sys.h" |
|
5 |
#include "crisutils.h" |
|
6 |
|
|
7 |
/* need to avoid acr as source here. */ |
|
8 |
static inline int cris_addc_m(int a, const int *b) |
|
9 |
{ |
|
10 |
asm volatile ("addc [%1], %0\n" : "+r" (a) : "r" (b)); |
|
11 |
return a; |
|
12 |
} |
|
13 |
|
|
14 |
/* 'b' is a crisv32 constrain to avoid postinc with $acr. */ |
|
15 |
static inline int cris_addc_pi_m(int a, int **b) |
|
16 |
{ |
|
17 |
asm volatile ("addc [%1+], %0\n" : "+r" (a), "+b" (*b)); |
|
18 |
return a; |
|
19 |
} |
|
20 |
|
|
21 |
#define verify_addc_m(a, b, res, n, z, v, c) \ |
|
22 |
{ \ |
|
23 |
int r; \ |
|
24 |
r = cris_addc_m((a), (b)); \ |
|
25 |
cris_tst_cc((n), (z), (v), (c)); \ |
|
26 |
if (r != (res)) \ |
|
27 |
err(); \ |
|
28 |
} |
|
29 |
|
|
30 |
#define verify_addc_pi_m(a, b, res, n, z, v, c) \ |
|
31 |
{ \ |
|
32 |
int r; \ |
|
33 |
r = cris_addc_pi_m((a), (b)); \ |
|
34 |
cris_tst_cc((n), (z), (v), (c)); \ |
|
35 |
if (r != (res)) \ |
|
36 |
err(); \ |
|
37 |
} |
|
38 |
|
|
39 |
int x[] = { 0, 0, 2, -1, 0xffff, -1, 0x5432f789}; |
|
40 |
|
|
41 |
int main(void) |
|
42 |
{ |
|
43 |
int *p = (void *)&x[0]; |
|
44 |
#if 1 |
|
45 |
cris_tst_cc_init(); |
|
46 |
asm volatile ("clearf cz"); |
|
47 |
verify_addc_m(0, p, 0, 0, 0, 0, 0); |
|
48 |
|
|
49 |
cris_tst_cc_init(); |
|
50 |
asm volatile ("setf z"); |
|
51 |
verify_addc_m(0, p, 0, 0, 1, 0, 0); |
|
52 |
|
|
53 |
cris_tst_cc_init(); |
|
54 |
asm volatile ("setf c"); |
|
55 |
verify_addc_m(0, p, 1, 0, 0, 0, 0); |
|
56 |
|
|
57 |
cris_tst_cc_init(); |
|
58 |
asm volatile ("clearf c"); |
|
59 |
verify_addc_pi_m(0, &p, 0, 0, 1, 0, 0); |
|
60 |
|
|
61 |
p = &x[1]; |
|
62 |
cris_tst_cc_init(); |
|
63 |
asm volatile ("setf c"); |
|
64 |
verify_addc_pi_m(0, &p, 1, 0, 0, 0, 0); |
|
65 |
|
|
66 |
if (p != &x[2]) |
|
67 |
err(); |
|
68 |
|
|
69 |
cris_tst_cc_init(); |
|
70 |
asm volatile ("clearf c"); |
|
71 |
verify_addc_pi_m(-1, &p, 1, 0, 0, 0, 1); |
|
72 |
|
|
73 |
if (p != &x[3]) |
|
74 |
err(); |
|
75 |
#endif |
|
76 |
p = &x[3]; |
|
77 |
/* TODO: investigate why this one fails. */ |
|
78 |
cris_tst_cc_init(); |
|
79 |
asm volatile ("setf c"); |
|
80 |
verify_addc_m(2, p, 2, 0, 0, 0, 1); |
|
81 |
p += 4; |
|
82 |
|
|
83 |
pass(); |
|
84 |
return 0; |
|
85 |
} |
/dev/null | ||
---|---|---|
1 |
# mach: crisv0 crisv3 crisv8 crisv10 crisv32 |
|
2 |
# output: 0\n1\n2\n4\nbe02460f\n69d035a6\nc16c14d4\n |
|
3 |
|
|
4 |
.include "testutils.inc" |
|
5 |
start |
|
6 |
moveq 0,r3 |
|
7 |
moveq 0,r4 |
|
8 |
clearf zcvn |
|
9 |
addi r4.b,r3 |
|
10 |
test_cc 0 0 0 0 |
|
11 |
checkr3 0 |
|
12 |
|
|
13 |
moveq 0,r3 |
|
14 |
moveq 1,r4 |
|
15 |
setf zcvn |
|
16 |
addi r4.b,r3 |
|
17 |
test_cc 1 1 1 1 |
|
18 |
checkr3 1 |
|
19 |
|
|
20 |
moveq 0,r3 |
|
21 |
moveq 1,r4 |
|
22 |
setf cv |
|
23 |
clearf zn |
|
24 |
addi r4.w,r3 |
|
25 |
test_cc 0 0 1 1 |
|
26 |
checkr3 2 |
|
27 |
|
|
28 |
moveq 0,r3 |
|
29 |
moveq 1,r4 |
|
30 |
clearf cv |
|
31 |
setf zn |
|
32 |
addi r4.d,r3 |
|
33 |
test_cc 1 1 0 0 |
|
34 |
checkr3 4 |
|
35 |
|
|
36 |
move.d 0x12345678,r3 |
|
37 |
move.d 0xabcdef97,r4 |
|
38 |
clearf cn |
|
39 |
setf zv |
|
40 |
addi r4.b,r3 |
|
41 |
test_cc 0 1 1 0 |
|
42 |
checkr3 be02460f |
|
43 |
|
|
44 |
move.d 0x12345678,r3 |
|
45 |
move.d 0xabcdef97,r4 |
|
46 |
setf cn |
|
47 |
clearf zv |
|
48 |
addi r4.w,r3 |
|
49 |
test_cc 1 0 0 1 |
|
50 |
checkr3 69d035a6 |
|
51 |
|
|
52 |
move.d 0x12345678,r3 |
|
53 |
move.d 0xabcdef97,r4 |
|
54 |
addi r4.d,r3 |
|
55 |
checkr3 c16c14d4 |
|
56 |
|
|
57 |
quit |
/dev/null | ||
---|---|---|
1 |
# mach: crisv32 |
|
2 |
# output: 4455aa77\n4455aa77\nee19ccff\nff22\n4455aa77\nff224455\n55aa77ff\n |
|
3 |
|
|
4 |
.include "testutils.inc" |
|
5 |
.data |
|
6 |
x: |
|
7 |
.dword 0x55aa77ff |
|
8 |
.dword 0xccff2244 |
|
9 |
.dword 0x88ccee19 |
|
10 |
|
|
11 |
start |
|
12 |
setf cv |
|
13 |
moveq -1,r0 |
|
14 |
move.d x-32768,r5 |
|
15 |
move.d 32769,r6 |
|
16 |
addi r6.b,r5,acr |
|
17 |
test_cc 0 0 1 1 |
|
18 |
move.d [acr],r3 |
|
19 |
checkr3 4455aa77 |
|
20 |
|
|
21 |
addu.w 32771,r5 |
|
22 |
setf znvc |
|
23 |
moveq -1,r8 |
|
24 |
addi r8.w,r5,acr |
|
25 |
test_cc 1 1 1 1 |
|
26 |
move.d [acr],r3 |
|
27 |
checkr3 4455aa77 |
|
28 |
|
|
29 |
moveq 5,r10 |
|
30 |
clearf znvc |
|
31 |
addi r10.b,acr,acr |
|
32 |
test_cc 0 0 0 0 |
|
33 |
move.d [acr],r3 |
|
34 |
checkr3 ee19ccff |
|
35 |
|
|
36 |
subq 1,r5 |
|
37 |
move.d r5,r8 |
|
38 |
subq 1,r8 |
|
39 |
moveq 1,r9 |
|
40 |
addi r9.d,r8,acr |
|
41 |
test_cc 0 0 0 0 |
|
42 |
movu.w [acr],r3 |
|
43 |
checkr3 ff22 |
|
44 |
|
|
45 |
moveq -2,r11 |
|
46 |
addi r11.w,acr,acr |
|
47 |
move.d [acr],r3 |
|
48 |
checkr3 4455aa77 |
|
49 |
|
|
50 |
moveq 5,r9 |
|
51 |
addi r9.d,acr,acr |
|
52 |
subq 18,acr |
|
53 |
move.d [acr],r3 |
|
54 |
checkr3 ff224455 |
|
55 |
|
|
56 |
move.d -76789888/4,r12 |
|
57 |
addi r12.d,r5,acr |
|
58 |
add.d 76789886,acr |
|
59 |
move.d [acr],r3 |
|
60 |
checkr3 55aa77ff |
|
61 |
|
|
62 |
quit |
/dev/null | ||
---|---|---|
1 |
# mach: crisv0 crisv3 crisv8 crisv10 crisv32 |
|
2 |
# output: 1\n1\n1fffe\nfffffffe\ncc463bdb\nffff0001\n1\nfffe\nfedafffe\n78133bdb\nffffff01\n1\nfe\nfeda49fe\n781344db\n781344d0\n |
|
3 |
|
|
4 |
.include "testutils.inc" |
|
5 |
.data |
|
6 |
x: |
|
7 |
.dword 2,-1,0xffff,-1,0x5432f789 |
|
8 |
.word 2,-1,0xffff,0xf789 |
|
9 |
.byte 2,0xff,0x89 |
|
10 |
.byte 0x7e |
|
11 |
|
|
12 |
start |
|
13 |
moveq -1,r3 |
|
14 |
move.d x,r5 |
|
15 |
add.d [r5+],r3 |
|
16 |
test_cc 0 0 0 1 |
|
17 |
checkr3 1 |
|
18 |
|
|
19 |
moveq 2,r3 |
|
20 |
add.d [r5],r3 |
|
21 |
test_cc 0 0 0 1 |
|
22 |
addq 4,r5 |
|
23 |
checkr3 1 |
|
24 |
|
|
25 |
move.d 0xffff,r3 |
|
26 |
add.d [r5+],r3 |
|
27 |
test_cc 0 0 0 0 |
|
28 |
checkr3 1fffe |
|
29 |
|
|
30 |
moveq -1,r3 |
|
31 |
add.d [r5+],r3 |
|
32 |
test_cc 1 0 0 1 |
|
33 |
checkr3 fffffffe |
|
34 |
|
|
35 |
move.d 0x78134452,r3 |
|
36 |
add.d [r5+],r3 |
|
37 |
test_cc 1 0 1 0 |
|
38 |
checkr3 cc463bdb |
|
39 |
|
|
40 |
moveq -1,r3 |
|
41 |
add.w [r5+],r3 |
|
42 |
test_cc 0 0 0 1 |
|
43 |
checkr3 ffff0001 |
|
44 |
|
|
45 |
moveq 2,r3 |
|
46 |
add.w [r5+],r3 |
|
47 |
test_cc 0 0 0 1 |
|
48 |
checkr3 1 |
|
49 |
|
|
50 |
move.d 0xffff,r3 |
|
51 |
add.w [r5],r3 |
|
52 |
test_cc 1 0 0 1 |
|
53 |
checkr3 fffe |
|
54 |
|
|
55 |
move.d 0xfedaffff,r3 |
|
56 |
add.w [r5+],r3 |
|
57 |
test_cc 1 0 0 1 |
|
58 |
checkr3 fedafffe |
|
59 |
|
|
60 |
move.d 0x78134452,r3 |
|
61 |
add.w [r5+],r3 |
|
62 |
test_cc 0 0 0 1 |
|
63 |
checkr3 78133bdb |
|
64 |
|
|
65 |
moveq -1,r3 |
|
66 |
add.b [r5],r3 |
|
67 |
test_cc 0 0 0 1 |
|
68 |
addq 1,r5 |
|
69 |
checkr3 ffffff01 |
|
70 |
|
|
71 |
moveq 2,r3 |
|
72 |
add.b [r5],r3 |
|
73 |
test_cc 0 0 0 1 |
|
74 |
checkr3 1 |
|
75 |
|
|
76 |
move.d 0xff,r3 |
|
77 |
add.b [r5],r3 |
|
78 |
test_cc 1 0 0 1 |
|
79 |
checkr3 fe |
|
80 |
|
|
81 |
move.d 0xfeda49ff,r3 |
|
82 |
add.b [r5+],r3 |
|
83 |
test_cc 1 0 0 1 |
|
84 |
checkr3 feda49fe |
|
85 |
|
|
86 |
move.d 0x78134452,r3 |
|
87 |
add.b [r5+],r3 |
|
88 |
test_cc 1 0 0 0 |
|
89 |
checkr3 781344db |
|
90 |
|
|
91 |
move.d 0x78134452,r3 |
|
92 |
add.b [r5],r3 |
|
93 |
test_cc 1 0 1 0 |
|
94 |
checkr3 781344d0 |
|
95 |
|
|
96 |
quit |
/dev/null | ||
---|---|---|
1 |
#include <stdio.h> |
|
2 |
#include <stdlib.h> |
|
3 |
#include <stdint.h> |
|
4 |
#include "sys.h" |
|
5 |
#include "crisutils.h" |
|
6 |
|
|
7 |
/* this would be better to do in asm, it's an orgy in GCC inline asm now. */ |
|
8 |
|
|
9 |
#define cris_addo_b(o, v) \ |
|
10 |
asm volatile ("addo.b\t[%0], %1, $acr\n" : : "r" (o), "r" (v) : "acr"); |
|
11 |
#define cris_addo_w(o, v) \ |
|
12 |
asm volatile ("addo.w\t[%0], %1, $acr\n" : : "r" (o), "r" (v) : "acr"); |
|
13 |
#define cris_addo_d(o, v) \ |
|
14 |
asm volatile ("addo.d\t[%0], %1, $acr\n" : : "r" (o), "r" (v) : "acr"); |
|
15 |
#define cris_addo_pi_b(o, v) \ |
|
16 |
asm volatile ("addo.b\t[%0+], %1, $acr\n" \ |
|
17 |
: "+b" (o): "r" (v) : "acr"); |
|
18 |
#define cris_addo_pi_w(o, v) \ |
|
19 |
asm volatile ("addo.w\t[%0+], %1, $acr\n" \ |
|
20 |
: "+b" (o): "r" (v) : "acr"); |
|
21 |
#define cris_addo_pi_d(o, v) \ |
|
22 |
asm volatile ("addo.d\t[%0+], %1, $acr\n" \ |
|
23 |
: "+b" (o): "r" (v) : "acr"); |
|
24 |
|
|
25 |
struct { |
|
26 |
uint32_t v1; |
|
27 |
uint16_t v2; |
|
28 |
uint32_t v3; |
|
29 |
uint8_t v4; |
|
30 |
uint8_t v5; |
|
31 |
uint16_t v6; |
|
32 |
uint32_t v7; |
|
33 |
} y = { |
|
34 |
32769, |
|
35 |
-1, |
|
36 |
5, |
|
37 |
3, -4, |
|
38 |
2, |
|
39 |
-76789887 |
|
40 |
}; |
|
41 |
|
|
42 |
static int x[3] = {0x55aa77ff, 0xccff2244, 0x88ccee19}; |
|
43 |
|
|
44 |
int main(void) |
|
45 |
{ |
|
46 |
int *r; |
|
47 |
unsigned char *t, *p; |
|
48 |
|
|
49 |
/* Note, this test-case will trig an unaligned access, partly |
|
50 |
to x[0] and to [x1]. */ |
|
51 |
t = (unsigned char *)x; |
|
52 |
t -= 32768; |
|
53 |
p = (unsigned char *) &y.v1; |
|
54 |
mb(); /* dont reorder anything beyond here. */ |
|
55 |
cris_tst_cc_init(); |
|
56 |
asm volatile ("setf\tzvnc\n"); |
|
57 |
cris_addo_pi_d(p, t); |
|
58 |
cris_tst_cc(1, 1, 1, 1); |
|
59 |
asm volatile ("move.d\t$acr, %0\n" : "=r" (r)); |
|
60 |
if (*r != 0x4455aa77) |
|
61 |
err(); |
|
62 |
|
|
63 |
|
|
64 |
t += 32770; |
|
65 |
mb(); /* dont reorder anything beyond here. */ |
|
66 |
cris_tst_cc_init(); |
|
67 |
asm volatile ("setf\tzvnc\n"); |
|
68 |
cris_addo_pi_w(p, t); |
|
69 |
cris_tst_cc(1, 1, 1, 1); |
|
70 |
asm volatile ("move.d\t$acr, %0\n" : "=r" (r)); |
|
71 |
if (*r != 0x4455aa77) |
|
72 |
err(); |
|
73 |
|
|
74 |
mb(); /* dont reorder anything beyond here. */ |
|
75 |
cris_tst_cc_init(); |
|
76 |
asm volatile ("setf\tzvnc\n"); |
|
77 |
cris_addo_d(p, r); |
|
78 |
cris_tst_cc(1, 1, 1, 1); |
|
79 |
p += 4; |
|
80 |
asm volatile ("move.d\t$acr, %0\n" : "=r" (r)); |
|
81 |
if (*r != 0xee19ccff) |
|
82 |
err(); |
|
83 |
|
|
84 |
mb(); /* dont reorder anything beyond here. */ |
|
85 |
cris_tst_cc_init(); |
|
86 |
asm volatile ("setf\tzvnc\n"); |
|
87 |
cris_addo_pi_b(p, t); |
|
88 |
cris_tst_cc(0, 0, 0, 0); |
|
89 |
asm volatile ("move.d\t$acr, %0\n" : "=r" (r)); |
|
90 |
if (*(uint16_t*)r != 0xff22) |
|
91 |
err(); |
|
92 |
|
|
93 |
mb(); /* dont reorder anything beyond here. */ |
|
94 |
cris_tst_cc_init(); |
|
95 |
asm volatile ("setf\tzvnc\n"); |
|
96 |
cris_addo_b(p, r); |
|
97 |
cris_tst_cc(1, 1, 1, 1); |
|
98 |
p += 1; |
|
99 |
asm volatile ("move.d\t$acr, %0\n" : "=r" (r)); |
|
100 |
if (*r != 0x4455aa77) |
|
101 |
err(); |
|
102 |
|
|
103 |
mb(); /* dont reorder anything beyond here. */ |
|
104 |
cris_tst_cc_init(); |
|
105 |
asm volatile ("setf\tzvnc\n"); |
|
106 |
cris_addo_w(p, r); |
|
107 |
cris_tst_cc(1, 1, 1, 1); |
|
108 |
p += 2; |
|
109 |
asm volatile ("move.d\t$acr, %0\n" : "=r" (r)); |
|
110 |
if (*r != 0xff224455) |
|
111 |
err(); |
|
112 |
|
|
113 |
mb(); /* dont reorder anything beyond here. */ |
|
114 |
cris_tst_cc_init(); |
|
115 |
asm volatile ("setf\tzvnc\n"); |
|
116 |
cris_addo_pi_d(p, t); |
|
117 |
cris_tst_cc(0, 0, 0, 0); |
|
118 |
asm volatile ("move.d\t$acr, %0\n" : "=r" (r)); |
|
119 |
r = (void*)(((char *)r) + 76789885); |
|
120 |
if (*r != 0x55aa77ff) |
|
121 |
err(); |
|
122 |
|
|
123 |
pass(); |
|
124 |
return 0; |
|
125 |
} |
/dev/null | ||
---|---|---|
1 |
#include <stdio.h> |
|
2 |
#include <stdlib.h> |
|
3 |
#include <stdint.h> |
|
4 |
#include "sys.h" |
|
5 |
#include "crisutils.h" |
|
6 |
|
|
7 |
/* this would be better to do in asm, it's an orgy in GCC inline asm now. */ |
|
8 |
|
|
9 |
/* ACR will be clobbered. */ |
|
10 |
#define cris_addoq(o, v) \ |
|
11 |
asm volatile ("addoq\t%1, %0, $acr\n" : : "r" (v), "i" (o) : "acr"); |
|
12 |
|
|
13 |
|
|
14 |
int main(void) |
|
15 |
{ |
|
16 |
int x[3] = {0x55aa77ff, 0xccff2244, 0x88ccee19}; |
|
17 |
int *p, *t = x + 1; |
|
18 |
|
|
19 |
cris_tst_cc_init(); |
|
20 |
asm volatile ("setf\tzvnc\n"); |
|
21 |
cris_addoq(0, t); |
|
22 |
cris_tst_cc(1, 1, 1, 1); |
|
23 |
asm volatile ("move.d\t$acr, %0\n" : "=r" (p)); |
|
24 |
if (*p != 0xccff2244) |
|
25 |
err(); |
|
26 |
|
|
27 |
cris_tst_cc_init(); |
|
28 |
asm volatile ("setf\tzvnc\n"); |
|
29 |
cris_addoq(4, t); |
|
30 |
cris_tst_cc(0, 0, 0, 0); |
|
31 |
asm volatile ("move.d\t$acr, %0\n" : "=r" (p)); |
|
32 |
if (*p != 0x88ccee19) |
|
33 |
err(); |
|
34 |
|
|
35 |
cris_tst_cc_init(); |
|
36 |
asm volatile ("clearf\tzvnc\n"); |
|
37 |
cris_addoq(-8, t + 1); |
|
38 |
cris_tst_cc(0, 0, 0, 0); |
|
39 |
asm volatile ("move.d\t$acr, %0\n" : "=r" (p)); |
|
40 |
if (*p != 0x55aa77ff) |
|
41 |
err(); |
|
42 |
pass(); |
|
43 |
return 0; |
|
44 |
} |
/dev/null | ||
---|---|---|
1 |
# mach: crisv3 crisv8 crisv10 crisv32 |
|
2 |
# output: ffffffff\n0\n1\n100\n10000\n47\n67\na6\n80000001\n |
|
3 |
|
|
4 |
.include "testutils.inc" |
|
5 |
start |
|
6 |
moveq -2,r3 |
|
7 |
addq 1,r3 |
|
8 |
test_cc 1 0 0 0 |
|
9 |
checkr3 ffffffff |
|
10 |
|
|
11 |
addq 1,r3 |
|
12 |
test_cc 0 1 0 1 |
|
13 |
checkr3 0 |
|
14 |
|
|
15 |
addq 1,r3 |
|
16 |
test_cc 0 0 0 0 |
|
17 |
checkr3 1 |
|
18 |
|
|
19 |
move.d 0xff,r3 |
|
20 |
addq 1,r3 |
|
21 |
test_cc 0 0 0 0 |
|
22 |
checkr3 100 |
|
23 |
|
|
24 |
move.d 0xffff,r3 |
|
25 |
addq 1,r3 |
|
26 |
test_cc 0 0 0 0 |
|
27 |
checkr3 10000 |
|
28 |
|
|
29 |
move.d 0x42,r3 |
|
30 |
addq 5,r3 |
|
31 |
test_cc 0 0 0 0 |
|
32 |
checkr3 47 |
|
33 |
|
|
34 |
addq 32,r3 |
|
35 |
test_cc 0 0 0 0 |
|
36 |
checkr3 67 |
|
37 |
|
|
38 |
addq 63,r3 |
|
39 |
test_cc 0 0 0 0 |
|
40 |
checkr3 a6 |
|
41 |
|
|
42 |
move.d 0x7ffffffe,r3 |
|
43 |
addq 3,r3 |
|
44 |
test_cc 1 0 1 0 |
|
45 |
checkr3 80000001 |
|
46 |
|
|
47 |
quit |
/dev/null | ||
---|---|---|
1 |
# mach: crisv0 crisv3 crisv8 crisv10 crisv32 |
|
2 |
# output: 1\n1\n1fffe\nfffffffe\ncc463bdb\nffff0001\n1\nfffe\nfedafffe\n78133bdb\nffffff01\n1\nfe\nfeda49fe\n781344db\n |
|
3 |
|
|
4 |
.include "testutils.inc" |
|
5 |
start |
|
6 |
moveq -1,r3 |
|
7 |
moveq 2,r4 |
|
8 |
add.d r4,r3 |
|
9 |
test_cc 0 0 0 1 |
|
10 |
checkr3 1 |
|
11 |
|
|
12 |
moveq 2,r3 |
|
13 |
moveq -1,r4 |
|
14 |
add.d r4,r3 |
|
15 |
test_cc 0 0 0 1 |
|
16 |
checkr3 1 |
|
17 |
|
|
18 |
move.d 0xffff,r4 |
|
19 |
move.d r4,r3 |
|
20 |
add.d r4,r3 |
|
21 |
test_cc 0 0 0 0 |
|
22 |
checkr3 1fffe |
|
23 |
|
|
24 |
moveq -1,r4 |
|
25 |
move.d r4,r3 |
|
26 |
add.d r4,r3 |
|
27 |
test_cc 1 0 0 1 |
|
28 |
checkr3 fffffffe |
|
29 |
|
|
30 |
move.d 0x5432f789,r4 |
|
31 |
move.d 0x78134452,r3 |
|
32 |
add.d r4,r3 |
|
33 |
test_cc 1 0 1 0 |
|
34 |
checkr3 cc463bdb |
|
35 |
|
|
36 |
moveq -1,r3 |
|
37 |
moveq 2,r4 |
|
38 |
add.w r4,r3 |
|
39 |
test_cc 0 0 0 1 |
|
40 |
checkr3 ffff0001 |
|
41 |
|
|
42 |
moveq 2,r3 |
|
43 |
moveq -1,r4 |
|
44 |
add.w r4,r3 |
|
45 |
test_cc 0 0 0 1 |
|
46 |
checkr3 1 |
|
47 |
|
|
48 |
move.d 0xffff,r4 |
|
49 |
move.d r4,r3 |
|
50 |
add.w r4,r3 |
|
51 |
test_cc 1 0 0 1 |
|
52 |
checkr3 fffe |
|
53 |
|
|
54 |
move.d 0xfedaffff,r4 |
|
55 |
move.d r4,r3 |
|
56 |
add.w r4,r3 |
|
57 |
test_cc 1 0 0 1 |
|
58 |
checkr3 fedafffe |
|
59 |
|
|
60 |
move.d 0x5432f789,r4 |
|
61 |
move.d 0x78134452,r3 |
|
62 |
add.w r4,r3 |
|
63 |
test_cc 0 0 0 1 |
|
64 |
checkr3 78133bdb |
|
65 |
|
|
66 |
moveq -1,r3 |
|
67 |
moveq 2,r4 |
|
68 |
add.b r4,r3 |
|
69 |
test_cc 0 0 0 1 |
|
70 |
checkr3 ffffff01 |
|
71 |
|
|
72 |
moveq 2,r3 |
|
73 |
moveq -1,r4 |
|
74 |
add.b r4,r3 |
|
75 |
test_cc 0 0 0 1 |
|
76 |
checkr3 1 |
|
77 |
|
|
78 |
move.d 0xff,r4 |
|
79 |
move.d r4,r3 |
|
80 |
add.b r4,r3 |
|
81 |
test_cc 1 0 0 1 |
|
82 |
checkr3 fe |
|
83 |
|
|
84 |
move.d 0xfeda49ff,r4 |
|
85 |
move.d r4,r3 |
|
86 |
add.b r4,r3 |
|
87 |
test_cc 1 0 0 1 |
|
88 |
checkr3 feda49fe |
|
89 |
|
|
90 |
move.d 0x5432f789,r4 |
|
91 |
move.d 0x78134452,r3 |
|
92 |
add.b r4,r3 |
|
93 |
test_cc 1 0 0 0 |
|
94 |
checkr3 781344db |
|
95 |
|
|
96 |
quit |
/dev/null | ||
---|---|---|
1 |
# mach: crisv0 crisv3 crisv8 crisv10 crisv32 |
|
2 |
# output: 1\n1\n101\n10001\n100fe\n1fffe\nfffe\nfffe\nfffffffe\nfe\nfffffffe\n781344db\n781343db\n78143bdb\n78133bdb\n800000ed\n0\n |
|
3 |
|
|
4 |
.include "testutils.inc" |
|
5 |
start |
|
6 |
moveq 2,r3 |
|
7 |
adds.b 0xff,r3 |
|
8 |
test_cc 0 0 0 1 |
|
9 |
checkr3 1 |
|
10 |
|
|
11 |
moveq 2,r3 |
|
12 |
adds.w 0xffff,r3 |
|
13 |
test_cc 0 0 0 1 |
|
14 |
checkr3 1 |
|
15 |
|
|
16 |
moveq 2,r3 |
|
17 |
addu.b 0xff,r3 |
|
18 |
checkr3 101 |
|
19 |
|
|
20 |
moveq 2,r3 |
|
21 |
move.d 0xffffffff,r4 |
|
22 |
addu.w -1,r3 |
|
23 |
test_cc 0 0 0 0 |
|
24 |
checkr3 10001 |
|
25 |
|
|
26 |
move.d 0xffff,r3 |
|
27 |
addu.b -1,r3 |
|
28 |
test_cc 0 0 0 0 |
|
29 |
checkr3 100fe |
|
30 |
|
|
31 |
move.d 0xffff,r3 |
|
32 |
addu.w -1,r3 |
|
33 |
test_cc 0 0 0 0 |
|
34 |
checkr3 1fffe |
|
35 |
|
|
36 |
move.d 0xffff,r3 |
|
37 |
adds.b 0xff,r3 |
|
38 |
test_cc 0 0 0 1 |
|
39 |
checkr3 fffe |
|
40 |
|
|
41 |
move.d 0xffff,r3 |
|
42 |
adds.w 0xffff,r3 |
|
43 |
test_cc 0 0 0 1 |
|
44 |
checkr3 fffe |
|
45 |
|
|
46 |
moveq -1,r3 |
|
47 |
adds.b 0xff,r3 |
|
48 |
test_cc 1 0 0 1 |
|
49 |
checkr3 fffffffe |
|
50 |
|
|
51 |
moveq -1,r3 |
|
52 |
adds.w 0xff,r3 |
|
53 |
test_cc 0 0 0 1 |
|
54 |
checkr3 fe |
|
55 |
|
|
56 |
moveq -1,r3 |
|
57 |
adds.w 0xffff,r3 |
|
58 |
test_cc 1 0 0 1 |
|
59 |
checkr3 fffffffe |
|
60 |
|
|
61 |
move.d 0x78134452,r3 |
|
62 |
addu.b 0x89,r3 |
|
63 |
test_cc 0 0 0 0 |
|
64 |
checkr3 781344db |
|
65 |
|
|
66 |
move.d 0x78134452,r3 |
|
67 |
adds.b 0x89,r3 |
|
68 |
test_cc 0 0 0 1 |
|
69 |
checkr3 781343db |
|
70 |
|
|
71 |
move.d 0x78134452,r3 |
|
72 |
addu.w 0xf789,r3 |
|
73 |
test_cc 0 0 0 0 |
|
74 |
checkr3 78143bdb |
|
75 |
|
|
76 |
move.d 0x78134452,r3 |
|
77 |
adds.w 0xf789,r3 |
|
78 |
test_cc 0 0 0 1 |
|
79 |
checkr3 78133bdb |
|
80 |
|
|
81 |
move.d 0x7fffffee,r3 |
|
82 |
addu.b 0xff,r3 |
|
83 |
test_cc 1 0 1 0 |
|
84 |
checkr3 800000ed |
|
85 |
|
|
86 |
move.d 0x1,r3 |
|
87 |
adds.w 0xffff,r3 |
|
88 |
test_cc 0 1 0 1 |
|
89 |
checkr3 0 |
|
90 |
|
|
91 |
quit |
/dev/null | ||
---|---|---|
1 |
# mach: crisv0 crisv3 crisv8 crisv10 crisv32 |
|
2 |
# output: 1\n1\n101\n10001\n100fe\n1fffe\nfffe\nfffe\nfffffffe\nfe\nfffffffe\n781344db\n781343db\n78143bdb\n78133bdb\n800000ed\n0\n |
|
3 |
|
|
4 |
.include "testutils.inc" |
|
5 |
.data |
|
6 |
x: |
|
7 |
.byte 0xff |
|
8 |
.word 0xffff |
|
9 |
.word 0xff |
|
10 |
.word 0xffff |
|
11 |
.byte 0x89 |
|
12 |
.word 0xf789 |
|
13 |
.byte 0xff |
|
14 |
.word 0xffff |
|
15 |
|
|
16 |
start |
|
17 |
moveq 2,r3 |
|
18 |
move.d x,r5 |
|
19 |
adds.b [r5+],r3 |
|
20 |
test_cc 0 0 0 1 |
|
21 |
checkr3 1 |
|
22 |
|
|
23 |
moveq 2,r3 |
|
24 |
adds.w [r5+],r3 |
|
25 |
test_cc 0 0 0 1 |
|
26 |
checkr3 1 |
|
27 |
|
Also available in: Unified diff