[X86][SSE] Bitcast assertion in XFormVExtractWithShuffleIntoLoad
[oota-llvm.git] / test / CodeGen / X86 / extractelement-load.ll
index 3e31b4b190b4cabf65ede79194804e69a3c97c59..8647599769361751e044c38b3dd900078b10bff8 100644 (file)
@@ -36,7 +36,9 @@ define void @t3() {
 ;
 ; This movs the entire vector, shuffling the high double down. If we fixed the
 ; FIXME above it would just move the high double directly.
-; CHECK: movhpd %xmm
+; CHECK: movupd
+; CHECK: shufpd
+; CHECK: movlpd
 
 bb:
   %tmp13 = load <2 x double>* undef, align 1
@@ -44,3 +46,19 @@ bb:
   store double %.sroa.3.24.vec.extract, double* undef, align 8
   unreachable
 }
+
+; Case where a load is unary shuffled, then bitcast (to a type with the same
+; number of elements) before extractelement.
+; This is testing for an assertion - the extraction was assuming that the undef
+; second shuffle operand was a post-bitcast type instead of a pre-bitcast type.
+define i64 @t4(<2 x double>* %a) {
+; CHECK-LABEL: t4:
+; CHECK: mov
+; CHECK: ret
+  %b = load <2 x double>* %a, align 16
+  %c = shufflevector <2 x double> %b, <2 x double> %b, <2 x i32> <i32 1, i32 0>
+  %d = bitcast <2 x double> %c to <2 x i64>
+  %e = extractelement <2 x i64> %d, i32 1
+  ret i64 %e
+}
+