forked from wangliu-iscas/gcc-patch
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
RISC-V: Enable Hoist to GCSE simple constants
Hoist want_to_gcse_p () calls rtx_cost () to compute max distance for hoist candidates . For a const with cost 1 backend currently returns 0, causing Hoist to bail and elide GCSE. Note that constants requiring more than 1 insns to setup were working already since backend is returning 1 as well. Arguably that needs updating as well to reflect cost better, but that should be a different change anyways. To keep testsuite parity, some V tests need updatinge which started failing in the new costing regime. gcc/ChangeLog: * gcc/config/riscv.cc (riscv_rtx_costs): Adjust const_int cost. gcc/testsuite/ChangeLog: * gcc.target/riscv/gcse-const.c: New Test * gcc.target/riscv/rvv/vsetvl/vlmax_conflict-7.c: Disable for -O2. * gcc.target/riscv/rvv/vsetvl/vlmax_conflict-8.c: Ditto. Signed-off-by: Vineet Gupta <vineetg@rivosinc.com>
- Loading branch information
1 parent
c2d62cd
commit b93bd4f
Showing
4 changed files
with
17 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
/* Slightly modified copy of gcc.target/arm/pr40956.c. */ | ||
/* { dg-options "-Os" } */ | ||
/* Make sure the constant "6" is loaded into register only once. */ | ||
/* { dg-final { scan-assembler-times "\tli.*6" 1 } } */ | ||
|
||
int foo(int p, int* q) | ||
{ | ||
if (p!=9) | ||
*q = 6; | ||
else | ||
*(q+1) = 6; | ||
return 3; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters