OLD | NEW |
1 ; Tests various aspects of x86 immediate encoding. Some encodings are shorter. | 1 ; Tests various aspects of x86 immediate encoding. Some encodings are shorter. |
2 ; For example, the encoding is shorter for 8-bit immediates or when using EAX. | 2 ; For example, the encoding is shorter for 8-bit immediates or when using EAX. |
3 ; This assumes that EAX is chosen as the first free register in O2 mode. | 3 ; This assumes that EAX is chosen as the first free register in O2 mode. |
4 | 4 |
5 ; RUN: %p2i --filetype=obj --disassemble -i %s --args -O2 | FileCheck %s | 5 ; RUN: %p2i --filetype=obj --disassemble -i %s --args -O2 | FileCheck %s |
6 | 6 |
7 define internal i32 @testXor8Imm8(i32 %arg) { | 7 define internal i32 @testXor8Imm8(i32 %arg) { |
8 entry: | 8 entry: |
9 %arg_i8 = trunc i32 %arg to i8 | 9 %arg_i8 = trunc i32 %arg to i8 |
10 %result_i8 = xor i8 %arg_i8, 127 | 10 %result_i8 = xor i8 %arg_i8, 127 |
(...skipping 273 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
284 ret i64 %shl | 284 ret i64 %shl |
285 } | 285 } |
286 ; CHECK-LABEL: test_via_shl64Bit | 286 ; CHECK-LABEL: test_via_shl64Bit |
287 ; CHECK: 0f a5 c2 shld edx,eax,cl | 287 ; CHECK: 0f a5 c2 shld edx,eax,cl |
288 ; CHECK: d3 e0 shl eax,cl | 288 ; CHECK: d3 e0 shl eax,cl |
289 ; CHECK: f6 c1 20 test cl,0x20 | 289 ; CHECK: f6 c1 20 test cl,0x20 |
290 | 290 |
291 ; Test a few register encodings of "test". | 291 ; Test a few register encodings of "test". |
292 declare i64 @llvm.ctlz.i64(i64, i1) | 292 declare i64 @llvm.ctlz.i64(i64, i1) |
293 | 293 |
294 define i64 @test_via_ctlz_64(i64 %x, i64 %y, i64 %z, i64 %w) { | 294 define internal i64 @test_via_ctlz_64(i64 %x, i64 %y, i64 %z, i64 %w) { |
295 entry: | 295 entry: |
296 %r = call i64 @llvm.ctlz.i64(i64 %x, i1 false) | 296 %r = call i64 @llvm.ctlz.i64(i64 %x, i1 false) |
297 %r2 = call i64 @llvm.ctlz.i64(i64 %y, i1 false) | 297 %r2 = call i64 @llvm.ctlz.i64(i64 %y, i1 false) |
298 %r3 = call i64 @llvm.ctlz.i64(i64 %z, i1 false) | 298 %r3 = call i64 @llvm.ctlz.i64(i64 %z, i1 false) |
299 %r4 = call i64 @llvm.ctlz.i64(i64 %w, i1 false) | 299 %r4 = call i64 @llvm.ctlz.i64(i64 %w, i1 false) |
300 %res1 = add i64 %r, %r2 | 300 %res1 = add i64 %r, %r2 |
301 %res2 = add i64 %r3, %r4 | 301 %res2 = add i64 %r3, %r4 |
302 %res = add i64 %res1, %res2 | 302 %res = add i64 %res1, %res2 |
303 ret i64 %res | 303 ret i64 %res |
304 } | 304 } |
305 ; CHECK-LABEL: test_via_ctlz_64 | 305 ; CHECK-LABEL: test_via_ctlz_64 |
306 ; CHECK-DAG: 85 c0 test eax,eax | 306 ; CHECK-DAG: 85 c0 test eax,eax |
307 ; CHECK-DAG: 85 db test ebx,ebx | 307 ; CHECK-DAG: 85 db test ebx,ebx |
308 ; CHECK-DAG: 85 f6 test esi,esi | 308 ; CHECK-DAG: 85 f6 test esi,esi |
OLD | NEW |