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

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).