On Sun, May 29, 2022 at 4:00 AM Takayuki 'January June' Suwa <jjsuwa_sys3...@yahoo.co.jp> wrote: > > In Xtensa ISA, there is no single machine instruction that calculates unary > bitwise negation. But a few optimizers assume that bitwise negation can be > done by a single insn. > > As a result, '((x < 0) ? ~x : x)' cannot be optimized to '(x ^ (x >> 31))' > ever before, for example. > > This patch relaxes such limitation, by putting the insn expansion off till > the split pass. > > gcc/ChangeLog: > > * config/xtensa/xtensa.md (one_cmplsi2): > Rearrange as an insn_and_split pattern. > > gcc/testsuite/ChangeLog: > > * gcc.target/xtensa/one_cmpl_abs.c: New. > --- > gcc/config/xtensa/xtensa.md | 26 +++++++++++++------ > .../gcc.target/xtensa/one_cmpl_abs.c | 9 +++++++ > 2 files changed, 27 insertions(+), 8 deletions(-) > create mode 100644 gcc/testsuite/gcc.target/xtensa/one_cmpl_abs.c
Regtested for target=xtensa-linux-uclibc, no new regressions. Committed to master. -- Thanks. -- Max