Skip to content

Commit 6c4bd66

Browse files
authored
[RISCV] Remove i32 and i16 from GPR register class. NFC (#162425)
Reduces RISCVGenDAGISel.inc by ~2000 bytes. I had to adjust some casts to avoid a tablegen error about an immediate being too large. The error was suppressed before because the type wasn't "concrete" early enough.
1 parent 0f3ca19 commit 6c4bd66

File tree

2 files changed

+13
-13
lines changed

2 files changed

+13
-13
lines changed

llvm/lib/Target/RISCV/RISCVInstrInfoZb.td

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -788,32 +788,32 @@ multiclass ShxAdd_UWPat<int i, Instruction shxadd_uw> {
788788
}
789789

790790
multiclass Sh1Add_UWPat<Instruction sh1add_uw> {
791-
def : Pat<(i64 (add_like_non_imm12 (and (shl GPR:$rs1, (i64 1)), 0x1FFFFFFFF),
792-
(XLenVT GPR:$rs2))),
791+
def : Pat<(add_like_non_imm12 (and (shl GPR:$rs1, (i64 1)), (i64 0x1FFFFFFFF)),
792+
(XLenVT GPR:$rs2)),
793793
(sh1add_uw GPR:$rs1, GPR:$rs2)>;
794794
// Use SRLI to clear the LSBs and SHXADD_UW to mask and shift.
795-
def : Pat<(i64 (add_like_non_imm12 (and GPR:$rs1, 0x1FFFFFFFE),
796-
(XLenVT GPR:$rs2))),
795+
def : Pat<(add_like_non_imm12 (and GPR:$rs1, (i64 0x1FFFFFFFE)),
796+
(XLenVT GPR:$rs2)),
797797
(sh1add_uw (XLenVT (SRLI GPR:$rs1, 1)), GPR:$rs2)>;
798798
}
799799

800800
multiclass Sh2Add_UWPat<Instruction sh2add_uw> {
801-
def : Pat<(i64 (add_like_non_imm12 (and (shl GPR:$rs1, (i64 2)), 0x3FFFFFFFF),
802-
(XLenVT GPR:$rs2))),
801+
def : Pat<(add_like_non_imm12 (and (shl GPR:$rs1, (i64 2)), (i64 0x3FFFFFFFF)),
802+
(XLenVT GPR:$rs2)),
803803
(sh2add_uw GPR:$rs1, GPR:$rs2)>;
804804
// Use SRLI to clear the LSBs and SHXADD_UW to mask and shift.
805-
def : Pat<(i64 (add_like_non_imm12 (and GPR:$rs1, 0x3FFFFFFFC),
806-
(XLenVT GPR:$rs2))),
805+
def : Pat<(add_like_non_imm12 (and GPR:$rs1, (i64 0x3FFFFFFFC)),
806+
(XLenVT GPR:$rs2)),
807807
(sh2add_uw (XLenVT (SRLI GPR:$rs1, 2)), GPR:$rs2)>;
808808
}
809809

810810
multiclass Sh3Add_UWPat<Instruction sh3add_uw> {
811-
def : Pat<(i64 (add_like_non_imm12 (and (shl GPR:$rs1, (i64 3)), 0x7FFFFFFFF),
812-
(XLenVT GPR:$rs2))),
811+
def : Pat<(add_like_non_imm12 (and (shl GPR:$rs1, (i64 3)), (i64 0x7FFFFFFFF)),
812+
(XLenVT GPR:$rs2)),
813813
(sh3add_uw GPR:$rs1, GPR:$rs2)>;
814814
// Use SRLI to clear the LSBs and SHXADD_UW to mask and shift.
815-
def : Pat<(i64 (add_like_non_imm12 (and GPR:$rs1, 0x7FFFFFFF8),
816-
(XLenVT GPR:$rs2))),
815+
def : Pat<(add_like_non_imm12 (and GPR:$rs1, (i64 0x7FFFFFFF8)),
816+
(XLenVT GPR:$rs2)),
817817
(sh3add_uw (XLenVT (SRLI GPR:$rs1, 3)), GPR:$rs2)>;
818818
}
819819

llvm/lib/Target/RISCV/RISCVRegisterInfo.td

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -238,7 +238,7 @@ class RISCVRegisterClass<list<ValueType> regTypes, int align, dag regList>
238238
}
239239

240240
class GPRRegisterClass<dag regList>
241-
: RISCVRegisterClass<[XLenVT, XLenFVT, i32, i16], 32, regList> {
241+
: RISCVRegisterClass<[XLenVT, XLenFVT], 32, regList> {
242242
let RegInfos = XLenRI;
243243
}
244244

0 commit comments

Comments
 (0)