xref: /aosp_15_r20/external/llvm/test/CodeGen/X86/lea-2.ll (revision 9880d6810fe72a1726cb53787c6711e909410d58)
1*9880d681SAndroid Build Coastguard Worker; RUN: llc < %s -mtriple=i686-linux -x86-asm-syntax=intel | FileCheck %s
2*9880d681SAndroid Build Coastguard Worker; RUN: llc < %s -mtriple=x86_64-linux -x86-asm-syntax=intel | FileCheck %s
3*9880d681SAndroid Build Coastguard Worker; RUN: llc < %s -mtriple=x86_64-linux-gnux32 -x86-asm-syntax=intel | FileCheck %s
4*9880d681SAndroid Build Coastguard Worker; RUN: llc < %s -mtriple=x86_64-nacl -x86-asm-syntax=intel | FileCheck %s
5*9880d681SAndroid Build Coastguard Worker
6*9880d681SAndroid Build Coastguard Workerdefine i32 @test1(i32 %A, i32 %B) {
7*9880d681SAndroid Build Coastguard Worker  %tmp1 = shl i32 %A, 2
8*9880d681SAndroid Build Coastguard Worker  %tmp3 = add i32 %B, -5
9*9880d681SAndroid Build Coastguard Worker  %tmp4 = add i32 %tmp3, %tmp1
10*9880d681SAndroid Build Coastguard Worker; The above computation of %tmp4 should match a single lea, without using
11*9880d681SAndroid Build Coastguard Worker; actual add instructions.
12*9880d681SAndroid Build Coastguard Worker; CHECK-NOT: add
13*9880d681SAndroid Build Coastguard Worker; CHECK: lea {{[a-z]+}}, [{{[a-z]+}} + 4*{{[a-z]+}} - 5]
14*9880d681SAndroid Build Coastguard Worker
15*9880d681SAndroid Build Coastguard Worker  ret i32 %tmp4
16*9880d681SAndroid Build Coastguard Worker}
17*9880d681SAndroid Build Coastguard Worker
18*9880d681SAndroid Build Coastguard Worker
19