| 1 | /* Copyright (C) 2018-2021 Free Software Foundation, Inc. | 
|---|
| 2 |  | 
|---|
| 3 | This file is part of GCC. | 
|---|
| 4 |  | 
|---|
| 5 | GCC is free software; you can redistribute it and/or modify | 
|---|
| 6 | it under the terms of the GNU General Public License as published by | 
|---|
| 7 | the Free Software Foundation; either version 3, or (at your option) | 
|---|
| 8 | any later version. | 
|---|
| 9 |  | 
|---|
| 10 | GCC is distributed in the hope that it will be useful, | 
|---|
| 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 
|---|
| 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the | 
|---|
| 13 | GNU General Public License for more details. | 
|---|
| 14 |  | 
|---|
| 15 | Under Section 7 of GPL version 3, you are granted additional | 
|---|
| 16 | permissions described in the GCC Runtime Library Exception, version | 
|---|
| 17 | 3.1, as published by the Free Software Foundation. | 
|---|
| 18 |  | 
|---|
| 19 | You should have received a copy of the GNU General Public License and | 
|---|
| 20 | a copy of the GCC Runtime Library Exception along with this program; | 
|---|
| 21 | see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see | 
|---|
| 22 | <http://www.gnu.org/licenses/>.  */ | 
|---|
| 23 |  | 
|---|
| 24 | #if !defined _IMMINTRIN_H_INCLUDED | 
|---|
| 25 | # error "Never use <keylockerintrin.h> directly; include <x86intrin.h> instead." | 
|---|
| 26 | #endif | 
|---|
| 27 |  | 
|---|
| 28 | #ifndef _KEYLOCKERINTRIN_H_INCLUDED | 
|---|
| 29 | #define _KEYLOCKERINTRIN_H_INCLUDED | 
|---|
| 30 |  | 
|---|
| 31 | #ifndef __KL__ | 
|---|
| 32 | #pragma GCC push_options | 
|---|
| 33 | #pragma GCC target("kl") | 
|---|
| 34 | #define __DISABLE_KL__ | 
|---|
| 35 | #endif /* __KL__ */ | 
|---|
| 36 |  | 
|---|
| 37 |  | 
|---|
| 38 | extern __inline | 
|---|
| 39 | void __attribute__((__gnu_inline__, __always_inline__, __artificial__)) | 
|---|
| 40 | _mm_loadiwkey (unsigned int __I, __m128i __A, __m128i __B, __m128i __C) | 
|---|
| 41 | { | 
|---|
| 42 | __builtin_ia32_loadiwkey ((__v2di) __B, (__v2di) __C, (__v2di) __A, __I); | 
|---|
| 43 | } | 
|---|
| 44 |  | 
|---|
| 45 | extern __inline | 
|---|
| 46 | unsigned int __attribute__((__gnu_inline__, __always_inline__, __artificial__)) | 
|---|
| 47 | _mm_encodekey128_u32 (unsigned int __I, __m128i __A, void * __P) | 
|---|
| 48 | { | 
|---|
| 49 | return __builtin_ia32_encodekey128_u32 (__I, (__v2di)__A, __P); | 
|---|
| 50 | } | 
|---|
| 51 |  | 
|---|
| 52 | extern __inline | 
|---|
| 53 | unsigned int __attribute__((__gnu_inline__, __always_inline__, __artificial__)) | 
|---|
| 54 | _mm_encodekey256_u32 (unsigned int __I, __m128i __A, __m128i __B, void * __P) | 
|---|
| 55 | { | 
|---|
| 56 | return __builtin_ia32_encodekey256_u32 (__I, (__v2di)__A, (__v2di)__B, __P); | 
|---|
| 57 | } | 
|---|
| 58 |  | 
|---|
| 59 | extern __inline | 
|---|
| 60 | unsigned char __attribute__((__gnu_inline__, __always_inline__, __artificial__)) | 
|---|
| 61 | _mm_aesdec128kl_u8 (__m128i * __A, __m128i __B, const void * __P) | 
|---|
| 62 | { | 
|---|
| 63 | return __builtin_ia32_aesdec128kl_u8 ((__v2di *) __A, (__v2di) __B, __P); | 
|---|
| 64 | } | 
|---|
| 65 |  | 
|---|
| 66 | extern __inline | 
|---|
| 67 | unsigned char __attribute__((__gnu_inline__, __always_inline__, __artificial__)) | 
|---|
| 68 | _mm_aesdec256kl_u8 (__m128i * __A, __m128i __B, const void * __P) | 
|---|
| 69 | { | 
|---|
| 70 | return __builtin_ia32_aesdec256kl_u8 ((__v2di *) __A, (__v2di) __B, __P); | 
|---|
| 71 | } | 
|---|
| 72 |  | 
|---|
| 73 | extern __inline | 
|---|
| 74 | unsigned char __attribute__((__gnu_inline__, __always_inline__, __artificial__)) | 
|---|
| 75 | _mm_aesenc128kl_u8 (__m128i * __A, __m128i __B, const void * __P) | 
|---|
| 76 | { | 
|---|
| 77 | return __builtin_ia32_aesenc128kl_u8 ((__v2di *) __A, (__v2di) __B, __P); | 
|---|
| 78 | } | 
|---|
| 79 |  | 
|---|
| 80 | extern __inline | 
|---|
| 81 | unsigned char __attribute__((__gnu_inline__, __always_inline__, __artificial__)) | 
|---|
| 82 | _mm_aesenc256kl_u8 (__m128i * __A, __m128i __B, const void * __P) | 
|---|
| 83 | { | 
|---|
| 84 | return __builtin_ia32_aesenc256kl_u8 ((__v2di *) __A, (__v2di) __B, __P); | 
|---|
| 85 | } | 
|---|
| 86 |  | 
|---|
| 87 | #ifdef __DISABLE_KL__ | 
|---|
| 88 | #undef __DISABLE_KL__ | 
|---|
| 89 | #pragma GCC pop_options | 
|---|
| 90 | #endif /* __DISABLE_KL__ */ | 
|---|
| 91 |  | 
|---|
| 92 | #ifndef __WIDEKL__ | 
|---|
| 93 | #pragma GCC push_options | 
|---|
| 94 | #pragma GCC target("widekl") | 
|---|
| 95 | #define __DISABLE_WIDEKL__ | 
|---|
| 96 | #endif /* __WIDEKL__ */ | 
|---|
| 97 |  | 
|---|
| 98 | extern __inline | 
|---|
| 99 | unsigned char __attribute__((__gnu_inline__, __always_inline__, __artificial__)) | 
|---|
| 100 | _mm_aesdecwide128kl_u8(__m128i __A[8], const __m128i __B[8], const void * __P) | 
|---|
| 101 | { | 
|---|
| 102 | return __builtin_ia32_aesdecwide128kl_u8 ((__v2di *) __A, (__v2di *) __B, __P); | 
|---|
| 103 | } | 
|---|
| 104 |  | 
|---|
| 105 | extern __inline | 
|---|
| 106 | unsigned char __attribute__((__gnu_inline__, __always_inline__, __artificial__)) | 
|---|
| 107 | _mm_aesdecwide256kl_u8(__m128i __A[8], const __m128i __B[8], const void * __P) | 
|---|
| 108 | { | 
|---|
| 109 | return __builtin_ia32_aesdecwide256kl_u8 ((__v2di *) __A, (__v2di *) __B, __P); | 
|---|
| 110 | } | 
|---|
| 111 |  | 
|---|
| 112 | extern __inline | 
|---|
| 113 | unsigned char __attribute__((__gnu_inline__, __always_inline__, __artificial__)) | 
|---|
| 114 | _mm_aesencwide128kl_u8(__m128i __A[8], const __m128i __B[8], const void * __P) | 
|---|
| 115 | { | 
|---|
| 116 | return __builtin_ia32_aesencwide128kl_u8 ((__v2di *) __A, (__v2di *) __B, __P); | 
|---|
| 117 | } | 
|---|
| 118 |  | 
|---|
| 119 | extern __inline | 
|---|
| 120 | unsigned char __attribute__((__gnu_inline__, __always_inline__, __artificial__)) | 
|---|
| 121 | _mm_aesencwide256kl_u8(__m128i __A[8], const __m128i __B[8], const void * __P) | 
|---|
| 122 | { | 
|---|
| 123 | return __builtin_ia32_aesencwide256kl_u8 ((__v2di *) __A, (__v2di *) __B, __P); | 
|---|
| 124 | } | 
|---|
| 125 | #ifdef __DISABLE_WIDEKL__ | 
|---|
| 126 | #undef __DISABLE_WIDEKL__ | 
|---|
| 127 | #pragma GCC pop_options | 
|---|
| 128 | #endif /* __DISABLE_WIDEKL__ */ | 
|---|
| 129 | #endif /* _KEYLOCKERINTRIN_H_INCLUDED */ | 
|---|