[Hexagon] Using multiply instead of shift on signed number which can be UB
authorColin LeMahieu <colinl@codeaurora.org>
Fri, 4 Dec 2015 15:48:45 +0000 (15:48 +0000)
committerColin LeMahieu <colinl@codeaurora.org>
Fri, 4 Dec 2015 15:48:45 +0000 (15:48 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@254719 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Target/Hexagon/AsmParser/HexagonAsmParser.cpp

index 5e78762b994af21d27f5ea93e11103db88796d7b..64050824c10bd6066f2aa97ffb75372bfb589e98 100644 (file)
@@ -554,13 +554,13 @@ public:
   void adds4_6ImmOperands(MCInst &Inst, unsigned N) const {
     assert(N == 1 && "Invalid number of operands!");
     const MCConstantExpr *CE = dyn_cast<MCConstantExpr>(getImm());
   void adds4_6ImmOperands(MCInst &Inst, unsigned N) const {
     assert(N == 1 && "Invalid number of operands!");
     const MCConstantExpr *CE = dyn_cast<MCConstantExpr>(getImm());
-    Inst.addOperand(MCOperand::createImm(CE->getValue() << 6));
+    Inst.addOperand(MCOperand::createImm(CE->getValue() * 64));
   }
 
   void adds3_6ImmOperands(MCInst &Inst, unsigned N) const {
     assert(N == 1 && "Invalid number of operands!");
     const MCConstantExpr *CE = dyn_cast<MCConstantExpr>(getImm());
   }
 
   void adds3_6ImmOperands(MCInst &Inst, unsigned N) const {
     assert(N == 1 && "Invalid number of operands!");
     const MCConstantExpr *CE = dyn_cast<MCConstantExpr>(getImm());
-    Inst.addOperand(MCOperand::createImm(CE->getValue() << 6));
+    Inst.addOperand(MCOperand::createImm(CE->getValue() * 64));
   }
 
   StringRef getToken() const {
   }
 
   StringRef getToken() const {