mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-23 19:23:23 +01:00
Fix ssat and ssat16 encodings for ARM and Thumb. The bit position value
must be encoded decremented by one. Only add encoding tests for ssat16 because ssat can't be parsed yet. llvm-svn: 132324
This commit is contained in:
parent
728ea362c3
commit
0bdb365634
@ -232,6 +232,8 @@ namespace {
|
||||
unsigned Op) const { return 0; }
|
||||
unsigned getMsbOpValue(const MachineInstr &MI,
|
||||
unsigned Op) const { return 0; }
|
||||
unsigned getSsatBitPosValue(const MachineInstr &MI,
|
||||
unsigned Op) const { return 0; }
|
||||
uint32_t getLdStmModeOpValue(const MachineInstr &MI, unsigned OpIdx)
|
||||
const {return 0; }
|
||||
uint32_t getLdStSORegOpValue(const MachineInstr &MI, unsigned OpIdx)
|
||||
|
@ -475,6 +475,12 @@ def width_imm : Operand<i32>, ImmLeaf<i32, [{
|
||||
let EncoderMethod = "getMsbOpValue";
|
||||
}
|
||||
|
||||
def ssat_imm : Operand<i32>, ImmLeaf<i32, [{
|
||||
return Imm > 0 && Imm <= 32;
|
||||
}]> {
|
||||
let EncoderMethod = "getSsatBitPosValue";
|
||||
}
|
||||
|
||||
// Define ARM specific addressing modes.
|
||||
|
||||
def MemMode2AsmOperand : AsmOperandClass {
|
||||
@ -2455,7 +2461,7 @@ def USADA8 : AI<(outs GPR:$Rd), (ins GPR:$Rn, GPR:$Rm, GPR:$Ra),
|
||||
|
||||
// Signed/Unsigned saturate -- for disassembly only
|
||||
|
||||
def SSAT : AI<(outs GPR:$Rd), (ins i32imm:$sat_imm, GPR:$a, shift_imm:$sh),
|
||||
def SSAT : AI<(outs GPR:$Rd), (ins ssat_imm:$sat_imm, GPR:$a, shift_imm:$sh),
|
||||
SatFrm, NoItinerary, "ssat", "\t$Rd, $sat_imm, $a$sh",
|
||||
[/* For disassembly only; pattern left blank */]> {
|
||||
bits<4> Rd;
|
||||
@ -2471,7 +2477,7 @@ def SSAT : AI<(outs GPR:$Rd), (ins i32imm:$sat_imm, GPR:$a, shift_imm:$sh),
|
||||
let Inst{3-0} = Rn;
|
||||
}
|
||||
|
||||
def SSAT16 : AI<(outs GPR:$Rd), (ins i32imm:$sat_imm, GPR:$Rn), SatFrm,
|
||||
def SSAT16 : AI<(outs GPR:$Rd), (ins ssat_imm:$sat_imm, GPR:$Rn), SatFrm,
|
||||
NoItinerary, "ssat16", "\t$Rd, $sat_imm, $Rn",
|
||||
[/* For disassembly only; pattern left blank */]> {
|
||||
bits<4> Rd;
|
||||
|
@ -1973,9 +1973,9 @@ class T2SatI<dag oops, dag iops, InstrItinClass itin,
|
||||
}
|
||||
|
||||
def t2SSAT: T2SatI<
|
||||
(outs rGPR:$Rd), (ins i32imm:$sat_imm, rGPR:$Rn, shift_imm:$sh),
|
||||
NoItinerary, "ssat", "\t$Rd, $sat_imm, $Rn$sh",
|
||||
[/* For disassembly only; pattern left blank */]> {
|
||||
(outs rGPR:$Rd), (ins ssat_imm:$sat_imm, rGPR:$Rn, shift_imm:$sh),
|
||||
NoItinerary, "ssat", "\t$Rd, $sat_imm, $Rn$sh",
|
||||
[/* For disassembly only; pattern left blank */]> {
|
||||
let Inst{31-27} = 0b11110;
|
||||
let Inst{25-22} = 0b1100;
|
||||
let Inst{20} = 0;
|
||||
@ -1983,9 +1983,9 @@ def t2SSAT: T2SatI<
|
||||
}
|
||||
|
||||
def t2SSAT16: T2SatI<
|
||||
(outs rGPR:$Rd), (ins i32imm:$sat_imm, rGPR:$Rn), NoItinerary,
|
||||
"ssat16", "\t$Rd, $sat_imm, $Rn",
|
||||
[/* For disassembly only; pattern left blank */]> {
|
||||
(outs rGPR:$Rd), (ins ssat_imm:$sat_imm, rGPR:$Rn), NoItinerary,
|
||||
"ssat16", "\t$Rd, $sat_imm, $Rn",
|
||||
[/* For disassembly only; pattern left blank */]> {
|
||||
let Inst{31-27} = 0b11110;
|
||||
let Inst{25-22} = 0b1100;
|
||||
let Inst{20} = 0;
|
||||
|
@ -269,6 +269,9 @@ public:
|
||||
unsigned getMsbOpValue(const MCInst &MI, unsigned Op,
|
||||
SmallVectorImpl<MCFixup> &Fixups) const;
|
||||
|
||||
unsigned getSsatBitPosValue(const MCInst &MI, unsigned Op,
|
||||
SmallVectorImpl<MCFixup> &Fixups) const;
|
||||
|
||||
unsigned getRegisterListOpValue(const MCInst &MI, unsigned Op,
|
||||
SmallVectorImpl<MCFixup> &Fixups) const;
|
||||
unsigned getAddrMode6AddressOpValue(const MCInst &MI, unsigned Op,
|
||||
@ -1123,6 +1126,13 @@ getMsbOpValue(const MCInst &MI, unsigned Op,
|
||||
return msb;
|
||||
}
|
||||
|
||||
unsigned ARMMCCodeEmitter::
|
||||
getSsatBitPosValue(const MCInst &MI, unsigned Op,
|
||||
SmallVectorImpl<MCFixup> &Fixups) const {
|
||||
// For ssat instructions, the bit position should be encoded decremented by 1
|
||||
return MI.getOperand(Op).getImm()-1;
|
||||
}
|
||||
|
||||
unsigned ARMMCCodeEmitter::
|
||||
getRegisterListOpValue(const MCInst &MI, unsigned Op,
|
||||
SmallVectorImpl<MCFixup> &Fixups) const {
|
||||
|
@ -312,3 +312,6 @@
|
||||
@ CHECK: ldrexd r0, r1, [r0] @ encoding: [0x9f,0x0f,0xb0,0xe1]
|
||||
ldrexd r0, r1, [r0]
|
||||
|
||||
@ CHECK: ssat16 r0, #7, r0 @ encoding: [0x30,0x0f,0xa6,0xe6]
|
||||
ssat16 r0, #7, r0
|
||||
|
||||
|
@ -300,3 +300,5 @@
|
||||
ldrex r0, [r0]
|
||||
@ CHECK: ldrexd r0, r1, [r0] @ encoding: [0xd0,0xe8,0x7f,0x01]
|
||||
ldrexd r0, r1, [r0]
|
||||
@ CHECK: ssat16 r0, #7, r0 @ encoding: [0x20,0xf3,0x06,0x00]
|
||||
ssat16 r0, #7, r0
|
||||
|
@ -596,6 +596,7 @@ static int ARMFlagFromOpName(LiteralConstantEmitter *type,
|
||||
IMM("t_adrlabel");
|
||||
IMM("t2adrlabel");
|
||||
IMM("shift_imm");
|
||||
IMM("ssat_imm");
|
||||
IMM("neon_vcvt_imm32");
|
||||
IMM("shr_imm8");
|
||||
IMM("shr_imm16");
|
||||
|
Loading…
Reference in New Issue
Block a user