6#include "native/config.h"
14#if NATIVE_HOST_X86 || defined(NATIVE_DOXYGEN)
15namespace native::detail::x86_aes {
17 template<isa<x86> Arch>
requires(Arch.has(x86_feature::aes))
19 __m128i aesenc(__m128i state, __m128i round_key) noexcept {
20 return _mm_aesenc_si128(state, round_key);
23 template<isa<x86> Arch>
requires(Arch.has(x86_feature::aes))
25 __m128i aesenclast(__m128i state, __m128i round_key) noexcept {
26 return _mm_aesenclast_si128(state, round_key);
29 template<isa<x86> Arch>
requires(Arch.has(x86_feature::aes))
31 __m128i aesdec(__m128i state, __m128i round_key) noexcept {
32 return _mm_aesdec_si128(state, round_key);
35 template<isa<x86> Arch>
requires(Arch.has(x86_feature::aes))
37 __m128i aesdeclast(__m128i state, __m128i round_key) noexcept {
38 return _mm_aesdeclast_si128(state, round_key);
41 template<isa<x86> Arch>
requires(Arch.has(x86_feature::aes))
43 __m128i aesimc(__m128i state) noexcept {
44 return _mm_aesimc_si128(state);
47 template<isa<x86> Arch,
unsigned Imm8>
requires(Arch.has(x86_feature::aes) && Imm8 <= 255)
49 __m128i aeskeygenassist(__m128i state) noexcept {
50 return _mm_aeskeygenassist_si128(state, Imm8);
53 template<isa<x86> Arch,
class... Args>
54 void aesenc(Args...) =
delete;
56 template<isa<x86> Arch,
class... Args>
59 template<isa<x86> Arch,
class... Args>
60 void aesdec(Args...) =
delete;
62 template<isa<x86> Arch,
class... Args>
65 template<isa<x86> Arch,
class... Args>
66 void aesimc(Args...) =
delete;
68 template<isa<x86> Arch,
unsigned Imm8,
class... Args>
Compiler attributes for host code, with shader-safe shared modifiers.
constexpr simd< std::uint8_t, 16, Arch > aesimc(simd< std::uint8_t, 16, Arch > state) noexcept
Apply inverse AES MixColumns independently to the four state columns.
#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 > aesdeclast(simd< std::uint8_t, 16, Arch > state, simd< std::uint8_t, 16, Arch > round_key) noexcept
Apply inverse ShiftRows, inverse SubBytes and then AddRoundKey for the final decryption round.
constexpr simd< std::uint8_t, 16, Arch > aesenclast(simd< std::uint8_t, 16, Arch > state, simd< std::uint8_t, 16, Arch > round_key) noexcept
Apply ShiftRows, SubBytes and then AddRoundKey for the final encryption round.
constexpr simd< std::uint8_t, 16, Arch > aesdec(simd< std::uint8_t, 16, Arch > state, simd< std::uint8_t, 16, Arch > round_key) noexcept
Apply inverse ShiftRows, inverse SubBytes, inverse MixColumns and then AddRoundKey.
constexpr simd< std::uint8_t, 16, Arch > aeskeygenassist(simd< std::uint8_t, 16, Arch > state) noexcept
constexpr simd< std::uint8_t, 16, Arch > aesenc(simd< std::uint8_t, 16, Arch > state, simd< std::uint8_t, 16, Arch > round_key) noexcept
Apply ShiftRows, SubBytes, MixColumns and then AddRoundKey.