public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug tree-optimization/111345] New: `X % Y is smaller than Y.` pattern could be simpified
@ 2023-09-08 21:46 pinskia at gcc dot gnu.org
2023-09-08 21:46 ` [Bug tree-optimization/111345] " pinskia at gcc dot gnu.org
` (3 more replies)
0 siblings, 4 replies; 5+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-09-08 21:46 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111345
Bug ID: 111345
Summary: `X % Y is smaller than Y.` pattern could be simpified
Product: gcc
Version: 14.0
Status: UNCONFIRMED
Keywords: internal-improvement
Severity: enhancement
Priority: P3
Component: tree-optimization
Assignee: pinskia at gcc dot gnu.org
Reporter: pinskia at gcc dot gnu.org
Target Milestone: ---
Right now it is defined as:
```
(for cmp (lt ge)
(simplify
(cmp (trunc_mod @0 @1) @1)
(if (TYPE_UNSIGNED (TREE_TYPE (@0)))
{ constant_boolean_node (cmp == LT_EXPR, type); })))
(for cmp (gt le)
(simplify
(cmp @1 (trunc_mod @0 @1))
(if (TYPE_UNSIGNED (TREE_TYPE (@0)))
{ constant_boolean_node (cmp == GT_EXPR, type); })))
```
But it could be simplified to:
```
(for cmp (lt ge)
(simplify
(cmp:c (trunc_mod @0 @1) @1)
(if (TYPE_UNSIGNED (TREE_TYPE (@0)))
{ constant_boolean_node (cmp == LT_EXPR, type); })))
```
This simplifies the written code but the produced code is the same ...
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug tree-optimization/111345] `X % Y is smaller than Y.` pattern could be simpified
2023-09-08 21:46 [Bug tree-optimization/111345] New: `X % Y is smaller than Y.` pattern could be simpified pinskia at gcc dot gnu.org
@ 2023-09-08 21:46 ` pinskia at gcc dot gnu.org
2023-09-12 22:51 ` pinskia at gcc dot gnu.org
` (2 subsequent siblings)
3 siblings, 0 replies; 5+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-09-08 21:46 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111345
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] 5+ messages in thread
* [Bug tree-optimization/111345] `X % Y is smaller than Y.` pattern could be simpified
2023-09-08 21:46 [Bug tree-optimization/111345] New: `X % Y is smaller than Y.` pattern could be simpified pinskia at gcc dot gnu.org
2023-09-08 21:46 ` [Bug tree-optimization/111345] " pinskia at gcc dot gnu.org
@ 2023-09-12 22:51 ` pinskia at gcc dot gnu.org
2023-09-13 12:04 ` cvs-commit at gcc dot gnu.org
2023-09-13 12:04 ` pinskia at gcc dot gnu.org
3 siblings, 0 replies; 5+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-09-12 22:51 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111345
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Keywords| |patch
URL| |https://gcc.gnu.org/piperma
| |il/gcc-patches/2023-Septemb
| |er/630109.html
--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Patch posted:
https://gcc.gnu.org/pipermail/gcc-patches/2023-September/630109.html
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug tree-optimization/111345] `X % Y is smaller than Y.` pattern could be simpified
2023-09-08 21:46 [Bug tree-optimization/111345] New: `X % Y is smaller than Y.` pattern could be simpified pinskia at gcc dot gnu.org
2023-09-08 21:46 ` [Bug tree-optimization/111345] " pinskia at gcc dot gnu.org
2023-09-12 22:51 ` pinskia at gcc dot gnu.org
@ 2023-09-13 12:04 ` cvs-commit at gcc dot gnu.org
2023-09-13 12:04 ` pinskia at gcc dot gnu.org
3 siblings, 0 replies; 5+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2023-09-13 12:04 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111345
--- Comment #2 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:635a34e2be67d709088c31573732dfdf733e4cec
commit r14-3921-g635a34e2be67d709088c31573732dfdf733e4cec
Author: Andrew Pinski <apinski@marvell.com>
Date: Tue Sep 12 10:43:23 2023 -0700
MATCH: Simplify `(X % Y) < Y` pattern.
This merges the two patterns to catch
`(X % Y) < Y` and `Y > (X % Y)` into one by
using :c on the comparison operator.
It does not change any code generation nor
anything else. It is more to allow for better
maintainability of this pattern.
OK? Bootstrapped and tested on x86_64-linux-gnu.
gcc/ChangeLog:
PR tree-optimization/111345
* match.pd (`Y > (X % Y)`): Merge
into ...
(`(X % Y) < Y`): Pattern by adding `:c`
on the comparison.
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug tree-optimization/111345] `X % Y is smaller than Y.` pattern could be simpified
2023-09-08 21:46 [Bug tree-optimization/111345] New: `X % Y is smaller than Y.` pattern could be simpified pinskia at gcc dot gnu.org
` (2 preceding siblings ...)
2023-09-13 12:04 ` cvs-commit at gcc dot gnu.org
@ 2023-09-13 12:04 ` pinskia at gcc dot gnu.org
3 siblings, 0 replies; 5+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-09-13 12:04 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111345
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Target Milestone|--- |14.0
Status|ASSIGNED |RESOLVED
Resolution|--- |FIXED
--- Comment #3 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Fixed.
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2023-09-13 12:04 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-09-08 21:46 [Bug tree-optimization/111345] New: `X % Y is smaller than Y.` pattern could be simpified pinskia at gcc dot gnu.org
2023-09-08 21:46 ` [Bug tree-optimization/111345] " pinskia at gcc dot gnu.org
2023-09-12 22:51 ` pinskia at gcc dot gnu.org
2023-09-13 12:04 ` cvs-commit at gcc dot gnu.org
2023-09-13 12:04 ` 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).