Skip to content

Commit

Permalink
[LoongArch] Don't left shift negative value (#106812)
Browse files Browse the repository at this point in the history
Fixed another UB from #106332.

Detected here https://lab.llvm.org/buildbot/#/builders/169/builds/2662
  • Loading branch information
vitalybuka authored Aug 31, 2024
1 parent 3745a2e commit 18e35d8
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions llvm/lib/Target/LoongArch/MCTargetDesc/LoongArchMatInt.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -82,9 +82,9 @@ LoongArchMatInt::InstSeq LoongArchMatInt::generateInstSeq(int64_t Val) {
TmpVal1 = Insts[1].Imm;
if (N == 3)
break;
TmpVal2 = Insts[3].Imm << 52 | TmpVal1;
TmpVal2 = static_cast<uint64_t>(Insts[3].Imm) << 52 | TmpVal1;
}
TmpVal1 |= Insts[0].Imm << 12;
TmpVal1 |= static_cast<uint64_t>(Insts[0].Imm) << 12;
break;
case LoongArch::ORI:
case LoongArch::ADDI_W:
Expand Down

0 comments on commit 18e35d8

Please sign in to comment.