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