Skip to content

Commit ae47f93

Browse files
author
Toma Tabacu
committedApr 10, 2015
[mips] [IAS] Improve comments in MipsAsmParser::expandLoadImm. NFC.
llvm-svn: 234595
1 parent 518659d commit ae47f93

File tree

1 file changed

+5
-7
lines changed

1 file changed

+5
-7
lines changed
 

‎llvm/lib/Target/Mips/AsmParser/MipsAsmParser.cpp

+5-7
Original file line numberDiff line numberDiff line change
@@ -1713,24 +1713,23 @@ bool MipsAsmParser::expandLoadImm(MCInst &Inst, SMLoc IDLoc,
17131713
// FIXME: gas has a special case for values that are 000...1111, which
17141714
// becomes a li -1 and then a dsrl
17151715
if (0 <= ImmValue && ImmValue <= 65535) {
1716-
// For 0 <= j <= 65535.
1716+
// For unsigned and positive signed 16-bit values (0 <= j <= 65535):
17171717
// li d,j => ori d,$zero,j
17181718
tmpInst.setOpcode(Mips::ORi);
17191719
tmpInst.addOperand(MCOperand::CreateReg(RegOp.getReg()));
17201720
tmpInst.addOperand(MCOperand::CreateReg(Mips::ZERO));
17211721
tmpInst.addOperand(MCOperand::CreateImm(ImmValue));
17221722
Instructions.push_back(tmpInst);
17231723
} else if (ImmValue < 0 && ImmValue >= -32768) {
1724-
// For -32768 <= j < 0.
1724+
// For negative signed 16-bit values (-32768 <= j < 0):
17251725
// li d,j => addiu d,$zero,j
17261726
tmpInst.setOpcode(Mips::ADDiu);
17271727
tmpInst.addOperand(MCOperand::CreateReg(RegOp.getReg()));
17281728
tmpInst.addOperand(MCOperand::CreateReg(Mips::ZERO));
17291729
tmpInst.addOperand(MCOperand::CreateImm(ImmValue));
17301730
Instructions.push_back(tmpInst);
17311731
} 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:
17341733
// li d,j => lui d,hi16(j)
17351734
// ori d,d,lo16(j)
17361735
tmpInst.setOpcode(Mips::LUi);
@@ -1752,8 +1751,7 @@ bool MipsAsmParser::expandLoadImm(MCInst &Inst, SMLoc IDLoc,
17521751
// | 16-bytes | 16-bytes | 16-bytes |
17531752
// |__________|__________|__________|
17541753
//
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:
17571755
// li d,j => lui d,hi16(j)
17581756
// ori d,d,hi16(lo32(j))
17591757
// dsll d,d,16
@@ -1778,7 +1776,7 @@ bool MipsAsmParser::expandLoadImm(MCInst &Inst, SMLoc IDLoc,
17781776
// | 16-bytes | 16-bytes | 16-bytes | 16-bytes |
17791777
// |__________|__________|__________|__________|
17801778
//
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:
17821780
// li d,j => lui d,hi16(j)
17831781
// ori d,d,lo16(hi32(j))
17841782
// dsll d,d,16

0 commit comments

Comments
 (0)
Please sign in to comment.