RISC-V: add TARGET_ZBKB to the condition of bswapsi2, bswapdi2 and rotr<mode>3 patterns
Checks
Commit Message
From: Sinan Lin <sinan.lin@linux.alibaba.com>
tell gcc that zbkb has these two spn to enable some optimizations. e.g.
1) the rrotate_expr could match to rotrm3 during expand; 2) hook up
__builtin_bswap64 with `rev8` in zbkb64.
---
gcc/config/riscv/bitmanip.md | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
Comments
On 4/10/23 04:56, Lin Sinan wrote:
> From: Sinan Lin <sinan.lin@linux.alibaba.com>
>
> tell gcc that zbkb has these two spn to enable some optimizations. e.g.
> 1) the rrotate_expr could match to rotrm3 during expand; 2) hook up
> __builtin_bswap64 with `rev8` in zbkb64.
> ---
> gcc/config/riscv/bitmanip.md | 6 +++---
> 1 file changed, 3 insertions(+), 3 deletions(-)
Deferred to gcc-14 as the trunk is not currently open for development.
jeff
On 4/10/23 04:56, Lin Sinan wrote:
> From: Sinan Lin <sinan.lin@linux.alibaba.com>
>
> tell gcc that zbkb has these two spn to enable some optimizations. e.g.
> 1) the rrotate_expr could match to rotrm3 during expand; 2) hook up
> __builtin_bswap64 with `rev8` in zbkb64.
Thanks. I pushed this to the trunk.
jeff
@@ -297,7 +297,7 @@
[(set (match_operand:GPR 0 "register_operand")
(rotatert:GPR (match_operand:GPR 1 "register_operand")
(match_operand:QI 2 "arith_operand")))]
- "TARGET_ZBB || TARGET_XTHEADBB"
+ "TARGET_ZBB || TARGET_XTHEADBB || TARGET_ZBKB"
{
if (TARGET_XTHEADBB && !immediate_operand (operands[2], VOIDmode))
FAIL;
@@ -362,12 +362,12 @@
(define_expand "bswapdi2"
[(set (match_operand:DI 0 "register_operand")
(bswap:DI (match_operand:DI 1 "register_operand")))]
- "TARGET_64BIT && (TARGET_ZBB || TARGET_XTHEADBB)")
+ "TARGET_64BIT && (TARGET_ZBB || TARGET_XTHEADBB || TARGET_ZBKB)")
(define_expand "bswapsi2"
[(set (match_operand:SI 0 "register_operand")
(bswap:SI (match_operand:SI 1 "register_operand")))]
- "(!TARGET_64BIT && TARGET_ZBB) || TARGET_XTHEADBB")
+ "(!TARGET_64BIT && (TARGET_ZBB || TARGET_ZBKB)) || TARGET_XTHEADBB")
(define_insn "*bswap<mode>2"
[(set (match_operand:X 0 "register_operand" "=r")