4#include "native/isa_import.h"
5#include "native/x86/vaes.h"
13#if NATIVE_HOST_X86 || defined(NATIVE_DOXYGEN)
26 template<isa<x86> Arch>
requires(Arch.has(x86_feature::aes) && Arch.has(x86_feature::avx))
29 simd<
std::uint8_t, 16, Arch> state,
simd<
std::uint8_t, 16, Arch> key) noexcept {
31 return detail::x86_vaes_constant::round<false, false>(state, key);
34 detail::x86_vaes::vaesenc<Arch>(state.to_native(), key.to_native()));
39 template<isa<x86> Arch>
requires(!(Arch.has(x86_feature::aes) && Arch.has(x86_feature::avx)) &&
40 requires { sizeof(simd<std::uint8_t, 16, Arch>); })
43 return detail::x86_vaes_constant::round<false, false>(state, key);
47 template<isa<x86> Arch>
requires(Arch.has(x86_feature::vaes) && Arch.has(x86_feature::avx))
52 return detail::x86_vaes_constant::round<false, false>(state, key);
55 detail::x86_vaes::vaesenc<Arch>(state.to_native(), key.to_native()));
60 template<isa<x86> Arch>
requires(!(Arch.has(x86_feature::vaes) && Arch.has(x86_feature::avx)) &&
61 requires { sizeof(simd<std::uint8_t, 32, Arch>); })
64 return detail::x86_vaes_constant::round<false, false>(state, key);
68 template<isa<x86> Arch>
requires(Arch.has(x86_feature::vaes) && Arch.has(x86_feature::avx512f))
73 return detail::x86_vaes_constant::round<false, false>(state, key);
76 detail::x86_vaes::vaesenc<Arch>(state.to_native(), key.to_native()));
81 template<isa<x86> Arch>
requires(!(Arch.has(x86_feature::vaes) && Arch.has(x86_feature::avx512f)) &&
82 requires { sizeof(simd<std::uint8_t, 64, Arch>); })
85 return detail::x86_vaes_constant::round<false, false>(state, key);
89 template<isa<x86> Arch,
class... Args>
93 template<isa<x86> Arch>
requires(Arch.has(x86_feature::aes) && Arch.has(x86_feature::avx))
96 simd<
std::uint8_t, 16, Arch> state,
simd<
std::uint8_t, 16, Arch> key) noexcept {
98 return detail::x86_vaes_constant::round<false, true>(state, key);
101 detail::x86_vaes::vaesenclast<Arch>(state.to_native(), key.to_native()));
106 template<isa<x86> Arch>
requires(!(Arch.has(x86_feature::aes) && Arch.has(x86_feature::avx)) &&
107 requires { sizeof(simd<std::uint8_t, 16, Arch>); })
110 return detail::x86_vaes_constant::round<false, true>(state, key);
114 template<isa<x86> Arch>
requires(Arch.has(x86_feature::vaes) && Arch.has(x86_feature::avx))
119 return detail::x86_vaes_constant::round<false, true>(state, key);
122 detail::x86_vaes::vaesenclast<Arch>(state.to_native(), key.to_native()));
127 template<isa<x86> Arch>
requires(!(Arch.has(x86_feature::vaes) && Arch.has(x86_feature::avx)) &&
128 requires { sizeof(simd<std::uint8_t, 32, Arch>); })
131 return detail::x86_vaes_constant::round<false, true>(state, key);
135 template<isa<x86> Arch>
requires(Arch.has(x86_feature::vaes) && Arch.has(x86_feature::avx512f))
140 return detail::x86_vaes_constant::round<false, true>(state, key);
143 detail::x86_vaes::vaesenclast<Arch>(state.to_native(), key.to_native()));
148 template<isa<x86> Arch>
requires(!(Arch.has(x86_feature::vaes) && Arch.has(x86_feature::avx512f)) &&
149 requires { sizeof(simd<std::uint8_t, 64, Arch>); })
152 return detail::x86_vaes_constant::round<false, true>(state, key);
156 template<isa<x86> Arch,
class... Args>
160 template<isa<x86> Arch>
requires(Arch.has(x86_feature::aes) && Arch.has(x86_feature::avx))
163 simd<
std::uint8_t, 16, Arch> state,
simd<
std::uint8_t, 16, Arch> key) noexcept {
165 return detail::x86_vaes_constant::round<true, false>(state, key);
168 detail::x86_vaes::vaesdec<Arch>(state.to_native(), key.to_native()));
173 template<isa<x86> Arch>
requires(!(Arch.has(x86_feature::aes) && Arch.has(x86_feature::avx)) &&
174 requires { sizeof(simd<std::uint8_t, 16, Arch>); })
177 return detail::x86_vaes_constant::round<true, false>(state, key);
181 template<isa<x86> Arch>
requires(Arch.has(x86_feature::vaes) && Arch.has(x86_feature::avx))
186 return detail::x86_vaes_constant::round<true, false>(state, key);
189 detail::x86_vaes::vaesdec<Arch>(state.to_native(), key.to_native()));
194 template<isa<x86> Arch>
requires(!(Arch.has(x86_feature::vaes) && Arch.has(x86_feature::avx)) &&
195 requires { sizeof(simd<std::uint8_t, 32, Arch>); })
198 return detail::x86_vaes_constant::round<true, false>(state, key);
202 template<isa<x86> Arch>
requires(Arch.has(x86_feature::vaes) && Arch.has(x86_feature::avx512f))
207 return detail::x86_vaes_constant::round<true, false>(state, key);
210 detail::x86_vaes::vaesdec<Arch>(state.to_native(), key.to_native()));
215 template<isa<x86> Arch>
requires(!(Arch.has(x86_feature::vaes) && Arch.has(x86_feature::avx512f)) &&
216 requires { sizeof(simd<std::uint8_t, 64, Arch>); })
219 return detail::x86_vaes_constant::round<true, false>(state, key);
223 template<isa<x86> Arch,
class... Args>
227 template<isa<x86> Arch>
requires(Arch.has(x86_feature::aes) && Arch.has(x86_feature::avx))
230 simd<
std::uint8_t, 16, Arch> state,
simd<
std::uint8_t, 16, Arch> key) noexcept {
232 return detail::x86_vaes_constant::round<true, true>(state, key);
235 detail::x86_vaes::vaesdeclast<Arch>(state.to_native(), key.to_native()));
240 template<isa<x86> Arch>
requires(!(Arch.has(x86_feature::aes) && Arch.has(x86_feature::avx)) &&
241 requires { sizeof(simd<std::uint8_t, 16, Arch>); })
244 return detail::x86_vaes_constant::round<true, true>(state, key);
248 template<isa<x86> Arch>
requires(Arch.has(x86_feature::vaes) && Arch.has(x86_feature::avx))
253 return detail::x86_vaes_constant::round<true, true>(state, key);
256 detail::x86_vaes::vaesdeclast<Arch>(state.to_native(), key.to_native()));
261 template<isa<x86> Arch>
requires(!(Arch.has(x86_feature::vaes) && Arch.has(x86_feature::avx)) &&
262 requires { sizeof(simd<std::uint8_t, 32, Arch>); })
265 return detail::x86_vaes_constant::round<true, true>(state, key);
269 template<isa<x86> Arch>
requires(Arch.has(x86_feature::vaes) && Arch.has(x86_feature::avx512f))
274 return detail::x86_vaes_constant::round<true, true>(state, key);
277 detail::x86_vaes::vaesdeclast<Arch>(state.to_native(), key.to_native()));
282 template<isa<x86> Arch>
requires(!(Arch.has(x86_feature::vaes) && Arch.has(x86_feature::avx512f)) &&
283 requires { sizeof(simd<std::uint8_t, 64, Arch>); })
286 return detail::x86_vaes_constant::round<true, true>(state, key);
290 template<isa<x86> Arch,
class... Args>
#define native_inline
inline [[always_inline]]
#define native_nodiscard
C++17 [[nodiscard]].
#define native_const
[[const]] is not const
#define native_target(x)
this indicates a required feature set for the current multiversioned function.
constexpr simd< std::uint8_t, 16, Arch > vaesenc(simd< std::uint8_t, 16, Arch > state, simd< std::uint8_t, 16, Arch > key) noexcept
One AES encryption round.
constexpr simd< std::uint8_t, 16, Arch > vaesenclast(simd< std::uint8_t, 16, Arch > state, simd< std::uint8_t, 16, Arch > key) noexcept
One final AES encryption round.
constexpr simd< std::uint8_t, 16, Arch > vaesdec(simd< std::uint8_t, 16, Arch > state, simd< std::uint8_t, 16, Arch > key) noexcept
One AES decryption round.
constexpr simd< std::uint8_t, 16, Arch > vaesdeclast(simd< std::uint8_t, 16, Arch > state, simd< std::uint8_t, 16, Arch > key) noexcept
One final AES decryption round.
Architecture-tagged vectors, register packs and supporting value types. Native arithmetic follows its...
Standard-library adaptations documented here for SIMD value types.
Omitted architecture arguments use the native.simd provider's baseline.