diff options
author | Philipp Tomsich <philipp.tomsich@vrull.eu> | 2023-08-29 16:48:24 -0600 |
---|---|---|
committer | Jeff Law <jlaw@ventanamicro.com> | 2023-08-29 16:59:19 -0600 |
commit | 94b950df6f8c46925799f642e5c44f42638f2b5e (patch) | |
tree | 68b13d5ecf38f007ecd602a558c7a72e1460906f /ChangeLog | |
parent | 034d99e81484fbb83f15da91ee1a744b9301b04f (diff) |
RISC-V: Use splitter to generate zicond in another case
So in analyzing Ventana's internal tree against the trunk it became apparent
that the current zicond code is missing a case that helps coremark's bitwise
CRC implementation.
Here's a minimized testcase:
long xor1(long crc, long poly)
{
if (crc & 1)
crc ^= poly;
return crc;
}
ie, it's just a conditional xor.
We generate this:
andi a5,a0,1
neg a5,a5
and a5,a5,a1
xor a0,a5,a0
ret
But we should instead generate:
andi a5,a0,1
czero.eqz a5,a1,a5
xor a0,a5,a0
ret
Combine wants to generate:
Trying 7, 8 -> 9:
7: r140:DI=r137:DI&0x1
8: r141:DI=-r140:DI
REG_DEAD r140:DI
9: r142:DI=r141:DI&r144:DI
REG_DEAD r144:DI
REG_DEAD r141:DI
Failed to match this instruction:
(set (reg:DI 142)
(and:DI (sign_extract:DI (reg/v:DI 137 [ crc ])
(const_int 1 [0x1])
(const_int 0 [0]))
(reg:DI 144)))
A splitter can rewrite the above into a suitable if-then-else construct and
squeeze an instruction out of that pesky CRC loop. Sadly it doesn't really
help anything else.
The patch includes two variants. One that uses ZBS, the other uses an ANDI
logical to produce the input condition.
gcc/
* config/riscv/zicond.md: New splitters to rewrite single bit
sign extension as the condition to a czero in the desired form.
gcc/testsuite
* gcc.target/riscv/zicond-xor-01.c: New test.
Co-authored-by: Jeff Law <jlaw@ventanamicro.com>
Diffstat (limited to 'ChangeLog')
0 files changed, 0 insertions, 0 deletions