FreeBSD: add file descriptor tracking for _umtx_op
[valgrind.git] / none / tests / s390x / clij.c
blob01636cf7dfcb97e50f25de8dee9ff6c4dfa916dd
1 #include <stdio.h>
2 #include <stdint.h>
3 #include "opcodes.h"
5 #define BRASLCLOBBER "cc", "0","1","2","3","4","5","14", \
6 "f0","f1","f2","f3","f4","f5","f6","f7"
8 void if_eq(void) { printf("equal\n"); }
9 void if_ne(void) { printf("not equal\n"); }
10 void if_gt(void) { printf("greater than\n"); }
11 void if_le(void) { printf("less or equal\n"); }
12 void if_lt(void) { printf("less than\n"); }
13 void if_ge(void) { printf("greater or equal\n"); }
14 void if_taken(void) { printf("taken\n"); }
15 void if_not_taken(void) { printf("not taken\n"); }
17 #undef LT
18 #define NEVER 0
19 #define GT 2
20 #define LT 4
21 #define NE 6
22 #define EQ 8
23 #define LE C
24 #define GE A
25 #define ALWAYS E
28 void compare_never(uint32_t value)
30 register uint32_t val asm("r7") = value;
32 asm volatile(
33 "aghi 15,-160\n\t"
34 CLIJ(7,NEVER,8,2a) "\n\t" /* 0x2a == 42 */
35 "brasl 14,if_not_taken\n\t"
36 "j 0f\n\t"
37 "brasl 14,if_taken\n\t"
38 "0: aghi 15,160\n\t" : : "d"(val) : BRASLCLOBBER);
39 return;
42 void compare_always(uint32_t value)
44 register uint32_t val asm("r7") = value;
46 asm volatile(
47 "aghi 15,-160\n\t"
48 CLIJ(7,ALWAYS,8,2a) "\n\t" /* 0x2a == 42 */
49 "brasl 14,if_not_taken\n\t"
50 "j 0f\n\t"
51 "brasl 14,if_taken\n\t"
52 "0: aghi 15,160\n\t" : : "d"(val) : BRASLCLOBBER);
53 return;
56 void compare_le42(uint32_t value)
58 register uint32_t val asm("r7") = value;
60 asm volatile(
61 "aghi 15,-160\n\t"
62 CLIJ(7,LE,8,2a) "\n\t" /* 0x2a == 42 */
63 "brasl 14,if_gt\n\t"
64 "j 0f\n\t"
65 "brasl 14,if_le\n\t"
66 "0: aghi 15,160\n\t" : : "d"(val) : BRASLCLOBBER);
67 return;
70 void compare_ge42(uint32_t value)
72 register uint32_t val asm("r7") = value;
74 asm volatile(
75 "aghi 15,-160\n\t"
76 CLIJ(7,GE,8,2a) "\n\t" /* 0x2a == 42 */
77 "brasl 14,if_lt\n\t"
78 "j 0f\n\t"
79 "brasl 14,if_ge\n\t"
80 "0: aghi 15,160\n\t" : : "d"(val) : BRASLCLOBBER);
81 return;
84 void compare_gt42(uint32_t value)
86 register uint32_t val asm("r7") = value;
88 asm volatile(
89 "aghi 15,-160\n\t"
90 CLIJ(7,GT,8,2a) "\n\t" /* 0x2a == 42 */
91 "brasl 14,if_le\n\t"
92 "j 0f\n\t"
93 "brasl 14,if_gt\n\t"
94 "0: aghi 15,160\n\t" : : "d"(val) : BRASLCLOBBER);
95 return;
98 void compare_lt42(uint32_t value)
100 register uint32_t val asm("r7") = value;
102 asm volatile(
103 "aghi 15,-160\n\t"
104 CLIJ(7,LT,8,2a) "\n\t" /* 0x2a == 42 */
105 "brasl 14,if_ge\n\t"
106 "j 0f\n\t"
107 "brasl 14,if_lt\n\t"
108 "0: aghi 15,160\n\t" : : "d"(val) : BRASLCLOBBER);
109 return;
112 void compare_eq42(uint32_t value)
114 register uint32_t val asm("r7") = value;
116 asm volatile(
117 "aghi 15,-160\n\t"
118 CLIJ(7,EQ,8,2a) "\n\t" /* 0x2a == 42 */
119 "brasl 14,if_ne\n\t"
120 "j 0f\n\t"
121 "brasl 14,if_eq\n\t"
122 "0: aghi 15,160\n\t" : : "d"(val) : BRASLCLOBBER);
123 return;
126 void compare_ne42(uint32_t value)
128 register uint32_t val asm("r7") = value;
130 asm volatile(
131 "aghi 15,-160\n\t"
132 CLIJ(7,NE,8,2a) "\n\t" /* 0x2a == 42 */
133 "brasl 14,if_eq\n\t"
134 "j 0f\n\t"
135 "brasl 14,if_ne\n\t"
136 "0: aghi 15,160\n\t" : : "d"(val) : BRASLCLOBBER);
137 return;
140 int main()
142 compare_eq42(12);
143 compare_eq42(42);
144 compare_eq42(100);
146 compare_ne42(12);
147 compare_ne42(42);
148 compare_ne42(100);
150 compare_gt42(12);
151 compare_gt42(42);
152 compare_gt42(100);
154 compare_lt42(12);
155 compare_lt42(42);
156 compare_lt42(100);
158 compare_le42(12);
159 compare_le42(42);
160 compare_le42(100);
162 compare_ge42(12);
163 compare_ge42(42);
164 compare_ge42(100);
166 compare_never(12);
167 compare_never(42);
168 compare_never(100);
170 compare_always(12);
171 compare_always(42);
172 compare_always(100);
174 return 0;