Hi Suwa-san,

On Fri, Oct 24, 2025 at 12:55 PM Takayuki 'January June' Suwa
<[email protected]> wrote:
>
> The definition of one_cmplsi2 insn pattern is not mandatory; the insn
> generator recognize the absence of the pattern and instead generates an XOR
> with a pseudo whose value is -1 if "XOR reg, reg, imm" is not also provided.
> There is an advantage to exposing constant-valued registers early in RTL
> passes; they are easier targets for CSE or loop invariant hoisting.
>
> Indeed, the only reason we defined that insn even though it wasn't required
> was because some optimizers in the RTL ifcvt pass needed
> '(set (reg) (not (reg)))' RTX, however, in recent versions of gcc, the
> equivalent optimizations are performed before RTL passes, so there is no
> longer any need to explicitly define that insn.
>
> Another concern with removing this insn definition is the impact on complex
> insns that have '(not)' as part of them, but also nothing to worry about;
> because the RTL insn combiner can correctly recognize an XOR with a register
> value of -1 as a one's complement operation even without the definition of
> this insn, and apply the result to subsequent combine operations.
>
> gcc/ChangeLog:
>
>         * config/xtensa/xtensa.md (one_cmplsi2): Remove.
> ---
>   gcc/config/xtensa/xtensa.md | 23 +----------------------
>   1 file changed, 1 insertion(+), 22 deletions(-)

This change breaks a lot of tests with the following error at the linking stage:
    undefined reference to `__one_cmpldi2'
e.g.
gcc.c-torture/execute/20110418-1.c

-- 
Thanks.
-- Max

Reply via email to