fix raw_pread_aligned return value
[qemu-kvm/fedora.git] / tests / cris / check_addc.c
blobe4078555f8ccd4d9e677cb01226446564cd05d6c
1 #include <stdio.h>
2 #include <stdlib.h>
3 #include <stdint.h>
4 #include "sys.h"
5 #include "crisutils.h"
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;
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(); \
21 int main(void)
23 cris_tst_cc_init();
24 asm volatile ("clearf cz");
25 verify_addc(0, 0, 0, 0, 0, 0, 0);
27 cris_tst_cc_init();
28 asm volatile ("setf z");
29 verify_addc(0, 0, 0, 0, 1, 0, 0);
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);
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);
43 cris_tst_cc_init();
44 asm volatile ("setf c");
45 verify_addc(0xffff, 0xffff, 0x1ffff, 0, 0, 0, 0);
47 cris_tst_cc_init();
48 asm volatile ("clearf nzvc");
49 verify_addc(-1, -1, 0xfffffffe, 1, 0, 0, 1);
51 cris_tst_cc_init();
52 asm volatile ("setf c");
53 verify_addc(0x78134452, 0x5432f789, 0xcc463bdc, 1, 0, 1, 0);
55 pass();
56 return 0;