public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/58889] New: GCC 4.9 fails to compile certain functions with intrinsics with __attribute__((target))
@ 2013-10-26 18:30 thiago at kde dot org
  2013-10-29 11:13 ` [Bug target/58889] " rguenth at gcc dot gnu.org
  2021-09-17  4:38 ` crazylht at gmail dot com
  0 siblings, 2 replies; 3+ messages in thread
From: thiago at kde dot org @ 2013-10-26 18:30 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 58889
           Summary: GCC 4.9 fails to compile certain functions with
                    intrinsics with __attribute__((target))
           Product: gcc
           Version: 4.9.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
          Assignee: unassigned at gcc dot gnu.org
          Reporter: thiago at kde dot org

Source:

$ cat t.c
#include <immintrin.h>
__attribute__((target("avx2"))) int f(void *ptr)
{ 
  return _mm256_movemask_epi8(_mm256_loadu_si256((__m256i*)ptr)); 
}

Works:

$ ~/gcc4.9/bin/g++ -S -O3 -o /dev/null t.c
$ ~/gcc4.9/bin/g++ -m32 -S -O3 -o /dev/null t.c
$ ~/gcc4.9/bin/g++ -march=core2 -S -O3 -o /dev/null t.c
$ ~/gcc4.9/bin/g++ -march=core2 -m32 -S -O3 -o /dev/null t.c
$ ~/gcc4.9/bin/g++ -march=nocona -S -O3 -o /dev/null t.c
$ ~/gcc4.9/bin/g++ -march=nocona -m32 -S -O3 -o /dev/null t.c
$ ~/gcc4.9/bin/g++ -march=prescott -m32 -S -O3 -o /dev/null t.c
$ ~/gcc4.9/bin/g++ -march=pentium4 -m32 -S -O3 -o /dev/null t.c
$ ~/gcc4.9/bin/g++ -march=pentium3 -m32 -S -O3 -o /dev/null t.c

Fails:
$ ~/gcc4.9/bin/g++ -march=pentium2 -m32 -S -O3 -o /dev/null t.c
avxintrin.h: In function ‘int f(void*)’:
avxintrin.h:890:1: error: inlining failed in call to always_inline ‘__m256i
_mm256_loadu_si256(const __m256i*)’: target specific option mismatch
 _mm256_loadu_si256 (__m256i const *__P)
 ^
[...]
g++: internal compiler error: Segmentation fault (program cc1plus)
0x409614 execute
        /home/thiago/src/gcc/gcc/gcc.c:2864


$ ~/gcc4.9/bin/g++ -march=pentium -m32 -S -O3 -o /dev/null t.c
avxintrin.h: In function ‘int f(void*)’:
avxintrin.h:890:1: error: inlining failed in call to always_inline ‘__m256i
_mm256_loadu_si256(const __m256i*)’: target specific option mismatch
 _mm256_loadu_si256 (__m256i const *__P)
 ^
[...]
[no segfault]

This is an unpatched, pristine GCC, built from trunk@203862.
System: Linux 64-bit (Fedora 17)
Configure options: --enable-lang=c,c++
>From gcc-bugs-return-432804-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org Sat Oct 26 18:31:41 2013
Return-Path: <gcc-bugs-return-432804-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org>
Delivered-To: listarch-gcc-bugs@gcc.gnu.org
Received: (qmail 27912 invoked by alias); 26 Oct 2013 18:31:40 -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 27882 invoked by uid 48); 26 Oct 2013 18:31:38 -0000
From: "thiago at kde dot org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c/58889] GCC 4.9 fails to compile certain functions with intrinsics with __attribute__((target))
Date: Sat, 26 Oct 2013 18:31: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: 4.9.0
X-Bugzilla-Keywords:
X-Bugzilla-Severity: normal
X-Bugzilla-Who: thiago at kde dot org
X-Bugzilla-Status: UNCONFIRMED
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-58889-4-LqjUTZcnzQ@http.gcc.gnu.org/bugzilla/>
In-Reply-To: <bug-58889-4@http.gcc.gnu.org/bugzilla/>
References: <bug-58889-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: 2013-10/txt/msg01948.txt.bz2
Content-length: 332

http://gcc.gnu.org/bugzilla/show_bug.cgi?idX889

--- Comment #1 from Thiago Macieira <thiago at kde dot org> ---
This problem also happens with other combinations of functions in use and
compiler options.

My original problem happened on a 64-bit build with -march=corei7-avx and a
function with __attribute__((target("avx2"))).


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

* [Bug target/58889] GCC 4.9 fails to compile certain functions with intrinsics with __attribute__((target))
  2013-10-26 18:30 [Bug c/58889] New: GCC 4.9 fails to compile certain functions with intrinsics with __attribute__((target)) thiago at kde dot org
@ 2013-10-29 11:13 ` rguenth at gcc dot gnu.org
  2021-09-17  4:38 ` crazylht at gmail dot com
  1 sibling, 0 replies; 3+ messages in thread
From: rguenth at gcc dot gnu.org @ 2013-10-29 11:13 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Target|                            |i?86-*-*
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2013-10-29
                 CC|                            |hubicka at gcc dot gnu.org
     Ever confirmed|0                           |1

--- Comment #2 from Richard Biener <rguenth at gcc dot gnu.org> ---
Confirmed with -O -m32.  AVX2 is new in 4.9, can you build a testcase
with AVX to see whether 4.8 works?

I suspect we hit

      else if (caller_opts->x_ix86_fpmath != callee_opts->x_ix86_fpmath)
        ret = false;

after Honzas patch?


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

* [Bug target/58889] GCC 4.9 fails to compile certain functions with intrinsics with __attribute__((target))
  2013-10-26 18:30 [Bug c/58889] New: GCC 4.9 fails to compile certain functions with intrinsics with __attribute__((target)) thiago at kde dot org
  2013-10-29 11:13 ` [Bug target/58889] " rguenth at gcc dot gnu.org
@ 2021-09-17  4:38 ` crazylht at gmail dot com
  1 sibling, 0 replies; 3+ messages in thread
From: crazylht at gmail dot com @ 2021-09-17  4:38 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 from Hongtao.liu <crazylht at gmail dot com> ---
It seems to be fixed in GCC.4.9.0
https://godbolt.org/z/MbqPzeTEP

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

end of thread, other threads:[~2021-09-17  4:38 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-10-26 18:30 [Bug c/58889] New: GCC 4.9 fails to compile certain functions with intrinsics with __attribute__((target)) thiago at kde dot org
2013-10-29 11:13 ` [Bug target/58889] " rguenth at gcc dot gnu.org
2021-09-17  4:38 ` crazylht 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).