3 #define branch(mask,i2,_v1) \
6 unsigned long v1 = _v1; \
7 asm volatile( " tmll %[v]," #i2 "\n\t" \
8 " brc " #mask " ,1f\n\t" \
9 " mvi %[taken],0\n\t" \
11 "1: mvi %[taken],1\n\t" \
12 "0: bcr 0,0 /* nop */\n\t" \
13 : [taken] "=Q" (taken) \
25 printf("Test #1 mask == 0, value == ~0 --> cc == 0\n");
30 if (branch(0, 0, v
)) ++wrong
; else ++ok
;
31 if (branch(1, 0, v
)) ++wrong
; else ++ok
;
32 if (branch(2, 0, v
)) ++wrong
; else ++ok
;
33 if (branch(3, 0, v
)) ++wrong
; else ++ok
;
34 if (branch(4, 0, v
)) ++wrong
; else ++ok
;
35 if (branch(5, 0, v
)) ++wrong
; else ++ok
;
36 if (branch(6, 0, v
)) ++wrong
; else ++ok
;
37 if (branch(7, 0, v
)) ++wrong
; else ++ok
;
38 if (branch(8, 0, v
)) ++ok
; else ++wrong
;
39 if (branch(9, 0, v
)) ++ok
; else ++wrong
;
40 if (branch(10, 0, v
)) ++ok
; else ++wrong
;
41 if (branch(11, 0, v
)) ++ok
; else ++wrong
;
42 if (branch(12, 0, v
)) ++ok
; else ++wrong
;
43 if (branch(13, 0, v
)) ++ok
; else ++wrong
;
44 if (branch(14, 0, v
)) ++ok
; else ++wrong
;
45 if (branch(15, 0, v
)) ++ok
; else ++wrong
;
47 if (wrong
!= 0 || ok
!= 16)
59 printf("Test #2 mask == 0xFFF, value == 0 --> cc == 0\n");
64 if (branch(0, 0xFFFF, v
)) ++wrong
; else ++ok
;
65 if (branch(1, 0xFFFF, v
)) ++wrong
; else ++ok
;
66 if (branch(2, 0xFFFF, v
)) ++wrong
; else ++ok
;
67 if (branch(3, 0xFFFF, v
)) ++wrong
; else ++ok
;
68 if (branch(4, 0xFFFF, v
)) ++wrong
; else ++ok
;
69 if (branch(5, 0xFFFF, v
)) ++wrong
; else ++ok
;
70 if (branch(6, 0xFFFF, v
)) ++wrong
; else ++ok
;
71 if (branch(7, 0xFFFF, v
)) ++wrong
; else ++ok
;
72 if (branch(8, 0xFFFF, v
)) ++ok
; else ++wrong
;
73 if (branch(9, 0xFFFF, v
)) ++ok
; else ++wrong
;
74 if (branch(10, 0xFFFF, v
)) ++ok
; else ++wrong
;
75 if (branch(11, 0xFFFF, v
)) ++ok
; else ++wrong
;
76 if (branch(12, 0xFFFF, v
)) ++ok
; else ++wrong
;
77 if (branch(13, 0xFFFF, v
)) ++ok
; else ++wrong
;
78 if (branch(14, 0xFFFF, v
)) ++ok
; else ++wrong
;
79 if (branch(15, 0xFFFF, v
)) ++ok
; else ++wrong
;
81 if (wrong
!= 0 || ok
!= 16)
88 tmll_all_selected_bits_set_1(void)
93 printf("Test #3 mask == 0xFFFF, value == 0xFFFF --> cc == 3\n");
98 if (branch(0, 0xFFFF, v
)) ++wrong
; else ++ok
;
99 if (branch(1, 0xFFFF, v
)) ++ok
; else ++wrong
;
100 if (branch(2, 0xFFFF, v
)) ++wrong
; else ++ok
;
101 if (branch(3, 0xFFFF, v
)) ++ok
; else ++wrong
;
102 if (branch(4, 0xFFFF, v
)) ++wrong
; else ++ok
;
103 if (branch(5, 0xFFFF, v
)) ++ok
; else ++wrong
;
104 if (branch(6, 0xFFFF, v
)) ++wrong
; else ++ok
;
105 if (branch(7, 0xFFFF, v
)) ++ok
; else ++wrong
;
106 if (branch(8, 0xFFFF, v
)) ++wrong
; else ++ok
;
107 if (branch(9, 0xFFFF, v
)) ++ok
; else ++wrong
;
108 if (branch(10, 0xFFFF, v
)) ++wrong
; else ++ok
;
109 if (branch(11, 0xFFFF, v
)) ++ok
; else ++wrong
;
110 if (branch(12, 0xFFFF, v
)) ++wrong
; else ++ok
;
111 if (branch(13, 0xFFFF, v
)) ++ok
; else ++wrong
;
112 if (branch(14, 0xFFFF, v
)) ++wrong
; else ++ok
;
113 if (branch(15, 0xFFFF, v
)) ++ok
; else ++wrong
;
115 if (wrong
!= 0 || ok
!= 16)
122 tmll_all_selected_bits_set_2(void)
127 printf("Test #4 mask == 0x8000, value == 0x8000 --> cc == 3\n");
132 if (branch(0, 0x8000, v
)) ++wrong
; else ++ok
;
133 if (branch(1, 0x8000, v
)) ++ok
; else ++wrong
;
134 if (branch(2, 0x8000, v
)) ++wrong
; else ++ok
;
135 if (branch(3, 0x8000, v
)) ++ok
; else ++wrong
;
136 if (branch(4, 0x8000, v
)) ++wrong
; else ++ok
;
137 if (branch(5, 0x8000, v
)) ++ok
; else ++wrong
;
138 if (branch(6, 0x8000, v
)) ++wrong
; else ++ok
;
139 if (branch(7, 0x8000, v
)) ++ok
; else ++wrong
;
140 if (branch(8, 0x8000, v
)) ++wrong
; else ++ok
;
141 if (branch(9, 0x8000, v
)) ++ok
; else ++wrong
;
142 if (branch(10, 0x8000, v
)) ++wrong
; else ++ok
;
143 if (branch(11, 0x8000, v
)) ++ok
; else ++wrong
;
144 if (branch(12, 0x8000, v
)) ++wrong
; else ++ok
;
145 if (branch(13, 0x8000, v
)) ++ok
; else ++wrong
;
146 if (branch(14, 0x8000, v
)) ++wrong
; else ++ok
;
147 if (branch(15, 0x8000, v
)) ++ok
; else ++wrong
;
149 if (wrong
!= 0 || ok
!= 16)
156 tmll_some_selected_bits_set_msb_set(void)
161 printf("Test #5 mask == 0xF000, value == 0x9000 --> cc == 2\n");
166 if (branch(0, 0xF000, v
)) ++wrong
; else ++ok
;
167 if (branch(1, 0xF000, v
)) ++wrong
; else ++ok
;
168 if (branch(2, 0xF000, v
)) ++ok
; else ++wrong
;
169 if (branch(3, 0xF000, v
)) ++ok
; else ++wrong
;
170 if (branch(4, 0xF000, v
)) ++wrong
; else ++ok
;
171 if (branch(5, 0xF000, v
)) ++wrong
; else ++ok
;
172 if (branch(6, 0xF000, v
)) ++ok
; else ++wrong
;
173 if (branch(7, 0xF000, v
)) ++ok
; else ++wrong
;
174 if (branch(8, 0xF000, v
)) ++wrong
; else ++ok
;
175 if (branch(9, 0xF000, v
)) ++wrong
; else ++ok
;
176 if (branch(10, 0xF000, v
)) ++ok
; else ++wrong
;
177 if (branch(11, 0xF000, v
)) ++ok
; else ++wrong
;
178 if (branch(12, 0xF000, v
)) ++wrong
; else ++ok
;
179 if (branch(13, 0xF000, v
)) ++wrong
; else ++ok
;
180 if (branch(14, 0xF000, v
)) ++ok
; else ++wrong
;
181 if (branch(15, 0xF000, v
)) ++ok
; else ++wrong
;
183 if (wrong
!= 0 || ok
!= 16)
190 tmll_some_selected_bits_set_msb_not_set(void)
195 printf("Test #6 mask == 0xF000, value == 0x3000 --> cc == 1\n");
200 if (branch(0, 0xF000, v
)) ++wrong
; else ++ok
;
201 if (branch(1, 0xF000, v
)) ++wrong
; else ++ok
;
202 if (branch(2, 0xF000, v
)) ++wrong
; else ++ok
;
203 if (branch(3, 0xF000, v
)) ++wrong
; else ++ok
;
204 if (branch(4, 0xF000, v
)) ++ok
; else ++wrong
;
205 if (branch(5, 0xF000, v
)) ++ok
; else ++wrong
;
206 if (branch(6, 0xF000, v
)) ++ok
; else ++wrong
;
207 if (branch(7, 0xF000, v
)) ++ok
; else ++wrong
;
208 if (branch(8, 0xF000, v
)) ++wrong
; else ++ok
;
209 if (branch(9, 0xF000, v
)) ++wrong
; else ++ok
;
210 if (branch(10, 0xF000, v
)) ++wrong
; else ++ok
;
211 if (branch(11, 0xF000, v
)) ++wrong
; else ++ok
;
212 if (branch(12, 0xF000, v
)) ++ok
; else ++wrong
;
213 if (branch(13, 0xF000, v
)) ++ok
; else ++wrong
;
214 if (branch(14, 0xF000, v
)) ++ok
; else ++wrong
;
215 if (branch(15, 0xF000, v
)) ++ok
; else ++wrong
;
217 if (wrong
!= 0 || ok
!= 16)
228 tmll_all_selected_bits_set_1();
229 tmll_all_selected_bits_set_2();
230 tmll_some_selected_bits_set_msb_set();
231 tmll_some_selected_bits_set_msb_not_set();