• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2; RUN: llc < %s -mtriple=i686-linux          | FileCheck %s --check-prefix=X32
3; RUN: llc < %s -mtriple=x86_64-linux        | FileCheck %s --check-prefix=X64
4; RUN: llc < %s -mtriple=x86_64-linux-gnux32 | FileCheck %s --check-prefix=X64
5; RUN: llc < %s -mtriple=x86_64-nacl         | FileCheck %s --check-prefix=X64
6
7; The computation of %t4 should match a single lea, without using actual add instructions.
8
9define i32 @test1(i32 %A, i32 %B) {
10; X32-LABEL: test1:
11; X32:       # %bb.0:
12; X32-NEXT:    movl {{[0-9]+}}(%esp), %eax
13; X32-NEXT:    movl {{[0-9]+}}(%esp), %ecx
14; X32-NEXT:    leal -5(%ecx,%eax,4), %eax
15; X32-NEXT:    retl
16;
17; X64-LABEL: test1:
18; X64:       # %bb.0:
19; X64-NEXT:    # kill: def $esi killed $esi def $rsi
20; X64-NEXT:    # kill: def $edi killed $edi def $rdi
21; X64-NEXT:    leal -5(%rsi,%rdi,4), %eax
22; X64-NEXT:    retq
23  %t1 = shl i32 %A, 2
24  %t3 = add i32 %B, -5
25  %t4 = add i32 %t3, %t1
26  ret i32 %t4
27}
28
29
30