summaryrefslogtreecommitdiff
path: root/test/CodeGen/PowerPC
diff options
context:
space:
mode:
authorHal Finkel <hfinkel@anl.gov>2013-04-06 19:30:30 +0000
committerHal Finkel <hfinkel@anl.gov>2013-04-06 19:30:30 +0000
commit839b9096538f790a2bb060547df24703807cb83b (patch)
tree0cf51af4bf2e88a7a170f6ef96961f35b7699a07 /test/CodeGen/PowerPC
parent012ffd56059576d4a0ee523f673b3190b1f03311 (diff)
downloadllvm-839b9096538f790a2bb060547df24703807cb83b.tar.gz
llvm-839b9096538f790a2bb060547df24703807cb83b.tar.bz2
llvm-839b9096538f790a2bb060547df24703807cb83b.tar.xz
Implement PPCInstrInfo::FoldImmediate
There are certain PPC instructions into which we can fold a zero immediate operand. We can detect such cases by looking at the register class required by the using operand (so long as it is not otherwise constrained). git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@178961 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/CodeGen/PowerPC')
-rw-r--r--test/CodeGen/PowerPC/fold-zero.ll14
1 files changed, 14 insertions, 0 deletions
diff --git a/test/CodeGen/PowerPC/fold-zero.ll b/test/CodeGen/PowerPC/fold-zero.ll
new file mode 100644
index 0000000000..c7ec6fade5
--- /dev/null
+++ b/test/CodeGen/PowerPC/fold-zero.ll
@@ -0,0 +1,14 @@
+; RUN: llc < %s -mtriple=powerpc64-unknown-linux-gnu -mcpu=pwr7 | FileCheck %s
+target datalayout = "E-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-f128:128:128-v128:128:128-n32:64"
+target triple = "powerpc64-unknown-linux-gnu"
+
+define i32 @test1(i1 %a, i32 %c) nounwind {
+ %x = select i1 %a, i32 %c, i32 0
+ ret i32 %x
+
+; CHECK: @test1
+; CHECK-NOT: li {{[0-9]+}}, 0
+; CHECK: isel 3, 0,
+; CHECK: blr
+}
+