Index: lib/Target/Mips/AsmParser/MipsAsmParser.cpp =================================================================== --- lib/Target/Mips/AsmParser/MipsAsmParser.cpp +++ lib/Target/Mips/AsmParser/MipsAsmParser.cpp @@ -208,6 +208,9 @@ bool expandLoadStoreMultiple(MCInst &Inst, SMLoc IDLoc, SmallVectorImpl &Instructions); + bool expandAliasImmediate(MCInst &Inst, SMLoc IDLoc, + SmallVectorImpl &Instructions); + bool expandBranchImm(MCInst &Inst, SMLoc IDLoc, SmallVectorImpl &Instructions); @@ -372,11 +375,11 @@ // Initialize the set of available features. setAvailableFeatures(ComputeAvailableFeatures(STI.getFeatureBits())); - + // Remember the initial assembler options. The user can not modify these. AssemblerOptions.push_back( llvm::make_unique(STI.getFeatureBits())); - + // Create an assembler options environment for the user to modify. AssemblerOptions.push_back( llvm::make_unique(STI.getFeatureBits())); @@ -1635,7 +1638,24 @@ case Mips::BLEU: case Mips::BGEU: case Mips::BGTU: + case Mips::NORImm: return true; + case Mips::ADDi: + case Mips::ADDiu: + case Mips::ANDi: + case Mips::ORi: + case Mips::SLTi: + case Mips::SLTiu: + 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 !(-32768 <= ImmValue && ImmValue <= 65535); + } else { + return false; + } default: return false; } @@ -1673,6 +1693,15 @@ case Mips::BGEU: case Mips::BGTU: return expandCondBranches(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); } } @@ -2449,6 +2478,79 @@ 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(); + unsigned FinalOpcode = Inst.getOpcode(); + + if (DstReg == SrcReg) { + ATReg = getATReg(Inst.getLoc()); + FinalDstReg = DstReg; + DstReg = ATReg; + } + + if (!loadImmediate(ImmValue, DstReg, Mips::NoRegister, true, 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); + } else { + return true; + } + + return false; +} + void MipsAsmParser::createNop(bool hasShortDelaySlot, SMLoc IDLoc, SmallVectorImpl &Instructions) { MCInst NopInst; @@ -4341,7 +4443,7 @@ getParser().getStreamer().EmitGPRel32Value(Value); if (getLexer().isNot(AsmToken::EndOfStatement)) - return Error(getLexer().getLoc(), + return Error(getLexer().getLoc(), "unexpected token, expected end of statement"); Parser.Lex(); // Eat EndOfStatement token. return false; @@ -4359,7 +4461,7 @@ getParser().getStreamer().EmitGPRel64Value(Value); if (getLexer().isNot(AsmToken::EndOfStatement)) - return Error(getLexer().getLoc(), + return Error(getLexer().getLoc(), "unexpected token, expected end of statement"); Parser.Lex(); // Eat EndOfStatement token. return false; @@ -4401,7 +4503,7 @@ } // Unknown option. - Warning(Parser.getTok().getLoc(), + Warning(Parser.getTok().getLoc(), "unknown option, expected 'pic0' or 'pic2'"); Parser.eatToEndOfStatement(); return false; @@ -4800,7 +4902,7 @@ if (IDVal == ".abicalls") { getTargetStreamer().emitDirectiveAbiCalls(); if (Parser.getTok().isNot(AsmToken::EndOfStatement)) { - Error(Parser.getTok().getLoc(), + Error(Parser.getTok().getLoc(), "unexpected token, expected end of statement"); // Clear line Parser.eatToEndOfStatement(); Index: lib/Target/Mips/MipsInstrInfo.td =================================================================== --- lib/Target/Mips/MipsInstrInfo.td +++ lib/Target/Mips/MipsInstrInfo.td @@ -1620,7 +1620,7 @@ def : MipsInstAlias<"beqzl $rs,$offset", (BEQL GPR32Opnd:$rs, ZERO, brtarget:$offset), 0>; def : MipsInstAlias<"syscall", (SYSCALL 0), 1>; - + def : MipsInstAlias<"break", (BREAK 0, 0), 1>; def : MipsInstAlias<"break $imm", (BREAK uimm10:$imm, 0), 1>; def : MipsInstAlias<"ei", (EI ZERO), 1>, ISA_MIPS32R2; @@ -1684,6 +1684,9 @@ 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), Index: test/MC/Mips/instalias-imm-expanding.s =================================================================== --- test/MC/Mips/instalias-imm-expanding.s +++ test/MC/Mips/instalias-imm-expanding.s @@ -0,0 +1,297 @@ +# 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: addi $4, $4, 65535 # encoding: [0xff,0xff,0x84,0x20] + 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: lui $1, 65535 # encoding: [0xff,0xff,0x01,0x3c] +# CHECK: ori $1, $1, 65535 # encoding: [0xff,0xff,0x21,0x34] +# 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: addi $4, $5, 65535 # encoding: [0xff,0xff,0xa4,0x20] + 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: lui $4, 65535 # encoding: [0xff,0xff,0x04,0x3c] +# CHECK: ori $4, $4, 65535 # encoding: [0xff,0xff,0x84,0x34] +# 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: addiu $4, $4, 65535 # encoding: [0xff,0xff,0x84,0x24] + 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: lui $1, 65535 # encoding: [0xff,0xff,0x01,0x3c] +# CHECK: ori $1, $1, 65535 # encoding: [0xff,0xff,0x21,0x34] +# 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: addiu $4, $5, 65535 # encoding: [0xff,0xff,0xa4,0x24] + 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: lui $4, 65535 # encoding: [0xff,0xff,0x04,0x3c] +# CHECK: ori $4, $4, 65535 # encoding: [0xff,0xff,0x84,0x34] +# 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: andi $4, $4, 32768 # encoding: [0x00,0x80,0x84,0x30] + 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: lui $1, 65535 # encoding: [0xff,0xff,0x01,0x3c] +# CHECK: ori $1, $1, 65535 # encoding: [0xff,0xff,0x21,0x34] +# 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: andi $4, $5, 32768 # encoding: [0x00,0x80,0xa4,0x30] + 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: lui $4, 65535 # encoding: [0xff,0xff,0x04,0x3c] +# CHECK: ori $4, $4, 65535 # encoding: [0xff,0xff,0x84,0x34] +# CHECK: and $4, $4, $5 # encoding: [0x24,0x20,0x85,0x00] + + + + nor $4,$5,0 +# CHECK: ori $4, $zero, 0 # encoding: [0x00,0x00,0x04,0x34] +# CHECK: nor $4, $4, $5 # encoding: [0x27,0x20,0x85,0x00] + nor $4,$5,1 +# CHECK: ori $4, $zero, 1 # encoding: [0x01,0x00,0x04,0x34] +# 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: ori $4, $4, 32768 # encoding: [0x00,0x80,0x84,0x34] + 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: lui $1, 65535 # encoding: [0xff,0xff,0x01,0x3c] +# CHECK: ori $1, $1, 65535 # encoding: [0xff,0xff,0x21,0x34] +# 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: ori $4, $5, 32768 # encoding: [0x00,0x80,0xa4,0x34] + 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: lui $4, 65535 # encoding: [0xff,0xff,0x04,0x3c] +# CHECK: ori $4, $4, 65535 # encoding: [0xff,0xff,0x84,0x34] +# 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: slti $4, $5, 65535 # encoding: [0xff,0xff,0xa4,0x28] + 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: lui $4, 65535 # encoding: [0xff,0xff,0x04,0x3c] +# CHECK: ori $4, $4, 65535 # encoding: [0xff,0xff,0x84,0x34] +# 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: sltiu $4, $5, 65535 # encoding: [0xff,0xff,0xa4,0x2c] + 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: lui $4, 65535 # encoding: [0xff,0xff,0x04,0x3c] +# CHECK: ori $4, $4, 65535 # encoding: [0xff,0xff,0x84,0x34] +# 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: xori $4, $4, 32768 # encoding: [0x00,0x80,0x84,0x38] + 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: lui $1, 65535 # encoding: [0xff,0xff,0x01,0x3c] +# CHECK: ori $1, $1, 65535 # encoding: [0xff,0xff,0x21,0x34] +# 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: xori $4, $5, 32768 # encoding: [0x00,0x80,0xa4,0x38] + 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: lui $4, 65535 # encoding: [0xff,0xff,0x04,0x3c] +# CHECK: ori $4, $4, 65535 # encoding: [0xff,0xff,0x84,0x34] +# CHECK: xor $4, $4, $5 # encoding: [0x26,0x20,0x85,0x00] + + + +# Force at least 8 (non-delay-slot) zero bytes, to make 'objdump' print ... + .space 8