diff options
author | Philipp Tomsich <philipp.tomsich@vrull.eu> | 2022-05-12 15:11:20 +0200 |
---|---|---|
committer | Philipp Tomsich <philipp.tomsich@vrull.eu> | 2022-11-16 20:33:59 +0100 |
commit | ac74b3f82b339569b34dc9d1330c2faf74a1c82a (patch) | |
tree | 26f835ee3d901e962166843fe7ad78d6628b48d5 /gcc/range-op-float.cc | |
parent | 32462550f2803aafb726b5ae20d4d95ce36dcd9c (diff) | |
download | gcc-ac74b3f82b339569b34dc9d1330c2faf74a1c82a.zip gcc-ac74b3f82b339569b34dc9d1330c2faf74a1c82a.tar.gz gcc-ac74b3f82b339569b34dc9d1330c2faf74a1c82a.tar.bz2 |
RISC-V: Split "(a & (1UL << bitno)) ? 0 : 1" to bext + xori
We avoid reassociating "(~(a >> BIT_NO)) & 1" into "((~a) >> BIT_NO) & 1"
by splitting it into a zero-extraction (bext) and an xori. This both
avoids burning a register on a temporary and generates a sequence that
clearly captures 'extract bit, then invert bit'.
This change improves the previously generated
srl a0,a0,a1
not a0,a0
andi a0,a0,1
into
bext a0,a0,a1
xori a0,a0,1
Signed-off-by: Philipp Tomsich <philipp.tomsich@vrull.eu>
gcc/ChangeLog:
* config/riscv/bitmanip.md: Add split covering
"(a & (1 << BIT_NO)) ? 0 : 1".
gcc/testsuite/ChangeLog:
* gcc.target/riscv/zbs-bext.c: Add testcases.
* gcc.target/riscv/zbs-bexti.c: Add testcases.
Diffstat (limited to 'gcc/range-op-float.cc')
0 files changed, 0 insertions, 0 deletions