root / tests / cris / check_addoq.c @ f97572e5
History | View | Annotate | Download (965 Bytes)
1 | dd43edf4 | ths | #include <stdio.h> |
---|---|---|---|
2 | dd43edf4 | ths | #include <stdlib.h> |
3 | dd43edf4 | ths | #include <stdint.h> |
4 | dd43edf4 | ths | #include "sys.h" |
5 | dd43edf4 | ths | #include "crisutils.h" |
6 | dd43edf4 | ths | |
7 | dd43edf4 | ths | /* this would be better to do in asm, it's an orgy in GCC inline asm now. */
|
8 | dd43edf4 | ths | |
9 | dd43edf4 | ths | /* ACR will be clobbered. */
|
10 | dd43edf4 | ths | #define cris_addoq(o, v) \
|
11 | dd43edf4 | ths | asm volatile ("addoq\t%1, %0, $acr\n" : : "r" (v), "i" (o) : "acr"); |
12 | dd43edf4 | ths | |
13 | dd43edf4 | ths | |
14 | dd43edf4 | ths | int main(void) |
15 | dd43edf4 | ths | { |
16 | dd43edf4 | ths | int x[3] = {0x55aa77ff, 0xccff2244, 0x88ccee19}; |
17 | dd43edf4 | ths | int *p, *t = x + 1; |
18 | dd43edf4 | ths | |
19 | dd43edf4 | ths | cris_tst_cc_init(); |
20 | dd43edf4 | ths | asm volatile ("setf\tzvnc\n"); |
21 | dd43edf4 | ths | cris_addoq(0, t);
|
22 | dd43edf4 | ths | cris_tst_cc(1, 1, 1, 1); |
23 | dd43edf4 | ths | asm volatile ("move.d\t$acr, %0\n" : "=r" (p)); |
24 | dd43edf4 | ths | if (*p != 0xccff2244) |
25 | dd43edf4 | ths | err(); |
26 | dd43edf4 | ths | |
27 | dd43edf4 | ths | cris_tst_cc_init(); |
28 | dd43edf4 | ths | asm volatile ("setf\tzvnc\n"); |
29 | dd43edf4 | ths | cris_addoq(4, t);
|
30 | dd43edf4 | ths | cris_tst_cc(1, 1, 1, 1); |
31 | dd43edf4 | ths | asm volatile ("move.d\t$acr, %0\n" : "=r" (p)); |
32 | dd43edf4 | ths | if (*p != 0x88ccee19) |
33 | dd43edf4 | ths | err(); |
34 | dd43edf4 | ths | |
35 | dd43edf4 | ths | cris_tst_cc_init(); |
36 | dd43edf4 | ths | asm volatile ("clearf\tzvnc\n"); |
37 | dd43edf4 | ths | cris_addoq(-8, t + 1); |
38 | dd43edf4 | ths | cris_tst_cc(0, 0, 0, 0); |
39 | dd43edf4 | ths | asm volatile ("move.d\t$acr, %0\n" : "=r" (p)); |
40 | dd43edf4 | ths | if (*p != 0x55aa77ff) |
41 | dd43edf4 | ths | err(); |
42 | dd43edf4 | ths | pass(); |
43 | dd43edf4 | ths | return 0; |
44 | dd43edf4 | ths | } |