[Bug tree-optimization/112468] [14 Regression] Missed phi-opt after recent change (phi-opt-24.c)

2024-01-10 Thread tnfchris at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=112468

Tamar Christina  changed:

   What|Removed |Added

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

--- Comment #14 from Tamar Christina  ---
Fixed thanks for the report.

[Bug tree-optimization/112468] [14 Regression] Missed phi-opt after recent change (phi-opt-24.c)

2024-01-10 Thread cvs-commit at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=112468

--- Comment #13 from GCC Commits  ---
The master branch has been updated by Tamar Christina :

https://gcc.gnu.org/g:7cbe41d35e6a60776484e04e42e408de9fc82954

commit r14-7115-g7cbe41d35e6a60776484e04e42e408de9fc82954
Author: Tamar Christina 
Date:   Wed Jan 10 17:18:28 2024 +

middle-end: Don't apply copysign optimization if target does not implement
optab [PR112468]

Currently GCC does not treat IFN_COPYSIGN the same as the copysign tree
expr.
The latter has a libcall fallback and the IFN can only do optabs.

Because of this the change I made to optimize copysign only works if the
target has impemented the optab, but it should work for those that have the
libcall too.

More annoyingly if a target has vector versions of ABS and NEG but not
COPYSIGN
then the change made them lose vectorization.

The proper fix for this is to treat the IFN the same as the tree EXPR and
to
enhance expand_COPYSIGN to also support vector calls.

I have such a patch for GCC 15 but it's quite big and too invasive for
stage-4.
As such this is a minimal fix, just don't apply the transformation and
leave
targets which don't have the optab unoptimized.

Targets list for check_effective_target_ifn_copysign was gotten by grepping
for
copysign and looking at the optab.

gcc/ChangeLog:

PR tree-optimization/112468
* doc/sourcebuild.texi: Document ifn_copysign.
* match.pd: Only apply transformation if target supports the IFN.

gcc/testsuite/ChangeLog:

PR tree-optimization/112468
* gcc.dg/fold-copysign-1.c: Modify tests based on if target
supports
IFN_COPYSIGN.
* gcc.dg/pr55152-2.c: Likewise.
* gcc.dg/tree-ssa/abs-4.c: Likewise.
* gcc.dg/tree-ssa/backprop-6.c: Likewise.
* gcc.dg/tree-ssa/copy-sign-2.c: Likewise.
* gcc.dg/tree-ssa/mult-abs-2.c: Likewise.
* lib/target-supports.exp (check_effective_target_ifn_copysign):
New.

[Bug tree-optimization/112468] [14 Regression] Missed phi-opt after recent change (phi-opt-24.c)

2023-12-18 Thread sandra at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=112468

sandra at gcc dot gnu.org changed:

   What|Removed |Added

 CC||sandra at gcc dot gnu.org

--- Comment #12 from sandra at gcc dot gnu.org ---
Add nios2 to the list of targets where this change triggered a bunch of test
fails.

[Bug tree-optimization/112468] [14 Regression] Missed phi-opt after recent change (phi-opt-24.c)

2023-12-13 Thread hp at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=112468

--- Comment #11 from Hans-Peter Nilsson  ---
(In reply to Tamar Christina from comment #10)
> Hi,
> 
> It's not forgotten. I've agreed on a fix with the maintainers that should
> solve a bunch of other (older) issues with copysign as well.
> 
> Since it's a bug fix it's on my list after my stage3 changes.  But I expect
> to be able to send the patch next week.
> 
> Sorry for the delay.

Fair enough, thanks for the update!

[Bug tree-optimization/112468] [14 Regression] Missed phi-opt after recent change (phi-opt-24.c)

2023-12-13 Thread tnfchris at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=112468

--- Comment #10 from Tamar Christina  ---
Hi,

It's not forgotten. I've agreed on a fix with the maintainers that should solve
a bunch of other (older) issues with copysign as well.

Since it's a bug fix it's on my list after my stage3 changes.  But I expect to
be able to send the patch next week.

Sorry for the delay.

[Bug tree-optimization/112468] [14 Regression] Missed phi-opt after recent change (phi-opt-24.c)

2023-12-13 Thread hp at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=112468

--- Comment #9 from Hans-Peter Nilsson  ---
(In reply to Tamar Christina from comment #7)
> testing patch

A month later: any update on that?
I didn't see a patch posted, so perhaps there was more work to it.
Please leave a note if you're no longer working on it and/or not expecting
progress within, say, another month.