public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug target/54830] New: [SH] Unnecessary exts.w before extu.b
@ 2012-10-06  0:04 olegendo at gcc dot gnu.org
  2012-10-18 19:24 ` [Bug target/54830] " olegendo at gcc dot gnu.org
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: olegendo at gcc dot gnu.org @ 2012-10-06  0:04 UTC (permalink / raw)
  To: gcc-bugs


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

             Bug #: 54830
           Summary: [SH] Unnecessary exts.w before extu.b
    Classification: Unclassified
           Product: gcc
           Version: 4.8.0
            Status: UNCONFIRMED
          Severity: enhancement
          Priority: P3
         Component: target
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: olegendo@gcc.gnu.org
            Target: sh*-*-*


While working on another issue, I've spotted the following sequence

        swap.w    r11,r1
        exts.w    r1,r1
        extu.b    r1,r2
        mov.l    @(16,r12),r1

in CSiBE/jpeg-6b/jcphuff.c, function _emit_eobrun, when compiling with
-m4-single -ml -O2 -mpretend-cmove.

I will try to investigate that later.


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

* [Bug target/54830] [SH] Unnecessary exts.w before extu.b
  2012-10-06  0:04 [Bug target/54830] New: [SH] Unnecessary exts.w before extu.b olegendo at gcc dot gnu.org
@ 2012-10-18 19:24 ` olegendo at gcc dot gnu.org
  2012-10-18 19:25 ` olegendo at gcc dot gnu.org
  2012-11-07 21:27 ` olegendo at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: olegendo at gcc dot gnu.org @ 2012-10-18 19:24 UTC (permalink / raw)
  To: gcc-bugs


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

--- Comment #1 from Oleg Endo <olegendo at gcc dot gnu.org> 2012-10-18 19:24:36 UTC ---
Created attachment 28487
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=28487
Reduced test case

This is the reduced test case.  It shows that there are actually two redundant
zero/sign extensions when compiling with -m4 {-ml|-mb} -O2:

   swap.w       r5,r5   ! 88    rotlsi3_16
   ...
   exts.w       r5,r5   ! 89    *extendhisi2_compact_reg
   ...
   extu.b       r5,r9   ! 10    *zero_extendqisi2_compact
   ...
   extu.b       r9,r12  ! 11    *zero_extendqisi2_compact
   ...

Turning on the REE pass (-free) doesn't seem to help this either.
Adding the following pattern to sh.md:

(define_insn_and_split "*"
  [(set (match_operand:SI 0 "register_operand")
    (zero_extract:SI (match_operand:SI 1 "register_operand")
             (const_int 8)
             (const_int 16)))]
  "TARGET_SH1"
  "#"
  "&& 1"
  [(set (match_dup 0) (lshiftrt:SI (match_dup 1) (const_int 16)))
   (set (match_dup 0) (zero_extend:SI (match_dup 2)))]
{
  operands[2] = gen_lowpart (QImode, operands[0]);
})


eliminates the first sign-extension (exts.w) only.  The second zero-extension
can be eliminated by extending sh_try_omit_signzero_extend in sh.c accordingly.


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

* [Bug target/54830] [SH] Unnecessary exts.w before extu.b
  2012-10-06  0:04 [Bug target/54830] New: [SH] Unnecessary exts.w before extu.b olegendo at gcc dot gnu.org
  2012-10-18 19:24 ` [Bug target/54830] " olegendo at gcc dot gnu.org
@ 2012-10-18 19:25 ` olegendo at gcc dot gnu.org
  2012-11-07 21:27 ` olegendo at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: olegendo at gcc dot gnu.org @ 2012-10-18 19:25 UTC (permalink / raw)
  To: gcc-bugs


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

Oleg Endo <olegendo at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |ASSIGNED
   Last reconfirmed|                            |2012-10-18
         AssignedTo|unassigned at gcc dot       |olegendo at gcc dot gnu.org
                   |gnu.org                     |
     Ever Confirmed|0                           |1


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

* [Bug target/54830] [SH] Unnecessary exts.w before extu.b
  2012-10-06  0:04 [Bug target/54830] New: [SH] Unnecessary exts.w before extu.b olegendo at gcc dot gnu.org
  2012-10-18 19:24 ` [Bug target/54830] " olegendo at gcc dot gnu.org
  2012-10-18 19:25 ` olegendo at gcc dot gnu.org
@ 2012-11-07 21:27 ` olegendo at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: olegendo at gcc dot gnu.org @ 2012-11-07 21:27 UTC (permalink / raw)
  To: gcc-bugs


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

--- Comment #2 from Oleg Endo <olegendo at gcc dot gnu.org> 2012-11-07 21:27:11 UTC ---
Just for the record..
The arithmetic right shift by 16 splits into the sequence swap.w exts.w after
combine.  Thus, any other following extensions don't get combined away.


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

end of thread, other threads:[~2012-11-07 21:27 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-10-06  0:04 [Bug target/54830] New: [SH] Unnecessary exts.w before extu.b olegendo at gcc dot gnu.org
2012-10-18 19:24 ` [Bug target/54830] " olegendo at gcc dot gnu.org
2012-10-18 19:25 ` olegendo at gcc dot gnu.org
2012-11-07 21:27 ` olegendo 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).