Skip to content

[RISCV] Simplify one of the RV32 PACK isel patterns. #152045

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 1 commit into
base: main
Choose a base branch
from
Open
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
8 changes: 4 additions & 4 deletions llvm/lib/Target/RISCV/RISCVInstrInfoZb.td
Original file line number Diff line number Diff line change
Expand Up @@ -641,13 +641,13 @@ def : Pat<(binop_allhusers<or> (shl GPR:$rs2, (XLenVT 8)),
let Predicates = [HasStdExtZbkb, IsRV32] in {
def : Pat<(i32 (or (zexti16 (i32 GPR:$rs1)), (shl GPR:$rs2, (i32 16)))),
(PACK GPR:$rs1, GPR:$rs2)>;
// Match a packh for the high half with a zero extended value in the low half.
// If the low half also happens to be a packh, it can be matched separately.
def : Pat<(or (or
(shl (zexti8 (XLenVT GPR:$op1rs2)), (XLenVT 24)),
(shl (zexti8 (XLenVT GPR:$op1rs1)), (XLenVT 16))),
(or
(shl (zexti8 (XLenVT GPR:$op0rs2)), (XLenVT 8)),
(zexti8 (XLenVT GPR:$op0rs1)))),
(PACK (XLenVT (PACKH GPR:$op0rs1, GPR:$op0rs2)),
(zexti16 (XLenVT GPR:$op0))),
(PACK (XLenVT GPR:$op0),
(XLenVT (PACKH GPR:$op1rs1, GPR:$op1rs2)))>;
}

Expand Down