Skip to content

[RISCV] Add compress patterns for qc.extu and qc.mvltui #140682

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions llvm/lib/Target/RISCV/RISCVInstrInfoXqci.td
Original file line number Diff line number Diff line change
Expand Up @@ -1489,6 +1489,9 @@ def : CompressPat<(QC_E_SW GPR:$rs2, GPRMem:$rs1, simm12:$imm12),
let Predicates = [HasVendorXqcicm, IsRV32] in {
def : CompressPat<(QC_MVEQI GPRC:$rd, GPRC:$rd, 0, GPRC:$rs1),
(QC_C_MVEQZ GPRC:$rd, GPRC:$rs1)>;
let isCompressOnly = true in
def : CompressPat<(QC_MVLTUI GPRC:$rd, GPRC:$rd, 1, GPRC:$rs1),
(QC_C_MVEQZ GPRC:$rd, GPRC:$rs1)>;
}

let Predicates = [HasVendorXqcibm, IsRV32] in {
Expand All @@ -1501,6 +1504,9 @@ def : CompressPat<(BSETI GPRC:$rs1, GPRC:$rs1, uimmlog2xlennonzero:$shamt),
(QC_C_BSETI GPRC:$rs1, uimmlog2xlennonzero:$shamt)>;
def : CompressPat<(BEXTI GPRC:$rs1, GPRC:$rs1, uimmlog2xlennonzero:$shamt),
(QC_C_BEXTI GPRC:$rs1, uimmlog2xlennonzero:$shamt)>;
let isCompressOnly = true in
def : CompressPat<(QC_EXTU GPRC:$rd, GPRC:$rd, 1, uimmlog2xlennonzero:$shamt),
(QC_C_BEXTI GPRC:$rd, uimmlog2xlennonzero:$shamt)>;
} // Predicates = [HasVendorXqcibm, HasStdExtZbs, IsRV32]

let isCompressOnly = true, Predicates = [HasVendorXqcilb, IsRV32] in {
Expand Down
5 changes: 5 additions & 0 deletions llvm/test/MC/RISCV/xqcibm-valid.s
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,11 @@ qc.c.extu x15, 32
# CHECK-ENC: encoding: [0xaa,0x15]
qc.extu x11, x11, 11, 0

# CHECK-NOALIAS: qc.c.bexti a1, 5
# CHECK-ALIAS: bexti a1, a1, 5
# CHECK-ENC: encoding: [0x95,0x91]
qc.extu x11, x11, 1, 5

# CHECK-NOALIAS: qc.c.bexti s1, 8
# CHECK-ALIAS: bexti s1, s1, 8
# CHECK-ENC-ZBS: encoding: [0xa1,0x90]
Expand Down
5 changes: 5 additions & 0 deletions llvm/test/MC/RISCV/xqcicm-valid.s
Original file line number Diff line number Diff line change
Expand Up @@ -130,3 +130,8 @@ qc.mvgeui x9, x10, 31, x12
# CHECK-ENC: encoding: [0x06,0xae]
qc.mveqi x9, x9, 0, x12

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

Loading