17330f729Sjoerg /*===------------------ vaesintrin.h - VAES intrinsics ---------------------=== 27330f729Sjoerg * 37330f729Sjoerg * 47330f729Sjoerg * Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. 57330f729Sjoerg * See https://llvm.org/LICENSE.txt for license information. 67330f729Sjoerg * SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 77330f729Sjoerg * 87330f729Sjoerg *===-----------------------------------------------------------------------=== 97330f729Sjoerg */ 107330f729Sjoerg #ifndef __IMMINTRIN_H 117330f729Sjoerg #error "Never use <vaesintrin.h> directly; include <immintrin.h> instead." 127330f729Sjoerg #endif 137330f729Sjoerg 147330f729Sjoerg #ifndef __VAESINTRIN_H 157330f729Sjoerg #define __VAESINTRIN_H 167330f729Sjoerg 177330f729Sjoerg /* Default attributes for YMM forms. */ 187330f729Sjoerg #define __DEFAULT_FN_ATTRS __attribute__((__always_inline__, __nodebug__, __target__("vaes"), __min_vector_width__(256))) 197330f729Sjoerg 207330f729Sjoerg /* Default attributes for ZMM forms. */ 217330f729Sjoerg #define __DEFAULT_FN_ATTRS_F __attribute__((__always_inline__, __nodebug__, __target__("avx512f,vaes"), __min_vector_width__(512))) 227330f729Sjoerg 237330f729Sjoerg 247330f729Sjoerg static __inline__ __m256i __DEFAULT_FN_ATTRS _mm256_aesenc_epi128(__m256i __A,__m256i __B)257330f729Sjoerg _mm256_aesenc_epi128(__m256i __A, __m256i __B) 267330f729Sjoerg { 277330f729Sjoerg return (__m256i) __builtin_ia32_aesenc256((__v4di) __A, 287330f729Sjoerg (__v4di) __B); 297330f729Sjoerg } 307330f729Sjoerg 317330f729Sjoerg static __inline__ __m256i __DEFAULT_FN_ATTRS _mm256_aesdec_epi128(__m256i __A,__m256i __B)327330f729Sjoerg _mm256_aesdec_epi128(__m256i __A, __m256i __B) 337330f729Sjoerg { 347330f729Sjoerg return (__m256i) __builtin_ia32_aesdec256((__v4di) __A, 357330f729Sjoerg (__v4di) __B); 367330f729Sjoerg } 377330f729Sjoerg 387330f729Sjoerg static __inline__ __m256i __DEFAULT_FN_ATTRS _mm256_aesenclast_epi128(__m256i __A,__m256i __B)397330f729Sjoerg _mm256_aesenclast_epi128(__m256i __A, __m256i __B) 407330f729Sjoerg { 417330f729Sjoerg return (__m256i) __builtin_ia32_aesenclast256((__v4di) __A, 427330f729Sjoerg (__v4di) __B); 437330f729Sjoerg } 447330f729Sjoerg 457330f729Sjoerg static __inline__ __m256i __DEFAULT_FN_ATTRS _mm256_aesdeclast_epi128(__m256i __A,__m256i __B)467330f729Sjoerg _mm256_aesdeclast_epi128(__m256i __A, __m256i __B) 477330f729Sjoerg { 487330f729Sjoerg return (__m256i) __builtin_ia32_aesdeclast256((__v4di) __A, 497330f729Sjoerg (__v4di) __B); 507330f729Sjoerg } 517330f729Sjoerg 52*e038c9c4Sjoerg #ifdef __AVX512FINTRIN_H 53*e038c9c4Sjoerg static __inline__ __m512i __DEFAULT_FN_ATTRS_F _mm512_aesenc_epi128(__m512i __A,__m512i __B)54*e038c9c4Sjoerg _mm512_aesenc_epi128(__m512i __A, __m512i __B) 55*e038c9c4Sjoerg { 56*e038c9c4Sjoerg return (__m512i) __builtin_ia32_aesenc512((__v8di) __A, 57*e038c9c4Sjoerg (__v8di) __B); 58*e038c9c4Sjoerg } 59*e038c9c4Sjoerg 60*e038c9c4Sjoerg static __inline__ __m512i __DEFAULT_FN_ATTRS_F _mm512_aesdec_epi128(__m512i __A,__m512i __B)61*e038c9c4Sjoerg _mm512_aesdec_epi128(__m512i __A, __m512i __B) 62*e038c9c4Sjoerg { 63*e038c9c4Sjoerg return (__m512i) __builtin_ia32_aesdec512((__v8di) __A, 64*e038c9c4Sjoerg (__v8di) __B); 65*e038c9c4Sjoerg } 66*e038c9c4Sjoerg 67*e038c9c4Sjoerg static __inline__ __m512i __DEFAULT_FN_ATTRS_F _mm512_aesenclast_epi128(__m512i __A,__m512i __B)68*e038c9c4Sjoerg _mm512_aesenclast_epi128(__m512i __A, __m512i __B) 69*e038c9c4Sjoerg { 70*e038c9c4Sjoerg return (__m512i) __builtin_ia32_aesenclast512((__v8di) __A, 71*e038c9c4Sjoerg (__v8di) __B); 72*e038c9c4Sjoerg } 73*e038c9c4Sjoerg 747330f729Sjoerg static __inline__ __m512i __DEFAULT_FN_ATTRS_F _mm512_aesdeclast_epi128(__m512i __A,__m512i __B)757330f729Sjoerg _mm512_aesdeclast_epi128(__m512i __A, __m512i __B) 767330f729Sjoerg { 777330f729Sjoerg return (__m512i) __builtin_ia32_aesdeclast512((__v8di) __A, 787330f729Sjoerg (__v8di) __B); 797330f729Sjoerg } 80*e038c9c4Sjoerg #endif // __AVX512FINTRIN_H 817330f729Sjoerg 827330f729Sjoerg #undef __DEFAULT_FN_ATTRS 837330f729Sjoerg #undef __DEFAULT_FN_ATTRS_F 847330f729Sjoerg 857330f729Sjoerg #endif 86