[Bug c++/83875] [feature request] target_clones compatible SIMD capability/length check

kretz at kde dot org gcc-bugzilla@gcc.gnu.org
Wed Jan 17 11:45:00 GMT 2018


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

Matthias Kretz <kretz at kde dot org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |kretz at kde dot org

--- Comment #6 from Matthias Kretz <kretz at kde dot org> ---
Here's an example I'd like to see supported. Note the missing target_clones
attribute on "min":

inline __m128i min(__m128i a, __m128i b) {
    if constexpr (__builtin_target_supports("sse4.1")) {
        return _mm_min_epi32(a, b);
    } else {
        const auto mask = _mm_cmpgt_epi32(a, b);
        return _mm_or_si128(_mm_andnot_si128(mask, a), _mm_and_si128(mask, b));
    }
}

[[gnu::target_clones("default,sse4.1")]]
__m128i f(__m128i a, __m128i b) {
    return min(a, b);
}


More information about the Gcc-bugs mailing list