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));
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));
19
#define verify_addc_m(a, b, res, n, z, v, c) \
22
r = cris_addc_m((a), (b)); \
23
cris_tst_cc((n), (z), (v), (c)); \
28
#define verify_addc_pi_m(a, b, res, n, z, v, c) \
31
r = cris_addc_pi_m((a), (b)); \
32
cris_tst_cc((n), (z), (v), (c)); \
37
int x[] = { 0, 0, 2, -1, 0xffff, -1, 0x5432f789};
41
int *p = (void *)&x[0];
44
asm volatile ("clearf cz");
45
verify_addc_m(0, p, 0, 0, 0, 0, 0);
48
asm volatile ("setf z");
49
verify_addc_m(0, p, 0, 0, 1, 0, 0);
52
asm volatile ("setf c");
53
verify_addc_m(0, p, 1, 0, 0, 0, 0);
56
asm volatile ("clearf c");
57
verify_addc_pi_m(0, &p, 0, 0, 1, 0, 0);
61
asm volatile ("setf c");
62
verify_addc_pi_m(0, &p, 1, 0, 0, 0, 0);
68
asm volatile ("clearf c");
69
verify_addc_pi_m(-1, &p, 1, 0, 0, 0, 1);
75
/* TODO: investigate why this one fails. */
77
asm volatile ("setf c");
78
verify_addc_m(2, p, 2, 0, 0, 0, 1);