diff options
author | Chris Lattner <sabre@nondot.org> | 2005-09-10 00:20:18 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2005-09-10 00:20:18 +0000 |
commit | 13d58e71b7ab2857162b88860c56dce4c9cea3de (patch) | |
tree | 4bc7e33c7a93f243ff883ca480e4603a58d86027 | |
parent | a500fc681de6329194e9755e051422d621387aa3 (diff) |
Allow targets to say they don't support truncstore i1 (which includes a mask
when storing to an 8-bit memory location), as most don't.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23303 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | lib/CodeGen/SelectionDAG/LegalizeDAG.cpp | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp b/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp index 55dcbd9ffd..277f696dcb 100644 --- a/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp +++ b/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp @@ -1043,10 +1043,23 @@ SDOperand SelectionDAGLegalize::LegalizeOp(SDOperand Op) { switch (getTypeAction(Node->getOperand(1).getValueType())) { case Legal: Tmp2 = LegalizeOp(Node->getOperand(1)); - if (Tmp1 != Node->getOperand(0) || Tmp2 != Node->getOperand(1) || - Tmp3 != Node->getOperand(2)) + + // The only promote case we handle is TRUNCSTORE:i1 X into + // -> TRUNCSTORE:i8 (and X, 1) + if (cast<VTSDNode>(Node->getOperand(4))->getVT() == MVT::i1 && + TLI.getOperationAction(ISD::TRUNCSTORE, MVT::i1) == + TargetLowering::Promote) { + // Promote the bool to a mask then store. + Tmp2 = DAG.getNode(ISD::AND, Tmp2.getValueType(), Tmp2, + DAG.getConstant(1, Tmp2.getValueType())); + Result = DAG.getNode(ISD::TRUNCSTORE, MVT::Other, Tmp1, Tmp2, Tmp3, + Node->getOperand(3), DAG.getValueType(MVT::i8)); + + } else if (Tmp1 != Node->getOperand(0) || Tmp2 != Node->getOperand(1) || + Tmp3 != Node->getOperand(2)) { Result = DAG.getNode(ISD::TRUNCSTORE, MVT::Other, Tmp1, Tmp2, Tmp3, Node->getOperand(3), Node->getOperand(4)); + } break; case Promote: case Expand: |