- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi, I am writing some SIMD code where I would like to initialize a constant at compile-time with constexpr.
Both GCC and Clang are happy with code like shown below, but ICC unfortunately errors out.
using float_v = float __attribute__((vector_size(16)));
constexpr float_v broadcast(float x) { return float_v{x, x, x, x}; }
float test() { float_v v = broadcast(0); return v[0]; }
Does anyone know how to make this work on ICC without resorting to intrinsics?
- Tags:
- CC++
- Development Tools
- Intel® C++ Compiler
- Intel® Parallel Studio XE
- Intel® System Studio
- Optimization
- Parallel Computing
- Vectorization
Link Copied
2 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
This is a known issue in our Front End. There is an internal bug tracker for it (CMPLRS-7400). We'll keep you updated when the fix is avail.
Thanks,
Viet
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thank you. For now I am using C++14 and initializing the vector with a for loop like this:
#ifdef __INTEL_COMPILER static constexpr float_v make_array(const float& val) { float_v a; for (size_t i = 0; i < N; ++i) a = val; return a; } #else // ... #endif

Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page