[Bug c++/80439] New: __attribute__((target("xxx"))) not applied to lambdas
thiago at kde dot org
gcc-bugzilla@gcc.gnu.org
Sat Apr 15 21:26:00 GMT 2017
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80439
Bug ID: 80439
Summary: __attribute__((target("xxx"))) not applied to lambdas
Product: gcc
Version: 7.0.1
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: thiago at kde dot org
Target Milestone: ---
Testcase (see also https://godbolt.org/g/H2xjNc for GCC and Clang build):
========
#include <immintrin.h>
#include <stdint.h>
__attribute__((target("sse4.2")))
unsigned aeshash(const uint8_t *p, size_t len, unsigned seed)
{
const auto l = [](unsigned data) {
__m128i m = _mm_insert_epi32(_mm_setzero_si128(), data, 1);
return _mm_extract_epi32(m, 1);
};
return l(seed);
}========
In the testcase above, if the source is compiled with base options for x86
(either 32- or 64-bit mode), GCC fails to compile with error:
/usr/lib/gcc/x86_64-linux-gnu/6.3.0/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)
^~~~~~~~~~~~~~~~~
<source>:9:38: note: called from here
return _mm_extract_epi32(m, 1);
^
Clang compiles the above just fine.
The compilation works if I add __attribute__((target("sse4.2"))) to the lambda.
More information about the Gcc-bugs
mailing list