Skip to content

Commit

Permalink
[RISCV][NFC] Simplify uses of PatFrag binop_oneuse
Browse files Browse the repository at this point in the history
Reviewed By: craig.topper

Differential Revision: https://reviews.llvm.org/D154435
  • Loading branch information
benshi001 committed Jul 6, 2023
1 parent 4eee9ef commit a824b00
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
1 change: 0 additions & 1 deletion llvm/lib/Target/RISCV/RISCVInstrInfo.td
Original file line number Diff line number Diff line change
Expand Up @@ -1241,7 +1241,6 @@ class binop_oneuse<SDPatternOperator operator>
}]>;

def and_oneuse : binop_oneuse<and>;
def add_oneuse : binop_oneuse<add>;
def mul_oneuse : binop_oneuse<mul>;

def mul_const_oneuse : PatFrag<(ops node:$A, node:$B),
Expand Down
6 changes: 3 additions & 3 deletions llvm/lib/Target/RISCV/RISCVInstrInfoZb.td
Original file line number Diff line number Diff line change
Expand Up @@ -778,13 +778,13 @@ def : Pat<(i64 (add (and GPR:$rs1, 0x3FFFFFFFC), non_imm12:$rs2)),
def : Pat<(i64 (add (and GPR:$rs1, 0x7FFFFFFF8), non_imm12:$rs2)),
(SH3ADD_UW (SRLI GPR:$rs1, 3), GPR:$rs2)>;

def : Pat<(i64 (mul (binop_oneuse<and> GPR:$r, 0xFFFFFFFF), C3LeftShiftUW:$i)),
def : Pat<(i64 (mul (and_oneuse GPR:$r, 0xFFFFFFFF), C3LeftShiftUW:$i)),
(SH1ADD (SLLI_UW GPR:$r, (TrailingZeros C3LeftShiftUW:$i)),
(SLLI_UW GPR:$r, (TrailingZeros C3LeftShiftUW:$i)))>;
def : Pat<(i64 (mul (binop_oneuse<and> GPR:$r, 0xFFFFFFFF), C5LeftShiftUW:$i)),
def : Pat<(i64 (mul (and_oneuse GPR:$r, 0xFFFFFFFF), C5LeftShiftUW:$i)),
(SH2ADD (SLLI_UW GPR:$r, (TrailingZeros C5LeftShiftUW:$i)),
(SLLI_UW GPR:$r, (TrailingZeros C5LeftShiftUW:$i)))>;
def : Pat<(i64 (mul (binop_oneuse<and> GPR:$r, 0xFFFFFFFF), C9LeftShiftUW:$i)),
def : Pat<(i64 (mul (and_oneuse GPR:$r, 0xFFFFFFFF), C9LeftShiftUW:$i)),
(SH3ADD (SLLI_UW GPR:$r, (TrailingZeros C9LeftShiftUW:$i)),
(SLLI_UW GPR:$r, (TrailingZeros C9LeftShiftUW:$i)))>;
} // Predicates = [HasStdExtZba, IsRV64]
Expand Down

0 comments on commit a824b00

Please sign in to comment.