public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "ubizjak at gmail dot com" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug target/66369] gcc 4.8.3/5.1.0 miss optimisation with vpmovmskb
Date: Wed, 03 Jun 2015 18:00:00 -0000	[thread overview]
Message-ID: <bug-66369-4-E0HKsbCmSl@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-66369-4@http.gcc.gnu.org/bugzilla/>

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

Uroš Bizjak <ubizjak at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |ASSIGNED
   Last reconfirmed|                            |2015-06-03
           Assignee|unassigned at gcc dot gnu.org      |ubizjak at gmail dot com
     Ever confirmed|0                           |1

--- Comment #5 from Uroš Bizjak <ubizjak at gmail dot com> ---
Created attachment 35693
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=35693&action=edit
Patch to add zero-extended MOVMSK patterns

This patch adds zero-extended MOVMSK patterns.

However, one more cast from (int) to (unsigned int) is needed in the source,
due to the definition of the intrinsic:

   long v;

   regchx256 = _mm256_set1_epi8( ch );
   regset256 = _mm256_loadu_si256( (__m256i const *) set );
   v = (unsigned int) _mm256_movemask_epi8
                       ( _mm256_cmpeq_epi8(regchx256,regset256) );

Using patched gcc, the code compiles to:

lookup32:
        vmovdqu charset32(%rip), %ymm0  # 10    *avx_loaddquv32qi
        vmovd   %edi, %xmm1     # 54    vec_setv4si_0/4
        movl    $11141307, %eax # 5     *movdi_internal/3
        vpbroadcastb    %xmm1, %ymm1    # 55    avx2_pbroadcastv32qi
        vpcmpeqb        %ymm0, %ymm1, %ymm0     # 13    *avx2_eqv32qi3
        vpmovmskb       %ymm0, %edx     # 16    *avx2_pmovmskb_zext
        testl   %edx, %edx      # 19    *cmpsi_ccno_1/1
        je      .L5     # 20    *jcc_1
        tzcntq  %rdx, %rdx      # 53    *ctzdi2_falsedep
        movq    mytable+32(,%rdx,8), %rax       # 28    *movdi_internal/4
.L5:
        vzeroupper      # 51    avx_vzeroupper
        ret     # 58    simple_return_internal
>From gcc-bugs-return-488025-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org Wed Jun 03 18:05:56 2015
Return-Path: <gcc-bugs-return-488025-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org>
Delivered-To: listarch-gcc-bugs@gcc.gnu.org
Received: (qmail 69178 invoked by alias); 3 Jun 2015 18:05:55 -0000
Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm
Precedence: bulk
List-Id: <gcc-bugs.gcc.gnu.org>
List-Archive: <http://gcc.gnu.org/ml/gcc-bugs/>
List-Post: <mailto:gcc-bugs@gcc.gnu.org>
List-Help: <mailto:gcc-bugs-help@gcc.gnu.org>
Sender: gcc-bugs-owner@gcc.gnu.org
Delivered-To: mailing list gcc-bugs@gcc.gnu.org
Received: (qmail 69135 invoked by uid 48); 3 Jun 2015 18:05:49 -0000
From: "ubizjak at gmail dot com" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug target/66275] __attribute__((sysv_abi)) with x86_64-w64-mingw32-gcc generates incorrect code
Date: Wed, 03 Jun 2015 18:05:00 -0000
X-Bugzilla-Reason: CC
X-Bugzilla-Type: changed
X-Bugzilla-Watch-Reason: None
X-Bugzilla-Product: gcc
X-Bugzilla-Component: target
X-Bugzilla-Version: 4.9.2
X-Bugzilla-Keywords: wrong-code
X-Bugzilla-Severity: normal
X-Bugzilla-Who: ubizjak at gmail dot com
X-Bugzilla-Status: NEW
X-Bugzilla-Resolution:
X-Bugzilla-Priority: P3
X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org
X-Bugzilla-Target-Milestone: 5.2
X-Bugzilla-Flags:
X-Bugzilla-Changed-Fields: target_milestone
Message-ID: <bug-66275-4-PO9yKTcwvz@http.gcc.gnu.org/bugzilla/>
In-Reply-To: <bug-66275-4@http.gcc.gnu.org/bugzilla/>
References: <bug-66275-4@http.gcc.gnu.org/bugzilla/>
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/
Auto-Submitted: auto-generated
MIME-Version: 1.0
X-SW-Source: 2015-06/txt/msg00357.txt.bz2
Content-length: 417

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

Uroš Bizjak <ubizjak at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|---                         |5.2

--- Comment #7 from Uroš Bizjak <ubizjak at gmail dot com> ---
Fixed in mainline, will be backported to gcc-5 branch.
>From gcc-bugs-return-488026-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org Wed Jun 03 18:08:06 2015
Return-Path: <gcc-bugs-return-488026-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org>
Delivered-To: listarch-gcc-bugs@gcc.gnu.org
Received: (qmail 76798 invoked by alias); 3 Jun 2015 18:08:06 -0000
Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm
Precedence: bulk
List-Id: <gcc-bugs.gcc.gnu.org>
List-Archive: <http://gcc.gnu.org/ml/gcc-bugs/>
List-Post: <mailto:gcc-bugs@gcc.gnu.org>
List-Help: <mailto:gcc-bugs-help@gcc.gnu.org>
Sender: gcc-bugs-owner@gcc.gnu.org
Delivered-To: mailing list gcc-bugs@gcc.gnu.org
Received: (qmail 76730 invoked by uid 48); 3 Jun 2015 18:08:01 -0000
From: "ubizjak at gmail dot com" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug target/66275] __attribute__((sysv_abi)) with x86_64-w64-mingw32-gcc generates incorrect code
Date: Wed, 03 Jun 2015 18:08:00 -0000
X-Bugzilla-Reason: CC
X-Bugzilla-Type: changed
X-Bugzilla-Watch-Reason: None
X-Bugzilla-Product: gcc
X-Bugzilla-Component: target
X-Bugzilla-Version: 4.9.2
X-Bugzilla-Keywords: wrong-code
X-Bugzilla-Severity: normal
X-Bugzilla-Who: ubizjak at gmail dot com
X-Bugzilla-Status: NEW
X-Bugzilla-Resolution:
X-Bugzilla-Priority: P3
X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org
X-Bugzilla-Target-Milestone: 5.2
X-Bugzilla-Flags:
X-Bugzilla-Changed-Fields:
Message-ID: <bug-66275-4-TX36Cwd5s6@http.gcc.gnu.org/bugzilla/>
In-Reply-To: <bug-66275-4@http.gcc.gnu.org/bugzilla/>
References: <bug-66275-4@http.gcc.gnu.org/bugzilla/>
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/
Auto-Submitted: auto-generated
MIME-Version: 1.0
X-SW-Source: 2015-06/txt/msg00358.txt.bz2
Content-length: 1124

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

--- Comment #8 from Uroš Bizjak <ubizjak at gmail dot com> ---
(In reply to Peter Cordes from comment #0)

> I wrote it in that ugly way initially because I was basically porting my ASM
> code to intrinsics.  BTW, the results were terrible.  gcc generates
> ridiculously bad code for getting the src bytes into zero-extended 64bit
> regs, for use as scaled-offsets in an address, compared to
> 
> movzx %dl, %eax
> movxz %dh, %ebx
> shr   $16, %rdx
> use rax/rbx
> movzx %dl, %eax
> movxz %dh, %ebx
> shr   $16, %rdx
> use rax/rbx
>  ...
> 
>  gcc never just shifts the reg holding src data.  Instead if copies, and
> shifts the copy by $16, $32, or $48.
> 
>  gcc's code is about 35% slower than the hand-written version, even letting
> it use avx so it doesn't emit useless movdqa instructions when it doesn't
> realize that an old value is no longer needed.  Just un-comment the
> mostly-commented loop body in the testcase (attachment version).
> 
>  Anyway, slow code is off-topic, this bug is about wrong code!

Please open a new PR for this bug.
>From gcc-bugs-return-488027-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org Wed Jun 03 18:10:49 2015
Return-Path: <gcc-bugs-return-488027-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org>
Delivered-To: listarch-gcc-bugs@gcc.gnu.org
Received: (qmail 82030 invoked by alias); 3 Jun 2015 18:10:48 -0000
Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm
Precedence: bulk
List-Id: <gcc-bugs.gcc.gnu.org>
List-Archive: <http://gcc.gnu.org/ml/gcc-bugs/>
List-Post: <mailto:gcc-bugs@gcc.gnu.org>
List-Help: <mailto:gcc-bugs-help@gcc.gnu.org>
Sender: gcc-bugs-owner@gcc.gnu.org
Delivered-To: mailing list gcc-bugs@gcc.gnu.org
Received: (qmail 81962 invoked by uid 48); 3 Jun 2015 18:10:45 -0000
From: "avi@cloudius-systems.com" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug libstdc++/65942] [5/6 Regression] [C++14] cannot use std::function as comparator in algorithms
Date: Wed, 03 Jun 2015 18:10:00 -0000
X-Bugzilla-Reason: CC
X-Bugzilla-Type: changed
X-Bugzilla-Watch-Reason: None
X-Bugzilla-Product: gcc
X-Bugzilla-Component: libstdc++
X-Bugzilla-Version: 5.0
X-Bugzilla-Keywords: rejects-valid
X-Bugzilla-Severity: normal
X-Bugzilla-Who: avi@cloudius-systems.com
X-Bugzilla-Status: ASSIGNED
X-Bugzilla-Resolution:
X-Bugzilla-Priority: P3
X-Bugzilla-Assigned-To: redi at gcc dot gnu.org
X-Bugzilla-Target-Milestone: ---
X-Bugzilla-Flags:
X-Bugzilla-Changed-Fields:
Message-ID: <bug-65942-4-eOzXZ65kQU@http.gcc.gnu.org/bugzilla/>
In-Reply-To: <bug-65942-4@http.gcc.gnu.org/bugzilla/>
References: <bug-65942-4@http.gcc.gnu.org/bugzilla/>
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: 7bit
X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/
Auto-Submitted: auto-generated
MIME-Version: 1.0
X-SW-Source: 2015-06/txt/msg00359.txt.bz2
Content-length: 157

https://gcc.gnu.org/bugzilla/show_bug.cgi?ide942

--- Comment #14 from Avi Kivity <avi@cloudius-systems.com> ---
Please consider backporting this to 5.2.


  parent reply	other threads:[~2015-06-03 18:00 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-06-01 21:53 [Bug c/66369] New: " marcus.kool at urlfilterdb dot com
2015-06-01 21:57 ` [Bug c/66369] " marcus.kool at urlfilterdb dot com
2015-06-02  9:05 ` [Bug target/66369] " rguenth at gcc dot gnu.org
2015-06-02 10:21 ` ubizjak at gmail dot com
2015-06-02 11:21 ` marcus.kool at urlfilterdb dot com
2015-06-02 14:51 ` marcus.kool at urlfilterdb dot com
2015-06-03 18:00 ` ubizjak at gmail dot com [this message]
2015-06-04 10:06 ` uros at gcc dot gnu.org
2015-06-04 10:11 ` ubizjak at gmail dot com
2015-06-04 17:50 ` marcus.kool at urlfilterdb 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-66369-4-E0HKsbCmSl@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).