s390-ccw.img: replace while loop with a disabled wait on s390 bios
[qemu/agraf.git] / tests / tcg / cris / check_addc.c
blobfacd1bea2dc30a32541935381c5c6ff2136a5dd2
1 #include <stdio.h>
2 #include <stdlib.h>
3 #include <stdint.h>
4 #include "sys.h"
5 #include "crisutils.h"
7 static inline int cris_addc(int a, const int b)
9 asm ("addc\t%1, %0\n" : "+r" (a) : "r" (b));
10 return a;
13 #define verify_addc(a, b, res, n, z, v, c) \
14 { \
15 int r; \
16 r = cris_addc((a), (b)); \
17 cris_tst_cc((n), (z), (v), (c)); \
18 if (r != (res)) \
19 err(); \
22 int main(void)
24 cris_tst_cc_init();
25 asm volatile ("clearf cz");
26 verify_addc(0, 0, 0, 0, 0, 0, 0);
28 cris_tst_cc_init();
29 asm volatile ("setf z");
30 verify_addc(0, 0, 0, 0, 1, 0, 0);
32 cris_tst_cc_init();
33 asm volatile ("setf cz");
34 verify_addc(0, 0, 1, 0, 0, 0, 0);
35 cris_tst_cc_init();
36 asm volatile ("clearf c");
37 verify_addc(-1, 2, 1, 0, 0, 0, 1);
39 cris_tst_cc_init();
40 asm volatile ("clearf nzv");
41 asm volatile ("setf c");
42 verify_addc(-1, 2, 2, 0, 0, 0, 1);
44 cris_tst_cc_init();
45 asm volatile ("setf c");
46 verify_addc(0xffff, 0xffff, 0x1ffff, 0, 0, 0, 0);
48 cris_tst_cc_init();
49 asm volatile ("clearf nzvc");
50 verify_addc(-1, -1, 0xfffffffe, 1, 0, 0, 1);
52 cris_tst_cc_init();
53 asm volatile ("setf c");
54 verify_addc(0x78134452, 0x5432f789, 0xcc463bdc, 1, 0, 1, 0);
56 pass();
57 return 0;