public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/66369] New: gcc 4.8.3/5.1.0 miss optimisation with vpmovmskb
@ 2015-06-01 21:53 marcus.kool at urlfilterdb dot com
  2015-06-01 21:57 ` [Bug c/66369] " marcus.kool at urlfilterdb dot com
                   ` (8 more replies)
  0 siblings, 9 replies; 10+ messages in thread
From: marcus.kool at urlfilterdb dot com @ 2015-06-01 21:53 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 66369
           Summary: gcc 4.8.3/5.1.0 miss optimisation with vpmovmskb
           Product: gcc
           Version: 4.8.3
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
          Assignee: unassigned at gcc dot gnu.org
          Reporter: marcus.kool at urlfilterdb dot com
  Target Milestone: ---

Created attachment 35672
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=35672&action=edit
example C code to demonstrate the missed optimisation in gcc 4.8.3 and 5.1.0

When using _mm256_movemask_epi8() I cannot find a way for gcc to produce
   vpmovmskb YMM,R64
instead of 
   vpmovmskb YMM,R32

When the result of the vpmovmskb is not stored in R64, unnecessary
sign-extension instructions cltq, movl or movslq are generated later.  With a
result in R32 and indexing an array of structs, gcc generates for 
   node = node->children[ __builtin_ctzl(result-of-vpmovmskb) ]
the following:
   vpmovmskb YMM,R32
   movslq    R32, R64
   tzcntq    R64, R64
   movq      offset(%rdi,R64,8), %rdi
instead of the more efficient:
   vpmovmskb YMM,R64
   tzcntq    R64,R64
   movq      offset(%rdi,R64,8), %rdi

Attached is avx2.c which has the C source code that demonstrates the above.
aavx2.c is compiled with gcc (GCC) 4.8.3 20140911 (Red Hat 4.8.3-9) and flags
   -std=c99 -march=core-avx2  -mtune=core-avx2 -O3
gcc 5.1.0 has the same behaviour.


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

* [Bug c/66369] gcc 4.8.3/5.1.0 miss optimisation with vpmovmskb
  2015-06-01 21:53 [Bug c/66369] New: gcc 4.8.3/5.1.0 miss optimisation with vpmovmskb marcus.kool at urlfilterdb dot com
@ 2015-06-01 21:57 ` marcus.kool at urlfilterdb dot com
  2015-06-02  9:05 ` [Bug target/66369] " rguenth at gcc dot gnu.org
                   ` (7 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: marcus.kool at urlfilterdb dot com @ 2015-06-01 21:57 UTC (permalink / raw)
  To: gcc-bugs

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

Marcus Kool <marcus.kool at urlfilterdb dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |missed-optimization
      Known to fail|                            |4.8.3, 5.1.0
           Severity|normal                      |minor


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

* [Bug target/66369] gcc 4.8.3/5.1.0 miss optimisation with vpmovmskb
  2015-06-01 21:53 [Bug c/66369] New: gcc 4.8.3/5.1.0 miss optimisation with vpmovmskb 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 ` rguenth at gcc dot gnu.org
  2015-06-02 10:21 ` ubizjak at gmail dot com
                   ` (6 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: rguenth at gcc dot gnu.org @ 2015-06-02  9:05 UTC (permalink / raw)
  To: gcc-bugs

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

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Target|                            |x86_64-*-*, i?86-*-*

--- Comment #1 from Richard Biener <rguenth at gcc dot gnu.org> ---
   v = (long ) _mm256_movemask_epi8( _mm256_cmpeq_epi8(regchx256,regset256) );

isn't this because there maybe isn't an intrinsic producing a 64bit value?
If so the backend probably misses a pattern for it and thus combine doesn't
generate it.


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

* [Bug target/66369] gcc 4.8.3/5.1.0 miss optimisation with vpmovmskb
  2015-06-01 21:53 [Bug c/66369] New: gcc 4.8.3/5.1.0 miss optimisation with vpmovmskb 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
                   ` (5 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: ubizjak at gmail dot com @ 2015-06-02 10:21 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from Uroš Bizjak <ubizjak at gmail dot com> ---
I have looked briefly at this. The compiler actually generates the following:

        vpmovmskb       %ymm0, %edx     # 16    avx2_pmovmskb   [length = 4]
        testl   %edx, %edx      # 18    *cmpsi_ccno_1/1 [length = 2]
        je      .L5     # 19    *jcc_1  [length = 2]
        movslq  %edx, %rdx      # 21    *extendsidi2_rex64/2    [length = 3]
        tzcntq  %rdx, %rdx      # 52    *ctzdi2_falsedep        [length = 5]

from:

  int _14;
  long unsigned int v.1_15;
  int _16;
  ...
  _14 = __builtin_ia32_pmovmskb256 (_13);
  if (_14 != 0)
    goto <bb 5>;
  else
    goto <bb 6>;

  <bb 5>:
  v.1_15 = (long unsigned int) _14;
  _16 = __builtin_ctzl (v.1_15);
  _17 = (long int) _16;

The intrinsic returns "int", and from the above tree dump, the compiler won't
even consider to combine the sign-extension with vpmovmskb.

So, why not:

   unsigned int v;

   v = (unsigned int) _mm256_movemask_epi8( ... );
   if (v != 0)
      return (long) __builtin_ctz( v );
>From gcc-bugs-return-487815-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org Tue Jun 02 10:21:32 2015
Return-Path: <gcc-bugs-return-487815-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org>
Delivered-To: listarch-gcc-bugs@gcc.gnu.org
Received: (qmail 114651 invoked by alias); 2 Jun 2015 10:21:32 -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 114611 invoked by uid 48); 2 Jun 2015 10:21:28 -0000
From: "fxcoudert at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug fortran/66377] New: [F95] Wrong-code with equivalenced array in module
Date: Tue, 02 Jun 2015 10:21:00 -0000
X-Bugzilla-Reason: CC
X-Bugzilla-Type: new
X-Bugzilla-Watch-Reason: None
X-Bugzilla-Product: gcc
X-Bugzilla-Component: fortran
X-Bugzilla-Version: 6.0
X-Bugzilla-Keywords:
X-Bugzilla-Severity: normal
X-Bugzilla-Who: fxcoudert at gcc dot gnu.org
X-Bugzilla-Status: UNCONFIRMED
X-Bugzilla-Resolution:
X-Bugzilla-Priority: P3
X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org
X-Bugzilla-Target-Milestone: ---
X-Bugzilla-Flags:
X-Bugzilla-Changed-Fields: bug_id short_desc product version bug_status bug_severity priority component assigned_to reporter target_milestone
Message-ID: <bug-66377-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/msg00147.txt.bz2
Content-length: 772

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

            Bug ID: 66377
           Summary: [F95] Wrong-code with equivalenced array in module
           Product: gcc
           Version: 6.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
          Assignee: unassigned at gcc dot gnu.org
          Reporter: fxcoudert at gcc dot gnu.org
  Target Milestone: ---

This code:

module constant
  integer :: x(2), x1, x2
  equivalence (x(1),x1), (x(2),x2)
end module

program test
  use constant
  x = (/1, 2/)
  call another()
contains
  subroutine another()
    use constant, only : x1
    print *, x1
  end subroutine
end program

should output "1", but outputs "0" with all versions of gfortran tested.


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

* [Bug target/66369] gcc 4.8.3/5.1.0 miss optimisation with vpmovmskb
  2015-06-01 21:53 [Bug c/66369] New: gcc 4.8.3/5.1.0 miss optimisation with vpmovmskb marcus.kool at urlfilterdb dot com
                   ` (2 preceding siblings ...)
  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
                   ` (4 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: marcus.kool at urlfilterdb dot com @ 2015-06-02 11:21 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 from Marcus Kool <marcus.kool at urlfilterdb dot com> ---

> The intrinsic returns "int", and from the above tree dump, the compiler
> won't even consider to combine the sign-extension with vpmovmskb.

That is the core of the issue: the part of gcc that deals with intrinsics does
not consider to use the 64bit version of the vpmovmskb instruction.  

BTW: how is gcc behaving on a system with AVX512 ?


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

* [Bug target/66369] gcc 4.8.3/5.1.0 miss optimisation with vpmovmskb
  2015-06-01 21:53 [Bug c/66369] New: gcc 4.8.3/5.1.0 miss optimisation with vpmovmskb marcus.kool at urlfilterdb dot com
                   ` (3 preceding siblings ...)
  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
                   ` (3 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: marcus.kool at urlfilterdb dot com @ 2015-06-02 14:51 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #4 from Marcus Kool <marcus.kool at urlfilterdb dot com> ---
> The intrinsic returns "int", and from the above tree dump, the compiler
> won't even consider to combine the sign-extension with vpmovmskb.
> 
> So, why not:
> 
>    unsigned int v;
> 
>    v = (unsigned int) _mm256_movemask_epi8( ... );
>    if (v != 0)
>       return (long) __builtin_ctz( v );

Because that will produce the extra and unnecessary sign extension instructions
if the result is used to index an array of structs.

Can this issue be resolved by simply always letting the intrinsic producing a
64bit result and hence always producing the 64bit instruction 
   vpmovmskb YMM,R64  ?
It well be that a 64bit results is not desired and a conversion to 32bit is
then required but an (implicit) conversion from a long to an int does _not_
need an instruction while conversion from int to long does need an unnecessary
instruction.


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

* [Bug target/66369] gcc 4.8.3/5.1.0 miss optimisation with vpmovmskb
  2015-06-01 21:53 [Bug c/66369] New: gcc 4.8.3/5.1.0 miss optimisation with vpmovmskb marcus.kool at urlfilterdb dot com
                   ` (4 preceding siblings ...)
  2015-06-02 14:51 ` marcus.kool at urlfilterdb dot com
@ 2015-06-03 18:00 ` ubizjak at gmail dot com
  2015-06-04 10:06 ` uros at gcc dot gnu.org
                   ` (2 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: ubizjak at gmail dot com @ 2015-06-03 18:00 UTC (permalink / raw)
  To: gcc-bugs

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.


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

* [Bug target/66369] gcc 4.8.3/5.1.0 miss optimisation with vpmovmskb
  2015-06-01 21:53 [Bug c/66369] New: gcc 4.8.3/5.1.0 miss optimisation with vpmovmskb marcus.kool at urlfilterdb dot com
                   ` (5 preceding siblings ...)
  2015-06-03 18:00 ` ubizjak at gmail dot com
@ 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
  8 siblings, 0 replies; 10+ messages in thread
From: uros at gcc dot gnu.org @ 2015-06-04 10:06 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #6 from uros at gcc dot gnu.org ---
Author: uros
Date: Thu Jun  4 10:06:11 2015
New Revision: 224120

URL: https://gcc.gnu.org/viewcvs?rev=224120&root=gcc&view=rev
Log:
        PR target/66369
        * config/i386/sse.md (<sse2_avx2>_pmovmsk): Merge from avx2_pmovmskb
        and sse2_pmovmskb using VI1_AVX2 mode iterator.
        (*<sse>_movmsk<ssemodesuffix><avxsizesuffix>_zext): New insn pattern.
        (*<sse2_avx2>_pmovmskb_zext): Ditto.


Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/config/i386/sse.md


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

* [Bug target/66369] gcc 4.8.3/5.1.0 miss optimisation with vpmovmskb
  2015-06-01 21:53 [Bug c/66369] New: gcc 4.8.3/5.1.0 miss optimisation with vpmovmskb marcus.kool at urlfilterdb dot com
                   ` (6 preceding siblings ...)
  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
  8 siblings, 0 replies; 10+ messages in thread
From: ubizjak at gmail dot com @ 2015-06-04 10:11 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
         Resolution|---                         |FIXED
   Target Milestone|---                         |6.0

--- Comment #7 from Uroš Bizjak <ubizjak at gmail dot com> ---
Implemented in mainline (6.0), no plan to backport.
>From gcc-bugs-return-488094-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org Thu Jun 04 10:56:03 2015
Return-Path: <gcc-bugs-return-488094-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org>
Delivered-To: listarch-gcc-bugs@gcc.gnu.org
Received: (qmail 103991 invoked by alias); 4 Jun 2015 10:56:03 -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 103952 invoked by uid 48); 4 Jun 2015 10:55:58 -0000
From: "marxin at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug other/66394] [5/6 Regression] ICE in -flto -fmerge-all-constants -fno-use-linker-plugin targetting i686-w64-mingw32
Date: Thu, 04 Jun 2015 10:56:00 -0000
X-Bugzilla-Reason: CC
X-Bugzilla-Type: changed
X-Bugzilla-Watch-Reason: None
X-Bugzilla-Product: gcc
X-Bugzilla-Component: other
X-Bugzilla-Version: 5.1.0
X-Bugzilla-Keywords:
X-Bugzilla-Severity: normal
X-Bugzilla-Who: marxin at gcc dot gnu.org
X-Bugzilla-Status: UNCONFIRMED
X-Bugzilla-Resolution:
X-Bugzilla-Priority: P3
X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org
X-Bugzilla-Target-Milestone: ---
X-Bugzilla-Flags:
X-Bugzilla-Changed-Fields:
Message-ID: <bug-66394-4-RfhMg5PEDG@http.gcc.gnu.org/bugzilla/>
In-Reply-To: <bug-66394-4@http.gcc.gnu.org/bugzilla/>
References: <bug-66394-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/msg00426.txt.bz2
Content-length: 146

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

--- Comment #3 from Martin Liška <marxin at gcc dot gnu.org> ---
Started with r201408.
>From gcc-bugs-return-488095-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org Thu Jun 04 10:59:00 2015
Return-Path: <gcc-bugs-return-488095-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org>
Delivered-To: listarch-gcc-bugs@gcc.gnu.org
Received: (qmail 113033 invoked by alias); 4 Jun 2015 10:59:00 -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 112978 invoked by uid 48); 4 Jun 2015 10:58:56 -0000
From: "manu at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c/66415] [6 Regression] ice in location_column_from_byte_offset
Date: Thu, 04 Jun 2015 10:59:00 -0000
X-Bugzilla-Reason: CC
X-Bugzilla-Type: changed
X-Bugzilla-Watch-Reason: None
X-Bugzilla-Product: gcc
X-Bugzilla-Component: c
X-Bugzilla-Version: 6.0
X-Bugzilla-Keywords:
X-Bugzilla-Severity: normal
X-Bugzilla-Who: manu at gcc dot gnu.org
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: 6.0
X-Bugzilla-Flags:
X-Bugzilla-Changed-Fields:
Message-ID: <bug-66415-4-O2UxItacie@http.gcc.gnu.org/bugzilla/>
In-Reply-To: <bug-66415-4@http.gcc.gnu.org/bugzilla/>
References: <bug-66415-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/msg00427.txt.bz2
Content-length: 1455

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

--- Comment #6 from Manuel López-Ibáñez <manu at gcc dot gnu.org> ---
(In reply to Marek Polacek from comment #5)
> Oops, the patch does not fixed the reduced case, so something else is needed
> as well :(.

It seems this is triggering:

  if (map != LINEMAPS_LAST_ORDINARY_MAP (set))
=>  if (linemap_assert_fails (loc + offset < MAP_START_LOCATION (&map[1])))
      return loc;

because we have:

(gdb) p loc
$10 = 441
(gdb) p loc + offset
$11 = 460
(gdb) p MAP_START_LOCATION(&map[1])
$12 = 442
(gdb) p expand_location(MAP_START_LOCATION(&map[0]))
$14 = {file = 0x7fffffffe7ea "/home/manuel/test.c", line = 1, column = 0, data
= 0x0, sysp = false}
(gdb) p expand_location(MAP_START_LOCATION(&map[1]))
$13 = {file = 0x7fffffffe7ea "/home/manuel/test.c", line = 4, column = 0, data
= 0x0, sysp = false}

I'm not sure how it happens that 441 is in map[0] and not in map[1]. The ideal
fix would be that we detect this case and then use map[1] instead of map[0]
before calling linemap_position_for_line_and_column. We probably need to check
every subsequent map until it fits.

A simple fix is to remove the call to linemap_assert_fails and simply return
loc (that is, give up on computing a precise column location). In that case,
please add a FIXME. I may look at this if/when I have some free time (hopefully
before GCC 6 is released).
>From gcc-bugs-return-488096-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org Thu Jun 04 11:09:22 2015
Return-Path: <gcc-bugs-return-488096-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org>
Delivered-To: listarch-gcc-bugs@gcc.gnu.org
Received: (qmail 62859 invoked by alias); 4 Jun 2015 11:09:21 -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 60823 invoked by uid 48); 4 Jun 2015 11:09:18 -0000
From: "mpolacek at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c/66415] [6 Regression] ice in location_column_from_byte_offset
Date: Thu, 04 Jun 2015 11:09:00 -0000
X-Bugzilla-Reason: CC
X-Bugzilla-Type: changed
X-Bugzilla-Watch-Reason: None
X-Bugzilla-Product: gcc
X-Bugzilla-Component: c
X-Bugzilla-Version: 6.0
X-Bugzilla-Keywords:
X-Bugzilla-Severity: normal
X-Bugzilla-Who: mpolacek at gcc dot gnu.org
X-Bugzilla-Status: ASSIGNED
X-Bugzilla-Resolution:
X-Bugzilla-Priority: P3
X-Bugzilla-Assigned-To: mpolacek at gcc dot gnu.org
X-Bugzilla-Target-Milestone: 6.0
X-Bugzilla-Flags:
X-Bugzilla-Changed-Fields: bug_status assigned_to
Message-ID: <bug-66415-4-qLGZnOvWHs@http.gcc.gnu.org/bugzilla/>
In-Reply-To: <bug-66415-4@http.gcc.gnu.org/bugzilla/>
References: <bug-66415-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/msg00428.txt.bz2
Content-length: 464

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

Marek Polacek <mpolacek at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |ASSIGNED
           Assignee|unassigned at gcc dot gnu.org      |mpolacek at gcc dot gnu.org

--- Comment #7 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
Works for me.


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

* [Bug target/66369] gcc 4.8.3/5.1.0 miss optimisation with vpmovmskb
  2015-06-01 21:53 [Bug c/66369] New: gcc 4.8.3/5.1.0 miss optimisation with vpmovmskb marcus.kool at urlfilterdb dot com
                   ` (7 preceding siblings ...)
  2015-06-04 10:11 ` ubizjak at gmail dot com
@ 2015-06-04 17:50 ` marcus.kool at urlfilterdb dot com
  8 siblings, 0 replies; 10+ messages in thread
From: marcus.kool at urlfilterdb dot com @ 2015-06-04 17:50 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #8 from Marcus Kool <marcus.kool at urlfilterdb dot com> ---
(In reply to Uroš Bizjak from comment #5)
> Created attachment 35693 [details]
> 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) );
Can you confirm that the code has
     return __builtin_ctzl(v);

Thanks for the patch, but the required cast to unsigned int is
counter-intuitive and it is likely that nobody will use this cast in their code
and hence miss the optimisation.  Isn't there a more elegant solution?
>From gcc-bugs-return-488114-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org Thu Jun 04 17:59:17 2015
Return-Path: <gcc-bugs-return-488114-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org>
Delivered-To: listarch-gcc-bugs@gcc.gnu.org
Received: (qmail 6067 invoked by alias); 4 Jun 2015 17:59:17 -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 5297 invoked by uid 48); 4 Jun 2015 17:59:13 -0000
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: Thu, 04 Jun 2015 17:59: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.8.3
X-Bugzilla-Keywords: missed-optimization
X-Bugzilla-Severity: minor
X-Bugzilla-Who: ubizjak at gmail dot com
X-Bugzilla-Status: RESOLVED
X-Bugzilla-Resolution: FIXED
X-Bugzilla-Priority: P3
X-Bugzilla-Assigned-To: ubizjak at gmail dot com
X-Bugzilla-Target-Milestone: 6.0
X-Bugzilla-Flags:
X-Bugzilla-Changed-Fields:
Message-ID: <bug-66369-4-8X2VHueJUZ@http.gcc.gnu.org/bugzilla/>
In-Reply-To: <bug-66369-4@http.gcc.gnu.org/bugzilla/>
References: <bug-66369-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/msg00446.txt.bz2
Content-length: 851

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

--- Comment #9 from Uroš Bizjak <ubizjak at gmail dot com> ---
(In reply to Marcus Kool from comment #8)

> Can you confirm that the code has
>      return __builtin_ctzl(v);

__inline__ long find_pos32( unsigned char ch, mycharset32 set )
{
   __m256i regchx256;
   __m256i regset256;
   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) );
   if (v != 0L)
      return (long) __builtin_ctzl( v );
   return -1;
}

> Thanks for the patch, but the required cast to unsigned int is
> counter-intuitive and it is likely that nobody will use this cast in their
> code and hence miss the optimisation.  Isn't there a more elegant solution?

No.
>From gcc-bugs-return-488115-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org Thu Jun 04 18:13:26 2015
Return-Path: <gcc-bugs-return-488115-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org>
Delivered-To: listarch-gcc-bugs@gcc.gnu.org
Received: (qmail 35887 invoked by alias); 4 Jun 2015 18:13:26 -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 35842 invoked by uid 48); 4 Jun 2015 18:13:22 -0000
From: "tkoenig at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug fortran/58749] PACK(ADJUSTL([" a"," b"]), [.TRUE.,.FALSE.]) causes an internal compiler error
Date: Thu, 04 Jun 2015 18:13:00 -0000
X-Bugzilla-Reason: CC
X-Bugzilla-Type: changed
X-Bugzilla-Watch-Reason: None
X-Bugzilla-Product: gcc
X-Bugzilla-Component: fortran
X-Bugzilla-Version: unknown
X-Bugzilla-Keywords:
X-Bugzilla-Severity: normal
X-Bugzilla-Who: tkoenig at gcc dot gnu.org
X-Bugzilla-Status: ASSIGNED
X-Bugzilla-Resolution:
X-Bugzilla-Priority: P3
X-Bugzilla-Assigned-To: tkoenig at gcc dot gnu.org
X-Bugzilla-Target-Milestone: ---
X-Bugzilla-Flags:
X-Bugzilla-Changed-Fields: bug_status cf_reconfirmed_on cc assigned_to
Message-ID: <bug-58749-4-5cIJ20PNT8@http.gcc.gnu.org/bugzilla/>
In-Reply-To: <bug-58749-4@http.gcc.gnu.org/bugzilla/>
References: <bug-58749-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/msg00447.txt.bz2
Content-length: 600

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

Thomas Koenig <tkoenig at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |ASSIGNED
   Last reconfirmed|2013-10-16 00:00:00         |2015-6-4
                 CC|                            |tkoenig at gcc dot gnu.org
           Assignee|unassigned at gcc dot gnu.org      |tkoenig at gcc dot gnu.org

--- Comment #2 from Thomas Koenig <tkoenig at gcc dot gnu.org> ---
A missing charlen.


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

end of thread, other threads:[~2015-06-04 17:50 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-06-01 21:53 [Bug c/66369] New: gcc 4.8.3/5.1.0 miss optimisation with vpmovmskb 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
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

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