diff options
author | Craig Topper <craig.topper@intel.com> | 2018-10-30 03:27:15 +0000 |
---|---|---|
committer | Craig Topper <craig.topper@intel.com> | 2018-10-30 03:27:15 +0000 |
commit | b293322cee173b953845ce1a68975944a4df0a72 (patch) | |
tree | f44c8c3e1dd8e5383a4e5f9b8787c34a63411995 /llvm/lib/Target | |
parent | 2640795c94cad6863c66cffd30e8e217dd3ac506 (diff) | |
download | bcm5719-llvm-b293322cee173b953845ce1a68975944a4df0a72.tar.gz bcm5719-llvm-b293322cee173b953845ce1a68975944a4df0a72.zip |
[LegalizeTypes] Teach PromoteIntRes_BITCAST to better handle a bitcast with vector output type and a vector input type that needs to be widened
Summary: Previously if we had a bitcast vector output type that needs promotion and a vector input type that needs widening we would just do a stack store and load to handle the conversion. We can do a little better if we can widen the bitcast to a legal vector type the same size as the widened input type. Then we can do the bitcast between this widened type and the widened input type. Afterwards we can extract_subvector back to the original output and any_extend that. Type legalization will then circle back and handle promotion of the extract_subvector and the any_extend will just be removed. This will avoid going through the stack and allows us to remove a custom version of this legalization from X86.
Reviewers: efriedma, RKSimon
Reviewed By: efriedma
Subscribers: javed.absar, llvm-commits
Differential Revision: https://reviews.llvm.org/D53229
llvm-svn: 345567
Diffstat (limited to 'llvm/lib/Target')
-rw-r--r-- | llvm/lib/Target/X86/X86ISelLowering.cpp | 10 |
1 files changed, 2 insertions, 8 deletions
diff --git a/llvm/lib/Target/X86/X86ISelLowering.cpp b/llvm/lib/Target/X86/X86ISelLowering.cpp index c7d398873d2..da5340a050b 100644 --- a/llvm/lib/Target/X86/X86ISelLowering.cpp +++ b/llvm/lib/Target/X86/X86ISelLowering.cpp @@ -26338,7 +26338,7 @@ void X86TargetLowering::ReplaceNodeResults(SDNode *N, return; } - if ((SrcVT != MVT::f64 && SrcVT != MVT::v2f32) || + if (SrcVT != MVT::f64 || (DstVT != MVT::v2i32 && DstVT != MVT::v4i16 && DstVT != MVT::v8i8) || getTypeAction(*DAG.getContext(), DstVT) == TypeWidenVector) return; @@ -26347,13 +26347,7 @@ void X86TargetLowering::ReplaceNodeResults(SDNode *N, EVT SVT = DstVT.getVectorElementType(); EVT WiderVT = EVT::getVectorVT(*DAG.getContext(), SVT, NumElts * 2); SDValue Res; - if (SrcVT == MVT::f64) - Res = DAG.getNode(ISD::SCALAR_TO_VECTOR, dl, - MVT::v2f64, N->getOperand(0)); - else - Res = DAG.getNode(ISD::CONCAT_VECTORS, dl, MVT::v4f32, N->getOperand(0), - DAG.getUNDEF(MVT::v2f32)); - + Res = DAG.getNode(ISD::SCALAR_TO_VECTOR, dl, MVT::v2f64, N->getOperand(0)); Res = DAG.getBitcast(WiderVT, Res); Res = DAG.getNode(ISD::EXTRACT_SUBVECTOR, dl, DstVT, Res, DAG.getIntPtrConstant(0, dl)); |