shaintrin.h revision 280031
140939Sdes/*===---- shaintrin.h - SHA intrinsics -------------------------------------===
240939Sdes *
340939Sdes * Permission is hereby granted, free of charge, to any person obtaining a copy
440939Sdes * of this software and associated documentation files (the "Software"), to deal
540939Sdes * in the Software without restriction, including without limitation the rights
640939Sdes * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
740939Sdes * copies of the Software, and to permit persons to whom the Software is
840939Sdes * furnished to do so, subject to the following conditions:
940939Sdes *
1040939Sdes * The above copyright notice and this permission notice shall be included in
1140939Sdes * all copies or substantial portions of the Software.
1240939Sdes *
1340939Sdes * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
1440939Sdes * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
1540939Sdes * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
1640939Sdes * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
1740939Sdes * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
1840939Sdes * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
1940939Sdes * THE SOFTWARE.
2040939Sdes *
2140939Sdes *===-----------------------------------------------------------------------===
2240939Sdes */
2340939Sdes
2440939Sdes#ifndef __IMMINTRIN_H
2540939Sdes#error "Never use <shaintrin.h> directly; include <immintrin.h> instead."
2640939Sdes#endif
2740939Sdes
2850476Speter#ifndef __SHAINTRIN_H
2940939Sdes#define __SHAINTRIN_H
3040939Sdes
3141862Sdes#if !defined (__SHA__)
3240939Sdes#  error "SHA instructions not enabled"
3355557Sdes#endif
3462981Sdes
3540939Sdes#define _mm_sha1rnds4_epu32(V1, V2, M) __extension__ ({ \
3640939Sdes  __builtin_ia32_sha1rnds4((V1), (V2), (M)); })
3740939Sdes
3840939Sdesstatic __inline__ __m128i __attribute__((__always_inline__, __nodebug__))
3960924Sdes_mm_sha1nexte_epu32(__m128i __X, __m128i __Y)
4041862Sdes{
4141862Sdes  return (__m128i)__builtin_ia32_sha1nexte((__v4si)__X, (__v4si)__Y);
4240939Sdes}
4340939Sdes
4440939Sdesstatic __inline__ __m128i __attribute__((__always_inline__, __nodebug__))
4540939Sdes_mm_sha1msg1_epu32(__m128i __X, __m128i __Y)
4640939Sdes{
4740939Sdes  return (__m128i)__builtin_ia32_sha1msg1((__v4si)__X, (__v4si)__Y);
4840975Sdes}
4940939Sdes
5040939Sdesstatic __inline__ __m128i __attribute__((__always_inline__, __nodebug__))
5140939Sdes_mm_sha1msg2_epu32(__m128i __X, __m128i __Y)
5240939Sdes{
5340939Sdes  return (__m128i)__builtin_ia32_sha1msg2((__v4si)__X, (__v4si)__Y);
5440939Sdes}
5560737Sume
5660737Sumestatic __inline__ __m128i __attribute__((__always_inline__, __nodebug__))
5760737Sume_mm_sha256rnds2_epu32(__m128i __X, __m128i __Y, __m128i __Z)
5860737Sume{
5940975Sdes  return (__m128i)__builtin_ia32_sha256rnds2((__v4si)__X, (__v4si)__Y, (__v4si)__Z);
6040939Sdes}
6140939Sdes
6262981Sdesstatic __inline__ __m128i __attribute__((__always_inline__, __nodebug__))
6362981Sdes_mm_sha256msg1_epu32(__m128i __X, __m128i __Y)
6440939Sdes{
6562981Sdes  return (__m128i)__builtin_ia32_sha256msg1((__v4si)__X, (__v4si)__Y);
6640939Sdes}
6740939Sdes
6840939Sdesstatic __inline__ __m128i __attribute__((__always_inline__, __nodebug__))
6940939Sdes_mm_sha256msg2_epu32(__m128i __X, __m128i __Y)
7040939Sdes{
7160924Sdes  return (__m128i)__builtin_ia32_sha256msg2((__v4si)__X, (__v4si)__Y);
7240975Sdes}
7340939Sdes
7460924Sdes#endif /* __SHAINTRIN_H */
7560924Sdes