summaryrefslogtreecommitdiffstats
path: root/llvm/lib/CodeGen/SelectionDAG/LegalizeVectorOps.cpp
diff options
context:
space:
mode:
authorCameron McInally <cameron.mcinally@nyu.edu>2018-06-15 20:57:55 +0000
committerCameron McInally <cameron.mcinally@nyu.edu>2018-06-15 20:57:55 +0000
commit7caac670b223c35f21dc54937716362a84267248 (patch)
tree754187f3f391f2d808db81c7662b389a2fd43dcf /llvm/lib/CodeGen/SelectionDAG/LegalizeVectorOps.cpp
parent02d1c6c0cf20b7c6e4df3c4bba14a55d6195efbd (diff)
downloadbcm5719-llvm-7caac670b223c35f21dc54937716362a84267248.tar.gz
bcm5719-llvm-7caac670b223c35f21dc54937716362a84267248.zip
[FPEnv] Expand constrained FP POWI
Modify ExpandStrictFPOp(...) to handle nodes that have scalar operands. Also, add a Strict FMA test and do some other light cleanup in the Strict FP code. Differential Revision: https://reviews.llvm.org/D48149 llvm-svn: 334863
Diffstat (limited to 'llvm/lib/CodeGen/SelectionDAG/LegalizeVectorOps.cpp')
-rw-r--r--llvm/lib/CodeGen/SelectionDAG/LegalizeVectorOps.cpp22
1 files changed, 18 insertions, 4 deletions
diff --git a/llvm/lib/CodeGen/SelectionDAG/LegalizeVectorOps.cpp b/llvm/lib/CodeGen/SelectionDAG/LegalizeVectorOps.cpp
index 478da870b41..ed88806ae8a 100644
--- a/llvm/lib/CodeGen/SelectionDAG/LegalizeVectorOps.cpp
+++ b/llvm/lib/CodeGen/SelectionDAG/LegalizeVectorOps.cpp
@@ -293,6 +293,10 @@ SDValue VectorLegalizer::LegalizeOp(SDValue Op) {
switch (Op.getOpcode()) {
default:
return TranslateLegalizeResults(Op, Result);
+ case ISD::STRICT_FADD:
+ case ISD::STRICT_FSUB:
+ case ISD::STRICT_FMUL:
+ case ISD::STRICT_FDIV:
case ISD::STRICT_FSQRT:
case ISD::STRICT_FMA:
case ISD::STRICT_FPOW:
@@ -725,9 +729,14 @@ SDValue VectorLegalizer::Expand(SDValue Op) {
return ExpandCTLZ(Op);
case ISD::CTTZ_ZERO_UNDEF:
return ExpandCTTZ_ZERO_UNDEF(Op);
+ case ISD::STRICT_FADD:
+ case ISD::STRICT_FSUB:
+ case ISD::STRICT_FMUL:
+ case ISD::STRICT_FDIV:
case ISD::STRICT_FSQRT:
case ISD::STRICT_FMA:
case ISD::STRICT_FPOW:
+ case ISD::STRICT_FPOWI:
case ISD::STRICT_FSIN:
case ISD::STRICT_FCOS:
case ISD::STRICT_FEXP:
@@ -1134,8 +1143,8 @@ SDValue VectorLegalizer::ExpandStrictFPOp(SDValue Op) {
SDValue Chain = Op.getOperand(0);
SDLoc dl(Op);
- SmallVector<SDValue, 8> OpValues;
- SmallVector<SDValue, 8> OpChains;
+ SmallVector<SDValue, 32> OpValues;
+ SmallVector<SDValue, 32> OpChains;
for (unsigned i = 0; i < NumElems; ++i) {
SmallVector<SDValue, 4> Opers;
SDValue Idx = DAG.getConstant(i, dl,
@@ -1146,8 +1155,13 @@ SDValue VectorLegalizer::ExpandStrictFPOp(SDValue Op) {
// Now process the remaining operands.
for (unsigned j = 1; j < NumOpers; ++j) {
- SDValue Oper = DAG.getNode(ISD::EXTRACT_VECTOR_ELT, dl,
- EltVT, Op.getOperand(j), Idx);
+ SDValue Oper = Op.getOperand(j);
+ EVT OperVT = Oper.getValueType();
+
+ if (OperVT.isVector())
+ Oper = DAG.getNode(ISD::EXTRACT_VECTOR_ELT, dl,
+ EltVT, Oper, Idx);
+
Opers.push_back(Oper);
}
OpenPOWER on IntegriCloud