10b57cec5SDimitry Andric /*===------------------ vaesintrin.h - VAES intrinsics ---------------------=== 20b57cec5SDimitry Andric * 30b57cec5SDimitry Andric * 40b57cec5SDimitry Andric * Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. 50b57cec5SDimitry Andric * See https://llvm.org/LICENSE.txt for license information. 60b57cec5SDimitry Andric * SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 70b57cec5SDimitry Andric * 80b57cec5SDimitry Andric *===-----------------------------------------------------------------------=== 90b57cec5SDimitry Andric */ 100b57cec5SDimitry Andric #ifndef __IMMINTRIN_H 110b57cec5SDimitry Andric #error "Never use <vaesintrin.h> directly; include <immintrin.h> instead." 120b57cec5SDimitry Andric #endif 130b57cec5SDimitry Andric 140b57cec5SDimitry Andric #ifndef __VAESINTRIN_H 150b57cec5SDimitry Andric #define __VAESINTRIN_H 160b57cec5SDimitry Andric 170b57cec5SDimitry Andric /* Default attributes for YMM forms. */ 180b57cec5SDimitry Andric #define __DEFAULT_FN_ATTRS __attribute__((__always_inline__, __nodebug__, __target__("vaes"), __min_vector_width__(256))) 190b57cec5SDimitry Andric 200b57cec5SDimitry Andric /* Default attributes for ZMM forms. */ 21*5f757f3fSDimitry Andric #define __DEFAULT_FN_ATTRS_F \ 22*5f757f3fSDimitry Andric __attribute__((__always_inline__, __nodebug__, \ 23*5f757f3fSDimitry Andric __target__("avx512f,evex512,vaes"), \ 24*5f757f3fSDimitry Andric __min_vector_width__(512))) 250b57cec5SDimitry Andric 260b57cec5SDimitry Andric static __inline__ __m256i __DEFAULT_FN_ATTRS 270b57cec5SDimitry Andric _mm256_aesenc_epi128(__m256i __A, __m256i __B) 280b57cec5SDimitry Andric { 290b57cec5SDimitry Andric return (__m256i) __builtin_ia32_aesenc256((__v4di) __A, 300b57cec5SDimitry Andric (__v4di) __B); 310b57cec5SDimitry Andric } 320b57cec5SDimitry Andric 330b57cec5SDimitry Andric static __inline__ __m256i __DEFAULT_FN_ATTRS 340b57cec5SDimitry Andric _mm256_aesdec_epi128(__m256i __A, __m256i __B) 350b57cec5SDimitry Andric { 360b57cec5SDimitry Andric return (__m256i) __builtin_ia32_aesdec256((__v4di) __A, 370b57cec5SDimitry Andric (__v4di) __B); 380b57cec5SDimitry Andric } 390b57cec5SDimitry Andric 400b57cec5SDimitry Andric static __inline__ __m256i __DEFAULT_FN_ATTRS 410b57cec5SDimitry Andric _mm256_aesenclast_epi128(__m256i __A, __m256i __B) 420b57cec5SDimitry Andric { 430b57cec5SDimitry Andric return (__m256i) __builtin_ia32_aesenclast256((__v4di) __A, 440b57cec5SDimitry Andric (__v4di) __B); 450b57cec5SDimitry Andric } 460b57cec5SDimitry Andric 470b57cec5SDimitry Andric static __inline__ __m256i __DEFAULT_FN_ATTRS 480b57cec5SDimitry Andric _mm256_aesdeclast_epi128(__m256i __A, __m256i __B) 490b57cec5SDimitry Andric { 500b57cec5SDimitry Andric return (__m256i) __builtin_ia32_aesdeclast256((__v4di) __A, 510b57cec5SDimitry Andric (__v4di) __B); 520b57cec5SDimitry Andric } 530b57cec5SDimitry Andric 54fe6060f1SDimitry Andric #ifdef __AVX512FINTRIN_H 55fe6060f1SDimitry Andric static __inline__ __m512i __DEFAULT_FN_ATTRS_F 56fe6060f1SDimitry Andric _mm512_aesenc_epi128(__m512i __A, __m512i __B) 57fe6060f1SDimitry Andric { 58fe6060f1SDimitry Andric return (__m512i) __builtin_ia32_aesenc512((__v8di) __A, 59fe6060f1SDimitry Andric (__v8di) __B); 60fe6060f1SDimitry Andric } 61fe6060f1SDimitry Andric 62fe6060f1SDimitry Andric static __inline__ __m512i __DEFAULT_FN_ATTRS_F 63fe6060f1SDimitry Andric _mm512_aesdec_epi128(__m512i __A, __m512i __B) 64fe6060f1SDimitry Andric { 65fe6060f1SDimitry Andric return (__m512i) __builtin_ia32_aesdec512((__v8di) __A, 66fe6060f1SDimitry Andric (__v8di) __B); 67fe6060f1SDimitry Andric } 68fe6060f1SDimitry Andric 69fe6060f1SDimitry Andric static __inline__ __m512i __DEFAULT_FN_ATTRS_F 70fe6060f1SDimitry Andric _mm512_aesenclast_epi128(__m512i __A, __m512i __B) 71fe6060f1SDimitry Andric { 72fe6060f1SDimitry Andric return (__m512i) __builtin_ia32_aesenclast512((__v8di) __A, 73fe6060f1SDimitry Andric (__v8di) __B); 74fe6060f1SDimitry Andric } 75fe6060f1SDimitry Andric 760b57cec5SDimitry Andric static __inline__ __m512i __DEFAULT_FN_ATTRS_F 770b57cec5SDimitry Andric _mm512_aesdeclast_epi128(__m512i __A, __m512i __B) 780b57cec5SDimitry Andric { 790b57cec5SDimitry Andric return (__m512i) __builtin_ia32_aesdeclast512((__v8di) __A, 800b57cec5SDimitry Andric (__v8di) __B); 810b57cec5SDimitry Andric } 82fe6060f1SDimitry Andric #endif // __AVX512FINTRIN_H 830b57cec5SDimitry Andric 840b57cec5SDimitry Andric #undef __DEFAULT_FN_ATTRS 850b57cec5SDimitry Andric #undef __DEFAULT_FN_ATTRS_F 860b57cec5SDimitry Andric 8704eeddc0SDimitry Andric #endif // __VAESINTRIN_H 88