From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 23257 invoked by alias); 28 Oct 2010 08:30:40 -0000 Received: (qmail 23241 invoked by uid 22791); 28 Oct 2010 08:30:38 -0000 X-SWARE-Spam-Status: No, hits=-2.2 required=5.0 tests=ALL_TRUSTED,AWL,BAYES_00,SARE_FROM_CONS6S,TW_OV,TW_VD X-Spam-Check-By: sourceware.org Received: from localhost (HELO gcc.gnu.org) (127.0.0.1) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Thu, 28 Oct 2010 08:30:33 +0000 From: "tbptbp at gmail dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug target/46209] New: pmovmskb, useless sign extension X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: target X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: tbptbp at gmail dot com X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Changed-Fields: Message-ID: X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated Content-Type: text/plain; charset="UTF-8" MIME-Version: 1.0 Date: Thu, 28 Oct 2010 08:30:00 -0000 Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org X-SW-Source: 2010-10/txt/msg02378.txt.bz2 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 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)