public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug middle-end/94543] New: missed optimization with MIN and AND with type promotion
@ 2020-04-09 19:13 rth at gcc dot gnu.org
  2020-04-14  6:44 ` [Bug rtl-optimization/94543] " rguenth at gcc dot gnu.org
  0 siblings, 1 reply; 2+ messages in thread
From: rth at gcc dot gnu.org @ 2020-04-09 19:13 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 94543
           Summary: missed optimization with MIN and AND with type
                    promotion
           Product: gcc
           Version: tree-ssa
            Status: UNCONFIRMED
          Severity: enhancement
          Priority: P3
         Component: middle-end
          Assignee: unassigned at gcc dot gnu.org
          Reporter: rth at gcc dot gnu.org
  Target Milestone: ---

unsigned f(unsigned short x) { return (x > 0xff ? 0xff : x) & 0xff; }

        cmpw    $255, %di
        movl    $255, %eax
        cmova   %eax, %edi
        movzwl  %di, %eax
        ret

The final AND is of course redundant.  The optimizer removes it
for wider types, but fails to do so when promoting from short.

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

end of thread, other threads:[~2020-04-14  6:44 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-04-09 19:13 [Bug middle-end/94543] New: missed optimization with MIN and AND with type promotion rth at gcc dot gnu.org
2020-04-14  6:44 ` [Bug rtl-optimization/94543] " rguenth 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).