Details | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
14 | pmbaty | 1 | /*===------------------ vaesintrin.h - VAES intrinsics ---------------------=== |
2 | * |
||
3 | * |
||
4 | * Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. |
||
5 | * See https://llvm.org/LICENSE.txt for license information. |
||
6 | * SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception |
||
7 | * |
||
8 | *===-----------------------------------------------------------------------=== |
||
9 | */ |
||
10 | #ifndef __IMMINTRIN_H |
||
11 | #error "Never use <vaesintrin.h> directly; include <immintrin.h> instead." |
||
12 | #endif |
||
13 | |||
14 | #ifndef __VAESINTRIN_H |
||
15 | #define __VAESINTRIN_H |
||
16 | |||
17 | /* Default attributes for YMM forms. */ |
||
18 | #define __DEFAULT_FN_ATTRS __attribute__((__always_inline__, __nodebug__, __target__("vaes"), __min_vector_width__(256))) |
||
19 | |||
20 | /* Default attributes for ZMM forms. */ |
||
21 | #define __DEFAULT_FN_ATTRS_F __attribute__((__always_inline__, __nodebug__, __target__("avx512f,vaes"), __min_vector_width__(512))) |
||
22 | |||
23 | |||
24 | static __inline__ __m256i __DEFAULT_FN_ATTRS |
||
25 | _mm256_aesenc_epi128(__m256i __A, __m256i __B) |
||
26 | { |
||
27 | return (__m256i) __builtin_ia32_aesenc256((__v4di) __A, |
||
28 | (__v4di) __B); |
||
29 | } |
||
30 | |||
31 | static __inline__ __m256i __DEFAULT_FN_ATTRS |
||
32 | _mm256_aesdec_epi128(__m256i __A, __m256i __B) |
||
33 | { |
||
34 | return (__m256i) __builtin_ia32_aesdec256((__v4di) __A, |
||
35 | (__v4di) __B); |
||
36 | } |
||
37 | |||
38 | static __inline__ __m256i __DEFAULT_FN_ATTRS |
||
39 | _mm256_aesenclast_epi128(__m256i __A, __m256i __B) |
||
40 | { |
||
41 | return (__m256i) __builtin_ia32_aesenclast256((__v4di) __A, |
||
42 | (__v4di) __B); |
||
43 | } |
||
44 | |||
45 | static __inline__ __m256i __DEFAULT_FN_ATTRS |
||
46 | _mm256_aesdeclast_epi128(__m256i __A, __m256i __B) |
||
47 | { |
||
48 | return (__m256i) __builtin_ia32_aesdeclast256((__v4di) __A, |
||
49 | (__v4di) __B); |
||
50 | } |
||
51 | |||
52 | #ifdef __AVX512FINTRIN_H |
||
53 | static __inline__ __m512i __DEFAULT_FN_ATTRS_F |
||
54 | _mm512_aesenc_epi128(__m512i __A, __m512i __B) |
||
55 | { |
||
56 | return (__m512i) __builtin_ia32_aesenc512((__v8di) __A, |
||
57 | (__v8di) __B); |
||
58 | } |
||
59 | |||
60 | static __inline__ __m512i __DEFAULT_FN_ATTRS_F |
||
61 | _mm512_aesdec_epi128(__m512i __A, __m512i __B) |
||
62 | { |
||
63 | return (__m512i) __builtin_ia32_aesdec512((__v8di) __A, |
||
64 | (__v8di) __B); |
||
65 | } |
||
66 | |||
67 | static __inline__ __m512i __DEFAULT_FN_ATTRS_F |
||
68 | _mm512_aesenclast_epi128(__m512i __A, __m512i __B) |
||
69 | { |
||
70 | return (__m512i) __builtin_ia32_aesenclast512((__v8di) __A, |
||
71 | (__v8di) __B); |
||
72 | } |
||
73 | |||
74 | static __inline__ __m512i __DEFAULT_FN_ATTRS_F |
||
75 | _mm512_aesdeclast_epi128(__m512i __A, __m512i __B) |
||
76 | { |
||
77 | return (__m512i) __builtin_ia32_aesdeclast512((__v8di) __A, |
||
78 | (__v8di) __B); |
||
79 | } |
||
80 | #endif // __AVX512FINTRIN_H |
||
81 | |||
82 | #undef __DEFAULT_FN_ATTRS |
||
83 | #undef __DEFAULT_FN_ATTRS_F |
||
84 | |||
85 | #endif // __VAESINTRIN_H |