summaryrefslogtreecommitdiffstats
path: root/llvm/test/CodeGen
diff options
context:
space:
mode:
authorMichael Kuperstein <michael.m.kuperstein@intel.com>2015-11-11 11:44:31 +0000
committerMichael Kuperstein <michael.m.kuperstein@intel.com>2015-11-11 11:44:31 +0000
commit12982a816c4be8702202cfcf5c3a83a29f70b5b9 (patch)
treea48556d0f45eccad2dac188305984abd40a8a92c /llvm/test/CodeGen
parent5bfeca12017d3d8352b7ebc9ea2eeb2f95950395 (diff)
downloadbcm5719-llvm-12982a816c4be8702202cfcf5c3a83a29f70b5b9.tar.gz
bcm5719-llvm-12982a816c4be8702202cfcf5c3a83a29f70b5b9.zip
[X86] Replace LEAs with INC/DEC when profitable
If possible and profitable, replace lea %reg, 1(%reg) and lea %reg, -1(%reg) with inc %reg and dec %reg respectively. Patch by: anton.nadolsky@intel.com Differential Revision: http://reviews.llvm.org/D14059 llvm-svn: 252722
Diffstat (limited to 'llvm/test/CodeGen')
-rw-r--r--llvm/test/CodeGen/X86/fixup-lea.ll34
-rw-r--r--llvm/test/CodeGen/X86/lsr-static-addr.ll2
2 files changed, 35 insertions, 1 deletions
diff --git a/llvm/test/CodeGen/X86/fixup-lea.ll b/llvm/test/CodeGen/X86/fixup-lea.ll
new file mode 100644
index 00000000000..1ddc099ffd6
--- /dev/null
+++ b/llvm/test/CodeGen/X86/fixup-lea.ll
@@ -0,0 +1,34 @@
+;RUN: llc < %s -march=x86 | FileCheck %s
+
+define void @foo(i32 inreg %dns) minsize {
+entry:
+; CHECK-LABEL: foo
+; CHECK: dec
+ br label %for.body
+
+for.body:
+ %i.05 = phi i16 [ %dec, %for.body ], [ 0, %entry ]
+ %dec = add i16 %i.05, -1
+ %conv = zext i16 %dec to i32
+ %cmp = icmp slt i32 %conv, %dns
+ br i1 %cmp, label %for.body, label %for.end
+
+for.end:
+ ret void
+}
+
+define void @bar(i32 inreg %dns) minsize {
+entry:
+; CHECK-LABEL: bar
+; CHECK: inc
+ br label %for.body
+
+for.body:
+ %i.05 = phi i16 [ %inc, %for.body ], [ 0, %entry ]
+ %inc = add i16 %i.05, 1
+ %conv = zext i16 %inc to i32
+ %cmp = icmp slt i32 %conv, %dns
+ br i1 %cmp, label %for.body, label %for.end
+for.end:
+ ret void
+}
diff --git a/llvm/test/CodeGen/X86/lsr-static-addr.ll b/llvm/test/CodeGen/X86/lsr-static-addr.ll
index 1765ed7871d..97451e5573f 100644
--- a/llvm/test/CodeGen/X86/lsr-static-addr.ll
+++ b/llvm/test/CodeGen/X86/lsr-static-addr.ll
@@ -18,7 +18,7 @@
; ATOM-NEXT: movsd A(,%rax,8)
; ATOM-NEXT: mulsd
; ATOM-NEXT: movsd
-; ATOM-NEXT: leaq 1(%rax), %rax
+; ATOM-NEXT: incq %rax
@A = external global [0 x double]
OpenPOWER on IntegriCloud