Commit dd43edf4e136bff05cbbb6b42b96c024c591dbb9
1 parent
83fa1010
CRIS testsuite, based on the SIM testsuite, by Edgar E. Iglesias.
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@3365 c046a42c-6fe2-441c-8c8c-71466251a162
Showing
61 changed files
with
4698 additions
and
0 deletions
Too many changes to show.
To preserve performance only 61 of 103 files are displayed.
tests/cris/.gdbinit
0 → 100644
tests/cris/Makefile
0 → 100644
| 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_int64.tst | |
| 59 | +# check_jsr is broken. | |
| 60 | +#TESTCASES += check_jsr.tst | |
| 61 | +TESTCASES += check_mcp.tst | |
| 62 | +TESTCASES += check_movei.tst | |
| 63 | +TESTCASES += check_mover.tst | |
| 64 | +TESTCASES += check_moverm.tst | |
| 65 | +TESTCASES += check_moveq.tst | |
| 66 | +TESTCASES += check_movemr.tst | |
| 67 | +TESTCASES += check_movemrv32.tst | |
| 68 | +TESTCASES += check_movecr.tst | |
| 69 | +TESTCASES += check_movmp.tst | |
| 70 | +TESTCASES += check_movpr.tst | |
| 71 | +TESTCASES += check_movprv32.tst | |
| 72 | +TESTCASES += check_movdelsr1.tst | |
| 73 | +TESTCASES += check_movpmv32.tst | |
| 74 | +TESTCASES += check_movsr.tst | |
| 75 | +TESTCASES += check_movsm.tst | |
| 76 | +TESTCASES += check_movscr.tst | |
| 77 | +TESTCASES += check_movur.tst | |
| 78 | +TESTCASES += check_movum.tst | |
| 79 | +TESTCASES += check_movucr.tst | |
| 80 | +TESTCASES += check_mulx.tst | |
| 81 | +TESTCASES += check_mulv32.tst | |
| 82 | +TESTCASES += check_neg.tst | |
| 83 | +TESTCASES += check_not.tst | |
| 84 | +TESTCASES += check_lz.tst | |
| 85 | +TESTCASES += check_lapc.tst | |
| 86 | +TESTCASES += check_lsl.tst | |
| 87 | +TESTCASES += check_lsr.tst | |
| 88 | +TESTCASES += check_orc.tst | |
| 89 | +TESTCASES += check_orm.tst | |
| 90 | +TESTCASES += check_orr.tst | |
| 91 | +TESTCASES += check_orq.tst | |
| 92 | +TESTCASES += check_ret.tst | |
| 93 | +TESTCASES += check_swap.tst | |
| 94 | +TESTCASES += check_scc.tst | |
| 95 | +TESTCASES += check_subc.tst | |
| 96 | +TESTCASES += check_subq.tst | |
| 97 | +TESTCASES += check_subr.tst | |
| 98 | +TESTCASES += check_subm.tst | |
| 99 | +TESTCASES += check_glibc_kernelversion.tst | |
| 100 | +TESTCASES += check_xarith.tst | |
| 101 | + | |
| 102 | +TESTCASES += check_hello.ctst | |
| 103 | +TESTCASES += check_stat1.ctst | |
| 104 | +TESTCASES += check_stat2.ctst | |
| 105 | +TESTCASES += check_stat3.ctst | |
| 106 | +TESTCASES += check_stat4.ctst | |
| 107 | +TESTCASES += check_openpf1.ctst | |
| 108 | +TESTCASES += check_openpf2.ctst | |
| 109 | +TESTCASES += check_openpf3.ctst | |
| 110 | +TESTCASES += check_openpf4.ctst | |
| 111 | +TESTCASES += check_openpf5.ctst | |
| 112 | +TESTCASES += check_mapbrk.ctst | |
| 113 | +TESTCASES += check_mmap1.ctst | |
| 114 | +TESTCASES += check_mmap2.ctst | |
| 115 | +TESTCASES += check_mmap3.ctst | |
| 116 | +TESTCASES += check_time1.ctst | |
| 117 | +TESTCASES += check_time2.ctst | |
| 118 | + | |
| 119 | + | |
| 120 | +TESTCASES += check_gcctorture_pr28634-1.ctst | |
| 121 | +#TESTCASES += check_gcctorture_pr28634.ctst | |
| 122 | + | |
| 123 | +all: build | |
| 124 | + | |
| 125 | +%.o: $(SRC_PATH)/tests/cris/%.c | |
| 126 | + $(CC) $(CFLAGS) -c $< -o $@ | |
| 127 | + | |
| 128 | +%.o: $(SRC_PATH)/tests/cris/%.s | |
| 129 | + $(AS) $(ASFLAGS) -c $< -o $@ | |
| 130 | + | |
| 131 | +%.tst: %.o | |
| 132 | + $(CC) $(CFLAGS) $(NOSTDFLAGS) $(LDLIBS) $(NOSTDLIBS) $(CRT) $< $(SYS) -o $@ | |
| 133 | + | |
| 134 | +%.ctst: %.o | |
| 135 | + $(CC) $(CFLAGS) $(LDLIBS) $< -o $@ | |
| 136 | + | |
| 137 | +build: $(CRT) $(SYS) $(TESTCASES) | |
| 138 | + | |
| 139 | +check: $(CRT) $(SYS) $(TESTCASES) | |
| 140 | + @echo -e "\nQEMU simulator." | |
| 141 | + @for case in $(TESTCASES); do \ | |
| 142 | + echo -n "$$case "; \ | |
| 143 | + $(SIM) $$case; \ | |
| 144 | + done | |
| 145 | +check-g: $(CRT) $(SYS) $(TESTCASES) | |
| 146 | + @echo -e "\nGDB simulator." | |
| 147 | + @for case in $(TESTCASES); do \ | |
| 148 | + echo -n "$$case "; \ | |
| 149 | + $(SIMG) $$case; \ | |
| 150 | + done | |
| 151 | + | |
| 152 | +clean: | |
| 153 | + $(RM) -fr $(TESTCASES) $(CRT) $(SYS) | ... | ... |
tests/cris/README
0 → 100644
tests/cris/check_abs.c
0 → 100644
| 1 | +#include <stdio.h> | |
| 2 | +#include <stdlib.h> | |
| 3 | +#include <stdint.h> | |
| 4 | +#include "sys.h" | |
| 5 | +#include "crisutils.h" | |
| 6 | + | |
| 7 | +extern inline int cris_abs(int n) { | |
| 8 | + int r; | |
| 9 | + asm ("abs\t%1, %0\n" : "=r" (r) : "r" (n)); | |
| 10 | + return r; | |
| 11 | +} | |
| 12 | + | |
| 13 | +extern inline void | |
| 14 | +verify_abs(int val, int res, | |
| 15 | + const int n, const int z, const int v, const int c) | |
| 16 | +{ | |
| 17 | + int r; | |
| 18 | + | |
| 19 | + cris_tst_cc_init(); | |
| 20 | + r = cris_abs(val); | |
| 21 | + cris_tst_cc(n, z, v, c); | |
| 22 | + if (r != res) | |
| 23 | + err(); | |
| 24 | +} | |
| 25 | + | |
| 26 | +int main(void) | |
| 27 | +{ | |
| 28 | + verify_abs(-1, 1, 0, 0, 0, 0); | |
| 29 | + verify_abs(0x80000000, 0x80000000, 1, 0, 0, 0); | |
| 30 | + verify_abs(0x7fffffff, 0x7fffffff, 0, 0, 0, 0); | |
| 31 | + verify_abs(42, 42, 0, 0, 0, 0); | |
| 32 | + verify_abs(1, 1, 0, 0, 0, 0); | |
| 33 | + verify_abs(0xffff, 0xffff, 0, 0, 0, 0); | |
| 34 | + verify_abs(0xffff, 0xffff, 0, 0, 0, 0); | |
| 35 | + verify_abs(-31, 0x1f, 0, 0, 0, 0); | |
| 36 | + verify_abs(0, 0, 0, 1, 0, 0); | |
| 37 | + pass(); | |
| 38 | + return 0; | |
| 39 | +} | ... | ... |
tests/cris/check_addc.c
0 → 100644
| 1 | +#include <stdio.h> | |
| 2 | +#include <stdlib.h> | |
| 3 | +#include <stdint.h> | |
| 4 | +#include "sys.h" | |
| 5 | +#include "crisutils.h" | |
| 6 | + | |
| 7 | +extern inline int cris_addc(int a, const int b) { | |
| 8 | + asm ("addc\t%1, %0\n" : "+r" (a) : "r" (b)); | |
| 9 | + return a; | |
| 10 | +} | |
| 11 | + | |
| 12 | +#define verify_addc(a, b, res, n, z, v, c) \ | |
| 13 | +{ \ | |
| 14 | + int r; \ | |
| 15 | + r = cris_addc((a), (b)); \ | |
| 16 | + cris_tst_cc((n), (z), (v), (c)); \ | |
| 17 | + if (r != (res)) \ | |
| 18 | + err(); \ | |
| 19 | +} | |
| 20 | + | |
| 21 | +int main(void) | |
| 22 | +{ | |
| 23 | + cris_tst_cc_init(); | |
| 24 | + asm volatile ("clearf cz"); | |
| 25 | + verify_addc(0, 0, 0, 0, 0, 0, 0); | |
| 26 | + | |
| 27 | + cris_tst_cc_init(); | |
| 28 | + asm volatile ("setf z"); | |
| 29 | + verify_addc(0, 0, 0, 0, 1, 0, 0); | |
| 30 | + | |
| 31 | + cris_tst_cc_init(); | |
| 32 | + asm volatile ("setf cz"); | |
| 33 | + verify_addc(0, 0, 1, 0, 0, 0, 0); | |
| 34 | + cris_tst_cc_init(); | |
| 35 | + asm volatile ("clearf c"); | |
| 36 | + verify_addc(-1, 2, 1, 0, 0, 0, 1); | |
| 37 | + | |
| 38 | + cris_tst_cc_init(); | |
| 39 | + asm volatile ("clearf nzv"); | |
| 40 | + asm volatile ("setf c"); | |
| 41 | + verify_addc(-1, 2, 2, 0, 0, 0, 1); | |
| 42 | + | |
| 43 | + cris_tst_cc_init(); | |
| 44 | + asm volatile ("setf c"); | |
| 45 | + verify_addc(0xffff, 0xffff, 0x1ffff, 0, 0, 0, 0); | |
| 46 | + | |
| 47 | + cris_tst_cc_init(); | |
| 48 | + asm volatile ("clearf nzvc"); | |
| 49 | + verify_addc(-1, -1, 0xfffffffe, 1, 0, 0, 1); | |
| 50 | + | |
| 51 | + cris_tst_cc_init(); | |
| 52 | + asm volatile ("setf c"); | |
| 53 | + verify_addc(0x78134452, 0x5432f789, 0xcc463bdc, 1, 0, 1, 0); | |
| 54 | + | |
| 55 | + pass(); | |
| 56 | + return 0; | |
| 57 | +} | ... | ... |
tests/cris/check_addcm.c
0 → 100644
| 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 | +extern inline int cris_addc_m(int a, const int *b) { | |
| 9 | + asm volatile ("addc [%1], %0\n" : "+r" (a) : "r" (b)); | |
| 10 | + return a; | |
| 11 | +} | |
| 12 | + | |
| 13 | +/* 'b' is a crisv32 constrain to avoid postinc with $acr. */ | |
| 14 | +extern inline int cris_addc_pi_m(int a, int **b) { | |
| 15 | + asm volatile ("addc [%1+], %0\n" : "+r" (a), "+b" (*b)); | |
| 16 | + return a; | |
| 17 | +} | |
| 18 | + | |
| 19 | +#define verify_addc_m(a, b, res, n, z, v, c) \ | |
| 20 | +{ \ | |
| 21 | + int r; \ | |
| 22 | + r = cris_addc_m((a), (b)); \ | |
| 23 | + cris_tst_cc((n), (z), (v), (c)); \ | |
| 24 | + if (r != (res)) \ | |
| 25 | + err(); \ | |
| 26 | +} | |
| 27 | + | |
| 28 | +#define verify_addc_pi_m(a, b, res, n, z, v, c) \ | |
| 29 | +{ \ | |
| 30 | + int r; \ | |
| 31 | + r = cris_addc_pi_m((a), (b)); \ | |
| 32 | + cris_tst_cc((n), (z), (v), (c)); \ | |
| 33 | + if (r != (res)) \ | |
| 34 | + err(); \ | |
| 35 | +} | |
| 36 | + | |
| 37 | +int x[] = { 0, 0, 2, -1, 0xffff, -1, 0x5432f789}; | |
| 38 | + | |
| 39 | +int main(void) | |
| 40 | +{ | |
| 41 | + int *p = (void *)&x[0]; | |
| 42 | +#if 1 | |
| 43 | + cris_tst_cc_init(); | |
| 44 | + asm volatile ("clearf cz"); | |
| 45 | + verify_addc_m(0, p, 0, 0, 0, 0, 0); | |
| 46 | + | |
| 47 | + cris_tst_cc_init(); | |
| 48 | + asm volatile ("setf z"); | |
| 49 | + verify_addc_m(0, p, 0, 0, 1, 0, 0); | |
| 50 | + | |
| 51 | + cris_tst_cc_init(); | |
| 52 | + asm volatile ("setf c"); | |
| 53 | + verify_addc_m(0, p, 1, 0, 0, 0, 0); | |
| 54 | + | |
| 55 | + cris_tst_cc_init(); | |
| 56 | + asm volatile ("clearf c"); | |
| 57 | + verify_addc_pi_m(0, &p, 0, 0, 1, 0, 0); | |
| 58 | + | |
| 59 | + p = &x[1]; | |
| 60 | + cris_tst_cc_init(); | |
| 61 | + asm volatile ("setf c"); | |
| 62 | + verify_addc_pi_m(0, &p, 1, 0, 0, 0, 0); | |
| 63 | + | |
| 64 | + if (p != &x[2]) | |
| 65 | + err(); | |
| 66 | + | |
| 67 | + cris_tst_cc_init(); | |
| 68 | + asm volatile ("clearf c"); | |
| 69 | + verify_addc_pi_m(-1, &p, 1, 0, 0, 0, 1); | |
| 70 | + | |
| 71 | + if (p != &x[3]) | |
| 72 | + err(); | |
| 73 | +#endif | |
| 74 | + p = &x[3]; | |
| 75 | + /* TODO: investigate why this one fails. */ | |
| 76 | + cris_tst_cc_init(); | |
| 77 | + asm volatile ("setf c"); | |
| 78 | + verify_addc_m(2, p, 2, 0, 0, 0, 1); | |
| 79 | + p += 4; | |
| 80 | + | |
| 81 | + pass(); | |
| 82 | + return 0; | |
| 83 | +} | ... | ... |
tests/cris/check_addi.s
0 → 100644
| 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 | ... | ... |
tests/cris/check_addiv32.s
0 → 100644
| 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 | ... | ... |
tests/cris/check_addm.s
0 → 100644
| 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 | ... | ... |
tests/cris/check_addo.c
0 → 100644
| 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(1, 1, 1, 1); | |
| 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(1, 1, 1, 1); | |
| 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 | +} | ... | ... |
tests/cris/check_addoq.c
0 → 100644
| 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(1, 1, 1, 1); | |
| 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 | +} | ... | ... |
tests/cris/check_addq.s
0 → 100644
| 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 | ... | ... |
tests/cris/check_addr.s
0 → 100644
| 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 | ... | ... |
tests/cris/check_addxc.s
0 → 100644
| 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 | ... | ... |
tests/cris/check_addxm.s
0 → 100644
| 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 | + | |
| 28 | + moveq 2,r3 | |
| 29 | + subq 3,r5 | |
| 30 | + addu.b [r5+],r3 | |
| 31 | + test_cc 0 0 0 0 | |
| 32 | + checkr3 101 | |
| 33 | + | |
| 34 | + moveq 2,r3 | |
| 35 | + addu.w [r5+],r3 | |
| 36 | + subq 3,r5 | |
| 37 | + test_cc 0 0 0 0 | |
| 38 | + checkr3 10001 | |
| 39 | + | |
| 40 | + move.d 0xffff,r3 | |
| 41 | + addu.b [r5],r3 | |
| 42 | + test_cc 0 0 0 0 | |
| 43 | + checkr3 100fe | |
| 44 | + | |
| 45 | + move.d 0xffff,r3 | |
| 46 | + addu.w [r5],r3 | |
| 47 | + test_cc 0 0 0 0 | |
| 48 | + checkr3 1fffe | |
| 49 | + | |
| 50 | + move.d 0xffff,r3 | |
| 51 | + adds.b [r5],r3 | |
| 52 | + test_cc 0 0 0 1 | |
| 53 | + checkr3 fffe | |
| 54 | + | |
| 55 | + move.d 0xffff,r3 | |
| 56 | + adds.w [r5],r3 | |
| 57 | + test_cc 0 0 0 1 | |
| 58 | + checkr3 fffe | |
| 59 | + | |
| 60 | + moveq -1,r3 | |
| 61 | + adds.b [r5],r3 | |
| 62 | + test_cc 1 0 0 1 | |
| 63 | + addq 3,r5 | |
| 64 | + checkr3 fffffffe | |
| 65 | + | |
| 66 | + moveq -1,r3 | |
| 67 | + adds.w [r5+],r3 | |
| 68 | + test_cc 0 0 0 1 | |
| 69 | + checkr3 fe | |
| 70 | + | |
| 71 | + moveq -1,r3 | |
| 72 | + adds.w [r5+],r3 | |
| 73 | + test_cc 1 0 0 1 | |
| 74 | + checkr3 fffffffe | |
| 75 | + | |
| 76 | + move.d 0x78134452,r3 | |
| 77 | + addu.b [r5],r3 | |
| 78 | + test_cc 0 0 0 0 | |
| 79 | + checkr3 781344db | |
| 80 | + | |
| 81 | + move.d 0x78134452,r3 | |
| 82 | + adds.b [r5+],r3 | |
| 83 | + test_cc 0 0 0 1 | |
| 84 | + checkr3 781343db | |
| 85 | + | |
| 86 | + move.d 0x78134452,r3 | |
| 87 | + addu.w [r5],r3 | |
| 88 | + test_cc 0 0 0 0 | |
| 89 | + checkr3 78143bdb | |
| 90 | + | |
| 91 | + move.d 0x78134452,r3 | |
| 92 | + adds.w [r5+],r3 | |
| 93 | + test_cc 0 0 0 1 | |
| 94 | + checkr3 78133bdb | |
| 95 | + | |
| 96 | + move.d 0x7fffffee,r3 | |
| 97 | + addu.b [r5+],r3 | |
| 98 | + test_cc 1 0 1 0 | |
| 99 | + checkr3 800000ed | |
| 100 | + | |
| 101 | + move.d 0x1,r3 | |
| 102 | + adds.w [r5+],r3 | |
| 103 | + test_cc 0 1 0 1 | |
| 104 | + checkr3 0 | |
| 105 | + | |
| 106 | + quit | ... | ... |
tests/cris/check_addxr.s
0 → 100644
| 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 | ... | ... |
tests/cris/check_andc.s
0 → 100644
| 1 | +# mach: crisv0 crisv3 crisv8 crisv10 crisv32 | |
| 2 | +# output: 2\n2\nffff\nffffffff\n50124400\nffff0002\n2\nfffff\nfedaff0f\n78134400\nffffff02\n2\nf02\n78134401\n78134400\n | |
| 3 | + | |
| 4 | + .include "testutils.inc" | |
| 5 | + start | |
| 6 | + moveq -1,r3 | |
| 7 | + and.d 2,r3 | |
| 8 | + test_move_cc 0 0 0 0 | |
| 9 | + checkr3 2 | |
| 10 | + | |
| 11 | + moveq 2,r3 | |
| 12 | + and.d -1,r3 | |
| 13 | + test_move_cc 0 0 0 0 | |
| 14 | + checkr3 2 | |
| 15 | + | |
| 16 | + move.d 0xffff,r3 | |
| 17 | + and.d 0xffff,r3 | |
| 18 | + test_move_cc 0 0 0 0 | |
| 19 | + checkr3 ffff | |
| 20 | + | |
| 21 | + moveq -1,r3 | |
| 22 | + and.d -1,r3 | |
| 23 | + test_move_cc 1 0 0 0 | |
| 24 | + checkr3 ffffffff | |
| 25 | + | |
| 26 | + move.d 0x78134452,r3 | |
| 27 | + and.d 0x5432f789,r3 | |
| 28 | + test_move_cc 0 0 0 0 | |
| 29 | + checkr3 50124400 | |
| 30 | + | |
| 31 | + moveq -1,r3 | |
| 32 | + and.w 2,r3 | |
| 33 | + test_move_cc 0 0 0 0 | |
| 34 | + checkr3 ffff0002 | |
| 35 | + | |
| 36 | + moveq 2,r3 | |
| 37 | + and.w -1,r3 | |
| 38 | + test_move_cc 0 0 0 0 | |
| 39 | + checkr3 2 | |
| 40 | + | |
| 41 | + move.d 0xfffff,r3 | |
| 42 | + and.w 0xffff,r3 | |
| 43 | + test_move_cc 1 0 0 0 | |
| 44 | + checkr3 fffff | |
| 45 | + | |
| 46 | + move.d 0xfedaffaf,r3 | |
| 47 | + and.w 0xff5f,r3 | |
| 48 | + test_move_cc 1 0 0 0 | |
| 49 | + checkr3 fedaff0f | |
| 50 | + | |
| 51 | + move.d 0x78134452,r3 | |
| 52 | + and.w 0xf789,r3 | |
| 53 | + test_move_cc 0 0 0 0 | |
| 54 | + checkr3 78134400 | |
| 55 | + | |
| 56 | + moveq -1,r3 | |
| 57 | + and.b 2,r3 | |
| 58 | + test_move_cc 0 0 0 0 | |
| 59 | + checkr3 ffffff02 | |
| 60 | + | |
| 61 | + moveq 2,r3 | |
| 62 | + and.b -1,r3 | |
| 63 | + test_move_cc 0 0 0 0 | |
| 64 | + checkr3 2 | |
| 65 | + | |
| 66 | + move.d 0xfa7,r3 | |
| 67 | + and.b 0x5a,r3 | |
| 68 | + test_move_cc 0 0 0 0 | |
| 69 | + checkr3 f02 | |
| 70 | + | |
| 71 | + move.d 0x78134453,r3 | |
| 72 | + and.b 0x89,r3 | |
| 73 | + test_move_cc 0 0 0 0 | |
| 74 | + checkr3 78134401 | |
| 75 | + | |
| 76 | + and.b 0,r3 | |
| 77 | + test_move_cc 0 1 0 0 | |
| 78 | + checkr3 78134400 | |
| 79 | + | |
| 80 | + quit | ... | ... |
tests/cris/check_andm.s
0 → 100644
| 1 | +# mach: crisv0 crisv3 crisv8 crisv10 crisv32 | |
| 2 | +# output: 2\n2\nffff\nffffffff\n50124400\nffff0002\n2\nfffff\nfedaff0f\n78134400\nffffff02\n2\nf02\n78134401\n78134400\n | |
| 3 | + | |
| 4 | + .include "testutils.inc" | |
| 5 | + .data | |
| 6 | +x: | |
| 7 | + .dword 2,-1,0xffff,-1,0x5432f789 | |
| 8 | + .word 2,-1,0xffff,0xff5f,0xf789 | |
| 9 | + .byte 2,-1,0x5a,0x89,0 | |
| 10 | + | |
| 11 | + start | |
| 12 | + moveq -1,r3 | |
| 13 | + move.d x,r5 | |
| 14 | + and.d [r5+],r3 | |
| 15 | + test_move_cc 0 0 0 0 | |
| 16 | + checkr3 2 | |
| 17 | + | |
| 18 | + moveq 2,r3 | |
| 19 | + and.d [r5],r3 | |
| 20 | + test_move_cc 0 0 0 0 | |
| 21 | + addq 4,r5 | |
| 22 | + checkr3 2 | |
| 23 | + | |
| 24 | + move.d 0xffff,r3 | |
| 25 | + and.d [r5+],r3 | |
| 26 | + test_move_cc 0 0 0 0 | |
| 27 | + checkr3 ffff | |
| 28 | + | |
| 29 | + moveq -1,r3 | |
| 30 | + and.d [r5+],r3 | |
| 31 | + test_move_cc 1 0 0 0 | |
| 32 | + checkr3 ffffffff | |
| 33 | + | |
| 34 | + move.d 0x78134452,r3 | |
| 35 | + and.d [r5+],r3 | |
| 36 | + test_move_cc 0 0 0 0 | |
| 37 | + checkr3 50124400 | |
| 38 | + | |
| 39 | + moveq -1,r3 | |
| 40 | + and.w [r5+],r3 | |
| 41 | + test_move_cc 0 0 0 0 | |
| 42 | + checkr3 ffff0002 | |
| 43 | + | |
| 44 | + moveq 2,r3 | |
| 45 | + and.w [r5+],r3 | |
| 46 | + test_move_cc 0 0 0 0 | |
| 47 | + checkr3 2 | |
| 48 | + | |
| 49 | + move.d 0xfffff,r3 | |
| 50 | + and.w [r5],r3 | |
| 51 | + test_move_cc 1 0 0 0 | |
| 52 | + addq 2,r5 | |
| 53 | + checkr3 fffff | |
| 54 | + | |
| 55 | + move.d 0xfedaffaf,r3 | |
| 56 | + and.w [r5+],r3 | |
| 57 | + test_move_cc 1 0 0 0 | |
| 58 | + checkr3 fedaff0f | |
| 59 | + | |
| 60 | + move.d 0x78134452,r3 | |
| 61 | + and.w [r5+],r3 | |
| 62 | + test_move_cc 0 0 0 0 | |
| 63 | + checkr3 78134400 | |
| 64 | + | |
| 65 | + moveq -1,r3 | |
| 66 | + and.b [r5],r3 | |
| 67 | + test_move_cc 0 0 0 0 | |
| 68 | + addq 1,r5 | |
| 69 | + checkr3 ffffff02 | |
| 70 | + | |
| 71 | + moveq 2,r3 | |
| 72 | + and.b [r5+],r3 | |
| 73 | + test_move_cc 0 0 0 0 | |
| 74 | + checkr3 2 | |
| 75 | + | |
| 76 | + move.d 0xfa7,r3 | |
| 77 | + and.b [r5+],r3 | |
| 78 | + test_move_cc 0 0 0 0 | |
| 79 | + checkr3 f02 | |
| 80 | + | |
| 81 | + move.d 0x78134453,r3 | |
| 82 | + and.b [r5+],r3 | |
| 83 | + test_move_cc 0 0 0 0 | |
| 84 | + checkr3 78134401 | |
| 85 | + | |
| 86 | + and.b [r5],r3 | |
| 87 | + test_move_cc 0 1 0 0 | |
| 88 | + checkr3 78134400 | |
| 89 | + | |
| 90 | + quit | ... | ... |
tests/cris/check_andq.s
0 → 100644
| 1 | +# mach: crisv0 crisv3 crisv8 crisv10 crisv32 | |
| 2 | +# output: 2\n2\nffff\nffffffff\n1f\nffffffe0\n78134452\n0\n | |
| 3 | + | |
| 4 | + .include "testutils.inc" | |
| 5 | + start | |
| 6 | + moveq -1,r3 | |
| 7 | + andq 2,r3 | |
| 8 | + test_move_cc 0 0 0 0 | |
| 9 | + checkr3 2 | |
| 10 | + | |
| 11 | + moveq 2,r3 | |
| 12 | + andq -1,r3 | |
| 13 | + test_move_cc 0 0 0 0 | |
| 14 | + checkr3 2 | |
| 15 | + | |
| 16 | + move.d 0xffff,r3 | |
| 17 | + andq -1,r3 | |
| 18 | + test_move_cc 0 0 0 0 | |
| 19 | + checkr3 ffff | |
| 20 | + | |
| 21 | + moveq -1,r3 | |
| 22 | + andq -1,r3 | |
| 23 | + test_move_cc 1 0 0 0 | |
| 24 | + checkr3 ffffffff | |
| 25 | + | |
| 26 | + moveq -1,r3 | |
| 27 | + andq 31,r3 | |
| 28 | + test_move_cc 0 0 0 0 | |
| 29 | + checkr3 1f | |
| 30 | + | |
| 31 | + moveq -1,r3 | |
| 32 | + andq -32,r3 | |
| 33 | + test_move_cc 1 0 0 0 | |
| 34 | + checkr3 ffffffe0 | |
| 35 | + | |
| 36 | + move.d 0x78134457,r3 | |
| 37 | + andq -14,r3 | |
| 38 | + test_move_cc 0 0 0 0 | |
| 39 | + checkr3 78134452 | |
| 40 | + | |
| 41 | + moveq 0,r3 | |
| 42 | + andq -14,r3 | |
| 43 | + test_move_cc 0 1 0 0 | |
| 44 | + checkr3 0 | |
| 45 | + | |
| 46 | + quit | ... | ... |
tests/cris/check_andr.s
0 → 100644
| 1 | +# mach: crisv0 crisv3 crisv8 crisv10 crisv32 | |
| 2 | +# output: 2\n2\nffff\nffffffff\n50124400\nffff0002\n2\nfffff\nfedaff0f\n78134400\nffffff02\n2\nf02\n78134401\n78134400\n | |
| 3 | + | |
| 4 | + .include "testutils.inc" | |
| 5 | + start | |
| 6 | + moveq -1,r3 | |
| 7 | + moveq 2,r4 | |
| 8 | + and.d r4,r3 | |
| 9 | + test_move_cc 0 0 0 0 | |
| 10 | + checkr3 2 | |
| 11 | + | |
| 12 | + moveq 2,r3 | |
| 13 | + moveq -1,r4 | |
| 14 | + and.d r4,r3 | |
| 15 | + test_move_cc 0 0 0 0 | |
| 16 | + checkr3 2 | |
| 17 | + | |
| 18 | + move.d 0xffff,r4 | |
| 19 | + move.d r4,r3 | |
| 20 | + and.d r4,r3 | |
| 21 | + test_move_cc 0 0 0 0 | |
| 22 | + checkr3 ffff | |
| 23 | + | |
| 24 | + moveq -1,r4 | |
| 25 | + move.d r4,r3 | |
| 26 | + and.d r4,r3 | |
| 27 | + test_move_cc 1 0 0 0 | |
| 28 | + checkr3 ffffffff | |
| 29 | + | |
| 30 | + move.d 0x5432f789,r4 | |
| 31 | + move.d 0x78134452,r3 | |
| 32 | + and.d r4,r3 | |
| 33 | + test_move_cc 0 0 0 0 | |
| 34 | + checkr3 50124400 | |
| 35 | + | |
| 36 | + moveq -1,r3 | |
| 37 | + moveq 2,r4 | |
| 38 | + and.w r4,r3 | |
| 39 | + test_move_cc 0 0 0 0 | |
| 40 | + checkr3 ffff0002 | |
| 41 | + | |
| 42 | + moveq 2,r3 | |
| 43 | + moveq -1,r4 | |
| 44 | + and.w r4,r3 | |
| 45 | + test_move_cc 0 0 0 0 | |
| 46 | + checkr3 2 | |
| 47 | + | |
| 48 | + move.d 0xfffff,r3 | |
| 49 | + move.d 0xffff,r4 | |
| 50 | + and.w r4,r3 | |
| 51 | + test_move_cc 1 0 0 0 | |
| 52 | + checkr3 fffff | |
| 53 | + | |
| 54 | + move.d 0xfedaffaf,r3 | |
| 55 | + move.d 0xff5f,r4 | |
| 56 | + and.w r4,r3 | |
| 57 | + test_move_cc 1 0 0 0 | |
| 58 | + checkr3 fedaff0f | |
| 59 | + | |
| 60 | + move.d 0x5432f789,r4 | |
| 61 | + move.d 0x78134452,r3 | |
| 62 | + and.w r4,r3 | |
| 63 | + test_move_cc 0 0 0 0 | |
| 64 | + checkr3 78134400 | |
| 65 | + | |
| 66 | + moveq -1,r3 | |
| 67 | + moveq 2,r4 | |
| 68 | + and.b r4,r3 | |
| 69 | + test_move_cc 0 0 0 0 | |
| 70 | + checkr3 ffffff02 | |
| 71 | + | |
| 72 | + moveq 2,r3 | |
| 73 | + moveq -1,r4 | |
| 74 | + and.b r4,r3 | |
| 75 | + test_move_cc 0 0 0 0 | |
| 76 | + checkr3 2 | |
| 77 | + | |
| 78 | + move.d 0x5a,r4 | |
| 79 | + move.d 0xfa7,r3 | |
| 80 | + and.b r4,r3 | |
| 81 | + test_move_cc 0 0 0 0 | |
| 82 | + checkr3 f02 | |
| 83 | + | |
| 84 | + move.d 0x5432f789,r4 | |
| 85 | + move.d 0x78134453,r3 | |
| 86 | + and.b r4,r3 | |
| 87 | + test_move_cc 0 0 0 0 | |
| 88 | + checkr3 78134401 | |
| 89 | + | |
| 90 | + moveq 0,r7 | |
| 91 | + and.b r7,r3 | |
| 92 | + test_move_cc 0 1 0 0 | |
| 93 | + checkr3 78134400 | |
| 94 | + | |
| 95 | + quit | ... | ... |
tests/cris/check_asr.s
0 → 100644
| 1 | +# mach: crisv0 crisv3 crisv8 crisv10 crisv32 | |
| 2 | +# output: ffffffff\n1\nffffffff\nffffffff\n5a67f\nffffffff\nffffffff\nffffffff\nf699fc67\nffffffff\n1\nffffffff\nffffffff\n5a67f\nda67ffff\nda67ffff\nda67ffff\nda67fc67\nffffffff\nffffffff\n1\nffffffff\nffffffff\n5a670007\nda67f1ff\nda67f1ff\nda67f1ff\nda67f1e7\nffffffff\nffffffff\n1\nffffffff\nffffffff\nffffffff\n5a67f1ff\n5a67f1f9\n0\n5a670000\n | |
| 3 | + | |
| 4 | + .include "testutils.inc" | |
| 5 | + start | |
| 6 | + moveq -1,r3 | |
| 7 | + asrq 0,r3 | |
| 8 | + test_move_cc 1 0 0 0 | |
| 9 | + checkr3 ffffffff | |
| 10 | + | |
| 11 | + moveq 2,r3 | |
| 12 | + asrq 1,r3 | |
| 13 | + test_move_cc 0 0 0 0 | |
| 14 | + checkr3 1 | |
| 15 | + | |
| 16 | + moveq -1,r3 | |
| 17 | + asrq 31,r3 | |
| 18 | + test_move_cc 1 0 0 0 | |
| 19 | + checkr3 ffffffff | |
| 20 | + | |
| 21 | + moveq -1,r3 | |
| 22 | + asrq 15,r3 | |
| 23 | + test_move_cc 1 0 0 0 | |
| 24 | + checkr3 ffffffff | |
| 25 | + | |
| 26 | + move.d 0x5a67f19f,r3 | |
| 27 | + asrq 12,r3 | |
| 28 | + test_move_cc 0 0 0 0 | |
| 29 | + checkr3 5a67f | |
| 30 | + | |
| 31 | + move.d 0xda67f19f,r3 | |
| 32 | + move.d 31,r4 | |
| 33 | + asr.d r4,r3 | |
| 34 | + test_move_cc 1 0 0 0 | |
| 35 | + checkr3 ffffffff | |
| 36 | + | |
| 37 | + move.d 0xda67f19f,r3 | |
| 38 | + move.d 32,r4 | |
| 39 | + asr.d r4,r3 | |
| 40 | + test_move_cc 1 0 0 0 | |
| 41 | + checkr3 ffffffff | |
| 42 | + | |
| 43 | + move.d 0xda67f19f,r3 | |
| 44 | + move.d 33,r4 | |
| 45 | + asr.d r4,r3 | |
| 46 | + test_move_cc 1 0 0 0 | |
| 47 | + checkr3 ffffffff | |
| 48 | + | |
| 49 | + move.d 0xda67f19f,r3 | |
| 50 | + move.d 66,r4 | |
| 51 | + asr.d r4,r3 | |
| 52 | + test_move_cc 1 0 0 0 | |
| 53 | + checkr3 f699fc67 | |
| 54 | + | |
| 55 | + moveq -1,r3 | |
| 56 | + moveq 0,r4 | |
| 57 | + asr.d r4,r3 | |
| 58 | + test_move_cc 1 0 0 0 | |
| 59 | + checkr3 ffffffff | |
| 60 | + | |
| 61 | + moveq 2,r3 | |
| 62 | + moveq 1,r4 | |
| 63 | + asr.d r4,r3 | |
| 64 | + test_move_cc 0 0 0 0 | |
| 65 | + checkr3 1 | |
| 66 | + | |
| 67 | + moveq -1,r3 | |
| 68 | + moveq 31,r4 | |
| 69 | + asr.d r4,r3 | |
| 70 | + test_move_cc 1 0 0 0 | |
| 71 | + checkr3 ffffffff | |
| 72 | + | |
| 73 | + moveq -1,r3 | |
| 74 | + moveq 15,r4 | |
| 75 | + asr.d r4,r3 | |
| 76 | + test_move_cc 1 0 0 0 | |
| 77 | + checkr3 ffffffff | |
| 78 | + | |
| 79 | + move.d 0x5a67f19f,r3 | |
| 80 | + moveq 12,r4 | |
| 81 | + asr.d r4,r3 | |
| 82 | + test_move_cc 0 0 0 0 | |
| 83 | + checkr3 5a67f | |
| 84 | + | |
| 85 | + move.d 0xda67f19f,r3 | |
| 86 | + move.d 31,r4 | |
| 87 | + asr.w r4,r3 | |
| 88 | + test_move_cc 1 0 0 0 | |
| 89 | + checkr3 da67ffff | |
| 90 | + | |
| 91 | + move.d 0xda67f19f,r3 | |
| 92 | + move.d 32,r4 | |
| 93 | + asr.w r4,r3 | |
| 94 | + test_move_cc 1 0 0 0 | |
| 95 | + checkr3 da67ffff | |
| 96 | + | |
| 97 | + move.d 0xda67f19f,r3 | |
| 98 | + move.d 33,r4 | |
| 99 | + asr.w r4,r3 | |
| 100 | + test_move_cc 1 0 0 0 | |
| 101 | + checkr3 da67ffff | |
| 102 | + | |
| 103 | + move.d 0xda67f19f,r3 | |
| 104 | + move.d 66,r4 | |
| 105 | + asr.w r4,r3 | |
| 106 | + test_move_cc 1 0 0 0 | |
| 107 | + checkr3 da67fc67 | |
| 108 | + | |
| 109 | + moveq -1,r3 | |
| 110 | + moveq 0,r4 | |
| 111 | + asr.w r4,r3 | |
| 112 | + test_move_cc 1 0 0 0 | |
| 113 | + checkr3 ffffffff | |
| 114 | + | |
| 115 | + moveq -1,r3 | |
| 116 | + moveq 1,r4 | |
| 117 | + asr.w r4,r3 | |
| 118 | + test_move_cc 1 0 0 0 | |
| 119 | + checkr3 ffffffff | |
| 120 | + | |
| 121 | + moveq 2,r3 | |
| 122 | + moveq 1,r4 | |
| 123 | + asr.w r4,r3 | |
| 124 | + test_move_cc 0 0 0 0 | |
| 125 | + checkr3 1 | |
| 126 | + | |
| 127 | + moveq -1,r3 | |
| 128 | + moveq 31,r4 | |
| 129 | + asr.w r4,r3 | |
| 130 | + test_move_cc 1 0 0 0 | |
| 131 | + checkr3 ffffffff | |
| 132 | + | |
| 133 | + moveq -1,r3 | |
| 134 | + moveq 15,r4 | |
| 135 | + asr.w r4,r3 | |
| 136 | + test_move_cc 1 0 0 0 | |
| 137 | + checkr3 ffffffff | |
| 138 | + | |
| 139 | + move.d 0x5a67719f,r3 | |
| 140 | + moveq 12,r4 | |
| 141 | + asr.w r4,r3 | |
| 142 | + test_move_cc 0 0 0 0 | |
| 143 | + checkr3 5a670007 | |
| 144 | + | |
| 145 | + move.d 0xda67f19f,r3 | |
| 146 | + move.d 31,r4 | |
| 147 | + asr.b r4,r3 | |
| 148 | + test_move_cc 1 0 0 0 | |
| 149 | + checkr3 da67f1ff | |
| 150 | + | |
| 151 | + move.d 0xda67f19f,r3 | |
| 152 | + move.d 32,r4 | |
| 153 | + asr.b r4,r3 | |
| 154 | + test_move_cc 1 0 0 0 | |
| 155 | + checkr3 da67f1ff | |
| 156 | + | |
| 157 | + move.d 0xda67f19f,r3 | |
| 158 | + move.d 33,r4 | |
| 159 | + asr.b r4,r3 | |
| 160 | + test_move_cc 1 0 0 0 | |
| 161 | + checkr3 da67f1ff | |
| 162 | + | |
| 163 | + move.d 0xda67f19f,r3 | |
| 164 | + move.d 66,r4 | |
| 165 | + asr.b r4,r3 | |
| 166 | + test_move_cc 1 0 0 0 | |
| 167 | + checkr3 da67f1e7 | |
| 168 | + | |
| 169 | + moveq -1,r3 | |
| 170 | + moveq 0,r4 | |
| 171 | + asr.b r4,r3 | |
| 172 | + test_move_cc 1 0 0 0 | |
| 173 | + checkr3 ffffffff | |
| 174 | + | |
| 175 | + moveq -1,r3 | |
| 176 | + moveq 1,r4 | |
| 177 | + asr.b r4,r3 | |
| 178 | + test_move_cc 1 0 0 0 | |
| 179 | + checkr3 ffffffff | |
| 180 | + | |
| 181 | + moveq 2,r3 | |
| 182 | + moveq 1,r4 | |
| 183 | + asr.b r4,r3 | |
| 184 | + test_move_cc 0 0 0 0 | |
| 185 | + checkr3 1 | |
| 186 | + | |
| 187 | + moveq -1,r3 | |
| 188 | + moveq 31,r4 | |
| 189 | + asr.b r4,r3 | |
| 190 | + test_move_cc 1 0 0 0 | |
| 191 | + checkr3 ffffffff | |
| 192 | + | |
| 193 | + moveq -1,r3 | |
| 194 | + moveq 15,r4 | |
| 195 | + asr.b r4,r3 | |
| 196 | + test_move_cc 1 0 0 0 | |
| 197 | + checkr3 ffffffff | |
| 198 | + | |
| 199 | + moveq -1,r3 | |
| 200 | + moveq 7,r4 | |
| 201 | + asr.b r4,r3 | |
| 202 | + test_move_cc 1 0 0 0 | |
| 203 | + checkr3 ffffffff | |
| 204 | + | |
| 205 | +; FIXME: was wrong. | |
| 206 | + move.d 0x5a67f19f,r3 | |
| 207 | + moveq 12,r4 | |
| 208 | + asr.b r4,r3 | |
| 209 | + test_move_cc 1 0 0 0 | |
| 210 | + checkr3 5a67f1ff | |
| 211 | + | |
| 212 | +; FIXME: was wrong. | |
| 213 | + move.d 0x5a67f19f,r3 | |
| 214 | + moveq 4,r4 | |
| 215 | + asr.b r4,r3 | |
| 216 | + test_move_cc 1 0 0 0 | |
| 217 | + checkr3 5a67f1f9 | |
| 218 | + | |
| 219 | + move.d 0x5a67f19f,r3 | |
| 220 | + asrq 31,r3 | |
| 221 | + test_move_cc 0 1 0 0 | |
| 222 | + checkr3 0 | |
| 223 | + | |
| 224 | + move.d 0x5a67419f,r3 | |
| 225 | + moveq 16,r4 | |
| 226 | + asr.w r4,r3 | |
| 227 | + test_move_cc 0 1 0 0 | |
| 228 | + checkr3 5a670000 | |
| 229 | + | |
| 230 | + quit | ... | ... |
tests/cris/check_ba.s
0 → 100644
| 1 | +# mach: crisv0 crisv3 crisv8 crisv10 crisv32 | |
| 2 | +# output: a\n | |
| 3 | + | |
| 4 | + | |
| 5 | + .set smalloffset,0 | |
| 6 | + .set largeoffset,0 | |
| 7 | + | |
| 8 | + | |
| 9 | + .macro fail | |
| 10 | + jump _fail | |
| 11 | + .endm | |
| 12 | + | |
| 13 | + .global main | |
| 14 | +main: | |
| 15 | + moveq 0,$r3 | |
| 16 | + | |
| 17 | +; Short forward branch. | |
| 18 | + ba 0f | |
| 19 | + addq 1,$r3 | |
| 20 | + fail | |
| 21 | + | |
| 22 | +; Max short forward branch. | |
| 23 | +1: | |
| 24 | + ba 2f | |
| 25 | + addq 1,$r3 | |
| 26 | + fail | |
| 27 | + | |
| 28 | +; Short backward branch. | |
| 29 | +0: | |
| 30 | + ba 1b | |
| 31 | + addq 1,$r3 | |
| 32 | + fail | |
| 33 | + | |
| 34 | + .space 254-2+smalloffset+1b-.,0 | |
| 35 | + moveq 0,$r3 | |
| 36 | + | |
| 37 | +2: | |
| 38 | +; Transit branch (long). | |
| 39 | + ba 3f | |
| 40 | + addq 1,$r3 | |
| 41 | + fail | |
| 42 | + | |
| 43 | + moveq 0,$r3 | |
| 44 | +4: | |
| 45 | +; Long forward branch. | |
| 46 | + ba 5f | |
| 47 | + addq 1,$r3 | |
| 48 | + fail | |
| 49 | + | |
| 50 | + .space 256-2-smalloffset+4b-.,0 | |
| 51 | + | |
| 52 | + moveq 0,$r3 | |
| 53 | + | |
| 54 | +; Max short backward branch. | |
| 55 | +3: | |
| 56 | + ba 4b | |
| 57 | + addq 1,$r3 | |
| 58 | + fail | |
| 59 | + | |
| 60 | +5: | |
| 61 | +; Max long forward branch. | |
| 62 | + ba 6f | |
| 63 | + addq 1,$r3 | |
| 64 | + fail | |
| 65 | + | |
| 66 | + .space 32766+largeoffset-2+5b-.,0 | |
| 67 | + | |
| 68 | + moveq 0,$r3 | |
| 69 | +6: | |
| 70 | +; Transit branch. | |
| 71 | + ba 7f | |
| 72 | + addq 1,$r3 | |
| 73 | + fail | |
| 74 | + | |
| 75 | + moveq 0,$r3 | |
| 76 | +9: | |
| 77 | + jsr pass | |
| 78 | + nop | |
| 79 | + | |
| 80 | +; Transit branch. | |
| 81 | + moveq 0,$r3 | |
| 82 | +7: | |
| 83 | + ba 8f | |
| 84 | + addq 1,$r3 | |
| 85 | + fail | |
| 86 | + | |
| 87 | + .space 32768-largeoffset+9b-.,0 | |
| 88 | + | |
| 89 | +8: | |
| 90 | +; Max long backward branch. | |
| 91 | + ba 9b | |
| 92 | + addq 1,$r3 | |
| 93 | + fail | ... | ... |
tests/cris/check_bas.s
0 → 100644
| 1 | +# mach: crisv32 | |
| 2 | +# output: 0\n0\n0\nfb349abc\n0\n12124243\n0\n0\neab5baad\n0\nefb37832\n | |
| 3 | + | |
| 4 | + .include "testutils.inc" | |
| 5 | + start | |
| 6 | +x: | |
| 7 | + setf zncv | |
| 8 | + bsr 0f | |
| 9 | + nop | |
| 10 | +0: | |
| 11 | + test_cc 1 1 1 1 | |
| 12 | + move srp,r3 | |
| 13 | + sub.d 0b,r3 | |
| 14 | + checkr3 0 | |
| 15 | + | |
| 16 | + bas 1f,mof | |
| 17 | + moveq 0,r0 | |
| 18 | +6: | |
| 19 | + nop | |
| 20 | + quit | |
| 21 | + | |
| 22 | +2: | |
| 23 | + move srp,r3 | |
| 24 | + sub.d 3f,r3 | |
| 25 | + checkr3 0 | |
| 26 | + move srp,r4 | |
| 27 | + subq 4,r4 | |
| 28 | + move.d [r4],r3 | |
| 29 | + checkr3 fb349abc | |
| 30 | + | |
| 31 | + basc 4f,mof | |
| 32 | + nop | |
| 33 | + .dword 0x12124243 | |
| 34 | +7: | |
| 35 | + nop | |
| 36 | + quit | |
| 37 | + | |
| 38 | +8: | |
| 39 | + move mof,r3 | |
| 40 | + sub.d 7f,r3 | |
| 41 | + checkr3 0 | |
| 42 | + | |
| 43 | + move mof,r4 | |
| 44 | + subq 4,r4 | |
| 45 | + move.d [r4],r3 | |
| 46 | + checkr3 eab5baad | |
| 47 | + | |
| 48 | + jasc 9f,mof | |
| 49 | + nop | |
| 50 | + .dword 0xefb37832 | |
| 51 | +0: | |
| 52 | + quit | |
| 53 | + | |
| 54 | + quit | |
| 55 | +9: | |
| 56 | + move mof,r3 | |
| 57 | + sub.d 0b,r3 | |
| 58 | + checkr3 0 | |
| 59 | + | |
| 60 | + move mof,r4 | |
| 61 | + subq 4,r4 | |
| 62 | + move.d [r4],r3 | |
| 63 | + checkr3 efb37832 | |
| 64 | + | |
| 65 | + quit | |
| 66 | + | |
| 67 | +4: | |
| 68 | + move mof,r3 | |
| 69 | + sub.d 7b,r3 | |
| 70 | + checkr3 0 | |
| 71 | + move mof,r4 | |
| 72 | + subq 4,r4 | |
| 73 | + move.d [r4],r3 | |
| 74 | + checkr3 12124243 | |
| 75 | + basc 5f,bz | |
| 76 | + moveq 0,r3 | |
| 77 | + .dword 0x7634aeba | |
| 78 | + quit | |
| 79 | + | |
| 80 | + .space 32770,0 | |
| 81 | +1: | |
| 82 | + move mof,r3 | |
| 83 | + sub.d 6b,r3 | |
| 84 | + checkr3 0 | |
| 85 | + | |
| 86 | + bsrc 2b | |
| 87 | + nop | |
| 88 | + .dword 0xfb349abc | |
| 89 | +3: | |
| 90 | + | |
| 91 | + quit | |
| 92 | + | |
| 93 | +5: | |
| 94 | + move mof,r3 | |
| 95 | + sub.d 7b,r3 | |
| 96 | + checkr3 0 | |
| 97 | + move.d 8b,r6 | |
| 98 | + jasc r6,mof | |
| 99 | + nop | |
| 100 | + .dword 0xeab5baad | |
| 101 | +7: | |
| 102 | + quit | ... | ... |
tests/cris/check_bcc.s
0 → 100644
| 1 | + .global main | |
| 2 | + .type main, @function | |
| 3 | +main: | |
| 4 | + clearf nzvc | |
| 5 | + setf nzv | |
| 6 | + bcc 0f | |
| 7 | + addq 1, $r3 | |
| 8 | + jump dofail | |
| 9 | + | |
| 10 | +0: | |
| 11 | + clearf nzvc | |
| 12 | + setf nzv | |
| 13 | + bcs dofail | |
| 14 | + addq 1,$r3 | |
| 15 | + | |
| 16 | + clearf nzvc | |
| 17 | + setf ncv | |
| 18 | + bne 1f | |
| 19 | + addq 1, $r3 | |
| 20 | + | |
| 21 | +fail: | |
| 22 | +dofail: | |
| 23 | + jump _fail | |
| 24 | + | |
| 25 | +1: | |
| 26 | + clearf nzvc | |
| 27 | + setf ncv | |
| 28 | + beq dofail | |
| 29 | + addq 1,$r3 | |
| 30 | + | |
| 31 | + clearf nzvc | |
| 32 | + setf ncz | |
| 33 | + bvc 2f | |
| 34 | + addq 1,$r3 | |
| 35 | + jump dofail | |
| 36 | + | |
| 37 | +2: | |
| 38 | + clearf nzvc | |
| 39 | + setf ncz | |
| 40 | + bvs dofail | |
| 41 | + addq 1,$r3 | |
| 42 | + | |
| 43 | + clearf nzvc | |
| 44 | + setf vcz | |
| 45 | + bpl 3f | |
| 46 | + addq 1,$r3 | |
| 47 | + jump fail | |
| 48 | +3: | |
| 49 | + clearf nzvc | |
| 50 | + setf vcz | |
| 51 | + bmi dofail | |
| 52 | + addq 1,$r3 | |
| 53 | + | |
| 54 | + clearf nzvc | |
| 55 | + setf nv | |
| 56 | + bls dofail | |
| 57 | + addq 1,$r3 | |
| 58 | + | |
| 59 | + clearf nzvc | |
| 60 | + setf nv | |
| 61 | + bhi 4f | |
| 62 | + addq 1,$r3 | |
| 63 | + jump dofail | |
| 64 | + | |
| 65 | +4: | |
| 66 | + clearf nzvc | |
| 67 | + setf zc | |
| 68 | + bge 5f | |
| 69 | + addq 1,$r3 | |
| 70 | + jump dofail | |
| 71 | + | |
| 72 | +5: | |
| 73 | + clearf nzvc | |
| 74 | + setf zc | |
| 75 | + blt dofail | |
| 76 | + addq 1,$r3 | |
| 77 | + | |
| 78 | + clearf nzvc | |
| 79 | + setf c | |
| 80 | + bgt 6f | |
| 81 | + addq 1,$r3 | |
| 82 | + jump fail | |
| 83 | + | |
| 84 | +6: | |
| 85 | + clearf nzvc | |
| 86 | + setf c | |
| 87 | + ble dofail | |
| 88 | + addq 1,$r3 | |
| 89 | + | |
| 90 | +;;;;;;;;;; | |
| 91 | + | |
| 92 | + setf nzvc | |
| 93 | + clearf nzv | |
| 94 | + bcc dofail | |
| 95 | + addq 1,$r3 | |
| 96 | + | |
| 97 | + setf nzvc | |
| 98 | + clearf nzv | |
| 99 | + bcs 0f | |
| 100 | + addq 1,$r3 | |
| 101 | + jump fail | |
| 102 | + | |
| 103 | +0: | |
| 104 | + setf nzvc | |
| 105 | + clearf ncv | |
| 106 | + bne dofail | |
| 107 | + addq 1,$r3 | |
| 108 | + | |
| 109 | + setf nzvc | |
| 110 | + clearf ncv | |
| 111 | + beq 1f | |
| 112 | + addq 1,$r3 | |
| 113 | + jump fail | |
| 114 | + | |
| 115 | +1: | |
| 116 | + setf nzvc | |
| 117 | + clearf ncz | |
| 118 | + bvc dofail | |
| 119 | + addq 1,$r3 | |
| 120 | + | |
| 121 | + setf nzvc | |
| 122 | + clearf ncz | |
| 123 | + bvs 2f | |
| 124 | + addq 1,$r3 | |
| 125 | + jump fail | |
| 126 | + | |
| 127 | +2: | |
| 128 | + setf nzvc | |
| 129 | + clearf vcz | |
| 130 | + bpl dofail | |
| 131 | + addq 1,$r3 | |
| 132 | + | |
| 133 | + setf nzvc | |
| 134 | + clearf vcz | |
| 135 | + bmi 3f | |
| 136 | + addq 1,$r3 | |
| 137 | + jump fail | |
| 138 | + | |
| 139 | +3: | |
| 140 | + setf nzvc | |
| 141 | + clearf nv | |
| 142 | + bls 4f | |
| 143 | + addq 1,$r3 | |
| 144 | + jump fail | |
| 145 | + | |
| 146 | +4: | |
| 147 | + setf nzvc | |
| 148 | + clearf nv | |
| 149 | + bhi dofail | |
| 150 | + addq 1,$r3 | |
| 151 | + | |
| 152 | + setf zvc | |
| 153 | + clearf nzc | |
| 154 | + bge dofail | |
| 155 | + addq 1,$r3 | |
| 156 | + | |
| 157 | + setf nzc | |
| 158 | + clearf vzc | |
| 159 | + blt 5f | |
| 160 | + addq 1,$r3 | |
| 161 | + jump fail | |
| 162 | + | |
| 163 | +5: | |
| 164 | + setf nzvc | |
| 165 | + clearf c | |
| 166 | + bgt dofail | |
| 167 | + addq 1,$r3 | |
| 168 | + | |
| 169 | + setf nzvc | |
| 170 | + clearf c | |
| 171 | + ble 6f | |
| 172 | + addq 1,$r3 | |
| 173 | + jump fail | |
| 174 | + | |
| 175 | +6: | |
| 176 | + ; do a forward branch. | |
| 177 | + ba 2f | |
| 178 | + nop | |
| 179 | + .fill 100 | |
| 180 | +1: | |
| 181 | + ba 3f | |
| 182 | + nop | |
| 183 | + .fill 800 | |
| 184 | +2: | |
| 185 | + ba 1b | |
| 186 | + nop | |
| 187 | + .fill 1024 | |
| 188 | +3: | |
| 189 | + | |
| 190 | + moveq 31, $r0 | |
| 191 | +1: bne 1b | |
| 192 | + subq 1, $r0 | |
| 193 | + | |
| 194 | + jsr pass | |
| 195 | + moveq 0, $r10 | |
| 196 | + ret | |
| 197 | + nop | ... | ... |
tests/cris/check_bound.c
0 → 100644
| 1 | +#include <stdio.h> | |
| 2 | +#include <stdlib.h> | |
| 3 | +#include <stdint.h> | |
| 4 | +#include "sys.h" | |
| 5 | +#include "crisutils.h" | |
| 6 | + | |
| 7 | +extern inline int cris_bound_b(int v, int b) { | |
| 8 | + int r = v; | |
| 9 | + asm ("bound.b\t%1, %0\n" : "+r" (r) : "ri" (b)); | |
| 10 | + return r; | |
| 11 | +} | |
| 12 | + | |
| 13 | +extern inline int cris_bound_w(int v, int b) { | |
| 14 | + int r = v; | |
| 15 | + asm ("bound.w\t%1, %0\n" : "+r" (r) : "ri" (b)); | |
| 16 | + return r; | |
| 17 | +} | |
| 18 | + | |
| 19 | +extern inline int cris_bound_d(int v, int b) { | |
| 20 | + int r = v; | |
| 21 | + asm ("bound.d\t%1, %0\n" : "+r" (r) : "ri" (b)); | |
| 22 | + return r; | |
| 23 | +} | |
| 24 | + | |
| 25 | +int main(void) | |
| 26 | +{ | |
| 27 | + int r; | |
| 28 | + | |
| 29 | + cris_tst_cc_init(); | |
| 30 | + r = cris_bound_d(-1, 2); | |
| 31 | + cris_tst_cc(0, 0, 0, 0); | |
| 32 | + if (r != 2) | |
| 33 | + err(); | |
| 34 | + | |
| 35 | + cris_tst_cc_init(); | |
| 36 | + r = cris_bound_d(2, 0xffffffff); | |
| 37 | + cris_tst_cc(0, 0, 0, 0); | |
| 38 | + if (r != 2) | |
| 39 | + err(); | |
| 40 | + | |
| 41 | + cris_tst_cc_init(); | |
| 42 | + r = cris_bound_d(0xffff, 0xffff); | |
| 43 | + cris_tst_cc(0, 0, 0, 0); | |
| 44 | + if (r != 0xffff) | |
| 45 | + err(); | |
| 46 | + | |
| 47 | + cris_tst_cc_init(); | |
| 48 | + r = cris_bound_d(-1, 0xffffffff); | |
| 49 | + cris_tst_cc(1, 0, 0, 0); | |
| 50 | + if (r != 0xffffffff) | |
| 51 | + err(); | |
| 52 | + | |
| 53 | + cris_tst_cc_init(); | |
| 54 | + r = cris_bound_d(0x78134452, 0x5432f789); | |
| 55 | + cris_tst_cc(0, 0, 0, 0); | |
| 56 | + if (r != 0x5432f789) | |
| 57 | + err(); | |
| 58 | + | |
| 59 | + cris_tst_cc_init(); | |
| 60 | + r = cris_bound_w(-1, 2); | |
| 61 | + cris_tst_cc(0, 0, 0, 0); | |
| 62 | + if (r != 2) | |
| 63 | + err(); | |
| 64 | + | |
| 65 | + cris_tst_cc_init(); | |
| 66 | + r = cris_bound_w(-1, 0xffff); | |
| 67 | + cris_tst_cc(0, 0, 0, 0); | |
| 68 | + if (r != 0xffff) | |
| 69 | + err(); | |
| 70 | + | |
| 71 | + cris_tst_cc_init(); | |
| 72 | + r = cris_bound_w(2, 0xffff); | |
| 73 | + cris_tst_cc(0, 0, 0, 0); | |
| 74 | + if (r != 2) | |
| 75 | + err(); | |
| 76 | + | |
| 77 | + cris_tst_cc_init(); | |
| 78 | + r = cris_bound_w(0xfedaffff, 0xffff); | |
| 79 | + cris_tst_cc(0, 0, 0, 0); | |
| 80 | + if (r != 0xffff) | |
| 81 | + err(); | |
| 82 | + | |
| 83 | + cris_tst_cc_init(); | |
| 84 | + r = cris_bound_w(0x78134452, 0xf789); | |
| 85 | + cris_tst_cc(0, 0, 0, 0); | |
| 86 | + if (r != 0xf789) | |
| 87 | + err(); | |
| 88 | + | |
| 89 | + cris_tst_cc_init(); | |
| 90 | + r = cris_bound_b(-1, 2); | |
| 91 | + cris_tst_cc(0, 0, 0, 0); | |
| 92 | + if (r != 2) | |
| 93 | + err(); | |
| 94 | + | |
| 95 | + cris_tst_cc_init(); | |
| 96 | + r = cris_bound_b(2, 0xff); | |
| 97 | + cris_tst_cc(0, 0, 0, 0); | |
| 98 | + if (r != 2) | |
| 99 | + err(); | |
| 100 | + | |
| 101 | + cris_tst_cc_init(); | |
| 102 | + r = cris_bound_b(-1, 0xff); | |
| 103 | + cris_tst_cc(0, 0, 0, 0); | |
| 104 | + if (r != 0xff) | |
| 105 | + err(); | |
| 106 | + | |
| 107 | + cris_tst_cc_init(); | |
| 108 | + r = cris_bound_b(0xff, 0xff); | |
| 109 | + cris_tst_cc(0, 0, 0, 0); | |
| 110 | + if (r != 0xff) | |
| 111 | + err(); | |
| 112 | + | |
| 113 | + cris_tst_cc_init(); | |
| 114 | + r = cris_bound_b(0xfeda49ff, 0xff); | |
| 115 | + cris_tst_cc(0, 0, 0, 0); | |
| 116 | + if (r != 0xff) | |
| 117 | + err(); | |
| 118 | + | |
| 119 | + cris_tst_cc_init(); | |
| 120 | + r = cris_bound_b(0x78134452, 0x89); | |
| 121 | + cris_tst_cc(0, 0, 0, 0); | |
| 122 | + if (r != 0x89) | |
| 123 | + err(); | |
| 124 | + | |
| 125 | + cris_tst_cc_init(); | |
| 126 | + r = cris_bound_w(0x78134452, 0); | |
| 127 | + cris_tst_cc(0, 1, 0, 0); | |
| 128 | + if (r != 0) | |
| 129 | + err(); | |
| 130 | + | |
| 131 | + cris_tst_cc_init(); | |
| 132 | + r = cris_bound_b(0xffff, -1); | |
| 133 | + cris_tst_cc(0, 0, 0, 0); | |
| 134 | + if (r != 0xff) | |
| 135 | + err(); | |
| 136 | + | |
| 137 | + pass(); | |
| 138 | + return 0; | |
| 139 | +} | ... | ... |
tests/cris/check_boundc.s
0 → 100644
| 1 | +# mach: crisv0 crisv3 crisv8 crisv10 crisv32 | |
| 2 | +# output: 2\n2\nffff\nffffffff\n5432f789\n2\nffff\n2\nffff\nffff\nf789\n2\n2\nff\nff\nff\n89\n0\nff\n | |
| 3 | + | |
| 4 | + .include "testutils.inc" | |
| 5 | + start | |
| 6 | + moveq -1,r3 | |
| 7 | + moveq 2,r4 | |
| 8 | + bound.d 2,r3 | |
| 9 | + test_move_cc 0 0 0 0 | |
| 10 | + checkr3 2 | |
| 11 | + | |
| 12 | + moveq 2,r3 | |
| 13 | + bound.d 0xffffffff,r3 | |
| 14 | + test_move_cc 0 0 0 0 | |
| 15 | + checkr3 2 | |
| 16 | + | |
| 17 | + move.d 0xffff,r3 | |
| 18 | + bound.d 0xffff,r3 | |
| 19 | + test_move_cc 0 0 0 0 | |
| 20 | + checkr3 ffff | |
| 21 | + | |
| 22 | + moveq -1,r3 | |
| 23 | + bound.d 0xffffffff,r3 | |
| 24 | + test_move_cc 1 0 0 0 | |
| 25 | + checkr3 ffffffff | |
| 26 | + | |
| 27 | + move.d 0x78134452,r3 | |
| 28 | + bound.d 0x5432f789,r3 | |
| 29 | + test_move_cc 0 0 0 0 | |
| 30 | + checkr3 5432f789 | |
| 31 | + | |
| 32 | + moveq -1,r3 | |
| 33 | + bound.w 2,r3 | |
| 34 | + test_move_cc 0 0 0 0 | |
| 35 | + checkr3 2 | |
| 36 | + | |
| 37 | + moveq -1,r3 | |
| 38 | + bound.w 0xffff,r3 | |
| 39 | + test_move_cc 0 0 0 0 | |
| 40 | + checkr3 ffff | |
| 41 | + | |
| 42 | + moveq 2,r3 | |
| 43 | + bound.w 0xffff,r3 | |
| 44 | + test_move_cc 0 0 0 0 | |
| 45 | + checkr3 2 | |
| 46 | + | |
| 47 | + move.d 0xffff,r3 | |
| 48 | + bound.w 0xffff,r3 | |
| 49 | + test_move_cc 0 0 0 0 | |
| 50 | + checkr3 ffff | |
| 51 | + | |
| 52 | + move.d 0xfedaffff,r3 | |
| 53 | + bound.w 0xffff,r3 | |
| 54 | + test_move_cc 0 0 0 0 | |
| 55 | + checkr3 ffff | |
| 56 | + | |
| 57 | + move.d 0x78134452,r3 | |
| 58 | + bound.w 0xf789,r3 | |
| 59 | + test_move_cc 0 0 0 0 | |
| 60 | + checkr3 f789 | |
| 61 | + | |
| 62 | + moveq -1,r3 | |
| 63 | + bound.b 2,r3 | |
| 64 | + test_move_cc 0 0 0 0 | |
| 65 | + checkr3 2 | |
| 66 | + | |
| 67 | + moveq 2,r3 | |
| 68 | + bound.b 0xff,r3 | |
| 69 | + test_move_cc 0 0 0 0 | |
| 70 | + checkr3 2 | |
| 71 | + | |
| 72 | + moveq -1,r3 | |
| 73 | + bound.b 0xff,r3 | |
| 74 | + test_move_cc 0 0 0 0 | |
| 75 | + checkr3 ff | |
| 76 | + | |
| 77 | + move.d 0xff,r3 | |
| 78 | + bound.b 0xff,r3 | |
| 79 | + test_move_cc 0 0 0 0 | |
| 80 | + checkr3 ff | |
| 81 | + | |
| 82 | + move.d 0xfeda49ff,r3 | |
| 83 | + bound.b 0xff,r3 | |
| 84 | + test_move_cc 0 0 0 0 | |
| 85 | + checkr3 ff | |
| 86 | + | |
| 87 | + move.d 0x78134452,r3 | |
| 88 | + bound.b 0x89,r3 | |
| 89 | + test_move_cc 0 0 0 0 | |
| 90 | + checkr3 89 | |
| 91 | + | |
| 92 | + bound.w 0,r3 | |
| 93 | + test_move_cc 0 1 0 0 | |
| 94 | + checkr3 0 | |
| 95 | + | |
| 96 | + move.d 0xffff,r3 | |
| 97 | + bound.b -1,r3 | |
| 98 | + test_move_cc 0 0 0 0 | |
| 99 | + checkr3 ff | |
| 100 | + | |
| 101 | + quit | ... | ... |
tests/cris/check_boundr.s
0 → 100644
| 1 | +# mach: crisv0 crisv3 crisv8 crisv10 crisv32 | |
| 2 | +# output: 2\n2\nffff\nffffffff\n5432f789\n2\n2\nffff\nffff\nffff\nf789\n2\n2\nff\nff\n89\nfeda4953\nfeda4962\n0\n0\n | |
| 3 | + | |
| 4 | + .include "testutils.inc" | |
| 5 | + start | |
| 6 | + moveq -1,r3 | |
| 7 | + moveq 2,r4 | |
| 8 | + bound.d r4,r3 | |
| 9 | + test_move_cc 0 0 0 0 | |
| 10 | + checkr3 2 | |
| 11 | + | |
| 12 | + moveq 2,r3 | |
| 13 | + moveq -1,r4 | |
| 14 | + bound.d r4,r3 | |
| 15 | + test_move_cc 0 0 0 0 | |
| 16 | + checkr3 2 | |
| 17 | + | |
| 18 | + move.d 0xffff,r4 | |
| 19 | + move.d r4,r3 | |
| 20 | + bound.d r4,r3 | |
| 21 | + test_move_cc 0 0 0 0 | |
| 22 | + checkr3 ffff | |
| 23 | + | |
| 24 | + moveq -1,r4 | |
| 25 | + move.d r4,r3 | |
| 26 | + bound.d r4,r3 | |
| 27 | + test_move_cc 1 0 0 0 | |
| 28 | + checkr3 ffffffff | |
| 29 | + | |
| 30 | + move.d 0x5432f789,r4 | |
| 31 | + move.d 0x78134452,r3 | |
| 32 | + bound.d r4,r3 | |
| 33 | + test_move_cc 0 0 0 0 | |
| 34 | + checkr3 5432f789 | |
| 35 | + | |
| 36 | + moveq -1,r3 | |
| 37 | + moveq 2,r4 | |
| 38 | + bound.w r4,r3 | |
| 39 | + test_move_cc 0 0 0 0 | |
| 40 | + checkr3 2 | |
| 41 | + | |
| 42 | + moveq 2,r3 | |
| 43 | + moveq -1,r4 | |
| 44 | + bound.w r4,r3 | |
| 45 | + test_move_cc 0 0 0 0 | |
| 46 | + checkr3 2 | |
| 47 | + | |
| 48 | + moveq -1,r3 | |
| 49 | + bound.w r3,r3 | |
| 50 | + test_move_cc 0 0 0 0 | |
| 51 | + checkr3 ffff | |
| 52 | + | |
| 53 | + move.d 0xffff,r4 | |
| 54 | + move.d r4,r3 | |
| 55 | + bound.w r4,r3 | |
| 56 | + test_move_cc 0 0 0 0 | |
| 57 | + checkr3 ffff | |
| 58 | + | |
| 59 | + move.d 0xfedaffff,r4 | |
| 60 | + move.d r4,r3 | |
| 61 | + bound.w r4,r3 | |
| 62 | + test_move_cc 0 0 0 0 | |
| 63 | + checkr3 ffff | |
| 64 | + | |
| 65 | + move.d 0x5432f789,r4 | |
| 66 | + move.d 0x78134452,r3 | |
| 67 | + bound.w r4,r3 | |
| 68 | + test_move_cc 0 0 0 0 | |
| 69 | + checkr3 f789 | |
| 70 | + | |
| 71 | + moveq -1,r3 | |
| 72 | + moveq 2,r4 | |
| 73 | + bound.b r4,r3 | |
| 74 | + test_move_cc 0 0 0 0 | |
| 75 | + checkr3 2 | |
| 76 | + | |
| 77 | + moveq 2,r3 | |
| 78 | + moveq -1,r4 | |
| 79 | + bound.b r4,r3 | |
| 80 | + test_move_cc 0 0 0 0 | |
| 81 | + checkr3 2 | |
| 82 | + | |
| 83 | + move.d 0xff,r4 | |
| 84 | + move.d r4,r3 | |
| 85 | + bound.b r4,r3 | |
| 86 | + test_move_cc 0 0 0 0 | |
| 87 | + checkr3 ff | |
| 88 | + | |
| 89 | + move.d 0xfeda49ff,r4 | |
| 90 | + move.d r4,r3 | |
| 91 | + bound.b r4,r3 | |
| 92 | + test_move_cc 0 0 0 0 | |
| 93 | + checkr3 ff | |
| 94 | + | |
| 95 | + move.d 0x5432f789,r4 | |
| 96 | + move.d 0x78134452,r3 | |
| 97 | + bound.b r4,r3 | |
| 98 | + test_move_cc 0 0 0 0 | |
| 99 | + checkr3 89 | |
| 100 | + | |
| 101 | + move.d 0xfeda4956,r3 | |
| 102 | + move.d 0xfeda4953,r4 | |
| 103 | + bound.d r4,r3 | |
| 104 | + test_move_cc 1 0 0 0 | |
| 105 | + checkr3 feda4953 | |
| 106 | + | |
| 107 | + move.d 0xfeda4962,r3 | |
| 108 | + move.d 0xfeda4963,r4 | |
| 109 | + bound.d r4,r3 | |
| 110 | + test_move_cc 1 0 0 0 | |
| 111 | + checkr3 feda4962 | |
| 112 | + | |
| 113 | + move.d 0xfeda4956,r3 | |
| 114 | + move.d 0,r4 | |
| 115 | + bound.d r4,r3 | |
| 116 | + test_move_cc 0 1 0 0 | |
| 117 | + checkr3 0 | |
| 118 | + | |
| 119 | + move.d 0xfeda4956,r4 | |
| 120 | + move.d 0,r3 | |
| 121 | + bound.d r4,r3 | |
| 122 | + test_move_cc 0 1 0 0 | |
| 123 | + checkr3 0 | |
| 124 | + | |
| 125 | + quit | ... | ... |
tests/cris/check_btst.s
0 → 100644
| 1 | +# mach: crisv0 crisv3 crisv8 crisv10 crisv32 | |
| 2 | +# output: 1111\n | |
| 3 | + | |
| 4 | + .include "testutils.inc" | |
| 5 | + start | |
| 6 | + clearf nzvc | |
| 7 | + moveq -1,r3 | |
| 8 | + .if 1 ;..asm.arch.cris.v32 | |
| 9 | + .else | |
| 10 | + setf vc | |
| 11 | + .endif | |
| 12 | + btstq 0,r3 | |
| 13 | + test_cc 1 0 0 0 | |
| 14 | + | |
| 15 | + moveq 2,r3 | |
| 16 | + btstq 1,r3 | |
| 17 | + test_cc 1 0 0 0 | |
| 18 | + | |
| 19 | + moveq 4,r3 | |
| 20 | + btstq 1,r3 | |
| 21 | + test_cc 0 1 0 0 | |
| 22 | + | |
| 23 | + moveq -1,r3 | |
| 24 | + btstq 31,r3 | |
| 25 | + test_cc 1 0 0 0 | |
| 26 | + | |
| 27 | + move.d 0x5a67f19f,r3 | |
| 28 | + btstq 12,r3 | |
| 29 | + test_cc 1 0 0 0 | |
| 30 | + | |
| 31 | + move.d 0xda67f19f,r3 | |
| 32 | + move.d 29,r4 | |
| 33 | + btst r4,r3 | |
| 34 | + test_cc 0 0 0 0 | |
| 35 | + | |
| 36 | + move.d 0xda67f19f,r3 | |
| 37 | + move.d 32,r4 | |
| 38 | + btst r4,r3 | |
| 39 | + test_cc 1 0 0 0 | |
| 40 | + | |
| 41 | + move.d 0xda67f191,r3 | |
| 42 | + move.d 33,r4 | |
| 43 | + btst r4,r3 | |
| 44 | + test_cc 0 0 0 0 | |
| 45 | + | |
| 46 | + moveq -1,r3 | |
| 47 | + moveq 0,r4 | |
| 48 | + btst r4,r3 | |
| 49 | + test_cc 1 0 0 0 | |
| 50 | + | |
| 51 | + moveq 2,r3 | |
| 52 | + moveq 1,r4 | |
| 53 | + btst r4,r3 | |
| 54 | + test_cc 1 0 0 0 | |
| 55 | + | |
| 56 | + moveq -1,r3 | |
| 57 | + moveq 31,r4 | |
| 58 | + btst r4,r3 | |
| 59 | + test_cc 1 0 0 0 | |
| 60 | + | |
| 61 | + moveq 4,r3 | |
| 62 | + btstq 1,r3 | |
| 63 | + test_cc 0 1 0 0 | |
| 64 | + | |
| 65 | + moveq -1,r3 | |
| 66 | + moveq 15,r4 | |
| 67 | + btst r4,r3 | |
| 68 | + test_cc 1 0 0 0 | |
| 69 | + | |
| 70 | + move.d 0x5a67f19f,r3 | |
| 71 | + moveq 12,r4 | |
| 72 | + btst r4,r3 | |
| 73 | + test_cc 1 0 0 0 | |
| 74 | + | |
| 75 | + move.d 0x5a678000,r3 | |
| 76 | + moveq 11,r4 | |
| 77 | + btst r4,r3 | |
| 78 | + test_cc 0 1 0 0 | |
| 79 | + | |
| 80 | + move.d 0x5a67f19f,r3 | |
| 81 | + btst r3,r3 | |
| 82 | + test_cc 0 0 0 0 | |
| 83 | + | |
| 84 | + move.d 0x1111,r3 | |
| 85 | + checkr3 1111 | |
| 86 | + | |
| 87 | + quit | ... | ... |
tests/cris/check_clearfv32.s
0 → 100644
| 1 | +# mach: crisv32 | |
| 2 | +# output: ef\nef\n | |
| 3 | + | |
| 4 | +; Check that "clearf x" doesn't trivially fail. | |
| 5 | + | |
| 6 | + .include "testutils.inc" | |
| 7 | + start | |
| 8 | + setf puixnzvc | |
| 9 | + clearf x ; Actually, x would be cleared by almost-all other insns. | |
| 10 | + move ccs,r3 | |
| 11 | + checkr3 ef | |
| 12 | + | |
| 13 | + setf puixnzvc | |
| 14 | + moveq 0, $r3 ; moveq should only clear the xflag. | |
| 15 | + move ccs,r3 | |
| 16 | + checkr3 ef | |
| 17 | + quit | ... | ... |
tests/cris/check_clrjmp1.s
0 → 100644
| 1 | +# mach: crisv3 crisv8 crisv10 crisv32 | |
| 2 | +# output: ffffff00\n | |
| 3 | + | |
| 4 | +; A bug resulting in a non-effectual clear.b discovered running the GCC | |
| 5 | +; testsuite; jump actually wrote to p0. | |
| 6 | + | |
| 7 | + .include "testutils.inc" | |
| 8 | + | |
| 9 | + start | |
| 10 | + jump 1f | |
| 11 | + nop | |
| 12 | + .p2align 8 | |
| 13 | +1: | |
| 14 | + move.d y,r4 | |
| 15 | + | |
| 16 | + .if 0 ;0 == ..asm.arch.cris.v32 | |
| 17 | +; There was a bug causing this insn to set special register p0 | |
| 18 | +; (byte-clear) to 8 (low 8 bits of location after insn). | |
| 19 | + jump [r4+] | |
| 20 | + .endif | |
| 21 | + | |
| 22 | +1: | |
| 23 | + move.d 0f,r4 | |
| 24 | + | |
| 25 | +; The corresponding bug would cause this insn too, to set p0. | |
| 26 | + jump r4 | |
| 27 | + nop | |
| 28 | + quit | |
| 29 | +0: | |
| 30 | + moveq -1,r3 | |
| 31 | + clear.b r3 | |
| 32 | + checkr3 ffffff00 | |
| 33 | + quit | |
| 34 | + | |
| 35 | +y: | |
| 36 | + .dword 1b | ... | ... |
tests/cris/check_cmp-2.s
0 → 100644
tests/cris/check_cmpc.s
0 → 100644
| 1 | +# mach: crisv0 crisv3 crisv8 crisv10 crisv32 | |
| 2 | +# output: ffffffff\n2\nffff\nffffffff\n78134452\nffffffff\n2\nffff\nfedaffff\n78134452\nffffffff\n2\nff\nfeda49ff\n78134452\n85649282\n | |
| 3 | + | |
| 4 | + .include "testutils.inc" | |
| 5 | + start | |
| 6 | + moveq -1,r3 | |
| 7 | + cmp.d -2,r3 | |
| 8 | + test_cc 0 0 0 0 | |
| 9 | + checkr3 ffffffff | |
| 10 | + | |
| 11 | + moveq 2,r3 | |
| 12 | + cmp.d 1,r3 | |
| 13 | + test_cc 0 0 0 0 | |
| 14 | + checkr3 2 | |
| 15 | + | |
| 16 | + move.d 0xffff,r3 | |
| 17 | + cmp.d -0xffff,r3 | |
| 18 | + test_cc 0 0 0 1 | |
| 19 | + checkr3 ffff | |
| 20 | + | |
| 21 | + moveq -1,r3 | |
| 22 | + cmp.d 1,r3 | |
| 23 | + test_cc 1 0 0 0 | |
| 24 | + checkr3 ffffffff | |
| 25 | + | |
| 26 | + move.d 0x78134452,r3 | |
| 27 | + cmp.d -0x5432f789,r3 | |
| 28 | + test_cc 1 0 1 1 | |
| 29 | + checkr3 78134452 | |
| 30 | + | |
| 31 | + moveq -1,r3 | |
| 32 | + cmp.w -2,r3 | |
| 33 | + test_cc 0 0 0 0 | |
| 34 | + checkr3 ffffffff | |
| 35 | + | |
| 36 | + moveq 2,r3 | |
| 37 | + cmp.w 1,r3 | |
| 38 | + test_cc 0 0 0 0 | |
| 39 | + checkr3 2 | |
| 40 | + | |
| 41 | + move.d 0xffff,r3 | |
| 42 | + cmp.w 1,r3 | |
| 43 | + test_cc 1 0 0 0 | |
| 44 | + checkr3 ffff | |
| 45 | + | |
| 46 | + move.d 0xfedaffff,r3 | |
| 47 | + cmp.w 1,r3 | |
| 48 | + test_cc 1 0 0 0 | |
| 49 | + checkr3 fedaffff | |
| 50 | + | |
| 51 | + move.d 0x78134452,r3 | |
| 52 | + cmp.w 0x877,r3 | |
| 53 | + test_cc 0 0 0 0 | |
| 54 | + checkr3 78134452 | |
| 55 | + | |
| 56 | + moveq -1,r3 | |
| 57 | + cmp.b -2,r3 | |
| 58 | + test_cc 0 0 0 0 | |
| 59 | + checkr3 ffffffff | |
| 60 | + | |
| 61 | + moveq 2,r3 | |
| 62 | + cmp.b 1,r3 | |
| 63 | + test_cc 0 0 0 0 | |
| 64 | + checkr3 2 | |
| 65 | + | |
| 66 | + move.d 0xff,r3 | |
| 67 | + cmp.b 1,r3 | |
| 68 | + test_cc 1 0 0 0 | |
| 69 | + checkr3 ff | |
| 70 | + | |
| 71 | + move.d 0xfeda49ff,r3 | |
| 72 | + cmp.b 1,r3 | |
| 73 | + test_cc 1 0 0 0 | |
| 74 | + checkr3 feda49ff | |
| 75 | + | |
| 76 | + move.d 0x78134452,r3 | |
| 77 | + cmp.b 0x77,r3 | |
| 78 | + test_cc 1 0 0 1 | |
| 79 | + checkr3 78134452 | |
| 80 | + | |
| 81 | + move.d 0x85649282,r3 | |
| 82 | + cmp.b 0x82,r3 | |
| 83 | + test_cc 0 1 0 0 | |
| 84 | + checkr3 85649282 | |
| 85 | + | |
| 86 | + quit | ... | ... |
tests/cris/check_cmpm.s
0 → 100644
| 1 | +# mach: crisv0 crisv3 crisv8 crisv10 crisv32 | |
| 2 | +# output: ffffffff\n2\nffff\nffffffff\n78134452\nffffffff\n2\nffff\nfedaffff\n78134452\nffffffff\n2\nff\nfeda49ff\n78134452\n85649222\n | |
| 3 | + | |
| 4 | + .include "testutils.inc" | |
| 5 | + .data | |
| 6 | +x: | |
| 7 | + .dword -2,1,-0xffff,1,-0x5432f789 | |
| 8 | + .word -2,1,1,0x877 | |
| 9 | + .byte -2,1,0x77 | |
| 10 | + .byte 0x22 | |
| 11 | + | |
| 12 | + start | |
| 13 | + moveq -1,r3 | |
| 14 | + move.d x,r5 | |
| 15 | + cmp.d [r5+],r3 | |
| 16 | + test_cc 0 0 0 0 | |
| 17 | + checkr3 ffffffff | |
| 18 | + | |
| 19 | + moveq 2,r3 | |
| 20 | + cmp.d [r5],r3 | |
| 21 | + test_cc 0 0 0 0 | |
| 22 | + addq 4,r5 | |
| 23 | + checkr3 2 | |
| 24 | + | |
| 25 | + move.d 0xffff,r3 | |
| 26 | + cmp.d [r5+],r3 | |
| 27 | + test_cc 0 0 0 1 | |
| 28 | + checkr3 ffff | |
| 29 | + | |
| 30 | + moveq -1,r3 | |
| 31 | + cmp.d [r5+],r3 | |
| 32 | + test_cc 1 0 0 0 | |
| 33 | + checkr3 ffffffff | |
| 34 | + | |
| 35 | + move.d 0x78134452,r3 | |
| 36 | + cmp.d [r5+],r3 | |
| 37 | + test_cc 1 0 1 1 | |
| 38 | + checkr3 78134452 | |
| 39 | + | |
| 40 | + moveq -1,r3 | |
| 41 | + cmp.w [r5+],r3 | |
| 42 | + test_cc 0 0 0 0 | |
| 43 | + checkr3 ffffffff | |
| 44 | + | |
| 45 | + moveq 2,r3 | |
| 46 | + cmp.w [r5+],r3 | |
| 47 | + test_cc 0 0 0 0 | |
| 48 | + checkr3 2 | |
| 49 | + | |
| 50 | + move.d 0xffff,r3 | |
| 51 | + cmp.w [r5],r3 | |
| 52 | + test_cc 1 0 0 0 | |
| 53 | + checkr3 ffff | |
| 54 | + | |
| 55 | + move.d 0xfedaffff,r3 | |
| 56 | + cmp.w [r5+],r3 | |
| 57 | + test_cc 1 0 0 0 | |
| 58 | + checkr3 fedaffff | |
| 59 | + | |
| 60 | + move.d 0x78134452,r3 | |
| 61 | + cmp.w [r5+],r3 | |
| 62 | + test_cc 0 0 0 0 | |
| 63 | + checkr3 78134452 | |
| 64 | + | |
| 65 | + moveq -1,r3 | |
| 66 | + cmp.b [r5],r3 | |
| 67 | + test_cc 0 0 0 0 | |
| 68 | + addq 1,r5 | |
| 69 | + checkr3 ffffffff | |
| 70 | + | |
| 71 | + moveq 2,r3 | |
| 72 | + cmp.b [r5],r3 | |
| 73 | + test_cc 0 0 0 0 | |
| 74 | + checkr3 2 | |
| 75 | + | |
| 76 | + move.d 0xff,r3 | |
| 77 | + cmp.b [r5],r3 | |
| 78 | + test_cc 1 0 0 0 | |
| 79 | + checkr3 ff | |
| 80 | + | |
| 81 | + move.d 0xfeda49ff,r3 | |
| 82 | + cmp.b [r5+],r3 | |
| 83 | + test_cc 1 0 0 0 | |
| 84 | + checkr3 feda49ff | |
| 85 | + | |
| 86 | + move.d 0x78134452,r3 | |
| 87 | + cmp.b [r5+],r3 | |
| 88 | + test_cc 1 0 0 1 | |
| 89 | + checkr3 78134452 | |
| 90 | + | |
| 91 | + move.d 0x85649222,r3 | |
| 92 | + cmp.b [r5],r3 | |
| 93 | + test_cc 0 1 0 0 | |
| 94 | + checkr3 85649222 | |
| 95 | + | |
| 96 | + quit | ... | ... |
tests/cris/check_cmpq.s
0 → 100644
| 1 | +# mach: crisv3 crisv8 crisv10 crisv32 | |
| 2 | +# output: 1\n1\n1\n1f\n1f\nffffffe1\nffffffe1\nffffffe0\n0\n0\nffffffff\nffffffff\n10000\n100\n5678900\n | |
| 3 | + | |
| 4 | + .include "testutils.inc" | |
| 5 | + start | |
| 6 | + moveq 1,r3 | |
| 7 | + cmpq 1,r3 | |
| 8 | + test_cc 0 1 0 0 | |
| 9 | + checkr3 1 | |
| 10 | + | |
| 11 | + cmpq -1,r3 | |
| 12 | + test_cc 0 0 0 1 | |
| 13 | + checkr3 1 | |
| 14 | + | |
| 15 | + cmpq 31,r3 | |
| 16 | + test_cc 1 0 0 1 | |
| 17 | + checkr3 1 | |
| 18 | + | |
| 19 | + moveq 31,r3 | |
| 20 | + cmpq 31,r3 | |
| 21 | + test_cc 0 1 0 0 | |
| 22 | + checkr3 1f | |
| 23 | + | |
| 24 | + cmpq -31,r3 | |
| 25 | + test_cc 0 0 0 1 | |
| 26 | + checkr3 1f | |
| 27 | + | |
| 28 | + movs.b -31,r3 | |
| 29 | + cmpq -31,r3 | |
| 30 | + test_cc 0 1 0 0 | |
| 31 | + checkr3 ffffffe1 | |
| 32 | + | |
| 33 | + cmpq -32,r3 | |
| 34 | + test_cc 0 0 0 0 | |
| 35 | + checkr3 ffffffe1 | |
| 36 | + | |
| 37 | + movs.b -32,r3 | |
| 38 | + cmpq -32,r3 | |
| 39 | + test_cc 0 1 0 0 | |
| 40 | + checkr3 ffffffe0 | |
| 41 | + | |
| 42 | + moveq 0,r3 | |
| 43 | + cmpq 1,r3 | |
| 44 | + test_cc 1 0 0 1 | |
| 45 | + checkr3 0 | |
| 46 | + | |
| 47 | + cmpq -32,r3 | |
| 48 | + test_cc 0 0 0 1 | |
| 49 | + checkr3 0 | |
| 50 | + | |
| 51 | + moveq -1,r3 | |
| 52 | + cmpq 1,r3 | |
| 53 | + test_cc 1 0 0 0 | |
| 54 | + checkr3 ffffffff | |
| 55 | + | |
| 56 | + cmpq -1,r3 | |
| 57 | + test_cc 0 1 0 0 | |
| 58 | + checkr3 ffffffff | |
| 59 | + | |
| 60 | + move.d 0x10000,r3 | |
| 61 | + cmpq 1,r3 | |
| 62 | + test_cc 0 0 0 0 | |
| 63 | + checkr3 10000 | |
| 64 | + | |
| 65 | + move.d 0x100,r3 | |
| 66 | + cmpq 1,r3 | |
| 67 | + test_cc 0 0 0 0 | |
| 68 | + checkr3 100 | |
| 69 | + | |
| 70 | + move.d 0x5678900,r3 | |
| 71 | + cmpq 7,r3 | |
| 72 | + test_cc 0 0 0 0 | |
| 73 | + checkr3 5678900 | |
| 74 | + | |
| 75 | + quit | ... | ... |
tests/cris/check_cmpr.s
0 → 100644
| 1 | +# mach: crisv0 crisv3 crisv8 crisv10 crisv32 | |
| 2 | +# output: ffffffff\n2\nffff\nffffffff\n78134452\nffffffff\n2\nffff\nfedaffff\n78134452\nffffffff\n2\nff\nfeda49ff\n78134452\n85649222\n | |
| 3 | + | |
| 4 | + .include "testutils.inc" | |
| 5 | + start | |
| 6 | + moveq -1,r3 | |
| 7 | + moveq -2,r4 | |
| 8 | + cmp.d r4,r3 | |
| 9 | + test_cc 0 0 0 0 | |
| 10 | + checkr3 ffffffff | |
| 11 | + | |
| 12 | + moveq 2,r3 | |
| 13 | + moveq 1,r4 | |
| 14 | + cmp.d r4,r3 | |
| 15 | + test_cc 0 0 0 0 | |
| 16 | + checkr3 2 | |
| 17 | + | |
| 18 | + move.d 0xffff,r3 | |
| 19 | + move.d -0xffff,r4 | |
| 20 | + cmp.d r4,r3 | |
| 21 | + test_cc 0 0 0 1 | |
| 22 | + checkr3 ffff | |
| 23 | + | |
| 24 | + moveq 1,r4 | |
| 25 | + moveq -1,r3 | |
| 26 | + cmp.d r4,r3 | |
| 27 | + test_cc 1 0 0 0 | |
| 28 | + checkr3 ffffffff | |
| 29 | + | |
| 30 | + move.d -0x5432f789,r4 | |
| 31 | + move.d 0x78134452,r3 | |
| 32 | + cmp.d r4,r3 | |
| 33 | + test_cc 1 0 1 1 | |
| 34 | + checkr3 78134452 | |
| 35 | + | |
| 36 | + moveq -1,r3 | |
| 37 | + moveq -2,r4 | |
| 38 | + cmp.w r4,r3 | |
| 39 | + test_cc 0 0 0 0 | |
| 40 | + checkr3 ffffffff | |
| 41 | + | |
| 42 | + moveq 2,r3 | |
| 43 | + moveq 1,r4 | |
| 44 | + cmp.w r4,r3 | |
| 45 | + test_cc 0 0 0 0 | |
| 46 | + checkr3 2 | |
| 47 | + | |
| 48 | + move.d 0xffff,r3 | |
| 49 | + move.d -0xffff,r4 | |
| 50 | + cmp.w r4,r3 | |
| 51 | + test_cc 1 0 0 0 | |
| 52 | + checkr3 ffff | |
| 53 | + | |
| 54 | + move.d 0xfedaffff,r3 | |
| 55 | + move.d -0xfedaffff,r4 | |
| 56 | + cmp.w r4,r3 | |
| 57 | + test_cc 1 0 0 0 | |
| 58 | + checkr3 fedaffff | |
| 59 | + | |
| 60 | + move.d -0x5432f789,r4 | |
| 61 | + move.d 0x78134452,r3 | |
| 62 | + cmp.w r4,r3 | |
| 63 | + test_cc 0 0 0 0 | |
| 64 | + checkr3 78134452 | |
| 65 | + | |
| 66 | + moveq -1,r3 | |
| 67 | + moveq -2,r4 | |
| 68 | + cmp.b r4,r3 | |
| 69 | + test_cc 0 0 0 0 | |
| 70 | + checkr3 ffffffff | |
| 71 | + | |
| 72 | + moveq 2,r3 | |
| 73 | + moveq 1,r4 | |
| 74 | + cmp.b r4,r3 | |
| 75 | + test_cc 0 0 0 0 | |
| 76 | + checkr3 2 | |
| 77 | + | |
| 78 | + move.d -0xff,r4 | |
| 79 | + move.d 0xff,r3 | |
| 80 | + cmp.b r4,r3 | |
| 81 | + test_cc 1 0 0 0 | |
| 82 | + checkr3 ff | |
| 83 | + | |
| 84 | + move.d -0xfeda49ff,r4 | |
| 85 | + move.d 0xfeda49ff,r3 | |
| 86 | + cmp.b r4,r3 | |
| 87 | + test_cc 1 0 0 0 | |
| 88 | + checkr3 feda49ff | |
| 89 | + | |
| 90 | + move.d -0x5432f789,r4 | |
| 91 | + move.d 0x78134452,r3 | |
| 92 | + cmp.b r4,r3 | |
| 93 | + test_cc 1 0 0 1 | |
| 94 | + checkr3 78134452 | |
| 95 | + | |
| 96 | + move.d 0x85649222,r3 | |
| 97 | + move.d 0x77445622,r4 | |
| 98 | + cmp.b r4,r3 | |
| 99 | + test_cc 0 1 0 0 | |
| 100 | + checkr3 85649222 | |
| 101 | + | |
| 102 | + quit | ... | ... |
tests/cris/check_cmpxc.s
0 → 100644
| 1 | +# mach: crisv0 crisv3 crisv8 crisv10 crisv32 | |
| 2 | +# output: 2\n2\n2\n2\nffff\nffff\nffff\nffff\nffffffff\nffffffff\nffffffff\n78134452\n78134452\n78134452\n78134452\n4452\n80000032\n | |
| 3 | + | |
| 4 | + .include "testutils.inc" | |
| 5 | + start | |
| 6 | + moveq 2,r3 | |
| 7 | + cmps.b 0xff,r3 | |
| 8 | + test_cc 0 0 0 1 | |
| 9 | + checkr3 2 | |
| 10 | + | |
| 11 | + moveq 2,r3 | |
| 12 | + cmps.w 0xffff,r3 | |
| 13 | + test_cc 0 0 0 1 | |
| 14 | + checkr3 2 | |
| 15 | + | |
| 16 | + moveq 2,r3 | |
| 17 | + cmpu.b 0xff,r3 | |
| 18 | + test_cc 1 0 0 1 | |
| 19 | + checkr3 2 | |
| 20 | + | |
| 21 | + moveq 2,r3 | |
| 22 | + move.d 0xffffffff,r4 | |
| 23 | + cmpu.w -1,r3 | |
| 24 | + test_cc 1 0 0 1 | |
| 25 | + checkr3 2 | |
| 26 | + | |
| 27 | + move.d 0xffff,r3 | |
| 28 | + cmpu.b -1,r3 | |
| 29 | + test_cc 0 0 0 0 | |
| 30 | + checkr3 ffff | |
| 31 | + | |
| 32 | + move.d 0xffff,r3 | |
| 33 | + cmpu.w -1,r3 | |
| 34 | + test_cc 0 1 0 0 | |
| 35 | + checkr3 ffff | |
| 36 | + | |
| 37 | + move.d 0xffff,r3 | |
| 38 | + cmps.b 0xff,r3 | |
| 39 | + test_cc 0 0 0 1 | |
| 40 | + checkr3 ffff | |
| 41 | + | |
| 42 | + move.d 0xffff,r3 | |
| 43 | + cmps.w 0xffff,r3 | |
| 44 | + test_cc 0 0 0 1 | |
| 45 | + checkr3 ffff | |
| 46 | + | |
| 47 | + moveq -1,r3 | |
| 48 | + cmps.b 0xff,r3 | |
| 49 | + test_cc 0 1 0 0 | |
| 50 | + checkr3 ffffffff | |
| 51 | + | |
| 52 | + moveq -1,r3 | |
| 53 | + cmps.w 0xff,r3 | |
| 54 | + test_cc 1 0 0 0 | |
| 55 | + checkr3 ffffffff | |
| 56 | + | |
| 57 | + moveq -1,r3 | |
| 58 | + cmps.w 0xffff,r3 | |
| 59 | + test_cc 0 1 0 0 | |
| 60 | + checkr3 ffffffff | |
| 61 | + | |
| 62 | + move.d 0x78134452,r3 | |
| 63 | + cmpu.b 0x89,r3 | |
| 64 | + test_cc 0 0 0 0 | |
| 65 | + checkr3 78134452 | |
| 66 | + | |
| 67 | + move.d 0x78134452,r3 | |
| 68 | + cmps.b 0x89,r3 | |
| 69 | + test_cc 0 0 0 1 | |
| 70 | + checkr3 78134452 | |
| 71 | + | |
| 72 | + move.d 0x78134452,r3 | |
| 73 | + cmpu.w 0xf789,r3 | |
| 74 | + test_cc 0 0 0 0 | |
| 75 | + checkr3 78134452 | |
| 76 | + | |
| 77 | + move.d 0x78134452,r3 | |
| 78 | + cmps.w 0xf789,r3 | |
| 79 | + test_cc 0 0 0 1 | |
| 80 | + checkr3 78134452 | |
| 81 | + | |
| 82 | + move.d 0x4452,r3 | |
| 83 | + cmps.w 0x8002,r3 | |
| 84 | + test_cc 0 0 0 1 | |
| 85 | + checkr3 4452 | |
| 86 | + | |
| 87 | + move.d 0x80000032,r3 | |
| 88 | + cmpu.w 0x764,r3 | |
| 89 | + test_cc 0 0 1 0 | |
| 90 | + checkr3 80000032 | |
| 91 | + | |
| 92 | + quit | ... | ... |
tests/cris/check_cmpxm.s
0 → 100644
| 1 | +# mach: crisv0 crisv3 crisv8 crisv10 crisv32 | |
| 2 | +# output: 2\n2\n2\n2\nffff\nffff\nffff\nffff\nffffffff\nffffffff\nffffffff\n78134452\n78134452\n78134452\n78134452\n4452\n80000032\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 | + .word 0x8002 | |
| 14 | + .word 0x764 | |
| 15 | + | |
| 16 | + start | |
| 17 | + moveq 2,r3 | |
| 18 | + move.d x,r5 | |
| 19 | + cmps.b [r5+],r3 | |
| 20 | + test_cc 0 0 0 1 | |
| 21 | + checkr3 2 | |
| 22 | + | |
| 23 | + moveq 2,r3 | |
| 24 | + cmps.w [r5+],r3 | |
| 25 | + test_cc 0 0 0 1 | |
| 26 | + checkr3 2 | |
| 27 | + | |
| 28 | + moveq 2,r3 | |
| 29 | + subq 3,r5 | |
| 30 | + cmpu.b [r5+],r3 | |
| 31 | + test_cc 1 0 0 1 | |
| 32 | + checkr3 2 | |
| 33 | + | |
| 34 | + moveq 2,r3 | |
| 35 | + cmpu.w [r5+],r3 | |
| 36 | + test_cc 1 0 0 1 | |
| 37 | + subq 3,r5 | |
| 38 | + checkr3 2 | |
| 39 | + | |
| 40 | + move.d 0xffff,r3 | |
| 41 | + cmpu.b [r5],r3 | |
| 42 | + test_cc 0 0 0 0 | |
| 43 | + checkr3 ffff | |
| 44 | + | |
| 45 | + move.d 0xffff,r3 | |
| 46 | + cmpu.w [r5],r3 | |
| 47 | + test_cc 0 1 0 0 | |
| 48 | + checkr3 ffff | |
| 49 | + | |
| 50 | + move.d 0xffff,r3 | |
| 51 | + cmps.b [r5],r3 | |
| 52 | + test_cc 0 0 0 1 | |
| 53 | + checkr3 ffff | |
| 54 | + | |
| 55 | + move.d 0xffff,r3 | |
| 56 | + cmps.w [r5],r3 | |
| 57 | + test_cc 0 0 0 1 | |
| 58 | + checkr3 ffff | |
| 59 | + | |
| 60 | + moveq -1,r3 | |
| 61 | + cmps.b [r5],r3 | |
| 62 | + test_cc 0 1 0 0 | |
| 63 | + addq 3,r5 | |
| 64 | + checkr3 ffffffff | |
| 65 | + | |
| 66 | + moveq -1,r3 | |
| 67 | + cmps.w [r5+],r3 | |
| 68 | + test_cc 1 0 0 0 | |
| 69 | + checkr3 ffffffff | |
| 70 | + | |
| 71 | + moveq -1,r3 | |
| 72 | + cmps.w [r5+],r3 | |
| 73 | + test_cc 0 1 0 0 | |
| 74 | + checkr3 ffffffff | |
| 75 | + | |
| 76 | + move.d 0x78134452,r3 | |
| 77 | + cmpu.b [r5],r3 | |
| 78 | + test_cc 0 0 0 0 | |
| 79 | + checkr3 78134452 | |
| 80 | + | |
| 81 | + move.d 0x78134452,r3 | |
| 82 | + cmps.b [r5+],r3 | |
| 83 | + test_cc 0 0 0 1 | |
| 84 | + checkr3 78134452 | |
| 85 | + | |
| 86 | + move.d 0x78134452,r3 | |
| 87 | + cmpu.w [r5],r3 | |
| 88 | + test_cc 0 0 0 0 | |
| 89 | + checkr3 78134452 | |
| 90 | + | |
| 91 | + move.d 0x78134452,r3 | |
| 92 | + cmps.w [r5+],r3 | |
| 93 | + test_cc 0 0 0 1 | |
| 94 | + checkr3 78134452 | |
| 95 | + | |
| 96 | + move.d 0x4452,r3 | |
| 97 | + cmps.w [r5+],r3 | |
| 98 | + test_cc 0 0 0 1 | |
| 99 | + checkr3 4452 | |
| 100 | + | |
| 101 | + move.d 0x80000032,r3 | |
| 102 | + cmpu.w [r5+],r3 | |
| 103 | + test_cc 0 0 1 0 | |
| 104 | + checkr3 80000032 | |
| 105 | + | |
| 106 | + quit | ... | ... |
tests/cris/check_dstep.s
0 → 100644
| 1 | +# mach: crisv0 crisv3 crisv8 crisv10 crisv32 | |
| 2 | +# output: fffffffc\n4\nffff\nfffffffe\n9bf3911b\n0\n | |
| 3 | + | |
| 4 | + .include "testutils.inc" | |
| 5 | + start | |
| 6 | + moveq -1,r3 | |
| 7 | + moveq 2,r4 | |
| 8 | + dstep r4,r3 | |
| 9 | + test_move_cc 1 0 0 0 | |
| 10 | + checkr3 fffffffc | |
| 11 | + | |
| 12 | + moveq 2,r3 | |
| 13 | + moveq -1,r4 | |
| 14 | + dstep r4,r3 | |
| 15 | + test_move_cc 0 0 0 0 | |
| 16 | + checkr3 4 | |
| 17 | + | |
| 18 | + move.d 0xffff,r4 | |
| 19 | + move.d r4,r3 | |
| 20 | + dstep r4,r3 | |
| 21 | + test_move_cc 0 0 0 0 | |
| 22 | + checkr3 ffff | |
| 23 | + | |
| 24 | + moveq -1,r4 | |
| 25 | + move.d r4,r3 | |
| 26 | + dstep r4,r3 | |
| 27 | + test_move_cc 1 0 0 0 | |
| 28 | + checkr3 fffffffe | |
| 29 | + | |
| 30 | + move.d 0x5432f789,r4 | |
| 31 | + move.d 0x78134452,r3 | |
| 32 | + dstep r4,r3 | |
| 33 | + test_move_cc 1 0 0 0 | |
| 34 | + checkr3 9bf3911b | |
| 35 | + | |
| 36 | + move.d 0xffff,r3 | |
| 37 | + move.d 0x1fffe,r4 | |
| 38 | + dstep r4,r3 | |
| 39 | + test_move_cc 0 1 0 0 | |
| 40 | + checkr3 0 | |
| 41 | + | |
| 42 | + quit | ... | ... |
tests/cris/check_gcctorture_pr28634-1.c
0 → 100644
| 1 | +/* PR rtl-optimization/28634. On targets with delayed branches, | |
| 2 | + dbr_schedule could do the next iteration's addition in the | |
| 3 | + branch delay slot, then subtract the value again if the branch | |
| 4 | + wasn't taken. This can lead to rounding errors. */ | |
| 5 | +int x = -1; | |
| 6 | +int y = 1; | |
| 7 | +int | |
| 8 | +main (void) | |
| 9 | +{ | |
| 10 | + while (y > 0) | |
| 11 | + y += x; | |
| 12 | + if (y != x + 1) | |
| 13 | + abort (); | |
| 14 | + exit (0); | |
| 15 | +} | ... | ... |
tests/cris/check_gcctorture_pr28634.c
0 → 100644
| 1 | +/* PR rtl-optimization/28634. On targets with delayed branches, | |
| 2 | + dbr_schedule could do the next iteration's addition in the | |
| 3 | + branch delay slot, then subtract the value again if the branch | |
| 4 | + wasn't taken. This can lead to rounding errors. */ | |
| 5 | +double x = -0x1.0p53; | |
| 6 | +double y = 1; | |
| 7 | +int | |
| 8 | +main (void) | |
| 9 | +{ | |
| 10 | + while (y > 0) | |
| 11 | + y += x; | |
| 12 | + if (y != x + 1) | |
| 13 | + abort (); | |
| 14 | + exit (0); | |
| 15 | +} | ... | ... |
tests/cris/check_glibc_kernelversion.c
0 → 100644
| 1 | +/* | |
| 2 | + * Check the lz insn. | |
| 3 | + */ | |
| 4 | + | |
| 5 | +#include <stdio.h> | |
| 6 | +#include <stdlib.h> | |
| 7 | +#include <stdint.h> | |
| 8 | +#include "sys.h" | |
| 9 | + | |
| 10 | +#define __LINUX_KERNEL_VERSION 131584 | |
| 11 | + | |
| 12 | +#define DL_SYSDEP_OSCHECK(FATAL) \ | |
| 13 | + do { \ | |
| 14 | + /* Test whether the kernel is new enough. This test is only \ | |
| 15 | + performed if the library is not compiled to run on all \ | |
| 16 | + kernels. */ \ | |
| 17 | + if (__LINUX_KERNEL_VERSION > 0) \ | |
| 18 | + { \ | |
| 19 | + char bufmem[64]; \ | |
| 20 | + char *buf = bufmem; \ | |
| 21 | + unsigned int version; \ | |
| 22 | + int parts; \ | |
| 23 | + char *cp; \ | |
| 24 | + struct utsname uts; \ | |
| 25 | + \ | |
| 26 | + /* Try the uname syscall */ \ | |
| 27 | + if (__uname (&uts)) \ | |
| 28 | + { \ | |
| 29 | + /* This was not successful. Now try reading the /proc \ | |
| 30 | + filesystem. */ \ | |
| 31 | + ssize_t reslen; \ | |
| 32 | + int fd = __open ("/proc/sys/kernel/osrelease", O_RDONLY); \ | |
| 33 | + if (fd == -1 \ | |
| 34 | + || (reslen = __read (fd, bufmem, sizeof (bufmem))) <= 0) \ | |
| 35 | + /* This also didn't work. We give up since we cannot \ | |
| 36 | + make sure the library can actually work. */ \ | |
| 37 | + FATAL ("FATAL: cannot determine library version\n"); \ | |
| 38 | + __close (fd); \ | |
| 39 | + buf[MIN (reslen, (ssize_t) sizeof (bufmem) - 1)] = '\0'; \ | |
| 40 | + } \ | |
| 41 | + else \ | |
| 42 | + buf = uts.release; \ | |
| 43 | + \ | |
| 44 | + /* Now convert it into a number. The string consists of at most \ | |
| 45 | + three parts. */ \ | |
| 46 | + version = 0; \ | |
| 47 | + parts = 0; \ | |
| 48 | + cp = buf; \ | |
| 49 | + while ((*cp >= '0') && (*cp <= '9')) \ | |
| 50 | + { \ | |
| 51 | + unsigned int here = *cp++ - '0'; \ | |
| 52 | + \ | |
| 53 | + while ((*cp >= '0') && (*cp <= '9')) \ | |
| 54 | + { \ | |
| 55 | + here *= 10; \ | |
| 56 | + here += *cp++ - '0'; \ | |
| 57 | + } \ | |
| 58 | + \ | |
| 59 | + ++parts; \ | |
| 60 | + version <<= 8; \ | |
| 61 | + version |= here; \ | |
| 62 | + \ | |
| 63 | + if (*cp++ != '.') \ | |
| 64 | + /* Another part following? */ \ | |
| 65 | + break; \ | |
| 66 | + } \ | |
| 67 | + \ | |
| 68 | + if (parts < 3) \ | |
| 69 | + version <<= 8 * (3 - parts); \ | |
| 70 | + \ | |
| 71 | + /* Now we can test with the required version. */ \ | |
| 72 | + if (version < __LINUX_KERNEL_VERSION) \ | |
| 73 | + /* Not sufficent. */ \ | |
| 74 | + FATAL ("FATAL: kernel too old\n"); \ | |
| 75 | + \ | |
| 76 | + _dl_osversion = version; \ | |
| 77 | + } \ | |
| 78 | + } while (0) | |
| 79 | + | |
| 80 | +int main(void) | |
| 81 | +{ | |
| 82 | + char bufmem[64] = "2.6.22"; | |
| 83 | + char *buf = bufmem; | |
| 84 | + unsigned int version; | |
| 85 | + int parts; | |
| 86 | + char *cp; | |
| 87 | + | |
| 88 | + version = 0; | |
| 89 | + parts = 0; | |
| 90 | + cp = buf; | |
| 91 | + while ((*cp >= '0') && (*cp <= '9')) | |
| 92 | + { | |
| 93 | + unsigned int here = *cp++ - '0'; | |
| 94 | + | |
| 95 | + while ((*cp >= '0') && (*cp <= '9')) | |
| 96 | + { | |
| 97 | + here *= 10; | |
| 98 | + here += *cp++ - '0'; | |
| 99 | + } | |
| 100 | + | |
| 101 | + ++parts; | |
| 102 | + version <<= 8; | |
| 103 | + version |= here; | |
| 104 | + | |
| 105 | + if (*cp++ != '.') | |
| 106 | + /* Another part following? */ | |
| 107 | + break; | |
| 108 | + } | |
| 109 | + | |
| 110 | + if (parts < 3) | |
| 111 | + version <<= 8 * (3 - parts); | |
| 112 | + if (version < __LINUX_KERNEL_VERSION) | |
| 113 | + err(); | |
| 114 | + pass(); | |
| 115 | + exit(0); | |
| 116 | +} | ... | ... |
tests/cris/check_hello.c
0 → 100644
tests/cris/check_int64.c
0 → 100644
| 1 | +#include <stdio.h> | |
| 2 | +#include <stdlib.h> | |
| 3 | +#include <stdint.h> | |
| 4 | +#include "sys.h" | |
| 5 | +#include "crisutils.h" | |
| 6 | + | |
| 7 | + | |
| 8 | +extern inline int64_t add64(const int64_t a, const int64_t b) { | |
| 9 | + return a + b; | |
| 10 | +} | |
| 11 | + | |
| 12 | +extern inline int64_t sub64(const int64_t a, const int64_t b) { | |
| 13 | + return a - b; | |
| 14 | +} | |
| 15 | + | |
| 16 | +int main(void) | |
| 17 | +{ | |
| 18 | + int64_t a = 1; | |
| 19 | + int64_t b = 2; | |
| 20 | + | |
| 21 | + /* FIXME: add some tests. */ | |
| 22 | + a = add64(a, b); | |
| 23 | + if (a != 3) | |
| 24 | + err(); | |
| 25 | + | |
| 26 | + a = sub64(a, b); | |
| 27 | + if (a != 1) | |
| 28 | + err(); | |
| 29 | + | |
| 30 | + a = add64(a, -4); | |
| 31 | + if (a != -3) | |
| 32 | + err(); | |
| 33 | + | |
| 34 | + a = add64(a, 3); | |
| 35 | + if (a != 0) | |
| 36 | + err(); | |
| 37 | + | |
| 38 | + a = 0; | |
| 39 | + a = sub64(a, 1); | |
| 40 | + if (a != -1) | |
| 41 | + err(); | |
| 42 | + | |
| 43 | + pass(); | |
| 44 | + return 0; | |
| 45 | +} | ... | ... |
tests/cris/check_jsr.s
0 → 100644
| 1 | +# mach: crisv3 crisv8 crisv10 crisv32 | |
| 2 | +# output: 0\n0\n0\n0\n0\n0\n | |
| 3 | + | |
| 4 | +# Test that jsr Rn and jsr [PC+] work. | |
| 5 | + | |
| 6 | + .include "testutils.inc" | |
| 7 | + start | |
| 8 | +x: | |
| 9 | + move.d 0f,r6 | |
| 10 | + setf nzvc | |
| 11 | + jsr r6 | |
| 12 | + .if 1; ..asm.arch.cris.v32 | |
| 13 | + nop | |
| 14 | + .endif | |
| 15 | +0: | |
| 16 | + test_move_cc 1 1 1 1 | |
| 17 | + move srp,r3 | |
| 18 | + sub.d 0b,r3 | |
| 19 | + checkr3 0 | |
| 20 | + | |
| 21 | + move.d 1f,r0 | |
| 22 | + setf nzvc | |
| 23 | + jsr r0 | |
| 24 | + .if 1 ; ..asm.arch.cris.v32 | |
| 25 | + moveq 0,r0 | |
| 26 | + .endif | |
| 27 | +6: | |
| 28 | + nop | |
| 29 | + quit | |
| 30 | + | |
| 31 | +2: | |
| 32 | + test_move_cc 0 0 0 0 | |
| 33 | + move srp,r3 | |
| 34 | + sub.d 3f,r3 | |
| 35 | + checkr3 0 | |
| 36 | + jsr 4f | |
| 37 | + .if 1 ; ..asm.arch.cris.v32 | |
| 38 | + nop | |
| 39 | + .endif | |
| 40 | +7: | |
| 41 | + nop | |
| 42 | + quit | |
| 43 | + | |
| 44 | +8: | |
| 45 | + move srp,r3 | |
| 46 | + sub.d 7b,r3 | |
| 47 | + checkr3 0 | |
| 48 | + quit | |
| 49 | + | |
| 50 | +4: | |
| 51 | + move srp,r3 | |
| 52 | + sub.d 7b,r3 | |
| 53 | + checkr3 0 | |
| 54 | + move.d 5f,r3 | |
| 55 | + jump r3 | |
| 56 | + .if 1; ..asm.arch.cris.v32 | |
| 57 | + moveq 0,r3 | |
| 58 | + .endif | |
| 59 | + quit | |
| 60 | + | |
| 61 | + .space 32770,0 | |
| 62 | +1: | |
| 63 | + test_move_cc 1 1 1 1 | |
| 64 | + move srp,r3 | |
| 65 | + sub.d 6b,r3 | |
| 66 | + checkr3 0 | |
| 67 | + | |
| 68 | + clearf cznv | |
| 69 | + jsr 2b | |
| 70 | + .if 1; ..asm.arch.cris.v32 | |
| 71 | + nop | |
| 72 | + .endif | |
| 73 | +3: | |
| 74 | + | |
| 75 | + quit | |
| 76 | + | |
| 77 | +5: | |
| 78 | + move srp,r3 | |
| 79 | + sub.d 7b,r3 | |
| 80 | + checkr3 0 | |
| 81 | + jump 8b | |
| 82 | + .if 1 ; ..asm.arch.cris.v32 | |
| 83 | + nop | |
| 84 | + .endif | |
| 85 | + quit | ... | ... |
tests/cris/check_lapc.s
0 → 100644
| 1 | +# mach: crisv32 | |
| 2 | +# output: 0\n0\nfffffffa\nfffffffe\nffffffda\n1e\n1e\n0\n | |
| 3 | + | |
| 4 | +.include "testutils.inc" | |
| 5 | + | |
| 6 | +; To accommodate dumpr3 with more than one instruction, keep it | |
| 7 | +; out of lapc operand ranges and difference calculations. | |
| 8 | + | |
| 9 | + start | |
| 10 | + lapc.d 0f,r3 | |
| 11 | +0: | |
| 12 | + sub.d .,r3 | |
| 13 | + checkr3 0 | |
| 14 | + | |
| 15 | + lapcq 0f,r3 | |
| 16 | +0: | |
| 17 | + sub.d .,r3 | |
| 18 | + checkr3 0 | |
| 19 | + | |
| 20 | + lapc.d .,r3 | |
| 21 | + sub.d .,r3 | |
| 22 | + checkr3 fffffffa | |
| 23 | + | |
| 24 | + lapcq .,r3 | |
| 25 | + sub.d .,r3 | |
| 26 | + checkr3 fffffffe | |
| 27 | + | |
| 28 | +0: | |
| 29 | + .rept 16 | |
| 30 | + nop | |
| 31 | + .endr | |
| 32 | + lapc.d 0b,r3 | |
| 33 | + sub.d .,r3 | |
| 34 | + checkr3 ffffffda | |
| 35 | + | |
| 36 | + setf zcvn | |
| 37 | + lapc.d 0f,r3 | |
| 38 | + test_cc 1 1 1 1 | |
| 39 | + sub.d .,r3 | |
| 40 | + nop | |
| 41 | + nop | |
| 42 | + nop | |
| 43 | + nop | |
| 44 | + nop | |
| 45 | + nop | |
| 46 | + nop | |
| 47 | + nop | |
| 48 | + nop | |
| 49 | + nop | |
| 50 | + nop | |
| 51 | + nop | |
| 52 | +0: | |
| 53 | + checkr3 1e | |
| 54 | +0: | |
| 55 | + lapcq 0f,r3 | |
| 56 | + sub.d 0b,r3 | |
| 57 | + nop | |
| 58 | + nop | |
| 59 | + nop | |
| 60 | + nop | |
| 61 | + nop | |
| 62 | + nop | |
| 63 | + nop | |
| 64 | + nop | |
| 65 | + nop | |
| 66 | + nop | |
| 67 | + nop | |
| 68 | +0: | |
| 69 | + checkr3 1e | |
| 70 | + clearf cn | |
| 71 | + setf zv | |
| 72 | +1: | |
| 73 | + lapcq .,r3 | |
| 74 | + test_cc 0 1 1 0 | |
| 75 | + sub.d 1b,r3 | |
| 76 | + checkr3 0 | |
| 77 | + | |
| 78 | + quit | ... | ... |
tests/cris/check_lsl.s
0 → 100644
| 1 | +# mach: crisv0 crisv3 crisv8 crisv10 crisv32 | |
| 2 | +# output: ffffffff\n4\n80000000\nffff8000\n7f19f000\n80000000\n0\n0\n699fc67c\nffffffff\n4\n80000000\nffff8000\n7f19f000\nda670000\nda670000\nda670000\nda67c67c\nffffffff\nfffafffe\n4\nffff0000\nffff8000\n5a67f000\nda67f100\nda67f100\nda67f100\nda67f17c\nfff3faff\nfff3fafe\n4\nffffff00\nffffff00\nffffff80\n5a67f100\n5a67f1f0\n | |
| 3 | + | |
| 4 | + .include "testutils.inc" | |
| 5 | + start | |
| 6 | + moveq -1,r3 | |
| 7 | + lslq 0,r3 | |
| 8 | + test_move_cc 1 0 0 0 | |
| 9 | + checkr3 ffffffff | |
| 10 | + | |
| 11 | + moveq 2,r3 | |
| 12 | + lslq 1,r3 | |
| 13 | + test_move_cc 0 0 0 0 | |
| 14 | + checkr3 4 | |
| 15 | + | |
| 16 | + moveq -1,r3 | |
| 17 | + lslq 31,r3 | |
| 18 | + test_move_cc 1 0 0 0 | |
| 19 | + checkr3 80000000 | |
| 20 | + | |
| 21 | + moveq -1,r3 | |
| 22 | + lslq 15,r3 | |
| 23 | + test_move_cc 1 0 0 0 | |
| 24 | + checkr3 ffff8000 | |
| 25 | + | |
| 26 | + move.d 0x5a67f19f,r3 | |
| 27 | + lslq 12,r3 | |
| 28 | + test_move_cc 0 0 0 0 | |
| 29 | + checkr3 7f19f000 | |
| 30 | + | |
| 31 | + move.d 0xda67f19f,r3 | |
| 32 | + move.d 31,r4 | |
| 33 | + lsl.d r4,r3 | |
| 34 | + test_move_cc 1 0 0 0 | |
| 35 | + checkr3 80000000 | |
| 36 | + | |
| 37 | + move.d 0xda67f19f,r3 | |
| 38 | + move.d 32,r4 | |
| 39 | + lsl.d r4,r3 | |
| 40 | + test_move_cc 0 1 0 0 | |
| 41 | + checkr3 0 | |
| 42 | + | |
| 43 | + move.d 0xda67f19f,r3 | |
| 44 | + move.d 33,r4 | |
| 45 | + lsl.d r4,r3 | |
| 46 | + test_move_cc 0 1 0 0 | |
| 47 | + checkr3 0 | |
| 48 | + | |
| 49 | + move.d 0xda67f19f,r3 | |
| 50 | + move.d 66,r4 | |
| 51 | + lsl.d r4,r3 | |
| 52 | + test_move_cc 0 0 0 0 | |
| 53 | + checkr3 699fc67c | |
| 54 | + | |
| 55 | + moveq -1,r3 | |
| 56 | + moveq 0,r4 | |
| 57 | + lsl.d r4,r3 | |
| 58 | + test_move_cc 1 0 0 0 | |
| 59 | + checkr3 ffffffff | |
| 60 | + | |
| 61 | + moveq 2,r3 | |
| 62 | + moveq 1,r4 | |
| 63 | + lsl.d r4,r3 | |
| 64 | + test_move_cc 0 0 0 0 | |
| 65 | + checkr3 4 | |
| 66 | + | |
| 67 | + moveq -1,r3 | |
| 68 | + moveq 31,r4 | |
| 69 | + lsl.d r4,r3 | |
| 70 | + test_move_cc 1 0 0 0 | |
| 71 | + checkr3 80000000 | |
| 72 | + | |
| 73 | + moveq -1,r3 | |
| 74 | + moveq 15,r4 | |
| 75 | + lsl.d r4,r3 | |
| 76 | + test_move_cc 1 0 0 0 | |
| 77 | + checkr3 ffff8000 | |
| 78 | + | |
| 79 | + move.d 0x5a67f19f,r3 | |
| 80 | + moveq 12,r4 | |
| 81 | + lsl.d r4,r3 | |
| 82 | + test_move_cc 0 0 0 0 | |
| 83 | + checkr3 7f19f000 | |
| 84 | + | |
| 85 | + move.d 0xda67f19f,r3 | |
| 86 | + move.d 31,r4 | |
| 87 | + lsl.w r4,r3 | |
| 88 | + test_move_cc 0 1 0 0 | |
| 89 | + checkr3 da670000 | |
| 90 | + | |
| 91 | + move.d 0xda67f19f,r3 | |
| 92 | + move.d 32,r4 | |
| 93 | + lsl.w r4,r3 | |
| 94 | + test_move_cc 0 1 0 0 | |
| 95 | + checkr3 da670000 | |
| 96 | + | |
| 97 | + move.d 0xda67f19f,r3 | |
| 98 | + move.d 33,r4 | |
| 99 | + lsl.w r4,r3 | |
| 100 | + test_move_cc 0 1 0 0 | |
| 101 | + checkr3 da670000 | |
| 102 | + | |
| 103 | + move.d 0xda67f19f,r3 | |
| 104 | + move.d 66,r4 | |
| 105 | + lsl.w r4,r3 | |
| 106 | + test_move_cc 1 0 0 0 | |
| 107 | + checkr3 da67c67c | |
| 108 | + | |
| 109 | + moveq -1,r3 | |
| 110 | + moveq 0,r4 | |
| 111 | + lsl.w r4,r3 | |
| 112 | + test_move_cc 1 0 0 0 | |
| 113 | + checkr3 ffffffff | |
| 114 | + | |
| 115 | + move.d 0xfffaffff,r3 | |
| 116 | + moveq 1,r4 | |
| 117 | + lsl.w r4,r3 | |
| 118 | + test_move_cc 1 0 0 0 | |
| 119 | + checkr3 fffafffe | |
| 120 | + | |
| 121 | + moveq 2,r3 | |
| 122 | + moveq 1,r4 | |
| 123 | + lsl.w r4,r3 | |
| 124 | + test_move_cc 0 0 0 0 | |
| 125 | + checkr3 4 | |
| 126 | + | |
| 127 | + moveq -1,r3 | |
| 128 | + moveq 31,r4 | |
| 129 | + lsl.w r4,r3 | |
| 130 | + test_move_cc 0 1 0 0 | |
| 131 | + checkr3 ffff0000 | |
| 132 | + | |
| 133 | + moveq -1,r3 | |
| 134 | + moveq 15,r4 | |
| 135 | + lsl.w r4,r3 | |
| 136 | + test_move_cc 1 0 0 0 | |
| 137 | + checkr3 ffff8000 | |
| 138 | + | |
| 139 | + move.d 0x5a67f19f,r3 | |
| 140 | + moveq 12,r4 | |
| 141 | + lsl.w r4,r3 | |
| 142 | + test_move_cc 1 0 0 0 | |
| 143 | + checkr3 5a67f000 | |
| 144 | + | |
| 145 | + move.d 0xda67f19f,r3 | |
| 146 | + move.d 31,r4 | |
| 147 | + lsl.b r4,r3 | |
| 148 | + test_move_cc 0 1 0 0 | |
| 149 | + checkr3 da67f100 | |
| 150 | + | |
| 151 | + move.d 0xda67f19f,r3 | |
| 152 | + move.d 32,r4 | |
| 153 | + lsl.b r4,r3 | |
| 154 | + test_move_cc 0 1 0 0 | |
| 155 | + checkr3 da67f100 | |
| 156 | + | |
| 157 | + move.d 0xda67f19f,r3 | |
| 158 | + move.d 33,r4 | |
| 159 | + lsl.b r4,r3 | |
| 160 | + test_move_cc 0 1 0 0 | |
| 161 | + checkr3 da67f100 | |
| 162 | + | |
| 163 | + move.d 0xda67f19f,r3 | |
| 164 | + move.d 66,r4 | |
| 165 | + lsl.b r4,r3 | |
| 166 | + test_move_cc 0 0 0 0 | |
| 167 | + checkr3 da67f17c | |
| 168 | + | |
| 169 | + move.d 0xfff3faff,r3 | |
| 170 | + moveq 0,r4 | |
| 171 | + lsl.b r4,r3 | |
| 172 | + test_move_cc 1 0 0 0 | |
| 173 | + checkr3 fff3faff | |
| 174 | + | |
| 175 | + move.d 0xfff3faff,r3 | |
| 176 | + moveq 1,r4 | |
| 177 | + lsl.b r4,r3 | |
| 178 | + test_move_cc 1 0 0 0 | |
| 179 | + checkr3 fff3fafe | |
| 180 | + | |
| 181 | + moveq 2,r3 | |
| 182 | + moveq 1,r4 | |
| 183 | + lsl.b r4,r3 | |
| 184 | + test_move_cc 0 0 0 0 | |
| 185 | + checkr3 4 | |
| 186 | + | |
| 187 | + moveq -1,r3 | |
| 188 | + moveq 31,r4 | |
| 189 | + lsl.b r4,r3 | |
| 190 | + test_move_cc 0 1 0 0 | |
| 191 | + checkr3 ffffff00 | |
| 192 | + | |
| 193 | + moveq -1,r3 | |
| 194 | + moveq 15,r4 | |
| 195 | + lsl.b r4,r3 | |
| 196 | + test_move_cc 0 1 0 0 | |
| 197 | + checkr3 ffffff00 | |
| 198 | + | |
| 199 | + moveq -1,r3 | |
| 200 | + moveq 7,r4 | |
| 201 | + lsl.b r4,r3 | |
| 202 | + test_move_cc 1 0 0 0 | |
| 203 | + checkr3 ffffff80 | |
| 204 | + | |
| 205 | + move.d 0x5a67f19f,r3 | |
| 206 | + moveq 12,r4 | |
| 207 | + lsl.b r4,r3 | |
| 208 | + test_move_cc 0 1 0 0 | |
| 209 | + checkr3 5a67f100 | |
| 210 | + | |
| 211 | + move.d 0x5a67f19f,r3 | |
| 212 | + moveq 4,r4 | |
| 213 | + lsl.b r4,r3 | |
| 214 | + test_move_cc 1 0 0 0 | |
| 215 | + checkr3 5a67f1f0 | |
| 216 | + | |
| 217 | + quit | ... | ... |
tests/cris/check_lsr.s
0 → 100644
| 1 | +# mach: crisv0 crisv3 crisv8 crisv10 crisv32 | |
| 2 | +# output: ffffffff\n1\n1\n1ffff\n5a67f\n1\n0\n0\n3699fc67\nffffffff\n1\n1\n1ffff\n5a67f\nda670000\nda670000\nda670000\nda673c67\nffffffff\nffff7fff\n1\nffff0000\nffff0001\n5a67000f\nda67f100\nda67f100\nda67f100\nda67f127\nffffffff\nffffff7f\n1\nffffff00\nffffff00\nffffff01\n5a67f100\n5a67f109\n | |
| 3 | + | |
| 4 | + .include "testutils.inc" | |
| 5 | + start | |
| 6 | + moveq -1,r3 | |
| 7 | + lsrq 0,r3 | |
| 8 | + test_move_cc 1 0 0 0 | |
| 9 | + checkr3 ffffffff | |
| 10 | + | |
| 11 | + moveq 2,r3 | |
| 12 | + lsrq 1,r3 | |
| 13 | + test_move_cc 0 0 0 0 | |
| 14 | + checkr3 1 | |
| 15 | + | |
| 16 | + moveq -1,r3 | |
| 17 | + lsrq 31,r3 | |
| 18 | + test_move_cc 0 0 0 0 | |
| 19 | + checkr3 1 | |
| 20 | + | |
| 21 | + moveq -1,r3 | |
| 22 | + lsrq 15,r3 | |
| 23 | + test_move_cc 0 0 0 0 | |
| 24 | + checkr3 1ffff | |
| 25 | + | |
| 26 | + move.d 0x5a67f19f,r3 | |
| 27 | + lsrq 12,r3 | |
| 28 | + test_move_cc 0 0 0 0 | |
| 29 | + checkr3 5a67f | |
| 30 | + | |
| 31 | + move.d 0xda67f19f,r3 | |
| 32 | + move.d 31,r4 | |
| 33 | + lsr.d r4,r3 | |
| 34 | + test_move_cc 0 0 0 0 | |
| 35 | + checkr3 1 | |
| 36 | + | |
| 37 | + move.d 0xda67f19f,r3 | |
| 38 | + move.d 32,r4 | |
| 39 | + lsr.d r4,r3 | |
| 40 | + test_move_cc 0 1 0 0 | |
| 41 | + checkr3 0 | |
| 42 | + | |
| 43 | + move.d 0xda67f19f,r3 | |
| 44 | + move.d 33,r4 | |
| 45 | + lsr.d r4,r3 | |
| 46 | + test_move_cc 0 1 0 0 | |
| 47 | + checkr3 0 | |
| 48 | + | |
| 49 | + move.d 0xda67f19f,r3 | |
| 50 | + move.d 66,r4 | |
| 51 | + lsr.d r4,r3 | |
| 52 | + test_move_cc 0 0 0 0 | |
| 53 | + checkr3 3699fc67 | |
| 54 | + | |
| 55 | + moveq -1,r3 | |
| 56 | + moveq 0,r4 | |
| 57 | + lsr.d r4,r3 | |
| 58 | + test_move_cc 1 0 0 0 | |
| 59 | + checkr3 ffffffff | |
| 60 | + | |
| 61 | + moveq 2,r3 | |
| 62 | + moveq 1,r4 | |
| 63 | + lsr.d r4,r3 | |
| 64 | + test_move_cc 0 0 0 0 | |
| 65 | + checkr3 1 | |
| 66 | + | |
| 67 | + moveq -1,r3 | |
| 68 | + moveq 31,r4 | |
| 69 | + lsr.d r4,r3 | |
| 70 | + test_move_cc 0 0 0 0 | |
| 71 | + checkr3 1 | |
| 72 | + | |
| 73 | + moveq -1,r3 | |
| 74 | + moveq 15,r4 | |
| 75 | + lsr.d r4,r3 | |
| 76 | + test_move_cc 0 0 0 0 | |
| 77 | + checkr3 1ffff | |
| 78 | + | |
| 79 | + move.d 0x5a67f19f,r3 | |
| 80 | + moveq 12,r4 | |
| 81 | + lsr.d r4,r3 | |
| 82 | + test_move_cc 0 0 0 0 | |
| 83 | + checkr3 5a67f | |
| 84 | + | |
| 85 | + move.d 0xda67f19f,r3 | |
| 86 | + move.d 31,r4 | |
| 87 | + lsr.w r4,r3 | |
| 88 | + test_move_cc 0 1 0 0 | |
| 89 | + checkr3 da670000 | |
| 90 | + | |
| 91 | + move.d 0xda67f19f,r3 | |
| 92 | + move.d 32,r4 | |
| 93 | + lsr.w r4,r3 | |
| 94 | + test_move_cc 0 1 0 0 | |
| 95 | + checkr3 da670000 | |
| 96 | + | |
| 97 | + move.d 0xda67f19f,r3 | |
| 98 | + move.d 33,r4 | |
| 99 | + lsr.w r4,r3 | |
| 100 | + test_move_cc 0 1 0 0 | |
| 101 | + checkr3 da670000 | |
| 102 | + | |
| 103 | + move.d 0xda67f19f,r3 | |
| 104 | + move.d 66,r4 | |
| 105 | + lsr.w r4,r3 | |
| 106 | + test_move_cc 0 0 0 0 | |
| 107 | + checkr3 da673c67 | |
| 108 | + | |
| 109 | + moveq -1,r3 | |
| 110 | + moveq 0,r4 | |
| 111 | + lsr.w r4,r3 | |
| 112 | + test_move_cc 1 0 0 0 | |
| 113 | + checkr3 ffffffff | |
| 114 | + | |
| 115 | + moveq -1,r3 | |
| 116 | + moveq 1,r4 | |
| 117 | + lsr.w r4,r3 | |
| 118 | + test_move_cc 0 0 0 0 | |
| 119 | + checkr3 ffff7fff | |
| 120 | + | |
| 121 | + moveq 2,r3 | |
| 122 | + moveq 1,r4 | |
| 123 | + lsr.w r4,r3 | |
| 124 | + test_move_cc 0 0 0 0 | |
| 125 | + checkr3 1 | |
| 126 | + | |
| 127 | +;; FIXME: this was wrong. Z should be set. | |
| 128 | + moveq -1,r3 | |
| 129 | + moveq 31,r4 | |
| 130 | + lsr.w r4,r3 | |
| 131 | + test_move_cc 0 1 0 0 | |
| 132 | + checkr3 ffff0000 | |
| 133 | + | |
| 134 | + moveq -1,r3 | |
| 135 | + moveq 15,r4 | |
| 136 | + lsr.w r4,r3 | |
| 137 | + test_move_cc 0 0 0 0 | |
| 138 | + checkr3 ffff0001 | |
| 139 | + | |
| 140 | + move.d 0x5a67f19f,r3 | |
| 141 | + moveq 12,r4 | |
| 142 | + lsr.w r4,r3 | |
| 143 | + test_move_cc 0 0 0 0 | |
| 144 | + checkr3 5a67000f | |
| 145 | + | |
| 146 | + move.d 0xda67f19f,r3 | |
| 147 | + move.d 31,r4 | |
| 148 | + lsr.b r4,r3 | |
| 149 | + test_move_cc 0 1 0 0 | |
| 150 | + checkr3 da67f100 | |
| 151 | + | |
| 152 | + move.d 0xda67f19f,r3 | |
| 153 | + move.d 32,r4 | |
| 154 | + lsr.b r4,r3 | |
| 155 | + test_move_cc 0 1 0 0 | |
| 156 | + checkr3 da67f100 | |
| 157 | + | |
| 158 | + move.d 0xda67f19f,r3 | |
| 159 | + move.d 33,r4 | |
| 160 | + lsr.b r4,r3 | |
| 161 | + test_move_cc 0 1 0 0 | |
| 162 | + checkr3 da67f100 | |
| 163 | + | |
| 164 | + move.d 0xda67f19f,r3 | |
| 165 | + move.d 66,r4 | |
| 166 | + lsr.b r4,r3 | |
| 167 | + test_move_cc 0 0 0 0 | |
| 168 | + checkr3 da67f127 | |
| 169 | + | |
| 170 | + moveq -1,r3 | |
| 171 | + moveq 0,r4 | |
| 172 | + lsr.b r4,r3 | |
| 173 | + test_move_cc 1 0 0 0 | |
| 174 | + checkr3 ffffffff | |
| 175 | + | |
| 176 | + moveq -1,r3 | |
| 177 | + moveq 1,r4 | |
| 178 | + lsr.b r4,r3 | |
| 179 | + test_move_cc 0 0 0 0 | |
| 180 | + checkr3 ffffff7f | |
| 181 | + | |
| 182 | + moveq 2,r3 | |
| 183 | + moveq 1,r4 | |
| 184 | + lsr.b r4,r3 | |
| 185 | + test_move_cc 0 0 0 0 | |
| 186 | + checkr3 1 | |
| 187 | + | |
| 188 | + moveq -1,r3 | |
| 189 | + moveq 31,r4 | |
| 190 | + lsr.b r4,r3 | |
| 191 | + test_move_cc 0 1 0 0 | |
| 192 | + checkr3 ffffff00 | |
| 193 | + | |
| 194 | + moveq -1,r3 | |
| 195 | + moveq 15,r4 | |
| 196 | + lsr.b r4,r3 | |
| 197 | + test_move_cc 0 1 0 0 | |
| 198 | + checkr3 ffffff00 | |
| 199 | + | |
| 200 | + moveq -1,r3 | |
| 201 | + moveq 7,r4 | |
| 202 | + lsr.b r4,r3 | |
| 203 | + test_move_cc 0 0 0 0 | |
| 204 | + checkr3 ffffff01 | |
| 205 | + | |
| 206 | + move.d 0x5a67f19f,r3 | |
| 207 | + moveq 12,r4 | |
| 208 | + lsr.b r4,r3 | |
| 209 | + test_move_cc 0 1 0 0 | |
| 210 | + checkr3 5a67f100 | |
| 211 | + | |
| 212 | + move.d 0x5a67f19f,r3 | |
| 213 | + moveq 4,r4 | |
| 214 | + lsr.b r4,r3 | |
| 215 | + test_move_cc 0 0 0 0 | |
| 216 | + checkr3 5a67f109 | |
| 217 | + | |
| 218 | + quit | ... | ... |
tests/cris/check_lz.c
0 → 100644
| 1 | +#include <stdio.h> | |
| 2 | +#include <stdlib.h> | |
| 3 | +#include <stdint.h> | |
| 4 | +#include "sys.h" | |
| 5 | + | |
| 6 | +extern inline int cris_lz(int x) | |
| 7 | +{ | |
| 8 | + int r; | |
| 9 | + asm ("lz\t%1, %0\n" : "=r" (r) : "r" (x)); | |
| 10 | + return r; | |
| 11 | +} | |
| 12 | + | |
| 13 | +void check_lz(void) | |
| 14 | +{ | |
| 15 | + int i; | |
| 16 | + | |
| 17 | + if (cris_lz(0) != 32) | |
| 18 | + err(); | |
| 19 | + if (cris_lz(1) != 31) | |
| 20 | + err(); | |
| 21 | + if (cris_lz(2) != 30) | |
| 22 | + err(); | |
| 23 | + if (cris_lz(4) != 29) | |
| 24 | + err(); | |
| 25 | + if (cris_lz(8) != 28) | |
| 26 | + err(); | |
| 27 | + | |
| 28 | + /* try all positions with a single bit. */ | |
| 29 | + for (i = 1; i < 32; i++) { | |
| 30 | + if (cris_lz(1 << (i-1)) != (32 - i)) | |
| 31 | + err(); | |
| 32 | + } | |
| 33 | + | |
| 34 | + /* try all positions with all bits. */ | |
| 35 | + for (i = 1; i < 32; i++) { | |
| 36 | + /* split up this computation to clarify it. */ | |
| 37 | + uint32_t val; | |
| 38 | + val = (unsigned int)-1 >> (32 - i); | |
| 39 | + if (cris_lz(val) != (32 - i)) | |
| 40 | + err(); | |
| 41 | + } | |
| 42 | +} | |
| 43 | + | |
| 44 | +int main(void) | |
| 45 | +{ | |
| 46 | + check_lz(); | |
| 47 | + pass(); | |
| 48 | + exit(0); | |
| 49 | +} | ... | ... |
tests/cris/check_mapbrk.c
0 → 100644
| 1 | +#include <stdio.h> | |
| 2 | +#include <stdlib.h> | |
| 3 | + | |
| 4 | +/* Basic sanity check that syscalls to implement malloc (brk, mmap2, | |
| 5 | + munmap) are trivially functional. */ | |
| 6 | + | |
| 7 | +int main () | |
| 8 | +{ | |
| 9 | + void *p1, *p2, *p3, *p4, *p5, *p6; | |
| 10 | + | |
| 11 | + if ((p1 = malloc (8100)) == NULL | |
| 12 | + || (p2 = malloc (16300)) == NULL | |
| 13 | + || (p3 = malloc (4000)) == NULL | |
| 14 | + || (p4 = malloc (500)) == NULL | |
| 15 | + || (p5 = malloc (1023*1024)) == NULL | |
| 16 | + || (p6 = malloc (8191*1024)) == NULL) | |
| 17 | + { | |
| 18 | + printf ("fail\n"); | |
| 19 | + exit (1); | |
| 20 | + } | |
| 21 | + | |
| 22 | + free (p1); | |
| 23 | + free (p2); | |
| 24 | + free (p3); | |
| 25 | + free (p4); | |
| 26 | + free (p5); | |
| 27 | + free (p6); | |
| 28 | + | |
| 29 | + p1 = malloc (64000); | |
| 30 | + if (p1 == NULL) | |
| 31 | + { | |
| 32 | + printf ("fail\n"); | |
| 33 | + exit (1); | |
| 34 | + } | |
| 35 | + free (p1); | |
| 36 | + | |
| 37 | + printf ("pass\n"); | |
| 38 | + exit (0); | |
| 39 | +} | ... | ... |
tests/cris/check_mcp.s
0 → 100644
| 1 | +# mach: crisv32 | |
| 2 | +# output: fffffffe\n1\n1ffff\nfffffffe\ncc463bdc\n4c463bdc\n0\n | |
| 3 | + | |
| 4 | + .include "testutils.inc" | |
| 5 | + start | |
| 6 | + | |
| 7 | +; Set R, clear C. | |
| 8 | + move 0x100,ccs | |
| 9 | + moveq -5,r3 | |
| 10 | + move 2,mof | |
| 11 | + mcp mof,r3 | |
| 12 | + test_cc 1 0 0 0 | |
| 13 | + checkr3 fffffffe | |
| 14 | + | |
| 15 | + moveq 2,r3 | |
| 16 | + move -1,srp | |
| 17 | + mcp srp,r3 | |
| 18 | + test_cc 0 0 0 0 | |
| 19 | + checkr3 1 | |
| 20 | + | |
| 21 | + move 0xffff,srp | |
| 22 | + move srp,r3 | |
| 23 | + mcp srp,r3 | |
| 24 | + test_cc 0 0 0 0 | |
| 25 | + checkr3 1ffff | |
| 26 | + | |
| 27 | + move -1,mof | |
| 28 | + move mof,r3 | |
| 29 | + mcp mof,r3 | |
| 30 | + test_cc 1 0 0 0 | |
| 31 | + checkr3 fffffffe | |
| 32 | + | |
| 33 | + move 0x5432f789,mof | |
| 34 | + move.d 0x78134452,r3 | |
| 35 | + mcp mof,r3 | |
| 36 | + test_cc 1 0 1 0 | |
| 37 | + checkr3 cc463bdc | |
| 38 | + | |
| 39 | + move 0x80000000,srp | |
| 40 | + mcp srp,r3 | |
| 41 | + test_cc 0 0 1 0 | |
| 42 | + checkr3 4c463bdc | |
| 43 | + | |
| 44 | + move 0xb3b9c423,srp | |
| 45 | + mcp srp,r3 | |
| 46 | + test_cc 0 1 0 0 | |
| 47 | + checkr3 0 | |
| 48 | + | |
| 49 | + quit | ... | ... |
tests/cris/check_mmap1.c
0 → 100644
| 1 | +/* | |
| 2 | +#notarget: cris*-*-elf | |
| 3 | +*/ | |
| 4 | + | |
| 5 | +#define _GNU_SOURCE | |
| 6 | +#include <string.h> | |
| 7 | +#include <stdlib.h> | |
| 8 | +#include <stdio.h> | |
| 9 | +#include <sys/types.h> | |
| 10 | +#include <sys/stat.h> | |
| 11 | +#include <fcntl.h> | |
| 12 | +#include <unistd.h> | |
| 13 | +#include <sys/mman.h> | |
| 14 | + | |
| 15 | +int main (int argc, char *argv[]) | |
| 16 | +{ | |
| 17 | + int fd = open (argv[0], O_RDONLY); | |
| 18 | + struct stat sb; | |
| 19 | + int size; | |
| 20 | + void *a; | |
| 21 | + const char *str = "a string you'll only find in the program"; | |
| 22 | + | |
| 23 | + if (fd == -1) | |
| 24 | + { | |
| 25 | + perror ("open"); | |
| 26 | + abort (); | |
| 27 | + } | |
| 28 | + | |
| 29 | + if (fstat (fd, &sb) < 0) | |
| 30 | + { | |
| 31 | + perror ("fstat"); | |
| 32 | + abort (); | |
| 33 | + } | |
| 34 | + | |
| 35 | + size = sb.st_size; | |
| 36 | + | |
| 37 | + /* We want to test mmapping a size that isn't exactly a page. */ | |
| 38 | + if ((size & 8191) == 0) | |
| 39 | + size--; | |
| 40 | + | |
| 41 | + a = mmap (NULL, size, PROT_READ, MAP_PRIVATE, fd, 0); | |
| 42 | + | |
| 43 | + if (memmem (a, size, str, strlen (str) + 1) == NULL) | |
| 44 | + abort (); | |
| 45 | + | |
| 46 | + printf ("pass\n"); | |
| 47 | + exit (0); | |
| 48 | +} | ... | ... |
tests/cris/check_mmap2.c
0 → 100644
| 1 | +/* | |
| 2 | +#notarget: cris*-*-elf | |
| 3 | +*/ | |
| 4 | + | |
| 5 | +#define _GNU_SOURCE | |
| 6 | +#include <string.h> | |
| 7 | +#include <stdlib.h> | |
| 8 | +#include <stdio.h> | |
| 9 | +#include <sys/types.h> | |
| 10 | +#include <sys/stat.h> | |
| 11 | +#include <fcntl.h> | |
| 12 | +#include <unistd.h> | |
| 13 | +#include <sys/mman.h> | |
| 14 | + | |
| 15 | +int main (int argc, char *argv[]) | |
| 16 | +{ | |
| 17 | + int fd = open (argv[0], O_RDONLY); | |
| 18 | + struct stat sb; | |
| 19 | + int size; | |
| 20 | + void *a; | |
| 21 | + const char *str = "a string you'll only find in the program"; | |
| 22 | + | |
| 23 | + if (fd == -1) | |
| 24 | + { | |
| 25 | + perror ("open"); | |
| 26 | + abort (); | |
| 27 | + } | |
| 28 | + | |
| 29 | + if (fstat (fd, &sb) < 0) | |
| 30 | + { | |
| 31 | + perror ("fstat"); | |
| 32 | + abort (); | |
| 33 | + } | |
| 34 | + | |
| 35 | + size = sb.st_size; | |
| 36 | + | |
| 37 | + /* We want to test mmapping a size that isn't exactly a page. */ | |
| 38 | + if ((size & 8191) == 0) | |
| 39 | + size--; | |
| 40 | + | |
| 41 | + a = mmap (NULL, size, PROT_READ, MAP_SHARED, fd, 0); | |
| 42 | + | |
| 43 | + if (memmem (a, size, str, strlen (str) + 1) == NULL) | |
| 44 | + abort (); | |
| 45 | + | |
| 46 | + printf ("pass\n"); | |
| 47 | + exit (0); | |
| 48 | +} | ... | ... |
tests/cris/check_mmap3.c
0 → 100644
| 1 | +/* | |
| 2 | +#notarget: cris*-*-elf | |
| 3 | +*/ | |
| 4 | + | |
| 5 | +#define _GNU_SOURCE | |
| 6 | +#include <string.h> | |
| 7 | +#include <stdlib.h> | |
| 8 | +#include <stdio.h> | |
| 9 | +#include <sys/types.h> | |
| 10 | +#include <sys/stat.h> | |
| 11 | +#include <unistd.h> | |
| 12 | +#include <sys/mman.h> | |
| 13 | + | |
| 14 | +int main (int argc, char *argv[]) | |
| 15 | +{ | |
| 16 | + volatile unsigned char *a; | |
| 17 | + | |
| 18 | + /* Check that we can map a non-multiple of a page and still get a full page. */ | |
| 19 | + a = mmap (NULL, 0x4c, PROT_READ | PROT_WRITE | PROT_EXEC, | |
| 20 | + MAP_PRIVATE | MAP_ANONYMOUS, -1, 0); | |
| 21 | + if (a == NULL || a == (unsigned char *) -1) | |
| 22 | + abort (); | |
| 23 | + | |
| 24 | + a[0] = 0xbe; | |
| 25 | + a[8191] = 0xef; | |
| 26 | + memset ((char *) a + 1, 0, 8190); | |
| 27 | + | |
| 28 | + if (a[0] != 0xbe || a[8191] != 0xef) | |
| 29 | + abort (); | |
| 30 | + | |
| 31 | + printf ("pass\n"); | |
| 32 | + exit (0); | |
| 33 | +} | ... | ... |
tests/cris/check_movdelsr1.s
0 → 100644
| 1 | +# mach: crisv0 crisv3 crisv8 crisv10 crisv32 | |
| 2 | +# output: aa117acd\n | |
| 3 | +# output: eeaabb42\n | |
| 4 | + | |
| 5 | +; Bug with move to special register in delay slot, due to | |
| 6 | +; special flush-insn-cache simulator use. Ordinary move worked; | |
| 7 | +; special register caused branch to fail. | |
| 8 | + | |
| 9 | + .include "testutils.inc" | |
| 10 | + start | |
| 11 | + move -1,srp | |
| 12 | + | |
| 13 | + move.d 0xaa117acd,r1 | |
| 14 | + moveq 3,r9 | |
| 15 | + cmpq 1,r9 | |
| 16 | + bhi 0f | |
| 17 | + move.d r1,r3 | |
| 18 | + | |
| 19 | + fail | |
| 20 | +0: | |
| 21 | + checkr3 aa117acd | |
| 22 | + | |
| 23 | + move.d 0xeeaabb42,r1 | |
| 24 | + moveq 3,r9 | |
| 25 | + cmpq 1,r9 | |
| 26 | + bhi 0f | |
| 27 | + move r1,srp | |
| 28 | + | |
| 29 | + fail | |
| 30 | +0: | |
| 31 | + move srp,r3 | |
| 32 | + checkr3 eeaabb42 | |
| 33 | + quit | ... | ... |
tests/cris/check_movecr.s
0 → 100644
| 1 | +# mach: crisv3 crisv8 crisv10 crisv32 | |
| 2 | +# output: ffffff42\n94\nffff4321\n9234\n76543210\n76540000\n | |
| 3 | + | |
| 4 | +; Move constant byte, word, dword to register. Check that no extension is | |
| 5 | +; performed, that only part of the register is set. | |
| 6 | + | |
| 7 | + .include "testutils.inc" | |
| 8 | + startnostack | |
| 9 | + moveq -1,r3 | |
| 10 | + move.b 0x42,r3 | |
| 11 | + test_move_cc 0 0 0 0 | |
| 12 | + checkr3 ffffff42 | |
| 13 | + | |
| 14 | + moveq 0,r3 | |
| 15 | + move.b 0x94,r3 | |
| 16 | + test_move_cc 1 0 0 0 | |
| 17 | + checkr3 94 | |
| 18 | + | |
| 19 | + moveq -1,r3 | |
| 20 | + move.w 0x4321,r3 | |
| 21 | + test_move_cc 0 0 0 0 | |
| 22 | + checkr3 ffff4321 | |
| 23 | + | |
| 24 | + moveq 0,r3 | |
| 25 | + move.w 0x9234,r3 | |
| 26 | + test_move_cc 1 0 0 0 | |
| 27 | + checkr3 9234 | |
| 28 | + | |
| 29 | + move.d 0x76543210,r3 | |
| 30 | + test_move_cc 0 0 0 0 | |
| 31 | + checkr3 76543210 | |
| 32 | + | |
| 33 | + move.w 0,r3 | |
| 34 | + test_move_cc 0 1 0 0 | |
| 35 | + checkr3 76540000 | |
| 36 | + | |
| 37 | + quit | ... | ... |
tests/cris/check_movei.s
0 → 100644
| 1 | +# mach: crisv32 | |
| 2 | +# output: fffffffe\n | |
| 3 | +# output: fffffffe\n | |
| 4 | + | |
| 5 | +; Check basic integral-write semantics regarding flags. | |
| 6 | + | |
| 7 | + .include "testutils.inc" | |
| 8 | + start | |
| 9 | + | |
| 10 | +; A write that works. Check that flags are set correspondingly. | |
| 11 | + move.d d,r4 | |
| 12 | + moveq -2,r5 | |
| 13 | + setf c | |
| 14 | + clearf p | |
| 15 | + move.d [r4],r3 | |
| 16 | + ax | |
| 17 | + move.d r5,[r4] | |
| 18 | + move.d [r4],r3 | |
| 19 | + | |
| 20 | + bcc 0f | |
| 21 | + nop | |
| 22 | + fail | |
| 23 | + | |
| 24 | +0: | |
| 25 | + checkr3 fffffffe | |
| 26 | + | |
| 27 | +; A write that fails; check flags too. | |
| 28 | + move.d d,r4 | |
| 29 | + moveq 23,r5 | |
| 30 | + setf p | |
| 31 | + clearf c | |
| 32 | + move.d [r4],r3 | |
| 33 | + ax | |
| 34 | + move.d r5,[r4] | |
| 35 | + move.d [r4],r3 | |
| 36 | + | |
| 37 | + bcs 0f | |
| 38 | + nop | |
| 39 | + fail | |
| 40 | + | |
| 41 | +0: | |
| 42 | + checkr3 fffffffe | |
| 43 | + quit | |
| 44 | + | |
| 45 | + .data | |
| 46 | +d: | |
| 47 | + .dword 42424242 | ... | ... |
tests/cris/check_movemr.s
0 → 100644
| 1 | +# mach: crisv3 crisv8 crisv10 crisv32 | |
| 2 | +# output: 12345678\n10234567\n12345678\n12344567\n12344523\n76543210\nffffffaa\naa\n9911\nffff9911\n78\n56\n3456\n6712\n | |
| 3 | + | |
| 4 | + .include "testutils.inc" | |
| 5 | + start | |
| 6 | + | |
| 7 | + .data | |
| 8 | +mem1: | |
| 9 | + .dword 0x12345678 | |
| 10 | +mem2: | |
| 11 | + .word 0x4567 | |
| 12 | +mem3: | |
| 13 | + .byte 0x23 | |
| 14 | + .dword 0x76543210 | |
| 15 | + .byte 0xaa,0x11,0x99 | |
| 16 | + | |
| 17 | + .text | |
| 18 | + move.d mem1,r2 | |
| 19 | + move.d [r2],r3 | |
| 20 | + test_move_cc 0 0 0 0 | |
| 21 | + checkr3 12345678 | |
| 22 | + | |
| 23 | + move.d mem2,r3 | |
| 24 | + move.d [r3],r3 | |
| 25 | + test_move_cc 0 0 0 0 | |
| 26 | + checkr3 10234567 | |
| 27 | + | |
| 28 | + move.d mem1,r2 | |
| 29 | + move.d [r2+],r3 | |
| 30 | + test_move_cc 0 0 0 0 | |
| 31 | + checkr3 12345678 | |
| 32 | + | |
| 33 | + move.w [r2+],r3 | |
| 34 | + test_move_cc 0 0 0 0 | |
| 35 | + checkr3 12344567 | |
| 36 | + | |
| 37 | + move.b [r2+],r3 | |
| 38 | + test_move_cc 0 0 0 0 | |
| 39 | + checkr3 12344523 | |
| 40 | + | |
| 41 | + move.d [r2+],r3 | |
| 42 | + test_move_cc 0 0 0 0 | |
| 43 | + checkr3 76543210 | |
| 44 | + | |
| 45 | + movs.b [r2],r3 | |
| 46 | + test_move_cc 1 0 0 0 | |
| 47 | + checkr3 ffffffaa | |
| 48 | + | |
| 49 | + movu.b [r2+],r3 | |
| 50 | + test_move_cc 0 0 0 0 | |
| 51 | + checkr3 aa | |
| 52 | + | |
| 53 | + movu.w [r2],r3 | |
| 54 | + test_move_cc 0 0 0 0 | |
| 55 | + checkr3 9911 | |
| 56 | + | |
| 57 | + movs.w [r2+],r3 | |
| 58 | + test_move_cc 1 0 0 0 | |
| 59 | + checkr3 ffff9911 | |
| 60 | + | |
| 61 | + move.d mem1,r13 | |
| 62 | + movs.b [r13+],r3 | |
| 63 | + test_move_cc 0 0 0 0 | |
| 64 | + checkr3 78 | |
| 65 | + | |
| 66 | + movu.b [r13],r3 | |
| 67 | + test_move_cc 0 0 0 0 | |
| 68 | + checkr3 56 | |
| 69 | + | |
| 70 | + movs.w [r13+],r3 | |
| 71 | + test_move_cc 0 0 0 0 | |
| 72 | + checkr3 3456 | |
| 73 | + | |
| 74 | + movu.w [r13+],r3 | |
| 75 | + test_move_cc 0 0 0 0 | |
| 76 | + checkr3 6712 | |
| 77 | + | |
| 78 | + quit | |
| 79 | + | ... | ... |
tests/cris/check_movemrv32.s
0 → 100644
| 1 | +# mach: crisv32 | |
| 2 | +# output: 15\n7\n2\nffff1234\nb\n16\nf\n2\nffffffef\nf\nffff1234\nf\nfffffff4\nd\nfffffff2\n10\nfffffff2\nd\n | |
| 3 | + | |
| 4 | + .include "testutils.inc" | |
| 5 | + .data | |
| 6 | +x: | |
| 7 | + .dword 8,9,10,11 | |
| 8 | +y: | |
| 9 | + .dword -12,13,-14,15,16 | |
| 10 | + | |
| 11 | + start | |
| 12 | + moveq 7,r0 | |
| 13 | + moveq 2,r1 | |
| 14 | + move.d 0xffff1234,r2 | |
| 15 | + moveq 21,r3 | |
| 16 | + move.d x,r4 | |
| 17 | + setf zcvn | |
| 18 | + movem r2,[r4+] | |
| 19 | + test_cc 1 1 1 1 | |
| 20 | + subq 12,r4 | |
| 21 | + | |
| 22 | + checkr3 15 | |
| 23 | + | |
| 24 | + move.d [r4+],r3 | |
| 25 | + checkr3 7 | |
| 26 | + | |
| 27 | + move.d [r4+],r3 | |
| 28 | + checkr3 2 | |
| 29 | + | |
| 30 | + move.d [r4+],r3 | |
| 31 | + checkr3 ffff1234 | |
| 32 | + | |
| 33 | + move.d [r4+],r3 | |
| 34 | + checkr3 b | |
| 35 | + | |
| 36 | + subq 16,r4 | |
| 37 | + moveq 22,r0 | |
| 38 | + moveq 15,r1 | |
| 39 | + clearf zcvn | |
| 40 | + movem r0,[r4] | |
| 41 | + test_cc 0 0 0 0 | |
| 42 | + move.d [r4+],r3 | |
| 43 | + checkr3 16 | |
| 44 | + | |
| 45 | + move.d r1,r3 | |
| 46 | + checkr3 f | |
| 47 | + | |
| 48 | + move.d [r4+],r3 | |
| 49 | + checkr3 2 | |
| 50 | + | |
| 51 | + subq 8,r4 | |
| 52 | + moveq 10,r2 | |
| 53 | + moveq -17,r0 | |
| 54 | + clearf zc | |
| 55 | + setf vn | |
| 56 | + movem r1,[r4] | |
| 57 | + test_cc 1 0 1 0 | |
| 58 | + move.d [r4+],r3 | |
| 59 | + checkr3 ffffffef | |
| 60 | + | |
| 61 | + move.d [r4+],r3 | |
| 62 | + checkr3 f | |
| 63 | + | |
| 64 | + move.d [r4+],r3 | |
| 65 | + checkr3 ffff1234 | |
| 66 | + | |
| 67 | + move.d y,r4 | |
| 68 | + setf zc | |
| 69 | + clearf vn | |
| 70 | + movem [r4+],r3 | |
| 71 | + test_cc 0 1 0 1 | |
| 72 | + checkr3 f | |
| 73 | + | |
| 74 | + move.d r0,r3 | |
| 75 | + checkr3 fffffff4 | |
| 76 | + | |
| 77 | + move.d r1,r3 | |
| 78 | + checkr3 d | |
| 79 | + | |
| 80 | + move.d r2,r3 | |
| 81 | + checkr3 fffffff2 | |
| 82 | + | |
| 83 | + move.d [r4],r3 | |
| 84 | + checkr3 10 | |
| 85 | + | |
| 86 | + subq 8,r4 | |
| 87 | + setf zcvn | |
| 88 | + movem [r4+],r0 | |
| 89 | + test_cc 1 1 1 1 | |
| 90 | + move.d r0,r3 | |
| 91 | + checkr3 fffffff2 | |
| 92 | + | |
| 93 | + move.d r1,r3 | |
| 94 | + checkr3 d | |
| 95 | + | |
| 96 | + quit | |
| 97 | + | ... | ... |
tests/cris/check_moveq.c
0 → 100644
| 1 | +#include <stdio.h> | |
| 2 | +#include <stdlib.h> | |
| 3 | +#include <stdint.h> | |
| 4 | +#include "sys.h" | |
| 5 | +#include "crisutils.h" | |
| 6 | + | |
| 7 | +#define cris_moveq(dst, src) \ | |
| 8 | + asm volatile ("moveq %1, %0\n" : "=r" (dst) : "i" (src)); | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | +int main(void) | |
| 13 | +{ | |
| 14 | + int t; | |
| 15 | + | |
| 16 | + cris_tst_cc_init(); | |
| 17 | + asm volatile ("setf\tzvnc\n"); | |
| 18 | + cris_moveq(t, 10); | |
| 19 | + cris_tst_cc(1, 1, 1, 1); | |
| 20 | + if (t != 10) | |
| 21 | + err(); | |
| 22 | + | |
| 23 | + /* make sure moveq doesnt clobber the zflag. */ | |
| 24 | + cris_tst_cc_init(); | |
| 25 | + asm volatile ("setf vnc\n"); | |
| 26 | + asm volatile ("clearf z\n"); | |
| 27 | + cris_moveq(t, 0); | |
| 28 | + cris_tst_cc(1, 0, 1, 1); | |
| 29 | + if (t != 0) | |
| 30 | + err(); | |
| 31 | + | |
| 32 | + /* make sure moveq doesnt clobber the nflag. | |
| 33 | + Also check large immediates */ | |
| 34 | + cris_tst_cc_init(); | |
| 35 | + asm volatile ("setf zvc\n"); | |
| 36 | + asm volatile ("clearf n\n"); | |
| 37 | + cris_moveq(t, -31); | |
| 38 | + cris_tst_cc(0, 1, 1, 1); | |
| 39 | + if (t != -31) | |
| 40 | + err(); | |
| 41 | + | |
| 42 | + cris_tst_cc_init(); | |
| 43 | + asm volatile ("setf nzvc\n"); | |
| 44 | + cris_moveq(t, 31); | |
| 45 | + cris_tst_cc(1, 1, 1, 1); | |
| 46 | + if (t != 31) | |
| 47 | + err(); | |
| 48 | + | |
| 49 | + pass(); | |
| 50 | + return 0; | |
| 51 | +} | ... | ... |
tests/cris/check_mover.s
0 → 100644
| 1 | +# mach: crisv3 crisv8 crisv10 crisv32 | |
| 2 | +# output: ffffff05\nffff0005\n5\nffffff00\n | |
| 3 | + | |
| 4 | +; Move between registers. Check that just the subreg is copied. | |
| 5 | + | |
| 6 | + .include "testutils.inc" | |
| 7 | + startnostack | |
| 8 | + moveq -30,r3 | |
| 9 | + moveq 5,r4 | |
| 10 | + move.b r4,r3 | |
| 11 | + test_move_cc 0 0 0 0 ; FIXME | |
| 12 | + checkr3 ffffff05 | |
| 13 | + | |
| 14 | + move.w r4,r3 | |
| 15 | + test_move_cc 0 0 0 0 | |
| 16 | + checkr3 ffff0005 | |
| 17 | + | |
| 18 | + move.d r4,r3 | |
| 19 | + test_move_cc 0 0 0 0 | |
| 20 | + checkr3 5 | |
| 21 | + | |
| 22 | + moveq -1,r3 | |
| 23 | + moveq 0,r4 | |
| 24 | + move.b r4,r3 | |
| 25 | + test_move_cc 0 1 0 0 | |
| 26 | + checkr3 ffffff00 | |
| 27 | + | |
| 28 | + quit | |
| 29 | + | ... | ... |
tests/cris/check_moverm.s
0 → 100644
| 1 | +# mach: crisv3 crisv8 crisv10 crisv32 | |
| 2 | +# output: 7823fec2\n10231879\n102318fe\n | |
| 3 | + | |
| 4 | + .include "testutils.inc" | |
| 5 | + start | |
| 6 | + | |
| 7 | + .data | |
| 8 | +mem1: | |
| 9 | + .dword 0x12345678 | |
| 10 | +mem2: | |
| 11 | + .word 0x4567 | |
| 12 | +mem3: | |
| 13 | + .byte 0x23 | |
| 14 | + .dword 0x76543210 | |
| 15 | + .byte 0xaa,0x11,0x99 | |
| 16 | + | |
| 17 | + .text | |
| 18 | + move.d mem1,r2 | |
| 19 | + move.d 0x7823fec2,r4 | |
| 20 | + setf nzvc | |
| 21 | + move.d r4,[r2+] | |
| 22 | + test_cc 1 1 1 1 | |
| 23 | + subq 4,r2 | |
| 24 | + move.d [r2],r3 | |
| 25 | + checkr3 7823fec2 | |
| 26 | + | |
| 27 | + move.d mem2,r3 | |
| 28 | + move.d 0x45231879,r4 | |
| 29 | + clearf nzvc | |
| 30 | + move.w r4,[r3] | |
| 31 | + test_cc 0 0 0 0 | |
| 32 | + move.d [r3],r3 | |
| 33 | + checkr3 10231879 | |
| 34 | + | |
| 35 | + move.d mem2,r2 | |
| 36 | + moveq -2,r4 | |
| 37 | + clearf nc | |
| 38 | + setf zv | |
| 39 | + move.b r4,[r2+] | |
| 40 | + test_cc 0 1 1 0 | |
| 41 | + subq 1,r2 | |
| 42 | + move.d [r2],r3 | |
| 43 | + checkr3 102318ff | |
| 44 | + | |
| 45 | + quit | ... | ... |