@@ -1733,7 +1733,8 @@ void VectorLegalizer::ExpandUINT_TO_FLOAT(SDNode *Node,
1733
1733
bool IsStrict = Node->isStrictFPOpcode ();
1734
1734
unsigned OpNo = IsStrict ? 1 : 0 ;
1735
1735
SDValue Src = Node->getOperand (OpNo);
1736
- EVT VT = Src.getValueType ();
1736
+ EVT SrcVT = Src.getValueType ();
1737
+ EVT DstVT = Node->getValueType (0 );
1737
1738
SDLoc DL (Node);
1738
1739
1739
1740
// Attempt to expand using TargetLowering.
@@ -1747,11 +1748,11 @@ void VectorLegalizer::ExpandUINT_TO_FLOAT(SDNode *Node,
1747
1748
}
1748
1749
1749
1750
// Make sure that the SINT_TO_FP and SRL instructions are available.
1750
- if (((!IsStrict && TLI.getOperationAction (ISD::SINT_TO_FP, VT ) ==
1751
+ if (((!IsStrict && TLI.getOperationAction (ISD::SINT_TO_FP, SrcVT ) ==
1751
1752
TargetLowering::Expand) ||
1752
- (IsStrict && TLI.getOperationAction (ISD::STRICT_SINT_TO_FP, VT ) ==
1753
+ (IsStrict && TLI.getOperationAction (ISD::STRICT_SINT_TO_FP, SrcVT ) ==
1753
1754
TargetLowering::Expand)) ||
1754
- TLI.getOperationAction (ISD::SRL, VT ) == TargetLowering::Expand) {
1755
+ TLI.getOperationAction (ISD::SRL, SrcVT ) == TargetLowering::Expand) {
1755
1756
if (IsStrict) {
1756
1757
UnrollStrictFPOp (Node, Results);
1757
1758
return ;
@@ -1761,46 +1762,42 @@ void VectorLegalizer::ExpandUINT_TO_FLOAT(SDNode *Node,
1761
1762
return ;
1762
1763
}
1763
1764
1764
- unsigned BW = VT .getScalarSizeInBits ();
1765
+ unsigned BW = SrcVT .getScalarSizeInBits ();
1765
1766
assert ((BW == 64 || BW == 32 ) &&
1766
1767
" Elements in vector-UINT_TO_FP must be 32 or 64 bits wide" );
1767
1768
1768
- SDValue HalfWord = DAG.getConstant (BW / 2 , DL, VT );
1769
+ SDValue HalfWord = DAG.getConstant (BW / 2 , DL, SrcVT );
1769
1770
1770
1771
// Constants to clear the upper part of the word.
1771
1772
// Notice that we can also use SHL+SHR, but using a constant is slightly
1772
1773
// faster on x86.
1773
1774
uint64_t HWMask = (BW == 64 ) ? 0x00000000FFFFFFFF : 0x0000FFFF ;
1774
- SDValue HalfWordMask = DAG.getConstant (HWMask, DL, VT );
1775
+ SDValue HalfWordMask = DAG.getConstant (HWMask, DL, SrcVT );
1775
1776
1776
1777
// Two to the power of half-word-size.
1777
- SDValue TWOHW =
1778
- DAG.getConstantFP (1ULL << (BW / 2 ), DL, Node->getValueType (0 ));
1778
+ SDValue TWOHW = DAG.getConstantFP (1ULL << (BW / 2 ), DL, DstVT);
1779
1779
1780
1780
// Clear upper part of LO, lower HI
1781
- SDValue HI = DAG.getNode (ISD::SRL, DL, VT , Src, HalfWord);
1782
- SDValue LO = DAG.getNode (ISD::AND, DL, VT , Src, HalfWordMask);
1781
+ SDValue HI = DAG.getNode (ISD::SRL, DL, SrcVT , Src, HalfWord);
1782
+ SDValue LO = DAG.getNode (ISD::AND, DL, SrcVT , Src, HalfWordMask);
1783
1783
1784
1784
if (IsStrict) {
1785
1785
// Convert hi and lo to floats
1786
1786
// Convert the hi part back to the upper values
1787
1787
// TODO: Can any fast-math-flags be set on these nodes?
1788
- SDValue fHI = DAG.getNode (ISD::STRICT_SINT_TO_FP, DL,
1789
- {Node->getValueType (0 ), MVT::Other},
1788
+ SDValue fHI = DAG.getNode (ISD::STRICT_SINT_TO_FP, DL, {DstVT, MVT::Other},
1790
1789
{Node->getOperand (0 ), HI});
1791
- fHI = DAG.getNode (ISD::STRICT_FMUL, DL, {Node-> getValueType ( 0 ) , MVT::Other},
1790
+ fHI = DAG.getNode (ISD::STRICT_FMUL, DL, {DstVT , MVT::Other},
1792
1791
{fHI .getValue (1 ), fHI , TWOHW});
1793
- SDValue fLO = DAG.getNode (ISD::STRICT_SINT_TO_FP, DL,
1794
- {Node->getValueType (0 ), MVT::Other},
1792
+ SDValue fLO = DAG.getNode (ISD::STRICT_SINT_TO_FP, DL, {DstVT, MVT::Other},
1795
1793
{Node->getOperand (0 ), LO});
1796
1794
1797
1795
SDValue TF = DAG.getNode (ISD::TokenFactor, DL, MVT::Other, fHI .getValue (1 ),
1798
1796
fLO .getValue (1 ));
1799
1797
1800
1798
// Add the two halves
1801
1799
SDValue Result =
1802
- DAG.getNode (ISD::STRICT_FADD, DL, {Node->getValueType (0 ), MVT::Other},
1803
- {TF, fHI , fLO });
1800
+ DAG.getNode (ISD::STRICT_FADD, DL, {DstVT, MVT::Other}, {TF, fHI , fLO });
1804
1801
1805
1802
Results.push_back (Result);
1806
1803
Results.push_back (Result.getValue (1 ));
@@ -1810,13 +1807,12 @@ void VectorLegalizer::ExpandUINT_TO_FLOAT(SDNode *Node,
1810
1807
// Convert hi and lo to floats
1811
1808
// Convert the hi part back to the upper values
1812
1809
// TODO: Can any fast-math-flags be set on these nodes?
1813
- SDValue fHI = DAG.getNode (ISD::SINT_TO_FP, DL, Node-> getValueType ( 0 ) , HI);
1814
- fHI = DAG.getNode (ISD::FMUL, DL, Node-> getValueType ( 0 ) , fHI , TWOHW);
1815
- SDValue fLO = DAG.getNode (ISD::SINT_TO_FP, DL, Node-> getValueType ( 0 ) , LO);
1810
+ SDValue fHI = DAG.getNode (ISD::SINT_TO_FP, DL, DstVT , HI);
1811
+ fHI = DAG.getNode (ISD::FMUL, DL, DstVT , fHI , TWOHW);
1812
+ SDValue fLO = DAG.getNode (ISD::SINT_TO_FP, DL, DstVT , LO);
1816
1813
1817
1814
// Add the two halves
1818
- Results.push_back (
1819
- DAG.getNode (ISD::FADD, DL, Node->getValueType (0 ), fHI , fLO ));
1815
+ Results.push_back (DAG.getNode (ISD::FADD, DL, DstVT, fHI , fLO ));
1820
1816
}
1821
1817
1822
1818
SDValue VectorLegalizer::ExpandFNEG (SDNode *Node) {
0 commit comments