-
Notifications
You must be signed in to change notification settings - Fork 10.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
3 changed files
with
84 additions
and
99 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,29 @@ | ||
; RUN: llc < %s -mtriple=i686-linux -x86-asm-syntax=intel | FileCheck %s | ||
; RUN: llc < %s -mtriple=x86_64-linux -x86-asm-syntax=intel | FileCheck %s | ||
; RUN: llc < %s -mtriple=x86_64-linux-gnux32 -x86-asm-syntax=intel | FileCheck %s | ||
; RUN: llc < %s -mtriple=x86_64-nacl -x86-asm-syntax=intel | FileCheck %s | ||
; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py | ||
; RUN: llc < %s -mtriple=i686-linux | FileCheck %s --check-prefix=X32 | ||
; RUN: llc < %s -mtriple=x86_64-linux | FileCheck %s --check-prefix=X64 | ||
; RUN: llc < %s -mtriple=x86_64-linux-gnux32 | FileCheck %s --check-prefix=X64 | ||
; RUN: llc < %s -mtriple=x86_64-nacl | FileCheck %s --check-prefix=X64 | ||
|
||
define i32 @test1(i32 %A, i32 %B) { | ||
%tmp1 = shl i32 %A, 2 | ||
%tmp3 = add i32 %B, -5 | ||
%tmp4 = add i32 %tmp3, %tmp1 | ||
; The above computation of %tmp4 should match a single lea, without using | ||
; actual add instructions. | ||
; CHECK-NOT: add | ||
; CHECK: lea {{[a-z]+}}, [{{[a-z]+}} + 4*{{[a-z]+}} - 5] | ||
; The computation of %t4 should match a single lea, without using actual add instructions. | ||
|
||
ret i32 %tmp4 | ||
define i32 @test1(i32 %A, i32 %B) { | ||
; X32-LABEL: test1: | ||
; X32: # %bb.0: | ||
; X32-NEXT: movl {{[0-9]+}}(%esp), %eax | ||
; X32-NEXT: movl {{[0-9]+}}(%esp), %ecx | ||
; X32-NEXT: leal -5(%ecx,%eax,4), %eax | ||
; X32-NEXT: retl | ||
; | ||
; X64-LABEL: test1: | ||
; X64: # %bb.0: | ||
; X64-NEXT: # kill: def $esi killed $esi def $rsi | ||
; X64-NEXT: # kill: def $edi killed $edi def $rdi | ||
; X64-NEXT: leal -5(%rsi,%rdi,4), %eax | ||
; X64-NEXT: retq | ||
%t1 = shl i32 %A, 2 | ||
%t3 = add i32 %B, -5 | ||
%t4 = add i32 %t3, %t1 | ||
ret i32 %t4 | ||
} | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,32 @@ | ||
; RUN: llc < %s -mtriple=x86_64-linux | FileCheck %s | ||
; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py | ||
; RUN: llc < %s -mtriple=x86_64-linux | FileCheck %s | ||
; RUN: llc < %s -mtriple=x86_64-linux-gnux32 | FileCheck %s | ||
; RUN: llc < %s -mtriple=x86_64-nacl | FileCheck %s | ||
|
||
; RUN: llc < %s -mtriple=x86_64-nacl | FileCheck %s | ||
|
||
define zeroext i16 @t1(i32 %on_off) nounwind { | ||
entry: | ||
%0 = sub i32 %on_off, 1 | ||
%1 = mul i32 %0, 2 | ||
%2 = trunc i32 %1 to i16 | ||
%3 = zext i16 %2 to i32 | ||
%4 = trunc i32 %3 to i16 | ||
; CHECK: lea | ||
ret i16 %4 | ||
; CHECK-LABEL: t1: | ||
; CHECK: # %bb.0: | ||
; CHECK-NEXT: # kill: def $edi killed $edi def $rdi | ||
; CHECK-NEXT: leal -2(%rdi,%rdi), %eax | ||
; CHECK-NEXT: # kill: def $ax killed $ax killed $eax | ||
; CHECK-NEXT: retq | ||
%t0 = sub i32 %on_off, 1 | ||
%t1 = mul i32 %t0, 2 | ||
%t2 = trunc i32 %t1 to i16 | ||
%t3 = zext i16 %t2 to i32 | ||
%t4 = trunc i32 %t3 to i16 | ||
ret i16 %t4 | ||
} | ||
|
||
define i32 @t2(i32 %on_off) nounwind { | ||
entry: | ||
%0 = sub i32 %on_off, 1 | ||
%1 = mul i32 %0, 2 | ||
%2 = and i32 %1, 65535 | ||
; CHECK: lea | ||
ret i32 %2 | ||
; CHECK-LABEL: t2: | ||
; CHECK: # %bb.0: | ||
; CHECK-NEXT: # kill: def $edi killed $edi def $rdi | ||
; CHECK-NEXT: leal -2(%rdi,%rdi), %eax | ||
; CHECK-NEXT: movzwl %ax, %eax | ||
; CHECK-NEXT: retq | ||
%t0 = sub i32 %on_off, 1 | ||
%t1 = mul i32 %t0, 2 | ||
%t2 = and i32 %t1, 65535 | ||
ret i32 %t2 | ||
} |