https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111302
Bug ID: 111302
Summary: aligned std::experimental::simd loads and stores are
not constant expressions
Product: gcc
Version: 14.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: libstdc++
Assignee: mkretz at gcc dot gnu.org
Reporter: mkretz at gcc dot gnu.org
Target Milestone: ---
Test case (https://godbolt.org/z/d16rvjjsK):
#include <experimental/simd>
namespace stdx = std::experimental;
using V = stdx::native_simd<float>;
alignas(64) constexpr float mem[32] = {};
constexpr V zero1 = V(mem, stdx::element_aligned);
constexpr V zero2 = V(mem, stdx::vector_aligned);
constexpr V zero3 = V(mem, stdx::overaligned<64>);
constexpr float tmp1 = [](){
float buf[V::size()] = {};
V().copy_to(buf, stdx::element_aligned);
return buf[0];
}();
constexpr float tmp2 = [](){
alignas(stdx::memory_alignment_v<V>) float buf[V::size()] = {};
V().copy_to(buf, stdx::vector_aligned);
return buf[0];
}();
constexpr float tmp3 = [](){
alignas(64) float buf[V::size()] = {};
V().copy_to(buf, stdx::overaligned<64>);
return buf[0];
}();
The element_aligned variants compile. The others don't, but they should.