Skip to content

Commit

Permalink
Workaround for GCC bug for __builtin_is_constant_evaluated when evalu…
Browse files Browse the repository at this point in the history
…ating attribute argument
  • Loading branch information
MitalAshok committed Sep 8, 2024
1 parent 4db132c commit cbe2a7c
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion libcxx/include/experimental/__simd/vec_ext.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,10 @@ inline constexpr bool is_abi_tag_v<simd_abi::__vec_ext<_Np>> = _Np > 0 && _Np <=

template <class _Tp, int _Np>
struct __simd_storage<_Tp, simd_abi::__vec_ext<_Np>> {
_Tp __data __attribute__((__vector_size__(std::__bit_ceil((sizeof(_Tp) * _Np)))));
// Workaround for GCC bug: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105233
static constexpr size_t __vector_size = std::__bit_ceil((sizeof(_Tp) * _Np));

_Tp __data __attribute__((__vector_size__(__vector_size)));

_LIBCPP_HIDE_FROM_ABI _Tp __get(size_t __idx) const noexcept {
_LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(__idx < _Np, "Index is out of bounds");
Expand Down

0 comments on commit cbe2a7c

Please sign in to comment.