2013-09-19 21:22:04 +08:00
|
|
|
/*===---- shaintrin.h - SHA intrinsics -------------------------------------===
|
|
|
|
*
|
2019-04-09 04:51:30 +08:00
|
|
|
* Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
|
|
|
* See https://llvm.org/LICENSE.txt for license information.
|
|
|
|
* SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
2013-09-19 21:22:04 +08:00
|
|
|
*
|
|
|
|
*===-----------------------------------------------------------------------===
|
|
|
|
*/
|
|
|
|
|
2013-09-19 22:07:14 +08:00
|
|
|
#ifndef __IMMINTRIN_H
|
2013-09-19 22:00:22 +08:00
|
|
|
#error "Never use <shaintrin.h> directly; include <immintrin.h> instead."
|
2013-09-19 21:22:04 +08:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifndef __SHAINTRIN_H
|
|
|
|
#define __SHAINTRIN_H
|
|
|
|
|
2015-06-17 15:09:20 +08:00
|
|
|
/* Define the default attributes for the functions in this file. */
|
2018-07-10 03:00:16 +08:00
|
|
|
#define __DEFAULT_FN_ATTRS __attribute__((__always_inline__, __nodebug__, __target__("sha"), __min_vector_width__(128)))
|
2015-06-17 15:09:20 +08:00
|
|
|
|
2018-05-31 08:51:20 +08:00
|
|
|
#define _mm_sha1rnds4_epu32(V1, V2, M) \
|
2018-06-01 17:40:50 +08:00
|
|
|
__builtin_ia32_sha1rnds4((__v4si)(__m128i)(V1), (__v4si)(__m128i)(V2), (M))
|
2013-09-19 21:22:04 +08:00
|
|
|
|
2015-06-30 21:36:19 +08:00
|
|
|
static __inline__ __m128i __DEFAULT_FN_ATTRS
|
2013-09-19 21:22:04 +08:00
|
|
|
_mm_sha1nexte_epu32(__m128i __X, __m128i __Y)
|
|
|
|
{
|
2014-12-27 19:50:51 +08:00
|
|
|
return (__m128i)__builtin_ia32_sha1nexte((__v4si)__X, (__v4si)__Y);
|
2013-09-19 21:22:04 +08:00
|
|
|
}
|
|
|
|
|
2015-06-30 21:36:19 +08:00
|
|
|
static __inline__ __m128i __DEFAULT_FN_ATTRS
|
2013-09-19 21:22:04 +08:00
|
|
|
_mm_sha1msg1_epu32(__m128i __X, __m128i __Y)
|
|
|
|
{
|
2014-12-27 19:50:51 +08:00
|
|
|
return (__m128i)__builtin_ia32_sha1msg1((__v4si)__X, (__v4si)__Y);
|
2013-09-19 21:22:04 +08:00
|
|
|
}
|
|
|
|
|
2015-06-30 21:36:19 +08:00
|
|
|
static __inline__ __m128i __DEFAULT_FN_ATTRS
|
2013-09-19 21:22:04 +08:00
|
|
|
_mm_sha1msg2_epu32(__m128i __X, __m128i __Y)
|
|
|
|
{
|
2014-12-27 19:50:51 +08:00
|
|
|
return (__m128i)__builtin_ia32_sha1msg2((__v4si)__X, (__v4si)__Y);
|
2013-09-19 21:22:04 +08:00
|
|
|
}
|
|
|
|
|
2015-06-30 21:36:19 +08:00
|
|
|
static __inline__ __m128i __DEFAULT_FN_ATTRS
|
2013-09-19 21:22:04 +08:00
|
|
|
_mm_sha256rnds2_epu32(__m128i __X, __m128i __Y, __m128i __Z)
|
|
|
|
{
|
2014-12-27 19:50:51 +08:00
|
|
|
return (__m128i)__builtin_ia32_sha256rnds2((__v4si)__X, (__v4si)__Y, (__v4si)__Z);
|
2013-09-19 21:22:04 +08:00
|
|
|
}
|
|
|
|
|
2015-06-30 21:36:19 +08:00
|
|
|
static __inline__ __m128i __DEFAULT_FN_ATTRS
|
2013-09-19 21:22:04 +08:00
|
|
|
_mm_sha256msg1_epu32(__m128i __X, __m128i __Y)
|
|
|
|
{
|
2014-12-27 19:50:51 +08:00
|
|
|
return (__m128i)__builtin_ia32_sha256msg1((__v4si)__X, (__v4si)__Y);
|
2013-09-19 21:22:04 +08:00
|
|
|
}
|
|
|
|
|
2015-06-30 21:36:19 +08:00
|
|
|
static __inline__ __m128i __DEFAULT_FN_ATTRS
|
2013-09-19 21:22:04 +08:00
|
|
|
_mm_sha256msg2_epu32(__m128i __X, __m128i __Y)
|
|
|
|
{
|
2014-12-27 19:50:51 +08:00
|
|
|
return (__m128i)__builtin_ia32_sha256msg2((__v4si)__X, (__v4si)__Y);
|
2013-09-19 21:22:04 +08:00
|
|
|
}
|
|
|
|
|
2015-06-30 21:36:19 +08:00
|
|
|
#undef __DEFAULT_FN_ATTRS
|
2015-06-17 15:09:20 +08:00
|
|
|
|
2013-09-19 21:22:04 +08:00
|
|
|
#endif /* __SHAINTRIN_H */
|