OLD | NEW |
---|---|
1 ; Test encoding of MIPS32 instructions used in intrinsic calls | 1 ; Test encoding of MIPS32 instructions used in intrinsic calls |
2 | 2 |
3 ; REQUIRES: allow_dump | 3 ; REQUIRES: allow_dump |
4 | 4 |
5 ; Compile using standalone assembler. | 5 ; Compile using standalone assembler. |
6 ; RUN: %p2i --filetype=asm -i %s --target=mips32 --args -O2 \ | 6 ; RUN: %p2i --filetype=asm -i %s --target=mips32 --args -O2 \ |
7 ; RUN: --allow-externally-defined-symbols --skip-unimplemented \ | 7 ; RUN: --allow-externally-defined-symbols --skip-unimplemented \ |
8 ; RUN: | FileCheck %s --check-prefix=ASM | 8 ; RUN: | FileCheck %s --check-prefix=ASM |
9 | 9 |
10 ; Show bytes in assembled standalone code. | 10 ; Show bytes in assembled standalone code. |
11 ; RUN: %p2i --filetype=asm -i %s --target=mips32 --assemble --disassemble \ | 11 ; RUN: %p2i --filetype=asm -i %s --target=mips32 --assemble --disassemble \ |
12 ; RUN: --args -O2 --allow-externally-defined-symbols --skip-unimplemented \ | 12 ; RUN: --args -O2 --allow-externally-defined-symbols --skip-unimplemented \ |
13 ; RUN: | FileCheck %s --check-prefix=DIS | 13 ; RUN: | FileCheck %s --check-prefix=DIS |
14 | 14 |
15 ; Compile using integrated assembler. | 15 ; Compile using integrated assembler. |
16 ; RUN: %p2i --filetype=iasm -i %s --target=mips32 --args -O2 \ | 16 ; RUN: %p2i --filetype=iasm -i %s --target=mips32 --args -O2 \ |
17 ; RUN: --allow-externally-defined-symbols --skip-unimplemented \ | 17 ; RUN: --allow-externally-defined-symbols --skip-unimplemented \ |
18 ; RUN: | FileCheck %s --check-prefix=IASM | 18 ; RUN: | FileCheck %s --check-prefix=IASM |
19 | 19 |
20 ; Show bytes in assembled integrated code. | 20 ; Show bytes in assembled integrated code. |
21 ; RUN: %p2i --filetype=iasm -i %s --target=mips32 --assemble --disassemble \ | 21 ; RUN: %p2i --filetype=iasm -i %s --target=mips32 --assemble --disassemble \ |
22 ; RUN: --args -O2 --allow-externally-defined-symbols --skip-unimplemented \ | 22 ; RUN: --args -O2 --allow-externally-defined-symbols --skip-unimplemented \ |
23 ; RUN: | FileCheck %s --check-prefix=DIS | 23 ; RUN: | FileCheck %s --check-prefix=DIS |
24 | 24 |
25 declare i32 @llvm.ctlz.i32(i32, i1) | 25 declare i32 @llvm.ctlz.i32(i32, i1) |
26 declare i64 @llvm.ctlz.i64(i64, i1) | |
26 declare i32 @llvm.cttz.i32(i32, i1) | 27 declare i32 @llvm.cttz.i32(i32, i1) |
28 declare i64 @llvm.cttz.i64(i64, i1) | |
27 declare void @llvm.trap() | 29 declare void @llvm.trap() |
28 | 30 |
29 define internal i32 @encCtlz32(i32 %x) { | 31 define internal i32 @encCtlz32(i32 %x) { |
30 entry: | 32 entry: |
31 %r = call i32 @llvm.ctlz.i32(i32 %x, i1 false) | 33 %r = call i32 @llvm.ctlz.i32(i32 %x, i1 false) |
32 ret i32 %r | 34 ret i32 %r |
33 } | 35 } |
34 | 36 |
35 ; ASM-LABEL: encCtlz32 | 37 ; ASM-LABEL: encCtlz32 |
36 ; ASM-NEXT: .LencCtlz32$entry: | 38 ; ASM-NEXT: .LencCtlz32$entry: |
37 ; ASM-NEXT: clz $a0, $a0 | 39 ; ASM-NEXT: clz $a0, $a0 |
38 ; ASM-NEXT: move $v0, $a0 | 40 ; ASM-NEXT: move $v0, $a0 |
39 ; ASM-NEXT: jr $ra | 41 ; ASM-NEXT: jr $ra |
40 | 42 |
41 ; DIS-LABEL: 00000000 <encCtlz32>: | 43 ; DIS-LABEL: {{.*}} <encCtlz32>: |
Jim Stichnoth
2016/09/27 03:58:07
In the future, these patterns could be simplified
| |
42 ; DIS-NEXT: 0:» 70842020 » clz» a0,a0 | 44 ; DIS-NEXT: {{.*}} 70842020 » clz» a0,a0 |
43 ; DIS-NEXT: 4:» 00801021 » move» v0,a0 | 45 ; DIS-NEXT: {{.*}} 00801021 » move» v0,a0 |
44 ; DIS-NEXT: 8:» 03e00008 » jr» ra | 46 ; DIS-NEXT: {{.*}} 03e00008 » jr» ra |
45 | 47 |
46 ; IASM-LABEL: encCtlz32 | 48 ; IASM-LABEL: encCtlz32 |
47 ; IASM-NEXT: .LencCtlz32$entry: | 49 ; IASM-NEXT: .LencCtlz32$entry: |
48 ; IASM-NEXT: .byte 0x20 | 50 ; IASM-NEXT: .byte 0x20 |
49 ; IASM-NEXT: .byte 0x20 | 51 ; IASM-NEXT: .byte 0x20 |
50 ; IASM-NEXT: .byte 0x84 | 52 ; IASM-NEXT: .byte 0x84 |
51 ; IASM-NEXT: .byte 0x70 | 53 ; IASM-NEXT: .byte 0x70 |
52 ; IASM-NEXT: .byte 0x21 | 54 ; IASM-NEXT: .byte 0x21 |
53 ; IASM-NEXT: .byte 0x10 | 55 ; IASM-NEXT: .byte 0x10 |
54 ; IASM-NEXT: .byte 0x80 | 56 ; IASM-NEXT: .byte 0x80 |
55 ; IASM-NEXT: .byte 0x0 | 57 ; IASM-NEXT: .byte 0x0 |
56 ; IASM-NEXT: .byte 0x8 | 58 ; IASM-NEXT: .byte 0x8 |
57 ; IASM-NEXT: .byte 0x0 | 59 ; IASM-NEXT: .byte 0x0 |
58 ; IASM-NEXT: .byte 0xe0 | 60 ; IASM-NEXT: .byte 0xe0 |
59 ; IASM-NEXT: .byte 0x3 | 61 ; IASM-NEXT: .byte 0x3 |
60 | 62 |
63 define internal i32 @encCtlz32Const() { | |
64 entry: | |
65 %r = call i32 @llvm.ctlz.i32(i32 123456, i1 false) | |
66 ret i32 %r | |
67 } | |
68 | |
69 ; ASM-LABEL: encCtlz32Const | |
70 ; ASM-NEXT: .LencCtlz32Const$entry: | |
71 ; ASM-NEXT: lui $v0, 1 | |
72 ; ASM-NEXT: ori $v0, $v0, 57920 | |
73 ; ASM-NEXT: clz $v0, $v0 | |
74 ; ASM-NEXT: jr $ra | |
75 | |
76 ; DIS-LABEL: {{.*}} <encCtlz32Const>: | |
77 ; DIS-NEXT: {{.*}} 3c020001 lui v0,0x1 | |
78 ; DIS-NEXT: {{.*}} 3442e240 ori v0,v0,0xe240 | |
79 ; DIS-NEXT: {{.*}} 70421020 clz v0,v0 | |
80 ; DIS-NEXT: {{.*}} 03e00008 jr ra | |
81 | |
82 ; IASM-LABEL: encCtlz32Const | |
83 ; IASM-NEXT: .LencCtlz32Const$entry: | |
84 ; IASM-NEXT: .byte 0x1 | |
85 ; IASM-NEXT: .byte 0x0 | |
86 ; IASM-NEXT: .byte 0x2 | |
87 ; IASM-NEXT: .byte 0x3c | |
88 ; IASM-NEXT: .byte 0x40 | |
89 ; IASM-NEXT: .byte 0xe2 | |
90 ; IASM-NEXT: .byte 0x42 | |
91 ; IASM-NEXT: .byte 0x34 | |
92 ; IASM-NEXT: .byte 0x20 | |
93 ; IASM-NEXT: .byte 0x10 | |
94 ; IASM-NEXT: .byte 0x42 | |
95 ; IASM-NEXT: .byte 0x70 | |
96 ; IASM-NEXT: .byte 0x8 | |
97 ; IASM-NEXT: .byte 0x0 | |
98 ; IASM-NEXT: .byte 0xe0 | |
99 ; IASM-NEXT: .byte 0x3 | |
100 | |
101 define internal i64 @encCtlz64(i64 %x) { | |
102 entry: | |
103 %r = call i64 @llvm.ctlz.i64(i64 %x, i1 false) | |
104 ret i64 %r | |
105 } | |
106 | |
107 ; ASM-LABEL: encCtlz64 | |
108 ; ASM-NEXT: .LencCtlz64$entry: | |
109 ; ASM-NEXT: clz $v0, $a1 | |
110 ; ASM-NEXT: clz $a0, $a0 | |
111 ; ASM-NEXT: addiu $a0, $a0, 32 | |
112 ; ASM-NEXT: movn $a0, $v0, $a1 | |
113 ; ASM-NEXT: addiu $v0, $zero, 0 | |
114 ; ASM-NEXT: move $v1, $v0 | |
115 ; ASM-NEXT: move $v0, $a0 | |
116 ; ASM-NEXT: jr $ra | |
117 | |
118 ; DIS-LABEL: {{.*}} <encCtlz64>: | |
119 ; DIS-NEXT: {{.*}} 70a21020 clz v0,a1 | |
120 ; DIS-NEXT: {{.*}} 70842020 clz a0,a0 | |
121 ; DIS-NEXT: {{.*}} 24840020 addiu a0,a0,32 | |
122 ; DIS-NEXT: {{.*}} {{.*}}0b movn {{.*}} | |
123 ; DIS-NEXT: {{.*}} 24020000 li v0,0 | |
124 ; DIS-NEXT: {{.*}} 00401821 move v1,v0 | |
125 ; DIS-NEXT: {{.*}} 00801021 move v0,a0 | |
126 ; DIS-NEXT: {{.*}} 03e00008 jr ra | |
127 | |
128 ; IASM-LABEL: encCtlz64 | |
129 ; IASM-NEXT: .LencCtlz64$entry: | |
130 ; IASM-NEXT: .byte 0x20 | |
131 ; IASM-NEXT: .byte 0x10 | |
132 ; IASM-NEXT: .byte 0xa2 | |
133 ; IASM-NEXT: .byte 0x70 | |
134 ; IASM-NEXT: .byte 0x20 | |
135 ; IASM-NEXT: .byte 0x20 | |
136 ; IASM-NEXT: .byte 0x84 | |
137 ; IASM-NEXT: .byte 0x70 | |
138 ; IASM-NEXT: .byte 0x20 | |
139 ; IASM-NEXT: .byte 0x0 | |
140 ; IASM-NEXT: .byte 0x84 | |
141 ; IASM-NEXT: .byte 0x24 | |
142 ; IASM-NEXT: .byte 0xb | |
143 ; IASM-NEXT: .byte 0x20 | |
144 ; IASM-NEXT: .byte 0x82 | |
145 ; IASM-NEXT: .byte 0x0 | |
146 ; IASM-NEXT: .byte 0x0 | |
147 ; IASM-NEXT: .byte 0x0 | |
148 ; IASM-NEXT: .byte 0x2 | |
149 ; IASM-NEXT: .byte 0x24 | |
150 ; IASM-NEXT: .byte 0x21 | |
151 ; IASM-NEXT: .byte 0x18 | |
152 ; IASM-NEXT: .byte 0x40 | |
153 ; IASM-NEXT: .byte 0x0 | |
154 ; IASM-NEXT: .byte 0x21 | |
155 ; IASM-NEXT: .byte 0x10 | |
156 ; IASM-NEXT: .byte 0x80 | |
157 ; IASM-NEXT: .byte 0x0 | |
158 ; IASM-NEXT: .byte 0x8 | |
159 ; IASM-NEXT: .byte 0x0 | |
160 ; IASM-NEXT: .byte 0xe0 | |
161 ; IASM-NEXT: .byte 0x3 | |
162 | |
163 define internal i32 @encCtlz64Const(i64 %x) { | |
164 entry: | |
165 %r = call i64 @llvm.ctlz.i64(i64 123456789012, i1 false) | |
166 %r2 = trunc i64 %r to i32 | |
167 ret i32 %r2 | |
168 } | |
169 | |
170 ; ASM-LABEL: encCtlz64Const | |
171 ; ASM-NEXT: .LencCtlz64Const$entry: | |
172 ; ASM-NEXT: # $zero = def.pseudo | |
173 ; ASM-NEXT: addiu $v0, $zero, 28 | |
174 ; ASM-NEXT: lui $v1, 48793 | |
175 ; ASM-NEXT: ori $v1, $v1, 6676 | |
176 ; ASM-NEXT: clz $a0, $v0 | |
177 ; ASM-NEXT: clz $v1, $v1 | |
178 ; ASM-NEXT: addiu $v1, $v1, 32 | |
179 ; ASM-NEXT: movn $v1, $a0, $v0 | |
180 ; ASM-NEXT: move $v0, $v1 | |
181 ; ASM-NEXT: jr $ra | |
182 | |
183 ; DIS-LABEL: {{.*}} <encCtlz64Const>: | |
184 ; DIS-NEXT: {{.*}} 2402001c li v0,28 | |
185 ; DIS-NEXT: {{.*}} 3c03be99 lui v1,0xbe99 | |
186 ; DIS-NEXT: {{.*}} 34631a14 ori v1,v1,0x1a14 | |
187 ; DIS-NEXT: {{.*}} 70442020 clz a0,v0 | |
188 ; DIS-NEXT: {{.*}} 70631820 clz v1,v1 | |
189 ; DIS-NEXT: {{.*}} 24630020 addiu v1,v1,32 | |
190 ; DIS-NEXT: {{.*}} {{.*}}0b movn {{.*}} | |
191 ; DIS-NEXT: {{.*}} 00601021 move v0,v1 | |
192 ; DIS-NEXT: {{.*}} 03e00008 jr ra | |
193 | |
194 ; IASM-LABEL: encCtlz64Const | |
195 ; IASM-NEXT: .LencCtlz64Const$entry: | |
196 ; IASM-NEXT: .byte 0x1c | |
197 ; IASM-NEXT: .byte 0x0 | |
198 ; IASM-NEXT: .byte 0x2 | |
199 ; IASM-NEXT: .byte 0x24 | |
200 ; IASM-NEXT: .byte 0x99 | |
201 ; IASM-NEXT: .byte 0xbe | |
202 ; IASM-NEXT: .byte 0x3 | |
203 ; IASM-NEXT: .byte 0x3c | |
204 ; IASM-NEXT: .byte 0x14 | |
205 ; IASM-NEXT: .byte 0x1a | |
206 ; IASM-NEXT: .byte 0x63 | |
207 ; IASM-NEXT: .byte 0x34 | |
208 ; IASM-NEXT: .byte 0x20 | |
209 ; IASM-NEXT: .byte 0x20 | |
210 ; IASM-NEXT: .byte 0x44 | |
211 ; IASM-NEXT: .byte 0x70 | |
212 ; IASM-NEXT: .byte 0x20 | |
213 ; IASM-NEXT: .byte 0x18 | |
214 ; IASM-NEXT: .byte 0x63 | |
215 ; IASM-NEXT: .byte 0x70 | |
216 ; IASM-NEXT: .byte 0x20 | |
217 ; IASM-NEXT: .byte 0x0 | |
218 ; IASM-NEXT: .byte 0x63 | |
219 ; IASM-NEXT: .byte 0x24 | |
220 ; IASM-NEXT: .byte 0xb | |
221 ; IASM-NEXT: .byte 0x18 | |
222 ; IASM-NEXT: .byte 0x64 | |
223 ; IASM-NEXT: .byte 0x0 | |
224 ; IASM-NEXT: .byte 0x21 | |
225 ; IASM-NEXT: .byte 0x10 | |
226 ; IASM-NEXT: .byte 0x60 | |
227 ; IASM-NEXT: .byte 0x0 | |
228 ; IASM-NEXT: .byte 0x8 | |
229 ; IASM-NEXT: .byte 0x0 | |
230 ; IASM-NEXT: .byte 0xe0 | |
231 ; IASM-NEXT: .byte 0x3 | |
232 | |
61 define internal i32 @encCttz32(i32 %x) { | 233 define internal i32 @encCttz32(i32 %x) { |
62 entry: | 234 entry: |
63 %r = call i32 @llvm.cttz.i32(i32 %x, i1 false) | 235 %r = call i32 @llvm.cttz.i32(i32 %x, i1 false) |
64 ret i32 %r | 236 ret i32 %r |
65 } | 237 } |
66 | 238 |
67 ; ASM-LABEL: encCttz32 | 239 ; ASM-LABEL: encCttz32 |
68 ; ASM-NEXT: .LencCttz32$entry: | 240 ; ASM-NEXT: .LencCttz32$entry: |
69 ; ASM-NEXT: addiu $v0, $a0, -1 | 241 ; ASM-NEXT: addiu $v0, $a0, -1 |
70 ; ASM-NEXT: nor $a0, $a0, $zero | 242 ; ASM-NEXT: nor $a0, $a0, $zero |
71 ; ASM-NEXT: and $a0, $a0, $v0 | 243 ; ASM-NEXT: and $a0, $a0, $v0 |
72 ; ASM-NEXT: clz $a0, $a0 | 244 ; ASM-NEXT: clz $a0, $a0 |
73 ; ASM-NEXT: addiu $v0, $zero, 32 | 245 ; ASM-NEXT: addiu $v0, $zero, 32 |
74 ; ASM-NEXT: subu $v0, $v0, $a0 | 246 ; ASM-NEXT: subu $v0, $v0, $a0 |
75 ; ASM-NEXT: jr $ra | 247 ; ASM-NEXT: jr $ra |
76 | 248 |
77 ; DIS-LABEL: 00000010 <encCttz32>: | 249 ; DIS-LABEL: {{.*}} <encCttz32>: |
78 ; DIS-NEXT: 10:» 2482ffff » addiu» v0,a0,-1 | 250 ; DIS-NEXT: {{.*}} 2482ffff » addiu» v0,a0,-1 |
79 ; DIS-NEXT: 14:» 00802027 » nor» a0,a0,zero | 251 ; DIS-NEXT: {{.*}} 00802027 » nor» a0,a0,zero |
80 ; DIS-NEXT: 18:» 00822024 » and» a0,a0,v0 | 252 ; DIS-NEXT: {{.*}} 00822024 » and» a0,a0,v0 |
81 ; DIS-NEXT: 1c:» 70842020 » clz» a0,a0 | 253 ; DIS-NEXT: {{.*}} 70842020 » clz» a0,a0 |
82 ; DIS-NEXT: 20:» 24020020 » li» v0,32 | 254 ; DIS-NEXT: {{.*}} 24020020 » li» v0,32 |
83 ; DIS-NEXT: 24:» 00441023 » subu» v0,v0,a0 | 255 ; DIS-NEXT: {{.*}} 00441023 » subu» v0,v0,a0 |
84 ; DIS-NEXT: 28:» 03e00008 » jr» ra | 256 ; DIS-NEXT: {{.*}} 03e00008 » jr» ra |
85 | 257 |
86 ; IASM-LABEL: encCttz32 | 258 ; IASM-LABEL: encCttz32 |
87 ; IASM-NEXT: .LencCttz32$entry: | 259 ; IASM-NEXT: .LencCttz32$entry: |
88 ; IASM-NEXT: .byte 0xff | 260 ; IASM-NEXT: .byte 0xff |
89 ; IASM-NEXT: .byte 0xff | 261 ; IASM-NEXT: .byte 0xff |
90 ; IASM-NEXT: .byte 0x82 | 262 ; IASM-NEXT: .byte 0x82 |
91 ; IASM-NEXT: .byte 0x24 | 263 ; IASM-NEXT: .byte 0x24 |
92 ; IASM-NEXT: .byte 0x27 | 264 ; IASM-NEXT: .byte 0x27 |
93 ; IASM-NEXT: .byte 0x20 | 265 ; IASM-NEXT: .byte 0x20 |
94 ; IASM-NEXT: .byte 0x80 | 266 ; IASM-NEXT: .byte 0x80 |
(...skipping 12 matching lines...) Expand all Loading... | |
107 ; IASM-NEXT: .byte 0x24 | 279 ; IASM-NEXT: .byte 0x24 |
108 ; IASM-NEXT: .byte 0x23 | 280 ; IASM-NEXT: .byte 0x23 |
109 ; IASM-NEXT: .byte 0x10 | 281 ; IASM-NEXT: .byte 0x10 |
110 ; IASM-NEXT: .byte 0x44 | 282 ; IASM-NEXT: .byte 0x44 |
111 ; IASM-NEXT: .byte 0x0 | 283 ; IASM-NEXT: .byte 0x0 |
112 ; IASM-NEXT: .byte 0x8 | 284 ; IASM-NEXT: .byte 0x8 |
113 ; IASM-NEXT: .byte 0x0 | 285 ; IASM-NEXT: .byte 0x0 |
114 ; IASM-NEXT: .byte 0xe0 | 286 ; IASM-NEXT: .byte 0xe0 |
115 ; IASM-NEXT: .byte 0x3 | 287 ; IASM-NEXT: .byte 0x3 |
116 | 288 |
289 define internal i32 @encCttz32Const() { | |
290 entry: | |
291 %r = call i32 @llvm.cttz.i32(i32 123456, i1 false) | |
292 ret i32 %r | |
293 } | |
294 | |
295 ; ASM-LABEL: encCttz32Const | |
296 ; ASM-NEXT: .LencCttz32Const$entry: | |
297 ; ASM-NEXT: lui $v0, 1 | |
298 ; ASM-NEXT: ori $v0, $v0, 57920 | |
299 ; ASM-NEXT: addiu $v1, $v0, -1 | |
300 ; ASM-NEXT: nor $v0, $v0, $zero | |
301 ; ASM-NEXT: and $v0, $v0, $v1 | |
302 ; ASM-NEXT: clz $v0, $v0 | |
303 ; ASM-NEXT: addiu $v1, $zero, 32 | |
304 ; ASM-NEXT: subu $v1, $v1, $v0 | |
305 ; ASM-NEXT: move $v0, $v1 | |
306 ; ASM-NEXT: jr $ra | |
307 | |
308 ; DIS-LABEL: {{.*}} <encCttz32Const>: | |
309 ; DIS-NEXT: {{.*}} 3c020001 lui v0,0x1 | |
310 ; DIS-NEXT: {{.*}} ori v0,v0,0xe240 | |
311 ; DIS-NEXT: {{.*}} addiu v1,v0,-1 | |
312 ; DIS-NEXT: {{.*}} nor v0,v0,zero | |
313 ; DIS-NEXT: {{.*}} and v0,v0,v1 | |
314 ; DIS-NEXT: {{.*}} clz v0,v0 | |
315 ; DIS-NEXT: {{.*}} li v1,32 | |
316 ; DIS-NEXT: {{.*}} subu v1,v1,v0 | |
317 ; DIS-NEXT: {{.*}} move v0,v1 | |
318 ; DIS-NEXT: {{.*}} jr ra | |
319 | |
320 ; IASM-LABEL: encCttz32Const: | |
321 ; IASM-NEXT: .LencCttz32Const$entry: | |
322 ; IASM-NEXT: .byte 0x1 | |
323 ; IASM-NEXT: .byte 0x0 | |
324 ; IASM-NEXT: .byte 0x2 | |
325 ; IASM-NEXT: .byte 0x3c | |
326 ; IASM-NEXT: .byte 0x40 | |
327 ; IASM-NEXT: .byte 0xe2 | |
328 ; IASM-NEXT: .byte 0x42 | |
329 ; IASM-NEXT: .byte 0x34 | |
330 ; IASM-NEXT: .byte 0xff | |
331 ; IASM-NEXT: .byte 0xff | |
332 ; IASM-NEXT: .byte 0x43 | |
333 ; IASM-NEXT: .byte 0x24 | |
334 ; IASM-NEXT: .byte 0x27 | |
335 ; IASM-NEXT: .byte 0x10 | |
336 ; IASM-NEXT: .byte 0x40 | |
337 ; IASM-NEXT: .byte 0x0 | |
338 ; IASM-NEXT: .byte 0x24 | |
339 ; IASM-NEXT: .byte 0x10 | |
340 ; IASM-NEXT: .byte 0x43 | |
341 ; IASM-NEXT: .byte 0x0 | |
342 ; IASM-NEXT: .byte 0x20 | |
343 ; IASM-NEXT: .byte 0x10 | |
344 ; IASM-NEXT: .byte 0x42 | |
345 ; IASM-NEXT: .byte 0x70 | |
346 ; IASM-NEXT: .byte 0x20 | |
347 ; IASM-NEXT: .byte 0x0 | |
348 ; IASM-NEXT: .byte 0x3 | |
349 ; IASM-NEXT: .byte 0x24 | |
350 ; IASM-NEXT: .byte 0x23 | |
351 ; IASM-NEXT: .byte 0x18 | |
352 ; IASM-NEXT: .byte 0x62 | |
353 ; IASM-NEXT: .byte 0x0 | |
354 ; IASM-NEXT: .byte 0x21 | |
355 ; IASM-NEXT: .byte 0x10 | |
356 ; IASM-NEXT: .byte 0x60 | |
357 ; IASM-NEXT: .byte 0x0 | |
358 ; IASM-NEXT: .byte 0x8 | |
359 ; IASM-NEXT: .byte 0x0 | |
360 ; IASM-NEXT: .byte 0xe0 | |
361 ; IASM-NEXT: .byte 0x3 | |
362 | |
363 define internal i64 @encCttz64(i64 %x) { | |
364 entry: | |
365 %r = call i64 @llvm.cttz.i64(i64 %x, i1 false) | |
366 ret i64 %r | |
367 } | |
368 | |
369 ; ASM-LABEL: encCttz64 | |
370 ; ASM-NEXT: .LencCttz64$entry: | |
371 ; ASM-NEXT: addiu $v0, $a1, -1 | |
372 ; ASM-NEXT: nor $a1, $a1, $zero | |
373 ; ASM-NEXT: and $a1, $a1, $v0 | |
374 ; ASM-NEXT: clz $a1, $a1 | |
375 ; ASM-NEXT: addiu $v0, $zero, 64 | |
376 ; ASM-NEXT: subu $v0, $v0, $a1 | |
377 ; ASM-NEXT: addiu $v1, $a0, -1 | |
378 ; ASM-NEXT: nor $a1, $a0, $zero | |
379 ; ASM-NEXT: and $a1, $a1, $v1 | |
380 ; ASM-NEXT: clz $a1, $a1 | |
381 ; ASM-NEXT: addiu $v1, $zero, 32 | |
382 ; ASM-NEXT: subu $v1, $v1, $a1 | |
383 ; ASM-NEXT: movn $v0, $v1, $a0 | |
384 ; ASM-NEXT: addiu $v1, $zero, 0 | |
385 ; ASM-NEXT: jr $ra | |
386 | |
387 ; DIS-LABEL: {{.*}} <encCttz64>: | |
388 ; DIS-NEXT: {{.*}} 24a2ffff addiu v0,a1,-1 | |
389 ; DIS-NEXT: {{.*}} 00a02827 nor a1,a1,zero | |
390 ; DIS-NEXT: {{.*}} 00a22824 and a1,a1,v0 | |
391 ; DIS-NEXT: {{.*}} 70a52820 clz a1,a1 | |
392 ; DIS-NEXT: {{.*}} 24020040 li v0,64 | |
393 ; DIS-NEXT: {{.*}} 00451023 subu v0,v0,a1 | |
394 ; DIS-NEXT: {{.*}} 2483ffff addiu v1,a0,-1 | |
395 ; DIS-NEXT: {{.*}} 00802827 nor a1,a0,zero | |
396 ; DIS-NEXT: {{.*}} 00a32824 and a1,a1,v1 | |
397 ; DIS-NEXT: {{.*}} 70a52820 clz a1,a1 | |
398 ; DIS-NEXT: {{.*}} 24030020 li v1,32 | |
399 ; DIS-NEXT: {{.*}} 00651823 subu v1,v1,a1 | |
400 ; DIS-NEXT: {{.*}} {{.*}}0b movn {{.*}} | |
401 ; DIS-NEXT: {{.*}} 24030000 li v1,0 | |
402 ; DIS-NEXT: {{.*}} 03e00008 jr ra | |
403 | |
404 ; IASM-LABEL: encCttz64: | |
405 ; IASM-NEXT: .LencCttz64$entry: | |
406 ; IASM-NEXT: .byte 0xff | |
407 ; IASM-NEXT: .byte 0xff | |
408 ; IASM-NEXT: .byte 0xa2 | |
409 ; IASM-NEXT: .byte 0x24 | |
410 ; IASM-NEXT: .byte 0x27 | |
411 ; IASM-NEXT: .byte 0x28 | |
412 ; IASM-NEXT: .byte 0xa0 | |
413 ; IASM-NEXT: .byte 0x0 | |
414 ; IASM-NEXT: .byte 0x24 | |
415 ; IASM-NEXT: .byte 0x28 | |
416 ; IASM-NEXT: .byte 0xa2 | |
417 ; IASM-NEXT: .byte 0x0 | |
418 ; IASM-NEXT: .byte 0x20 | |
419 ; IASM-NEXT: .byte 0x28 | |
420 ; IASM-NEXT: .byte 0xa5 | |
421 ; IASM-NEXT: .byte 0x70 | |
422 ; IASM-NEXT: .byte 0x40 | |
423 ; IASM-NEXT: .byte 0x0 | |
424 ; IASM-NEXT: .byte 0x2 | |
425 ; IASM-NEXT: .byte 0x24 | |
426 ; IASM-NEXT: .byte 0x23 | |
427 ; IASM-NEXT: .byte 0x10 | |
428 ; IASM-NEXT: .byte 0x45 | |
429 ; IASM-NEXT: .byte 0x0 | |
430 ; IASM-NEXT: .byte 0xff | |
431 ; IASM-NEXT: .byte 0xff | |
432 ; IASM-NEXT: .byte 0x83 | |
433 ; IASM-NEXT: .byte 0x24 | |
434 ; IASM-NEXT: .byte 0x27 | |
435 ; IASM-NEXT: .byte 0x28 | |
436 ; IASM-NEXT: .byte 0x80 | |
437 ; IASM-NEXT: .byte 0x0 | |
438 ; IASM-NEXT: .byte 0x24 | |
439 ; IASM-NEXT: .byte 0x28 | |
440 ; IASM-NEXT: .byte 0xa3 | |
441 ; IASM-NEXT: .byte 0x0 | |
442 ; IASM-NEXT: .byte 0x20 | |
443 ; IASM-NEXT: .byte 0x28 | |
444 ; IASM-NEXT: .byte 0xa5 | |
445 ; IASM-NEXT: .byte 0x70 | |
446 ; IASM-NEXT: .byte 0x20 | |
447 ; IASM-NEXT: .byte 0x0 | |
448 ; IASM-NEXT: .byte 0x3 | |
449 ; IASM-NEXT: .byte 0x24 | |
450 ; IASM-NEXT: .byte 0x23 | |
451 ; IASM-NEXT: .byte 0x18 | |
452 ; IASM-NEXT: .byte 0x65 | |
453 ; IASM-NEXT: .byte 0x0 | |
454 ; IASM-NEXT: .byte 0xb | |
455 ; IASM-NEXT: .byte 0x10 | |
456 ; IASM-NEXT: .byte 0x43 | |
457 ; IASM-NEXT: .byte 0x0 | |
458 ; IASM-NEXT: .byte 0x0 | |
459 ; IASM-NEXT: .byte 0x0 | |
460 ; IASM-NEXT: .byte 0x3 | |
461 ; IASM-NEXT: .byte 0x24 | |
462 ; IASM-NEXT: .byte 0x8 | |
463 ; IASM-NEXT: .byte 0x0 | |
464 ; IASM-NEXT: .byte 0xe0 | |
465 ; IASM-NEXT: .byte 0x3 | |
466 | |
467 define internal i64 @encCttz64Const(i64 %x) { | |
468 entry: | |
469 %r = call i64 @llvm.cttz.i64(i64 123456789012, i1 false) | |
470 ret i64 %r | |
471 } | |
472 | |
473 ; ASM-LABEL: encCttz64Const | |
474 ; ASM-NEXT: .LencCttz64Const$entry: | |
475 ; ASM-NEXT: # $zero = def.pseudo | |
476 ; ASM-NEXT: addiu $v0, $zero, 28 | |
477 ; ASM-NEXT: lui $v1, 48793 | |
478 ; ASM-NEXT: ori $v1, $v1, 6676 | |
479 ; ASM-NEXT: addiu $a0, $v0, -1 | |
480 ; ASM-NEXT: nor $v0, $v0, $zero | |
481 ; ASM-NEXT: and $v0, $v0, $a0 | |
482 ; ASM-NEXT: clz $v0, $v0 | |
483 ; ASM-NEXT: addiu $a0, $zero, 64 | |
484 ; ASM-NEXT: subu $a0, $a0, $v0 | |
485 ; ASM-NEXT: addiu $v0, $v1, -1 | |
486 ; ASM-NEXT: nor $a1, $v1, $zero | |
487 ; ASM-NEXT: and $a1, $a1, $v0 | |
488 ; ASM-NEXT: clz $a1, $a1 | |
489 ; ASM-NEXT: addiu $v0, $zero, 32 | |
490 ; ASM-NEXT: subu $v0, $v0, $a1 | |
491 ; ASM-NEXT: movn $a0, $v0, $v1 | |
492 ; ASM-NEXT: addiu $v0, $zero, 0 | |
493 ; ASM-NEXT: move $v1, $v0 | |
494 ; ASM-NEXT: move $v0, $a0 | |
495 ; ASM-NEXT: jr $ra | |
496 | |
497 ; DIS-LABEL: {{.*}} <encCttz64Const>: | |
498 ; DIS-NEXT: {{.*}} 2402001c li v0,28 | |
499 ; DIS-NEXT: {{.*}} 3c03be99 lui v1,0xbe99 | |
500 ; DIS-NEXT: {{.*}} 34631a14 ori v1,v1,0x1a14 | |
501 ; DIS-NEXT: {{.*}} 2444ffff addiu a0,v0,-1 | |
502 ; DIS-NEXT: {{.*}} 00401027 nor v0,v0,zero | |
503 ; DIS-NEXT: {{.*}} 00441024 and v0,v0,a0 | |
504 ; DIS-NEXT: {{.*}} 70421020 clz v0,v0 | |
505 ; DIS-NEXT: {{.*}} 24040040 li a0,64 | |
506 ; DIS-NEXT: {{.*}} 00822023 subu a0,a0,v0 | |
507 ; DIS-NEXT: {{.*}} 2462ffff addiu v0,v1,-1 | |
508 ; DIS-NEXT: {{.*}} 00602827 nor a1,v1,zero | |
509 ; DIS-NEXT: {{.*}} 00a22824 and a1,a1,v0 | |
510 ; DIS-NEXT: {{.*}} 70a52820 clz a1,a1 | |
511 ; DIS-NEXT: {{.*}} 24020020 li v0,32 | |
512 ; DIS-NEXT: {{.*}} 00451023 subu v0,v0,a1 | |
513 ; DIS-NEXT: {{.*}} {{.*}}0b movn {{.*}} | |
514 ; DIS-NEXT: {{.*}} 24{{.*}} li {{.*}},0 | |
515 ; DIS-NEXT: {{.*}} {{.*}}21 move v1,{{.*}} | |
516 ; DIS-NEXT: {{.*}} {{.*}}21 move v0,{{.*}} | |
517 ; DIS-NEXT: {{.*}} 03e00008 jr ra | |
518 | |
519 ; IASM-LABEL: encCttz64Const: | |
520 ; IASM-NEXT: .LencCttz64Const$entry: | |
521 ; IASM-NEXT: .byte 0x1c | |
522 ; IASM-NEXT: .byte 0x0 | |
523 ; IASM-NEXT: .byte 0x2 | |
524 ; IASM-NEXT: .byte 0x24 | |
525 ; IASM-NEXT: .byte 0x99 | |
526 ; IASM-NEXT: .byte 0xbe | |
527 ; IASM-NEXT: .byte 0x3 | |
528 ; IASM-NEXT: .byte 0x3c | |
529 ; IASM-NEXT: .byte 0x14 | |
530 ; IASM-NEXT: .byte 0x1a | |
531 ; IASM-NEXT: .byte 0x63 | |
532 ; IASM-NEXT: .byte 0x34 | |
533 ; IASM-NEXT: .byte 0xff | |
534 ; IASM-NEXT: .byte 0xff | |
535 ; IASM-NEXT: .byte 0x44 | |
536 ; IASM-NEXT: .byte 0x24 | |
537 ; IASM-NEXT: .byte 0x27 | |
538 ; IASM-NEXT: .byte 0x10 | |
539 ; IASM-NEXT: .byte 0x40 | |
540 ; IASM-NEXT: .byte 0x0 | |
541 ; IASM-NEXT: .byte 0x24 | |
542 ; IASM-NEXT: .byte 0x10 | |
543 ; IASM-NEXT: .byte 0x44 | |
544 ; IASM-NEXT: .byte 0x0 | |
545 ; IASM-NEXT: .byte 0x20 | |
546 ; IASM-NEXT: .byte 0x10 | |
547 ; IASM-NEXT: .byte 0x42 | |
548 ; IASM-NEXT: .byte 0x70 | |
549 ; IASM-NEXT: .byte 0x40 | |
550 ; IASM-NEXT: .byte 0x0 | |
551 ; IASM-NEXT: .byte 0x4 | |
552 ; IASM-NEXT: .byte 0x24 | |
553 ; IASM-NEXT: .byte 0x23 | |
554 ; IASM-NEXT: .byte 0x20 | |
555 ; IASM-NEXT: .byte 0x82 | |
556 ; IASM-NEXT: .byte 0x0 | |
557 ; IASM-NEXT: .byte 0xff | |
558 ; IASM-NEXT: .byte 0xff | |
559 ; IASM-NEXT: .byte 0x62 | |
560 ; IASM-NEXT: .byte 0x24 | |
561 ; IASM-NEXT: .byte 0x27 | |
562 ; IASM-NEXT: .byte 0x28 | |
563 ; IASM-NEXT: .byte 0x60 | |
564 ; IASM-NEXT: .byte 0x0 | |
565 ; IASM-NEXT: .byte 0x24 | |
566 ; IASM-NEXT: .byte 0x28 | |
567 ; IASM-NEXT: .byte 0xa2 | |
568 ; IASM-NEXT: .byte 0x0 | |
569 ; IASM-NEXT: .byte 0x20 | |
570 ; IASM-NEXT: .byte 0x28 | |
571 ; IASM-NEXT: .byte 0xa5 | |
572 ; IASM-NEXT: .byte 0x70 | |
573 ; IASM-NEXT: .byte 0x20 | |
574 ; IASM-NEXT: .byte 0x0 | |
575 ; IASM-NEXT: .byte 0x2 | |
576 ; IASM-NEXT: .byte 0x24 | |
577 ; IASM-NEXT: .byte 0x23 | |
578 ; IASM-NEXT: .byte 0x10 | |
579 ; IASM-NEXT: .byte 0x45 | |
580 ; IASM-NEXT: .byte 0x0 | |
581 ; IASM-NEXT: .byte 0xb | |
582 ; IASM-NEXT: .byte 0x20 | |
583 ; IASM-NEXT: .byte 0x82 | |
584 ; IASM-NEXT: .byte 0x0 | |
585 ; IASM-NEXT: .byte 0x0 | |
586 ; IASM-NEXT: .byte 0x0 | |
587 ; IASM-NEXT: .byte 0x2 | |
588 ; IASM-NEXT: .byte 0x24 | |
589 ; IASM-NEXT: .byte 0x21 | |
590 ; IASM-NEXT: .byte 0x18 | |
591 ; IASM-NEXT: .byte 0x40 | |
592 ; IASM-NEXT: .byte 0x0 | |
593 ; IASM-NEXT: .byte 0x21 | |
594 ; IASM-NEXT: .byte 0x10 | |
595 ; IASM-NEXT: .byte 0x80 | |
596 ; IASM-NEXT: .byte 0x0 | |
597 ; IASM-NEXT: .byte 0x8 | |
598 ; IASM-NEXT: .byte 0x0 | |
599 ; IASM-NEXT: .byte 0xe0 | |
600 ; IASM-NEXT: .byte 0x3 | |
601 | |
117 define internal void @encTrap() { | 602 define internal void @encTrap() { |
118 unreachable | 603 unreachable |
119 } | 604 } |
120 | 605 |
121 ; ASM-LABEL: encTrap | 606 ; ASM-LABEL: encTrap |
122 ; ASM-NEXT: .LencTrap$__0: | 607 ; ASM-NEXT: .LencTrap$__0: |
123 ; ASM-NEXT: teq $zero, $zero, 0 | 608 ; ASM-NEXT: teq $zero, $zero, 0 |
124 | 609 |
125 ; DIS-LABEL: 00000030 <encTrap>: | 610 ; DIS-LABEL: {{.*}} <encTrap>: |
126 ; DIS-NEXT: 30:» 00000034 » teq» zero,zero | 611 ; DIS-NEXT: {{.*}} 00000034 » teq» zero,zero |
127 | 612 |
128 ; IASM-LABEL: encTrap: | 613 ; IASM-LABEL: encTrap: |
129 ; IASM-NEXT: .LencTrap$__0: | 614 ; IASM-NEXT: .LencTrap$__0: |
130 ; IASM-NEXT: .byte 0x34 | 615 ; IASM-NEXT: .byte 0x34 |
131 ; IASM-NEXT: .byte 0x0 | 616 ; IASM-NEXT: .byte 0x0 |
132 ; IASM-NEXT: .byte 0x0 | 617 ; IASM-NEXT: .byte 0x0 |
133 ; IASM-NEXT: .byte 0x0 | 618 ; IASM-NEXT: .byte 0x0 |
OLD | NEW |