virtio-serial: Turn props any virtio-serial-bus device must have into bus props
[qemu.git] / tests / cris / check_addcm.c
blob7928bc9999b598c22c3ae86c0b135544c77d4825
1 #include <stdio.h>
2 #include <stdlib.h>
3 #include <stdint.h>
4 #include "sys.h"
5 #include "crisutils.h"
7 /* need to avoid acr as source here. */
8 static inline int cris_addc_m(int a, const int *b)
10 asm volatile ("addc [%1], %0\n" : "+r" (a) : "r" (b));
11 return a;
14 /* 'b' is a crisv32 constrain to avoid postinc with $acr. */
15 static inline int cris_addc_pi_m(int a, int **b)
17 asm volatile ("addc [%1+], %0\n" : "+r" (a), "+b" (*b));
18 return a;
21 #define verify_addc_m(a, b, res, n, z, v, c) \
22 { \
23 int r; \
24 r = cris_addc_m((a), (b)); \
25 cris_tst_cc((n), (z), (v), (c)); \
26 if (r != (res)) \
27 err(); \
30 #define verify_addc_pi_m(a, b, res, n, z, v, c) \
31 { \
32 int r; \
33 r = cris_addc_pi_m((a), (b)); \
34 cris_tst_cc((n), (z), (v), (c)); \
35 if (r != (res)) \
36 err(); \
39 int x[] = { 0, 0, 2, -1, 0xffff, -1, 0x5432f789};
41 int main(void)
43 int *p = (void *)&x[0];
44 #if 1
45 cris_tst_cc_init();
46 asm volatile ("clearf cz");
47 verify_addc_m(0, p, 0, 0, 0, 0, 0);
49 cris_tst_cc_init();
50 asm volatile ("setf z");
51 verify_addc_m(0, p, 0, 0, 1, 0, 0);
53 cris_tst_cc_init();
54 asm volatile ("setf c");
55 verify_addc_m(0, p, 1, 0, 0, 0, 0);
57 cris_tst_cc_init();
58 asm volatile ("clearf c");
59 verify_addc_pi_m(0, &p, 0, 0, 1, 0, 0);
61 p = &x[1];
62 cris_tst_cc_init();
63 asm volatile ("setf c");
64 verify_addc_pi_m(0, &p, 1, 0, 0, 0, 0);
66 if (p != &x[2])
67 err();
69 cris_tst_cc_init();
70 asm volatile ("clearf c");
71 verify_addc_pi_m(-1, &p, 1, 0, 0, 0, 1);
73 if (p != &x[3])
74 err();
75 #endif
76 p = &x[3];
77 /* TODO: investigate why this one fails. */
78 cris_tst_cc_init();
79 asm volatile ("setf c");
80 verify_addc_m(2, p, 2, 0, 0, 0, 1);
81 p += 4;
83 pass();
84 return 0;