1/* Copyright (C) 2013-2014 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#ifndef _IMMINTRIN_H_INCLUDED 25#error "Never use <shaintrin.h> directly; include <immintrin.h> instead." 26#endif 27 28#ifndef _SHAINTRIN_H_INCLUDED 29#define _SHAINTRIN_H_INCLUDED 30 31#ifndef __SHA__ 32#pragma GCC push_options 33#pragma GCC target("sha") 34#define __DISABLE_SHA__ 35#endif /* __SHA__ */ 36 37extern __inline __m128i 38__attribute__ ((__gnu_inline__, __always_inline__, __artificial__)) 39_mm_sha1msg1_epu32 (__m128i __A, __m128i __B) 40{ 41 return (__m128i) __builtin_ia32_sha1msg1 ((__v4si) __A, (__v4si) __B); 42} 43 44extern __inline __m128i 45__attribute__ ((__gnu_inline__, __always_inline__, __artificial__)) 46_mm_sha1msg2_epu32 (__m128i __A, __m128i __B) 47{ 48 return (__m128i) __builtin_ia32_sha1msg2 ((__v4si) __A, (__v4si) __B); 49} 50 51extern __inline __m128i 52__attribute__ ((__gnu_inline__, __always_inline__, __artificial__)) 53_mm_sha1nexte_epu32 (__m128i __A, __m128i __B) 54{ 55 return (__m128i) __builtin_ia32_sha1nexte ((__v4si) __A, (__v4si) __B); 56} 57 58#ifdef __OPTIMIZE__ 59extern __inline __m128i 60__attribute__ ((__gnu_inline__, __always_inline__, __artificial__)) 61_mm_sha1rnds4_epu32 (__m128i __A, __m128i __B, const int __I) 62{ 63 return (__m128i) __builtin_ia32_sha1rnds4 ((__v4si) __A, (__v4si) __B, __I); 64} 65#else 66#define _mm_sha1rnds4_epu32(A, B, I) \ 67 ((__m128i) __builtin_ia32_sha1rnds4 ((__v4si)(__m128i)A, \ 68 (__v4si)(__m128i)B, (int)I)) 69#endif 70 71extern __inline __m128i 72__attribute__ ((__gnu_inline__, __always_inline__, __artificial__)) 73_mm_sha256msg1_epu32 (__m128i __A, __m128i __B) 74{ 75 return (__m128i) __builtin_ia32_sha256msg1 ((__v4si) __A, (__v4si) __B); 76} 77 78extern __inline __m128i 79__attribute__ ((__gnu_inline__, __always_inline__, __artificial__)) 80_mm_sha256msg2_epu32 (__m128i __A, __m128i __B) 81{ 82 return (__m128i) __builtin_ia32_sha256msg2 ((__v4si) __A, (__v4si) __B); 83} 84 85extern __inline __m128i 86__attribute__ ((__gnu_inline__, __always_inline__, __artificial__)) 87_mm_sha256rnds2_epu32 (__m128i __A, __m128i __B, __m128i __C) 88{ 89 return (__m128i) __builtin_ia32_sha256rnds2 ((__v4si) __A, (__v4si) __B, 90 (__v4si) __C); 91} 92 93#ifdef __DISABLE_SHA__ 94#undef __DISABLE_SHA__ 95#pragma GCC pop_options 96#endif /* __DISABLE_SHA__ */ 97 98#endif /* _SHAINTRIN_H_INCLUDED */ 99