Skip to content

Commit a58e2d1

Browse files
authored
[RISCV] Add compress patterns for qc.extu and qc.mvltui (#140682)
1 parent 86d1d4e commit a58e2d1

File tree

3 files changed

+16
-0
lines changed

3 files changed

+16
-0
lines changed

llvm/lib/Target/RISCV/RISCVInstrInfoXqci.td

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1489,6 +1489,9 @@ def : CompressPat<(QC_E_SW GPR:$rs2, GPRMem:$rs1, simm12:$imm12),
14891489
let Predicates = [HasVendorXqcicm, IsRV32] in {
14901490
def : CompressPat<(QC_MVEQI GPRC:$rd, GPRC:$rd, 0, GPRC:$rs1),
14911491
(QC_C_MVEQZ GPRC:$rd, GPRC:$rs1)>;
1492+
let isCompressOnly = true in
1493+
def : CompressPat<(QC_MVLTUI GPRC:$rd, GPRC:$rd, 1, GPRC:$rs1),
1494+
(QC_C_MVEQZ GPRC:$rd, GPRC:$rs1)>;
14921495
}
14931496

14941497
let Predicates = [HasVendorXqcibm, IsRV32] in {
@@ -1501,6 +1504,9 @@ def : CompressPat<(BSETI GPRC:$rs1, GPRC:$rs1, uimmlog2xlennonzero:$shamt),
15011504
(QC_C_BSETI GPRC:$rs1, uimmlog2xlennonzero:$shamt)>;
15021505
def : CompressPat<(BEXTI GPRC:$rs1, GPRC:$rs1, uimmlog2xlennonzero:$shamt),
15031506
(QC_C_BEXTI GPRC:$rs1, uimmlog2xlennonzero:$shamt)>;
1507+
let isCompressOnly = true in
1508+
def : CompressPat<(QC_EXTU GPRC:$rd, GPRC:$rd, 1, uimmlog2xlennonzero:$shamt),
1509+
(QC_C_BEXTI GPRC:$rd, uimmlog2xlennonzero:$shamt)>;
15041510
} // Predicates = [HasVendorXqcibm, HasStdExtZbs, IsRV32]
15051511

15061512
let isCompressOnly = true, Predicates = [HasVendorXqcilb, IsRV32] in {

llvm/test/MC/RISCV/xqcibm-valid.s

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,11 @@ qc.c.extu x15, 32
133133
# CHECK-ENC: encoding: [0xaa,0x15]
134134
qc.extu x11, x11, 11, 0
135135

136+
# CHECK-NOALIAS: qc.c.bexti a1, 5
137+
# CHECK-ALIAS: bexti a1, a1, 5
138+
# CHECK-ENC: encoding: [0x95,0x91]
139+
qc.extu x11, x11, 1, 5
140+
136141
# CHECK-NOALIAS: qc.c.bexti s1, 8
137142
# CHECK-ALIAS: bexti s1, s1, 8
138143
# CHECK-ENC-ZBS: encoding: [0xa1,0x90]

llvm/test/MC/RISCV/xqcicm-valid.s

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,3 +130,8 @@ qc.mvgeui x9, x10, 31, x12
130130
# CHECK-ENC: encoding: [0x06,0xae]
131131
qc.mveqi x9, x9, 0, x12
132132

133+
# CHECK-NOALIAS: qc.c.mveqz s1, a2
134+
# CHECK-ALIAS: qc.mveqi s1, s1, 0, a2
135+
# CHECK-ENC: encoding: [0x06,0xae]
136+
qc.mvltui x9, x9, 1, x12
137+

0 commit comments

Comments
 (0)