This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c/58889] New: GCC 4.9 fails to compile certain functions with intrinsics with __attribute__((target))


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++

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]