This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/59071] New: sse2 intrinsics and constant expressions
- From: "vermaelen.wouter at gmail dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Sun, 10 Nov 2013 20:05:33 +0000
- Subject: [Bug c++/59071] New: sse2 intrinsics and constant expressions
- Auto-submitted: auto-generated
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59071
Bug ID: 59071
Summary: sse2 intrinsics and constant expressions
Product: gcc
Version: 4.8.2
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: vermaelen.wouter at gmail dot com
gcc-4.8.2 with -O0 rejects the following code. With -O1 it works fine. Gcc-4.6,
4.7 and clang also work fine. I *believe* the stuff below is a constant
expression, so it should compile (even without optimizations enabled).
-------
#include "emmintrin.h"
template<int N> __m128i foo(__m128i x) {
return _mm_slli_si128(x, sizeof(__m128i) - N);
}
void bar(__m128i x) { foo<4>(x); }
--------
> g++ test.cc
In file included from test.cc:1:0:
test.cc: In function â__m128i foo(__m128i) [with int N = 4; __m128i =
__vector(2) long long int]â:
test.cc:4:9: error: the last argument must be an 8-bit immediate
return _mm_slli_si128(x, sizeof(__m128i) - N);