https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105353

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|__builtin_shufflevector     |__builtin_shufflevector
                   |with template parameter     |with value dependent
                   |fails to compile on GCC 12  |constant
                   |but compiles on clang       |
     Ever confirmed|0                           |1
   Last reconfirmed|                            |2022-04-22
             Status|UNCONFIRMED                 |NEW

--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Confirmed, it is all value dependent constants really. e.g. even sizeof fails:



#include <cstdint>

typedef std::uint8_t Simd128U8VectT __attribute__((__vector_size__(16)));

#define ShuffleIndex sizeof(T)

template<class T>
static inline Simd128U8VectT ShufFunc(Simd128U8VectT vect) noexcept {
    if constexpr(unsigned(ShuffleIndex) >= 16)
        return Simd128U8VectT { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
};
    else if constexpr(ShuffleIndex == 0)
        return vect;
    else
        return __builtin_shufflevector(vect, vect, ShuffleIndex, ShuffleIndex +
1,
            ShuffleIndex + 2, ShuffleIndex + 3, ShuffleIndex + 4, ShuffleIndex
+ 5,
            ShuffleIndex + 6, ShuffleIndex + 7, ShuffleIndex + 8, ShuffleIndex
+ 9,
            ShuffleIndex + 10, ShuffleIndex + 11, ShuffleIndex + 12,
ShuffleIndex + 13,
            ShuffleIndex + 14, ShuffleIndex + 15);
}

Reply via email to