public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "tocarip.intel at gmail dot com" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug target/50038] New: redundant zero extensions
Date: Wed, 10 Aug 2011 15:43:00 -0000	[thread overview]
Message-ID: <bug-50038-4@http.gcc.gnu.org/bugzilla/> (raw)

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.


             reply	other threads:[~2011-08-10 15:43 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-08-10 15:43 tocarip.intel at gmail dot com [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-50038-4@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).