]> gcc.gnu.org Git - gcc.git/commit
RISC-V: split to allow formation of sh[123]add before 32bit divw
authorPhilipp Tomsich <philipp.tomsich@vrull.eu>
Tue, 8 Nov 2022 19:45:51 +0000 (20:45 +0100)
committerPhilipp Tomsich <philipp.tomsich@vrull.eu>
Fri, 18 Nov 2022 20:15:24 +0000 (21:15 +0100)
commit30c2d8df173a6f3ca145cda9f9e261616fca8467
tree0785511ec10ba37eb18538bddc3b6f458360e856
parentacbb5ef06ee97849ecd5412ab56c1dff0f0d2fcf
RISC-V: split to allow formation of sh[123]add before 32bit divw

When using strength-reduction, we will reduce a multiplication to a
sequence of shifts and adds.  If this is performed with 32-bit types
and followed by a division, the lack of w-form sh[123]add will make
combination impossible and lead to a slli + addw being generated.

Split the sequence with the knowledge that a w-form div will perform
implicit sign-extensions.

gcc/ChangeLog:

* config/riscv/bitmanip.md: Add a define_split to optimize
  slliw + addiw + divw into sh[123]add + divw.

gcc/testsuite/ChangeLog:

* gcc.target/riscv/zba-shNadd-05.c: New test.
gcc/config/riscv/bitmanip.md
gcc/testsuite/gcc.target/riscv/zba-shNadd-05.c [new file with mode: 0644]
This page took 0.068262 seconds and 6 git commands to generate.