summaryrefslogtreecommitdiffstats
path: root/llvm/test/CodeGen/X86/combine-or.ll
diff options
context:
space:
mode:
authorSimon Pilgrim <llvm-dev@redking.me.uk>2015-04-23 08:43:13 +0000
committerSimon Pilgrim <llvm-dev@redking.me.uk>2015-04-23 08:43:13 +0000
commit86b034bae920c179ad184ca39145ce33d445f739 (patch)
treeaab0e8c11bf888ce966c416024e708db67c3c8ca /llvm/test/CodeGen/X86/combine-or.ll
parent24e6cc2de4603bda679868d2baa2c472c1540719 (diff)
downloadbcm5719-llvm-86b034bae920c179ad184ca39145ce33d445f739.tar.gz
bcm5719-llvm-86b034bae920c179ad184ca39145ce33d445f739.zip
[DAGCombiner] Remove extra bitcasts surrounding vector shuffles
Patch to remove extra bitcasts from shuffles, this is often a legacy of XformToShuffleWithZero being used to combine bitmaskings (of float vectors bitcast to integer vectors) into shuffles: bitcast(shuffle(bitcast(s0),bitcast(s1))) -> shuffle(s0,s1) Differential Revision: http://reviews.llvm.org/D9097 llvm-svn: 235578
Diffstat (limited to 'llvm/test/CodeGen/X86/combine-or.ll')
-rw-r--r--llvm/test/CodeGen/X86/combine-or.ll64
1 files changed, 64 insertions, 0 deletions
diff --git a/llvm/test/CodeGen/X86/combine-or.ll b/llvm/test/CodeGen/X86/combine-or.ll
index 8a0ffc128e5..970f1762c1b 100644
--- a/llvm/test/CodeGen/X86/combine-or.ll
+++ b/llvm/test/CodeGen/X86/combine-or.ll
@@ -277,6 +277,70 @@ define <2 x i64> @test21(<2 x i64> %a, <2 x i64> %b) {
ret <2 x i64> %or
}
+
+; Verify that the dag-combiner keeps the correct domain for float/double vectors
+; bitcast to use the mask-or blend combine.
+
+define <2 x double> @test22(<2 x double> %a0, <2 x double> %a1) {
+; CHECK-LABEL: test22:
+; CHECK: # BB#0:
+; CHECK-NEXT: blendpd {{.*#+}} xmm0 = xmm1[0],xmm0[1]
+; CHECK-NEXT: retq
+ %bc1 = bitcast <2 x double> %a0 to <2 x i64>
+ %bc2 = bitcast <2 x double> %a1 to <2 x i64>
+ %and1 = and <2 x i64> %bc1, <i64 0, i64 -1>
+ %and2 = and <2 x i64> %bc2, <i64 -1, i64 0>
+ %or = or <2 x i64> %and1, %and2
+ %bc3 = bitcast <2 x i64> %or to <2 x double>
+ ret <2 x double> %bc3
+}
+
+
+define <4 x float> @test23(<4 x float> %a0, <4 x float> %a1) {
+; CHECK-LABEL: test23:
+; CHECK: # BB#0:
+; CHECK-NEXT: blendps {{.*#+}} xmm0 = xmm1[0],xmm0[1,2],xmm1[3]
+; CHECK-NEXT: retq
+ %bc1 = bitcast <4 x float> %a0 to <4 x i32>
+ %bc2 = bitcast <4 x float> %a1 to <4 x i32>
+ %and1 = and <4 x i32> %bc1, <i32 0, i32 -1, i32 -1, i32 0>
+ %and2 = and <4 x i32> %bc2, <i32 -1, i32 0, i32 0, i32 -1>
+ %or = or <4 x i32> %and1, %and2
+ %bc3 = bitcast <4 x i32> %or to <4 x float>
+ ret <4 x float> %bc3
+}
+
+
+define <4 x float> @test24(<4 x float> %a0, <4 x float> %a1) {
+; CHECK-LABEL: test24:
+; CHECK: # BB#0:
+; CHECK-NEXT: blendpd {{.*#+}} xmm0 = xmm1[0],xmm0[1]
+; CHECK-NEXT: retq
+ %bc1 = bitcast <4 x float> %a0 to <2 x i64>
+ %bc2 = bitcast <4 x float> %a1 to <2 x i64>
+ %and1 = and <2 x i64> %bc1, <i64 0, i64 -1>
+ %and2 = and <2 x i64> %bc2, <i64 -1, i64 0>
+ %or = or <2 x i64> %and1, %and2
+ %bc3 = bitcast <2 x i64> %or to <4 x float>
+ ret <4 x float> %bc3
+}
+
+
+define <4 x float> @test25(<4 x float> %a0) {
+; CHECK-LABEL: test25:
+; CHECK: # BB#0:
+; CHECK-NEXT: blendps {{.*#+}} xmm0 = mem[0],xmm0[1,2],mem[3]
+; CHECK-NEXT: retq
+ %bc1 = bitcast <4 x float> %a0 to <4 x i32>
+ %bc2 = bitcast <4 x float> <float 1.0, float 1.0, float 1.0, float 1.0> to <4 x i32>
+ %and1 = and <4 x i32> %bc1, <i32 0, i32 -1, i32 -1, i32 0>
+ %and2 = and <4 x i32> %bc2, <i32 -1, i32 0, i32 0, i32 -1>
+ %or = or <4 x i32> %and1, %and2
+ %bc3 = bitcast <4 x i32> %or to <4 x float>
+ ret <4 x float> %bc3
+}
+
+
; Verify that the DAGCombiner doesn't crash in the attempt to check if a shuffle
; with illegal type has a legal mask. Method 'isShuffleMaskLegal' only knows how to
; handle legal vector value types.
OpenPOWER on IntegriCloud