public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug tree-optimization/49002] New: 128-bit AVX load incorrectly becomes 256-bit AVX load
@ 2011-05-14 23:57 athena at fftw dot org
  2011-05-15 18:59 ` [Bug target/49002] " ubizjak at gmail dot com
                   ` (6 more replies)
  0 siblings, 7 replies; 8+ messages in thread
From: athena at fftw dot org @ 2011-05-14 23:57 UTC (permalink / raw)
  To: gcc-bugs

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

           Summary: 128-bit AVX load incorrectly becomes 256-bit AVX load
           Product: gcc
           Version: 4.6.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: tree-optimization
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: athena@fftw.org


Created attachment 24249
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=24249
test case for this bug

The attached foo.c program contains two 128-bit AVX loads from
locations of type __m128d.  However, gcc-4.6 converts the first
load into a 256-load.  While this is semantically correct, because
the upper 128-bits are ignored, the vmovapd instruction has different
alignment requirements in 128 and 256-bit mode, and therefore this
conversion causes spurious segfaults when the data is not 32-byte aligned.

Compile the attached program as follows:

   x86_64-linux-gnu-gcc-4.6 -mavx -O -S foo.c

The generated assembly contains the incorrect load:

        vmovapd (%rdi), %ymm0

By contrast, gcc-4.5 generates the correct 128-bit load instruction "vmovapd
(%rdi), %xmm0".


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

* [Bug target/49002] 128-bit AVX load incorrectly becomes 256-bit AVX load
  2011-05-14 23:57 [Bug tree-optimization/49002] New: 128-bit AVX load incorrectly becomes 256-bit AVX load athena at fftw dot org
@ 2011-05-15 18:59 ` ubizjak at gmail dot com
  2011-05-18  8:43 ` kirill.yukhin at intel dot com
                   ` (5 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: ubizjak at gmail dot com @ 2011-05-15 18:59 UTC (permalink / raw)
  To: gcc-bugs

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

Uros Bizjak <ubizjak at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Target|                            |x86-avx
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2011.05.15 18:28:51
          Component|tree-optimization           |target
                 CC|                            |hjl.tools at gmail dot com
     Ever Confirmed|0                           |1
   Target Milestone|---                         |4.6.2

--- Comment #1 from Uros Bizjak <ubizjak at gmail dot com> 2011-05-15 18:28:51 UTC ---
Confirmed, caused by r161279 [1],[2].

2010-06-23  H.J. Lu  <hongjiu.lu@intel.com>

    * config/i386/i386.c (bdesc_args): Replace CODE_FOR_avx_si_si256,
    CODE_FOR_avx_ps_ps256 and CODE_FOR_avx_pd_pd256 with
    CODE_FOR_vec_extract_lo_v8si, CODE_FOR_vec_extract_lo_v8sf
    and CODE_FOR_vec_extract_lo_v4df.

    * config/i386/sse.md (vec_extract_lo_<AVX256MODE4P:mode>):
    Changed to define_insn_and_split.
    (vec_extract_lo_<AVX256MODE8P:mode>): Likewise.
    (vec_extract_lo_v16hi): Likewise.
    (vec_extract_lo_v32qi): Likewise.
    (avx_<avxmodesuffixp><avxmodesuffix>_<avxmodesuffixp>): Likewise.
    (avx_<avxmodesuffixp>_<avxmodesuffixp><avxmodesuffix>): Removed.

[1] http://gcc.gnu.org/ml/gcc-cvs/2010-06/msg01197.html
[2] http://gcc.gnu.org/ml/gcc-patches/2010-06/msg02216.html


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

* [Bug target/49002] 128-bit AVX load incorrectly becomes 256-bit AVX load
  2011-05-14 23:57 [Bug tree-optimization/49002] New: 128-bit AVX load incorrectly becomes 256-bit AVX load athena at fftw dot org
  2011-05-15 18:59 ` [Bug target/49002] " ubizjak at gmail dot com
@ 2011-05-18  8:43 ` kirill.yukhin at intel dot com
  2011-05-18  9:43 ` ubizjak at gmail dot com
                   ` (4 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: kirill.yukhin at intel dot com @ 2011-05-18  8:43 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from Yukhin Kirill <kirill.yukhin at intel dot com> 2011-05-18 08:24:10 UTC ---
Created attachment 24278
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=24278
The patch

Hi,
Here is fix for the bug. I made bootrstrap and make check on 4.6
BTW, it also have to be committed to trunk, since the problem is there is well

K


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

* [Bug target/49002] 128-bit AVX load incorrectly becomes 256-bit AVX load
  2011-05-14 23:57 [Bug tree-optimization/49002] New: 128-bit AVX load incorrectly becomes 256-bit AVX load athena at fftw dot org
  2011-05-15 18:59 ` [Bug target/49002] " ubizjak at gmail dot com
  2011-05-18  8:43 ` kirill.yukhin at intel dot com
@ 2011-05-18  9:43 ` ubizjak at gmail dot com
  2011-05-18 21:40 ` hjl.tools at gmail dot com
                   ` (3 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: ubizjak at gmail dot com @ 2011-05-18  9:43 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 from Uros Bizjak <ubizjak at gmail dot com> 2011-05-18 09:12:21 UTC ---
(In reply to comment #2)
> Created attachment 24278 [details]
> The patch

> Here is fix for the bug. I made bootrstrap and make check on 4.6
> BTW, it also have to be committed to trunk, since the problem is there is well

Please post the patch to gcc-patches@ mailing list for approval or further
discussion. Please follow the procedure, as explained in details in [1].

[1] http://gcc.gnu.org/contribute.html


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

* [Bug target/49002] 128-bit AVX load incorrectly becomes 256-bit AVX load
  2011-05-14 23:57 [Bug tree-optimization/49002] New: 128-bit AVX load incorrectly becomes 256-bit AVX load athena at fftw dot org
                   ` (2 preceding siblings ...)
  2011-05-18  9:43 ` ubizjak at gmail dot com
@ 2011-05-18 21:40 ` hjl.tools at gmail dot com
  2011-05-18 22:53 ` hjl at gcc dot gnu.org
                   ` (2 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: hjl.tools at gmail dot com @ 2011-05-18 21:40 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #4 from H.J. Lu <hjl.tools at gmail dot com> 2011-05-18 20:38:59 UTC ---
A patch is posted at

http://gcc.gnu.org/ml/gcc-patches/2011-05/msg01325.html


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

* [Bug target/49002] 128-bit AVX load incorrectly becomes 256-bit AVX load
  2011-05-14 23:57 [Bug tree-optimization/49002] New: 128-bit AVX load incorrectly becomes 256-bit AVX load athena at fftw dot org
                   ` (3 preceding siblings ...)
  2011-05-18 21:40 ` hjl.tools at gmail dot com
@ 2011-05-18 22:53 ` hjl at gcc dot gnu.org
  2011-05-18 23:24 ` hjl at gcc dot gnu.org
  2011-05-25 22:30 ` ubizjak at gmail dot com
  6 siblings, 0 replies; 8+ messages in thread
From: hjl at gcc dot gnu.org @ 2011-05-18 22:53 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #5 from hjl at gcc dot gnu.org <hjl at gcc dot gnu.org> 2011-05-18 22:12:30 UTC ---
Author: hjl
Date: Wed May 18 22:12:28 2011
New Revision: 173880

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=173880
Log:
Properly handle 256bit load cast.

gcc/

2011-05-18  H.J. Lu  <hongjiu.lu@intel.com>

    PR target/49002
    * config/i386/sse.md (avx_<ssemodesuffix><avxsizesuffix>_<ssemodesuffix>):
    Properly handle load cast.

gcc/testsuite/

2011-05-18  H.J. Lu  <hongjiu.lu@intel.com>

    PR target/49002
    * gcc.target/i386/pr49002-1.c: New test.
    * gcc.target/i386/pr49002-2.c: Likewise.

Added:
    trunk/gcc/testsuite/gcc.target/i386/pr49002-1.c
    trunk/gcc/testsuite/gcc.target/i386/pr49002-2.c
Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/config/i386/sse.md
    trunk/gcc/testsuite/ChangeLog


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

* [Bug target/49002] 128-bit AVX load incorrectly becomes 256-bit AVX load
  2011-05-14 23:57 [Bug tree-optimization/49002] New: 128-bit AVX load incorrectly becomes 256-bit AVX load athena at fftw dot org
                   ` (4 preceding siblings ...)
  2011-05-18 22:53 ` hjl at gcc dot gnu.org
@ 2011-05-18 23:24 ` hjl at gcc dot gnu.org
  2011-05-25 22:30 ` ubizjak at gmail dot com
  6 siblings, 0 replies; 8+ messages in thread
From: hjl at gcc dot gnu.org @ 2011-05-18 23:24 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #6 from hjl at gcc dot gnu.org <hjl at gcc dot gnu.org> 2011-05-18 22:56:37 UTC ---
Author: hjl
Date: Wed May 18 22:56:35 2011
New Revision: 173881

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=173881
Log:
Properly handle 256bit load cast.

gcc/

2011-05-18  H.J. Lu  <hongjiu.lu@intel.com>

    Backport from mainline
    2011-05-18  H.J. Lu  <hongjiu.lu@intel.com>

    PR target/49002
    * config/i386/sse.md
(avx_<avxmodesuffixp><avxmodesuffix>_<avxmodesuffixp>):
    Properly handle load cast.

gcc/testsuite/

2011-05-18  H.J. Lu  <hongjiu.lu@intel.com>

    Backport from mainline
    2011-05-18  H.J. Lu  <hongjiu.lu@intel.com>

    PR target/49002
    * gcc.target/i386/pr49002-1.c: New test.
    * gcc.target/i386/pr49002-2.c: Likewise.

Added:
    branches/gcc-4_6-branch/gcc/testsuite/gcc.target/i386/pr49002-1.c
    branches/gcc-4_6-branch/gcc/testsuite/gcc.target/i386/pr49002-2.c
Modified:
    branches/gcc-4_6-branch/gcc/ChangeLog
    branches/gcc-4_6-branch/gcc/config/i386/sse.md
    branches/gcc-4_6-branch/gcc/testsuite/ChangeLog


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

* [Bug target/49002] 128-bit AVX load incorrectly becomes 256-bit AVX load
  2011-05-14 23:57 [Bug tree-optimization/49002] New: 128-bit AVX load incorrectly becomes 256-bit AVX load athena at fftw dot org
                   ` (5 preceding siblings ...)
  2011-05-18 23:24 ` hjl at gcc dot gnu.org
@ 2011-05-25 22:30 ` ubizjak at gmail dot com
  6 siblings, 0 replies; 8+ messages in thread
From: ubizjak at gmail dot com @ 2011-05-25 22:30 UTC (permalink / raw)
  To: gcc-bugs

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

Uros Bizjak <ubizjak at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |FIXED

--- Comment #7 from Uros Bizjak <ubizjak at gmail dot com> 2011-05-25 22:11:30 UTC ---
Fixed.


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

end of thread, other threads:[~2011-05-25 22:12 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-05-14 23:57 [Bug tree-optimization/49002] New: 128-bit AVX load incorrectly becomes 256-bit AVX load athena at fftw dot org
2011-05-15 18:59 ` [Bug target/49002] " ubizjak at gmail dot com
2011-05-18  8:43 ` kirill.yukhin at intel dot com
2011-05-18  9:43 ` ubizjak at gmail dot com
2011-05-18 21:40 ` hjl.tools at gmail dot com
2011-05-18 22:53 ` hjl at gcc dot gnu.org
2011-05-18 23:24 ` hjl at gcc dot gnu.org
2011-05-25 22:30 ` ubizjak at gmail 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).