1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-21 12:02:58 +02:00

[mips] [IAS] Slightly improve shift instruction generation in expandLoadImm.

Summary:
Generate one DSLL32 of 0 instead of two consecutive DSLL of 16.
In order to do this I had to change createLShiftOri's template argument from a bool to an unsigned.

This also gave me the opportunity to rewrite the mips64-expansions.s test, as it was testing the same cases multiple times and skipping over other cases.
It was also somewhat unreadable, as the CHECK lines were grouped in a huge block of text at the beginning of the file.

Reviewers: dsanders

Reviewed By: dsanders

Subscribers: llvm-commits

Differential Revision: http://reviews.llvm.org/D8974

llvm-svn: 236311
This commit is contained in:
Toma Tabacu 2015-05-01 10:26:47 +00:00
parent eb80927c6c
commit a7771fd9f0
2 changed files with 212 additions and 226 deletions

View File

@ -1632,15 +1632,23 @@ bool MipsAsmParser::expandInstruction(MCInst &Inst, SMLoc IDLoc,
}
namespace {
template <bool PerformShift>
template <unsigned ShiftAmount>
void createLShiftOri(MCOperand Operand, unsigned RegNo, SMLoc IDLoc,
SmallVectorImpl<MCInst> &Instructions) {
SmallVectorImpl<MCInst> &Instructions) {
MCInst tmpInst;
if (PerformShift) {
if (ShiftAmount >= 32) {
tmpInst.setOpcode(Mips::DSLL32);
tmpInst.addOperand(MCOperand::CreateReg(RegNo));
tmpInst.addOperand(MCOperand::CreateReg(RegNo));
tmpInst.addOperand(MCOperand::CreateImm(ShiftAmount - 32));
tmpInst.setLoc(IDLoc);
Instructions.push_back(tmpInst);
tmpInst.clear();
} else if (ShiftAmount > 0) {
tmpInst.setOpcode(Mips::DSLL);
tmpInst.addOperand(MCOperand::CreateReg(RegNo));
tmpInst.addOperand(MCOperand::CreateReg(RegNo));
tmpInst.addOperand(MCOperand::CreateImm(16));
tmpInst.addOperand(MCOperand::CreateImm(ShiftAmount));
tmpInst.setLoc(IDLoc);
Instructions.push_back(tmpInst);
tmpInst.clear();
@ -1657,11 +1665,11 @@ void createLShiftOri(MCOperand Operand, unsigned RegNo, SMLoc IDLoc,
Instructions.push_back(tmpInst);
}
template <bool PerformShift>
template <unsigned ShiftAmount>
void createLShiftOri(int64_t Value, unsigned RegNo, SMLoc IDLoc,
SmallVectorImpl<MCInst> &Instructions) {
createLShiftOri<PerformShift>(MCOperand::CreateImm(Value), RegNo, IDLoc,
Instructions);
SmallVectorImpl<MCInst> &Instructions) {
createLShiftOri<ShiftAmount>(MCOperand::CreateImm(Value), RegNo, IDLoc,
Instructions);
}
}
@ -1747,7 +1755,7 @@ bool MipsAsmParser::expandLoadImm(MCInst &Inst, SMLoc IDLoc,
tmpInst.addOperand(MCOperand::CreateReg(Reg));
tmpInst.addOperand(MCOperand::CreateImm(Bits31To16));
Instructions.push_back(tmpInst);
createLShiftOri<false>(Bits15To0, Reg, IDLoc, Instructions);
createLShiftOri<0>(Bits15To0, Reg, IDLoc, Instructions);
} else if ((ImmValue & (0xffffLL << 48)) == 0) {
if (!isGP64bit()) {
Error(IDLoc, "instruction requires a 64-bit architecture");
@ -1775,8 +1783,8 @@ bool MipsAsmParser::expandLoadImm(MCInst &Inst, SMLoc IDLoc,
tmpInst.addOperand(MCOperand::CreateReg(Reg));
tmpInst.addOperand(MCOperand::CreateImm(Bits47To32));
Instructions.push_back(tmpInst);
createLShiftOri<false>(Bits31To16, Reg, IDLoc, Instructions);
createLShiftOri<true>(Bits15To0, Reg, IDLoc, Instructions);
createLShiftOri<0>(Bits31To16, Reg, IDLoc, Instructions);
createLShiftOri<16>(Bits15To0, Reg, IDLoc, Instructions);
} else {
if (!isGP64bit()) {
Error(IDLoc, "instruction requires a 64-bit architecture");
@ -1806,9 +1814,16 @@ bool MipsAsmParser::expandLoadImm(MCInst &Inst, SMLoc IDLoc,
tmpInst.addOperand(MCOperand::CreateReg(Reg));
tmpInst.addOperand(MCOperand::CreateImm(Bits63To48));
Instructions.push_back(tmpInst);
createLShiftOri<false>(Bits47To32, Reg, IDLoc, Instructions);
createLShiftOri<true>(Bits31To16, Reg, IDLoc, Instructions);
createLShiftOri<true>(Bits15To0, Reg, IDLoc, Instructions);
createLShiftOri<0>(Bits47To32, Reg, IDLoc, Instructions);
// When Bits31To16 is 0, do a left shift of 32 bits instead of doing
// two left shifts of 16 bits.
if (Bits31To16 == 0) {
createLShiftOri<32>(Bits15To0, Reg, IDLoc, Instructions);
} else {
createLShiftOri<16>(Bits31To16, Reg, IDLoc, Instructions);
createLShiftOri<16>(Bits15To0, Reg, IDLoc, Instructions);
}
}
return false;
}
@ -1947,11 +1962,11 @@ MipsAsmParser::expandLoadAddressSym(MCInst &Inst, SMLoc IDLoc,
tmpInst.addOperand(MCOperand::CreateExpr(HighestExpr));
Instructions.push_back(tmpInst);
createLShiftOri<false>(MCOperand::CreateExpr(HigherExpr), RegNo, SMLoc(),
Instructions);
createLShiftOri<true>(MCOperand::CreateExpr(HiExpr), RegNo, SMLoc(),
createLShiftOri<0>(MCOperand::CreateExpr(HigherExpr), RegNo, SMLoc(),
Instructions);
createLShiftOri<16>(MCOperand::CreateExpr(HiExpr), RegNo, SMLoc(),
Instructions);
createLShiftOri<true>(MCOperand::CreateExpr(LoExpr), RegNo, SMLoc(),
createLShiftOri<16>(MCOperand::CreateExpr(LoExpr), RegNo, SMLoc(),
Instructions);
} else {
// Otherwise, expand to:
@ -1962,8 +1977,8 @@ MipsAsmParser::expandLoadAddressSym(MCInst &Inst, SMLoc IDLoc,
tmpInst.addOperand(MCOperand::CreateExpr(HiExpr));
Instructions.push_back(tmpInst);
createLShiftOri<false>(MCOperand::CreateExpr(LoExpr), RegNo, SMLoc(),
Instructions);
createLShiftOri<0>(MCOperand::CreateExpr(LoExpr), RegNo, SMLoc(),
Instructions);
}
}

View File

@ -1,209 +1,180 @@
# RUN: llvm-mc %s -triple=mips64el-unknown-linux -show-encoding -mcpu=mips64r2 | FileCheck %s
#
# The GNU assembler implements 'dli' and 'dla' variants on 'li' and 'la'
# supporting double-word lengths. Test that not only are they present, bu
# that they also seem to handle 64-bit values.
#
# XXXRW: Does using powers of ten make me a bad person?
#
# CHECK: ori $12, $zero, 1 # encoding: [0x01,0x00,0x0c,0x34]
# CHECK: ori $12, $zero, 10 # encoding: [0x0a,0x00,0x0c,0x34]
# CHECK: ori $12, $zero, 100 # encoding: [0x64,0x00,0x0c,0x34]
# CHECK: ori $12, $zero, 1000 # encoding: [0xe8,0x03,0x0c,0x34]
# CHECK: ori $12, $zero, 10000 # encoding: [0x10,0x27,0x0c,0x34]
# CHECK: lui $12, 1 # encoding: [0x01,0x00,0x0c,0x3c]
# CHECK: ori $12, $12, 34464 # encoding: [0xa0,0x86,0x8c,0x35]
# CHECK: lui $12, 15 # encoding: [0x0f,0x00,0x0c,0x3c]
# CHECK: ori $12, $12, 16960 # encoding: [0x40,0x42,0x8c,0x35]
# CHECK: lui $12, 152 # encoding: [0x98,0x00,0x0c,0x3c]
# CHECK: ori $12, $12, 38528 # encoding: [0x80,0x96,0x8c,0x35]
# CHECK: lui $12, 1525 # encoding: [0xf5,0x05,0x0c,0x3c]
# CHECK: ori $12, $12, 57600 # encoding: [0x00,0xe1,0x8c,0x35]
# CHECK: lui $12, 15258 # encoding: [0x9a,0x3b,0x0c,0x3c]
# CHECK: ori $12, $12, 51712 # encoding: [0x00,0xca,0x8c,0x35]
# CHECK: lui $12, 2 # encoding: [0x02,0x00,0x0c,0x3c]
# CHECK: ori $12, $12, 21515 # encoding: [0x0b,0x54,0x8c,0x35]
# CHECK: dsll $12, $12, 16 # encoding: [0x38,0x64,0x0c,0x00]
# CHECK: ori $12, $12, 58368 # encoding: [0x00,0xe4,0x8c,0x35]
# CHECK: lui $12, 23 # encoding: [0x17,0x00,0x0c,0x3c]
# CHECK: ori $12, $12, 18550 # encoding: [0x76,0x48,0x8c,0x35]
# CHECK: dsll $12, $12, 16 # encoding: [0x38,0x64,0x0c,0x00]
# CHECK: ori $12, $12, 59392 # encoding: [0x00,0xe8,0x8c,0x35]
# CHECK: lui $12, 232 # encoding: [0xe8,0x00,0x0c,0x3c]
# CHECK: ori $12, $12, 54437 # encoding: [0xa5,0xd4,0x8c,0x35]
# CHECK: dsll $12, $12, 16 # encoding: [0x38,0x64,0x0c,0x00]
# CHECK: ori $12, $12, 4096 # encoding: [0x00,0x10,0x8c,0x35]
# CHECK: lui $12, 2328 # encoding: [0x18,0x09,0x0c,0x3c]
# CHECK: ori $12, $12, 20082 # encoding: [0x72,0x4e,0x8c,0x35]
# CHECK: dsll $12, $12, 16 # encoding: [0x38,0x64,0x0c,0x00]
# CHECK: ori $12, $12, 40960 # encoding: [0x00,0xa0,0x8c,0x35]
# CHECK: lui $12, 23283 # encoding: [0xf3,0x5a,0x0c,0x3c]
# CHECK: ori $12, $12, 4218 # encoding: [0x7a,0x10,0x8c,0x35]
# CHECK: dsll $12, $12, 16 # encoding: [0x38,0x64,0x0c,0x00]
# CHECK: ori $12, $12, 16384 # encoding: [0x00,0x40,0x8c,0x35]
# CHECK: lui $12, 3 # encoding: [0x03,0x00,0x0c,0x3c]
# CHECK: ori $12, $12, 36222 # encoding: [0x7e,0x8d,0x8c,0x35]
# CHECK: dsll $12, $12, 16 # encoding: [0x38,0x64,0x0c,0x00]
# CHECK: ori $12, $12, 42182 # encoding: [0xc6,0xa4,0x8c,0x35]
# CHECK: dsll $12, $12, 16 # encoding: [0x38,0x64,0x0c,0x00]
# CHECK: ori $12, $12, 32768 # encoding: [0x00,0x80,0x8c,0x35]
# CHECK: lui $12, 35 # encoding: [0x23,0x00,0x0c,0x3c]
# CHECK: ori $12, $12, 34546 # encoding: [0xf2,0x86,0x8c,0x35]
# CHECK: dsll $12, $12, 16 # encoding: [0x38,0x64,0x0c,0x00]
# CHECK: ori $12, $12, 28609 # encoding: [0xc1,0x6f,0x8c,0x35]
# CHECK: dsll $12, $12, 16 # encoding: [0x38,0x64,0x0c,0x00]
# CHECK-NOT: ori $12, $12, 0 # encoding: [0x00,0x00,0x8c,0x35]
# CHECK: lui $12, 355 # encoding: [0x63,0x01,0x0c,0x3c]
# CHECK: ori $12, $12, 17784 # encoding: [0x78,0x45,0x8c,0x35]
# CHECK: dsll $12, $12, 16 # encoding: [0x38,0x64,0x0c,0x00]
# CHECK: ori $12, $12, 23946 # encoding: [0x8a,0x5d,0x8c,0x35]
# CHECK: dsll $12, $12, 16 # encoding: [0x38,0x64,0x0c,0x00]
# CHECK-NOT: ori $12, $12, 0 # encoding: [0x00,0x00,0x8c,0x35]
# CHECK: lui $12, 3552 # encoding: [0xe0,0x0d,0x0c,0x3c]
# CHECK: ori $12, $12, 46771 # encoding: [0xb3,0xb6,0x8c,0x35]
# CHECK: dsll $12, $12, 16 # encoding: [0x38,0x64,0x0c,0x00]
# CHECK: ori $12, $12, 42852 # encoding: [0x64,0xa7,0x8c,0x35]
# CHECK: dsll $12, $12, 16 # encoding: [0x38,0x64,0x0c,0x00]
# CHECK-NOT: ori $12, $12, 0 # encoding: [0x00,0x00,0x8c,0x35]
# CHECK: lui $12, 35527 # encoding: [0xc7,0x8a,0x0c,0x3c]
# CHECK: ori $12, $12, 8964 # encoding: [0x04,0x23,0x8c,0x35]
# CHECK: dsll $12, $12, 16 # encoding: [0x38,0x64,0x0c,0x00]
# CHECK: ori $12, $12, 35304 # encoding: [0xe8,0x89,0x8c,0x35]
# CHECK: dsll $12, $12, 16 # encoding: [0x38,0x64,0x0c,0x00]
# CHECK-NOT: ori $12, $12, 0 # encoding: [0x00,0x00,0x8c,0x35]
# CHECK: addiu $12, $zero, -1 # encoding: [0xff,0xff,0x0c,0x24]
# CHECK: addiu $12, $zero, -10 # encoding: [0xf6,0xff,0x0c,0x24]
# CHECK: addiu $12, $zero, -100 # encoding: [0x9c,0xff,0x0c,0x24]
# CHECK: addiu $12, $zero, -1000 # encoding: [0x18,0xfc,0x0c,0x24]
# CHECK: addiu $12, $zero, -10000 # encoding: [0xf0,0xd8,0x0c,0x24]
# CHECK: lui $12, 65535 # encoding: [0xff,0xff,0x0c,0x3c]
# CHECK: ori $12, $12, 65535 # encoding: [0xff,0xff,0x8c,0x35]
# CHECK: dsll $12, $12, 16 # encoding: [0x38,0x64,0x0c,0x00]
# CHECK: ori $12, $12, 65534 # encoding: [0xfe,0xff,0x8c,0x35]
# CHECK: dsll $12, $12, 16 # encoding: [0x38,0x64,0x0c,0x00]
# CHECK: ori $12, $12, 31072 # encoding: [0x60,0x79,0x8c,0x35]
# CHECK: lui $12, 65535 # encoding: [0xff,0xff,0x0c,0x3c]
# CHECK: ori $12, $12, 65535 # encoding: [0xff,0xff,0x8c,0x35]
# CHECK: dsll $12, $12, 16 # encoding: [0x38,0x64,0x0c,0x00]
# CHECK: ori $12, $12, 65520 # encoding: [0xf0,0xff,0x8c,0x35]
# CHECK: dsll $12, $12, 16 # encoding: [0x38,0x64,0x0c,0x00]
# CHECK: ori $12, $12, 48576 # encoding: [0xc0,0xbd,0x8c,0x35]
# CHECK: lui $12, 65535 # encoding: [0xff,0xff,0x0c,0x3c]
# CHECK: ori $12, $12, 65535 # encoding: [0xff,0xff,0x8c,0x35]
# CHECK: dsll $12, $12, 16 # encoding: [0x38,0x64,0x0c,0x00]
# CHECK: ori $12, $12, 65383 # encoding: [0x67,0xff,0x8c,0x35]
# CHECK: dsll $12, $12, 16 # encoding: [0x38,0x64,0x0c,0x00]
# CHECK: ori $12, $12, 27008 # encoding: [0x80,0x69,0x8c,0x35]
# CHECK: lui $12, 65535 # encoding: [0xff,0xff,0x0c,0x3c]
# CHECK: ori $12, $12, 65535 # encoding: [0xff,0xff,0x8c,0x35]
# CHECK: dsll $12, $12, 16 # encoding: [0x38,0x64,0x0c,0x00]
# CHECK: ori $12, $12, 64010 # encoding: [0x0a,0xfa,0x8c,0x35]
# CHECK: dsll $12, $12, 16 # encoding: [0x38,0x64,0x0c,0x00]
# CHECK: ori $12, $12, 7936 # encoding: [0x00,0x1f,0x8c,0x35]
# CHECK: lui $12, 65535 # encoding: [0xff,0xff,0x0c,0x3c]
# CHECK: ori $12, $12, 65535 # encoding: [0xff,0xff,0x8c,0x35]
# CHECK: dsll $12, $12, 16 # encoding: [0x38,0x64,0x0c,0x00]
# CHECK: ori $12, $12, 50277 # encoding: [0x65,0xc4,0x8c,0x35]
# CHECK: dsll $12, $12, 16 # encoding: [0x38,0x64,0x0c,0x00]
# CHECK: ori $12, $12, 13824 # encoding: [0x00,0x36,0x8c,0x35]
# CHECK: lui $12, 65535 # encoding: [0xff,0xff,0x0c,0x3c]
# CHECK: ori $12, $12, 65533 # encoding: [0xfd,0xff,0x8c,0x35]
# CHECK: dsll $12, $12, 16 # encoding: [0x38,0x64,0x0c,0x00]
# CHECK: ori $12, $12, 44020 # encoding: [0xf4,0xab,0x8c,0x35]
# CHECK: dsll $12, $12, 16 # encoding: [0x38,0x64,0x0c,0x00]
# CHECK: ori $12, $12, 7168 # encoding: [0x00,0x1c,0x8c,0x35]
# CHECK: lui $12, 65535 # encoding: [0xff,0xff,0x0c,0x3c]
# CHECK: ori $12, $12, 65512 # encoding: [0xe8,0xff,0x8c,0x35]
# CHECK: dsll $12, $12, 16 # encoding: [0x38,0x64,0x0c,0x00]
# CHECK: ori $12, $12, 46985 # encoding: [0x89,0xb7,0x8c,0x35]
# CHECK: dsll $12, $12, 16 # encoding: [0x38,0x64,0x0c,0x00]
# CHECK: ori $12, $12, 6144 # encoding: [0x00,0x18,0x8c,0x35]
# CHECK: lui $12, 65535 # encoding: [0xff,0xff,0x0c,0x3c]
# CHECK: ori $12, $12, 65303 # encoding: [0x17,0xff,0x8c,0x35]
# CHECK: dsll $12, $12, 16 # encoding: [0x38,0x64,0x0c,0x00]
# CHECK: ori $12, $12, 11098 # encoding: [0x5a,0x2b,0x8c,0x35]
# CHECK: dsll $12, $12, 16 # encoding: [0x38,0x64,0x0c,0x00]
# CHECK: ori $12, $12, 61440 # encoding: [0x00,0xf0,0x8c,0x35]
# CHECK: lui $12, 65535 # encoding: [0xff,0xff,0x0c,0x3c]
# CHECK: ori $12, $12, 63207 # encoding: [0xe7,0xf6,0x8c,0x35]
# CHECK: dsll $12, $12, 16 # encoding: [0x38,0x64,0x0c,0x00]
# CHECK: ori $12, $12, 45453 # encoding: [0x8d,0xb1,0x8c,0x35]
# CHECK: dsll $12, $12, 16 # encoding: [0x38,0x64,0x0c,0x00]
# CHECK: ori $12, $12, 24576 # encoding: [0x00,0x60,0x8c,0x35]
# CHECK: lui $12, 65535 # encoding: [0xff,0xff,0x0c,0x3c]
# CHECK: ori $12, $12, 42252 # encoding: [0x0c,0xa5,0x8c,0x35]
# CHECK: dsll $12, $12, 16 # encoding: [0x38,0x64,0x0c,0x00]
# CHECK: ori $12, $12, 61317 # encoding: [0x85,0xef,0x8c,0x35]
# CHECK: dsll $12, $12, 16 # encoding: [0x38,0x64,0x0c,0x00]
# CHECK: ori $12, $12, 49152 # encoding: [0x00,0xc0,0x8c,0x35]
# CHECK: lui $12, 65532 # encoding: [0xfc,0xff,0x0c,0x3c]
# CHECK: ori $12, $12, 29313 # encoding: [0x81,0x72,0x8c,0x35]
# CHECK: dsll $12, $12, 16 # encoding: [0x38,0x64,0x0c,0x00]
# CHECK: ori $12, $12, 23353 # encoding: [0x39,0x5b,0x8c,0x35]
# CHECK: dsll $12, $12, 16 # encoding: [0x38,0x64,0x0c,0x00]
# CHECK: ori $12, $12, 32768 # encoding: [0x00,0x80,0x8c,0x35]
# CHECK: lui $12, 65500 # encoding: [0xdc,0xff,0x0c,0x3c]
# CHECK: ori $12, $12, 30989 # encoding: [0x0d,0x79,0x8c,0x35]
# CHECK: dsll $12, $12, 16 # encoding: [0x38,0x64,0x0c,0x00]
# CHECK: ori $12, $12, 36927 # encoding: [0x3f,0x90,0x8c,0x35]
# CHECK: dsll $12, $12, 16 # encoding: [0x38,0x64,0x0c,0x00]
# CHECK-NOT: ori $12, $12, 0 # encoding: [0x00,0x00,0x8c,0x35]
# CHECK: lui $12, 65180 # encoding: [0x9c,0xfe,0x0c,0x3c]
# CHECK: ori $12, $12, 47751 # encoding: [0x87,0xba,0x8c,0x35]
# CHECK: dsll $12, $12, 16 # encoding: [0x38,0x64,0x0c,0x00]
# CHECK: ori $12, $12, 41590 # encoding: [0x76,0xa2,0x8c,0x35]
# CHECK: dsll $12, $12, 16 # encoding: [0x38,0x64,0x0c,0x00]
# CHECK-NOT: ori $12, $12, 0 # encoding: [0x00,0x00,0x8c,0x35]
# CHECK: lui $12, 61983 # encoding: [0x1f,0xf2,0x0c,0x3c]
# CHECK: ori $12, $12, 18764 # encoding: [0x4c,0x49,0x8c,0x35]
# CHECK: dsll $12, $12, 16 # encoding: [0x38,0x64,0x0c,0x00]
# CHECK: ori $12, $12, 22684 # encoding: [0x9c,0x58,0x8c,0x35]
# CHECK: dsll $12, $12, 16 # encoding: [0x38,0x64,0x0c,0x00]
# CHECK-NOT: ori $12, $12, 0 # encoding: [0x00,0x00,0x8c,0x35]
# CHECK: lui $12, 30008 # encoding: [0x38,0x75,0x0c,0x3c]
# CHECK: ori $12, $12, 56571 # encoding: [0xfb,0xdc,0x8c,0x35]
# CHECK: dsll $12, $12, 16 # encoding: [0x38,0x64,0x0c,0x00]
# CHECK: ori $12, $12, 30232 # encoding: [0x18,0x76,0x8c,0x35]
# CHECK: dsll $12, $12, 16 # encoding: [0x38,0x64,0x0c,0x00]
# CHECK-NOT: ori $12, $12, 0 # encoding: [0x00,0x00,0x8c,0x35]
# Test the 'dli' and 'dla' 64-bit variants of 'li' and 'la'.
dli $t0, 1
dli $t0, 10
dli $t0, 100
dli $t0, 1000
dli $t0, 10000
dli $t0, 100000
dli $t0, 1000000
dli $t0, 10000000
dli $t0, 100000000
dli $t0, 1000000000
dli $t0, 10000000000
dli $t0, 100000000000
dli $t0, 1000000000000
dli $t0, 10000000000000
dli $t0, 100000000000000
dli $t0, 1000000000000000
dli $t0, 10000000000000000
dli $t0, 100000000000000000
dli $t0, 1000000000000000000
dli $t0, 10000000000000000000
dli $t0, -1
dli $t0, -10
dli $t0, -100
dli $t0, -1000
dli $t0, -10000
dli $t0, -100000
dli $t0, -1000000
dli $t0, -10000000
dli $t0, -100000000
dli $t0, -1000000000
dli $t0, -10000000000
dli $t0, -100000000000
dli $t0, -1000000000000
dli $t0, -10000000000000
dli $t0, -100000000000000
dli $t0, -1000000000000000
dli $t0, -10000000000000000
dli $t0, -100000000000000000
dli $t0, -1000000000000000000
dli $t0, -10000000000000000000
# Immediate is <= 32 bits.
dli $5, 123
# CHECK: ori $5, $zero, 123 # encoding: [0x7b,0x00,0x05,0x34]
dli $6, -2345
# CHECK: addiu $6, $zero, -2345 # encoding: [0xd7,0xf6,0x06,0x24]
dli $7, 65538
# CHECK: lui $7, 1 # encoding: [0x01,0x00,0x07,0x3c]
# CHECK: ori $7, $7, 2 # encoding: [0x02,0x00,0xe7,0x34]
dli $8, ~7
# CHECK: addiu $8, $zero, -8 # encoding: [0xf8,0xff,0x08,0x24]
dli $9, 0x10000
# CHECK: lui $9, 1 # encoding: [0x01,0x00,0x09,0x3c]
# CHECK-NOT: ori $9, $9, 0 # encoding: [0x00,0x00,0x29,0x35]
# Positive immediate which is => 32 bits and <= 48 bits.
dli $8, 0x100000000
# CHECK: lui $8, 1 # encoding: [0x01,0x00,0x08,0x3c]
# CHECK: dsll $8, $8, 16 # encoding: [0x38,0x44,0x08,0x00]
dli $8, 0x100000001
# CHECK: lui $8, 1 # encoding: [0x01,0x00,0x08,0x3c]
# CHECK: dsll $8, $8, 16 # encoding: [0x38,0x44,0x08,0x00]
# CHECK: ori $8, $8, 1 # encoding: [0x01,0x00,0x08,0x35]
dli $8, 0x100010000
# CHECK: lui $8, 1 # encoding: [0x01,0x00,0x08,0x3c]
# CHECK: ori $8, $8, 1 # encoding: [0x01,0x00,0x08,0x35]
# CHECK: dsll $8, $8, 16 # encoding: [0x38,0x44,0x08,0x00]
dli $8, 0x100010001
# CHECK: lui $8, 1 # encoding: [0x01,0x00,0x08,0x3c]
# CHECK: ori $8, $8, 1 # encoding: [0x01,0x00,0x08,0x35]
# CHECK: dsll $8, $8, 16 # encoding: [0x38,0x44,0x08,0x00]
# CHECK: ori $8, $8, 1 # encoding: [0x01,0x00,0x08,0x35]
# Positive immediate which is > 48 bits.
dli $8, 0x1000000000000
# CHECK: lui $8, 1 # encoding: [0x01,0x00,0x08,0x3c]
# CHECK: dsll32 $8, $8, 0 # encoding: [0x3c,0x40,0x08,0x00]
dli $8, 0x1000000000001
# CHECK: lui $8, 1 # encoding: [0x01,0x00,0x08,0x3c]
# CHECK: dsll32 $8, $8, 0 # encoding: [0x3c,0x40,0x08,0x00]
# CHECK: ori $8, $8, 1 # encoding: [0x01,0x00,0x08,0x35]
dli $8, 0x1000000010000
# CHECK: lui $8, 1 # encoding: [0x01,0x00,0x08,0x3c]
# CHECK: dsll $8, $8, 16 # encoding: [0x38,0x44,0x08,0x00]
# CHECK: ori $8, $8, 1 # encoding: [0x01,0x00,0x08,0x35]
# CHECK: dsll $8, $8, 16 # encoding: [0x38,0x44,0x08,0x00]
dli $8, 0x1000100000000
# CHECK: lui $8, 1 # encoding: [0x01,0x00,0x08,0x3c]
# CHECK: ori $8, $8, 1 # encoding: [0x01,0x00,0x08,0x35]
# CHECK: dsll32 $8, $8, 0 # encoding: [0x3c,0x40,0x08,0x00]
dli $8, 0x1000000010001
# CHECK: lui $8, 1 # encoding: [0x01,0x00,0x08,0x3c]
# CHECK: dsll $8, $8, 16 # encoding: [0x38,0x44,0x08,0x00]
# CHECK: ori $8, $8, 1 # encoding: [0x01,0x00,0x08,0x35]
# CHECK: dsll $8, $8, 16 # encoding: [0x38,0x44,0x08,0x00]
# CHECK: ori $8, $8, 1 # encoding: [0x01,0x00,0x08,0x35]
dli $8, 0x1000100010000
# CHECK: lui $8, 1 # encoding: [0x01,0x00,0x08,0x3c]
# CHECK: ori $8, $8, 1 # encoding: [0x01,0x00,0x08,0x35]
# CHECK: dsll $8, $8, 16 # encoding: [0x38,0x44,0x08,0x00]
# CHECK: ori $8, $8, 1 # encoding: [0x01,0x00,0x08,0x35]
# CHECK: dsll $8, $8, 16 # encoding: [0x38,0x44,0x08,0x00]
dli $8, 0x1000100000001
# CHECK: lui $8, 1 # encoding: [0x01,0x00,0x08,0x3c]
# CHECK: ori $8, $8, 1 # encoding: [0x01,0x00,0x08,0x35]
# CHECK: dsll32 $8, $8, 0 # encoding: [0x3c,0x40,0x08,0x00]
# CHECK: ori $8, $8, 1 # encoding: [0x01,0x00,0x08,0x35]
dli $8, 0x1000100010001
# CHECK: lui $8, 1 # encoding: [0x01,0x00,0x08,0x3c]
# CHECK: ori $8, $8, 1 # encoding: [0x01,0x00,0x08,0x35]
# CHECK: dsll $8, $8, 16 # encoding: [0x38,0x44,0x08,0x00]
# CHECK: ori $8, $8, 1 # encoding: [0x01,0x00,0x08,0x35]
# CHECK: dsll $8, $8, 16 # encoding: [0x38,0x44,0x08,0x00]
# CHECK: ori $8, $8, 1 # encoding: [0x01,0x00,0x08,0x35]
# Negative immediate which is => 32 bits and <= 48 bits.
dli $8, -0x100000000
# CHECK: lui $8, 65535 # encoding: [0xff,0xff,0x08,0x3c]
# CHECK: ori $8, $8, 65535 # encoding: [0xff,0xff,0x08,0x35]
# CHECK: dsll32 $8, $8, 0 # encoding: [0x3c,0x40,0x08,0x00]
dli $8, -0x100000001
# CHECK: lui $8, 65535 # encoding: [0xff,0xff,0x08,0x3c]
# CHECK: ori $8, $8, 65534 # encoding: [0xfe,0xff,0x08,0x35]
# CHECK: dsll $8, $8, 16 # encoding: [0x38,0x44,0x08,0x00]
# CHECK: ori $8, $8, 65535 # encoding: [0xff,0xff,0x08,0x35]
# CHECK: dsll $8, $8, 16 # encoding: [0x38,0x44,0x08,0x00]
# CHECK: ori $8, $8, 65535 # encoding: [0xff,0xff,0x08,0x35]
dli $8, -0x100010000
# CHECK: lui $8, 65535 # encoding: [0xff,0xff,0x08,0x3c]
# CHECK: ori $8, $8, 65534 # encoding: [0xfe,0xff,0x08,0x35]
# CHECK: dsll $8, $8, 16 # encoding: [0x38,0x44,0x08,0x00]
# CHECK: ori $8, $8, 65535 # encoding: [0xff,0xff,0x08,0x35]
# CHECK: dsll $8, $8, 16 # encoding: [0x38,0x44,0x08,0x00]
dli $8, -0x100010001
# CHECK: lui $8, 65535 # encoding: [0xff,0xff,0x08,0x3c]
# CHECK: ori $8, $8, 65534 # encoding: [0xfe,0xff,0x08,0x35]
# CHECK: dsll $8, $8, 16 # encoding: [0x38,0x44,0x08,0x00]
# CHECK: ori $8, $8, 65534 # encoding: [0xfe,0xff,0x08,0x35]
# CHECK: dsll $8, $8, 16 # encoding: [0x38,0x44,0x08,0x00]
# CHECK: ori $8, $8, 65535 # encoding: [0xff,0xff,0x08,0x35]
# Negative immediate which is > 48 bits.
dli $8, -0x1000000000000
# CHECK: lui $8, 65535 # encoding: [0xff,0xff,0x08,0x3c]
# CHECK: dsll32 $8, $8, 0 # encoding: [0x3c,0x40,0x08,0x00]
dli $8, -0x1000000000001
# CHECK: lui $8, 65534 # encoding: [0xfe,0xff,0x08,0x3c]
# CHECK: ori $8, $8, 65535 # encoding: [0xff,0xff,0x08,0x35]
# CHECK: dsll $8, $8, 16 # encoding: [0x38,0x44,0x08,0x00]
# CHECK: ori $8, $8, 65535 # encoding: [0xff,0xff,0x08,0x35]
# CHECK: dsll $8, $8, 16 # encoding: [0x38,0x44,0x08,0x00]
# CHECK: ori $8, $8, 65535 # encoding: [0xff,0xff,0x08,0x35]
dli $8, -0x1000000010000
# CHECK: lui $8, 65534 # encoding: [0xfe,0xff,0x08,0x3c]
# CHECK: ori $8, $8, 65535 # encoding: [0xff,0xff,0x08,0x35]
# CHECK: dsll $8, $8, 16 # encoding: [0x38,0x44,0x08,0x00]
# CHECK: ori $8, $8, 65535 # encoding: [0xff,0xff,0x08,0x35]
# CHECK: dsll $8, $8, 16 # encoding: [0x38,0x44,0x08,0x00]
dli $8, -0x1000100000000
# CHECK: lui $8, 65534 # encoding: [0xfe,0xff,0x08,0x3c]
# CHECK: ori $8, $8, 65535 # encoding: [0xff,0xff,0x08,0x35]
# CHECK: dsll32 $8, $8, 0 # encoding: [0x3c,0x40,0x08,0x00]
dli $8, -0x1000000010001
# CHECK: lui $8, 65534 # encoding: [0xfe,0xff,0x08,0x3c]
# CHECK: ori $8, $8, 65535 # encoding: [0xff,0xff,0x08,0x35]
# CHECK: dsll $8, $8, 16 # encoding: [0x38,0x44,0x08,0x00]
# CHECK: ori $8, $8, 65534 # encoding: [0xfe,0xff,0x08,0x35]
# CHECK: dsll $8, $8, 16 # encoding: [0x38,0x44,0x08,0x00]
# CHECK: ori $8, $8, 65535 # encoding: [0xff,0xff,0x08,0x35]
dli $8, -0x1000100010000
# CHECK: lui $8, 65534 # encoding: [0xfe,0xff,0x08,0x3c]
# CHECK: ori $8, $8, 65534 # encoding: [0xfe,0xff,0x08,0x35]
# CHECK: dsll $8, $8, 16 # encoding: [0x38,0x44,0x08,0x00]
# CHECK: ori $8, $8, 65535 # encoding: [0xff,0xff,0x08,0x35]
# CHECK: dsll $8, $8, 16 # encoding: [0x38,0x44,0x08,0x00]
dli $8, -0x1000100000001
# CHECK: lui $8, 65534 # encoding: [0xfe,0xff,0x08,0x3c]
# CHECK: ori $8, $8, 65534 # encoding: [0xfe,0xff,0x08,0x35]
# CHECK: dsll $8, $8, 16 # encoding: [0x38,0x44,0x08,0x00]
# CHECK: ori $8, $8, 65535 # encoding: [0xff,0xff,0x08,0x35]
# CHECK: dsll $8, $8, 16 # encoding: [0x38,0x44,0x08,0x00]
# CHECK: ori $8, $8, 65535 # encoding: [0xff,0xff,0x08,0x35]
dli $8, -0x1000100010001
# CHECK: lui $8, 65534 # encoding: [0xfe,0xff,0x08,0x3c]
# CHECK: ori $8, $8, 65534 # encoding: [0xfe,0xff,0x08,0x35]
# CHECK: dsll $8, $8, 16 # encoding: [0x38,0x44,0x08,0x00]
# CHECK: ori $8, $8, 65534 # encoding: [0xfe,0xff,0x08,0x35]
# CHECK: dsll $8, $8, 16 # encoding: [0x38,0x44,0x08,0x00]
# CHECK: ori $8, $8, 65535 # encoding: [0xff,0xff,0x08,0x35]