mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-04-16 20:40:16 +00:00
ARM mode aliases for bitwise instructions w/ register operands.
rdar://9704684 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@144803 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
d0405aaabc
commit
23f220705a
lib/Target/ARM
@ -5015,6 +5015,18 @@ def LSLi : ARMAsmPseudo<"lsl${s}${p} $Rd, $Rm, $imm",
|
||||
def RORi : ARMAsmPseudo<"ror${s}${p} $Rd, $Rm, $imm",
|
||||
(ins GPR:$Rd, GPR:$Rm, imm0_31:$imm, pred:$p,
|
||||
cc_out:$s)>;
|
||||
def ASRr : ARMAsmPseudo<"asr${s}${p} $Rd, $Rn, $Rm",
|
||||
(ins GPRnopc:$Rd, GPRnopc:$Rn, GPRnopc:$Rm, pred:$p,
|
||||
cc_out:$s)>;
|
||||
def LSRr : ARMAsmPseudo<"lsr${s}${p} $Rd, $Rn, $Rm",
|
||||
(ins GPRnopc:$Rd, GPRnopc:$Rn, GPRnopc:$Rm, pred:$p,
|
||||
cc_out:$s)>;
|
||||
def LSLr : ARMAsmPseudo<"lsl${s}${p} $Rd, $Rn, $Rm",
|
||||
(ins GPRnopc:$Rd, GPRnopc:$Rn, GPRnopc:$Rm, pred:$p,
|
||||
cc_out:$s)>;
|
||||
def RORr : ARMAsmPseudo<"ror${s}${p} $Rd, $Rn, $Rm",
|
||||
(ins GPRnopc:$Rd, GPRnopc:$Rn, GPRnopc:$Rm, pred:$p,
|
||||
cc_out:$s)>;
|
||||
// shifter instructions also support a two-operand form.
|
||||
def : ARMInstAlias<"asr${s}${p} $Rm, $imm",
|
||||
(ASRi GPR:$Rm, GPR:$Rm, imm0_32:$imm, pred:$p, cc_out:$s)>;
|
||||
|
@ -4613,6 +4613,32 @@ processInstruction(MCInst &Inst,
|
||||
const SmallVectorImpl<MCParsedAsmOperand*> &Operands) {
|
||||
switch (Inst.getOpcode()) {
|
||||
// Handle the MOV complex aliases.
|
||||
case ARM::ASRr:
|
||||
case ARM::LSRr:
|
||||
case ARM::LSLr:
|
||||
case ARM::RORr: {
|
||||
ARM_AM::ShiftOpc ShiftTy;
|
||||
switch(Inst.getOpcode()) {
|
||||
default: llvm_unreachable("unexpected opcode!");
|
||||
case ARM::ASRr: ShiftTy = ARM_AM::asr; break;
|
||||
case ARM::LSRr: ShiftTy = ARM_AM::lsr; break;
|
||||
case ARM::LSLr: ShiftTy = ARM_AM::lsl; break;
|
||||
case ARM::RORr: ShiftTy = ARM_AM::ror; break;
|
||||
}
|
||||
// A shift by zero is a plain MOVr, not a MOVsi.
|
||||
unsigned Shifter = ARM_AM::getSORegOpc(ShiftTy, 0);
|
||||
MCInst TmpInst;
|
||||
TmpInst.setOpcode(ARM::MOVsr);
|
||||
TmpInst.addOperand(Inst.getOperand(0)); // Rd
|
||||
TmpInst.addOperand(Inst.getOperand(1)); // Rn
|
||||
TmpInst.addOperand(Inst.getOperand(2)); // Rm
|
||||
TmpInst.addOperand(MCOperand::CreateImm(Shifter)); // Shift value and ty
|
||||
TmpInst.addOperand(Inst.getOperand(3)); // CondCode
|
||||
TmpInst.addOperand(Inst.getOperand(4));
|
||||
TmpInst.addOperand(Inst.getOperand(5)); // cc_out
|
||||
Inst = TmpInst;
|
||||
return true;
|
||||
}
|
||||
case ARM::ASRi:
|
||||
case ARM::LSRi:
|
||||
case ARM::LSLi:
|
||||
|
Loading…
x
Reference in New Issue
Block a user