You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The following code uses libstdc++ experimental simd, and wants to detect several all-zero patterns that can be easily done with the vptest instructions. All the code is available at https://godbolt.org/z/Kx68E1T6v .
#include<experimental/simd>
#include<cstdint>namespacestdx= std::experimental;
template <classT, std::size_t N>
using simd_of = stdx::simd<T, stdx::simd_abi::deduce_t<T, N>>;
usingdata_t = simd_of<std::int32_t, 4>;
boolsimple_ptest(data_t x) {
returnall_of(x == 0);
}
boolptest_and(data_t a, data_t b) {
returnall_of((a & b) == 0);
}
boolptest_andn(data_t a, data_t b) {
returnall_of((a & ~b) == 0);
}
The following code uses libstdc++ experimental simd, and wants to detect several all-zero patterns that can be easily done with the vptest instructions. All the code is available at https://godbolt.org/z/Kx68E1T6v .
#include <experimental/simd>
#include <cstdint>
namespacestdx= std::experimental;
template <classT, std::size_t N>
using simd_of = stdx::simd<T, stdx::simd_abi::deduce_t<T, N>>;
usingdata_t = simd_of<std::int32_t, 4>;
boolsimple_ptest(data_t x) {
returnall_of(x == 0);
}
boolptest_and(data_t a, data_t b) {
returnall_of((a & b) == 0);
}
boolptest_andn(data_t a, data_t b) {
returnall_of((a & ~b) == 0);
}
The following code uses libstdc++ experimental simd, and wants to detect several all-zero patterns that can be easily done with the vptest instructions. All the code is available at https://godbolt.org/z/Kx68E1T6v .
Equivalent assembly (hand-written):
But clang++ generates the following code at
-O3 -march=x86-64-v3
.reference: the same issue at gcc bugzilla (identified as a duplicate to another missed optimization).
The text was updated successfully, but these errors were encountered: