]> git.ipfire.org Git - thirdparty/gcc.git/commit
[to-be-committed,RISC-V] Improve variable bit set for rv64
authorJeff Law <jlaw@ventanamicro.com>
Mon, 17 Jun 2024 13:04:13 +0000 (07:04 -0600)
committerJeff Law <jlaw@ventanamicro.com>
Mon, 17 Jun 2024 13:04:13 +0000 (07:04 -0600)
commit83aad89fb99d0e82209734717c12f5aaca477970
treef4d18eb419623fd506385021de311da7bcb871ba
parent65e72b95c63a5501cf1482f3814ae8c8e672bf06
[to-be-committed,RISC-V] Improve variable bit set for rv64

Another case of being able to safely use bset for 1 << n.  In this case
the (1 << n)  is explicitly zero extended from SI to DI.  Two things to
keep in mind.  The (1 << n) is done in SImode.  So it doesn't directly
define bits 32..63 and those bits are cleared by the explicit zero
extension.  Second if N is out of SImode's range, then the original
source level construct was undefined.

Thus we can use bset with x0 as our source input.

I think this testcase was from the RAU team.  It doesn't immediately
look like something from SPEC, but that's where they were primarily focused.

This has been through Ventana's CI system in the past.  I've also
recently added zbs testing to my own tester and naturally this passed
there as well.  I'll wait for the pre-commit CI to do its thing before
moving forward.  The plan would be to commit after passing.

gcc/
* config/riscv/bitmanip.md (bsetdi_2): New pattern.

gcc/testsuite/

* gcc.target/riscv/zbs-zext-2.c: New test.
gcc/config/riscv/bitmanip.md
gcc/testsuite/gcc.target/riscv/zbs-zext-2.c [new file with mode: 0644]