public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug tree-optimization/111348] New: `(a CMP b) ? minmax<a, c> : minmax<b, c>` pattern missing :c on CMP
@ 2023-09-08 21:59 pinskia at gcc dot gnu.org
2023-09-08 22:00 ` [Bug tree-optimization/111348] " pinskia at gcc dot gnu.org
` (4 more replies)
0 siblings, 5 replies; 6+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-09-08 21:59 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111348
Bug ID: 111348
Summary: `(a CMP b) ? minmax<a, c> : minmax<b, c>` pattern
missing :c on CMP
Product: gcc
Version: 14.0
Status: UNCONFIRMED
Keywords: internal-improvement, missed-optimization
Severity: enhancement
Priority: P3
Component: tree-optimization
Assignee: pinskia at gcc dot gnu.org
Reporter: pinskia at gcc dot gnu.org
Target Milestone: ---
```
(for minmax (min max)
(for cmp (lt le gt ge ne)
(simplify
(cond (cmp @1 @3) (minmax:c @1 @4) (minmax:c @2 @4))
```
Is missing :c on cmp
because we could have
(@3 < @1) ? min(@1, @4) : min(@2, @4)
Which should match for and provide the same as `@1 > @3 ? min(@1, @4) : min(@2,
@4)`
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug tree-optimization/111348] `(a CMP b) ? minmax<a, c> : minmax<b, c>` pattern missing :c on CMP
2023-09-08 21:59 [Bug tree-optimization/111348] New: `(a CMP b) ? minmax<a, c> : minmax<b, c>` pattern missing :c on CMP pinskia at gcc dot gnu.org
@ 2023-09-08 22:00 ` pinskia at gcc dot gnu.org
2023-09-08 22:02 ` pinskia at gcc dot gnu.org
` (3 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-09-08 22:00 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111348
--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Need a testcase for this though.
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug tree-optimization/111348] `(a CMP b) ? minmax<a, c> : minmax<b, c>` pattern missing :c on CMP
2023-09-08 21:59 [Bug tree-optimization/111348] New: `(a CMP b) ? minmax<a, c> : minmax<b, c>` pattern missing :c on CMP pinskia at gcc dot gnu.org
2023-09-08 22:00 ` [Bug tree-optimization/111348] " pinskia at gcc dot gnu.org
@ 2023-09-08 22:02 ` pinskia at gcc dot gnu.org
2023-09-11 0:23 ` pinskia at gcc dot gnu.org
` (2 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-09-08 22:02 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111348
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Ever confirmed|0 |1
Status|UNCONFIRMED |ASSIGNED
Last reconfirmed| |2023-09-08
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug tree-optimization/111348] `(a CMP b) ? minmax<a, c> : minmax<b, c>` pattern missing :c on CMP
2023-09-08 21:59 [Bug tree-optimization/111348] New: `(a CMP b) ? minmax<a, c> : minmax<b, c>` pattern missing :c on CMP pinskia at gcc dot gnu.org
2023-09-08 22:00 ` [Bug tree-optimization/111348] " pinskia at gcc dot gnu.org
2023-09-08 22:02 ` pinskia at gcc dot gnu.org
@ 2023-09-11 0:23 ` pinskia at gcc dot gnu.org
2023-09-11 20:42 ` cvs-commit at gcc dot gnu.org
2023-09-11 20:42 ` pinskia at gcc dot gnu.org
4 siblings, 0 replies; 6+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-09-11 0:23 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111348
--- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Created attachment 55875
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=55875&action=edit
testcase
Currentlyt test1 is able to optimize to MAX_EXPR <MAX_EXPR <a, b>, c> but not
test1_
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug tree-optimization/111348] `(a CMP b) ? minmax<a, c> : minmax<b, c>` pattern missing :c on CMP
2023-09-08 21:59 [Bug tree-optimization/111348] New: `(a CMP b) ? minmax<a, c> : minmax<b, c>` pattern missing :c on CMP pinskia at gcc dot gnu.org
` (2 preceding siblings ...)
2023-09-11 0:23 ` pinskia at gcc dot gnu.org
@ 2023-09-11 20:42 ` cvs-commit at gcc dot gnu.org
2023-09-11 20:42 ` pinskia at gcc dot gnu.org
4 siblings, 0 replies; 6+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2023-09-11 20:42 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111348
--- Comment #3 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The trunk branch has been updated by Andrew Pinski <pinskia@gcc.gnu.org>:
https://gcc.gnu.org/g:8fdf712a38422952bbcde7e22eabcf821e6676b3
commit r14-3855-g8fdf712a38422952bbcde7e22eabcf821e6676b3
Author: Andrew Pinski <apinski@marvell.com>
Date: Mon Sep 11 08:05:10 2023 -0700
MATCH: [PR111348] add missing :c to cmp in the `(a CMP b) ? minmax<a, c> :
minmax<b, c>` pattern
When I added this pattern in r14-337-gc43819a9b4cd, I had missed the :c on
the cmp
part of the pattern meaning there might be some missing optimizations
happening.
The testcase shows an example of the missed optmization.
Committed as obvious after a bootstrap/test on x86_64-linux-gnu.
PR tree-optimization/111348
gcc/ChangeLog:
* match.pd (`(a CMP b) ? minmax<a, c> : minmax<b, c>`): Add :c on
the cmp part of the pattern.
gcc/testsuite/ChangeLog:
* gcc.dg/tree-ssa/minmax-26.c: New test.
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug tree-optimization/111348] `(a CMP b) ? minmax<a, c> : minmax<b, c>` pattern missing :c on CMP
2023-09-08 21:59 [Bug tree-optimization/111348] New: `(a CMP b) ? minmax<a, c> : minmax<b, c>` pattern missing :c on CMP pinskia at gcc dot gnu.org
` (3 preceding siblings ...)
2023-09-11 20:42 ` cvs-commit at gcc dot gnu.org
@ 2023-09-11 20:42 ` pinskia at gcc dot gnu.org
4 siblings, 0 replies; 6+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-09-11 20:42 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111348
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Target Milestone|--- |14.0
Status|ASSIGNED |RESOLVED
Resolution|--- |FIXED
--- Comment #4 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Fixed.
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2023-09-11 20:42 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-09-08 21:59 [Bug tree-optimization/111348] New: `(a CMP b) ? minmax<a, c> : minmax<b, c>` pattern missing :c on CMP pinskia at gcc dot gnu.org
2023-09-08 22:00 ` [Bug tree-optimization/111348] " pinskia at gcc dot gnu.org
2023-09-08 22:02 ` pinskia at gcc dot gnu.org
2023-09-11 0:23 ` pinskia at gcc dot gnu.org
2023-09-11 20:42 ` cvs-commit at gcc dot gnu.org
2023-09-11 20:42 ` pinskia at gcc dot gnu.org
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).