summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorMichael Zolotukhin <mzolotukhin@apple.com>2014-04-30 19:17:32 +0000
committerMichael Zolotukhin <mzolotukhin@apple.com>2014-04-30 19:17:32 +0000
commitc80b103a2b1659482332b41c42f49137f3a5c069 (patch)
treec079a356779ab5deb88238fb2baacd5db7c69c0c /test
parent4aef7270c975ed62788ce5956a1763101113bc6f (diff)
downloadllvm-c80b103a2b1659482332b41c42f49137f3a5c069.tar.gz
llvm-c80b103a2b1659482332b41c42f49137f3a5c069.tar.bz2
llvm-c80b103a2b1659482332b41c42f49137f3a5c069.tar.xz
[X86] Never hoist the shift value of a shift instruction.
There is no need to check if we want to hoist the immediate value of an shift instruction. Simply return TCC_Free right away. This change is like r206101, but for X86. rdar://problem/16190769 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@207692 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test')
-rw-r--r--test/CodeGen/X86/remat-invalid-liveness.ll10
-rw-r--r--test/Transforms/ConstantHoisting/X86/large-immediate.ll18
2 files changed, 24 insertions, 4 deletions
diff --git a/test/CodeGen/X86/remat-invalid-liveness.ll b/test/CodeGen/X86/remat-invalid-liveness.ll
index b14afe96ef..d285e83b79 100644
--- a/test/CodeGen/X86/remat-invalid-liveness.ll
+++ b/test/CodeGen/X86/remat-invalid-liveness.ll
@@ -31,6 +31,8 @@ target triple = "i386-apple-macosx10.9"
; Function Attrs: nounwind optsize ssp
define fastcc void @__XXX1(%struct.A* %ht) #0 {
entry:
+ %const72 = bitcast i128 72 to i128
+ %const3 = bitcast i128 3 to i128
switch i32 undef, label %if.end196 [
i32 1, label %sw.bb.i
i32 3, label %sw.bb2.i
@@ -39,13 +41,13 @@ entry:
sw.bb.i: ; preds = %entry
%call.i.i.i = tail call i32 undef(%struct.A* %ht, i8 zeroext 22, i32 undef, i32 0, %struct.D* undef)
%bf.load.i.i = load i128* undef, align 4
- %bf.lshr.i.i = lshr i128 %bf.load.i.i, 72
+ %bf.lshr.i.i = lshr i128 %bf.load.i.i, %const72
%shl1.i.i = shl nuw nsw i128 %bf.lshr.i.i, 8
%shl.i.i = trunc i128 %shl1.i.i to i32
br i1 undef, label %cond.false10.i.i, label %__XXX2.exit.i.i
__XXX2.exit.i.i: ; preds = %sw.bb.i
- %extract11.i.i.i = lshr i128 %bf.load.i.i, 3
+ %extract11.i.i.i = lshr i128 %bf.load.i.i, %const3
%extract.t12.i.i.i = trunc i128 %extract11.i.i.i to i32
%bf.cast7.i.i.i = and i32 %extract.t12.i.i.i, 3
%arrayidx.i.i.i = getelementptr inbounds %struct.A* %ht, i32 0, i32 3, i32 %bf.cast7.i.i.i
@@ -69,11 +71,11 @@ for.body.i.i: ; preds = %for.body.i.i, %cond
br i1 %or.cond, label %for.body.i.i, label %if.end196
sw.bb2.i: ; preds = %entry
- %bf.lshr.i85.i = lshr i128 undef, 72
+ %bf.lshr.i85.i = lshr i128 undef, %const72
br i1 undef, label %if.end196, label %__XXX2.exit.i95.i
__XXX2.exit.i95.i: ; preds = %sw.bb2.i
- %extract11.i.i91.i = lshr i128 undef, 3
+ %extract11.i.i91.i = lshr i128 undef, %const3
br label %if.end196
if.end196: ; preds = %__XXX2.exit.i95.i, %sw.bb2.i, %for.body.i.i, %cond.end12.i.i, %entry
diff --git a/test/Transforms/ConstantHoisting/X86/large-immediate.ll b/test/Transforms/ConstantHoisting/X86/large-immediate.ll
new file mode 100644
index 0000000000..bd7fa40e9c
--- /dev/null
+++ b/test/Transforms/ConstantHoisting/X86/large-immediate.ll
@@ -0,0 +1,18 @@
+; RUN: opt -mtriple=x86_64-darwin-unknown -S -consthoist < %s | FileCheck %s
+
+define i128 @test1(i128 %a) nounwind {
+; CHECK-LABEL: test1
+; CHECK: %const = bitcast i128 12297829382473034410122878 to i128
+ %1 = add i128 %a, 12297829382473034410122878
+ %2 = add i128 %1, 12297829382473034410122878
+ ret i128 %2
+}
+
+; Check that we don't hoist the shift value of a shift instruction.
+define i512 @test2(i512 %a) nounwind {
+; CHECK-LABEL: test2
+; CHECK-NOT: %const = bitcast i512 504 to i512
+ %1 = shl i512 %a, 504
+ %2 = ashr i512 %1, 504
+ ret i512 %2
+}