diff options
author | Jivan Hakobyan <jivanhakobyan9@gmail.com> | 2023-09-29 13:41:48 -0600 |
---|---|---|
committer | Jeff Law <jlaw@ventanamicro.com> | 2023-09-29 13:42:47 -0600 |
commit | 51d09e67df52164c2025afa24531cf79820ff4c8 (patch) | |
tree | 22d5d7a20c87c83b7ac605652cc2bf5effbce24d /contrib | |
parent | eaa41a6dc127d8d8a38646aaadc37681691fc311 (diff) | |
download | gcc-51d09e67df52164c2025afa24531cf79820ff4c8.zip gcc-51d09e67df52164c2025afa24531cf79820ff4c8.tar.gz gcc-51d09e67df52164c2025afa24531cf79820ff4c8.tar.bz2 |
RISC-V: Replace not + bitwise_imm with li + bitwise_not
In the case when we have C code like this
int foo (int a) {
return 100 & ~a;
}
GCC generates the following instruction sequence
foo:
not a0,a0
andi a0,a0,100
ret
This patch replaces that with this sequence
foo:
li a5,100
andn a0,a5,a0
ret
The profitability comes from an out-of-order processor being able to
issue the "li a5, 100" at any time after it's fetched while "not a0, a0" has
to wait until any prior setter of a0 has reached completion.
gcc/ChangeLog:
* config/riscv/bitmanip.md (*<optab>_not_const<mode>): New split
pattern.
gcc/testsuite/ChangeLog:
* gcc.target/riscv/zbb-andn-orn-01.c: New test.
* gcc.target/riscv/zbb-andn-orn-02.c: Likewise.
Diffstat (limited to 'contrib')
0 files changed, 0 insertions, 0 deletions