[llvm] r248706 - [mips] Handling of immediates bigger than 16 bits
Zoran Jovanovic via llvm-commits
llvm-commits at lists.llvm.org
Mon Sep 28 04:11:41 PDT 2015
Author: zjovanovic
Date: Mon Sep 28 06:11:34 2015
New Revision: 248706
URL: http://llvm.org/viewvc/llvm-project?rev=248706&view=rev
Log:
[mips] Handling of immediates bigger than 16 bits
Differential Revision: http://reviews.llvm.org/D10539
Added:
llvm/trunk/test/MC/Mips/instalias-imm-expanding.s
Modified:
llvm/trunk/lib/Target/Mips/AsmParser/MipsAsmParser.cpp
llvm/trunk/lib/Target/Mips/MipsInstrInfo.td
Modified: llvm/trunk/lib/Target/Mips/AsmParser/MipsAsmParser.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Mips/AsmParser/MipsAsmParser.cpp?rev=248706&r1=248705&r2=248706&view=diff
==============================================================================
--- llvm/trunk/lib/Target/Mips/AsmParser/MipsAsmParser.cpp (original)
+++ llvm/trunk/lib/Target/Mips/AsmParser/MipsAsmParser.cpp Mon Sep 28 06:11:34 2015
@@ -202,6 +202,9 @@ class MipsAsmParser : public MCTargetAsm
bool expandLoadStoreMultiple(MCInst &Inst, SMLoc IDLoc,
SmallVectorImpl<MCInst> &Instructions);
+ bool expandAliasImmediate(MCInst &Inst, SMLoc IDLoc,
+ SmallVectorImpl<MCInst> &Instructions);
+
bool expandBranchImm(MCInst &Inst, SMLoc IDLoc,
SmallVectorImpl<MCInst> &Instructions);
@@ -1883,7 +1886,31 @@ bool MipsAsmParser::needsExpansion(MCIns
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(MC
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 &In
return false;
}
+bool MipsAsmParser::expandAliasImmediate(MCInst &Inst, SMLoc IDLoc,
+ SmallVectorImpl<MCInst> &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<MCInst> &Instructions) {
MCInst NopInst;
Modified: llvm/trunk/lib/Target/Mips/MipsInstrInfo.td
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Mips/MipsInstrInfo.td?rev=248706&r1=248705&r2=248706&view=diff
==============================================================================
--- llvm/trunk/lib/Target/Mips/MipsInstrInfo.td (original)
+++ llvm/trunk/lib/Target/Mips/MipsInstrInfo.td Mon Sep 28 06:11:34 2015
@@ -1770,6 +1770,9 @@ def JalTwoReg : MipsAsmPseudoInst<(outs
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),
Added: llvm/trunk/test/MC/Mips/instalias-imm-expanding.s
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/MC/Mips/instalias-imm-expanding.s?rev=248706&view=auto
==============================================================================
--- llvm/trunk/test/MC/Mips/instalias-imm-expanding.s (added)
+++ llvm/trunk/test/MC/Mips/instalias-imm-expanding.s Mon Sep 28 06:11:34 2015
@@ -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]
More information about the llvm-commits
mailing list