[cfe-dev] Allow constexpr in vector extensions
Tom Westerhout via cfe-dev
cfe-dev at lists.llvm.org
Tue Aug 29 05:45:43 PDT 2017
Greetings!
This is my first post on this ML so, please, do tell me if I'm doing it
wrong.
I've noticed the following difference between GCC and Clang. Consider
this piece of code
```
typedef int v4si __attribute__ ((vector_size (16)));
int main()
{
constexpr v4si a = {1,2,3,4};
constexpr v4si b = {2,0,0,0};
v4si c = a + b;
}
```
It compiles cleanly with both GCC and Clang. However, if I try to make c
constexpr, Clang tells me that operator+ on vectors is not constexpr. I'm
wondering if there's a reason for that. There are no constrains from the
Standard as these are intrinsics, so I see no reason why we couldn't
allow constexpr code benefit from SIMD.
Tom
More information about the cfe-dev
mailing list