public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug middle-end/114669] New: use >= comparison when testing high bits
@ 2024-04-09 22:23 goon.pri.low at gmail dot com
  2024-04-09 22:27 ` [Bug tree-optimization/114669] " pinskia at gcc dot gnu.org
  2024-04-09 22:36 ` pinskia at gcc dot gnu.org
  0 siblings, 2 replies; 3+ messages in thread
From: goon.pri.low at gmail dot com @ 2024-04-09 22:23 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114669

            Bug ID: 114669
           Summary: use >= comparison when testing high bits
           Product: gcc
           Version: 14.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: middle-end
          Assignee: unassigned at gcc dot gnu.org
          Reporter: goon.pri.low at gmail dot com
  Target Milestone: ---

Example C functions

#include <stdint.h>
#include <stdbool.h>

bool unopt(uint32_t x) {
        return (x & 0xfff00000) == 0xfff00000;
}

bool opt(uint32_t x) {
        return x >= 0xfff00000;
}

Generated assembly

unopt:
        not     edi
        and     edi, -1048576
        sete    al
        ret
opt:
        cmp     edi, -1048577
        seta    al
        ret

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [Bug tree-optimization/114669] use >= comparison when testing high bits
  2024-04-09 22:23 [Bug middle-end/114669] New: use >= comparison when testing high bits goon.pri.low at gmail dot com
@ 2024-04-09 22:27 ` pinskia at gcc dot gnu.org
  2024-04-09 22:36 ` pinskia at gcc dot gnu.org
  1 sibling, 0 replies; 3+ messages in thread
From: pinskia at gcc dot gnu.org @ 2024-04-09 22:27 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114669

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
          Component|middle-end                  |tree-optimization
                 CC|                            |pinskia at gcc dot gnu.org

--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
This is almost definitely a dup ...

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [Bug tree-optimization/114669] use >= comparison when testing high bits
  2024-04-09 22:23 [Bug middle-end/114669] New: use >= comparison when testing high bits goon.pri.low at gmail dot com
  2024-04-09 22:27 ` [Bug tree-optimization/114669] " pinskia at gcc dot gnu.org
@ 2024-04-09 22:36 ` pinskia at gcc dot gnu.org
  1 sibling, 0 replies; 3+ messages in thread
From: pinskia at gcc dot gnu.org @ 2024-04-09 22:36 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114669

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
           Severity|normal                      |enhancement
   Last reconfirmed|                            |2024-04-09
     Ever confirmed|0                           |1

--- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Confirmed.

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2024-04-09 22:36 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-04-09 22:23 [Bug middle-end/114669] New: use >= comparison when testing high bits goon.pri.low at gmail dot com
2024-04-09 22:27 ` [Bug tree-optimization/114669] " pinskia at gcc dot gnu.org
2024-04-09 22:36 ` 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).