Merge 13789 via bugfix_asm_pragmas

This commit is contained in:
Luke Dashjr 2025-03-05 03:27:08 +00:00
commit 22df203e4c
4 changed files with 48 additions and 0 deletions

View File

@ -483,6 +483,12 @@ CXXFLAGS="$SSE41_CXXFLAGS $CXXFLAGS"
AC_MSG_CHECKING([for SSE4.1 intrinsics])
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
#include <immintrin.h>
#if defined(__clang__)
#pragma clang attribute push(__attribute__((__target__("sse4.1"))), apply_to = function)
#elif defined(__GNUC__)
#pragma GCC target ("sse4.1")
#endif
]],[[
__m128i a = _mm_set1_epi32(0);
__m128i b = _mm_set1_epi32(1);
@ -500,6 +506,12 @@ AC_MSG_CHECKING([for AVX2 intrinsics])
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
#include <stdint.h>
#include <immintrin.h>
#if defined(__clang__)
#pragma clang attribute push(__attribute__((__target__("avx,avx2"))), apply_to = function)
#elif defined(__GNUC__)
#pragma GCC target ("avx,avx2")
#endif
]],[[
__m256i l = _mm256_set1_epi32(0);
return _mm256_extract_epi32(l, 7);
@ -515,6 +527,12 @@ AC_MSG_CHECKING([for x86 SHA-NI intrinsics])
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
#include <stdint.h>
#include <immintrin.h>
#if defined(__clang__)
#pragma clang attribute push(__attribute__((__target__("sse4,sse4.1,sha"))), apply_to = function)
#elif defined(__GNUC__)
#pragma GCC target ("sse4,sse4.1,sha")
#endif
]],[[
__m128i i = _mm_set1_epi32(0);
__m128i j = _mm_set1_epi32(1);

View File

@ -10,6 +10,12 @@
#include <attributes.h>
#include <crypto/common.h>
#if defined(__clang__)
#pragma clang attribute push(__attribute__((__target__("avx,avx2"))), apply_to = function)
#elif defined(__GNUC__)
#pragma GCC target ("avx,avx2")
#endif
namespace sha256d64_avx2 {
namespace {
@ -326,4 +332,8 @@ void Transform_8way(unsigned char* out, const unsigned char* in)
}
#if defined(__clang__)
#pragma clang attribute pop
#endif
#endif

View File

@ -10,6 +10,12 @@
#include <attributes.h>
#include <crypto/common.h>
#if defined(__clang__)
#pragma clang attribute push(__attribute__((__target__("sse4.1"))), apply_to = function)
#elif defined(__GNUC__)
#pragma GCC target ("sse4.1")
#endif
namespace sha256d64_sse41 {
namespace {
@ -318,4 +324,8 @@ void Transform_4way(unsigned char* out, const unsigned char* in)
}
#if defined(__clang__)
#pragma clang attribute pop
#endif
#endif

View File

@ -13,6 +13,12 @@
#include <attributes.h>
#if defined(__clang__)
#pragma clang attribute push(__attribute__((__target__("sse4,sse4.1,sha"))), apply_to = function)
#elif defined(__GNUC__)
#pragma GCC target ("sse4,sse4.1,sha")
#endif
namespace {
alignas(__m128i) const uint8_t MASK[16] = {0x03, 0x02, 0x01, 0x00, 0x07, 0x06, 0x05, 0x04, 0x0b, 0x0a, 0x09, 0x08, 0x0f, 0x0e, 0x0d, 0x0c};
@ -355,4 +361,8 @@ void Transform_2way(unsigned char* out, const unsigned char* in)
}
#if defined(__clang__)
#pragma clang attribute pop
#endif
#endif