[Bug target/102224] [9/10 regession] wrong code for `x * copysign(1.0, x)` since r9-5298-g33142cf9cf82aa1f

2022-05-11 Thread jakub at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102224

Jakub Jelinek  changed:

   What|Removed |Added

 Status|ASSIGNED|RESOLVED
 Resolution|--- |FIXED

--- Comment #19 from Jakub Jelinek  ---
Fixed.

[Bug target/102224] [9/10 regession] wrong code for `x * copysign(1.0, x)` since r9-5298-g33142cf9cf82aa1f

2022-05-11 Thread cvs-commit at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102224

--- Comment #18 from CVS Commits  ---
The releases/gcc-9 branch has been updated by Jakub Jelinek
:

https://gcc.gnu.org/g:45579f290157b62a36752ed6df4fbcb7c742fb08

commit r9-10098-g45579f290157b62a36752ed6df4fbcb7c742fb08
Author: Jakub Jelinek 
Date:   Wed Sep 8 11:25:31 2021 +0200

i386: Fix up @xorsign3_1 [PR102224]

As the testcase shows, we miscompile @xorsign3_1 if both input
operands are in the same register, because the splitter overwrites op1
before with op1 & mask before using op0.

For dest = xorsign op0, op0 we can actually simplify it from
dest = (op0 & mask) ^ op0 to dest = op0 & ~mask (aka abs).

The expander change is an optimization improvement, if we at expansion
time know it is xorsign op0, op0, we can emit abs right away and get better
code through that.

The @xorsign3_1 is a fix for the case where xorsign wouldn't be known
to have same operands during expansion, but during RTL optimizations they
would appear.  We need to use earlyclobber, we require dest and op1 to be
the same but op0 must be different because we overwrite
op1 first.

2021-09-08  Jakub Jelinek  

PR target/102224
* config/i386/i386.md (xorsign3): If operands[1] is equal to
operands[2], emit abs2 instead.
(@xorsign3_1): Add early-clobber for output operand.

* gcc.dg/pr102224.c: New test.
* gcc.target/i386/avx-pr102224.c: New test.

(cherry picked from commit a7b626d98a9a821ffb33466818d6aa86cac1d6fd)

[Bug target/102224] [9/10 regession] wrong code for `x * copysign(1.0, x)` since r9-5298-g33142cf9cf82aa1f

2022-05-10 Thread cvs-commit at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102224

--- Comment #17 from CVS Commits  ---
The releases/gcc-10 branch has been updated by Jakub Jelinek
:

https://gcc.gnu.org/g:c7b00fbc469bc9c0a486b48bc349dba13881241e

commit r10-10641-gc7b00fbc469bc9c0a486b48bc349dba13881241e
Author: Jakub Jelinek 
Date:   Wed Sep 8 11:25:31 2021 +0200

i386: Fix up @xorsign3_1 [PR102224]

As the testcase shows, we miscompile @xorsign3_1 if both input
operands are in the same register, because the splitter overwrites op1
before with op1 & mask before using op0.

For dest = xorsign op0, op0 we can actually simplify it from
dest = (op0 & mask) ^ op0 to dest = op0 & ~mask (aka abs).

The expander change is an optimization improvement, if we at expansion
time know it is xorsign op0, op0, we can emit abs right away and get better
code through that.

The @xorsign3_1 is a fix for the case where xorsign wouldn't be known
to have same operands during expansion, but during RTL optimizations they
would appear.  We need to use earlyclobber, we require dest and op1 to be
the same but op0 must be different because we overwrite
op1 first.

2021-09-08  Jakub Jelinek  

PR target/102224
* config/i386/i386.md (xorsign3): If operands[1] is equal to
operands[2], emit abs2 instead.
(@xorsign3_1): Add early-clobber for output operand.

* gcc.dg/pr102224.c: New test.
* gcc.target/i386/avx-pr102224.c: New test.

(cherry picked from commit a7b626d98a9a821ffb33466818d6aa86cac1d6fd)

[Bug target/102224] [9/10 regession] wrong code for `x * copysign(1.0, x)` since r9-5298-g33142cf9cf82aa1f

2021-09-08 Thread jakub at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102224

Jakub Jelinek  changed:

   What|Removed |Added

Summary|[9/10/11 regession] wrong   |[9/10 regession] wrong code
   |code for `x * copysign(1.0, |for `x * copysign(1.0, x)`
   |x)` since   |since
   |r9-5298-g33142cf9cf82aa1f   |r9-5298-g33142cf9cf82aa1f

--- Comment #16 from Jakub Jelinek  ---
Fixed for 11.3 too.