diff options
| author | Elena Demikhovsky <elena.demikhovsky@intel.com> | 2014-02-11 10:21:53 +0000 |
|---|---|---|
| committer | Elena Demikhovsky <elena.demikhovsky@intel.com> | 2014-02-11 10:21:53 +0000 |
| commit | 1f32c313f151da491bca061f64d9a9f4773af070 (patch) | |
| tree | 4e913ffa8af3c2006259abdf31c8a38ac47b9771 | |
| parent | 1067ab0a1ac51d56b5705a7aeaf223ac2f960eec (diff) | |
| download | bcm5719-llvm-1f32c313f151da491bca061f64d9a9f4773af070.tar.gz bcm5719-llvm-1f32c313f151da491bca061f64d9a9f4773af070.zip | |
AVX: fixed a bug in LowerVECTOR_SHUFFLE
llvm-svn: 201140
| -rw-r--r-- | llvm/lib/Target/X86/X86ISelLowering.cpp | 6 | ||||
| -rw-r--r-- | llvm/test/CodeGen/X86/avx-shuffle.ll | 9 |
2 files changed, 14 insertions, 1 deletions
diff --git a/llvm/lib/Target/X86/X86ISelLowering.cpp b/llvm/lib/Target/X86/X86ISelLowering.cpp index 32e41c36802..85656d80914 100644 --- a/llvm/lib/Target/X86/X86ISelLowering.cpp +++ b/llvm/lib/Target/X86/X86ISelLowering.cpp @@ -7371,7 +7371,11 @@ X86TargetLowering::LowerVECTOR_SHUFFLE(SDValue Op, SelectionDAG &DAG) const { if (V1IsUndef && V2IsUndef) return DAG.getUNDEF(VT); - assert(!V1IsUndef && "Op 1 of shuffle should not be undef"); + // When we create a shuffle node we put the UNDEF node to second operand, + // but in some cases the first operand may be transformed to UNDEF. + // In this case we should just commute the node. + if (V1IsUndef) + return CommuteVectorShuffle(SVOp, DAG); // Vector shuffle lowering takes 3 steps: // diff --git a/llvm/test/CodeGen/X86/avx-shuffle.ll b/llvm/test/CodeGen/X86/avx-shuffle.ll index 0956361c7e3..02aa617c56c 100644 --- a/llvm/test/CodeGen/X86/avx-shuffle.ll +++ b/llvm/test/CodeGen/X86/avx-shuffle.ll @@ -297,3 +297,12 @@ entry: } declare <2 x double> @llvm.x86.avx.vextractf128.pd.256(<4 x double>, i8) nounwind readnone declare <4 x double> @llvm.x86.avx.vinsertf128.pd.256(<4 x double>, <2 x double>, i8) nounwind readnone + +; this test case just should not fail +define void @test20() { + %a0 = insertelement <3 x double> <double 0.000000e+00, double 0.000000e+00, double undef>, double 0.000000e+00, i32 2 + store <3 x double> %a0, <3 x double>* undef, align 1 + %a1 = insertelement <3 x double> <double 0.000000e+00, double 0.000000e+00, double undef>, double undef, i32 2 + store <3 x double> %a1, <3 x double>* undef, align 1 + ret void +} |

