@@ -1713,24 +1713,23 @@ bool MipsAsmParser::expandLoadImm(MCInst &Inst, SMLoc IDLoc,
1713
1713
// FIXME: gas has a special case for values that are 000...1111, which
1714
1714
// becomes a li -1 and then a dsrl
1715
1715
if (0 <= ImmValue && ImmValue <= 65535 ) {
1716
- // For 0 <= j <= 65535.
1716
+ // For unsigned and positive signed 16-bit values ( 0 <= j <= 65535):
1717
1717
// li d,j => ori d,$zero,j
1718
1718
tmpInst.setOpcode (Mips::ORi);
1719
1719
tmpInst.addOperand (MCOperand::CreateReg (RegOp.getReg ()));
1720
1720
tmpInst.addOperand (MCOperand::CreateReg (Mips::ZERO));
1721
1721
tmpInst.addOperand (MCOperand::CreateImm (ImmValue));
1722
1722
Instructions.push_back (tmpInst);
1723
1723
} else if (ImmValue < 0 && ImmValue >= -32768 ) {
1724
- // For - 32768 <= j < 0.
1724
+ // For negative signed 16-bit values (- 32768 <= j < 0):
1725
1725
// li d,j => addiu d,$zero,j
1726
1726
tmpInst.setOpcode (Mips::ADDiu);
1727
1727
tmpInst.addOperand (MCOperand::CreateReg (RegOp.getReg ()));
1728
1728
tmpInst.addOperand (MCOperand::CreateReg (Mips::ZERO));
1729
1729
tmpInst.addOperand (MCOperand::CreateImm (ImmValue));
1730
1730
Instructions.push_back (tmpInst);
1731
1731
} else if ((ImmValue & 0xffffffff ) == ImmValue) {
1732
- // For any value of j that is representable as a 32-bit integer, create
1733
- // a sequence of:
1732
+ // For all other values which are representable as a 32-bit integer:
1734
1733
// li d,j => lui d,hi16(j)
1735
1734
// ori d,d,lo16(j)
1736
1735
tmpInst.setOpcode (Mips::LUi);
@@ -1752,8 +1751,7 @@ bool MipsAsmParser::expandLoadImm(MCInst &Inst, SMLoc IDLoc,
1752
1751
// | 16-bytes | 16-bytes | 16-bytes |
1753
1752
// |__________|__________|__________|
1754
1753
//
1755
- // For any value of j that is representable as a 48-bit integer, create
1756
- // a sequence of:
1754
+ // For any 64-bit value that is representable as a 48-bit integer:
1757
1755
// li d,j => lui d,hi16(j)
1758
1756
// ori d,d,hi16(lo32(j))
1759
1757
// dsll d,d,16
@@ -1778,7 +1776,7 @@ bool MipsAsmParser::expandLoadImm(MCInst &Inst, SMLoc IDLoc,
1778
1776
// | 16-bytes | 16-bytes | 16-bytes | 16-bytes |
1779
1777
// |__________|__________|__________|__________|
1780
1778
//
1781
- // For any value of j that isn't representable as a 48 -bit integer.
1779
+ // For all other values which are representable as a 64 -bit integer:
1782
1780
// li d,j => lui d,hi16(j)
1783
1781
// ori d,d,lo16(hi32(j))
1784
1782
// dsll d,d,16
0 commit comments