diff options
| author | Daniel Sanders <daniel.sanders@imgtec.com> | 2013-11-22 11:24:50 +0000 |
|---|---|---|
| committer | Daniel Sanders <daniel.sanders@imgtec.com> | 2013-11-22 11:24:50 +0000 |
| commit | fd8e416879bd204c6c0d52efb4b04d3ac1213632 (patch) | |
| tree | 76dab6a56c95779b699c1ee1e6e3e6519572071d /llvm | |
| parent | 32474d622605ec7ed3fcf6d53b8317949ed98964 (diff) | |
| download | bcm5719-llvm-fd8e416879bd204c6c0d52efb4b04d3ac1213632.tar.gz bcm5719-llvm-fd8e416879bd204c6c0d52efb4b04d3ac1213632.zip | |
[mips][msa] Float vector constants cannot use ldi.[wd] directly. Bitcast from the appropriate integer vector type.
Fixes an instruction selection failure detected by llvm-stress.
llvm-svn: 195444
Diffstat (limited to 'llvm')
| -rw-r--r-- | llvm/lib/Target/Mips/MipsSEISelLowering.cpp | 4 | ||||
| -rw-r--r-- | llvm/test/CodeGen/Mips/msa/llvm-stress-s2501752154-simplified.ll | 27 |
2 files changed, 30 insertions, 1 deletions
diff --git a/llvm/lib/Target/Mips/MipsSEISelLowering.cpp b/llvm/lib/Target/Mips/MipsSEISelLowering.cpp index 27d7515c40c..c02c235eb7d 100644 --- a/llvm/lib/Target/Mips/MipsSEISelLowering.cpp +++ b/llvm/lib/Target/Mips/MipsSEISelLowering.cpp @@ -2210,7 +2210,9 @@ SDValue MipsSETargetLowering::lowerBUILD_VECTOR(SDValue Op, return SDValue(); // If the value fits into a simm10 then we can use ldi.[bhwd] - if (SplatValue.isSignedIntN(10)) + // However, if it isn't an integer type we will have to bitcast from an + // integer type first. + if (ResTy.isInteger() && SplatValue.isSignedIntN(10)) return Op; EVT ViaVecTy; diff --git a/llvm/test/CodeGen/Mips/msa/llvm-stress-s2501752154-simplified.ll b/llvm/test/CodeGen/Mips/msa/llvm-stress-s2501752154-simplified.ll new file mode 100644 index 00000000000..564ad7436d3 --- /dev/null +++ b/llvm/test/CodeGen/Mips/msa/llvm-stress-s2501752154-simplified.ll @@ -0,0 +1,27 @@ +; RUN: llc -march=mips < %s +; RUN: llc -march=mips -mattr=+msa,+fp64 < %s +; RUN: llc -march=mipsel < %s +; RUN: llc -march=mipsel -mattr=+msa,+fp64 < %s + +; This test originally failed for MSA with a "Cannot select ..." error. +; This happened because the legalizer treated undef's in the <4 x float> +; constant as equivalent to the defined elements when checking if it a constant +; splat, but then proceeded to legalize the undef's to zero, leaving it as a +; non-splat that cannot be selected. It should have eliminated the undef's by +; rewriting the splat constant. + +; It should at least successfully build. + +define void @autogen_SD2501752154() { +BB: + %BC = bitcast <4 x i32> <i32 -1, i32 -1, i32 undef, i32 undef> to <4 x float> + br label %CF74 + +CF74: ; preds = %CF74, %CF + %E54 = extractelement <1 x i1> undef, i32 0 + br i1 %E54, label %CF74, label %CF79 + +CF79: ; preds = %CF75 + %I63 = insertelement <4 x float> %BC, float undef, i32 0 + ret void +} |

