mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-02-22 13:29:44 +00:00
[Hexagon] Adding DoubleRegs decoder. Moving C2_mux and A2_nop. Adding combine imm-imm form.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@223494 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
33ada85735
commit
78ec9010c5
@ -61,6 +61,16 @@ static const uint16_t IntRegDecoderTable[] = {
|
|||||||
static const uint16_t PredRegDecoderTable[] = { Hexagon::P0, Hexagon::P1,
|
static const uint16_t PredRegDecoderTable[] = { Hexagon::P0, Hexagon::P1,
|
||||||
Hexagon::P2, Hexagon::P3 };
|
Hexagon::P2, Hexagon::P3 };
|
||||||
|
|
||||||
|
static DecodeStatus DecodeRegisterClass(MCInst &Inst, unsigned RegNo,
|
||||||
|
const uint16_t Table[], size_t Size) {
|
||||||
|
if (RegNo < Size) {
|
||||||
|
Inst.addOperand(MCOperand::CreateReg(Table[RegNo]));
|
||||||
|
return MCDisassembler::Success;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
return MCDisassembler::Fail;
|
||||||
|
}
|
||||||
|
|
||||||
static DecodeStatus DecodeIntRegsRegisterClass(MCInst &Inst, unsigned RegNo,
|
static DecodeStatus DecodeIntRegsRegisterClass(MCInst &Inst, unsigned RegNo,
|
||||||
uint64_t /*Address*/,
|
uint64_t /*Address*/,
|
||||||
void const *Decoder) {
|
void const *Decoder) {
|
||||||
@ -72,6 +82,20 @@ static DecodeStatus DecodeIntRegsRegisterClass(MCInst &Inst, unsigned RegNo,
|
|||||||
return MCDisassembler::Success;
|
return MCDisassembler::Success;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static DecodeStatus DecodeDoubleRegsRegisterClass(MCInst &Inst, unsigned RegNo,
|
||||||
|
uint64_t /*Address*/, const void *Decoder) {
|
||||||
|
static const uint16_t DoubleRegDecoderTable[] = {
|
||||||
|
Hexagon::D0, Hexagon::D1, Hexagon::D2, Hexagon::D3,
|
||||||
|
Hexagon::D4, Hexagon::D5, Hexagon::D6, Hexagon::D7,
|
||||||
|
Hexagon::D8, Hexagon::D9, Hexagon::D10, Hexagon::D11,
|
||||||
|
Hexagon::D12, Hexagon::D13, Hexagon::D14, Hexagon::D15
|
||||||
|
};
|
||||||
|
|
||||||
|
return (DecodeRegisterClass(Inst, RegNo >> 1,
|
||||||
|
DoubleRegDecoderTable,
|
||||||
|
sizeof (DoubleRegDecoderTable)));
|
||||||
|
}
|
||||||
|
|
||||||
static DecodeStatus DecodePredRegsRegisterClass(MCInst &Inst, unsigned RegNo,
|
static DecodeStatus DecodePredRegsRegisterClass(MCInst &Inst, unsigned RegNo,
|
||||||
uint64_t /*Address*/,
|
uint64_t /*Address*/,
|
||||||
void const *Decoder) {
|
void const *Decoder) {
|
||||||
|
@ -49,6 +49,7 @@ namespace llvm {
|
|||||||
RET_FLAG, // Return with a flag operand.
|
RET_FLAG, // Return with a flag operand.
|
||||||
BR_JT, // Jump table.
|
BR_JT, // Jump table.
|
||||||
BARRIER, // Memory barrier.
|
BARRIER, // Memory barrier.
|
||||||
|
COMBINE,
|
||||||
WrapperJT,
|
WrapperJT,
|
||||||
WrapperCP,
|
WrapperCP,
|
||||||
WrapperCombineII,
|
WrapperCombineII,
|
||||||
|
@ -96,6 +96,8 @@ multiclass CMP64_rr<string OpcStr, PatFrag OpNode> {
|
|||||||
def SDTHexagonI64I32I32 : SDTypeProfile<1, 2,
|
def SDTHexagonI64I32I32 : SDTypeProfile<1, 2,
|
||||||
[SDTCisVT<0, i64>, SDTCisVT<1, i32>, SDTCisSameAs<1, 2>]>;
|
[SDTCisVT<0, i64>, SDTCisVT<1, i32>, SDTCisSameAs<1, 2>]>;
|
||||||
|
|
||||||
|
def HexagonCOMBINE : SDNode<"HexagonISD::COMBINE", SDTHexagonI64I32I32>;
|
||||||
|
|
||||||
def HexagonWrapperCombineII :
|
def HexagonWrapperCombineII :
|
||||||
SDNode<"HexagonISD::WrapperCombineII", SDTHexagonI64I32I32>;
|
SDNode<"HexagonISD::WrapperCombineII", SDTHexagonI64I32I32>;
|
||||||
|
|
||||||
@ -267,6 +269,39 @@ def C2_mux: ALU32_rr<(outs IntRegs:$Rd),
|
|||||||
let Inst{4-0} = Rd;
|
let Inst{4-0} = Rd;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
def: Pat<(i32 (select (i1 PredRegs:$Pu), (i32 IntRegs:$Rs), (i32 IntRegs:$Rt))),
|
||||||
|
(C2_mux PredRegs:$Pu, IntRegs:$Rs, IntRegs:$Rt)>;
|
||||||
|
|
||||||
|
// Combines the two immediates into a double register.
|
||||||
|
// Increase complexity to make it greater than any complexity of a combine
|
||||||
|
// that involves a register.
|
||||||
|
|
||||||
|
let isReMaterializable = 1, isMoveImm = 1, isAsCheapAsAMove = 1,
|
||||||
|
isExtentSigned = 1, isExtendable = 1, opExtentBits = 8, opExtendable = 1,
|
||||||
|
AddedComplexity = 75, isCodeGenOnly = 0 in
|
||||||
|
def A2_combineii: ALU32Inst <(outs DoubleRegs:$Rdd), (ins s8Ext:$s8, s8Imm:$S8),
|
||||||
|
"$Rdd = combine(#$s8, #$S8)",
|
||||||
|
[(set (i64 DoubleRegs:$Rdd),
|
||||||
|
(i64 (HexagonCOMBINE(i32 s8ExtPred:$s8), (i32 s8ImmPred:$S8))))]> {
|
||||||
|
bits<5> Rdd;
|
||||||
|
bits<8> s8;
|
||||||
|
bits<8> S8;
|
||||||
|
|
||||||
|
let IClass = 0b0111;
|
||||||
|
let Inst{27-23} = 0b11000;
|
||||||
|
let Inst{22-16} = S8{7-1};
|
||||||
|
let Inst{13} = S8{0};
|
||||||
|
let Inst{12-5} = s8;
|
||||||
|
let Inst{4-0} = Rdd;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Nop.
|
||||||
|
let hasSideEffects = 0, isCodeGenOnly = 0 in
|
||||||
|
def A2_nop: ALU32Inst <(outs), (ins), "nop" > {
|
||||||
|
let IClass = 0b0111;
|
||||||
|
let Inst{27-24} = 0b1111;
|
||||||
|
}
|
||||||
|
|
||||||
multiclass ALU32_Pbase<string mnemonic, RegisterClass RC, bit isNot,
|
multiclass ALU32_Pbase<string mnemonic, RegisterClass RC, bit isNot,
|
||||||
bit isPredNew> {
|
bit isPredNew> {
|
||||||
let isPredicatedNew = isPredNew in
|
let isPredicatedNew = isPredNew in
|
||||||
@ -400,9 +435,6 @@ multiclass ZXTB_base <string mnemonic, bits<3> minOp> {
|
|||||||
let isCodeGenOnly=0 in
|
let isCodeGenOnly=0 in
|
||||||
defm zxtb : ZXTB_base<"zxtb",0b100>, PredNewRel;
|
defm zxtb : ZXTB_base<"zxtb",0b100>, PredNewRel;
|
||||||
|
|
||||||
def: Pat<(i32 (select (i1 PredRegs:$Pu), (i32 IntRegs:$Rs), (i32 IntRegs:$Rt))),
|
|
||||||
(C2_mux PredRegs:$Pu, IntRegs:$Rs, IntRegs:$Rt)>;
|
|
||||||
|
|
||||||
// Combines the two integer registers SRC1 and SRC2 into a double register.
|
// Combines the two integer registers SRC1 and SRC2 into a double register.
|
||||||
let isPredicable = 1 in
|
let isPredicable = 1 in
|
||||||
class T_Combine : ALU32_rr<(outs DoubleRegs:$dst),
|
class T_Combine : ALU32_rr<(outs DoubleRegs:$dst),
|
||||||
@ -491,13 +523,6 @@ def AND_ri : ALU32_ri<(outs IntRegs:$dst),
|
|||||||
[(set (i32 IntRegs:$dst), (and (i32 IntRegs:$src1),
|
[(set (i32 IntRegs:$dst), (and (i32 IntRegs:$src1),
|
||||||
s10ExtPred:$src2))]>, ImmRegRel;
|
s10ExtPred:$src2))]>, ImmRegRel;
|
||||||
|
|
||||||
// Nop.
|
|
||||||
let hasSideEffects = 0, isCodeGenOnly = 0 in
|
|
||||||
def A2_nop: ALU32Inst <(outs), (ins), "nop" > {
|
|
||||||
let IClass = 0b0111;
|
|
||||||
let Inst{27-24} = 0b1111;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Rd32=sub(#s10,Rs32)
|
// Rd32=sub(#s10,Rs32)
|
||||||
let isExtendable = 1, opExtendable = 1, isExtentSigned = 1, opExtentBits = 10,
|
let isExtendable = 1, opExtendable = 1, isExtentSigned = 1, opExtentBits = 10,
|
||||||
CextOpcode = "SUB", InputType = "imm" in
|
CextOpcode = "SUB", InputType = "imm" in
|
||||||
|
@ -8,6 +8,8 @@
|
|||||||
# CHECK: r17 = combine(r31.l, r21.h)
|
# CHECK: r17 = combine(r31.l, r21.h)
|
||||||
0x11 0xdf 0xf5 0xf3
|
0x11 0xdf 0xf5 0xf3
|
||||||
# CHECK: r17 = combine(r31.l, r21.l)
|
# CHECK: r17 = combine(r31.l, r21.l)
|
||||||
|
0xb0 0xe2 0x0f 0x7c
|
||||||
|
# CHECK: r17:16 = combine(#21, #31)
|
||||||
0x11 0xc0 0x15 0x70
|
0x11 0xc0 0x15 0x70
|
||||||
# CHECK: r17 = aslh(r21)
|
# CHECK: r17 = aslh(r21)
|
||||||
0x11 0xc0 0x35 0x70
|
0x11 0xc0 0x35 0x70
|
||||||
|
Loading…
x
Reference in New Issue
Block a user