1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc < %s -mtriple=x86_64-linux | FileCheck %s --check-prefixes=LINUX
3 ; RUN: llc < %s -mtriple=x86_64-win32 | FileCheck %s --check-prefixes=WIN
4 ; RUN: llc < %s -mtriple=x86_64-linux-gnux32 | FileCheck %s --check-prefixes=LINUX
5 ; RUN: llc < %s -mtriple=x86_64-nacl | FileCheck %s --check-prefixes=LINUX
7 define i32 @test1(i32 %x) nounwind {
10 ; LINUX-NEXT: # kill: def $edi killed $edi def $rdi
11 ; LINUX-NEXT: leal 7(,%rdi,8), %eax
16 ; WIN-NEXT: # kill: def $ecx killed $ecx def $rcx
17 ; WIN-NEXT: leal 7(,%rcx,8), %eax
20 %tmp2 = add i32 %tmp1, 7
25 ; ISel the add of -4 with a neg and use an lea for the rest of the
27 define i32 @test2(i32 %x_offs) nounwind readnone {
29 ; LINUX: # %bb.0: # %entry
30 ; LINUX-NEXT: # kill: def $edi killed $edi def $rdi
31 ; LINUX-NEXT: cmpl $5, %edi
32 ; LINUX-NEXT: jl .LBB1_2
33 ; LINUX-NEXT: # %bb.1: # %bb.nph
34 ; LINUX-NEXT: leal -5(%rdi), %eax
35 ; LINUX-NEXT: andl $-4, %eax
36 ; LINUX-NEXT: negl %eax
37 ; LINUX-NEXT: leal -4(%rdi,%rax), %eax
39 ; LINUX-NEXT: .LBB1_2: # %bb2
40 ; LINUX-NEXT: movl %edi, %eax
44 ; WIN: # %bb.0: # %entry
45 ; WIN-NEXT: # kill: def $ecx killed $ecx def $rcx
46 ; WIN-NEXT: cmpl $5, %ecx
47 ; WIN-NEXT: jl .LBB1_2
48 ; WIN-NEXT: # %bb.1: # %bb.nph
49 ; WIN-NEXT: leal -5(%rcx), %eax
50 ; WIN-NEXT: andl $-4, %eax
52 ; WIN-NEXT: leal -4(%rcx,%rax), %eax
54 ; WIN-NEXT: .LBB1_2: # %bb2
55 ; WIN-NEXT: movl %ecx, %eax
58 %t0 = icmp sgt i32 %x_offs, 4
59 br i1 %t0, label %bb.nph, label %bb2
62 %tmp = add i32 %x_offs, -5
63 %tmp6 = lshr i32 %tmp, 2
64 %tmp7 = mul i32 %tmp6, -4
65 %tmp8 = add i32 %tmp7, %x_offs
66 %tmp9 = add i32 %tmp8, -4