[llvm] 70582bc - Fix MSVC "result of 32-bit shift implicitly converted to 64 bits" warnings. NFCI.

Simon Pilgrim via llvm-commits llvm-commits at lists.llvm.org
Tue Sep 20 02:35:53 PDT 2022


Author: Simon Pilgrim
Date: 2022-09-20T10:35:32+01:00
New Revision: 70582bc4d3528e97882fbf5577d4f060302ff7fc

URL: https://github.com/llvm/llvm-project/commit/70582bc4d3528e97882fbf5577d4f060302ff7fc
DIFF: https://github.com/llvm/llvm-project/commit/70582bc4d3528e97882fbf5577d4f060302ff7fc.diff

LOG: Fix MSVC "result of 32-bit shift implicitly converted to 64 bits" warnings. NFCI.

Added: 
    

Modified: 
    llvm/lib/Target/Hexagon/HexagonISelLoweringHVX.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Target/Hexagon/HexagonISelLoweringHVX.cpp b/llvm/lib/Target/Hexagon/HexagonISelLoweringHVX.cpp
index f9e81a266591..c9b1572ccaa9 100755
--- a/llvm/lib/Target/Hexagon/HexagonISelLoweringHVX.cpp
+++ b/llvm/lib/Target/Hexagon/HexagonISelLoweringHVX.cpp
@@ -2283,9 +2283,9 @@ HexagonTargetLowering::emitHvxShiftRightRnd(SDValue Val, unsigned Amt,
   unsigned ShRight = Signed ? ISD::SRA : ISD::SRL;
 
   SDValue Inp = DAG.getBitcast(IntTy, Val);
-  SDValue LowBits = DAG.getConstant((1u << (Amt - 1)) - 1, dl, IntTy);
+  SDValue LowBits = DAG.getConstant((1ull << (Amt - 1)) - 1, dl, IntTy);
 
-  SDValue AmtP1 = DAG.getConstant(1u << Amt, dl, IntTy);
+  SDValue AmtP1 = DAG.getConstant(1ull << Amt, dl, IntTy);
   SDValue And = DAG.getNode(ISD::AND, dl, IntTy, {Inp, AmtP1});
   SDValue Zero = getZero(dl, IntTy, DAG);
   SDValue Bit = DAG.getSetCC(dl, PredTy, And, Zero, ISD::SETNE);
@@ -2426,13 +2426,13 @@ HexagonTargetLowering::ExpandHvxFpToInt(SDValue Op, SelectionDAG &DAG) const {
 
   auto [ExpWidth, ExpBias, FracWidth] = getIEEEProperties(InpTy);
   unsigned ElemWidth = 1 + ExpWidth + FracWidth;
-  assert(1u << (ExpWidth - 1) == 1 + ExpBias);
+  assert((1ull << (ExpWidth - 1)) == (1 + ExpBias));
 
   SDValue Inp = DAG.getBitcast(ResTy, Op0);
   SDValue Zero = getZero(dl, ResTy, DAG);
   SDValue Neg = DAG.getSetCC(dl, PredTy, Inp, Zero, ISD::SETLT);
-  SDValue M80 = DAG.getConstant(1u << (ElemWidth - 1), dl, ResTy);
-  SDValue M7F = DAG.getConstant((1u << (ElemWidth - 1)) - 1, dl, ResTy);
+  SDValue M80 = DAG.getConstant(1ull << (ElemWidth - 1), dl, ResTy);
+  SDValue M7F = DAG.getConstant((1ull << (ElemWidth - 1)) - 1, dl, ResTy);
   SDValue One = DAG.getConstant(1, dl, ResTy);
   SDValue Exp00 = DAG.getNode(ISD::SHL, dl, ResTy, {Inp, One});
   SDValue Exp01 = DAG.getNode(ISD::SUB, dl, ResTy, {Exp00, M80});


        


More information about the llvm-commits mailing list