[Bug c++/80439] __attribute__((target("xxx"))) not applied to lambdas

2017-10-05 Thread rguenth at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80439

--- Comment #4 from Richard Biener  ---
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 
#include 

__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);
}

[Bug c++/80439] __attribute__((target("xxx"))) not applied to lambdas

2017-10-05 Thread paolo.carlini at oracle dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80439

Paolo Carlini  changed:

   What|Removed |Added

 Status|UNCONFIRMED |NEW
   Last reconfirmed||2017-10-05
 Ever confirmed|0   |1

--- Comment #3 from Paolo Carlini  ---
Ah, ok, now I get it, the issue is that it should be accepted without, say,
-m32 -msse4.1, on the command line.

[Bug c++/80439] __attribute__((target("xxx"))) not applied to lambdas

2017-10-05 Thread paolo.carlini at oracle dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80439

Paolo Carlini  changed:

   What|Removed |Added

 CC||rguenth at gcc dot gnu.org

--- Comment #2 from Paolo Carlini  ---
Richard, can you actually reproduce this? I can't with the released 7.1.0
(given the error message I doubt submitter was actually using a 7 pre). Neither
I can reproduce it with 6.3.0, anyway. I'm passing, as requested, -m32 -msse4.1
(or -m32 -msse4.2)

[Bug c++/80439] __attribute__((target("xxx"))) not applied to lambdas

2017-04-20 Thread rguenth at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80439

--- Comment #1 from Richard Biener  ---
Hmm, I think it would make sense if lambdas (and nested functions) "inherit"
both target and optimize attributes from their parents.