This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/80439] __attribute__((target("xxx"))) not applied to lambdas
- From: "rguenth at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Thu, 05 Oct 2017 09:45:38 +0000
- Subject: [Bug c++/80439] __attribute__((target("xxx"))) not applied to lambdas
- Auto-submitted: auto-generated
- References: <bug-80439-4@http.gcc.gnu.org/bugzilla/>
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80439
--- Comment #4 from Richard Biener <rguenth at gcc dot gnu.org> ---
Confirmed.
> g++-7 t.C -S
In file included from
/usr/lib64/gcc/x86_64-suse-linux/7/include/immintrin.h:37:0,
from t.C:1:
t.C: In lambda function:
t.C:9:19: error: ‘__builtin_ia32_vec_set_v4si’ needs isa option -m32 -msse4.1
__m128i m = _mm_insert_epi32(_mm_setzero_si128(), data, 1);
^
> g++-7 t.C -S -O
In file included from
/usr/lib64/gcc/x86_64-suse-linux/7/include/immintrin.h:37:0,
from t.C:1:
/usr/lib64/gcc/x86_64-suse-linux/7/include/smmintrin.h: In lambda function:
/usr/lib64/gcc/x86_64-suse-linux/7/include/smmintrin.h:447:1: error: inlining
failed in call to always_inline ‘int _mm_extract_epi32(__m128i, int)’: target
specific option mismatch
_mm_extract_epi32 (__m128i __X, const int __N)
^~~~~~~~~~~~~~~~~
t.C:10:36: note: called from here
return _mm_extract_epi32(m, 1);
^
In file included from
/usr/lib64/gcc/x86_64-suse-linux/7/include/immintrin.h:37:0,
from t.C:1:
/usr/lib64/gcc/x86_64-suse-linux/7/include/smmintrin.h:406:1: error: inlining
failed in call to always_inline ‘__m128i _mm_insert_epi32(__m128i, int, int)’:
target specific option mismatch
...
This is with 7.2.1 (rev. 253227) but 7.1.0 and 7.2.0 are affected the same,
so is 6.4.0. GCC 5 rejects the testcase on unknown C++ grounds.
The key is to _not_ pass -msse4.2 -- it shouldn't be necessary given the
target attribute and as the following testcase dropping the lambda shows:
#include <immintrin.h>
#include <stdint.h>
__attribute__((target("sse4.2")))
unsigned aeshash(const uint8_t *p, size_t len, unsigned seed)
{
__m128i m = _mm_insert_epi32(_mm_setzero_si128(), seed, 1);
return _mm_extract_epi32(m, 1);
}