diff options
author | Liao Shihua <shihua@iscas.ac.cn> | 2024-05-24 13:03:57 +0800 |
---|---|---|
committer | Kito Cheng <kito.cheng@sifive.com> | 2024-05-27 14:50:18 +0800 |
commit | 06bb125521dec5648b725ddee4345b00decfdc77 (patch) | |
tree | b71cc96153674de24df58991639158eb7414d87e /gcc/tree-vect-loop.cc | |
parent | 314448fc65f40c98ee8bc02dfb54ea49d2f2c60d (diff) | |
download | gcc-06bb125521dec5648b725ddee4345b00decfdc77.zip gcc-06bb125521dec5648b725ddee4345b00decfdc77.tar.gz gcc-06bb125521dec5648b725ddee4345b00decfdc77.tar.bz2 |
RISC-V: Fix missing boolean_expression in zmmul extension
Update v1->v2
Add testcase for this patch.
Missing boolean_expression TARGET_ZMMUL in riscv_rtx_costs() cause different instructions when
multiplying an integer with a constant. ( https://github.com/riscv-collab/riscv-gnu-toolchain/issues/1482 )
int foo(int *ib) {
*ib = *ib * 33938;
return 0;
}
rv64im:
lw a4,0(a1)
li a5,32768
addiw a5,a5,1170
mulw a5,a5,a4
sw a5,0(a1)
ret
rv64i_zmmul:
lw a4,0(a1)
slliw a5,a4,5
addw a5,a5,a4
slliw a5,a5,3
addw a5,a5,a4
slliw a5,a5,3
addw a5,a5,a4
slliw a5,a5,3
addw a5,a5,a4
slliw a5,a5,1
sw a5,0(a1)
ret
Fixed.
gcc/ChangeLog:
* config/riscv/riscv.cc (riscv_rtx_costs): Add TARGET_ZMMUL.
gcc/testsuite/ChangeLog:
* gcc.target/riscv/zmmul-3.c: New test.
Diffstat (limited to 'gcc/tree-vect-loop.cc')
0 files changed, 0 insertions, 0 deletions