brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.7 KiB · 0883a8e Raw
55 lines · plain
1; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py2; RUN: llc < %s -mtriple=i686-linux          | FileCheck %s --check-prefix=X863; RUN: llc < %s -mtriple=x86_64-linux        | FileCheck %s --check-prefix=X644; RUN: llc < %s -mtriple=x86_64-linux-gnux32 | FileCheck %s --check-prefix=X645 6; The computation of %t4 should match a single lea, without using actual add instructions.7 8define i32 @test1(i32 %A, i32 %B) {9; X86-LABEL: test1:10; X86:       # %bb.0:11; X86-NEXT:    movl {{[0-9]+}}(%esp), %eax12; X86-NEXT:    movl {{[0-9]+}}(%esp), %ecx13; X86-NEXT:    leal -5(%ecx,%eax,4), %eax14; X86-NEXT:    retl15;16; X64-LABEL: test1:17; X64:       # %bb.0:18; X64-NEXT:    # kill: def $esi killed $esi def $rsi19; X64-NEXT:    # kill: def $edi killed $edi def $rdi20; X64-NEXT:    leal -5(%rsi,%rdi,4), %eax21; X64-NEXT:    retq22  %t1 = shl i32 %A, 223  %t3 = add i32 %B, -524  %t4 = add i32 %t3, %t125  ret i32 %t426}27 28; The addlike OR instruction should fold into the LEA.29 30define i64 @test2(i32 %a0, i64 %a1) {31; X86-LABEL: test2:32; X86:       # %bb.0:33; X86-NEXT:    movl {{[0-9]+}}(%esp), %edx34; X86-NEXT:    movl %edx, %eax35; X86-NEXT:    andl $2147483640, %eax # imm = 0x7FFFFFF836; X86-NEXT:    shrl $31, %edx37; X86-NEXT:    leal 4(%eax,%eax), %eax38; X86-NEXT:    addl {{[0-9]+}}(%esp), %eax39; X86-NEXT:    adcl {{[0-9]+}}(%esp), %edx40; X86-NEXT:    retl41;42; X64-LABEL: test2:43; X64:       # %bb.0:44; X64-NEXT:    # kill: def $edi killed $edi def $rdi45; X64-NEXT:    andl $-8, %edi46; X64-NEXT:    leaq 4(%rsi,%rdi,2), %rax47; X64-NEXT:    retq48  %x1 = and i32 %a0, -849  %x2 = or i32 %x1, 250  %x3 = zext i32 %x2 to i6451  %x4 = shl i64 %x3, 152  %x5 = add i64 %a1, %x453  ret i64 %x554}55