Quantcast
Channel: Intel® Software - Intel® C++ Compiler
Viewing all articles
Browse latest Browse all 1175

SIMD and constexpr

$
0
0

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]; }

https://godbolt.org/g/a333Mn

Does anyone know how to make this work on ICC without resorting to intrinsics?
 


Viewing all articles
Browse latest Browse all 1175

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>