aboutsummaryrefslogtreecommitdiff
path: root/libstdc++-v3
diff options
context:
space:
mode:
authorAlexey Merzlyakov <alexey.merzlyakov@samsung.com>2024-11-06 14:39:30 -0700
committerJeff Law <jlaw@ventanamicro.com>2024-11-06 14:40:08 -0700
commit69bd93c167fefbdff0cb88614275358b7a2b2941 (patch)
tree315cb949b8dc2fd27466efa0b507b84df16b6a84 /libstdc++-v3
parenta91d5c27cd2173a40cc170ee09330dd1e13403a5 (diff)
downloadgcc-69bd93c167fefbdff0cb88614275358b7a2b2941.zip
gcc-69bd93c167fefbdff0cb88614275358b7a2b2941.tar.gz
gcc-69bd93c167fefbdff0cb88614275358b7a2b2941.tar.bz2
[PATCH v2] RISC-V: zero_extend(not) -> xor optimization [PR112398]
This patch adds optimization of the following patterns: (zero_extend:M (subreg:N (not:O==M (X:Q==M)))) -> (xor:M (zero_extend:M (subreg:N (X:M)), mask)) ... where the mask is GET_MODE_MASK (N). For the cases when X:M doesn't have any non-zero bits outside of mode N, (zero_extend:M (subreg:N (X:M)) could be simplified to just (X:M) and whole optimization will be: (zero_extend:M (subreg:N (not:M (X:M)))) -> (xor:M (X:M, mask)) Patch targets to handle code patterns like: not a0,a0 andi a0,a0,0xff to be optimized to: xori a0,a0,255 Change was locally tested for x86_64 and AArch64 (as most common) and for RV-64 and MIPS-32 targets (as having an effect from this optimization): no regressions for all cases. PR rtl-optimization/112398 gcc/ChangeLog: * simplify-rtx.cc (simplify_context::simplify_unary_operation_1): Simplify ZERO_EXTEND (SUBREG (NOT X)) to XOR (X, GET_MODE_MASK(SUBREG)) when X doesn't have any non-zero bits outside of SUBREG mode. gcc/testsuite/ChangeLog: * gcc.target/riscv/pr112398.c: New test. Signed-off-by: Alexey Merzlyakov <alexey.merzlyakov@samsung.com>
Diffstat (limited to 'libstdc++-v3')
0 files changed, 0 insertions, 0 deletions