mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-01-02 07:32:52 +00:00
Do not infer the target type for COPY_TO_REGCLASS from dest regclass, this won't work if it can contain several types. Require explicit result type for the node for now. This fixes PR5364.
PS: It seems that blackfin usage of copy_to_regclass is completely bogus! git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@85766 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
2e1da9fea4
commit
3a639a07ea
@ -2409,10 +2409,10 @@ def : Pat<(extractelt (v4i32 QPR:$src), imm:$lane),
|
||||
(DSubReg_i32_reg imm:$lane))),
|
||||
(SubReg_i32_lane imm:$lane))>;
|
||||
def : Pat<(extractelt (v2f32 DPR:$src1), imm:$src2),
|
||||
(EXTRACT_SUBREG (COPY_TO_REGCLASS DPR:$src1, DPR_VFP2),
|
||||
(EXTRACT_SUBREG (v2f32 (COPY_TO_REGCLASS (v2f32 DPR:$src1), DPR_VFP2)),
|
||||
(SSubReg_f32_reg imm:$src2))>;
|
||||
def : Pat<(extractelt (v4f32 QPR:$src1), imm:$src2),
|
||||
(EXTRACT_SUBREG (COPY_TO_REGCLASS QPR:$src1, QPR_VFP2),
|
||||
(EXTRACT_SUBREG (v4f32 (COPY_TO_REGCLASS (v4f32 QPR:$src1), QPR_VFP2)),
|
||||
(SSubReg_f32_reg imm:$src2))>;
|
||||
//def : Pat<(extractelt (v2i64 QPR:$src1), imm:$src2),
|
||||
// (EXTRACT_SUBREG QPR:$src1, (DSubReg_f64_reg imm:$src2))>;
|
||||
@ -2459,11 +2459,11 @@ def : Pat<(insertelt (v4i32 QPR:$src1), GPR:$src2, imm:$lane),
|
||||
(DSubReg_i32_reg imm:$lane)))>;
|
||||
|
||||
def : Pat<(v2f32 (insertelt DPR:$src1, SPR:$src2, imm:$src3)),
|
||||
(INSERT_SUBREG (COPY_TO_REGCLASS DPR:$src1, DPR_VFP2),
|
||||
SPR:$src2, (SSubReg_f32_reg imm:$src3))>;
|
||||
(INSERT_SUBREG (v2f32 (COPY_TO_REGCLASS DPR:$src1, DPR_VFP2)),
|
||||
SPR:$src2, (SSubReg_f32_reg imm:$src3))>;
|
||||
def : Pat<(v4f32 (insertelt QPR:$src1, SPR:$src2, imm:$src3)),
|
||||
(INSERT_SUBREG (COPY_TO_REGCLASS QPR:$src1, QPR_VFP2),
|
||||
SPR:$src2, (SSubReg_f32_reg imm:$src3))>;
|
||||
(INSERT_SUBREG (v4f32 (COPY_TO_REGCLASS QPR:$src1, QPR_VFP2)),
|
||||
SPR:$src2, (SSubReg_f32_reg imm:$src3))>;
|
||||
|
||||
//def : Pat<(v2i64 (insertelt QPR:$src1, DPR:$src2, imm:$src3)),
|
||||
// (INSERT_SUBREG QPR:$src1, DPR:$src2, (DSubReg_f64_reg imm:$src3))>;
|
||||
|
@ -329,7 +329,7 @@ def DPR : RegisterClass<"ARM", [f64, v8i8, v4i16, v2i32, v1i64, v2f32], 64,
|
||||
|
||||
// Subset of DPR that are accessible with VFP2 (and so that also have
|
||||
// 32-bit SPR subregs).
|
||||
def DPR_VFP2 : RegisterClass<"ARM", [f64, v2i32, v2f32], 64,
|
||||
def DPR_VFP2 : RegisterClass<"ARM", [f64, v8i8, v4i16, v2i32, v1i64, v2f32], 64,
|
||||
[D0, D1, D2, D3, D4, D5, D6, D7,
|
||||
D8, D9, D10, D11, D12, D13, D14, D15]> {
|
||||
let SubRegClassList = [SPR, SPR];
|
||||
@ -337,7 +337,7 @@ def DPR_VFP2 : RegisterClass<"ARM", [f64, v2i32, v2f32], 64,
|
||||
|
||||
// Subset of DPR which can be used as a source of NEON scalars for 16-bit
|
||||
// operations
|
||||
def DPR_8 : RegisterClass<"ARM", [f64, v4i16, v2f32], 64,
|
||||
def DPR_8 : RegisterClass<"ARM", [f64, v8i8, v4i16, v2i32, v1i64, v2f32], 64,
|
||||
[D0, D1, D2, D3, D4, D5, D6, D7]> {
|
||||
let SubRegClassList = [SPR_8, SPR_8];
|
||||
}
|
||||
|
@ -465,16 +465,16 @@ def STORE32i_post: F1<(outs I:$ptr_wb), (ins D:$val, I:$ptr, M:$off),
|
||||
}
|
||||
|
||||
def : Pat<(truncstorei16 D:$val, PI:$ptr),
|
||||
(STORE16pi (EXTRACT_SUBREG (COPY_TO_REGCLASS D:$val, D),
|
||||
(STORE16pi (EXTRACT_SUBREG (i32 (COPY_TO_REGCLASS D:$val, D)),
|
||||
bfin_subreg_lo16), PI:$ptr)>;
|
||||
|
||||
def : Pat<(truncstorei16 (srl D:$val, (i16 16)), PI:$ptr),
|
||||
(STORE16pi (EXTRACT_SUBREG (COPY_TO_REGCLASS D:$val, D),
|
||||
(STORE16pi (EXTRACT_SUBREG (i32 (COPY_TO_REGCLASS D:$val, D)),
|
||||
bfin_subreg_hi16), PI:$ptr)>;
|
||||
|
||||
def : Pat<(truncstorei8 D16L:$val, P:$ptr),
|
||||
(STORE8p (INSERT_SUBREG (i32 (IMPLICIT_DEF)),
|
||||
(COPY_TO_REGCLASS D16L:$val, D16L),
|
||||
(i16 (COPY_TO_REGCLASS D16L:$val, D16L)),
|
||||
bfin_subreg_lo16),
|
||||
P:$ptr)>;
|
||||
|
||||
@ -525,7 +525,7 @@ def : Pat<(and D:$src, 0xffff),
|
||||
|
||||
def : Pat<(i32 (anyext D16L:$src)),
|
||||
(INSERT_SUBREG (i32 (IMPLICIT_DEF)),
|
||||
(COPY_TO_REGCLASS D16L:$src, D16L),
|
||||
(i16 (COPY_TO_REGCLASS D16L:$src, D16L)),
|
||||
bfin_subreg_lo16)>;
|
||||
|
||||
// TODO Dreg = Dreg_byte (X/Z)
|
||||
@ -870,4 +870,4 @@ def : Pat<(i16 (anyext JustCC:$cc)),
|
||||
(EXTRACT_SUBREG (MOVECC_zext JustCC:$cc), bfin_subreg_lo16)>;
|
||||
|
||||
def : Pat<(i16 (trunc D:$src)),
|
||||
(EXTRACT_SUBREG (COPY_TO_REGCLASS D:$src, D), bfin_subreg_lo16)>;
|
||||
(EXTRACT_SUBREG (i32 (COPY_TO_REGCLASS D:$src, D)), bfin_subreg_lo16)>;
|
||||
|
@ -1808,43 +1808,43 @@ def : Pat<(and (srl_su GR64:$src, (i8 8)), (i64 255)),
|
||||
(SUBREG_TO_REG
|
||||
(i64 0),
|
||||
(MOVZX32_NOREXrr8
|
||||
(EXTRACT_SUBREG (COPY_TO_REGCLASS GR64:$src, GR64_ABCD),
|
||||
(EXTRACT_SUBREG (i64 (COPY_TO_REGCLASS GR64:$src, GR64_ABCD)),
|
||||
x86_subreg_8bit_hi)),
|
||||
x86_subreg_32bit)>;
|
||||
def : Pat<(and (srl_su GR32:$src, (i8 8)), (i32 255)),
|
||||
(MOVZX32_NOREXrr8
|
||||
(EXTRACT_SUBREG (COPY_TO_REGCLASS GR32:$src, GR32_ABCD),
|
||||
(EXTRACT_SUBREG (i32 (COPY_TO_REGCLASS GR32:$src, GR32_ABCD)),
|
||||
x86_subreg_8bit_hi))>,
|
||||
Requires<[In64BitMode]>;
|
||||
def : Pat<(srl_su GR16:$src, (i8 8)),
|
||||
(EXTRACT_SUBREG
|
||||
(MOVZX32_NOREXrr8
|
||||
(EXTRACT_SUBREG (COPY_TO_REGCLASS GR16:$src, GR16_ABCD),
|
||||
(EXTRACT_SUBREG (i16 (COPY_TO_REGCLASS GR16:$src, GR16_ABCD)),
|
||||
x86_subreg_8bit_hi)),
|
||||
x86_subreg_16bit)>,
|
||||
Requires<[In64BitMode]>;
|
||||
def : Pat<(i32 (zext (srl_su GR16:$src, (i8 8)))),
|
||||
(MOVZX32_NOREXrr8
|
||||
(EXTRACT_SUBREG (COPY_TO_REGCLASS GR16:$src, GR16_ABCD),
|
||||
(EXTRACT_SUBREG (i16 (COPY_TO_REGCLASS GR16:$src, GR16_ABCD)),
|
||||
x86_subreg_8bit_hi))>,
|
||||
Requires<[In64BitMode]>;
|
||||
def : Pat<(i32 (anyext (srl_su GR16:$src, (i8 8)))),
|
||||
(MOVZX32_NOREXrr8
|
||||
(EXTRACT_SUBREG (COPY_TO_REGCLASS GR16:$src, GR16_ABCD),
|
||||
(EXTRACT_SUBREG (i16 (COPY_TO_REGCLASS GR16:$src, GR16_ABCD)),
|
||||
x86_subreg_8bit_hi))>,
|
||||
Requires<[In64BitMode]>;
|
||||
def : Pat<(i64 (zext (srl_su GR16:$src, (i8 8)))),
|
||||
(SUBREG_TO_REG
|
||||
(i64 0),
|
||||
(MOVZX32_NOREXrr8
|
||||
(EXTRACT_SUBREG (COPY_TO_REGCLASS GR16:$src, GR16_ABCD),
|
||||
(EXTRACT_SUBREG (i16 (COPY_TO_REGCLASS GR16:$src, GR16_ABCD)),
|
||||
x86_subreg_8bit_hi)),
|
||||
x86_subreg_32bit)>;
|
||||
def : Pat<(i64 (anyext (srl_su GR16:$src, (i8 8)))),
|
||||
(SUBREG_TO_REG
|
||||
(i64 0),
|
||||
(MOVZX32_NOREXrr8
|
||||
(EXTRACT_SUBREG (COPY_TO_REGCLASS GR16:$src, GR16_ABCD),
|
||||
(EXTRACT_SUBREG (i16 (COPY_TO_REGCLASS GR16:$src, GR16_ABCD)),
|
||||
x86_subreg_8bit_hi)),
|
||||
x86_subreg_32bit)>;
|
||||
|
||||
@ -1852,18 +1852,18 @@ def : Pat<(i64 (anyext (srl_su GR16:$src, (i8 8)))),
|
||||
def : Pat<(store (i8 (trunc_su (srl_su GR64:$src, (i8 8)))), addr:$dst),
|
||||
(MOV8mr_NOREX
|
||||
addr:$dst,
|
||||
(EXTRACT_SUBREG (COPY_TO_REGCLASS GR64:$src, GR64_ABCD),
|
||||
(EXTRACT_SUBREG (i64 (COPY_TO_REGCLASS GR64:$src, GR64_ABCD)),
|
||||
x86_subreg_8bit_hi))>;
|
||||
def : Pat<(store (i8 (trunc_su (srl_su GR32:$src, (i8 8)))), addr:$dst),
|
||||
(MOV8mr_NOREX
|
||||
addr:$dst,
|
||||
(EXTRACT_SUBREG (COPY_TO_REGCLASS GR32:$src, GR32_ABCD),
|
||||
(EXTRACT_SUBREG (i32 (COPY_TO_REGCLASS GR32:$src, GR32_ABCD)),
|
||||
x86_subreg_8bit_hi))>,
|
||||
Requires<[In64BitMode]>;
|
||||
def : Pat<(store (i8 (trunc_su (srl_su GR16:$src, (i8 8)))), addr:$dst),
|
||||
(MOV8mr_NOREX
|
||||
addr:$dst,
|
||||
(EXTRACT_SUBREG (COPY_TO_REGCLASS GR16:$src, GR16_ABCD),
|
||||
(EXTRACT_SUBREG (i16 (COPY_TO_REGCLASS GR16:$src, GR16_ABCD)),
|
||||
x86_subreg_8bit_hi))>,
|
||||
Requires<[In64BitMode]>;
|
||||
|
||||
|
@ -3969,12 +3969,14 @@ def : Pat<(and GR32:$src1, 0xffff),
|
||||
(MOVZX32rr16 (EXTRACT_SUBREG GR32:$src1, x86_subreg_16bit))>;
|
||||
// r & (2^8-1) ==> movz
|
||||
def : Pat<(and GR32:$src1, 0xff),
|
||||
(MOVZX32rr8 (EXTRACT_SUBREG (COPY_TO_REGCLASS GR32:$src1, GR32_ABCD),
|
||||
(MOVZX32rr8 (EXTRACT_SUBREG (i32 (COPY_TO_REGCLASS GR32:$src1,
|
||||
GR32_ABCD)),
|
||||
x86_subreg_8bit))>,
|
||||
Requires<[In32BitMode]>;
|
||||
// r & (2^8-1) ==> movz
|
||||
def : Pat<(and GR16:$src1, 0xff),
|
||||
(MOVZX16rr8 (EXTRACT_SUBREG (COPY_TO_REGCLASS GR16:$src1, GR16_ABCD),
|
||||
(MOVZX16rr8 (EXTRACT_SUBREG (i16 (COPY_TO_REGCLASS GR16:$src1,
|
||||
GR16_ABCD)),
|
||||
x86_subreg_8bit))>,
|
||||
Requires<[In32BitMode]>;
|
||||
|
||||
@ -3982,11 +3984,13 @@ def : Pat<(and GR16:$src1, 0xff),
|
||||
def : Pat<(sext_inreg GR32:$src, i16),
|
||||
(MOVSX32rr16 (EXTRACT_SUBREG GR32:$src, x86_subreg_16bit))>;
|
||||
def : Pat<(sext_inreg GR32:$src, i8),
|
||||
(MOVSX32rr8 (EXTRACT_SUBREG (COPY_TO_REGCLASS GR32:$src, GR32_ABCD),
|
||||
(MOVSX32rr8 (EXTRACT_SUBREG (i32 (COPY_TO_REGCLASS GR32:$src,
|
||||
GR32_ABCD)),
|
||||
x86_subreg_8bit))>,
|
||||
Requires<[In32BitMode]>;
|
||||
def : Pat<(sext_inreg GR16:$src, i8),
|
||||
(MOVSX16rr8 (EXTRACT_SUBREG (COPY_TO_REGCLASS GR16:$src, GR16_ABCD),
|
||||
(MOVSX16rr8 (EXTRACT_SUBREG (i16 (COPY_TO_REGCLASS GR16:$src,
|
||||
GR16_ABCD)),
|
||||
x86_subreg_8bit))>,
|
||||
Requires<[In32BitMode]>;
|
||||
|
||||
@ -3994,40 +3998,40 @@ def : Pat<(sext_inreg GR16:$src, i8),
|
||||
def : Pat<(i16 (trunc GR32:$src)),
|
||||
(EXTRACT_SUBREG GR32:$src, x86_subreg_16bit)>;
|
||||
def : Pat<(i8 (trunc GR32:$src)),
|
||||
(EXTRACT_SUBREG (COPY_TO_REGCLASS GR32:$src, GR32_ABCD),
|
||||
(EXTRACT_SUBREG (i32 (COPY_TO_REGCLASS GR32:$src, GR32_ABCD)),
|
||||
x86_subreg_8bit)>,
|
||||
Requires<[In32BitMode]>;
|
||||
def : Pat<(i8 (trunc GR16:$src)),
|
||||
(EXTRACT_SUBREG (COPY_TO_REGCLASS GR16:$src, GR16_ABCD),
|
||||
(EXTRACT_SUBREG (i16 (COPY_TO_REGCLASS GR16:$src, GR16_ABCD)),
|
||||
x86_subreg_8bit)>,
|
||||
Requires<[In32BitMode]>;
|
||||
|
||||
// h-register tricks
|
||||
def : Pat<(i8 (trunc (srl_su GR16:$src, (i8 8)))),
|
||||
(EXTRACT_SUBREG (COPY_TO_REGCLASS GR16:$src, GR16_ABCD),
|
||||
(EXTRACT_SUBREG (i32 (COPY_TO_REGCLASS GR16:$src, GR16_ABCD)),
|
||||
x86_subreg_8bit_hi)>,
|
||||
Requires<[In32BitMode]>;
|
||||
def : Pat<(i8 (trunc (srl_su GR32:$src, (i8 8)))),
|
||||
(EXTRACT_SUBREG (COPY_TO_REGCLASS GR32:$src, GR32_ABCD),
|
||||
(EXTRACT_SUBREG (i16 (COPY_TO_REGCLASS GR32:$src, GR32_ABCD)),
|
||||
x86_subreg_8bit_hi)>,
|
||||
Requires<[In32BitMode]>;
|
||||
def : Pat<(srl_su GR16:$src, (i8 8)),
|
||||
(EXTRACT_SUBREG
|
||||
(MOVZX32rr8
|
||||
(EXTRACT_SUBREG (COPY_TO_REGCLASS GR16:$src, GR16_ABCD),
|
||||
(EXTRACT_SUBREG (i16 (COPY_TO_REGCLASS GR16:$src, GR16_ABCD)),
|
||||
x86_subreg_8bit_hi)),
|
||||
x86_subreg_16bit)>,
|
||||
Requires<[In32BitMode]>;
|
||||
def : Pat<(i32 (zext (srl_su GR16:$src, (i8 8)))),
|
||||
(MOVZX32rr8 (EXTRACT_SUBREG (COPY_TO_REGCLASS GR16:$src, GR16_ABCD),
|
||||
(MOVZX32rr8 (EXTRACT_SUBREG (i16 (COPY_TO_REGCLASS GR16:$src, GR16_ABCD)),
|
||||
x86_subreg_8bit_hi))>,
|
||||
Requires<[In32BitMode]>;
|
||||
def : Pat<(i32 (anyext (srl_su GR16:$src, (i8 8)))),
|
||||
(MOVZX32rr8 (EXTRACT_SUBREG (COPY_TO_REGCLASS GR16:$src, GR16_ABCD),
|
||||
(MOVZX32rr8 (EXTRACT_SUBREG (i16 (COPY_TO_REGCLASS GR16:$src, GR16_ABCD)),
|
||||
x86_subreg_8bit_hi))>,
|
||||
Requires<[In32BitMode]>;
|
||||
def : Pat<(and (srl_su GR32:$src, (i8 8)), (i32 255)),
|
||||
(MOVZX32rr8 (EXTRACT_SUBREG (COPY_TO_REGCLASS GR32:$src, GR32_ABCD),
|
||||
(MOVZX32rr8 (EXTRACT_SUBREG (i32 (COPY_TO_REGCLASS GR32:$src, GR32_ABCD)),
|
||||
x86_subreg_8bit_hi))>,
|
||||
Requires<[In32BitMode]>;
|
||||
|
||||
|
@ -915,7 +915,6 @@ bool TreePatternNode::ApplyTypeConstraints(TreePattern &TP, bool NotRegisters) {
|
||||
bool MadeChange = false;
|
||||
MadeChange |= getChild(0)->ApplyTypeConstraints(TP, NotRegisters);
|
||||
MadeChange |= getChild(1)->ApplyTypeConstraints(TP, NotRegisters);
|
||||
MadeChange |= UpdateNodeType(getChild(1)->getTypeNum(0), TP);
|
||||
return MadeChange;
|
||||
} else if (const CodeGenIntrinsic *Int = getIntrinsicInfo(CDP)) {
|
||||
bool MadeChange = false;
|
||||
|
Loading…
Reference in New Issue
Block a user