public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug rtl-optimization/59461] New: missed zero-extension elimination in the combiner
@ 2013-12-10 23:13 ebotcazou at gcc dot gnu.org
  2013-12-10 23:14 ` [Bug rtl-optimization/59461] " ebotcazou at gcc dot gnu.org
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: ebotcazou at gcc dot gnu.org @ 2013-12-10 23:13 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59461

            Bug ID: 59461
           Summary: missed zero-extension elimination in the combiner
           Product: gcc
           Version: 4.9.0
            Status: UNCONFIRMED
          Keywords: missed-optimization
          Severity: normal
          Priority: P3
         Component: rtl-optimization
          Assignee: unassigned at gcc dot gnu.org
          Reporter: ebotcazou at gcc dot gnu.org

This is a spin-off of PR rtl-optimization/58295.  The zero-extension is not
(and has never been) eliminated on the SPARC at -O2:

ee_isdigit2:
        sethi   %hi(zeb_test_array), %g1
        or      %g1, %lo(zeb_test_array), %g1
        ldub    [%g1+%o0], %g1
        mov     0, %o0
        add     %g1, -48, %g1
        and     %g1, 0xff, %g1
        cmp     %g1, 9
        jmp     %o7+8
         movleu %icc, 1, %o0
        .size   ee_isdigit2, .-ee_isdigit2

The instruction "and %g1, 0xff, %g1" is redundant like on the ARM and the
combiner should eliminate it.  The difference between the ARM and the SPARC is
that the former explicitly zero-extends the load from memory while the latter
does it only implicitly via LOAD_EXTEND_OP.  This shouldn't matter in the end,
but does here because of some weakness of the nonzero_bits machinery.


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

* [Bug rtl-optimization/59461] missed zero-extension elimination in the combiner
  2013-12-10 23:13 [Bug rtl-optimization/59461] New: missed zero-extension elimination in the combiner ebotcazou at gcc dot gnu.org
@ 2013-12-10 23:14 ` ebotcazou at gcc dot gnu.org
  2013-12-11  9:23 ` rguenth at gcc dot gnu.org
  2013-12-11  9:51 ` ebotcazou at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: ebotcazou at gcc dot gnu.org @ 2013-12-10 23:14 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59461

Eric Botcazou <ebotcazou at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |ASSIGNED
   Last reconfirmed|                            |2013-12-10
           Assignee|unassigned at gcc dot gnu.org      |ebotcazou at gcc dot gnu.org
     Ever confirmed|0                           |1
           Severity|normal                      |enhancement

--- Comment #1 from Eric Botcazou <ebotcazou at gcc dot gnu.org> ---
I'll look into this at some point.


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

* [Bug rtl-optimization/59461] missed zero-extension elimination in the combiner
  2013-12-10 23:13 [Bug rtl-optimization/59461] New: missed zero-extension elimination in the combiner ebotcazou at gcc dot gnu.org
  2013-12-10 23:14 ` [Bug rtl-optimization/59461] " ebotcazou at gcc dot gnu.org
@ 2013-12-11  9:23 ` rguenth at gcc dot gnu.org
  2013-12-11  9:51 ` ebotcazou at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: rguenth at gcc dot gnu.org @ 2013-12-11  9:23 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59461

--- Comment #2 from Richard Biener <rguenth at gcc dot gnu.org> ---
I wonder if x86_64 is also affected as it has implicitely zero/sign-extending
loads as well.


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

* [Bug rtl-optimization/59461] missed zero-extension elimination in the combiner
  2013-12-10 23:13 [Bug rtl-optimization/59461] New: missed zero-extension elimination in the combiner ebotcazou at gcc dot gnu.org
  2013-12-10 23:14 ` [Bug rtl-optimization/59461] " ebotcazou at gcc dot gnu.org
  2013-12-11  9:23 ` rguenth at gcc dot gnu.org
@ 2013-12-11  9:51 ` ebotcazou at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: ebotcazou at gcc dot gnu.org @ 2013-12-11  9:51 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59461

--- Comment #3 from Eric Botcazou <ebotcazou at gcc dot gnu.org> ---
> I wonder if x86_64 is also affected as it has implicitely zero/sign-extending
> loads as well.

Not for this testcase at least, where the code is (and has always been)
optimal:

ee_isdigit2:
.LFB0:
        .cfi_startproc
        movl    %edi, %edi
        movzbl  zeb_test_array(%rdi), %eax
        subl    $48, %eax
        cmpb    $9, %al
        setbe   %al
        ret
        .cfi_endproc

because the x86-64 can perform the addition in QImode directly.


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

end of thread, other threads:[~2013-12-11  9:51 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-12-10 23:13 [Bug rtl-optimization/59461] New: missed zero-extension elimination in the combiner ebotcazou at gcc dot gnu.org
2013-12-10 23:14 ` [Bug rtl-optimization/59461] " ebotcazou at gcc dot gnu.org
2013-12-11  9:23 ` rguenth at gcc dot gnu.org
2013-12-11  9:51 ` ebotcazou 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).