configure: add configure option avx512f_opt
[qemu/ar7.git] / tests / tcg / openrisc / test_logic.c
blob46d173f4819bdf7eb36fb1daa6e66d90dde206c2
1 #include <stdio.h>
3 int main(void)
5 int a, b, c;
6 int result;
8 b = 0x9743;
9 c = 0x2;
10 result = 0x25d0c;
11 __asm
12 ("l.sll %0, %1, %2\n\t"
13 : "=r"(a)
14 : "r"(b), "r"(c)
16 if (a != result) {
17 printf("sll error\n");
18 return -1;
21 b = 0x9743;
22 result = 0x25d0c;
23 __asm
24 ("l.slli %0, %1, 0x2\n\t"
25 : "=r"(a)
26 : "r"(b)
28 if (a != result) {
29 printf("slli error\n");
30 return -1;
33 b = 0x7654;
34 c = 0x03;
35 result = 0xeca;
36 __asm
37 ("l.srl %0, %1, %2\n\t"
38 : "=r"(a)
39 : "r"(b), "r"(c)
42 b = 0x7654;
43 result = 0xeca;
44 __asm
45 ("l.srli %0, %1, 0x3\n\t"
46 : "=r"(a)
47 : "r"(b)
49 if (a != result) {
50 printf("srli error\n");
51 return -1;
54 b = 0x80000001;
55 c = 0x4;
56 result = 0x18000000;
57 __asm
58 ("l.ror %0, %1, %2\n\t"
59 : "=r"(a)
60 : "r"(b), "r"(c)
62 if (a != result) {
63 printf("ror error\n");
64 return -1;
67 b = 0x80000001;
68 result = 0x18000000;
69 __asm
70 ("l.rori %0, %1, 0x4\n\t"
71 : "=r"(a)
72 : "r"(b)
74 if (a != result) {
75 printf("rori error\n");
76 return -1;
79 b = 0x80000001;
80 c = 0x03;
81 result = 0xf0000000;
82 __asm
83 ("l.sra %0, %1, %2\n\t"
84 : "=r"(a)
85 : "r"(b), "r"(c)
87 if (a != result) {
88 printf("sra error\n");
89 return -1;
92 b = 0x80000001;
93 result = 0xf0000000;
94 __asm
95 ("l.srai %0, %1, 0x3\n\t"
96 : "=r"(a)
97 : "r"(b)
99 if (a != result) {
100 printf("srai error\n");
101 return -1;
104 return 0;