mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-12-13 20:32:21 +00:00
ARM: NEON SHLL instruction immediate operand range checking.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@146003 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
f91abd22be
commit
3b8991cc98
@ -238,11 +238,6 @@ def so_imm_not_XFORM : SDNodeXForm<imm, [{
|
||||
return CurDAG->getTargetConstant(~(int)N->getZExtValue(), MVT::i32);
|
||||
}]>;
|
||||
|
||||
/// imm1_15 predicate - True if the 32-bit immediate is in the range [1,15].
|
||||
def imm1_15 : ImmLeaf<i32, [{
|
||||
return (int32_t)Imm >= 1 && (int32_t)Imm < 16;
|
||||
}]>;
|
||||
|
||||
/// imm16_31 predicate - True if the 32-bit immediate is in the range [16,31].
|
||||
def imm16_31 : ImmLeaf<i32, [{
|
||||
return (int32_t)Imm >= 16 && (int32_t)Imm < 32;
|
||||
@ -528,6 +523,42 @@ def imm0_7 : Operand<i32>, ImmLeaf<i32, [{
|
||||
let ParserMatchClass = Imm0_7AsmOperand;
|
||||
}
|
||||
|
||||
/// imm8 predicate - Immediate is exactly 8.
|
||||
def Imm8AsmOperand: ImmAsmOperand { let Name = "Imm8"; }
|
||||
def imm8 : Operand<i32>, ImmLeaf<i32, [{ return Imm == 8; }]> {
|
||||
let ParserMatchClass = Imm8AsmOperand;
|
||||
}
|
||||
|
||||
/// imm16 predicate - Immediate is exactly 16.
|
||||
def Imm16AsmOperand: ImmAsmOperand { let Name = "Imm16"; }
|
||||
def imm16 : Operand<i32>, ImmLeaf<i32, [{ return Imm == 16; }]> {
|
||||
let ParserMatchClass = Imm16AsmOperand;
|
||||
}
|
||||
|
||||
/// imm32 predicate - Immediate is exactly 32.
|
||||
def Imm32AsmOperand: ImmAsmOperand { let Name = "Imm32"; }
|
||||
def imm32 : Operand<i32>, ImmLeaf<i32, [{ return Imm == 32; }]> {
|
||||
let ParserMatchClass = Imm32AsmOperand;
|
||||
}
|
||||
|
||||
/// imm1_7 predicate - Immediate in the range [1,7].
|
||||
def Imm1_7AsmOperand: ImmAsmOperand { let Name = "Imm1_7"; }
|
||||
def imm1_7 : Operand<i32>, ImmLeaf<i32, [{ return Imm > 0 && Imm < 8; }]> {
|
||||
let ParserMatchClass = Imm1_7AsmOperand;
|
||||
}
|
||||
|
||||
/// imm1_15 predicate - Immediate in the range [1,15].
|
||||
def Imm1_15AsmOperand: ImmAsmOperand { let Name = "Imm1_15"; }
|
||||
def imm1_15 : Operand<i32>, ImmLeaf<i32, [{ return Imm > 0 && Imm < 16; }]> {
|
||||
let ParserMatchClass = Imm1_15AsmOperand;
|
||||
}
|
||||
|
||||
/// imm1_31 predicate - Immediate in the range [1,31].
|
||||
def Imm1_31AsmOperand: ImmAsmOperand { let Name = "Imm1_31"; }
|
||||
def imm1_31 : Operand<i32>, ImmLeaf<i32, [{ return Imm > 0 && Imm < 32; }]> {
|
||||
let ParserMatchClass = Imm1_31AsmOperand;
|
||||
}
|
||||
|
||||
/// imm0_15 predicate - Immediate in the range [0,15].
|
||||
def Imm0_15AsmOperand: ImmAsmOperand { let Name = "Imm0_15"; }
|
||||
def imm0_15 : Operand<i32>, ImmLeaf<i32, [{
|
||||
|
@ -3567,15 +3567,15 @@ multiclass N2VShInsR_QHSD<bit op24, bit op23, bits<4> op11_8, bit op4,
|
||||
multiclass N2VLSh_QHS<bit op24, bit op23, bits<4> op11_8, bit op7, bit op6,
|
||||
bit op4, string OpcodeStr, string Dt, SDNode OpNode> {
|
||||
def v8i16 : N2VLSh<op24, op23, op11_8, op7, op6, op4,
|
||||
OpcodeStr, !strconcat(Dt, "8"), v8i16, v8i8, i32imm, OpNode> {
|
||||
OpcodeStr, !strconcat(Dt, "8"), v8i16, v8i8, imm1_7, OpNode> {
|
||||
let Inst{21-19} = 0b001; // imm6 = 001xxx
|
||||
}
|
||||
def v4i32 : N2VLSh<op24, op23, op11_8, op7, op6, op4,
|
||||
OpcodeStr, !strconcat(Dt, "16"), v4i32, v4i16, i32imm, OpNode> {
|
||||
OpcodeStr, !strconcat(Dt, "16"), v4i32, v4i16, imm1_15, OpNode> {
|
||||
let Inst{21-20} = 0b01; // imm6 = 01xxxx
|
||||
}
|
||||
def v2i64 : N2VLSh<op24, op23, op11_8, op7, op6, op4,
|
||||
OpcodeStr, !strconcat(Dt, "32"), v2i64, v2i32, i32imm, OpNode> {
|
||||
OpcodeStr, !strconcat(Dt, "32"), v2i64, v2i32, imm1_31, OpNode> {
|
||||
let Inst{21} = 0b1; // imm6 = 1xxxxx
|
||||
}
|
||||
}
|
||||
@ -4382,11 +4382,11 @@ class N2VLShMax<bit op24, bit op23, bits<6> op21_16, bits<4> op11_8, bit op7,
|
||||
let DecoderMethod = "DecodeVSHLMaxInstruction";
|
||||
}
|
||||
def VSHLLi8 : N2VLShMax<1, 1, 0b110010, 0b0011, 0, 0, 0, "vshll", "i8",
|
||||
v8i16, v8i8, i32imm, NEONvshlli>;
|
||||
v8i16, v8i8, imm8, NEONvshlli>;
|
||||
def VSHLLi16 : N2VLShMax<1, 1, 0b110110, 0b0011, 0, 0, 0, "vshll", "i16",
|
||||
v4i32, v4i16, i32imm, NEONvshlli>;
|
||||
v4i32, v4i16, imm16, NEONvshlli>;
|
||||
def VSHLLi32 : N2VLShMax<1, 1, 0b111010, 0b0011, 0, 0, 0, "vshll", "i32",
|
||||
v2i64, v2i32, i32imm, NEONvshlli>;
|
||||
v2i64, v2i32, imm32, NEONvshlli>;
|
||||
|
||||
// VSHRN : Vector Shift Right and Narrow
|
||||
defm VSHRN : N2VNSh_HSD<0,1,0b1000,0,0,1, IIC_VSHLiD, "vshrn", "i",
|
||||
|
@ -610,6 +610,54 @@ public:
|
||||
int64_t Value = CE->getValue();
|
||||
return Value >= 0 && Value < 32;
|
||||
}
|
||||
bool isImm8() const {
|
||||
if (Kind != k_Immediate)
|
||||
return false;
|
||||
const MCConstantExpr *CE = dyn_cast<MCConstantExpr>(getImm());
|
||||
if (!CE) return false;
|
||||
int64_t Value = CE->getValue();
|
||||
return Value == 8;
|
||||
}
|
||||
bool isImm16() const {
|
||||
if (Kind != k_Immediate)
|
||||
return false;
|
||||
const MCConstantExpr *CE = dyn_cast<MCConstantExpr>(getImm());
|
||||
if (!CE) return false;
|
||||
int64_t Value = CE->getValue();
|
||||
return Value == 16;
|
||||
}
|
||||
bool isImm32() const {
|
||||
if (Kind != k_Immediate)
|
||||
return false;
|
||||
const MCConstantExpr *CE = dyn_cast<MCConstantExpr>(getImm());
|
||||
if (!CE) return false;
|
||||
int64_t Value = CE->getValue();
|
||||
return Value == 32;
|
||||
}
|
||||
bool isImm1_7() const {
|
||||
if (Kind != k_Immediate)
|
||||
return false;
|
||||
const MCConstantExpr *CE = dyn_cast<MCConstantExpr>(getImm());
|
||||
if (!CE) return false;
|
||||
int64_t Value = CE->getValue();
|
||||
return Value > 0 && Value < 8;
|
||||
}
|
||||
bool isImm1_15() const {
|
||||
if (Kind != k_Immediate)
|
||||
return false;
|
||||
const MCConstantExpr *CE = dyn_cast<MCConstantExpr>(getImm());
|
||||
if (!CE) return false;
|
||||
int64_t Value = CE->getValue();
|
||||
return Value > 0 && Value < 16;
|
||||
}
|
||||
bool isImm1_31() const {
|
||||
if (Kind != k_Immediate)
|
||||
return false;
|
||||
const MCConstantExpr *CE = dyn_cast<MCConstantExpr>(getImm());
|
||||
if (!CE) return false;
|
||||
int64_t Value = CE->getValue();
|
||||
return Value > 0 && Value < 32;
|
||||
}
|
||||
bool isImm1_16() const {
|
||||
if (Kind != k_Immediate)
|
||||
return false;
|
||||
|
@ -610,6 +610,12 @@ static int ARMFlagFromOpName(LiteralConstantEmitter *type,
|
||||
IMM("nImmSplatI64");
|
||||
IMM("nImmVMOVI32");
|
||||
IMM("nImmVMOVF32");
|
||||
IMM("imm8");
|
||||
IMM("imm16");
|
||||
IMM("imm32");
|
||||
IMM("imm1_7");
|
||||
IMM("imm1_15");
|
||||
IMM("imm1_31");
|
||||
IMM("imm0_1");
|
||||
IMM("imm0_3");
|
||||
IMM("imm0_7");
|
||||
|
Loading…
Reference in New Issue
Block a user