0
0
Fork 0
mirror of https://github.com/matrix-construct/construct synced 2024-11-29 10:12:39 +01:00

ircd::simd: Add constexprs for some lane traits.

This commit is contained in:
Jason Volk 2021-03-02 11:04:28 -08:00
parent cd2c6630bc
commit 29b47e8890

View file

@ -16,6 +16,20 @@ namespace ircd::simd
template<class T>
static constexpr size_t lanes();
template<class U,
class T>
static constexpr bool is_lane_same();
template<class U,
class T>
static constexpr bool is_lane_base_of();
template<class T>
static constexpr bool is_lane_integral();
template<class T>
static constexpr bool is_lane_floating();
// lane number convenience constants
extern const u8x64 u8x64_lane_id;
extern const u8x32 u8x32_lane_id;
@ -42,6 +56,36 @@ namespace ircd::simd
};
}
template<class T>
constexpr bool
ircd::simd::is_lane_floating()
{
return std::is_floating_point<lane_type<T>>::value;
}
template<class T>
constexpr bool
ircd::simd::is_lane_integral()
{
return std::is_integral<lane_type<T>>::value;
}
template<class U,
class T>
constexpr bool
ircd::simd::is_lane_same()
{
return std::is_same<U, lane_type<T>>::value;
}
template<class U,
class T>
constexpr bool
ircd::simd::is_lane_base_of()
{
return std::is_base_of<U, lane_type<T>>::value;
}
/// Get number of lanes for vector type (the number after the x in the
/// type name).
template<class T>