From 3b17c1cb31ebf88dc804f1aa6cf1c1b10f35b4fc Mon Sep 17 00:00:00 2001 From: Zoran Jovanovic Date: Mon, 28 Sep 2015 11:11:34 +0000 Subject: [PATCH] [mips] Handling of immediates bigger than 16 bits Differential Revision: http://reviews.llvm.org/D10539 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@248706 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Target/Mips/AsmParser/MipsAsmParser.cpp | 112 ++++++++ lib/Target/Mips/MipsInstrInfo.td | 3 + test/MC/Mips/instalias-imm-expanding.s | 273 ++++++++++++++++++++ 3 files changed, 388 insertions(+) create mode 100644 test/MC/Mips/instalias-imm-expanding.s diff --git a/lib/Target/Mips/AsmParser/MipsAsmParser.cpp b/lib/Target/Mips/AsmParser/MipsAsmParser.cpp index 4470baf8bff..f43e8f0fe36 100644 --- a/lib/Target/Mips/AsmParser/MipsAsmParser.cpp +++ b/lib/Target/Mips/AsmParser/MipsAsmParser.cpp @@ -202,6 +202,9 @@ class MipsAsmParser : public MCTargetAsmParser { bool expandLoadStoreMultiple(MCInst &Inst, SMLoc IDLoc, SmallVectorImpl &Instructions); + bool expandAliasImmediate(MCInst &Inst, SMLoc IDLoc, + SmallVectorImpl &Instructions); + bool expandBranchImm(MCInst &Inst, SMLoc IDLoc, SmallVectorImpl &Instructions); @@ -1883,7 +1886,31 @@ bool MipsAsmParser::needsExpansion(MCInst &Inst) { case Mips::DUDivMacro: case Mips::Ulhu: case Mips::Ulw: + case Mips::NORImm: return true; + case Mips::ADDi: + case Mips::ADDiu: + case Mips::SLTi: + case Mips::SLTiu: + if ((Inst.getNumOperands() == 3) && + Inst.getOperand(0).isReg() && + Inst.getOperand(1).isReg() && + Inst.getOperand(2).isImm()) { + int64_t ImmValue = Inst.getOperand(2).getImm(); + return !isInt<16>(ImmValue); + } + return false; + case Mips::ANDi: + case Mips::ORi: + case Mips::XORi: + if ((Inst.getNumOperands() == 3) && + Inst.getOperand(0).isReg() && + Inst.getOperand(1).isReg() && + Inst.getOperand(2).isImm()) { + int64_t ImmValue = Inst.getOperand(2).getImm(); + return !isUInt<16>(ImmValue); + } + return false; default: return false; } @@ -1957,6 +1984,15 @@ bool MipsAsmParser::expandInstruction(MCInst &Inst, SMLoc IDLoc, return expandUlhu(Inst, IDLoc, Instructions); case Mips::Ulw: return expandUlw(Inst, IDLoc, Instructions); + case Mips::ADDi: + case Mips::ADDiu: + case Mips::ANDi: + case Mips::NORImm: + case Mips::ORi: + case Mips::SLTi: + case Mips::SLTiu: + case Mips::XORi: + return expandAliasImmediate(Inst, IDLoc, Instructions); } } @@ -3125,6 +3161,82 @@ bool MipsAsmParser::expandUlw(MCInst &Inst, SMLoc IDLoc, return false; } +bool MipsAsmParser::expandAliasImmediate(MCInst &Inst, SMLoc IDLoc, + SmallVectorImpl &Instructions) { + + assert (Inst.getNumOperands() == 3 && "Invalid operand count"); + assert (Inst.getOperand(0).isReg() && + Inst.getOperand(1).isReg() && + Inst.getOperand(2).isImm() && "Invalid instruction operand."); + + unsigned ATReg = Mips::NoRegister; + unsigned FinalDstReg = Mips::NoRegister; + unsigned DstReg = Inst.getOperand(0).getReg(); + unsigned SrcReg = Inst.getOperand(1).getReg(); + int64_t ImmValue = Inst.getOperand(2).getImm(); + + bool Is32Bit = isInt<32>(ImmValue) || isUInt<32>(ImmValue); + + unsigned FinalOpcode = Inst.getOpcode(); + + if (DstReg == SrcReg) { + ATReg = getATReg(Inst.getLoc()); + if (!ATReg) + return true; + FinalDstReg = DstReg; + DstReg = ATReg; + } + + if (!loadImmediate(ImmValue, DstReg, Mips::NoRegister, Is32Bit, false, Inst.getLoc(), Instructions)) { + switch (FinalOpcode) { + default: + llvm_unreachable("unimplemented expansion"); + case (Mips::ADDi): + FinalOpcode = Mips::ADD; + break; + case (Mips::ADDiu): + FinalOpcode = Mips::ADDu; + break; + case (Mips::ANDi): + FinalOpcode = Mips::AND; + break; + case (Mips::NORImm): + FinalOpcode = Mips::NOR; + break; + case (Mips::ORi): + FinalOpcode = Mips::OR; + break; + case (Mips::SLTi): + FinalOpcode = Mips::SLT; + break; + case (Mips::SLTiu): + FinalOpcode = Mips::SLTu; + break; + case (Mips::XORi): + FinalOpcode = Mips::XOR; + break; + } + + MCInst tmpInst; + + tmpInst.clear(); + tmpInst.setLoc(Inst.getLoc()); + tmpInst.setOpcode(FinalOpcode); + if (FinalDstReg == Mips::NoRegister) { + tmpInst.addOperand(MCOperand::createReg(DstReg)); + tmpInst.addOperand(MCOperand::createReg(DstReg)); + tmpInst.addOperand(MCOperand::createReg(SrcReg)); + } else { + tmpInst.addOperand(MCOperand::createReg(FinalDstReg)); + tmpInst.addOperand(MCOperand::createReg(FinalDstReg)); + tmpInst.addOperand(MCOperand::createReg(DstReg)); + } + Instructions.push_back(tmpInst); + return false; + } + return true; +} + void MipsAsmParser::createNop(bool hasShortDelaySlot, SMLoc IDLoc, SmallVectorImpl &Instructions) { MCInst NopInst; diff --git a/lib/Target/Mips/MipsInstrInfo.td b/lib/Target/Mips/MipsInstrInfo.td index cbc8e2fcb8f..721ec848537 100644 --- a/lib/Target/Mips/MipsInstrInfo.td +++ b/lib/Target/Mips/MipsInstrInfo.td @@ -1770,6 +1770,9 @@ def JalTwoReg : MipsAsmPseudoInst<(outs GPR32Opnd:$rd), (ins GPR32Opnd:$rs), def JalOneReg : MipsAsmPseudoInst<(outs), (ins GPR32Opnd:$rs), "jal\t$rs"> ; +def NORImm : MipsAsmPseudoInst<(outs), (ins GPR32Opnd:$rs, GPR32Opnd:$rt, simm16:$imm), + "nor\t$rs, $rt, $imm"> ; + let hasDelaySlot = 1 in { def BneImm : MipsAsmPseudoInst<(outs GPR32Opnd:$rt), (ins imm64:$imm64, brtarget:$offset), diff --git a/test/MC/Mips/instalias-imm-expanding.s b/test/MC/Mips/instalias-imm-expanding.s new file mode 100644 index 00000000000..b3667ef8bf8 --- /dev/null +++ b/test/MC/Mips/instalias-imm-expanding.s @@ -0,0 +1,273 @@ +# RUN: llvm-mc %s -triple=mipsel-unknown-linux -mcpu=mips32r2 -show-encoding | FileCheck %s + + + .text +text_label: + + add $4, -0x80000000 +# CHECK: lui $1, 32768 # encoding: [0x00,0x80,0x01,0x3c] +# CHECK: add $4, $4, $1 # encoding: [0x20,0x20,0x81,0x00] + add $4, -0x8001 +# CHECK: lui $1, 65535 # encoding: [0xff,0xff,0x01,0x3c] +# CHECK: ori $1, $1, 32767 # encoding: [0xff,0x7f,0x21,0x34] +# CHECK: add $4, $4, $1 # encoding: [0x20,0x20,0x81,0x00] + add $4, -0x8000 +# CHECK: addi $4, $4, -32768 # encoding: [0x00,0x80,0x84,0x20] + add $4, 0 +# CHECK: addi $4, $4, 0 # encoding: [0x00,0x00,0x84,0x20] + add $4, 0xFFFF +# CHECK: ori $1, $zero, 65535 # encoding: [0xff,0xff,0x01,0x34] +# CHECK: add $4, $4, $1 # encoding: [0x20,0x20,0x81,0x00] + add $4, 0x10000 +# CHECK: lui $1, 1 # encoding: [0x01,0x00,0x01,0x3c] +# CHECK: add $4, $4, $1 # encoding: [0x20,0x20,0x81,0x00] + add $4, 0xFFFFFFFF +# CHECK: addiu $1, $zero, -1 # encoding: [0xff,0xff,0x01,0x24] +# CHECK: add $4, $4, $1 # encoding: [0x20,0x20,0x81,0x00] + + add $4, $5, -0x80000000 +# CHECK: lui $4, 32768 # encoding: [0x00,0x80,0x04,0x3c] +# CHECK: add $4, $4, $5 # encoding: [0x20,0x20,0x85,0x00] + add $4, $5, -0x8001 +# CHECK: lui $4, 65535 # encoding: [0xff,0xff,0x04,0x3c] +# CHECK: ori $4, $4, 32767 # encoding: [0xff,0x7f,0x84,0x34] +# CHECK: add $4, $4, $5 # encoding: [0x20,0x20,0x85,0x00] + add $4, $5, -0x8000 +# CHECK: addi $4, $5, -32768 # encoding: [0x00,0x80,0xa4,0x20] + add $4, $5, 0 +# CHECK: addi $4, $5, 0 # encoding: [0x00,0x00,0xa4,0x20] + add $4, $5, 0xFFFF +# CHECK: ori $4, $zero, 65535 # encoding: [0xff,0xff,0x04,0x34] +# CHECK: add $4, $4, $5 # encoding: [0x20,0x20,0x85,0x00] + add $4, $5, 0x10000 +# CHECK: lui $4, 1 # encoding: [0x01,0x00,0x04,0x3c] +# CHECK: add $4, $4, $5 # encoding: [0x20,0x20,0x85,0x00] + add $4, $5, 0xFFFFFFFF +# CHECK: addiu $4, $zero, -1 # encoding: [0xff,0xff,0x04,0x24] +# CHECK: add $4, $4, $5 # encoding: [0x20,0x20,0x85,0x00] + + addu $4, -0x80000000 +# CHECK: lui $1, 32768 # encoding: [0x00,0x80,0x01,0x3c] +# CHECK: addu $4, $4, $1 # encoding: [0x21,0x20,0x81,0x00] + addu $4, -0x8001 +# CHECK: lui $1, 65535 # encoding: [0xff,0xff,0x01,0x3c] +# CHECK: ori $1, $1, 32767 # encoding: [0xff,0x7f,0x21,0x34] +# CHECK: addu $4, $4, $1 # encoding: [0x21,0x20,0x81,0x00] + addu $4, -0x8000 +# CHECK: addiu $4, $4, -32768 # encoding: [0x00,0x80,0x84,0x24] + addu $4, 0 +# CHECK: addiu $4, $4, 0 # encoding: [0x00,0x00,0x84,0x24] + addu $4, 0xFFFF +# CHECK: ori $1, $zero, 65535 # encoding: [0xff,0xff,0x01,0x34] +# CHECK: addu $4, $4, $1 # encoding: [0x21,0x20,0x81,0x00] + addu $4, 0x10000 +# CHECK: lui $1, 1 # encoding: [0x01,0x00,0x01,0x3c] +# CHECK: addu $4, $4, $1 # encoding: [0x21,0x20,0x81,0x00] + addu $4, 0xFFFFFFFF +# CHECK: addiu $1, $zero, -1 # encoding: [0xff,0xff,0x01,0x24] +# CHECK: addu $4, $4, $1 # encoding: [0x21,0x20,0x81,0x00] + + addu $4, $5, -0x80000000 +# CHECK: lui $4, 32768 # encoding: [0x00,0x80,0x04,0x3c] +# CHECK: addu $4, $4, $5 # encoding: [0x21,0x20,0x85,0x00] + addu $4, $5, -0x8001 +# CHECK: lui $4, 65535 # encoding: [0xff,0xff,0x04,0x3c] +# CHECK: ori $4, $4, 32767 # encoding: [0xff,0x7f,0x84,0x34] +# CHECK: addu $4, $4, $5 # encoding: [0x21,0x20,0x85,0x00] + addu $4, $5, -0x8000 +# CHECK: addiu $4, $5, -32768 # encoding: [0x00,0x80,0xa4,0x24] + addu $4, $5, 0 +# CHECK: addiu $4, $5, 0 # encoding: [0x00,0x00,0xa4,0x24] + addu $4, $5, 0xFFFF +# CHECK: ori $4, $zero, 65535 # encoding: [0xff,0xff,0x04,0x34] +# CHECK: addu $4, $4, $5 # encoding: [0x21,0x20,0x85,0x00] + addu $4, $5, 0x10000 +# CHECK: lui $4, 1 # encoding: [0x01,0x00,0x04,0x3c] +# CHECK: addu $4, $4, $5 # encoding: [0x21,0x20,0x85,0x00] + addu $4, $5, 0xFFFFFFFF +# CHECK: addiu $4, $zero, -1 # encoding: [0xff,0xff,0x04,0x24] +# CHECK: addu $4, $4, $5 # encoding: [0x21,0x20,0x85,0x00] + + and $4, -0x80000000 +# CHECK: lui $1, 32768 # encoding: [0x00,0x80,0x01,0x3c] +# CHECK: and $4, $4, $1 # encoding: [0x24,0x20,0x81,0x00] + and $4, -0x8001 +# CHECK: lui $1, 65535 # encoding: [0xff,0xff,0x01,0x3c] +# CHECK: ori $1, $1, 32767 # encoding: [0xff,0x7f,0x21,0x34] +# CHECK: and $4, $4, $1 # encoding: [0x24,0x20,0x81,0x00] + and $4, -0x8000 +# CHECK: addiu $1, $zero, -32768 # encoding: [0x00,0x80,0x01,0x24] + and $4, 0 +# CHECK: andi $4, $4, 0 # encoding: [0x00,0x00,0x84,0x30] + and $4, 0xFFFF +# CHECK: andi $4, $4, 65535 # encoding: [0xff,0xff,0x84,0x30] + and $4, 0x10000 +# CHECK: lui $1, 1 # encoding: [0x01,0x00,0x01,0x3c] +# CHECK: and $4, $4, $1 # encoding: [0x24,0x20,0x81,0x00] + and $4, 0xFFFFFFFF +# CHECK: addiu $1, $zero, -1 # encoding: [0xff,0xff,0x01,0x24] +# CHECK: and $4, $4, $1 # encoding: [0x24,0x20,0x81,0x00] + + and $4, $5, -0x80000000 +# CHECK: lui $4, 32768 # encoding: [0x00,0x80,0x04,0x3c] +# CHECK: and $4, $4, $5 # encoding: [0x24,0x20,0x85,0x00] + and $4, $5, -0x8001 +# CHECK: lui $4, 65535 # encoding: [0xff,0xff,0x04,0x3c] +# CHECK: ori $4, $4, 32767 # encoding: [0xff,0x7f,0x84,0x34] +# CHECK: and $4, $4, $5 # encoding: [0x24,0x20,0x85,0x00] + and $4, $5, -0x8000 +# CHECK: addiu $4, $zero, -32768 # encoding: [0x00,0x80,0x04,0x24] +# CHECK: and $4, $4, $5 # encoding: [0x24,0x20,0x85,0x00] + and $4, $5, 0 +# CHECK: andi $4, $5, 0 # encoding: [0x00,0x00,0xa4,0x30] + and $4, $5, 0xFFFF +# CHECK: andi $4, $5, 65535 # encoding: [0xff,0xff,0xa4,0x30] + and $4, $5, 0x10000 +# CHECK: lui $4, 1 # encoding: [0x01,0x00,0x04,0x3c] +# CHECK: and $4, $4, $5 # encoding: [0x24,0x20,0x85,0x00] + and $4, $5, 0xFFFFFFFF +# CHECK: addiu $4, $zero, -1 # encoding: [0xff,0xff,0x04,0x24] +# CHECK: and $4, $4, $5 # encoding: [0x24,0x20,0x85,0x00] + + nor $4, $5, 0 +# CHECK: addiu $4, $zero, 0 # encoding: [0x00,0x00,0x04,0x24] +# CHECK: nor $4, $4, $5 # encoding: [0x27,0x20,0x85,0x00] + nor $4, $5, 1 +# CHECK: addiu $4, $zero, 1 # encoding: [0x01,0x00,0x04,0x24] +# CHECK: nor $4, $4, $5 # encoding: [0x27,0x20,0x85,0x00] + nor $4, $5, 0x8000 +# CHECK: ori $4, $zero, 32768 # encoding: [0x00,0x80,0x04,0x34] +# CHECK: nor $4, $4, $5 # encoding: [0x27,0x20,0x85,0x00] + nor $4, $5, -0x8000 +# CHECK: addiu $4, $zero, -32768 # encoding: [0x00,0x80,0x04,0x24] +# CHECK: nor $4, $4, $5 # encoding: [0x27,0x20,0x85,0x00] + nor $4, $5, 0x10000 +# CHECK: lui $4, 1 # encoding: [0x01,0x00,0x04,0x3c] +# CHECK: nor $4, $4, $5 # encoding: [0x27,0x20,0x85,0x00] + nor $4, $5, 0x1a5a5 +# CHECK: lui $4, 1 # encoding: [0x01,0x00,0x04,0x3c] +# CHECK: ori $4, $4, 42405 # encoding: [0xa5,0xa5,0x84,0x34] +# CHECK: nor $4, $4, $5 # encoding: [0x27,0x20,0x85,0x00] + + or $4, -0x80000000 +# CHECK: lui $1, 32768 # encoding: [0x00,0x80,0x01,0x3c] +# CHECK: or $4, $4, $1 # encoding: [0x25,0x20,0x81,0x00] + or $4, -0x8001 +# CHECK: lui $1, 65535 # encoding: [0xff,0xff,0x01,0x3c] +# CHECK: ori $1, $1, 32767 # encoding: [0xff,0x7f,0x21,0x34] +# CHECK: or $4, $4, $1 # encoding: [0x25,0x20,0x81,0x00] + or $4, -0x8000 +# CHECK: addiu $1, $zero, -32768 # encoding: [0x00,0x80,0x01,0x24] +# CHECK: or $4, $4, $1 # encoding: [0x25,0x20,0x81,0x00] + or $4, 0 +# CHECK: ori $4, $4, 0 # encoding: [0x00,0x00,0x84,0x34] + or $4, 0xFFFF +# CHECK: ori $4, $4, 65535 # encoding: [0xff,0xff,0x84,0x34] + or $4, 0x10000 +# CHECK: lui $1, 1 # encoding: [0x01,0x00,0x01,0x3c] +# CHECK: or $4, $4, $1 # encoding: [0x25,0x20,0x81,0x00] + or $4, 0xFFFFFFFF +# CHECK: addiu $1, $zero, -1 # encoding: [0xff,0xff,0x01,0x24] +# CHECK: or $4, $4, $1 # encoding: [0x25,0x20,0x81,0x00] + + or $4, $5, -0x80000000 +# CHECK: lui $4, 32768 # encoding: [0x00,0x80,0x04,0x3c] +# CHECK: or $4, $4, $5 # encoding: [0x25,0x20,0x85,0x00] + or $4, $5, -0x8001 +# CHECK: lui $4, 65535 # encoding: [0xff,0xff,0x04,0x3c] +# CHECK: ori $4, $4, 32767 # encoding: [0xff,0x7f,0x84,0x34] +# CHECK: or $4, $4, $5 # encoding: [0x25,0x20,0x85,0x00] + or $4, $5, -0x8000 +# CHECK: addiu $4, $zero, -32768 # encoding: [0x00,0x80,0x04,0x24] +# CHECK: or $4, $4, $5 # encoding: [0x25,0x20,0x85,0x00] + or $4, $5, 0 +# CHECK: ori $4, $5, 0 # encoding: [0x00,0x00,0xa4,0x34] + or $4, $5, 0xFFFF +# CHECK: ori $4, $5, 65535 # encoding: [0xff,0xff,0xa4,0x34] + or $4, $5, 0x10000 +# CHECK: lui $4, 1 # encoding: [0x01,0x00,0x04,0x3c] +# CHECK: or $4, $4, $5 # encoding: [0x25,0x20,0x85,0x00] + or $4, $5, 0xFFFFFFFF +# CHECK: addiu $4, $zero, -1 # encoding: [0xff,0xff,0x04,0x24] +# CHECK: or $4, $4, $5 # encoding: [0x25,0x20,0x85,0x00] + + slt $4, $5, -0x80000000 +# CHECK: lui $4, 32768 # encoding: [0x00,0x80,0x04,0x3c] +# CHECK: slt $4, $4, $5 # encoding: [0x2a,0x20,0x85,0x00] + slt $4, $5, -0x8001 +# CHECK: lui $4, 65535 # encoding: [0xff,0xff,0x04,0x3c] +# CHECK: ori $4, $4, 32767 # encoding: [0xff,0x7f,0x84,0x34] +# CHECK: slt $4, $4, $5 # encoding: [0x2a,0x20,0x85,0x00] + slt $4, $5, -0x8000 +# CHECK: slti $4, $5, -32768 # encoding: [0x00,0x80,0xa4,0x28] + slt $4, $5, 0 +# CHECK: slti $4, $5, 0 # encoding: [0x00,0x00,0xa4,0x28] + slt $4, $5, 0xFFFF +# CHECK: ori $4, $zero, 65535 # encoding: [0xff,0xff,0x04,0x34] + slt $4, $5, 0x10000 +# CHECK: lui $4, 1 # encoding: [0x01,0x00,0x04,0x3c] +# CHECK: slt $4, $4, $5 # encoding: [0x2a,0x20,0x85,0x00] + slt $4, $5, 0xFFFFFFFF +# CHECK: addiu $4, $zero, -1 # encoding: [0xff,0xff,0x04,0x24] +# CHECK: slt $4, $4, $5 # encoding: [0x2a,0x20,0x85,0x00] + + sltu $4, $5, -0x80000000 +# CHECK: lui $4, 32768 # encoding: [0x00,0x80,0x04,0x3c] +# CHECK: sltu $4, $4, $5 # encoding: [0x2b,0x20,0x85,0x00] + sltu $4, $5, -0x8001 +# CHECK: lui $4, 65535 # encoding: [0xff,0xff,0x04,0x3c] +# CHECK: ori $4, $4, 32767 # encoding: [0xff,0x7f,0x84,0x34] +# CHECK: sltu $4, $4, $5 # encoding: [0x2b,0x20,0x85,0x00] + sltu $4, $5, -0x8000 +# CHECK: sltiu $4, $5, -32768 # encoding: [0x00,0x80,0xa4,0x2c] + sltu $4, $5, 0 +# CHECK: sltiu $4, $5, 0 # encoding: [0x00,0x00,0xa4,0x2c] + sltu $4, $5, 0xFFFF +# CHECK: ori $4, $zero, 65535 # encoding: [0xff,0xff,0x04,0x34] + sltu $4, $5, 0x10000 +# CHECK: lui $4, 1 # encoding: [0x01,0x00,0x04,0x3c] +# CHECK: sltu $4, $4, $5 # encoding: [0x2b,0x20,0x85,0x00] + sltu $4, $5, 0xFFFFFFFF +# CHECK: addiu $4, $zero, -1 # encoding: [0xff,0xff,0x04,0x24] +# CHECK: sltu $4, $4, $5 # encoding: [0x2b,0x20,0x85,0x00] + + xor $4, -0x80000000 +# CHECK: lui $1, 32768 # encoding: [0x00,0x80,0x01,0x3c] +# CHECK: xor $4, $4, $1 # encoding: [0x26,0x20,0x81,0x00] + xor $4, -0x8001 +# CHECK: lui $1, 65535 # encoding: [0xff,0xff,0x01,0x3c] +# CHECK: ori $1, $1, 32767 # encoding: [0xff,0x7f,0x21,0x34] +# CHECK: xor $4, $4, $1 # encoding: [0x26,0x20,0x81,0x00] + xor $4, -0x8000 +# CHECK: addiu $1, $zero, -32768 # encoding: [0x00,0x80,0x01,0x24] + xor $4, 0 +# CHECK: xori $4, $4, 0 # encoding: [0x00,0x00,0x84,0x38] + xor $4, 0xFFFF +# CHECK: xori $4, $4, 65535 # encoding: [0xff,0xff,0x84,0x38] + xor $4, 0x10000 +# CHECK: lui $1, 1 # encoding: [0x01,0x00,0x01,0x3c] +# CHECK: xor $4, $4, $1 # encoding: [0x26,0x20,0x81,0x00] + xor $4, 0xFFFFFFFF +# CHECK: addiu $1, $zero, -1 # encoding: [0xff,0xff,0x01,0x24] +# CHECK: xor $4, $4, $1 # encoding: [0x26,0x20,0x81,0x00] + + xor $4, $5, -0x80000000 +# CHECK: lui $4, 32768 # encoding: [0x00,0x80,0x04,0x3c] +# CHECK: xor $4, $4, $5 # encoding: [0x26,0x20,0x85,0x00] + xor $4, $5, -0x8001 +# CHECK: lui $4, 65535 # encoding: [0xff,0xff,0x04,0x3c] +# CHECK: ori $4, $4, 32767 # encoding: [0xff,0x7f,0x84,0x34] +# CHECK: xor $4, $4, $5 # encoding: [0x26,0x20,0x85,0x00] + xor $4, $5, -0x8000 +# CHECK: addiu $4, $zero, -32768 # encoding: [0x00,0x80,0x04,0x24] +# CHECK: xor $4, $4, $5 # encoding: [0x26,0x20,0x85,0x00] + xor $4, $5, 0 +# CHECK: xori $4, $5, 0 # encoding: [0x00,0x00,0xa4,0x38] + xor $4, $5, 0xFFFF +# CHECK: xori $4, $5, 65535 # encoding: [0xff,0xff,0xa4,0x38] + xor $4, $5, 0x10000 +# CHECK: lui $4, 1 # encoding: [0x01,0x00,0x04,0x3c] +# CHECK: xor $4, $4, $5 # encoding: [0x26,0x20,0x85,0x00] + xor $4, $5, 0xFFFFFFFF +# CHECK: addiu $4, $zero, -1 # encoding: [0xff,0xff,0x04,0x24] +# CHECK: xor $4, $4, $5 # encoding: [0x26,0x20,0x85,0x00] -- 2.34.1