xref: /llvm-project/llvm/test/CodeGen/X86/lea-3.ll (revision c22dc71b120b066c0066b8517014149a001cc2b0)
1; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2; RUN: llc < %s -mtriple=x86_64-linux        | FileCheck %s
3; RUN: llc < %s -mtriple=x86_64-linux-gnux32 | FileCheck %s
4; RUN: llc < %s -mtriple=x86_64-nacl         | FileCheck %s
5; RUN: llc < %s -mtriple=x86_64-win32        | FileCheck %s --check-prefix=WIN32
6
7define i64 @test2(i64 %a) {
8; CHECK-LABEL: test2:
9; CHECK:       # %bb.0:
10; CHECK-NEXT:    leaq (,%rdi,4), %rax
11; CHECK-NEXT:    orq %rdi, %rax
12; CHECK-NEXT:    retq
13;
14; WIN32-LABEL: test2:
15; WIN32:       # %bb.0:
16; WIN32-NEXT:    leaq (,%rcx,4), %rax
17; WIN32-NEXT:    orq %rcx, %rax
18; WIN32-NEXT:    retq
19  %tmp2 = shl i64 %a, 2
20	%tmp3 = or i64 %tmp2, %a
21  ret i64 %tmp3
22}
23
24define i32 @test(i32 %a) {
25; CHECK-LABEL: test:
26; CHECK:       # %bb.0:
27; CHECK-NEXT:    # kill: def $edi killed $edi def $rdi
28; CHECK-NEXT:    leal (%rdi,%rdi,2), %eax
29; CHECK-NEXT:    retq
30;
31; WIN32-LABEL: test:
32; WIN32:       # %bb.0:
33; WIN32-NEXT:    # kill: def $ecx killed $ecx def $rcx
34; WIN32-NEXT:    leal (%rcx,%rcx,2), %eax
35; WIN32-NEXT:    retq
36  %tmp2 = mul i32 %a, 3
37  ret i32 %tmp2
38}
39
40define i64 @test3(i64 %a) {
41; CHECK-LABEL: test3:
42; CHECK:       # %bb.0:
43; CHECK-NEXT:    leaq (,%rdi,8), %rax
44; CHECK-NEXT:    retq
45;
46; WIN32-LABEL: test3:
47; WIN32:       # %bb.0:
48; WIN32-NEXT:    leaq (,%rcx,8), %rax
49; WIN32-NEXT:    retq
50  %tmp2 = shl i64 %a, 3
51  ret i64 %tmp2
52}
53
54