summaryrefslogtreecommitdiffstats
path: root/llvm/lib/CodeGen/SelectionDAG/LegalizeVectorOps.cpp
diff options
context:
space:
mode:
authorSimon Pilgrim <llvm-dev@redking.me.uk>2016-11-21 18:24:44 +0000
committerSimon Pilgrim <llvm-dev@redking.me.uk>2016-11-21 18:24:44 +0000
commit5662074ba345b2668b4bbf8c7b8c57b3a8ec3023 (patch)
tree18b52a2133b8dd1f144c7c2ea4e9424f3b9abb78 /llvm/lib/CodeGen/SelectionDAG/LegalizeVectorOps.cpp
parentbe939b3ff6aba44ff8d760852a24e39a0f70d084 (diff)
downloadbcm5719-llvm-5662074ba345b2668b4bbf8c7b8c57b3a8ec3023.tar.gz
bcm5719-llvm-5662074ba345b2668b4bbf8c7b8c57b3a8ec3023.zip
[VectorLegalizer] Remove EVT::getSizeInBits code duplications. NFCI.
We were calling SVT.getSizeInBits() several times in a row - just call it once and reuse the result. llvm-svn: 287556
Diffstat (limited to 'llvm/lib/CodeGen/SelectionDAG/LegalizeVectorOps.cpp')
-rw-r--r--llvm/lib/CodeGen/SelectionDAG/LegalizeVectorOps.cpp14
1 files changed, 6 insertions, 8 deletions
diff --git a/llvm/lib/CodeGen/SelectionDAG/LegalizeVectorOps.cpp b/llvm/lib/CodeGen/SelectionDAG/LegalizeVectorOps.cpp
index 72d26261136..8eba6a311b2 100644
--- a/llvm/lib/CodeGen/SelectionDAG/LegalizeVectorOps.cpp
+++ b/llvm/lib/CodeGen/SelectionDAG/LegalizeVectorOps.cpp
@@ -982,21 +982,20 @@ SDValue VectorLegalizer::ExpandUINT_TO_FLOAT(SDValue Op) {
TLI.getOperationAction(ISD::SRL, VT) == TargetLowering::Expand)
return DAG.UnrollVectorOp(Op.getNode());
- EVT SVT = VT.getScalarType();
- assert((SVT.getSizeInBits() == 64 || SVT.getSizeInBits() == 32) &&
- "Elements in vector-UINT_TO_FP must be 32 or 64 bits wide");
+ unsigned BW = VT.getScalarSizeInBits();
+ assert((BW == 64 || BW == 32) &&
+ "Elements in vector-UINT_TO_FP must be 32 or 64 bits wide");
- unsigned BW = SVT.getSizeInBits();
- SDValue HalfWord = DAG.getConstant(BW/2, DL, VT);
+ SDValue HalfWord = DAG.getConstant(BW / 2, DL, VT);
// Constants to clear the upper part of the word.
// Notice that we can also use SHL+SHR, but using a constant is slightly
// faster on x86.
- uint64_t HWMask = (SVT.getSizeInBits()==64)?0x00000000FFFFFFFF:0x0000FFFF;
+ uint64_t HWMask = (BW == 64) ? 0x00000000FFFFFFFF : 0x0000FFFF;
SDValue HalfWordMask = DAG.getConstant(HWMask, DL, VT);
// Two to the power of half-word-size.
- SDValue TWOHW = DAG.getConstantFP(1 << (BW/2), DL, Op.getValueType());
+ SDValue TWOHW = DAG.getConstantFP(1 << (BW / 2), DL, Op.getValueType());
// Clear upper part of LO, lower HI
SDValue HI = DAG.getNode(ISD::SRL, DL, VT, Op.getOperand(0), HalfWord);
@@ -1013,7 +1012,6 @@ SDValue VectorLegalizer::ExpandUINT_TO_FLOAT(SDValue Op) {
return DAG.getNode(ISD::FADD, DL, Op.getValueType(), fHI, fLO);
}
-
SDValue VectorLegalizer::ExpandFNEG(SDValue Op) {
if (TLI.isOperationLegalOrCustom(ISD::FSUB, Op.getValueType())) {
SDLoc DL(Op);
OpenPOWER on IntegriCloud