public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug target/46209] New: pmovmskb, useless sign extension
@ 2010-10-28  8:30 tbptbp at gmail dot com
  2010-10-28  8:32 ` [Bug target/46209] " tbptbp at gmail dot com
  2021-07-26  9:25 ` pinskia at gcc dot gnu.org
  0 siblings, 2 replies; 3+ messages in thread
From: tbptbp at gmail dot com @ 2010-10-28  8:30 UTC (permalink / raw)
  To: gcc-bugs

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

           Summary: pmovmskb, useless sign extension
           Product: gcc
           Version: 4.6.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: target
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: tbptbp@gmail.com
              Host: x86_64-pc-linux-gnu
            Target: x86_64-pc-linux-gnu


Hello,

$ cat movemsk.c
#include <xmmintrin.h>
typedef long unsigned int uint64_t;
uint64_t foo128(__m128i x) { return _mm_movemask_epi8(x); }
uint64_t foo64(__m64 x) { return _mm_movemask_pi8(x); }
$ /usr/local/gcc-4.6-20101026/bin/gcc  -O3 -march=native movemsk.c -S -o -
foo128:
.LFB516:
    .cfi_startproc
    pmovmskb    %xmm0, %eax
    cltq
    ret
foo64:
.LFB517:
    .cfi_startproc
    movdq2q    %xmm0, %mm0
    movq    %xmm0, -8(%rsp)
    pmovmskb    %mm0, %eax
    cltq
    ret

I won't discuss the interesting mmx code generation but to point that in both
cases, as per Intel doc, there's no need to extend the result; a sign extension
is even slightly more wrong.

$ /usr/local/gcc-4.6-20101026/bin/gcc  -v
Using built-in specs.
COLLECT_GCC=/usr/local/gcc-4.6-20101026/bin/gcc
COLLECT_LTO_WRAPPER=/usr/local/gcc-4.6-20101026/bin/../libexec/gcc/x86_64-unknown-linux-gnu/4.6.0/lto-wrapper
Target: x86_64-unknown-linux-gnu
Configured with: ../configure --prefix=/usr/local/gcc-4.6.0
--enable-languages=c,c++ --enable-threads=posix --disable-nls
--with-system-zlib --disable-bootstrap --enable-mpfr --enable-gold --enable-lto
--with-ppl --with-cloog --with-arch=native --enable-checking=release
Thread model: posix
gcc version 4.6.0 20101026 (experimental) (GCC)


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

* [Bug target/46209] pmovmskb, useless sign extension
  2010-10-28  8:30 [Bug target/46209] New: pmovmskb, useless sign extension tbptbp at gmail dot com
@ 2010-10-28  8:32 ` tbptbp at gmail dot com
  2021-07-26  9:25 ` pinskia at gcc dot gnu.org
  1 sibling, 0 replies; 3+ messages in thread
From: tbptbp at gmail dot com @ 2010-10-28  8:32 UTC (permalink / raw)
  To: gcc-bugs

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

tbp <tbptbp at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Severity|normal                      |enhancement


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

* [Bug target/46209] pmovmskb, useless sign extension
  2010-10-28  8:30 [Bug target/46209] New: pmovmskb, useless sign extension tbptbp at gmail dot com
  2010-10-28  8:32 ` [Bug target/46209] " tbptbp at gmail dot com
@ 2021-07-26  9:25 ` pinskia at gcc dot gnu.org
  1 sibling, 0 replies; 3+ messages in thread
From: pinskia at gcc dot gnu.org @ 2021-07-26  9:25 UTC (permalink / raw)
  To: gcc-bugs

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

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Depends on|                            |66369
     Ever confirmed|0                           |1
   Last reconfirmed|                            |2021-07-26
             Status|UNCONFIRMED                 |NEW

--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
foo64:
.LFB533:
        .cfi_startproc
        pmovmskb        %xmm0, %eax
        movzbl  %al, %eax
        ret

The 128 one was fixed with PR 66369.


Referenced Bugs:

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66369
[Bug 66369] gcc 4.8.3/5.1.0 miss optimisation with vpmovmskb

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

end of thread, other threads:[~2021-07-26  9:25 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-10-28  8:30 [Bug target/46209] New: pmovmskb, useless sign extension tbptbp at gmail dot com
2010-10-28  8:32 ` [Bug target/46209] " tbptbp at gmail dot com
2021-07-26  9:25 ` pinskia 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).