simplify TARGET_ARCH2 generation
[qemu.git] / tests / cris / check_moveq.c
blob9f71194ac3674322856376cc1c17ebcc727e183b
1 #include <stdio.h>
2 #include <stdlib.h>
3 #include <stdint.h>
4 #include "sys.h"
5 #include "crisutils.h"
7 #define cris_moveq(dst, src) \
8 asm volatile ("moveq %1, %0\n" : "=r" (dst) : "i" (src));
12 int main(void)
14 int t;
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();
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();
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();
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();
49 pass();
50 return 0;