1; RUN: llc < %s -mtriple=x86_64-linux | FileCheck %s 2; RUN: llc < %s -mtriple=x86_64-win32 | FileCheck %s 3 4define i32 @test1(i32 %x) nounwind { 5 %tmp1 = shl i32 %x, 3 6 %tmp2 = add i32 %tmp1, 7 7 ret i32 %tmp2 8; CHECK: test1: 9; CHECK: leal 7(,[[A0:%rdi|%rcx]],8), %eax 10} 11 12 13; ISel the add of -4 with a neg and use an lea for the rest of the 14; arithemtic. 15define i32 @test2(i32 %x_offs) nounwind readnone { 16entry: 17 %t0 = icmp sgt i32 %x_offs, 4 18 br i1 %t0, label %bb.nph, label %bb2 19 20bb.nph: 21 %tmp = add i32 %x_offs, -5 22 %tmp6 = lshr i32 %tmp, 2 23 %tmp7 = mul i32 %tmp6, -4 24 %tmp8 = add i32 %tmp7, %x_offs 25 %tmp9 = add i32 %tmp8, -4 26 ret i32 %tmp9 27 28bb2: 29 ret i32 %x_offs 30; CHECK: test2: 31; CHECK: leal -5([[A0]]), %eax 32; CHECK: andl $-4, %eax 33; CHECK: negl %eax 34; CHECK: leal -4([[A0]],%rax), %eax 35} 36