aboutsummaryrefslogtreecommitdiff
path: root/gcc/tree-parloops.cc
diff options
context:
space:
mode:
authorJivan Hakobyan <jivanhakobyan9@gmail.com>2023-04-25 20:41:02 -0600
committerJeff Law <jlaw@ventanamicro>2023-04-25 20:44:56 -0600
commit392200f807fe2ee377ecc451ff75894b89335c33 (patch)
tree312da4789ee25e602d0ddb01328abea0e75a7276 /gcc/tree-parloops.cc
parent68201409bc2867da45791331e385198826fa4576 (diff)
downloadgcc-392200f807fe2ee377ecc451ff75894b89335c33.zip
gcc-392200f807fe2ee377ecc451ff75894b89335c33.tar.gz
gcc-392200f807fe2ee377ecc451ff75894b89335c33.tar.bz2
avoid splitting small constants in bcrli_nottwobits patterns
I have noticed that in the case when we try to clear two bits through a small constant, and ZBS is enabled then GCC split it into two "andi" instructions. For example for the following C code: int foo(int a) { return a & ~ 0x101; } GCC generates the following: foo: andi a0,a0,-2 andi a0,a0,-257 ret but should be this one: foo: andi a0,a0,-258 ret This patch solves the mentioned issue. gcc/ChangeLog * config/riscv/bitmanip.md: Updated predicates of bclri<mode>_nottwobits and bclridisi_nottwobits patterns. * config/riscv/predicates.md: (not_uimm_extra_bit_or_nottwobits): Adjust predicate to avoid splitting arith constants. (const_nottwobits_not_arith_operand): New predicate. gcc/testsuite * gcc.target/riscv/zbs-bclri-nottwobits.c: New test.
Diffstat (limited to 'gcc/tree-parloops.cc')
0 files changed, 0 insertions, 0 deletions