public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug target/50038] New: redundant zero extensions
@ 2011-08-10 15:43 tocarip.intel at gmail dot com
  2011-08-11 10:47 ` [Bug target/50038] " izamyatin at gmail dot com
                   ` (8 more replies)
  0 siblings, 9 replies; 10+ messages in thread
From: tocarip.intel at gmail dot com @ 2011-08-10 15:43 UTC (permalink / raw)
  To: gcc-bugs

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

             Bug #: 50038
           Summary: redundant zero extensions
    Classification: Unclassified
           Product: gcc
           Version: 4.7.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: target
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: tocarip.intel@gmail.com


Following code

void t_run_test(int Pels,unsigned char * ImageInPtr,unsigned char *
ImageOutPtr)                                                                    
{                                                                               
        int             i;                                                      
        unsigned char                   xr, xg;                                 
        unsigned char                   xy=0;                                   
                for (i = 0; i < Pels; i++)                                      
                {                                                               
                        xr = *ImageInPtr++;                                     
                        xg = *ImageInPtr++;                                     
                        xy = (unsigned char) ((19595*xr + 38470*xg) >> 16);    
                                                                               
                    *ImageOutPtr++ = xy;                                       
                                                                               
        }                                                                      
                                                                    }

Is compiled -O2 with  both   gcc 4.5.1

(Target: x86_64-redhat-linux
Configured with: ../configure --prefix=/usr --mandir=/usr/share/man
--infodir=/usr/share/info --with-bugurl=http://bugzilla.redhat.com/bugzilla
--enable-bootstrap --enable-shared --enable-threads=posix
--enable-checking=release --with-system-zlib --enable-__cxa_atexit
--disable-libunwind-exceptions --enable-gnu-unique-object
--enable-linker-build-id
--enable-languages=c,c++,objc,obj-c++,java,fortran,ada,lto --enable-plugin
--enable-java-awt=gtk --disable-dssi
--with-java-home=/usr/lib/jvm/java-1.5.0-gcj-1.5.0.0/jre
--enable-libgcj-multifile --enable-java-maintainer-mode
--with-ecj-jar=/usr/share/java/eclipse-ecj.jar --disable-libjava-multilib
--with-ppl --with-cloog --with-tune=generic --with-arch_32=i686
--build=x86_64-redhat-linux)  

and trunk version 

(Target: x86_64-unknown-linux-gnu
Configured with: ../configure --enable-languages=c --disable-bootsrap
Thread model: posix
gcc version 4.7.0 20110808 (experimental) (GCC) ) 

to 
         ...
        movzbl  (%rsi), %edi                                                    
        movzbl  1(%rsi), %eax                                                   
        movq    %rcx, %rsi                                                      
        movzbl  %dil, %edi  <- redundant                                        
        movzbl  %al, %eax   <- redundant                                        
        imull   $19595, %edi, %edi                                              
        imull   $38470, %eax, %eax                                              
        addl    %edi, %eax
        ...
For example icc does
         ...
        movzbl    (%rsi), %ecx                                                  
        incl      %eax                                                          
        movzbl    1(%rsi), %r8d                                                 
        addq      $2, %rsi                                                      
        imull     $19595, %ecx, %r10d                            
        ....
Without unnecessary zero extensions.


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

* [Bug target/50038] redundant zero extensions
  2011-08-10 15:43 [Bug target/50038] New: redundant zero extensions tocarip.intel at gmail dot com
@ 2011-08-11 10:47 ` izamyatin at gmail dot com
  2011-09-27 11:08 ` tocarip.intel at gmail dot com
                   ` (7 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: izamyatin at gmail dot com @ 2011-08-11 10:47 UTC (permalink / raw)
  To: gcc-bugs

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

Igor Zamyatin <izamyatin at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |izamyatin at gmail dot com

--- Comment #1 from Igor Zamyatin <izamyatin at gmail dot com> 2011-08-11 10:46:37 UTC ---
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=46357 and
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=40170 look similar to given issue.

Also here http://gcc.gnu.org/ml/gcc-help/2010-11/msg00071.html lies some
additional info


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

* [Bug target/50038] redundant zero extensions
  2011-08-10 15:43 [Bug target/50038] New: redundant zero extensions tocarip.intel at gmail dot com
  2011-08-11 10:47 ` [Bug target/50038] " izamyatin at gmail dot com
@ 2011-09-27 11:08 ` tocarip.intel at gmail dot com
  2011-09-30 15:01 ` tocarip.intel at gmail dot com
                   ` (6 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: tocarip.intel at gmail dot com @ 2011-09-27 11:08 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from tocarip.intel at gmail dot com 2011-09-27 10:15:15 UTC ---
Created attachment 25369
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=25369
Possible solution

Here is an experimental patch which solves this problem. I modified
implicit-zee  pass to also eliminate useless zero-extensions from QImode to
SImode. With this patch  rgbyiqv test from EEMBC 2.0 benchmark showed 6%
improvement. However after this patch implicit-zee may became useful for
additional targets. For example it became beneficial to 32-bit x86 (+4% on
rgbyiqv).

Here is a Changelog:

2011-09-27  Ilya Tocar  <ilya.tocar@intel.com>

    * implicit-zee.c: Added 2011 to copyright.
    (combine_set_zero_extend): Add QImode.
    (merge_def_and_ze): Likewise.
    (add_removable_zero_extend): Likewise.
    (not_qi_to_si): New.
    (make_defs_and_copies_lists): Add check for QImode.


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

* [Bug target/50038] redundant zero extensions
  2011-08-10 15:43 [Bug target/50038] New: redundant zero extensions tocarip.intel at gmail dot com
  2011-08-11 10:47 ` [Bug target/50038] " izamyatin at gmail dot com
  2011-09-27 11:08 ` tocarip.intel at gmail dot com
@ 2011-09-30 15:01 ` tocarip.intel at gmail dot com
  2011-10-03  9:19 ` ubizjak at gmail dot com
                   ` (5 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: tocarip.intel at gmail dot com @ 2011-09-30 15:01 UTC (permalink / raw)
  To: gcc-bugs

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

tocarip.intel at gmail dot com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |tocarip.intel at gmail dot
                   |                            |com

--- Comment #3 from tocarip.intel at gmail dot com 2011-09-30 14:51:31 UTC ---
So assuming this approach (modify implicit-zee pass) is right, we'll have to
enable this pass at least on x86 (32 bit). Is it ok ?

P. S.
I forgot to mention that this patch bootstraps/passes ,make check.


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

* [Bug target/50038] redundant zero extensions
  2011-08-10 15:43 [Bug target/50038] New: redundant zero extensions tocarip.intel at gmail dot com
                   ` (2 preceding siblings ...)
  2011-09-30 15:01 ` tocarip.intel at gmail dot com
@ 2011-10-03  9:19 ` ubizjak at gmail dot com
  2011-10-04  9:52 ` tocarip.intel at gmail dot com
                   ` (4 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: ubizjak at gmail dot com @ 2011-10-03  9:19 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #4 from Uros Bizjak <ubizjak at gmail dot com> 2011-10-03 09:19:16 UTC ---
(In reply to comment #3)
> So assuming this approach (modify implicit-zee pass) is right, we'll have to
> enable this pass at least on x86 (32 bit). Is it ok ?
> 
> P. S.
> I forgot to mention that this patch bootstraps/passes ,make check.

Please post patches to gcc-patches mailing list.


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

* [Bug target/50038] redundant zero extensions
  2011-08-10 15:43 [Bug target/50038] New: redundant zero extensions tocarip.intel at gmail dot com
                   ` (3 preceding siblings ...)
  2011-10-03  9:19 ` ubizjak at gmail dot com
@ 2011-10-04  9:52 ` tocarip.intel at gmail dot com
  2011-10-04 10:04 ` ubizjak at gmail dot com
                   ` (3 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: tocarip.intel at gmail dot com @ 2011-10-04  9:52 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #5 from tocarip.intel at gmail dot com 2011-10-04 09:52:03 UTC ---
This patch is experimental and before sending it to patches mail-list i wanted
to verify that at least the approach (modify implicit-zee pass and later enable
it on 32bit x86) is correct. Should i just send experimental version?


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

* [Bug target/50038] redundant zero extensions
  2011-08-10 15:43 [Bug target/50038] New: redundant zero extensions tocarip.intel at gmail dot com
                   ` (4 preceding siblings ...)
  2011-10-04  9:52 ` tocarip.intel at gmail dot com
@ 2011-10-04 10:04 ` ubizjak at gmail dot com
  2011-11-05 10:56 ` ebotcazou at gcc dot gnu.org
                   ` (2 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: ubizjak at gmail dot com @ 2011-10-04 10:04 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #6 from Uros Bizjak <ubizjak at gmail dot com> 2011-10-04 10:03:32 UTC ---
(In reply to comment #5)
> This patch is experimental and before sending it to patches mail-list i wanted
> to verify that at least the approach (modify implicit-zee pass and later enable
> it on 32bit x86) is correct. Should i just send experimental version?

Sure, but please mark it with [RFC] in the header.


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

* [Bug target/50038] redundant zero extensions
  2011-08-10 15:43 [Bug target/50038] New: redundant zero extensions tocarip.intel at gmail dot com
                   ` (5 preceding siblings ...)
  2011-10-04 10:04 ` ubizjak at gmail dot com
@ 2011-11-05 10:56 ` ebotcazou at gcc dot gnu.org
  2011-12-21 11:54 ` kyukhin at gcc dot gnu.org
  2011-12-28  9:16 ` ubizjak at gmail dot com
  8 siblings, 0 replies; 10+ messages in thread
From: ebotcazou at gcc dot gnu.org @ 2011-11-05 10:56 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |missed-optimization
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2011-11-05
                 CC|                            |ebotcazou at gcc dot
                   |                            |gnu.org
     Ever Confirmed|0                           |1

--- Comment #7 from Eric Botcazou <ebotcazou at gcc dot gnu.org> 2011-11-05 10:55:38 UTC ---
The combiner should probably do something in this local case.


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

* [Bug target/50038] redundant zero extensions
  2011-08-10 15:43 [Bug target/50038] New: redundant zero extensions tocarip.intel at gmail dot com
                   ` (6 preceding siblings ...)
  2011-11-05 10:56 ` ebotcazou at gcc dot gnu.org
@ 2011-12-21 11:54 ` kyukhin at gcc dot gnu.org
  2011-12-28  9:16 ` ubizjak at gmail dot com
  8 siblings, 0 replies; 10+ messages in thread
From: kyukhin at gcc dot gnu.org @ 2011-12-21 11:54 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #8 from Kirill Yukhin <kyukhin at gcc dot gnu.org> 2011-12-21 11:52:32 UTC ---
Author: kyukhin
Date: Wed Dec 21 11:52:27 2011
New Revision: 182574

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=182574
Log:
gcc/

2011-12-21  Enkovich Ilya  <ilya.enkovich@intel.com>

        PR target/50038
        * implicit-zee.c: Delete.
        * ree.c: New file.
        * Makefile.in: Replace implicit-zee.c with ree.c.
        * config/i386/i386.c (ix86_option_override_internal): Rename
        flag_zee to flag_ree.
        * common.opt (fzee): Ignored.
        (free): New.
        * passes.c (init_optimization_passes): Replace pass_implicit_zee
        with pass_ree.
        * tree-pass.h (pass_implicit_zee): Delete.
        (pass_ree): New.
        * timevar.def (TV_ZEE): Delete.
        (TV_REE): New.
        * doc/invoke.texi: Add -free description.

gcc/testsuite/

2011-12-21  Enkovich Ilya  <ilya.enkovich@intel.com>

        PR target/50038


Added:
    trunk/gcc/ree.c
    trunk/gcc/testsuite/gcc.dg/pr50038.c
Removed:
    trunk/gcc/implicit-zee.c
Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/Makefile.in
    trunk/gcc/common.opt
    trunk/gcc/config/i386/i386.c
    trunk/gcc/doc/invoke.texi
    trunk/gcc/passes.c
    trunk/gcc/testsuite/ChangeLog
    trunk/gcc/timevar.def
    trunk/gcc/tree-pass.h


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

* [Bug target/50038] redundant zero extensions
  2011-08-10 15:43 [Bug target/50038] New: redundant zero extensions tocarip.intel at gmail dot com
                   ` (7 preceding siblings ...)
  2011-12-21 11:54 ` kyukhin at gcc dot gnu.org
@ 2011-12-28  9:16 ` ubizjak at gmail dot com
  8 siblings, 0 replies; 10+ messages in thread
From: ubizjak at gmail dot com @ 2011-12-28  9:16 UTC (permalink / raw)
  To: gcc-bugs

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

Uros Bizjak <ubizjak at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |FIXED
   Target Milestone|---                         |4.7.0

--- Comment #9 from Uros Bizjak <ubizjak at gmail dot com> 2011-12-28 09:13:03 UTC ---
Patch was committed to mainline.


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

end of thread, other threads:[~2011-12-28  9:14 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-08-10 15:43 [Bug target/50038] New: redundant zero extensions tocarip.intel at gmail dot com
2011-08-11 10:47 ` [Bug target/50038] " izamyatin at gmail dot com
2011-09-27 11:08 ` tocarip.intel at gmail dot com
2011-09-30 15:01 ` tocarip.intel at gmail dot com
2011-10-03  9:19 ` ubizjak at gmail dot com
2011-10-04  9:52 ` tocarip.intel at gmail dot com
2011-10-04 10:04 ` ubizjak at gmail dot com
2011-11-05 10:56 ` ebotcazou at gcc dot gnu.org
2011-12-21 11:54 ` kyukhin at gcc dot gnu.org
2011-12-28  9:16 ` ubizjak at gmail dot com

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