diff options
| author | Duncan Sands <baldrick@free.fr> | 2009-03-29 13:51:06 +0000 | 
|---|---|---|
| committer | Duncan Sands <baldrick@free.fr> | 2009-03-29 13:51:06 +0000 | 
| commit | d21581eaa196f49ed9d66975eb4f0e4c6ceb909f (patch) | |
| tree | 37a504aa6af257a946dd50d09d315d845a79f7e6 /llvm/lib/CodeGen | |
| parent | 6694cdf2152ddac50f90bab30af47917bb4bb2b7 (diff) | |
| download | bcm5719-llvm-d21581eaa196f49ed9d66975eb4f0e4c6ceb909f.tar.gz bcm5719-llvm-d21581eaa196f49ed9d66975eb4f0e4c6ceb909f.zip | |
Fix PR3899: add support for extracting floats from vectors
when using -soft-float.
Based on a patch by Jakob Stoklund Olesen.
llvm-svn: 67996
Diffstat (limited to 'llvm/lib/CodeGen')
| -rw-r--r-- | llvm/lib/CodeGen/SelectionDAG/LegalizeFloatTypes.cpp | 9 | ||||
| -rw-r--r-- | llvm/lib/CodeGen/SelectionDAG/LegalizeTypes.cpp | 11 | ||||
| -rw-r--r-- | llvm/lib/CodeGen/SelectionDAG/LegalizeTypes.h | 2 | 
3 files changed, 22 insertions, 0 deletions
| diff --git a/llvm/lib/CodeGen/SelectionDAG/LegalizeFloatTypes.cpp b/llvm/lib/CodeGen/SelectionDAG/LegalizeFloatTypes.cpp index ce312ae8c86..8aa3e940025 100644 --- a/llvm/lib/CodeGen/SelectionDAG/LegalizeFloatTypes.cpp +++ b/llvm/lib/CodeGen/SelectionDAG/LegalizeFloatTypes.cpp @@ -59,6 +59,8 @@ void DAGTypeLegalizer::SoftenFloatResult(SDNode *N, unsigned ResNo) {      case ISD::ConstantFP:        R = SoftenFloatRes_ConstantFP(cast<ConstantFPSDNode>(N));        break; +    case ISD::EXTRACT_VECTOR_ELT: +      R = SoftenFloatRes_EXTRACT_VECTOR_ELT(N); break;      case ISD::FABS:        R = SoftenFloatRes_FABS(N); break;      case ISD::FADD:        R = SoftenFloatRes_FADD(N); break;      case ISD::FCEIL:       R = SoftenFloatRes_FCEIL(N); break; @@ -113,6 +115,13 @@ SDValue DAGTypeLegalizer::SoftenFloatRes_ConstantFP(ConstantFPSDNode *N) {                           TLI.getTypeToTransformTo(N->getValueType(0)));  } +SDValue DAGTypeLegalizer::SoftenFloatRes_EXTRACT_VECTOR_ELT(SDNode *N) { +  SDValue NewOp = BitConvertVectorToIntegerVector(N->getOperand(0)); +  return DAG.getNode(ISD::EXTRACT_VECTOR_ELT, N->getDebugLoc(), +                     NewOp.getValueType().getVectorElementType(), +                     NewOp, N->getOperand(1)); +} +  SDValue DAGTypeLegalizer::SoftenFloatRes_FABS(SDNode *N) {    MVT NVT = TLI.getTypeToTransformTo(N->getValueType(0));    unsigned Size = NVT.getSizeInBits(); diff --git a/llvm/lib/CodeGen/SelectionDAG/LegalizeTypes.cpp b/llvm/lib/CodeGen/SelectionDAG/LegalizeTypes.cpp index 28f7a4db9ca..985d3459567 100644 --- a/llvm/lib/CodeGen/SelectionDAG/LegalizeTypes.cpp +++ b/llvm/lib/CodeGen/SelectionDAG/LegalizeTypes.cpp @@ -858,6 +858,17 @@ SDValue DAGTypeLegalizer::BitConvertToInteger(SDValue Op) {                       MVT::getIntegerVT(BitWidth), Op);  } +/// BitConvertVectorToIntegerVector - Convert to a vector of integers of the +/// same size. +SDValue DAGTypeLegalizer::BitConvertVectorToIntegerVector(SDValue Op) { +  assert(Op.getValueType().isVector() && "Only applies to vectors!"); +  unsigned EltWidth = Op.getValueType().getVectorElementType().getSizeInBits(); +  MVT EltNVT = MVT::getIntegerVT(EltWidth); +  unsigned NumElts = Op.getValueType().getVectorNumElements(); +  return DAG.getNode(ISD::BIT_CONVERT, Op.getDebugLoc(), +                     MVT::getVectorVT(EltNVT, NumElts), Op); +} +  SDValue DAGTypeLegalizer::CreateStackStoreLoad(SDValue Op,                                                 MVT DestVT) {    DebugLoc dl = Op.getDebugLoc(); diff --git a/llvm/lib/CodeGen/SelectionDAG/LegalizeTypes.h b/llvm/lib/CodeGen/SelectionDAG/LegalizeTypes.h index 0cceafc0b0a..25fa4a70d4a 100644 --- a/llvm/lib/CodeGen/SelectionDAG/LegalizeTypes.h +++ b/llvm/lib/CodeGen/SelectionDAG/LegalizeTypes.h @@ -190,6 +190,7 @@ private:    // Common routines.    SDValue BitConvertToInteger(SDValue Op); +  SDValue BitConvertVectorToIntegerVector(SDValue Op);    SDValue CreateStackStoreLoad(SDValue Op, MVT DestVT);    bool CustomLowerResults(SDNode *N, MVT VT, bool LegalizeResult);    SDValue GetVectorElementPointer(SDValue VecPtr, MVT EltVT, SDValue Index); @@ -392,6 +393,7 @@ private:    SDValue SoftenFloatRes_BIT_CONVERT(SDNode *N);    SDValue SoftenFloatRes_BUILD_PAIR(SDNode *N);    SDValue SoftenFloatRes_ConstantFP(ConstantFPSDNode *N); +  SDValue SoftenFloatRes_EXTRACT_VECTOR_ELT(SDNode *N);    SDValue SoftenFloatRes_FABS(SDNode *N);    SDValue SoftenFloatRes_FADD(SDNode *N);    SDValue SoftenFloatRes_FCEIL(SDNode *N); | 

