From e043698442a90c6cb9cad07cedcbfc8fde84c472 Mon Sep 17 00:00:00 2001 From: Jay D Dee Date: Tue, 7 Nov 2023 04:59:44 -0500 Subject: [PATCH] v23.7 --- Makefile.am | 1 - RELEASE_NOTES | 9 + algo/argon2d/argon2d/opt.c | 2 +- algo/blake/blake512-hash.c | 83 +- algo/hamsi/hamsi-hash-4way.c | 24 +- algo/jh/jh-hash-4way.c | 39 - algo/keccak/keccak-hash-4way.c | 2 +- algo/luffa/luffa_for_sse2.c | 53 +- algo/lyra2/allium-4way.c | 23 +- algo/scrypt/scrypt.c | 61 +- algo/sha/sha2.c | 681 ----- algo/sha/sha256-hash.c | 2 +- algo/sha/sha256d-4way.c | 5 +- algo/sha/sha256d.c | 21 + algo/sha/sha256d.h | 57 +- algo/sha/sha256dt.c | 2 - algo/sha/sha256t-4way.c | 2 - algo/sha/sha512-hash-4way.c | 79 +- algo/sha/sha512256d-4way.c | 76 +- algo/simd/simd-hash-2way.c | 2429 +++++++++++------- algo/simd/simd-hash-2way.h | 70 +- algo/x16/minotaur.c | 23 +- algo/x17/x17-4way.c | 120 +- algo/x22/x22i.c | 2 +- algo/x22/x25x.c | 2 +- configure | 20 +- configure.ac | 2 +- configure~ | 4393 +++++++++++++------------------- cpu-miner.c | 33 +- simd-utils/intrlv.h | 11 + simd-utils/simd-128.h | 115 +- simd-utils/simd-256.h | 43 +- simd-utils/simd-neon.h | 254 +- 33 files changed, 3928 insertions(+), 4811 deletions(-) delete mode 100644 algo/sha/sha2.c diff --git a/Makefile.am b/Makefile.am index 66bd3e4d..bbe55c50 100644 --- a/Makefile.am +++ b/Makefile.am @@ -156,7 +156,6 @@ cpuminer_SOURCES = \ algo/sha/hmac-sha256-hash.c \ algo/sha/hmac-sha256-hash-4way.c \ algo/sha/sha256d.c \ - algo/sha/sha2.c \ algo/sha/sha256d-4way.c \ algo/sha/sha256t-gate.c \ algo/sha/sha256t-4way.c \ diff --git a/RELEASE_NOTES b/RELEASE_NOTES index 9d8bbea2..813bdd40 100644 --- a/RELEASE_NOTES +++ b/RELEASE_NOTES @@ -73,6 +73,15 @@ If not what makes it happen or not happen? Change Log ---------- +v23.7 + +Fixed blakes2s, broken in v3.23.4. +ARM: SHA2 extension tested and working. +ARM: sha512256d fully optimized. +ARM: X17 more optimizations. +ARM: AES extension working for Shavite. +ARM errata: CPU features AES & SHA256 are not reported when available. + v23.6 ARM: Sha256dt, Sha256t, Sha256d 4-way now working and fully optimized for NEON, SHA also enabled but untested. diff --git a/algo/argon2d/argon2d/opt.c b/algo/argon2d/argon2d/opt.c index d278ff37..a363a614 100644 --- a/algo/argon2d/argon2d/opt.c +++ b/algo/argon2d/argon2d/opt.c @@ -242,7 +242,7 @@ void fill_segment(const argon2_instance_t *instance, #elif defined(__AVX2__) __m256i state[ARGON2_HWORDS_IN_BLOCK]; #else - v128_t state[ARGON2_OWORDS_IN_BLOCK]; + v128u64_t state[ARGON2_OWORDS_IN_BLOCK]; #endif // int data_independent_addressing; diff --git a/algo/blake/blake512-hash.c b/algo/blake/blake512-hash.c index 55ddf3b1..c4ee3033 100644 --- a/algo/blake/blake512-hash.c +++ b/algo/blake/blake512-hash.c @@ -465,6 +465,7 @@ void blake512_update(blake512_context *sc, const void *data, size_t len) { if ( ( sc->T0 = sc->T0 + 1024 ) < 1024 ) sc->T1 += 1; + blake512_transform( sc->H, (uint64_t*)sc->buf, sc->T0, sc->T1 ); sc->ptr = 0; } @@ -474,7 +475,7 @@ void blake512_update(blake512_context *sc, const void *data, size_t len) void blake512_close( blake512_context *sc, void *dst ) { unsigned char buf[128] __attribute__((aligned(32))); - size_t ptr, k; + size_t ptr; unsigned bit_len; uint64_t th, tl; @@ -517,11 +518,8 @@ void blake512_close( blake512_context *sc, void *dst ) *(uint64_t*)(buf + 120) = bswap_64( tl ); blake512_update( sc, buf, 128 ); } - -//TODO vectored bswap - for ( k = 0; k < 8; k ++ ) - ((uint64_t*)dst)[k] = bswap_64( sc->H[k] ); + v128_block_bswap64_512( dst, sc->H ); } void blake512_full( blake512_context *sc, void *dst, const void *data, @@ -1779,13 +1777,11 @@ blake64_4way_close( blake_4x64_big_context *sc, void *dst ) v256_64( 0x0100000000000000ULL ) ); buf[112>>3] = v256_64( bswap_64( th ) ); buf[120>>3] = v256_64( bswap_64( tl ) ); - blake64_4way( sc, buf + (ptr>>3), 128 - ptr ); } else { memset_zero_256( buf + (ptr>>3) + 1, (120 - ptr) >> 3 ); - blake64_4way( sc, buf + (ptr>>3), 128 - ptr ); sc->T0 = 0xFFFFFFFFFFFFFC00ULL; sc->T1 = 0xFFFFFFFFFFFFFFFFULL; @@ -1793,9 +1789,9 @@ blake64_4way_close( blake_4x64_big_context *sc, void *dst ) buf[104>>3] = v256_64( 0x0100000000000000ULL ); buf[112>>3] = v256_64( bswap_64( th ) ); buf[120>>3] = v256_64( bswap_64( tl ) ); - blake64_4way( sc, buf, 128 ); } + mm256_block_bswap_64( (__m256i*)dst, sc->H ); } @@ -1960,21 +1956,21 @@ void blake512_2x64_compress( blake_2x64_big_context *sc ) #else // SSE2 & NEON M0 = v128_bswap64( sc->buf[ 0] ); - M1 = v128_bswap64( sc->buf[ 0] ); - M2 = v128_bswap64( sc->buf[ 0] ); - M3 = v128_bswap64( sc->buf[ 0] ); - M4 = v128_bswap64( sc->buf[ 0] ); - M5 = v128_bswap64( sc->buf[ 0] ); - M6 = v128_bswap64( sc->buf[ 0] ); - M7 = v128_bswap64( sc->buf[ 0] ); - M8 = v128_bswap64( sc->buf[ 0] ); - M9 = v128_bswap64( sc->buf[ 0] ); - MA = v128_bswap64( sc->buf[ 0] ); - MB = v128_bswap64( sc->buf[ 0] ); - MC = v128_bswap64( sc->buf[ 0] ); - MD = v128_bswap64( sc->buf[ 0] ); - ME = v128_bswap64( sc->buf[ 0] ); - MF = v128_bswap64( sc->buf[ 0] ); + M1 = v128_bswap64( sc->buf[ 1] ); + M2 = v128_bswap64( sc->buf[ 2] ); + M3 = v128_bswap64( sc->buf[ 3] ); + M4 = v128_bswap64( sc->buf[ 4] ); + M5 = v128_bswap64( sc->buf[ 5] ); + M6 = v128_bswap64( sc->buf[ 6] ); + M7 = v128_bswap64( sc->buf[ 7] ); + M8 = v128_bswap64( sc->buf[ 8] ); + M9 = v128_bswap64( sc->buf[ 9] ); + MA = v128_bswap64( sc->buf[10] ); + MB = v128_bswap64( sc->buf[11] ); + MC = v128_bswap64( sc->buf[12] ); + MD = v128_bswap64( sc->buf[13] ); + ME = v128_bswap64( sc->buf[14] ); + MF = v128_bswap64( sc->buf[15] ); #endif @@ -2235,7 +2231,6 @@ blake64_2x64( blake_2x64_big_context *sc, const void *data, size_t len) v128u64_t *buf; size_t ptr; const int buf_size = 128; // sizeof/8 - DECL_STATE_2X64 buf = sc->buf; ptr = sc->ptr; @@ -2247,7 +2242,6 @@ blake64_2x64( blake_2x64_big_context *sc, const void *data, size_t len) return; } - READ_STATE64(sc); while ( len > 0 ) { size_t clen; @@ -2260,13 +2254,12 @@ blake64_2x64( blake_2x64_big_context *sc, const void *data, size_t len) len -= clen; if ( ptr == buf_size ) { - if ( (T0 = T0 + 1024 ) < 1024 ) - T1 = T1 + 1; + if ( (sc->T0 = sc->T0 + 1024 ) < 1024 ) + sc->T1 = sc->T1 + 1; blake512_2x64_compress( sc ); ptr = 0; } } - WRITE_STATE64(sc); sc->ptr = ptr; } @@ -2280,37 +2273,35 @@ blake64_2x64_close( blake_2x64_big_context *sc, void *dst ) ptr = sc->ptr; bit_len = ((unsigned)ptr << 3); - buf[ptr>>3] = v128_64( 0x80 ); + sc->buf[ptr>>3] = v128_64( 0x80 ); tl = sc->T0 + bit_len; th = sc->T1; if (ptr == 0 ) { - sc->T0 = 0xFFFFFFFFFFFFFC00ULL; - sc->T1 = 0xFFFFFFFFFFFFFFFFULL; + sc->T0 = 0xFFFFFFFFFFFFFC00ULL; + sc->T1 = 0xFFFFFFFFFFFFFFFFULL; } else if ( sc->T0 == 0 ) { - sc->T0 = 0xFFFFFFFFFFFFFC00ULL + bit_len; - sc->T1 = sc->T1 - 1; + sc->T0 = 0xFFFFFFFFFFFFFC00ULL + bit_len; + sc->T1 = sc->T1 - 1; } else - { - sc->T0 -= 1024 - bit_len; - } - + sc->T0 -= 1024 - bit_len; + if ( ptr <= 104 ) { - v128_memset_zero( buf + (ptr>>3) + 1, (104-ptr) >> 3 ); - buf[104>>3] = v128_or( buf[104>>3], v128_64( 0x0100000000000000ULL ) ); - buf[112>>3] = v128_64( bswap_64( th ) ); - buf[120>>3] = v128_64( bswap_64( tl ) ); - - blake64_2x64( sc, buf + (ptr>>3), 128 - ptr ); + v128_memset_zero( sc->buf + (ptr>>3) + 1, (104-ptr) >> 3 ); + sc->buf[104>>3] = v128_or( sc->buf[104>>3], + v128_64( 0x0100000000000000ULL ) ); + sc->buf[112>>3] = v128_64( bswap_64( th ) ); + sc->buf[120>>3] = v128_64( bswap_64( tl ) ); + blake64_2x64( sc, sc->buf + (ptr>>3), 128 - ptr ); } else { - v128_memset_zero( buf + (ptr>>3) + 1, (120 - ptr) >> 3 ); - blake64_2x64( sc, buf + (ptr>>3), 128 - ptr ); + v128_memset_zero( sc->buf + (ptr>>3) + 1, (120 - ptr) >> 3 ); + blake64_2x64( sc, sc->buf + (ptr>>3), 128 - ptr ); sc->T0 = 0xFFFFFFFFFFFFFC00ULL; sc->T1 = 0xFFFFFFFFFFFFFFFFULL; v128_memset_zero( buf, 112>>3 ); @@ -2319,6 +2310,7 @@ blake64_2x64_close( blake_2x64_big_context *sc, void *dst ) buf[120>>3] = v128_64( bswap_64( tl ) ); blake64_2x64( sc, buf, 128 ); } + v128_block_bswap64( (v128u64_t*)dst, sc->H ); } @@ -2326,7 +2318,6 @@ blake64_2x64_close( blake_2x64_big_context *sc, void *dst ) void blake512_2x64_full( blake_2x64_big_context *sc, void * dst, const void *data, size_t len ) { - // init casti_v128u64( sc->H, 0 ) = v128_64( 0x6A09E667F3BCC908 ); diff --git a/algo/hamsi/hamsi-hash-4way.c b/algo/hamsi/hamsi-hash-4way.c index 7e8b2387..15c2a049 100644 --- a/algo/hamsi/hamsi-hash-4way.c +++ b/algo/hamsi/hamsi-hash-4way.c @@ -1936,7 +1936,7 @@ void hamsi512_4way_close( hamsi_4way_big_context *sc, void *dst ) #if defined(__SSE4_2__) || defined(__ARM_NEON) #define DECL_STATE_2x64 \ - v128_t c0, c1, c2, c3, c4, c5, c6, c7; \ + v128u64_t c0, c1, c2, c3, c4, c5, c6, c7; \ #define READ_STATE_2x64(sc) \ c0 = sc->h[0]; \ @@ -1960,13 +1960,13 @@ void hamsi512_4way_close( hamsi_4way_big_context *sc, void *dst ) #define INPUT_2x64 \ { \ - v128_t db = *buf; \ - const v128_t zero = v128_zero; \ + v128u64_t db = *buf; \ + const v128u64_t zero = v128_64( 0ull ); \ const uint64_t *tp = (const uint64_t*)T512; \ m0 = m1 = m2 = m3 = m4 = m5 = m6 = m7 = zero; \ for ( int i = 63; i >= 0; i-- ) \ { \ - v128_t dm = v128_cmpgt64( zero, v128_sl64( db, i ) ); \ + v128u64_t dm = v128_cmpgt64( zero, v128_sl64( db, i ) ); \ m0 = v128_xor( m0, v128_and( dm, v128_64( tp[0] ) ) ); \ m1 = v128_xor( m1, v128_and( dm, v128_64( tp[1] ) ) ); \ m2 = v128_xor( m2, v128_and( dm, v128_64( tp[2] ) ) ); \ @@ -1982,7 +1982,7 @@ void hamsi512_4way_close( hamsi_4way_big_context *sc, void *dst ) // v3 no ternary logic, 15 instructions, 9 TL equivalent instructions #define SBOX_2x64( a, b, c, d ) \ { \ - v128_t tb, td; \ + v128u64_t tb, td; \ td = v128_xorand( d, a, c ); \ tb = v128_xoror( b, d, a ); \ c = v128_xor3( c, td, b ); \ @@ -2010,7 +2010,7 @@ void hamsi512_4way_close( hamsi_4way_big_context *sc, void *dst ) #define ROUND_2x64( alpha ) \ { \ - v128_t t0, t1, t2, t3, t4, t5; \ + v128u64_t t0, t1, t2, t3, t4, t5; \ const v128_t mask = v128_64( 0x00000000ffffffff ); \ s0 = v128_xor( s0, alpha[ 0] ); \ s1 = v128_xor( s1, alpha[ 1] ); \ @@ -2107,7 +2107,7 @@ void hamsi512_4way_close( hamsi_4way_big_context *sc, void *dst ) #define P_2x64 \ { \ - v128_t alpha[16]; \ + v128u64_t alpha[16]; \ const uint64_t A0 = ( (uint64_t*)alpha_n )[0]; \ for( int i = 0; i < 16; i++ ) \ alpha[i] = v128_64( ( (uint64_t*)alpha_n )[i] ); \ @@ -2126,7 +2126,7 @@ void hamsi512_4way_close( hamsi_4way_big_context *sc, void *dst ) #define PF_2x64 \ { \ - v128_t alpha[16]; \ + v128u64_t alpha[16]; \ const uint64_t A0 = ( (uint64_t*)alpha_f )[0]; \ for( int i = 0; i < 16; i++ ) \ alpha[i] = v128_64( ( (uint64_t*)alpha_f )[i] ); \ @@ -2193,7 +2193,7 @@ void hamsi64_big( hamsi_2x64_context *sc, v128_t *buf, size_t num ) void hamsi64_big_final( hamsi_2x64_context *sc, v128_t *buf ) { - v128_t m0, m1, m2, m3, m4, m5, m6, m7; + v128u64_t m0, m1, m2, m3, m4, m5, m6, m7; DECL_STATE_2x64; READ_STATE_2x64( sc ); INPUT_2x64; @@ -2231,15 +2231,15 @@ void hamsi512_2x64_update( hamsi_2x64_context *sc, const void *data, void hamsi512_2x64_close( hamsi_2x64_context *sc, void *dst ) { - v128_t pad[1]; + v128u32_t pad; uint32_t ch, cl; ch = bswap_32( sc->count_high ); cl = bswap_32( sc->count_low + ( sc->partial_len << 3 ) ); - pad[0] = v128_64( ((uint64_t)cl << 32 ) | (uint64_t)ch ); + pad = v128_64( ((uint64_t)cl << 32 ) | (uint64_t)ch ); sc->buf[0] = v128_64( 0x80 ); hamsi64_big( sc, sc->buf, 1 ); - hamsi64_big_final( sc, pad ); + hamsi64_big_final( sc, &pad ); v128_block_bswap32( (v128_t*)dst, sc->h ); } diff --git a/algo/jh/jh-hash-4way.c b/algo/jh/jh-hash-4way.c index 0a208537..fbc30180 100644 --- a/algo/jh/jh-hash-4way.c +++ b/algo/jh/jh-hash-4way.c @@ -852,48 +852,10 @@ void jh512_4x64_ctx( jh_4x64_context *cc, void *dst, const void *data, size_t le // SSE2 & NEON -#if defined(__AVX512VL__) -//TODO enable for AVX10_256, not used with AVX512VL - -#define v128_notxorandnot( a, b, c ) \ - _mm_ternarylogic_epi64( a, b, c, 0x2d ) - -#else - #define v128_notxorandnot( a, b, c ) \ v128_xor( v128_not( a ), v128_andnot( b, c ) ) -#endif -#define Sb(x0, x1, x2, x3, c) \ -{ \ - v128u64_t cc = v128_64( c ); \ - x3 = v128_not( x3 ); \ - x0 = v128_xor( x0, v128_andnot( x2, cc ) ); \ - tmp = v128_xor( cc, v128_and( x0, x1 ) ); \ - x0 = v128_xor( x0, v128_and( x2, x3 ) ); \ - x3 = v128_xor( x3, v128_andnot( x1, x2 ) ); \ - x1 = v128_xor( x1, v128_and( x0, x2 ) ); \ - x2 = v128_xor( x2, v128_andnot( x3, x0 ) ); \ - x0 = v128_xor( x0, v128_or( x1, x3 ) ); \ - x3 = v128_xor( x3, v128_and( x1, x2 ) ); \ - x1 = v128_xor( x1, v128_and( tmp, x0 ) ); \ - x2 = v128_xor( x2, tmp ); \ -} - -#define Lb(x0, x1, x2, x3, x4, x5, x6, x7) \ -{ \ - x4 = v128_xor( x4, x1 ); \ - x5 = v128_xor( x5, x2 ); \ - x6 = v128_xor( x6, v128_xor( x3, x0 ) ); \ - x7 = v128_xor( x7, x0 ); \ - x0 = v128_xor( x0, x5 ); \ - x1 = v128_xor( x1, x6 ); \ - x2 = v128_xor( x2, v128_xor( x7, x4 ) ); \ - x3 = v128_xor( x3, x4 ); \ -} - -/* #define Sb(x0, x1, x2, x3, c) \ { \ const v128u64_t cc = v128_64( c ); \ @@ -920,7 +882,6 @@ void jh512_4x64_ctx( jh_4x64_context *cc, void *dst, const void *data, size_t le x2 = v128_xor3( x2, x7, x4 ); \ x3 = v128_xor( x3, x4 ); \ } -*/ #undef Wz #define Wz(x, c, n) \ diff --git a/algo/keccak/keccak-hash-4way.c b/algo/keccak/keccak-hash-4way.c index c2f3c8cd..6d4a1a0d 100644 --- a/algo/keccak/keccak-hash-4way.c +++ b/algo/keccak/keccak-hash-4way.c @@ -563,7 +563,7 @@ static void keccak64x2_close( keccak64_ctx_v128 *kc, void *dst, { unsigned eb; union { - v128_t tmp[lim + 1]; + v128_t tmp[140]; uint64_t dummy; /* for alignment */ } u; size_t j; diff --git a/algo/luffa/luffa_for_sse2.c b/algo/luffa/luffa_for_sse2.c index 6cdbb811..e8296bc1 100644 --- a/algo/luffa/luffa_for_sse2.c +++ b/algo/luffa/luffa_for_sse2.c @@ -33,43 +33,39 @@ #define MULT2( a0, a1 ) \ { \ - v128_t b = v128_xor( a0, _mm_maskz_shuffle_epi32( 0xb, a1, 0x10 ) ); \ + v128_t b = v128_xor( a0, _mm_maskz_shuffle_epi32( 0xb, a1, 0 ) ); \ a0 = _mm_alignr_epi8( a1, b, 4 ); \ a1 = _mm_alignr_epi8( b, a1, 4 ); \ } #elif defined(__SSE4_1__) -#define MULT2( a0, a1 ) do \ +#define MULT2( a0, a1 ) \ { \ - v128_t b = v128_xor( a0, \ - _mm_shuffle_epi32( mm128_mask_32( a1, 0xe ), 0x10 ) ); \ + v128_t b = _mm_shuffle_epi32( a1, 0 ); \ + b = v128_xor( a0, v128_mask32( b, 0x4 ) ); \ a0 = _mm_alignr_epi8( a1, b, 4 ); \ a1 = _mm_alignr_epi8( b, a1, 4 ); \ -} while(0) +} #elif defined(__ARM_NEON) -const uint32x4_t mask = { 0xffffffff, 0, 0xffffffff, 0xffffffff }; - // { a1_0, 0, a1_0, a1_0 } #define MULT2( a0, a1 ) \ { \ - v128_t b = v128_xor( a0, \ - v128_and( v128_32( vgetq_lane_u32( a1, 0 ) ), mask ) ); \ + v128_t b = v128_xor( a0, v128_and( vdupq_laneq_u32( a1, 0 ), MASK ) ); \ a0 = v128_alignr32( a1, b, 1 ); \ a1 = v128_alignr32( b, a1, 1 ); \ } #else // assume SSE2 -#define MULT2( a0, a1 ) do \ +#define MULT2( a0, a1 ) \ { \ - v128_t b = v128_xor( a0, \ - _mm_shuffle_epi32( v128_and( a1, MASK ), 0x10 ) ); \ + v128_t b = v128_xor( a0, v128_and( _mm_shuffle_epi32( a1, 0 ), MASK ) ); \ a0 = v128_or( _mm_srli_si128( b, 4 ), _mm_slli_si128( a1, 12 ) ); \ a1 = v128_or( _mm_srli_si128( a1, 4 ), _mm_slli_si128( b, 12 ) ); \ -} while(0) +} #endif @@ -137,8 +133,8 @@ const uint32x4_t mask = { 0xffffffff, 0, 0xffffffff, 0xffffffff }; t0 = v128_shufll32( a1 ); \ a1 = v128_unpacklo32( t0, a0 ); \ t0 = v128_unpackhi32( t0, a0 ); \ - t1 = v128_swap64( t0 ); \ - a0 = v128_swap64( a1 ); \ + t1 = v128_rev64( t0 ); \ + a0 = v128_rev64( a1 ); \ SUBCRUMB( t1, t0, a0, a1 ); \ t0 = v128_unpacklo32( t0, t1 ); \ a1 = v128_unpacklo32( a1, a0 ); \ @@ -224,9 +220,10 @@ static const uint32_t CNS_INIT[128] __attribute((aligned(16))) = { }; -v128_t CNS128[32]; +static v128_t CNS128[32]; + #if !defined(__SSE4_1__) -v128_t MASK; +static v128_t MASK; #endif int init_luffa(hashState_luffa *state, int hashbitlen) @@ -235,13 +232,13 @@ int init_luffa(hashState_luffa *state, int hashbitlen) state->hashbitlen = hashbitlen; #if !defined(__SSE4_1__) /* set the lower 32 bits to '1' */ - MASK = v128_set32(0x00000000, 0x00000000, 0x00000000, 0xffffffff); + MASK = v128_set32( 0xffffffff, 0, 0xffffffff, 0xffffffff ); #endif /* set the 32-bit round constant values to the 128-bit data field */ for ( i=0; i<32; i++ ) CNS128[i] = v128_load( (v128_t*)&CNS_INIT[i*4] ); for ( i=0; i<10; i++ ) - state->chainv[i] = v128_load( (v128_t*)&IV[i*4] ); + state->chainv[i] = v128_load( (v128_t*)&IV[i*4] ); memset(state->buffer, 0, sizeof state->buffer ); return 0; } @@ -268,7 +265,7 @@ int update_luffa( hashState_luffa *state, const void *data, // remaining data bytes casti_v128( state->buffer, 0 ) = v128_bswap32( cast_v128( data ) ); // padding of partial block - casti_v128( state->buffer, 1 ) = v128_set32( 0, 0, 0, 0x80000000 ); + casti_v128( state->buffer, 1 ) = v128_set32( 0, 0, 0, 0x80000000 ); } return 0; @@ -327,7 +324,6 @@ int update_and_final_luffa( hashState_luffa *state, void* output, return 0; } - int luffa_full( hashState_luffa *state, void* output, int hashbitlen, const void* data, size_t inlen ) { @@ -336,13 +332,13 @@ int luffa_full( hashState_luffa *state, void* output, int hashbitlen, state->hashbitlen = hashbitlen; #if !defined(__SSE4_1__) /* set the lower 32 bits to '1' */ - MASK= v128_set64( 0, 0x00000000ffffffff ); + MASK= v128_set32( 0xffffffff, 0, 0xffffffff, 0xffffffff ); #endif /* set the 32-bit round constant values to the 128-bit data field */ for ( i=0; i<32; i++ ) - CNS128[i] = v128_load( (v128_t*)&CNS_INIT[i*4] ); + CNS128[i] = casti_v128( CNS_INIT, i ); for ( i=0; i<10; i++ ) - state->chainv[i] = v128_load( (v128_t*)&IV[i*4] ); + state->chainv[i] = casti_v128( IV, i ); memset(state->buffer, 0, sizeof state->buffer ); // update @@ -376,16 +372,15 @@ int luffa_full( hashState_luffa *state, void* output, int hashbitlen, return 0; } - /***************************************************/ /* Round function */ /* state: hash context */ static void rnd512( hashState_luffa *state, v128_t msg1, v128_t msg0 ) { - v128_t t0, t1; - v128_t *chainv = state->chainv; - v128_t x0, x1, x2, x3, x4, x5, x6, x7; + v128u32_t t0, t1; + v128u32_t *chainv = state->chainv; + v128u32_t x0, x1, x2, x3, x4, x5, x6, x7; t0 = v128_xor3( chainv[0], chainv[2], chainv[4] ); t1 = v128_xor3( chainv[1], chainv[3], chainv[5] ); @@ -472,7 +467,7 @@ static void rnd512( hashState_luffa *state, v128_t msg1, v128_t msg0 ) chainv[5] = v128_rol32( chainv[5], 2 ); chainv[7] = v128_rol32( chainv[7], 3 ); chainv[9] = v128_rol32( chainv[9], 4 ); - + NMLTOM1024( chainv[0], chainv[2], chainv[4], chainv[6], x0, x1, x2, x3, chainv[1], chainv[3], chainv[5], chainv[7], x4, x5, x6, x7 ); diff --git a/algo/lyra2/allium-4way.c b/algo/lyra2/allium-4way.c index e49e5c70..c1e840af 100644 --- a/algo/lyra2/allium-4way.c +++ b/algo/lyra2/allium-4way.c @@ -11,7 +11,7 @@ #endif #include "algo/keccak/sph_keccak.h" #include "algo/skein/sph_skein.h" -#if !( defined(__AES__) || defined(__ARM_FEATURE_AES) ) +#if !defined(__AES__) // && !defined(__ARM_FEATURE_AES) ) #include "algo/groestl/sph_groestl.h" #endif @@ -19,7 +19,7 @@ #define ALLIUM_16WAY 1 #elif defined(__AVX2__) #define ALLIUM_8WAY 1 -#elif #defined(__SSE2__) || defined(__ARM_NEON) +#elif defined(__SSE2__) || defined(__ARM_NEON) #define ALLIUM_4WAY 1 #endif @@ -30,7 +30,7 @@ typedef union { cube_4way_2buf_context cube; skein256_8way_context skein; #if defined(__VAES__) - groestl256_4way_context groestl; + groestl256_4way_context groestl; #else hashState_groestl256 groestl; #endif @@ -465,12 +465,12 @@ typedef union { keccak256_2x64_context keccak; cubehashParam cube; -#if defined(__x86_64__) +//#if defined(__x86_64__) skein256_2x64_context skein; -#else - sph_skein512_context skein; -#endif -#if defined(__AES__) || defined(__ARM_FEATURE_AES) +//#else +// sph_skein512_context skein; +//#endif +#if defined(__AES__) // || defined(__ARM_FEATURE_AES) hashState_groestl256 groestl; #else sph_groestl256_context groestl; @@ -516,7 +516,7 @@ static void allium_4way_hash( void *hash, const void *midstate_vars, LYRA2RE( hash2, 32, hash2, 32, hash2, 32, 1, 8, 8 ); LYRA2RE( hash3, 32, hash3, 32, hash3, 32, 1, 8, 8 ); -#if defined(__x86_64__) +//#if defined(__x86_64__) intrlv_2x64( vhashA, hash0, hash1, 256 ); skein256_2x64_init( &ctx.skein ); skein256_2x64_update( &ctx.skein, vhashA, 32 ); @@ -527,6 +527,7 @@ static void allium_4way_hash( void *hash, const void *midstate_vars, skein256_2x64_update( &ctx.skein, vhashA, 32 ); skein256_2x64_close( &ctx.skein, vhashA ); dintrlv_2x64( hash2, hash3, vhashA, 256 ); +/* #else sph_skein256_init( &ctx.skein ); sph_skein256( &ctx.skein, hash0, 32 ); @@ -541,8 +542,8 @@ static void allium_4way_hash( void *hash, const void *midstate_vars, sph_skein256( &ctx.skein, hash3, 32 ); sph_skein256_close( &ctx.skein, hash3 ); #endif - -#if defined(__AES__) || defined(__ARM_FEATURE_AES) +*/ +#if defined(__AES__) // || defined(__ARM_FEATURE_AES) groestl256_full( &ctx.groestl, hash0, hash0, 256 ); groestl256_full( &ctx.groestl, hash1, hash1, 256 ); groestl256_full( &ctx.groestl, hash2, hash2, 256 ); diff --git a/algo/scrypt/scrypt.c b/algo/scrypt/scrypt.c index 9891aba5..e0ab88be 100644 --- a/algo/scrypt/scrypt.c +++ b/algo/scrypt/scrypt.c @@ -35,41 +35,47 @@ //#include #include "malloc-huge.h" -static const uint32_t keypad[12] = { - 0x80000000, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x00000280 -}; -static const uint32_t innerpad[11] = { - 0x80000000, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x000004a0 -}; -static const uint32_t outerpad[8] = { - 0x80000000, 0, 0, 0, 0, 0, 0, 0x00000300 -}; -static const uint32_t finalblk[16] = { - 0x00000001, 0x80000000, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x00000620 -}; - -static const uint32_t sha256_initial_state[8] = -{ - 0x6A09E667, 0xBB67AE85, 0x3C6EF372, 0xA54FF53A, - 0x510E527F, 0x9B05688C, 0x1F83D9AB, 0x5BE0CD19 -}; - #if defined(__AVX512F__) && defined(__AVX512VL__) && defined(__AVX512DQ__) && defined(__AVX512BW__) #define SCRYPT_THROUGHPUT 16 #elif defined(__SHA__) || defined(__ARM_FEATURE_SHA2) #define SCRYPT_THROUGHPUT 2 #elif defined(__AVX2__) #define SCRYPT_THROUGHPUT 8 -#else +#elif defined(__SSE2__) || defined(__ARM_NEON) #define SCRYPT_THROUGHPUT 4 +#else + #define SCRYPT_THROUGHPUT 1 #endif -// static int scrypt_throughput = 0; +static const uint32_t sha256_initial_state[8] __attribute((aligned(32))) = +{ + 0x6A09E667, 0xBB67AE85, 0x3C6EF372, 0xA54FF53A, + 0x510E527F, 0x9B05688C, 0x1F83D9AB, 0x5BE0CD19 +}; static int scratchbuf_size = 0; - static __thread uint32_t *scratchbuf = NULL; +#if (SCRYPT_THROUGHPUT == 1) || defined(__SHA__) || defined(__ARM_FEATURE_SHA2) + +static const uint32_t keypad[12] __attribute((aligned(16))) = +{ + 0x80000000, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x00000280 +}; +static const uint32_t innerpad[11] __attribute((aligned(16))) = +{ + 0x80000000, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x000004a0 +}; +static const uint32_t outerpad[8] __attribute((aligned(16))) = +{ + 0x80000000, 0, 0, 0, 0, 0, 0, 0x00000300 +}; +static const uint32_t finalblk[16] __attribute((aligned(16))) = +{ + 0x00000001, 0x80000000, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x00000620 +}; + + // change this to a constant to be used directly as input state arg // vectors still need an init function. static inline void sha256_init_state( uint32_t *state ) @@ -155,6 +161,8 @@ static inline void PBKDF2_SHA256_128_32(uint32_t *tstate, uint32_t *ostate, output[i] = bswap_32( ostate[i] ); } +#endif // throughput 1 + // #if defined(__SHA__) || defined(__ARM_FEATURE_SHA2) static inline void HMAC_SHA256_80_init_SHA_2BUF( const uint32_t *key0, @@ -269,7 +277,8 @@ static inline void PBKDF2_SHA256_128_32_SHA_2BUF( uint32_t *tstate0, -static const uint32_t keypad_4way[4 * 12] = { +static const uint32_t keypad_4way[ 4*12 ] __attribute((aligned(32))) = +{ 0x80000000, 0x80000000, 0x80000000, 0x80000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, @@ -283,7 +292,8 @@ static const uint32_t keypad_4way[4 * 12] = { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000280, 0x00000280, 0x00000280, 0x00000280 }; -static const uint32_t innerpad_4way[4 * 11] = { +static const uint32_t innerpad_4way[ 4*11 ] __attribute((aligned(32))) = +{ 0x80000000, 0x80000000, 0x80000000, 0x80000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, @@ -296,7 +306,8 @@ static const uint32_t innerpad_4way[4 * 11] = { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x000004a0, 0x000004a0, 0x000004a0, 0x000004a0 }; -static const uint32_t outerpad_4way[4 * 8] = { +static const uint32_t outerpad_4way[ 4*8 ] __attribute((aligned(32))) = +{ 0x80000000, 0x80000000, 0x80000000, 0x80000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, diff --git a/algo/sha/sha2.c b/algo/sha/sha2.c deleted file mode 100644 index 358b5658..00000000 --- a/algo/sha/sha2.c +++ /dev/null @@ -1,681 +0,0 @@ -/* - * Copyright 2011 ArtForz - * Copyright 2011-2013 pooler - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by the Free - * Software Foundation; either version 2 of the License, or (at your option) - * any later version. See COPYING for more details. - */ - -#include "sha256d-4way.h" - -#include -#include - -#if defined(USE_ASM) && defined(__arm__) && defined(__APCS_32__) -#define EXTERN_SHA256 -#endif - -static const uint32_t sha256_h[8] = { - 0x6a09e667, 0xbb67ae85, 0x3c6ef372, 0xa54ff53a, - 0x510e527f, 0x9b05688c, 0x1f83d9ab, 0x5be0cd19 -}; - -static const uint32_t sha256_k[64] = { - 0x428a2f98, 0x71374491, 0xb5c0fbcf, 0xe9b5dba5, - 0x3956c25b, 0x59f111f1, 0x923f82a4, 0xab1c5ed5, - 0xd807aa98, 0x12835b01, 0x243185be, 0x550c7dc3, - 0x72be5d74, 0x80deb1fe, 0x9bdc06a7, 0xc19bf174, - 0xe49b69c1, 0xefbe4786, 0x0fc19dc6, 0x240ca1cc, - 0x2de92c6f, 0x4a7484aa, 0x5cb0a9dc, 0x76f988da, - 0x983e5152, 0xa831c66d, 0xb00327c8, 0xbf597fc7, - 0xc6e00bf3, 0xd5a79147, 0x06ca6351, 0x14292967, - 0x27b70a85, 0x2e1b2138, 0x4d2c6dfc, 0x53380d13, - 0x650a7354, 0x766a0abb, 0x81c2c92e, 0x92722c85, - 0xa2bfe8a1, 0xa81a664b, 0xc24b8b70, 0xc76c51a3, - 0xd192e819, 0xd6990624, 0xf40e3585, 0x106aa070, - 0x19a4c116, 0x1e376c08, 0x2748774c, 0x34b0bcb5, - 0x391c0cb3, 0x4ed8aa4a, 0x5b9cca4f, 0x682e6ff3, - 0x748f82ee, 0x78a5636f, 0x84c87814, 0x8cc70208, - 0x90befffa, 0xa4506ceb, 0xbef9a3f7, 0xc67178f2 -}; - -void sha256_init(uint32_t *state) -{ - memcpy(state, sha256_h, 32); -} - -/* Elementary functions used by SHA256 */ -#define Ch(x, y, z) ((x & (y ^ z)) ^ z) -#define Maj(x, y, z) ((x & (y | z)) | (y & z)) -#define ROTR(x, n) ((x >> n) | (x << (32 - n))) -#define S0(x) (ROTR(x, 2) ^ ROTR(x, 13) ^ ROTR(x, 22)) -#define S1(x) (ROTR(x, 6) ^ ROTR(x, 11) ^ ROTR(x, 25)) -#define s0(x) (ROTR(x, 7) ^ ROTR(x, 18) ^ (x >> 3)) -#define s1(x) (ROTR(x, 17) ^ ROTR(x, 19) ^ (x >> 10)) - -/* SHA256 round function */ -#define RND(a, b, c, d, e, f, g, h, k) \ - do { \ - t0 = h + S1(e) + Ch(e, f, g) + k; \ - t1 = S0(a) + Maj(a, b, c); \ - d += t0; \ - h = t0 + t1; \ - } while (0) - -/* Adjusted round function for rotating state */ -#define RNDr(S, W, i) \ - RND(S[(64 - i) % 8], S[(65 - i) % 8], \ - S[(66 - i) % 8], S[(67 - i) % 8], \ - S[(68 - i) % 8], S[(69 - i) % 8], \ - S[(70 - i) % 8], S[(71 - i) % 8], \ - W[i] + sha256_k[i]) - -#ifndef EXTERN_SHA256 - -/* - * SHA256 block compression function. The 256-bit state is transformed via - * the 512-bit input block to produce a new state. - */ -void sha256_transform(uint32_t *state, const uint32_t *block, int swap) -{ - uint32_t W[64]; - uint32_t S[8]; - uint32_t t0, t1; - int i; - - /* 1. Prepare message schedule W. */ - if (swap) { - for (i = 0; i < 16; i++) - W[i] = swab32(block[i]); - } else - memcpy(W, block, 64); - for (i = 16; i < 64; i += 2) { - W[i] = s1(W[i - 2]) + W[i - 7] + s0(W[i - 15]) + W[i - 16]; - W[i+1] = s1(W[i - 1]) + W[i - 6] + s0(W[i - 14]) + W[i - 15]; - } - - /* 2. Initialize working variables. */ - memcpy(S, state, 32); - - /* 3. Mix. */ - RNDr(S, W, 0); - RNDr(S, W, 1); - RNDr(S, W, 2); - RNDr(S, W, 3); - RNDr(S, W, 4); - RNDr(S, W, 5); - RNDr(S, W, 6); - RNDr(S, W, 7); - RNDr(S, W, 8); - RNDr(S, W, 9); - RNDr(S, W, 10); - RNDr(S, W, 11); - RNDr(S, W, 12); - RNDr(S, W, 13); - RNDr(S, W, 14); - RNDr(S, W, 15); - RNDr(S, W, 16); - RNDr(S, W, 17); - RNDr(S, W, 18); - RNDr(S, W, 19); - RNDr(S, W, 20); - RNDr(S, W, 21); - RNDr(S, W, 22); - RNDr(S, W, 23); - RNDr(S, W, 24); - RNDr(S, W, 25); - RNDr(S, W, 26); - RNDr(S, W, 27); - RNDr(S, W, 28); - RNDr(S, W, 29); - RNDr(S, W, 30); - RNDr(S, W, 31); - RNDr(S, W, 32); - RNDr(S, W, 33); - RNDr(S, W, 34); - RNDr(S, W, 35); - RNDr(S, W, 36); - RNDr(S, W, 37); - RNDr(S, W, 38); - RNDr(S, W, 39); - RNDr(S, W, 40); - RNDr(S, W, 41); - RNDr(S, W, 42); - RNDr(S, W, 43); - RNDr(S, W, 44); - RNDr(S, W, 45); - RNDr(S, W, 46); - RNDr(S, W, 47); - RNDr(S, W, 48); - RNDr(S, W, 49); - RNDr(S, W, 50); - RNDr(S, W, 51); - RNDr(S, W, 52); - RNDr(S, W, 53); - RNDr(S, W, 54); - RNDr(S, W, 55); - RNDr(S, W, 56); - RNDr(S, W, 57); - RNDr(S, W, 58); - RNDr(S, W, 59); - RNDr(S, W, 60); - RNDr(S, W, 61); - RNDr(S, W, 62); - RNDr(S, W, 63); - - /* 4. Mix local working variables into global state */ - for (i = 0; i < 8; i++) - state[i] += S[i]; -} - -#endif /* EXTERN_SHA256 */ - - -static const uint32_t sha256d_hash1[16] = { - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x80000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000100 -}; - -// this performs the entire hash all over again, why? -// because main function only does 56 rounds. - -static void sha256d_80_swap(uint32_t *hash, const uint32_t *data) -{ - uint32_t S[16]; - int i; - - sha256_init(S); - sha256_transform(S, data, 0); - sha256_transform(S, data + 16, 0); - memcpy(S + 8, sha256d_hash1 + 8, 32); - sha256_init(hash); - sha256_transform(hash, S, 0); - for (i = 0; i < 8; i++) - hash[i] = swab32(hash[i]); -} - -/* -#if defined (__SHA__) - -#include "algo/sha/sph_sha2.h" - -void sha256d(unsigned char *hash, const unsigned char *data, int len) -{ - sph_sha256_context ctx __attribute__ ((aligned (64))); - - sph_sha256_init( &ctx ); - sph_sha256( &ctx, data, len ); - sph_sha256_close( &ctx, hash ); - - sph_sha256_init( &ctx ); - sph_sha256( &ctx, hash, 32 ); - sph_sha256_close( &ctx, hash ); -} - -#else - -void sha256d(unsigned char *hash, const unsigned char *data, int len) -{ - - uint32_t S[16], T[16]; - int i, r; - - sha256_init(S); - for (r = len; r > -9; r -= 64) { - if (r < 64) - memset(T, 0, 64); - memcpy(T, data + len - r, r > 64 ? 64 : (r < 0 ? 0 : r)); - if (r >= 0 && r < 64) - ((unsigned char *)T)[r] = 0x80; - for (i = 0; i < 16; i++) - T[i] = be32dec(T + i); - if (r < 56) - T[15] = 8 * len; - sha256_transform(S, T, 0); - } - memcpy(S + 8, sha256d_hash1 + 8, 32); - sha256_init(T); - sha256_transform(T, S, 0); - for (i = 0; i < 8; i++) - be32enc((uint32_t *)hash + i, T[i]); -} - -#endif -*/ - -static inline void sha256d_preextend(uint32_t *W) -{ - W[16] = s1(W[14]) + W[ 9] + s0(W[ 1]) + W[ 0]; - W[17] = s1(W[15]) + W[10] + s0(W[ 2]) + W[ 1]; - W[18] = s1(W[16]) + W[11] + W[ 2]; - W[19] = s1(W[17]) + W[12] + s0(W[ 4]); - W[20] = W[13] + s0(W[ 5]) + W[ 4]; - W[21] = W[14] + s0(W[ 6]) + W[ 5]; - W[22] = W[15] + s0(W[ 7]) + W[ 6]; - W[23] = W[16] + s0(W[ 8]) + W[ 7]; - W[24] = W[17] + s0(W[ 9]) + W[ 8]; - W[25] = s0(W[10]) + W[ 9]; - W[26] = s0(W[11]) + W[10]; - W[27] = s0(W[12]) + W[11]; - W[28] = s0(W[13]) + W[12]; - W[29] = s0(W[14]) + W[13]; - W[30] = s0(W[15]) + W[14]; - W[31] = s0(W[16]) + W[15]; -} - -static inline void sha256d_prehash(uint32_t *S, const uint32_t *W) -{ - uint32_t t0, t1; - RNDr(S, W, 0); - RNDr(S, W, 1); - RNDr(S, W, 2); -} - -#ifdef EXTERN_SHA256 - -void sha256d_ms(uint32_t *hash, uint32_t *W, - const uint32_t *midstate, const uint32_t *prehash); - -#else - -static inline void sha256d_ms(uint32_t *hash, uint32_t *W, - const uint32_t *midstate, const uint32_t *prehash) -{ - uint32_t S[64]; - uint32_t t0, t1; - int i; - - S[18] = W[18]; - S[19] = W[19]; - S[20] = W[20]; - S[22] = W[22]; - S[23] = W[23]; - S[24] = W[24]; - S[30] = W[30]; - S[31] = W[31]; - - W[18] += s0(W[3]); - W[19] += W[3]; - W[20] += s1(W[18]); - W[21] = s1(W[19]); - W[22] += s1(W[20]); - W[23] += s1(W[21]); - W[24] += s1(W[22]); - W[25] = s1(W[23]) + W[18]; - W[26] = s1(W[24]) + W[19]; - W[27] = s1(W[25]) + W[20]; - W[28] = s1(W[26]) + W[21]; - W[29] = s1(W[27]) + W[22]; - W[30] += s1(W[28]) + W[23]; - W[31] += s1(W[29]) + W[24]; - for (i = 32; i < 64; i += 2) { - W[i] = s1(W[i - 2]) + W[i - 7] + s0(W[i - 15]) + W[i - 16]; - W[i+1] = s1(W[i - 1]) + W[i - 6] + s0(W[i - 14]) + W[i - 15]; - } - - memcpy(S, prehash, 32); - - RNDr(S, W, 3); - RNDr(S, W, 4); - RNDr(S, W, 5); - RNDr(S, W, 6); - RNDr(S, W, 7); - RNDr(S, W, 8); - RNDr(S, W, 9); - RNDr(S, W, 10); - RNDr(S, W, 11); - RNDr(S, W, 12); - RNDr(S, W, 13); - RNDr(S, W, 14); - RNDr(S, W, 15); - RNDr(S, W, 16); - RNDr(S, W, 17); - RNDr(S, W, 18); - RNDr(S, W, 19); - RNDr(S, W, 20); - RNDr(S, W, 21); - RNDr(S, W, 22); - RNDr(S, W, 23); - RNDr(S, W, 24); - RNDr(S, W, 25); - RNDr(S, W, 26); - RNDr(S, W, 27); - RNDr(S, W, 28); - RNDr(S, W, 29); - RNDr(S, W, 30); - RNDr(S, W, 31); - RNDr(S, W, 32); - RNDr(S, W, 33); - RNDr(S, W, 34); - RNDr(S, W, 35); - RNDr(S, W, 36); - RNDr(S, W, 37); - RNDr(S, W, 38); - RNDr(S, W, 39); - RNDr(S, W, 40); - RNDr(S, W, 41); - RNDr(S, W, 42); - RNDr(S, W, 43); - RNDr(S, W, 44); - RNDr(S, W, 45); - RNDr(S, W, 46); - RNDr(S, W, 47); - RNDr(S, W, 48); - RNDr(S, W, 49); - RNDr(S, W, 50); - RNDr(S, W, 51); - RNDr(S, W, 52); - RNDr(S, W, 53); - RNDr(S, W, 54); - RNDr(S, W, 55); - RNDr(S, W, 56); - RNDr(S, W, 57); - RNDr(S, W, 58); - RNDr(S, W, 59); - RNDr(S, W, 60); - RNDr(S, W, 61); - RNDr(S, W, 62); - RNDr(S, W, 63); - - for (i = 0; i < 8; i++) - S[i] += midstate[i]; - - W[18] = S[18]; - W[19] = S[19]; - W[20] = S[20]; - W[22] = S[22]; - W[23] = S[23]; - W[24] = S[24]; - W[30] = S[30]; - W[31] = S[31]; - - memcpy(S + 8, sha256d_hash1 + 8, 32); - S[16] = s1(sha256d_hash1[14]) + sha256d_hash1[ 9] + s0(S[ 1]) + S[ 0]; - S[17] = s1(sha256d_hash1[15]) + sha256d_hash1[10] + s0(S[ 2]) + S[ 1]; - S[18] = s1(S[16]) + sha256d_hash1[11] + s0(S[ 3]) + S[ 2]; - S[19] = s1(S[17]) + sha256d_hash1[12] + s0(S[ 4]) + S[ 3]; - S[20] = s1(S[18]) + sha256d_hash1[13] + s0(S[ 5]) + S[ 4]; - S[21] = s1(S[19]) + sha256d_hash1[14] + s0(S[ 6]) + S[ 5]; - S[22] = s1(S[20]) + sha256d_hash1[15] + s0(S[ 7]) + S[ 6]; - S[23] = s1(S[21]) + S[16] + s0(sha256d_hash1[ 8]) + S[ 7]; - S[24] = s1(S[22]) + S[17] + s0(sha256d_hash1[ 9]) + sha256d_hash1[ 8]; - S[25] = s1(S[23]) + S[18] + s0(sha256d_hash1[10]) + sha256d_hash1[ 9]; - S[26] = s1(S[24]) + S[19] + s0(sha256d_hash1[11]) + sha256d_hash1[10]; - S[27] = s1(S[25]) + S[20] + s0(sha256d_hash1[12]) + sha256d_hash1[11]; - S[28] = s1(S[26]) + S[21] + s0(sha256d_hash1[13]) + sha256d_hash1[12]; - S[29] = s1(S[27]) + S[22] + s0(sha256d_hash1[14]) + sha256d_hash1[13]; - S[30] = s1(S[28]) + S[23] + s0(sha256d_hash1[15]) + sha256d_hash1[14]; - S[31] = s1(S[29]) + S[24] + s0(S[16]) + sha256d_hash1[15]; - for (i = 32; i < 60; i += 2) { - S[i] = s1(S[i - 2]) + S[i - 7] + s0(S[i - 15]) + S[i - 16]; - S[i+1] = s1(S[i - 1]) + S[i - 6] + s0(S[i - 14]) + S[i - 15]; - } - S[60] = s1(S[58]) + S[53] + s0(S[45]) + S[44]; - - sha256_init(hash); - - RNDr(hash, S, 0); - RNDr(hash, S, 1); - RNDr(hash, S, 2); - RNDr(hash, S, 3); - RNDr(hash, S, 4); - RNDr(hash, S, 5); - RNDr(hash, S, 6); - RNDr(hash, S, 7); - RNDr(hash, S, 8); - RNDr(hash, S, 9); - RNDr(hash, S, 10); - RNDr(hash, S, 11); - RNDr(hash, S, 12); - RNDr(hash, S, 13); - RNDr(hash, S, 14); - RNDr(hash, S, 15); - RNDr(hash, S, 16); - RNDr(hash, S, 17); - RNDr(hash, S, 18); - RNDr(hash, S, 19); - RNDr(hash, S, 20); - RNDr(hash, S, 21); - RNDr(hash, S, 22); - RNDr(hash, S, 23); - RNDr(hash, S, 24); - RNDr(hash, S, 25); - RNDr(hash, S, 26); - RNDr(hash, S, 27); - RNDr(hash, S, 28); - RNDr(hash, S, 29); - RNDr(hash, S, 30); - RNDr(hash, S, 31); - RNDr(hash, S, 32); - RNDr(hash, S, 33); - RNDr(hash, S, 34); - RNDr(hash, S, 35); - RNDr(hash, S, 36); - RNDr(hash, S, 37); - RNDr(hash, S, 38); - RNDr(hash, S, 39); - RNDr(hash, S, 40); - RNDr(hash, S, 41); - RNDr(hash, S, 42); - RNDr(hash, S, 43); - RNDr(hash, S, 44); - RNDr(hash, S, 45); - RNDr(hash, S, 46); - RNDr(hash, S, 47); - RNDr(hash, S, 48); - RNDr(hash, S, 49); - RNDr(hash, S, 50); - RNDr(hash, S, 51); - RNDr(hash, S, 52); - RNDr(hash, S, 53); - RNDr(hash, S, 54); - RNDr(hash, S, 55); - RNDr(hash, S, 56); - - hash[2] += hash[6] + S1(hash[3]) + Ch(hash[3], hash[4], hash[5]) - + S[57] + sha256_k[57]; - hash[1] += hash[5] + S1(hash[2]) + Ch(hash[2], hash[3], hash[4]) - + S[58] + sha256_k[58]; - hash[0] += hash[4] + S1(hash[1]) + Ch(hash[1], hash[2], hash[3]) - + S[59] + sha256_k[59]; - hash[7] += hash[3] + S1(hash[0]) + Ch(hash[0], hash[1], hash[2]) - + S[60] + sha256_k[60] - + sha256_h[7]; -} - -#endif /* EXTERN_SHA256 */ - -#ifdef HAVE_SHA256_4WAY - -void sha256d_ms_4way(uint32_t *hash, uint32_t *data, - const uint32_t *midstate, const uint32_t *prehash); - -static inline int scanhash_sha256d_4way_pooler( struct work *work, - uint32_t max_nonce, uint64_t *hashes_done, struct thr_info *mythr ) -{ - uint32_t *pdata = work->data; - uint32_t *ptarget = work->target; - - uint32_t _ALIGN(128) data[4 * 64]; - uint32_t _ALIGN(32) hash[4 * 8]; - uint32_t _ALIGN(32) midstate[4 * 8]; - uint32_t _ALIGN(32) prehash[4 * 8]; - uint32_t n = pdata[19] - 1; - const uint32_t first_nonce = pdata[19]; - const uint32_t Htarg = ptarget[7]; - int thr_id = mythr->id; - int i, j; - - memcpy(data, pdata + 16, 64); - sha256d_preextend(data); - for (i = 31; i >= 0; i--) - for (j = 0; j < 4; j++) - data[i * 4 + j] = data[i]; - - sha256_init(midstate); - sha256_transform(midstate, pdata, 0); - memcpy(prehash, midstate, 32); - sha256d_prehash(prehash, pdata + 16); - for (i = 7; i >= 0; i--) { - for (j = 0; j < 4; j++) { - midstate[i * 4 + j] = midstate[i]; - prehash[i * 4 + j] = prehash[i]; - } - } - - do { - for (i = 0; i < 4; i++) - data[4 * 3 + i] = ++n; - - sha256d_ms_4way(hash, data, midstate, prehash); - - for (i = 0; i < 4; i++) { - if (swab32(hash[4 * 7 + i]) <= Htarg) { - pdata[19] = data[4 * 3 + i]; - sha256d_80_swap(hash, pdata); - if ( fulltest( hash, ptarget ) && !opt_benchmark ) - submit_solution( work, hash, mythr ); - } - } - } while (n < max_nonce && !work_restart[thr_id].restart); - - *hashes_done = n - first_nonce + 1; - pdata[19] = n; - return 0; -} - -#endif /* HAVE_SHA256_4WAY */ - -#ifdef HAVE_SHA256_8WAY - -void sha256d_ms_8way(uint32_t *hash, uint32_t *data, - const uint32_t *midstate, const uint32_t *prehash); - -static inline int scanhash_sha256d_8way_pooler( struct work *work, - uint32_t max_nonce, uint64_t *hashes_done, struct thr_info *mythr ) -{ - uint32_t *pdata = work->data; - uint32_t *ptarget = work->target; - - uint32_t _ALIGN(128) data[8 * 64]; - uint32_t _ALIGN(32) hash[8 * 8]; - uint32_t _ALIGN(32) midstate[8 * 8]; - uint32_t _ALIGN(32) prehash[8 * 8]; - uint32_t n = pdata[19] - 1; - const uint32_t first_nonce = pdata[19]; - const uint32_t Htarg = ptarget[7]; - int thr_id = mythr->id; - int i, j; - - memcpy(data, pdata + 16, 64); - sha256d_preextend(data); - for (i = 31; i >= 0; i--) - for (j = 0; j < 8; j++) - data[i * 8 + j] = data[i]; - - sha256_init(midstate); - sha256_transform(midstate, pdata, 0); - memcpy(prehash, midstate, 32); - sha256d_prehash(prehash, pdata + 16); - for (i = 7; i >= 0; i--) { - for (j = 0; j < 8; j++) { - midstate[i * 8 + j] = midstate[i]; - prehash[i * 8 + j] = prehash[i]; - } - } - - do { - for (i = 0; i < 8; i++) - data[8 * 3 + i] = ++n; - - sha256d_ms_8way(hash, data, midstate, prehash); - - for (i = 0; i < 8; i++) { - if (swab32(hash[8 * 7 + i]) <= Htarg) { - pdata[19] = data[8 * 3 + i]; - sha256d_80_swap(hash, pdata); - if ( fulltest( hash, ptarget ) && !opt_benchmark ) - submit_solution( work, hash, mythr ); - } - } - } while (n < max_nonce && !work_restart[thr_id].restart); - - *hashes_done = n - first_nonce + 1; - pdata[19] = n; - return 0; -} - -#endif /* HAVE_SHA256_8WAY */ - -int scanhash_sha256d_pooler( struct work *work, uint32_t max_nonce, - uint64_t *hashes_done, struct thr_info *mythr ) -{ - uint32_t *pdata = work->data; - uint32_t *ptarget = work->target; - uint32_t _ALIGN(128) data[64]; - uint32_t _ALIGN(32) hash[8]; - uint32_t _ALIGN(32) midstate[8]; - uint32_t _ALIGN(32) prehash[8]; - uint32_t n = pdata[19] - 1; - const uint32_t first_nonce = pdata[19]; - const uint32_t Htarg = ptarget[7]; - int thr_id = mythr->id; // thr_id arg is deprecated - -#ifdef HAVE_SHA256_8WAY - if ( sha256_use_8way() ) - return scanhash_sha256d_8way_pooler( work, max_nonce, hashes_done, mythr ); -#endif -#ifdef HAVE_SHA256_4WAY - if ( sha256_use_4way() ) - return scanhash_sha256d_4way_pooler( work, max_nonce, hashes_done, mythr ); -#endif - - memcpy(data, pdata + 16, 64); - sha256d_preextend(data); - - sha256_init(midstate); - sha256_transform(midstate, pdata, 0); - memcpy(prehash, midstate, 32); - sha256d_prehash(prehash, pdata + 16); - - do { - data[3] = ++n; - sha256d_ms(hash, data, midstate, prehash); - if (unlikely(swab32(hash[7]) <= Htarg)) - { - pdata[19] = data[3]; - sha256d_80_swap(hash, pdata); - if ( fulltest(hash, ptarget) && !opt_benchmark ) - submit_solution( work, hash, mythr ); - } - } while (likely(n < max_nonce && !work_restart[thr_id].restart)); - *hashes_done = n - first_nonce + 1; - pdata[19] = n; - return 0; -} - -bool register_sha256d_algo( algo_gate_t* gate ) -{ - gate->optimizations = SSE2_OPT | AVX2_OPT | AVX512_OPT; -#if defined(SHA256D_16WAY) - gate->scanhash = (void*)&scanhash_sha256d_16way; -#elif defined(SHA256D_SHA) - gate->optimizations = SHA_OPT; - gate->scanhash = (void*)&scanhash_sha256d_sha; -#elif defined(SHA256D_NEON_SHA2) - gate->optimizations = SHA_OPT; - gate->scanhash = (void*)&scanhash_sha256d_neon_sha2; -//#elif defined(SHA256D_8WAY) -// gate->scanhash = (void*)&scanhash_sha256d_8way; -#else - gate->scanhash = (void*)&scanhash_sha256d_pooler; -// gate->scanhash = (void*)&scanhash_sha256d_4way; -#endif - // gate->hash = (void*)&sha256d; - return true; -}; - diff --git a/algo/sha/sha256-hash.c b/algo/sha/sha256-hash.c index b4da6739..2f3b3015 100644 --- a/algo/sha/sha256-hash.c +++ b/algo/sha/sha256-hash.c @@ -1200,7 +1200,7 @@ void sha256_neon_sha_transform_le( uint32_t *state_out, const void *input, MSG2_Y = vsha256su1q_u32( MSG2_Y, MSG0_Y, MSG1_Y ); \ /* Rounds 44-47 */ \ MSG3_X = vsha256su0q_u32( MSG3_X, MSG0_X ); \ - MSG3_Y = vsha256su0q_u32( MSG3_X, MSG0_Y ); \ + MSG3_Y = vsha256su0q_u32( MSG3_Y, MSG0_Y ); \ TMP2_X = STATE0_X; \ TMP2_Y = STATE0_Y; \ TMP0_X = vaddq_u32( MSG0_X, casti_v128( K256, 12 ) ); \ diff --git a/algo/sha/sha256d-4way.c b/algo/sha/sha256d-4way.c index 870b3473..b0a2a487 100644 --- a/algo/sha/sha256d-4way.c +++ b/algo/sha/sha256d-4way.c @@ -1,9 +1,9 @@ -#include "sha256d-4way.h" #include #include #include #include #include "sha256-hash.h" +#include "sha256d.h" static const uint32_t sha256_iv[8] __attribute__ ((aligned (32))) = { @@ -383,8 +383,6 @@ int scanhash_sha256d_4x32( struct work *work, const uint32_t max_nonce, const v128_t last_byte = v128_32( 0x80000000 ); const v128_t four = v128_32( 4 ); - memset( block, 0, 16*4*4 ); - for ( int i = 0; i < 19; i++ ) vdata[i] = v128_32( pdata[i] ); vdata[16+3] = v128_set32( n+3, n+2, n+1, n ); @@ -412,7 +410,6 @@ int scanhash_sha256d_4x32( struct work *work, const uint32_t max_nonce, do { sha256_4x32_final_rounds( block, vdata+16, mhash1, mhash2, mexp_pre ); -// sha256_4x32_transform_le( block, vdata+16, mhash1 ); sha256_4x32_transform_le( hash32, block, iv ); for ( int lane = 0; lane < 4; lane++ ) diff --git a/algo/sha/sha256d.c b/algo/sha/sha256d.c index ed4bd60d..3c56ad44 100644 --- a/algo/sha/sha256d.c +++ b/algo/sha/sha256d.c @@ -1,3 +1,4 @@ +#include "sha256-hash.h" #include "sha256d.h" void sha256d( void *hash, const void *data, int len ) @@ -5,4 +6,24 @@ void sha256d( void *hash, const void *data, int len ) sha256_full( hash, data, len ); sha256_full( hash, hash, 32 ); } +bool register_sha256d_algo( algo_gate_t* gate ) +{ + gate->optimizations = SSE2_OPT | AVX2_OPT | AVX512_OPT; +#if defined(SHA256D_16WAY) + gate->scanhash = (void*)&scanhash_sha256d_16way; +#elif defined(SHA256D_SHA) + gate->optimizations = SHA_OPT; + gate->scanhash = (void*)&scanhash_sha256d_sha; +#elif defined(SHA256D_NEON_SHA2) + gate->optimizations = SHA_OPT; + gate->scanhash = (void*)&scanhash_sha256d_neon_sha2; +#elif defined(SHA256D_8WAY) + gate->scanhash = (void*)&scanhash_sha256d_8way; +#elif defined(SHA256D_4WAY) + gate->scanhash = (void*)&scanhash_sha256d_4x32; +#else + gate->hash = (void*)&sha256d; +#endif + return true; +}; diff --git a/algo/sha/sha256d.h b/algo/sha/sha256d.h index 71f78eeb..35a093d8 100644 --- a/algo/sha/sha256d.h +++ b/algo/sha/sha256d.h @@ -1,7 +1,58 @@ +#ifndef __SHA256D_4WAY_H__ +#define __SHA256D_4WAY_H__ 1 + +#include #include "algo-gate-api.h" -#include -#include -#include "sha256-hash.h" + +#if defined(__AVX512F__) && defined(__AVX512VL__) && defined(__AVX512DQ__) && defined(__AVX512BW__) + #define SHA256D_16WAY 1 +#elif defined(__SHA__) + #define SHA256D_SHA 1 +#elif defined(__ARM_NEON) && defined(__ARM_FEATURE_SHA2) + #define SHA256D_NEON_SHA2 1 +#elif defined(__AVX2__) + #define SHA256D_8WAY 1 +#else + #define SHA256D_4WAY 1 +#endif + +bool register_sha256d_algo( algo_gate_t* gate ); + +#if defined(SHA256D_16WAY) + +int scanhash_sha256d_16way( struct work *work, uint32_t max_nonce, + uint64_t *hashes_done, struct thr_info *mythr ); +#endif + +#if defined(SHA256D_8WAY) + +int scanhash_sha256d_8way( struct work *work, uint32_t max_nonce, + uint64_t *hashes_done, struct thr_info *mythr ); +#endif + +#if defined(SHA256D_4WAY) + +int scanhash_sha256d_4x32( struct work *work, uint32_t max_nonce, + uint64_t *hashes_done, struct thr_info *mythr ); +#endif + +#if defined(SHA256D_SHA) + +int scanhash_sha256d_sha( struct work *work, uint32_t max_nonce, + uint64_t *hashes_done, struct thr_info *mythr ); + +#endif + +#if defined(SHA256D_NEON_SHA2) + +int scanhash_sha256d_neon_sha2( struct work *work, uint32_t max_nonce, + uint64_t *hashes_done, struct thr_info *mythr ); + +#endif void sha256d( void *hash, const void *data, int len ); +bool register_sha256d_algo( algo_gate_t* gate ); + +#endif + diff --git a/algo/sha/sha256dt.c b/algo/sha/sha256dt.c index 1bc4a35e..24cbdb4d 100644 --- a/algo/sha/sha256dt.c +++ b/algo/sha/sha256dt.c @@ -380,8 +380,6 @@ int scanhash_sha256dt_4x32( struct work *work, const uint32_t max_nonce, const v128_t last_byte = v128_32( 0x80000000 ); const v128_t four = v128_32( 4 ); - memset( block, 0, 16*4*4 ); - for ( int i = 0; i < 19; i++ ) vdata[i] = v128_32( pdata[i] ); vdata[16+3] = v128_set32( n+3, n+2, n+1, n ); diff --git a/algo/sha/sha256t-4way.c b/algo/sha/sha256t-4way.c index 4c444f0c..9b21b066 100644 --- a/algo/sha/sha256t-4way.c +++ b/algo/sha/sha256t-4way.c @@ -392,8 +392,6 @@ int scanhash_sha256t_4way( struct work *work, const uint32_t max_nonce, const v128_t last_byte = v128_32( 0x80000000 ); const v128_t four = v128_32( 4 ); - memset( block, 0, 16*4*4 ); - for ( int i = 0; i < 19; i++ ) vdata[i] = v128_32( pdata[i] ); vdata[16+3] = v128_set32( n+3, n+2, n+1, n ); diff --git a/algo/sha/sha512-hash-4way.c b/algo/sha/sha512-hash-4way.c index df47855c..2495c861 100644 --- a/algo/sha/sha512-hash-4way.c +++ b/algo/sha/sha512-hash-4way.c @@ -692,7 +692,7 @@ do { \ _mm256_xor_si256( _mm256_and_si256( _mm256_xor_si256( Y, Z ), X ), Z ) #define MAJ(X, Y, Z) \ - _mm256_xor_si256( Y, _mm256_and_si256( X_xor_Y = _mm256_xor_si256( X, Y ), \ + _mm256_xor_si256( Y, _mm256_and_si256( (X_xor_Y = _mm256_xor_si256( X, Y )), \ Y_xor_Z ) ) #define SHA3_4WAY_STEP( A, B, C, D, E, F, G, H, i ) \ @@ -892,7 +892,7 @@ void sha512_4x64_ctx( sha512_4x64_context *sc, void *dst, const void *data, v128_xor( v128_and( v128_xor( Y, Z ), X ), Z ) #define MAJ_2x64(X, Y, Z) \ - v128_xor( Y, v128_and( X_xor_Y = v128_xor( X, Y ), Y_xor_Z ) ) + v128_xor( Y, v128_and( (X_xor_Y = v128_xor( X, Y ) ), Y_xor_Z ) ) #define SHA3_2x64_STEP( A, B, C, D, E, F, G, H, i ) \ do { \ @@ -917,34 +917,20 @@ sha512_2x64_round( sha512_2x64_context *ctx, v128u64_t *in, v128u64_t r[8] ) v128u64_t W[80]; v128_block_bswap64( W , in ); - v128_block_bswap64( (&W[8]), (&in[8]) ); + v128_block_bswap64( W+8, in+8 ); for ( i = 16; i < 80; i++ ) W[i] = v128_add4_64( SSG5_0_2x64( W[i-15] ), SSG5_1_2x64( W[i-2] ), W[ i- 7 ], W[ i-16 ] ); - if ( ctx->initialized ) - { - A = r[0]; - B = r[1]; - C = r[2]; - D = r[3]; - E = r[4]; - F = r[5]; - G = r[6]; - H = r[7]; - } - else - { - A = v128_64( 0x6A09E667F3BCC908 ); - B = v128_64( 0xBB67AE8584CAA73B ); - C = v128_64( 0x3C6EF372FE94F82B ); - D = v128_64( 0xA54FF53A5F1D36F1 ); - E = v128_64( 0x510E527FADE682D1 ); - F = v128_64( 0x9B05688C2B3E6C1F ); - G = v128_64( 0x1F83D9ABFB41BD6B ); - H = v128_64( 0x5BE0CD19137E2179 ); - } + A = r[0]; + B = r[1]; + C = r[2]; + D = r[3]; + E = r[4]; + F = r[5]; + G = r[6]; + H = r[7]; Y_xor_Z = v128_xor( B, C ); @@ -960,35 +946,28 @@ sha512_2x64_round( sha512_2x64_context *ctx, v128u64_t *in, v128u64_t r[8] ) SHA3_2x64_STEP( B, C, D, E, F, G, H, A, i + 7 ); } - if ( ctx->initialized ) - { - r[0] = v128_add64( r[0], A ); - r[1] = v128_add64( r[1], B ); - r[2] = v128_add64( r[2], C ); - r[3] = v128_add64( r[3], D ); - r[4] = v128_add64( r[4], E ); - r[5] = v128_add64( r[5], F ); - r[6] = v128_add64( r[6], G ); - r[7] = v128_add64( r[7], H ); - } - else - { - ctx->initialized = true; - r[0] = v128_add64( A, v128_64( 0x6A09E667F3BCC908 ) ); - r[1] = v128_add64( B, v128_64( 0xBB67AE8584CAA73B ) ); - r[2] = v128_add64( C, v128_64( 0x3C6EF372FE94F82B ) ); - r[3] = v128_add64( D, v128_64( 0xA54FF53A5F1D36F1 ) ); - r[4] = v128_add64( E, v128_64( 0x510E527FADE682D1 ) ); - r[5] = v128_add64( F, v128_64( 0x9B05688C2B3E6C1F ) ); - r[6] = v128_add64( G, v128_64( 0x1F83D9ABFB41BD6B ) ); - r[7] = v128_add64( H, v128_64( 0x5BE0CD19137E2179 ) ); - } + r[0] = v128_add64( r[0], A ); + r[1] = v128_add64( r[1], B ); + r[2] = v128_add64( r[2], C ); + r[3] = v128_add64( r[3], D ); + r[4] = v128_add64( r[4], E ); + r[5] = v128_add64( r[5], F ); + r[6] = v128_add64( r[6], G ); + r[7] = v128_add64( r[7], H ); } void sha512_2x64_init( sha512_2x64_context *sc ) { - sc->initialized = false; + sc->val[0] = v128_64( 0x6A09E667F3BCC908 ); + sc->val[1] = v128_64( 0xBB67AE8584CAA73B ); + sc->val[2] = v128_64( 0x3C6EF372FE94F82B ); + sc->val[3] = v128_64( 0xA54FF53A5F1D36F1 ); + sc->val[4] = v128_64( 0x510E527FADE682D1 ); + sc->val[5] = v128_64( 0x9B05688C2B3E6C1F ); + sc->val[6] = v128_64( 0x1F83D9ABFB41BD6B ); + sc->val[7] = v128_64( 0x5BE0CD19137E2179 ); sc->count = 0; + sc->initialized = true; } void sha512_2x64_update( sha512_2x64_context *sc, const void *data, size_t len ) @@ -1036,7 +1015,7 @@ void sha512_2x64_close( sha512_2x64_context *sc, void *dst ) v128_memset_zero( sc->buf + (ptr>>3), (pad - ptr) >> 3 ); sc->buf[ pad >> 3 ] = v128_bswap64( v128_64( sc->count >> 61 ) ); - sc->buf[ ( pad+8 ) >> 3 ] = v128_bswap64( v128_64( sc->count << 3 ) ); + sc->buf[ ( pad+8 ) >> 3 ] = v128_bswap64( v128_64( sc->count << 3 ) ); sha512_2x64_round( sc, sc->buf, sc->val ); v128_block_bswap64( castp_v128u64( dst ), sc->val ); diff --git a/algo/sha/sha512256d-4way.c b/algo/sha/sha512256d-4way.c index 77deaf1a..ec376df3 100644 --- a/algo/sha/sha512256d-4way.c +++ b/algo/sha/sha512256d-4way.c @@ -5,9 +5,11 @@ #include #if defined(__AVX512F__) && defined(__AVX512VL__) && defined(__AVX512DQ__) && defined(__AVX512BW__) -#define SHA512256D_8WAY 1 + #define SHA512256D_8WAY 1 #elif defined(__AVX2__) -#define SHA512256D_4WAY 1 + #define SHA512256D_4WAY 1 +#elif defined(__SSE2__) || defined(__ARM_NEON) + #define SHA512256D_2WAY 1 #endif #if defined(SHA512256D_8WAY) @@ -145,6 +147,74 @@ int scanhash_sha512256d_4way( struct work *work, uint32_t max_nonce, return 0; } +#elif defined(SHA512256D_2WAY) + +static void sha512256d_2x64_init( sha512_2x64_context *ctx ) +{ + ctx->count = 0; + ctx->initialized = true; + ctx->val[0] = v128_64( 0x22312194FC2BF72C ); + ctx->val[1] = v128_64( 0x9F555FA3C84C64C2 ); + ctx->val[2] = v128_64( 0x2393B86B6F53B151 ); + ctx->val[3] = v128_64( 0x963877195940EABD ); + ctx->val[4] = v128_64( 0x96283EE2A88EFFE3 ); + ctx->val[5] = v128_64( 0xBE5E1E2553863992 ); + ctx->val[6] = v128_64( 0x2B0199FC2C85B8AA ); + ctx->val[7] = v128_64( 0x0EB72DDC81C52CA2 ); +} + +int scanhash_sha512256d_2x64( struct work *work, uint32_t max_nonce, + uint64_t *hashes_done, struct thr_info *mythr ) +{ + uint64_t hash[8*2] __attribute__ ((aligned (64))); + uint32_t vdata[20*2] __attribute__ ((aligned (64))); + sha512_2x64_context ctx; + uint32_t lane_hash[8] __attribute__ ((aligned (32))); + uint64_t *hash_q3 = &(hash[3*2]); + uint32_t *pdata = work->data; + uint32_t *ptarget = work->target; + const uint64_t targ_q3 = ((uint64_t*)ptarget)[3]; + const uint32_t first_nonce = pdata[19]; + const uint32_t last_nonce = max_nonce - 4; + uint32_t n = first_nonce; + v128u64_t *noncev = (v128u64_t*)vdata + 9; + const int thr_id = mythr->id; + const bool bench = opt_benchmark; + const v128u64_t two = v128_64( 0x0000000200000000 ); + + v128_bswap32_intrlv80_2x64( vdata, pdata ); + *noncev = v128_add32( v128_set32( 1, 0, 0, 0 ), *noncev ); +// *noncev = v128_intrlv_blend_32( v128_set32( n+1, 0, n, 0 ), *noncev ); + + do + { + sha512256d_2x64_init( &ctx ); + sha512_2x64_update( &ctx, vdata, 80 ); + sha512_2x64_close( &ctx, hash ); + + sha512256d_2x64_init( &ctx ); + sha512_2x64_update( &ctx, hash, 32 ); + sha512_2x64_close( &ctx, hash ); + + for ( int lane = 0; lane < 2; lane++ ) + if ( hash_q3[ lane ] <= targ_q3 ) + { + extr_lane_2x64( lane_hash, hash, lane, 256 ); + if ( valid_hash( lane_hash, ptarget ) && !bench ) + { + pdata[19] = bswap_32( n + lane ); + submit_solution( work, lane_hash, mythr ); + } + } + *noncev = v128_add32( *noncev, two ); + n += 2; + } while ( (n < last_nonce) && !work_restart[thr_id].restart ); + + pdata[19] = n; + *hashes_done = n - first_nonce; + return 0; +} + #else #include "sph_sha2.h" @@ -214,6 +284,8 @@ bool register_sha512256d_algo( algo_gate_t* gate ) gate->scanhash = (void*)&scanhash_sha512256d_8way; #elif defined(SHA512256D_4WAY) gate->scanhash = (void*)&scanhash_sha512256d_4way; +#elif defined(SHA512256D_2WAY) + gate->scanhash = (void*)&scanhash_sha512256d_2x64; #else gate->scanhash = (void*)&scanhash_sha512256d; #endif diff --git a/algo/simd/simd-hash-2way.c b/algo/simd/simd-hash-2way.c index f3b6bbb9..7e968d99 100644 --- a/algo/simd/simd-hash-2way.c +++ b/algo/simd/simd-hash-2way.c @@ -1,109 +1,34 @@ #include #include #include - #include "simd-hash-2way.h" -#if defined (__AVX2__) - -union _m256_v16 { - uint16_t u16[16]; - __m256i v256; -}; -typedef union _m256_v16 m256_v16; - -// imported from simd_iv.h +uint32_t SIMD_IV_512[] __attribute__((aligned(64))) = +{ + 0x0ba16b95, 0x72f999ad, 0x9fecc2ae, 0xba3264fc, + 0x5e894929, 0x8e9f30e5, 0x2f1daa37, 0xf0f2c558, + 0xac506643, 0xa90635a5, 0xe25b878b, 0xaab7878f, + 0x88817f7a, 0x0a02892b, 0x559a7550, 0x598f657e, + 0x7eef60a1, 0x6b70e3e8, 0x9c1714d1, 0xb958e2a8, + 0xab02675e, 0xed1c014f, 0xcd8d65bb, 0xfdb7a257, + 0x09254899, 0xd699c7bc, 0x9019b6dc, 0x2b9022e4, + 0x8fa14956, 0x21bf9bd3, 0xb94d0943, 0x6ffddc22 }; -uint32_t SIMD_IV_512[] = { 0x0ba16b95, 0x72f999ad, 0x9fecc2ae, 0xba3264fc, - 0x5e894929, 0x8e9f30e5, 0x2f1daa37, 0xf0f2c558, - 0xac506643, 0xa90635a5, 0xe25b878b, 0xaab7878f, - 0x88817f7a, 0x0a02892b, 0x559a7550, 0x598f657e, - 0x7eef60a1, 0x6b70e3e8, 0x9c1714d1, 0xb958e2a8, - 0xab02675e, 0xed1c014f, 0xcd8d65bb, 0xfdb7a257, - 0x09254899, 0xd699c7bc, 0x9019b6dc, 0x2b9022e4, - 0x8fa14956, 0x21bf9bd3, 0xb94d0943, 0x6ffddc22 }; +#if defined(__x86_64__) -// targetted -/* Twiddle tables */ +#define SHUFXOR_1 0xb1 // rev64_32 +#define SHUFXOR_2 0x4e // rev64 +#define SHUFXOR_3 0x1b // rev32 -static const m256_v16 FFT64_Twiddle[] = -{ - {{ 1, 2, 4, 8, 16, 32, 64, 128, - 1, 2, 4, 8, 16, 32, 64, 128 }}, - {{ 1, 60, 2, 120, 4, -17, 8, -34, - 1, 60, 2, 120, 4, -17, 8, -34 }}, - {{ 1, 120, 8, -68, 64, -30, -2, 17, - 1, 120, 8, -68, 64, -30, -2, 17 }}, - {{ 1, 46, 60, -67, 2, 92, 120, 123, - 1, 46, 60, -67, 2, 92, 120, 123 }}, - {{ 1, 92, -17, -22, 32, 117, -30, 67, - 1, 92, -17, -22, 32, 117, -30, 67 }}, - {{ 1, -67, 120, -73, 8, -22, -68, -70, - 1, -67, 120, -73, 8, -22, -68, -70 }}, - {{ 1, 123, -34, -70, 128, 67, 17, 35, - 1, 123, -34, -70, 128, 67, 17, 35 }}, -}; +#elif defined(__aarch64__) -static const m256_v16 FFT128_Twiddle[] = -{ - {{ 1, -118, 46, -31, 60, 116, -67, -61, - 1, -118, 46, -31, 60, 116, -67, -61 }}, - {{ 2, 21, 92, -62, 120, -25, 123, -122, - 2, 21, 92, -62, 120, -25, 123, -122 }}, - {{ 4, 42, -73, -124, -17, -50, -11, 13, - 4, 42, -73, -124, -17, -50, -11, 13 }}, - {{ 8, 84, 111, 9, -34, -100, -22, 26, - 8, 84, 111, 9, -34, -100, -22, 26 }}, - {{ 16, -89, -35, 18, -68, 57, -44, 52, - 16, -89, -35, 18, -68, 57, -44, 52 }}, - {{ 32, 79, -70, 36, 121, 114, -88, 104, - 32, 79, -70, 36, 121, 114, -88, 104 }}, - {{ 64, -99, 117, 72, -15, -29, 81, -49, - 64, -99, 117, 72, -15, -29, 81, -49 }}, - {{ 128, 59, -23, -113, -30, -58, -95, -98, - 128, 59, -23, -113, -30, -58, -95, -98 }}, -}; +#define SHUFXOR_1(x) vrev64q_u32(x) +#define SHUFXOR_2(x) v128_rev64(x) +#define SHUFXOR_3(x) v128_rev64( v128_qrev32(x) ) -static const m256_v16 FFT256_Twiddle[] = -{ - {{ 1, 41, -118, 45, 46, 87, -31, 14, - 1, 41, -118, 45, 46, 87, -31, 14 }}, - {{ 60, -110, 116, -127, -67, 80, -61, 69, - 60, -110, 116, -127, -67, 80, -61, 69 }}, - {{ 2, 82, 21, 90, 92, -83, -62, 28, - 2, 82, 21, 90, 92, -83, -62, 28 }}, - {{ 120, 37, -25, 3, 123, -97, -122, -119, - 120, 37, -25, 3, 123, -97, -122, -119 }}, - {{ 4, -93, 42, -77, -73, 91, -124, 56, - 4, -93, 42, -77, -73, 91, -124, 56 }}, - {{ -17, 74, -50, 6, -11, 63, 13, 19, - -17, 74, -50, 6, -11, 63, 13, 19 }}, - {{ 8, 71, 84, 103, 111, -75, 9, 112, - 8, 71, 84, 103, 111, -75, 9, 112 }}, - {{ -34, -109, -100, 12, -22, 126, 26, 38, - -34, -109, -100, 12, -22, 126, 26, 38 }}, - {{ 16, -115, -89, -51, -35, 107, 18, -33, - 16, -115, -89, -51, -35, 107, 18, -33 }}, - {{ -68, 39, 57, 24, -44, -5, 52, 76, - -68, 39, 57, 24, -44, -5, 52, 76 }}, - {{ 32, 27, 79, -102, -70, -43, 36, -66, - 32, 27, 79, -102, -70, -43, 36, -66 }}, - {{ 121, 78, 114, 48, -88, -10, 104, -105, - 121, 78, 114, 48, -88, -10, 104, -105 }}, - {{ 64, 54, -99, 53, 117, -86, 72, 125, - 64, 54, -99, 53, 117, -86, 72, 125 }}, - {{ -15, -101, -29, 96, 81, -20, -49, 47, - -15, -101, -29, 96, 81, -20, -49, 47 }}, - {{ 128, 108, 59, 106, -23, 85, -113, -7, - 128, 108, 59, 106, -23, 85, -113, -7 }}, - {{ -30, 55, -58, -65, -95, -40, -98, 94, - -30, 55, -58, -65, -95, -40, -98, 94 }} -}; +#else -// generic -#define SHUFXOR_1 0xb1 /* 0b10110001 */ -#define SHUFXOR_2 0x4e /* 0b01001110 */ -#define SHUFXOR_3 0x1b /* 0b00011011 */ +#endif #define CAT(x, y) x##y #define XCAT(x,y) CAT(x,y) @@ -164,9 +89,10 @@ static const m256_v16 FFT256_Twiddle[] = #define SUM7_65 4 #define SUM7_66 5 -#define PERM(z,d,a,shufxor) XCAT(PERM_,XCAT(SUM7_##z,PERM_START))(d,a,shufxor) +#define PERM( z, d, a, shufxor ) \ + XCAT( PERM_, XCAT( SUM7_ ## z, PERM_START ) )( d, a, shufxor ) -#define PERM_0(d,a,shufxor) /* XOR 1 */ \ +#define PERM_0( d, a, shufxor ) /* XOR 1 */ \ do { \ d##l = shufxor( a##l, 1 ); \ d##h = shufxor( a##h, 1 ); \ @@ -208,33 +134,81 @@ do { \ d##h = a##l; \ } while(0) +#if defined(__SSE2__) || defined(__ARM_NEON) -// targetted -#define shufxor2w(x,s) _mm256_shuffle_epi32( x, XCAT( SHUFXOR_, s )) +union _m128_v16 +{ + uint16_t u16[8]; + v128u16_t v128; +} __attribute__((aligned(64))); +typedef union _m128_v16 m128_v16; -#if defined(__AVX512VL__) -//TODO Enable for AVX10_256 +static const m128_v16 FFT64_twiddle[] __attribute__((aligned(64))) = +{ + {{ 1, 2, 4, 8, 16, 32, 64, 128 }}, + {{ 1, 60, 2, 120, 4, -17, 8, -34 }}, + {{ 1, 120, 8, -68, 64, -30, -2, 17 }}, + {{ 1, 46, 60, -67, 2, 92, 120, 123 }}, + {{ 1, 92, -17, -22, 32, 117, -30, 67 }}, + {{ 1, -67, 120, -73, 8, -22, -68, -70 }}, + {{ 1, 123, -34, -70, 128, 67, 17, 35 }} +}; -#define REDUCE(x) \ - _mm256_sub_epi16( _mm256_maskz_mov_epi8( 0x55555555, x ), \ - _mm256_srai_epi16( x, 8 ) ) -#else +static const m128_v16 FFT128_twiddle[] __attribute__((aligned(64))) = +{ + {{ 1, -118, 46, -31, 60, 116, -67, -61 }}, + {{ 2, 21, 92, -62, 120, -25, 123, -122 }}, + {{ 4, 42, -73, -124, -17, -50, -11, 13 }}, + {{ 8, 84, 111, 9, -34, -100, -22, 26 }}, + {{ 16, -89, -35, 18, -68, 57, -44, 52 }}, + {{ 32, 79, -70, 36, 121, 114, -88, 104 }}, + {{ 64, -99, 117, 72, -15, -29, 81, -49 }}, + {{ 128, 59, -23, -113, -30, -58, -95, -98 }} +}; -#define REDUCE(x) \ - _mm256_sub_epi16( _mm256_and_si256( x, _mm256_set1_epi64x( \ - 0x00ff00ff00ff00ff ) ), _mm256_srai_epi16( x, 8 ) ) +static const m128_v16 FFT256_twiddle[] __attribute__((aligned(64))) = +{ + {{ 1, 41, -118, 45, 46, 87, -31, 14 }}, + {{ 60, -110, 116, -127, -67, 80, -61, 69 }}, + {{ 2, 82, 21, 90, 92, -83, -62, 28 }}, + {{ 120, 37, -25, 3, 123, -97, -122, -119 }}, + {{ 4, -93, 42, -77, -73, 91, -124, 56 }}, + {{ -17, 74, -50, 6, -11, 63, 13, 19 }}, + {{ 8, 71, 84, 103, 111, -75, 9, 112 }}, + {{ -34, -109, -100, 12, -22, 126, 26, 38 }}, + {{ 16, -115, -89, -51, -35, 107, 18, -33 }}, + {{ -68, 39, 57, 24, -44, -5, 52, 76 }}, + {{ 32, 27, 79, -102, -70, -43, 36, -66 }}, + {{ 121, 78, 114, 48, -88, -10, 104, -105 }}, + {{ 64, 54, -99, 53, 117, -86, 72, 125 }}, + {{ -15, -101, -29, 96, 81, -20, -49, 47 }}, + {{ 128, 108, 59, 106, -23, 85, -113, -7 }}, + {{ -30, 55, -58, -65, -95, -40, -98, 94 }}, +}; + +#if defined(__x86_64__) + +#define shufxor(x,s) _mm_shuffle_epi32( x, XCAT( SHUFXOR_, s )) +#elif defined(__aarch64__) + +#define shufxor(x,s) XCAT( SHUFXOR_, s )(x) + +#else +//#warning __FILE__ "Unknown or unsupported CPU architecture" #endif +#define REDUCE(x) \ + v128_sub16( v128_and( x, v128_64( \ + 0x00ff00ff00ff00ff ) ), v128_sra16( x, 8 ) ) + #define EXTRA_REDUCE_S(x)\ - _mm256_sub_epi16( x, _mm256_and_si256( \ - _mm256_set1_epi64x( 0x0101010101010101 ), \ - _mm256_cmpgt_epi16( x, _mm256_set1_epi64x( 0x0080008000800080 ) ) ) ) + v128_sub16( x, v128_and( \ + v128_64( 0x0101010101010101 ), \ + v128_cmpgt16( x, v128_64( 0x0080008000800080 ) ) ) ) #define REDUCE_FULL_S( x ) EXTRA_REDUCE_S( REDUCE (x ) ) -//#define DO_REDUCE( i ) X(i) = REDUCE( X(i) ) - #define DO_REDUCE_FULL_S(i) \ do { \ X(i) = REDUCE( X(i) ); \ @@ -242,232 +216,58 @@ do { \ } while(0) +static void FFT64( void *a ) +{ + v128u16_t* const A = a; + register v128u16_t X0, X1, X2, X3, X4, X5, X6, X7; -#if defined(__AVX512F__) && defined(__AVX512VL__) && defined(__AVX512DQ__) && defined(__AVX512BW__) +#define X(i) X##i -//////////////////////////////////// -// -// SIMD 4 way AVX512 + X0 = A[0]; + X1 = A[1]; + X2 = A[2]; + X3 = A[3]; + X4 = A[4]; + X5 = A[5]; + X6 = A[6]; + X7 = A[7]; -union _m512_v16 { - uint16_t u16[32]; - __m512i v512; -}; -typedef union _m512_v16 m512_v16; +#define DO_REDUCE(i) X(i) = REDUCE( X(i) ) -static const m512_v16 FFT64_Twiddle4w[] = -{ - {{ 1, 2, 4, 8, 16, 32, 64, 128, - 1, 2, 4, 8, 16, 32, 64, 128, - 1, 2, 4, 8, 16, 32, 64, 128, - 1, 2, 4, 8, 16, 32, 64, 128 }}, - {{ 1, 60, 2, 120, 4, -17, 8, -34, - 1, 60, 2, 120, 4, -17, 8, -34, - 1, 60, 2, 120, 4, -17, 8, -34, - 1, 60, 2, 120, 4, -17, 8, -34 }}, - {{ 1, 120, 8, -68, 64, -30, -2, 17, - 1, 120, 8, -68, 64, -30, -2, 17, - 1, 120, 8, -68, 64, -30, -2, 17, - 1, 120, 8, -68, 64, -30, -2, 17 }}, - {{ 1, 46, 60, -67, 2, 92, 120, 123, - 1, 46, 60, -67, 2, 92, 120, 123, - 1, 46, 60, -67, 2, 92, 120, 123, - 1, 46, 60, -67, 2, 92, 120, 123 }}, - {{ 1, 92, -17, -22, 32, 117, -30, 67, - 1, 92, -17, -22, 32, 117, -30, 67, - 1, 92, -17, -22, 32, 117, -30, 67, - 1, 92, -17, -22, 32, 117, -30, 67 }}, - {{ 1, -67, 120, -73, 8, -22, -68, -70, - 1, -67, 120, -73, 8, -22, -68, -70, - 1, -67, 120, -73, 8, -22, -68, -70, - 1, -67, 120, -73, 8, -22, -68, -70 }}, - {{ 1, 123, -34, -70, 128, 67, 17, 35, - 1, 123, -34, -70, 128, 67, 17, 35, - 1, 123, -34, -70, 128, 67, 17, 35, - 1, 123, -34, -70, 128, 67, 17, 35 }}, -}; + // Begin with 8 parallels DIF FFT_8 + // + // FFT_8 using w=4 as 8th root of unity + // Unrolled decimation in frequency (DIF) radix-2 NTT. + // Output data is in revbin_permuted order. -static const m512_v16 FFT128_Twiddle4w[] = -{ - {{ 1, -118, 46, -31, 60, 116, -67, -61, - 1, -118, 46, -31, 60, 116, -67, -61, - 1, -118, 46, -31, 60, 116, -67, -61, - 1, -118, 46, -31, 60, 116, -67, -61 }}, - {{ 2, 21, 92, -62, 120, -25, 123, -122, - 2, 21, 92, -62, 120, -25, 123, -122, - 2, 21, 92, -62, 120, -25, 123, -122, - 2, 21, 92, -62, 120, -25, 123, -122 }}, - {{ 4, 42, -73, -124, -17, -50, -11, 13, - 4, 42, -73, -124, -17, -50, -11, 13, - 4, 42, -73, -124, -17, -50, -11, 13, - 4, 42, -73, -124, -17, -50, -11, 13 }}, - {{ 8, 84, 111, 9, -34, -100, -22, 26, - 8, 84, 111, 9, -34, -100, -22, 26, - 8, 84, 111, 9, -34, -100, -22, 26, - 8, 84, 111, 9, -34, -100, -22, 26 }}, - {{ 16, -89, -35, 18, -68, 57, -44, 52, - 16, -89, -35, 18, -68, 57, -44, 52, - 16, -89, -35, 18, -68, 57, -44, 52, - 16, -89, -35, 18, -68, 57, -44, 52 }}, - {{ 32, 79, -70, 36, 121, 114, -88, 104, - 32, 79, -70, 36, 121, 114, -88, 104, - 32, 79, -70, 36, 121, 114, -88, 104, - 32, 79, -70, 36, 121, 114, -88, 104 }}, - {{ 64, -99, 117, 72, -15, -29, 81, -49, - 64, -99, 117, 72, -15, -29, 81, -49, - 64, -99, 117, 72, -15, -29, 81, -49, - 64, -99, 117, 72, -15, -29, 81, -49 }}, - {{ 128, 59, -23, -113, -30, -58, -95, -98, - 128, 59, -23, -113, -30, -58, -95, -98, - 128, 59, -23, -113, -30, -58, -95, -98, - 128, 59, -23, -113, -30, -58, -95, -98 }}, -}; + static const int w[] = {0, 2, 4, 6}; -static const m512_v16 FFT256_Twiddle4w[] = -{ - {{ 1, 41, -118, 45, 46, 87, -31, 14, - 1, 41, -118, 45, 46, 87, -31, 14, - 1, 41, -118, 45, 46, 87, -31, 14, - 1, 41, -118, 45, 46, 87, -31, 14 }}, - {{ 60, -110, 116, -127, -67, 80, -61, 69, - 60, -110, 116, -127, -67, 80, -61, 69, - 60, -110, 116, -127, -67, 80, -61, 69, - 60, -110, 116, -127, -67, 80, -61, 69 }}, - {{ 2, 82, 21, 90, 92, -83, -62, 28, - 2, 82, 21, 90, 92, -83, -62, 28, - 2, 82, 21, 90, 92, -83, -62, 28, - 2, 82, 21, 90, 92, -83, -62, 28 }}, - {{ 120, 37, -25, 3, 123, -97, -122, -119, - 120, 37, -25, 3, 123, -97, -122, -119, - 120, 37, -25, 3, 123, -97, -122, -119, - 120, 37, -25, 3, 123, -97, -122, -119 }}, - {{ 4, -93, 42, -77, -73, 91, -124, 56, - 4, -93, 42, -77, -73, 91, -124, 56, - 4, -93, 42, -77, -73, 91, -124, 56, - 4, -93, 42, -77, -73, 91, -124, 56 }}, - {{ -17, 74, -50, 6, -11, 63, 13, 19, - -17, 74, -50, 6, -11, 63, 13, 19, - -17, 74, -50, 6, -11, 63, 13, 19, - -17, 74, -50, 6, -11, 63, 13, 19 }}, - {{ 8, 71, 84, 103, 111, -75, 9, 112, - 8, 71, 84, 103, 111, -75, 9, 112, - 8, 71, 84, 103, 111, -75, 9, 112, - 8, 71, 84, 103, 111, -75, 9, 112 }}, - {{ -34, -109, -100, 12, -22, 126, 26, 38, - -34, -109, -100, 12, -22, 126, 26, 38, - -34, -109, -100, 12, -22, 126, 26, 38, - -34, -109, -100, 12, -22, 126, 26, 38 }}, - {{ 16, -115, -89, -51, -35, 107, 18, -33, - 16, -115, -89, -51, -35, 107, 18, -33, - 16, -115, -89, -51, -35, 107, 18, -33, - 16, -115, -89, -51, -35, 107, 18, -33 }}, - {{ -68, 39, 57, 24, -44, -5, 52, 76, - -68, 39, 57, 24, -44, -5, 52, 76, - -68, 39, 57, 24, -44, -5, 52, 76, - -68, 39, 57, 24, -44, -5, 52, 76 }}, - {{ 32, 27, 79, -102, -70, -43, 36, -66, - 32, 27, 79, -102, -70, -43, 36, -66, - 32, 27, 79, -102, -70, -43, 36, -66, - 32, 27, 79, -102, -70, -43, 36, -66 }}, - {{ 121, 78, 114, 48, -88, -10, 104, -105, - 121, 78, 114, 48, -88, -10, 104, -105, - 121, 78, 114, 48, -88, -10, 104, -105, - 121, 78, 114, 48, -88, -10, 104, -105 }}, - {{ 64, 54, -99, 53, 117, -86, 72, 125, - 64, 54, -99, 53, 117, -86, 72, 125, - 64, 54, -99, 53, 117, -86, 72, 125, - 64, 54, -99, 53, 117, -86, 72, 125 }}, - {{ -15, -101, -29, 96, 81, -20, -49, 47, - -15, -101, -29, 96, 81, -20, -49, 47, - -15, -101, -29, 96, 81, -20, -49, 47, - -15, -101, -29, 96, 81, -20, -49, 47 }}, - {{ 128, 108, 59, 106, -23, 85, -113, -7, - 128, 108, 59, 106, -23, 85, -113, -7, - 128, 108, 59, 106, -23, 85, -113, -7, - 128, 108, 59, 106, -23, 85, -113, -7 }}, - {{ -30, 55, -58, -65, -95, -40, -98, 94, - -30, 55, -58, -65, -95, -40, -98, 94, - -30, 55, -58, -65, -95, -40, -98, 94, - -30, 55, -58, -65, -95, -40, -98, 94 }} -}; - -#define shufxor4w(x,s) _mm512_shuffle_epi32( x, XCAT( SHUFXOR_, s )) - -#define REDUCE4w(x) \ - _mm512_sub_epi16( _mm512_maskz_mov_epi8( 0x5555555555555555, x ), \ - _mm512_srai_epi16( x, 8 ) ) - -#define EXTRA_REDUCE_S4w(x) \ - _mm512_sub_epi16( x, _mm512_and_si512( \ - _mm512_set1_epi64( 0x0101010101010101 ), \ - _mm512_movm_epi16( _mm512_cmpgt_epi16_mask( \ - x, _mm512_set1_epi64( 0x0080008000800080 ) ) ) ) ) - -// generic, except it calls targetted macros -#define REDUCE_FULL_S4w( x ) EXTRA_REDUCE_S4w( REDUCE4w (x ) ) - -//#define DO_REDUCE4w( i ) X(i) = REDUCE4w( X(i) ) - -#define DO_REDUCE_FULL_S4w(i) \ -do { \ - X(i) = REDUCE4w( X(i) ); \ - X(i) = EXTRA_REDUCE_S4w( X(i) ); \ -} while(0) - - -// targetted -void fft64_4way( void *a ) -{ - __m512i* const A = a; - register __m512i X0, X1, X2, X3, X4, X5, X6, X7; - -// generic -#define X(i) X##i - - X0 = A[0]; - X1 = A[1]; - X2 = A[2]; - X3 = A[3]; - X4 = A[4]; - X5 = A[5]; - X6 = A[6]; - X7 = A[7]; - -#define DO_REDUCE(i) X(i) = REDUCE4w( X(i) ) - - // Begin with 8 parallels DIF FFT_8 - // - // FFT_8 using w=4 as 8th root of unity - // Unrolled decimation in frequency (DIF) radix-2 NTT. - // Output data is in revbin_permuted order. - -// targetted #define BUTTERFLY_0( i,j ) \ do { \ - __m512i v = X(j); \ - X(j) = _mm512_add_epi16( X(i), X(j) ); \ - X(i) = _mm512_sub_epi16( X(i), v ); \ + v128u16_t v = X(j); \ + X(j) = v128_add16( X(i), X(j) ); \ + X(i) = v128_sub16( X(i), v ); \ } while(0) -#define BUTTERFLY_N( i, j, w ) \ +#define BUTTERFLY_N( i,j,n ) \ do { \ - __m512i v = X(j); \ - X(j) = _mm512_add_epi16( X(i), X(j) ); \ - X(i) = _mm512_slli_epi16( _mm512_sub_epi16( X(i), v ), w ); \ + v128u16_t v = X(j); \ + X(j) = v128_add16( X(i), X(j) ); \ + X(i) = v128_sl16( v128_sub16( X(i), v ), w[n] ); \ } while(0) BUTTERFLY_0( 0, 4 ); - BUTTERFLY_N( 1, 5, 2 ); - BUTTERFLY_N( 2, 6, 4 ); - BUTTERFLY_N( 3, 7, 6 ); + BUTTERFLY_N( 1, 5, 1 ); + BUTTERFLY_N( 2, 6, 2 ); + BUTTERFLY_N( 3, 7, 3 ); DO_REDUCE( 2 ); DO_REDUCE( 3 ); BUTTERFLY_0( 0, 2 ); BUTTERFLY_0( 4, 6 ); - BUTTERFLY_N( 1, 3, 4 ); - BUTTERFLY_N( 5, 7, 4 ); + BUTTERFLY_N( 1, 3, 2 ); + BUTTERFLY_N( 5, 7, 2 ); DO_REDUCE( 1 ); @@ -477,34 +277,35 @@ do { \ BUTTERFLY_0( 6, 7 ); /* We don't need to reduce X(7) */ - DO_REDUCE_FULL_S4w( 0 ); - DO_REDUCE_FULL_S4w( 1 ); - DO_REDUCE_FULL_S4w( 2 ); - DO_REDUCE_FULL_S4w( 3 ); - DO_REDUCE_FULL_S4w( 4 ); - DO_REDUCE_FULL_S4w( 5 ); - DO_REDUCE_FULL_S4w( 6 ); + DO_REDUCE_FULL_S( 0 ); + DO_REDUCE_FULL_S( 1 ); + DO_REDUCE_FULL_S( 2 ); + DO_REDUCE_FULL_S( 3 ); + DO_REDUCE_FULL_S( 4 ); + DO_REDUCE_FULL_S( 5 ); + DO_REDUCE_FULL_S( 6 ); #undef BUTTERFLY_0 #undef BUTTERFLY_N // Multiply by twiddle factors - X(6) = _mm512_mullo_epi16( X(6), FFT64_Twiddle4w[0].v512 ); - X(5) = _mm512_mullo_epi16( X(5), FFT64_Twiddle4w[1].v512 ); - X(4) = _mm512_mullo_epi16( X(4), FFT64_Twiddle4w[2].v512 ); - X(3) = _mm512_mullo_epi16( X(3), FFT64_Twiddle4w[3].v512 ); - X(2) = _mm512_mullo_epi16( X(2), FFT64_Twiddle4w[4].v512 ); - X(1) = _mm512_mullo_epi16( X(1), FFT64_Twiddle4w[5].v512 ); - X(0) = _mm512_mullo_epi16( X(0), FFT64_Twiddle4w[6].v512 ); + X(6) = v128_mul16( X(6), FFT64_twiddle[0].v128 ); + X(5) = v128_mul16( X(5), FFT64_twiddle[1].v128 ); + X(4) = v128_mul16( X(4), FFT64_twiddle[2].v128 ); + X(3) = v128_mul16( X(3), FFT64_twiddle[3].v128 ); + X(2) = v128_mul16( X(2), FFT64_twiddle[4].v128 ); + X(1) = v128_mul16( X(1), FFT64_twiddle[5].v128 ); + X(0) = v128_mul16( X(0), FFT64_twiddle[6].v128 ); // Transpose the FFT state with a revbin order permutation // on the rows and the column. // This will make the full FFT_64 in order. -#define INTERLEAVE( i, j ) \ +#define INTERLEAVE(i,j) \ do { \ - __m512i u = X(j); \ - X(j) = _mm512_unpackhi_epi16( X(i), X(j) ); \ - X(i) = _mm512_unpacklo_epi16( X(i), u ); \ + v128u16_t t1= X(i); \ + v128u16_t t2= X(j); \ + X(i) = v128_unpacklo16( t1, t2 ); \ + X(j) = v128_unpackhi16( t1, t2 ); \ } while(0) INTERLEAVE( 1, 0 ); @@ -524,20 +325,25 @@ do { \ #undef INTERLEAVE + //Finish with 8 parallels DIT FFT_8 + //FFT_8 using w=4 as 8th root of unity + // Unrolled decimation in time (DIT) radix-2 NTT. + // Input data is in revbin_permuted order. + #define BUTTERFLY_0( i,j ) \ do { \ - __m512i u = X(j); \ - X(j) = _mm512_sub_epi16( X(j), X(i) ); \ - X(i) = _mm512_add_epi16( u, X(i) ); \ + v128u16_t u = X(j); \ + X(j) = v128_sub16( X(j), X(i) ); \ + X(i) = v128_add16( u, X(i) ); \ } while(0) -#define BUTTERFLY_N( i, j, w ) \ +#define BUTTERFLY_N( i,j,n ) \ do { \ - __m512i u = X(j); \ - X(i) = _mm512_slli_epi16( X(i), w ); \ - X(j) = _mm512_sub_epi16( X(j), X(i) ); \ - X(i) = _mm512_add_epi16( u, X(i) ); \ + v128u16_t u = X(j); \ + X(i) = v128_sl16( X(i), w[n] ); \ + X(j) = v128_sub16( X(j), X(i) ); \ + X(i) = v128_add16( u, X(i) ); \ } while(0) DO_REDUCE( 0 ); @@ -556,24 +362,24 @@ do { \ BUTTERFLY_0( 0, 2 ); BUTTERFLY_0( 4, 6 ); - BUTTERFLY_N( 1, 3, 4 ); - BUTTERFLY_N( 5, 7, 4 ); + BUTTERFLY_N( 1, 3, 2 ); + BUTTERFLY_N( 5, 7, 2 ); DO_REDUCE( 3 ); BUTTERFLY_0( 0, 4 ); - BUTTERFLY_N( 1, 5, 2 ); - BUTTERFLY_N( 2, 6, 4 ); - BUTTERFLY_N( 3, 7, 6 ); + BUTTERFLY_N( 1, 5, 1 ); + BUTTERFLY_N( 2, 6, 2 ); + BUTTERFLY_N( 3, 7, 3 ); - DO_REDUCE_FULL_S4w( 0 ); - DO_REDUCE_FULL_S4w( 1 ); - DO_REDUCE_FULL_S4w( 2 ); - DO_REDUCE_FULL_S4w( 3 ); - DO_REDUCE_FULL_S4w( 4 ); - DO_REDUCE_FULL_S4w( 5 ); - DO_REDUCE_FULL_S4w( 6 ); - DO_REDUCE_FULL_S4w( 7 ); + DO_REDUCE_FULL_S( 0 ); + DO_REDUCE_FULL_S( 1 ); + DO_REDUCE_FULL_S( 2 ); + DO_REDUCE_FULL_S( 3 ); + DO_REDUCE_FULL_S( 4 ); + DO_REDUCE_FULL_S( 5 ); + DO_REDUCE_FULL_S( 6 ); + DO_REDUCE_FULL_S( 7 ); #undef BUTTERFLY_0 #undef BUTTERFLY_N @@ -591,124 +397,70 @@ do { \ #undef X } -void fft128_4way( void *a ) +static void FFT128( void *a ) { int i; // Temp space to help for interleaving in the end - __m512i B[8]; - __m512i *A = (__m512i*) a; + v128u16_t B[8]; + v128u16_t *A = (v128u16_t*) a; /* Size-2 butterflies */ for ( i = 0; i<8; i++ ) { - B[ i ] = _mm512_add_epi16( A[ i ], A[ i+8 ] ); - B[ i ] = REDUCE_FULL_S4w( B[ i ] ); - A[ i+8 ] = _mm512_sub_epi16( A[ i ], A[ i+8 ] ); - A[ i+8 ] = REDUCE_FULL_S4w( A[ i+8 ] ); - A[ i+8 ] = _mm512_mullo_epi16( A[ i+8 ], FFT128_Twiddle4w[i].v512 ); - A[ i+8 ] = REDUCE_FULL_S4w( A[ i+8 ] ); + B[ i ] = v128_add16( A[ i ], A[ i+8 ] ); + B[ i ] = REDUCE_FULL_S( B[ i ] ); + A[ i+8 ] = v128_sub16( A[ i ], A[ i+8 ] ); + A[ i+8 ] = REDUCE_FULL_S( A[ i+8 ] ); + A[ i+8 ] = v128_mul16( A[ i+8 ], FFT128_twiddle[i].v128 ); + A[ i+8 ] = REDUCE_FULL_S( A[ i+8 ] ); } - fft64_4way( B ); - fft64_4way( A+8 ); + FFT64( B ); + FFT64( A+8 ); - /* Transposi (i.e. interleave) */ + /* Transpose (i.e. interleave) */ for ( i = 0; i < 8; i++ ) { - A[ 2*i ] = _mm512_unpacklo_epi16( B[ i ], A[ i+8 ] ); - A[ 2*i+1 ] = _mm512_unpackhi_epi16( B[ i ], A[ i+8 ] ); + A[ 2*i ] = v128_unpacklo16( B[ i ], A[ i+8 ] ); + A[ 2*i+1 ] = v128_unpackhi16( B[ i ], A[ i+8 ] ); } } -void fft128_4way_msg( uint16_t *a, const uint8_t *x, int final ) -{ - const __m512i zero = _mm512_setzero_si512(); - static const m512_v16 Tweak = {{ 0,0,0,0,0,0,0,1, 0,0,0,0,0,0,0,1, - 0,0,0,0,0,0,0,1, 0,0,0,0,0,0,0,1 }}; - static const m512_v16 FinalTweak = {{ 0,0,0,0,0,1,0,1, 0,0,0,0,0,1,0,1, - 0,0,0,0,0,1,0,1, 0,0,0,0,0,1,0,1 }}; - - __m512i *X = (__m512i*)x; - __m512i *A = (__m512i*)a; - -#define UNPACK( i ) \ -do { \ - __m512i t = X[i]; \ - A[2*i] = _mm512_unpacklo_epi8( t, zero ); \ - A[2*i+8] = _mm512_mullo_epi16( A[2*i], FFT128_Twiddle4w[2*i].v512 ); \ - A[2*i+8] = REDUCE4w(A[2*i+8]); \ - A[2*i+1] = _mm512_unpackhi_epi8( t, zero ); \ - A[2*i+9] = _mm512_mullo_epi16(A[2*i+1], FFT128_Twiddle4w[2*i+1].v512 ); \ - A[2*i+9] = REDUCE4w(A[2*i+9]); \ -} while(0) - - // This allows to tweak the last butterflies to introduce X^127 -#define UNPACK_TWEAK( i,tw ) \ -do { \ - __m512i t = X[i]; \ - __m512i tmp; \ - A[2*i] = _mm512_unpacklo_epi8( t, zero ); \ - A[2*i+8] = _mm512_mullo_epi16( A[ 2*i ], FFT128_Twiddle4w[ 2*i ].v512 ); \ - A[2*i+8] = REDUCE4w( A[ 2*i+8 ] ); \ - tmp = _mm512_unpackhi_epi8( t, zero ); \ - A[2*i+1] = _mm512_add_epi16( tmp, tw ); \ - A[2*i+9] = _mm512_mullo_epi16( _mm512_sub_epi16( tmp, tw ), \ - FFT128_Twiddle4w[ 2*i+1 ].v512 );\ - A[2*i+9] = REDUCE4w( A[ 2*i+9 ] ); \ -} while(0) - - UNPACK( 0 ); - UNPACK( 1 ); - UNPACK( 2 ); - if ( final ) - UNPACK_TWEAK( 3, FinalTweak.v512 ); - else - UNPACK_TWEAK( 3, Tweak.v512 ); - -#undef UNPACK -#undef UNPACK_TWEAK - - fft64_4way( a ); - fft64_4way( a+256 ); -} - -void fft256_4way_msg( uint16_t *a, const uint8_t *x, int final ) +void FFT256_msg( uint16_t *a, const uint8_t *x, int final ) { - const __m512i zero = _mm512_setzero_si512(); - static const m512_v16 Tweak = {{ 0,0,0,0,0,0,0,1, 0,0,0,0,0,0,0,1, - 0,0,0,0,0,0,0,1, 0,0,0,0,0,0,0,1 }}; - static const m512_v16 FinalTweak = {{ 0,0,0,0,0,1,0,1, 0,0,0,0,0,1,0,1, - 0,0,0,0,0,1,0,1, 0,0,0,0,0,1,0,1 }}; + const v128u16_t zero = v128_zero; + static const m128_v16 Tweak = {{ 0,0,0,0,0,0,0,1 }}; + static const m128_v16 FinalTweak = {{ 0,0,0,0,0,1,0,1 }}; - __m512i *X = (__m512i*)x; - __m512i *A = (__m512i*)a; + v128u8_t *X = (v128u8_t*)x; + v128u16_t *A = (v128u16_t*)a; #define UNPACK( i ) \ do { \ - __m512i t = X[i]; \ - A[ 2*i ] = _mm512_unpacklo_epi8( t, zero ); \ - A[ 2*i + 16 ] = _mm512_mullo_epi16( A[ 2*i ], \ - FFT256_Twiddle4w[ 2*i ].v512 ); \ - A[ 2*i + 16 ] = REDUCE4w( A[ 2*i + 16 ] ); \ - A[ 2*i + 1 ] = _mm512_unpackhi_epi8( t, zero ); \ - A[ 2*i + 17 ] = _mm512_mullo_epi16( A[ 2*i + 1 ], \ - FFT256_Twiddle4w[ 2*i + 1 ].v512 ); \ - A[ 2*i + 17 ] = REDUCE4w( A[ 2*i + 17 ] ); \ + v128u8_t t = X[i]; \ + A[ 2*i ] = v128_unpacklo8( t, zero ); \ + A[ 2*i + 16 ] = v128_mul16( A[ 2*i ], \ + FFT256_twiddle[ 2*i ].v128 ); \ + A[ 2*i + 16 ] = REDUCE( A[ 2*i + 16 ] ); \ + A[ 2*i + 1 ] = v128_unpackhi8( t, zero ); \ + A[ 2*i + 17 ] = v128_mul16( A[ 2*i + 1 ], \ + FFT256_twiddle[ 2*i + 1 ].v128 ); \ + A[ 2*i + 17 ] = REDUCE( A[ 2*i + 17 ] ); \ } while(0) // This allows to tweak the last butterflies to introduce X^127 #define UNPACK_TWEAK( i,tw ) \ do { \ - __m512i t = X[i]; \ - __m512i tmp; \ - A[ 2*i ] = _mm512_unpacklo_epi8( t, zero ); \ - A[ 2*i + 16 ] = _mm512_mullo_epi16( A[ 2*i ], \ - FFT256_Twiddle4w[ 2*i ].v512 ); \ - A[ 2*i + 16 ] = REDUCE4w( A[ 2*i + 16 ] ); \ - tmp = _mm512_unpackhi_epi8( t, zero ); \ - A[ 2*i + 1 ] = _mm512_add_epi16( tmp, tw ); \ - A[ 2*i + 17 ] = _mm512_mullo_epi16( _mm512_sub_epi16( tmp, tw ), \ - FFT256_Twiddle4w[ 2*i + 1 ].v512 ); \ + v128u8_t t = X[i]; \ + v128u16_t tmp; \ + A[ 2*i ] = v128_unpacklo8( t, zero ); \ + A[ 2*i + 16 ] = v128_mul16( A[ 2*i ], \ + FFT256_twiddle[ 2*i ].v128 ); \ + A[ 2*i + 16 ] = REDUCE( A[ 2*i + 16 ] ); \ + tmp = v128_unpackhi8( t, zero ); \ + A[ 2*i + 1 ] = v128_add16( tmp, tw ); \ + A[ 2*i + 17 ] = v128_mul16( v128_sub16( tmp, tw ), \ + FFT256_twiddle[ 2*i + 1 ].v128 ); \ } while(0) UNPACK( 0 ); @@ -719,88 +471,76 @@ do { \ UNPACK( 5 ); UNPACK( 6 ); if ( final ) - UNPACK_TWEAK( 7, FinalTweak.v512 ); + UNPACK_TWEAK( 7, FinalTweak.v128 ); else - UNPACK_TWEAK( 7, Tweak.v512 ); + UNPACK_TWEAK( 7, Tweak.v128 ); #undef UNPACK #undef UNPACK_TWEAK - fft128_4way( a ); - fft128_4way( a+512 ); + FFT128( a ); + FFT128( a+128 ); } -#define c1_16_512( x ) {{ x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x }} +#define c1_16( x ) {{ x,x,x,x, x,x,x,x }} -void rounds512_4way( uint32_t *state, const uint8_t *msg, uint16_t *fft ) +static void ROUNDS512( uint32_t *state, const uint8_t *msg, uint16_t *fft ) { - register __m512i S0l, S1l, S2l, S3l; - register __m512i S0h, S1h, S2h, S3h; - __m512i *S = (__m512i*) state; - __m512i *M = (__m512i*) msg; - __m512i *W = (__m512i*) fft; + register v128u32_t S0l, S1l, S2l, S3l, S0h, S1h, S2h, S3h; + v128u32_t *S = (v128u32_t*)state; + v128u8_t *M = (v128u8_t*) msg; + v128u16_t *W = (v128u16_t*)fft; + static const m128_v16 code[] = { c1_16(185), c1_16(233) }; + + S0l = v128_xor( S[0], M[0] ); + S0h = v128_xor( S[1], M[1] ); + S1l = v128_xor( S[2], M[2] ); + S1h = v128_xor( S[3], M[3] ); + S2l = v128_xor( S[4], M[4] ); + S2h = v128_xor( S[5], M[5] ); + S3l = v128_xor( S[6], M[6] ); + S3h = v128_xor( S[7], M[7] ); - static const m512_v16 code[] = { c1_16_512(185), c1_16_512(233) }; +#define S(i) S##i - S0l = _mm512_xor_si512( S[0], M[0] ); - S0h = _mm512_xor_si512( S[1], M[1] ); - S1l = _mm512_xor_si512( S[2], M[2] ); - S1h = _mm512_xor_si512( S[3], M[3] ); - S2l = _mm512_xor_si512( S[4], M[4] ); - S2h = _mm512_xor_si512( S[5], M[5] ); - S3l = _mm512_xor_si512( S[6], M[6] ); - S3h = _mm512_xor_si512( S[7], M[7] ); +#define F_0(B, C, D) \ + v128_xor( v128_and( v128_xor( C,D ), B ), D ) -// targetted, local macros don't need a unique name -#define S(i) S##i - -#define F_0( B, C, D ) _mm512_ternarylogic_epi32( B, C, D, 0xca ) -#define F_1( B, C, D ) _mm512_ternarylogic_epi32( B, C, D, 0xe8 ) - -/* -#define F_0(B, C, D) \ - _mm512_xor_si512( _mm512_and_si512( _mm512_xor_si512( C,D ), B ), D ) -#define F_1(B, C, D) \ - _mm512_or_si512( _mm512_and_si512( D, C ),\ - _mm512_and_si512( _mm512_or_si512( D,C ), B ) ) -*/ +#define F_1(B, C, D) \ + v128_or( v128_and( D, C ),\ + v128_and( v128_or( D,C ), B ) ) #define Fl(a,b,c,fun) F_##fun (a##l,b##l,c##l) #define Fh(a,b,c,fun) F_##fun (a##h,b##h,c##h) - // We split the round function in two halfes - // so as to insert some independent computations in between - -// targetted - #define STEP_1_(a,b,c,d,w,fun,r,s,z) \ do { \ TTl = Fl( a,b,c,fun ); \ TTh = Fh( a,b,c,fun ); \ - a##l = mm512_rol_32( a##l, r ); \ - a##h = mm512_rol_32( a##h, r ); \ - w##l = _mm512_add_epi32( w##l, d##l ); \ - w##h = _mm512_add_epi32( w##h, d##h ); \ - TTl = _mm512_add_epi32( TTl, w##l ); \ - TTh = _mm512_add_epi32( TTh, w##h ); \ - TTl = mm512_rol_32( TTl, s ); \ - TTh = mm512_rol_32( TTh, s ); \ - PERM( z,d,a, shufxor4w ); \ + a##l = v128_rol32( a##l, r ); \ + a##h = v128_rol32( a##h, r ); \ + w##l = v128_add32( w##l, d##l ); \ + w##h = v128_add32( w##h, d##h ); \ + TTl = v128_add32( TTl, w##l ); \ + TTh = v128_add32( TTh, w##h ); \ + TTl = v128_rol32( TTl, s ); \ + TTh = v128_rol32( TTh, s ); \ + PERM( z,d,a, shufxor ); \ } while(0) #define STEP_1( a,b,c,d,w,fun,r,s,z ) STEP_1_( a,b,c,d,w,fun,r,s,z ) #define STEP_2_( a,b,c,d,w,fun,r,s ) \ do { \ - d##l = _mm512_add_epi32( d##l, TTl ); \ - d##h = _mm512_add_epi32( d##h, TTh ); \ + d##l = v128_add32( d##l, TTl ); \ + d##h = v128_add32( d##h, TTh ); \ } while(0) #define STEP_2( a,b,c,d,w,fun,r,s ) STEP_2_( a,b,c,d,w,fun,r,s ) #define STEP( a,b,c,d,w1,w2,fun,r,s,z ) \ do { \ - register __m512i TTl, TTh, Wl=w1, Wh=w2; \ + register v128u32_t TTl, TTh, Wl=w1, Wh=w2; \ STEP_1( a,b,c,d,W,fun,r,s,z ); \ STEP_2( a,b,c,d,W,fun,r,s ); \ } while(0); @@ -812,16 +552,16 @@ do { \ do { \ int a = MSG_##u(hh); \ int b = MSG_##u(ll); \ - w##l = _mm512_unpacklo_epi16( W[a], W[b] ); \ - w##l = _mm512_mullo_epi16( w##l, code[z].v512 ); \ - w##h = _mm512_unpackhi_epi16( W[a], W[b]) ; \ - w##h = _mm512_mullo_epi16( w##h, code[z].v512 ); \ + w##l = v128_unpacklo16( W[a], W[b] ); \ + w##l = v128_mul16( w##l, code[z].v128 ); \ + w##h = v128_unpackhi16( W[a], W[b]) ; \ + w##h = v128_mul16( w##h, code[z].v128 ); \ } while(0) - + #define ROUND( h0,l0,u0,h1,l1,u1,h2,l2,u2,h3,l3,u3,fun,r,s,t,u,z ) \ do { \ - register __m512i W0l, W1l, W2l, W3l, TTl; \ - register __m512i W0h, W1h, W2h, W3h, TTh; \ + register v128u32_t W0l, W1l, W2l, W3l, TTl; \ + register v128u32_t W0h, W1h, W2h, W3h, TTh; \ MSG( W0, h0, l0, u0, z ); \ STEP_1( S(0), S(1), S(2), S(3), W0, fun, r, s, 0 ); \ MSG( W1, h1, l1, u1, z ); \ @@ -891,184 +631,19 @@ do { \ #undef MSG } -void SIMD_4way_Compress( simd_4way_context *state, const void *m, int final ) +static void SIMD512_Compress( simd512_context *state, const void *m, int final ) { - m512_v16 Y[32]; + m128_v16 Y[32]; uint16_t *y = (uint16_t*) Y[0].u16; - fft256_4way_msg( y, m, final ); - - rounds512_4way( state->A, m, y ); -} - -// imported from nist.c - -int simd_4way_init( simd_4way_context *state, int hashbitlen ) -{ - __m512i *A = (__m512i*)state->A; - int n = 8; - - state->hashbitlen = hashbitlen; - state->n_feistels = n; - state->blocksize = 128*8; - state->count = 0; - - for ( int i = 0; i < 8; i++ ) - A[i] = _mm512_set4_epi32( SIMD_IV_512[4*i+3], SIMD_IV_512[4*i+2], - SIMD_IV_512[4*i+1], SIMD_IV_512[4*i+0] ); - return 0; -} - -int simd_4way_update( simd_4way_context *state, const void *data, - int databitlen ) -{ - int bs = state->blocksize; - int current = state->count & (bs - 1); - - while ( databitlen > 0 ) - { - if ( ( current == 0 ) && ( databitlen >= bs ) ) - { - // We can hash the data directly from the input buffer. - SIMD_4way_Compress( state, data, 0 ); - databitlen -= bs; - data += 4*(bs/8); - state->count += bs; - } - else - { - // Copy a chunk of data to the buffer - int len = bs - current; - if ( databitlen < len ) - { - memcpy( state->buffer + 4 * (current/8), data, 4 * (databitlen/8) ); - state->count += databitlen; - return 0; - } - else - { - memcpy( state->buffer + 4 * (current / 8), data, 4 * (len / 8) ); - state->count += len; - databitlen -= len; - data += 4*(len/8); - current = 0; - SIMD_4way_Compress( state, state->buffer, 0 ); - } - } - } - return 0; -} - -int simd_4way_close( simd_4way_context *state, void *hashval ) -{ - uint64_t l; - int current = state->count & (state->blocksize - 1); - int i; - int isshort = 1; - - // If there is still some data in the buffer, hash it - if ( current ) - { - current = ( current+7 ) / 8; - memset( state->buffer + 4*current, 0, 4*( state->blocksize/8 - current ) ); - SIMD_4way_Compress( state, state->buffer, 0 ); - } - - //* Input the message length as the last block - memset( state->buffer, 0, 4*(state->blocksize / 8) ); - l = state->count; - for ( i = 0; i < 8; i++ ) - { - state->buffer[ i ] = l & 0xff; - state->buffer[ i+16 ] = l & 0xff; - state->buffer[ i+32 ] = l & 0xff; - state->buffer[ i+48 ] = l & 0xff; - l >>= 8; - } - if ( state->count < 16384 ) - isshort = 2; - - SIMD_4way_Compress( state, state->buffer, isshort ); - memcpy( hashval, state->A, 4*(state->hashbitlen / 8) ); - - return 0; -} - -int simd_4way_update_close( simd_4way_context *state, void *hashval, - const void *data, int databitlen ) -{ - int current, i; - int bs = state->blocksize; // bits in one lane - int isshort = 1; - uint64_t l; - - current = state->count & (bs - 1); - - while ( databitlen > 0 ) - { - if ( current == 0 && databitlen >= bs ) - { - // We can hash the data directly from the input buffer. - SIMD_4way_Compress( state, data, 0 ); - databitlen -= bs; - data += 4*( bs/8 ); - state->count += bs; - } - else - { - // Copy a chunk of data to the buffer - int len = bs - current; - if ( databitlen < len ) - { - memcpy( state->buffer + 4*( current/8 ), data, 4*( (databitlen)/8 ) ); - state->count += databitlen; - break; - } - else - { - memcpy( state->buffer + 4*(current/8), data, 4*(len/8) ); - state->count += len; - databitlen -= len; - data += 4*( len/8 ); - current = 0; - SIMD_4way_Compress( state, state->buffer, 0 ); - } - } - } - - current = state->count & (state->blocksize - 1); - - // If there is still some data in the buffer, hash it - if ( current ) - { - current = current / 8; - memset( state->buffer + 4*current, 0, 4*( state->blocksize/8 - current) ); - SIMD_4way_Compress( state, state->buffer, 0 ); - } - - //* Input the message length as the last block - memset( state->buffer, 0, 4*( state->blocksize/8 ) ); - l = state->count; - for ( i = 0; i < 8; i++ ) - { - state->buffer[ i ] = l & 0xff; - state->buffer[ i+16 ] = l & 0xff; - state->buffer[ i+32 ] = l & 0xff; - state->buffer[ i+48 ] = l & 0xff; - l >>= 8; - } - if ( state->count < 16384 ) - isshort = 2; - - SIMD_4way_Compress( state, state->buffer, isshort ); - memcpy( hashval, state->A, 4*( state->hashbitlen / 8 ) ); - return 0; + FFT256_msg( y, m, final ); + ROUNDS512( state->A, m, y ); } -int simd512_4way_full( simd_4way_context *state, void *hashval, - const void *data, int datalen ) +int simd512_ctx( simd512_context *state, void *hashval, const void *data, + int datalen ) { - __m512i *A = (__m512i*)state->A; + v128u32_t *A = (v128u32_t*)state->A; state->hashbitlen = 512; state->n_feistels = 8; @@ -1076,15 +651,14 @@ int simd512_4way_full( simd_4way_context *state, void *hashval, state->count = 0; for ( int i = 0; i < 8; i++ ) - A[i] = _mm512_set4_epi32( SIMD_IV_512[4*i+3], SIMD_IV_512[4*i+2], - SIMD_IV_512[4*i+1], SIMD_IV_512[4*i+0] ); + A[i] = v128_set32( SIMD_IV_512[4*i+3], SIMD_IV_512[4*i+2], + SIMD_IV_512[4*i+1], SIMD_IV_512[4*i+0] ); int current, i; int bs = state->blocksize; // bits in one lane int isshort = 1; uint64_t l; int databitlen = datalen * 8; - current = state->count & (bs - 1); while ( databitlen > 0 ) @@ -1092,9 +666,9 @@ int simd512_4way_full( simd_4way_context *state, void *hashval, if ( current == 0 && databitlen >= bs ) { // We can hash the data directly from the input buffer. - SIMD_4way_Compress( state, data, 0 ); + SIMD512_Compress( state, data, 0 ); databitlen -= bs; - data += 4*( bs/8 ); + data += ( bs/8 ); state->count += bs; } else @@ -1103,18 +677,18 @@ int simd512_4way_full( simd_4way_context *state, void *hashval, int len = bs - current; if ( databitlen < len ) { - memcpy( state->buffer + 4*( current/8 ), data, 4*( (databitlen)/8 ) ); + memcpy( state->buffer + ( current/8 ), data, ( (databitlen+7)/8 ) ); state->count += databitlen; break; } else { - memcpy( state->buffer + 4*(current/8), data, 4*(len/8) ); + memcpy( state->buffer + (current/8), data, (len/8) ); state->count += len; databitlen -= len; - data += 4*( len/8 ); + data += ( len/8 ); current = 0; - SIMD_4way_Compress( state, state->buffer, 0 ); + SIMD512_Compress( state, state->buffer, 0 ); } } } @@ -1124,64 +698,294 @@ int simd512_4way_full( simd_4way_context *state, void *hashval, // If there is still some data in the buffer, hash it if ( current ) { - current = current / 8; - memset( state->buffer + 4*current, 0, 4*( state->blocksize/8 - current) ); - SIMD_4way_Compress( state, state->buffer, 0 ); + current = ( current+7 ) / 8; + memset( state->buffer + current, 0, ( state->blocksize/8 - current) ); + SIMD512_Compress( state, state->buffer, 0 ); } //* Input the message length as the last block - memset( state->buffer, 0, 4*( state->blocksize/8 ) ); + memset( state->buffer, 0, ( state->blocksize/8 ) ); l = state->count; for ( i = 0; i < 8; i++ ) { state->buffer[ i ] = l & 0xff; - state->buffer[ i+16 ] = l & 0xff; - state->buffer[ i+32 ] = l & 0xff; - state->buffer[ i+48 ] = l & 0xff; l >>= 8; } if ( state->count < 16384 ) isshort = 2; - SIMD_4way_Compress( state, state->buffer, isshort ); - memcpy( hashval, state->A, 4*( state->hashbitlen / 8 ) ); + SIMD512_Compress( state, state->buffer, isshort ); + memcpy( hashval, state->A, ( state->hashbitlen / 8 ) ); return 0; } - - -#endif // AVX512 - -//////////////////////////////////// -// -// SIMD 2 way AVX2 - -void fft64_2way( void *a ) +int simd512( void *hashval, const void *data, int datalen ) { - __m256i* const A = a; - register __m256i X0, X1, X2, X3, X4, X5, X6, X7; + simd512_context ctx; + simd512_ctx( &ctx, hashval, data, datalen ); + return 0; +} -#define X(i) X##i +#undef shuxor +#undef REDUCE +#undef EXTRA_REDUCE_S +#undef REDUCE_FULL_S +#undef DO_REDUCE_FULL_S +#undef c1_16 - X0 = A[0]; - X1 = A[1]; - X2 = A[2]; - X3 = A[3]; - X4 = A[4]; - X5 = A[5]; - X6 = A[6]; - X7 = A[7]; +#endif -#define DO_REDUCE(i) X(i) = REDUCE( X(i) ) +#if defined (__AVX2__) - // Begin with 8 parallels DIF FFT_8 - // - // FFT_8 using w=4 as 8th root of unity - // Unrolled decimation in frequency (DIF) radix-2 NTT. - // Output data is in revbin_permuted order. +union _m256_v16 { + uint16_t u16[16]; + __m256i v256; +}; +typedef union _m256_v16 m256_v16; - static const int w[] = {0, 2, 4, 6}; -// __m256i *Twiddle = (__m256i*)FFT64_Twiddle; +// targetted +/* Twiddle tables */ + +static const m256_v16 FFT64_Twiddle[] = +{ + {{ 1, 2, 4, 8, 16, 32, 64, 128, + 1, 2, 4, 8, 16, 32, 64, 128 }}, + {{ 1, 60, 2, 120, 4, -17, 8, -34, + 1, 60, 2, 120, 4, -17, 8, -34 }}, + {{ 1, 120, 8, -68, 64, -30, -2, 17, + 1, 120, 8, -68, 64, -30, -2, 17 }}, + {{ 1, 46, 60, -67, 2, 92, 120, 123, + 1, 46, 60, -67, 2, 92, 120, 123 }}, + {{ 1, 92, -17, -22, 32, 117, -30, 67, + 1, 92, -17, -22, 32, 117, -30, 67 }}, + {{ 1, -67, 120, -73, 8, -22, -68, -70, + 1, -67, 120, -73, 8, -22, -68, -70 }}, + {{ 1, 123, -34, -70, 128, 67, 17, 35, + 1, 123, -34, -70, 128, 67, 17, 35 }}, +}; + +static const m256_v16 FFT128_Twiddle[] = +{ + {{ 1, -118, 46, -31, 60, 116, -67, -61, + 1, -118, 46, -31, 60, 116, -67, -61 }}, + {{ 2, 21, 92, -62, 120, -25, 123, -122, + 2, 21, 92, -62, 120, -25, 123, -122 }}, + {{ 4, 42, -73, -124, -17, -50, -11, 13, + 4, 42, -73, -124, -17, -50, -11, 13 }}, + {{ 8, 84, 111, 9, -34, -100, -22, 26, + 8, 84, 111, 9, -34, -100, -22, 26 }}, + {{ 16, -89, -35, 18, -68, 57, -44, 52, + 16, -89, -35, 18, -68, 57, -44, 52 }}, + {{ 32, 79, -70, 36, 121, 114, -88, 104, + 32, 79, -70, 36, 121, 114, -88, 104 }}, + {{ 64, -99, 117, 72, -15, -29, 81, -49, + 64, -99, 117, 72, -15, -29, 81, -49 }}, + {{ 128, 59, -23, -113, -30, -58, -95, -98, + 128, 59, -23, -113, -30, -58, -95, -98 }}, +}; + +static const m256_v16 FFT256_Twiddle[] = +{ + {{ 1, 41, -118, 45, 46, 87, -31, 14, + 1, 41, -118, 45, 46, 87, -31, 14 }}, + {{ 60, -110, 116, -127, -67, 80, -61, 69, + 60, -110, 116, -127, -67, 80, -61, 69 }}, + {{ 2, 82, 21, 90, 92, -83, -62, 28, + 2, 82, 21, 90, 92, -83, -62, 28 }}, + {{ 120, 37, -25, 3, 123, -97, -122, -119, + 120, 37, -25, 3, 123, -97, -122, -119 }}, + {{ 4, -93, 42, -77, -73, 91, -124, 56, + 4, -93, 42, -77, -73, 91, -124, 56 }}, + {{ -17, 74, -50, 6, -11, 63, 13, 19, + -17, 74, -50, 6, -11, 63, 13, 19 }}, + {{ 8, 71, 84, 103, 111, -75, 9, 112, + 8, 71, 84, 103, 111, -75, 9, 112 }}, + {{ -34, -109, -100, 12, -22, 126, 26, 38, + -34, -109, -100, 12, -22, 126, 26, 38 }}, + {{ 16, -115, -89, -51, -35, 107, 18, -33, + 16, -115, -89, -51, -35, 107, 18, -33 }}, + {{ -68, 39, 57, 24, -44, -5, 52, 76, + -68, 39, 57, 24, -44, -5, 52, 76 }}, + {{ 32, 27, 79, -102, -70, -43, 36, -66, + 32, 27, 79, -102, -70, -43, 36, -66 }}, + {{ 121, 78, 114, 48, -88, -10, 104, -105, + 121, 78, 114, 48, -88, -10, 104, -105 }}, + {{ 64, 54, -99, 53, 117, -86, 72, 125, + 64, 54, -99, 53, 117, -86, 72, 125 }}, + {{ -15, -101, -29, 96, 81, -20, -49, 47, + -15, -101, -29, 96, 81, -20, -49, 47 }}, + {{ 128, 108, 59, 106, -23, 85, -113, -7, + 128, 108, 59, 106, -23, 85, -113, -7 }}, + {{ -30, 55, -58, -65, -95, -40, -98, 94, + -30, 55, -58, -65, -95, -40, -98, 94 }} +}; + +#if 0 +// generic +#define SHUFXOR_1 0xb1 // 0b10110001 +#define SHUFXOR_2 0x4e // 0b01001110 +#define SHUFXOR_3 0x1b // 0b00011011 + +#define CAT(x, y) x##y +#define XCAT(x,y) CAT(x,y) + +#define SUM7_00 0 +#define SUM7_01 1 +#define SUM7_02 2 +#define SUM7_03 3 +#define SUM7_04 4 +#define SUM7_05 5 +#define SUM7_06 6 + +#define SUM7_10 1 +#define SUM7_11 2 +#define SUM7_12 3 +#define SUM7_13 4 +#define SUM7_14 5 +#define SUM7_15 6 +#define SUM7_16 0 + +#define SUM7_20 2 +#define SUM7_21 3 +#define SUM7_22 4 +#define SUM7_23 5 +#define SUM7_24 6 +#define SUM7_25 0 +#define SUM7_26 1 + +#define SUM7_30 3 +#define SUM7_31 4 +#define SUM7_32 5 +#define SUM7_33 6 +#define SUM7_34 0 +#define SUM7_35 1 +#define SUM7_36 2 + +#define SUM7_40 4 +#define SUM7_41 5 +#define SUM7_42 6 +#define SUM7_43 0 +#define SUM7_44 1 +#define SUM7_45 2 +#define SUM7_46 3 + +#define SUM7_50 5 +#define SUM7_51 6 +#define SUM7_52 0 +#define SUM7_53 1 +#define SUM7_54 2 +#define SUM7_55 3 +#define SUM7_56 4 + +#define SUM7_60 6 +#define SUM7_61 0 +#define SUM7_62 1 +#define SUM7_63 2 +#define SUM7_64 3 +#define SUM7_65 4 +#define SUM7_66 5 + + +#define PERM(z,d,a,shufxor) XCAT(PERM_,XCAT(SUM7_##z,PERM_START))(d,a,shufxor) + +#define PERM_0(d,a,shufxor) /* XOR 1 */ \ +do { \ + d##l = shufxor( a##l, 1 ); \ + d##h = shufxor( a##h, 1 ); \ + } while(0) + +#define PERM_1(d,a,shufxor) /* XOR 6 */ \ +do { \ + d##l = shufxor( a##h, 2 ); \ + d##h = shufxor( a##l, 2 ); \ +} while(0) + +#define PERM_2(d,a,shufxor) /* XOR 2 */ \ +do { \ + d##l = shufxor( a##l, 2 ); \ + d##h = shufxor( a##h, 2 ); \ +} while(0) + +#define PERM_3(d,a,shufxor) /* XOR 3 */ \ +do { \ + d##l = shufxor( a##l, 3 ); \ + d##h = shufxor( a##h, 3 ); \ +} while(0) + +#define PERM_4(d,a,shufxor) /* XOR 5 */ \ +do { \ + d##l = shufxor( a##h, 1 ); \ + d##h = shufxor( a##l, 1 ); \ +} while(0) + +#define PERM_5(d,a,shufxor) /* XOR 7 */ \ +do { \ + d##l = shufxor( a##h, 3 ); \ + d##h = shufxor( a##l, 3 ); \ +} while(0) + +#define PERM_6(d,a,shufxor) /* XOR 4 */ \ +do { \ + d##l = a##h; \ + d##h = a##l; \ +} while(0) +#endif + +#define shufxor2w(x,s) _mm256_shuffle_epi32( x, XCAT( SHUFXOR_, s )) + +#if defined(__AVX512VL__) +//TODO Enable for AVX10_256 + +#define REDUCE(x) \ + _mm256_sub_epi16( _mm256_maskz_mov_epi8( 0x55555555, x ), \ + _mm256_srai_epi16( x, 8 ) ) +#else + +#define REDUCE(x) \ + _mm256_sub_epi16( _mm256_and_si256( x, _mm256_set1_epi64x( \ + 0x00ff00ff00ff00ff ) ), _mm256_srai_epi16( x, 8 ) ) + +#endif + +#define EXTRA_REDUCE_S(x)\ + _mm256_sub_epi16( x, _mm256_and_si256( \ + _mm256_set1_epi64x( 0x0101010101010101 ), \ + _mm256_cmpgt_epi16( x, _mm256_set1_epi64x( 0x0080008000800080 ) ) ) ) + +#define REDUCE_FULL_S( x ) EXTRA_REDUCE_S( REDUCE (x ) ) + +#define DO_REDUCE_FULL_S(i) \ +do { \ + X(i) = REDUCE( X(i) ); \ + X(i) = EXTRA_REDUCE_S( X(i) ); \ +} while(0) + +static void fft64_2way( void *a ) +{ + __m256i* const A = a; + register __m256i X0, X1, X2, X3, X4, X5, X6, X7; + +#define X(i) X##i + + X0 = A[0]; + X1 = A[1]; + X2 = A[2]; + X3 = A[3]; + X4 = A[4]; + X5 = A[5]; + X6 = A[6]; + X7 = A[7]; + +#define DO_REDUCE(i) X(i) = REDUCE( X(i) ) + + // Begin with 8 parallels DIF FFT_8 + // + // FFT_8 using w=4 as 8th root of unity + // Unrolled decimation in frequency (DIF) radix-2 NTT. + // Output data is in revbin_permuted order. + + static const int w[] = {0, 2, 4, 6}; +// __m256i *Twiddle = (__m256i*)FFT64_Twiddle; #define BUTTERFLY_0( i,j ) \ @@ -1326,6 +1130,7 @@ do { \ #undef BUTTERFLY_0 #undef BUTTERFLY_N #undef DO_REDUCE +#undef DO_REDUCE_FULL_S A[0] = X0; A[1] = X1; @@ -1339,13 +1144,12 @@ do { \ #undef X } -void fft128_2way( void *a ) +static void fft128_2way( void *a ) { int i; // Temp space to help for interleaving in the end __m256i B[8]; __m256i *A = (__m256i*) a; -// __m256i *Twiddle = (__m256i*)FFT128_Twiddle; /* Size-2 butterflies */ for ( i = 0; i<8; i++ ) @@ -1369,7 +1173,8 @@ void fft128_2way( void *a ) } } -void fft128_2way_msg( uint16_t *a, const uint8_t *x, int final ) + +static void fft256_2way_msg( uint16_t *a, const uint8_t *x, int final ) { const __m256i zero = _mm256_setzero_si256(); static const m256_v16 Tweak = {{ 0,0,0,0,0,0,0,1, 0,0,0,0,0,0,0,1, }}; @@ -1377,73 +1182,21 @@ void fft128_2way_msg( uint16_t *a, const uint8_t *x, int final ) __m256i *X = (__m256i*)x; __m256i *A = (__m256i*)a; -// __m256i *Twiddle = (__m256i*)FFT128_Twiddle; #define UNPACK( i ) \ do { \ __m256i t = X[i]; \ - A[2*i] = _mm256_unpacklo_epi8( t, zero ); \ - A[2*i+8] = _mm256_mullo_epi16( A[2*i], FFT128_Twiddle[2*i].v256 ); \ - A[2*i+8] = REDUCE(A[2*i+8]); \ - A[2*i+1] = _mm256_unpackhi_epi8( t, zero ); \ - A[2*i+9] = _mm256_mullo_epi16(A[2*i+1], FFT128_Twiddle[2*i+1].v256 ); \ - A[2*i+9] = REDUCE(A[2*i+9]); \ + A[ 2*i ] = _mm256_unpacklo_epi8( t, zero ); \ + A[ 2*i + 16 ] = _mm256_mullo_epi16( A[ 2*i ], \ + FFT256_Twiddle[ 2*i ].v256 ); \ + A[ 2*i + 16 ] = REDUCE( A[ 2*i + 16 ] ); \ + A[ 2*i + 1 ] = _mm256_unpackhi_epi8( t, zero ); \ + A[ 2*i + 17 ] = _mm256_mullo_epi16( A[ 2*i + 1 ], \ + FFT256_Twiddle[ 2*i + 1 ].v256 ); \ + A[ 2*i + 17 ] = REDUCE( A[ 2*i + 17 ] ); \ } while(0) - // This allows to tweak the last butterflies to introduce X^127 -#define UNPACK_TWEAK( i,tw ) \ -do { \ - __m256i t = X[i]; \ - __m256i tmp; \ - A[2*i] = _mm256_unpacklo_epi8( t, zero ); \ - A[2*i+8] = _mm256_mullo_epi16( A[ 2*i ], FFT128_Twiddle[ 2*i ].v256 ); \ - A[2*i+8] = REDUCE( A[ 2*i+8 ] ); \ - tmp = _mm256_unpackhi_epi8( t, zero ); \ - A[2*i+1] = _mm256_add_epi16( tmp, tw ); \ - A[2*i+9] = _mm256_mullo_epi16( _mm256_sub_epi16( tmp, tw ), \ - FFT128_Twiddle[ 2*i+1 ].v256 );\ - A[2*i+9] = REDUCE( A[ 2*i+9 ] ); \ -} while(0) - - UNPACK( 0 ); - UNPACK( 1 ); - UNPACK( 2 ); - if ( final ) - UNPACK_TWEAK( 3, FinalTweak.v256 ); - else - UNPACK_TWEAK( 3, Tweak.v256 ); - -#undef UNPACK -#undef UNPACK_TWEAK - - fft64_2way( a ); - fft64_2way( a+128 ); -} - -void fft256_2way_msg( uint16_t *a, const uint8_t *x, int final ) -{ - const __m256i zero = _mm256_setzero_si256(); - static const m256_v16 Tweak = {{ 0,0,0,0,0,0,0,1, 0,0,0,0,0,0,0,1, }}; - static const m256_v16 FinalTweak = {{ 0,0,0,0,0,1,0,1, 0,0,0,0,0,1,0,1, }}; - - __m256i *X = (__m256i*)x; - __m256i *A = (__m256i*)a; -// __m256i *Twiddle = (__m256i*)FFT256_Twiddle; - -#define UNPACK( i ) \ -do { \ - __m256i t = X[i]; \ - A[ 2*i ] = _mm256_unpacklo_epi8( t, zero ); \ - A[ 2*i + 16 ] = _mm256_mullo_epi16( A[ 2*i ], \ - FFT256_Twiddle[ 2*i ].v256 ); \ - A[ 2*i + 16 ] = REDUCE( A[ 2*i + 16 ] ); \ - A[ 2*i + 1 ] = _mm256_unpackhi_epi8( t, zero ); \ - A[ 2*i + 17 ] = _mm256_mullo_epi16( A[ 2*i + 1 ], \ - FFT256_Twiddle[ 2*i + 1 ].v256 ); \ - A[ 2*i + 17 ] = REDUCE( A[ 2*i + 17 ] ); \ -} while(0) - - // This allows to tweak the last butterflies to introduce X^127 + // This allows to tweak the last butterflies to introduce X^127 #define UNPACK_TWEAK( i,tw ) \ do { \ __m256i t = X[i]; \ @@ -1477,10 +1230,9 @@ do { \ fft128_2way( a+256 ); } - #define c1_16( x ) {{ x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x }} -void rounds512_2way( uint32_t *state, const uint8_t *msg, uint16_t *fft ) +static void rounds512_2way( uint32_t *state, const uint8_t *msg, uint16_t *fft ) { register __m256i S0l, S1l, S2l, S3l; register __m256i S0h, S1h, S2h, S3h; @@ -1488,7 +1240,7 @@ void rounds512_2way( uint32_t *state, const uint8_t *msg, uint16_t *fft ) __m256i *M = (__m256i*) msg; __m256i *W = (__m256i*) fft; static const m256_v16 code[] = { c1_16(185), c1_16(233) }; - + S0l = _mm256_xor_si256( S[0], M[0] ); S0h = _mm256_xor_si256( S[1], M[1] ); @@ -1510,138 +1262,886 @@ void rounds512_2way( uint32_t *state, const uint8_t *msg, uint16_t *fft ) #define Fl(a,b,c,fun) F_##fun (a##l,b##l,c##l) #define Fh(a,b,c,fun) F_##fun (a##h,b##h,c##h) - // We split the round function in two halfes - // so as to insert some independent computations in between -#if 0 -#define SUM7_00 0 -#define SUM7_01 1 -#define SUM7_02 2 -#define SUM7_03 3 -#define SUM7_04 4 -#define SUM7_05 5 -#define SUM7_06 6 +#define STEP_1_(a,b,c,d,w,fun,r,s,z) \ +do { \ + TTl = Fl( a,b,c,fun ); \ + TTh = Fh( a,b,c,fun ); \ + a##l = mm256_rol_32( a##l, r ); \ + a##h = mm256_rol_32( a##h, r ); \ + w##l = _mm256_add_epi32( w##l, d##l ); \ + w##h = _mm256_add_epi32( w##h, d##h ); \ + TTl = _mm256_add_epi32( TTl, w##l ); \ + TTh = _mm256_add_epi32( TTh, w##h ); \ + TTl = mm256_rol_32( TTl, s ); \ + TTh = mm256_rol_32( TTh, s ); \ + PERM( z,d,a, shufxor2w ); \ +} while(0) -#define SUM7_10 1 -#define SUM7_11 2 -#define SUM7_12 3 -#define SUM7_13 4 -#define SUM7_14 5 -#define SUM7_15 6 -#define SUM7_16 0 +#define STEP_1( a,b,c,d,w,fun,r,s,z ) STEP_1_( a,b,c,d,w,fun,r,s,z ) -#define SUM7_20 2 -#define SUM7_21 3 -#define SUM7_22 4 -#define SUM7_23 5 -#define SUM7_24 6 -#define SUM7_25 0 -#define SUM7_26 1 +#define STEP_2_( a,b,c,d,w,fun,r,s ) \ +do { \ + d##l = _mm256_add_epi32( d##l, TTl ); \ + d##h = _mm256_add_epi32( d##h, TTh ); \ +} while(0) -#define SUM7_30 3 -#define SUM7_31 4 -#define SUM7_32 5 -#define SUM7_33 6 -#define SUM7_34 0 -#define SUM7_35 1 -#define SUM7_36 2 +#define STEP_2( a,b,c,d,w,fun,r,s ) STEP_2_( a,b,c,d,w,fun,r,s ) + +#define STEP( a,b,c,d,w1,w2,fun,r,s,z ) \ +do { \ + register __m256i TTl, TTh, Wl=w1, Wh=w2; \ + STEP_1( a,b,c,d,W,fun,r,s,z ); \ + STEP_2( a,b,c,d,W,fun,r,s ); \ +} while(0); + +#define MSG_l(x) (2*(x)) +#define MSG_h(x) (2*(x)+1) + +#define MSG( w,hh,ll,u,z ) \ +do { \ + int a = MSG_##u(hh); \ + int b = MSG_##u(ll); \ + w##l = _mm256_unpacklo_epi16( W[a], W[b] ); \ + w##l = _mm256_mullo_epi16( w##l, code[z].v256 ); \ + w##h = _mm256_unpackhi_epi16( W[a], W[b]) ; \ + w##h = _mm256_mullo_epi16( w##h, code[z].v256 ); \ +} while(0) + +#define ROUND( h0,l0,u0,h1,l1,u1,h2,l2,u2,h3,l3,u3,fun,r,s,t,u,z ) \ +do { \ + register __m256i W0l, W1l, W2l, W3l, TTl; \ + register __m256i W0h, W1h, W2h, W3h, TTh; \ + MSG( W0, h0, l0, u0, z ); \ + STEP_1( S(0), S(1), S(2), S(3), W0, fun, r, s, 0 ); \ + MSG( W1, h1, l1, u1, z ); \ + STEP_2( S(0), S(1), S(2), S(3), W0, fun, r, s ); \ + STEP_1( S(3), S(0), S(1), S(2), W1, fun, s, t, 1 ); \ + MSG( W2,h2,l2,u2,z ); \ + STEP_2( S(3), S(0), S(1), S(2), W1, fun, s, t ); \ + STEP_1( S(2), S(3), S(0), S(1), W2, fun, t, u, 2 ); \ + MSG( W3,h3,l3,u3,z ); \ + STEP_2( S(2), S(3), S(0), S(1), W2, fun, t, u ); \ + STEP_1( S(1), S(2), S(3), S(0), W3, fun, u, r, 3 ); \ + STEP_2( S(1), S(2), S(3), S(0), W3, fun, u, r ); \ +} while(0) + + // 4 rounds with code 185 +#define PERM_START 0 + ROUND( 2, 10, l, 3, 11, l, 0, 8, l, 1, 9, l, 0, 3, 23, 17, 27, 0); +#undef PERM_START +#define PERM_START 4 + ROUND( 3, 11, h, 2, 10, h, 1, 9, h, 0, 8, h, 1, 3, 23, 17, 27, 0); +#undef PERM_START +#define PERM_START 1 + ROUND( 7, 15, h, 5, 13, h, 6, 14, l, 4, 12, l, 0, 28, 19, 22, 7, 0); +#undef PERM_START +#define PERM_START 5 + ROUND( 4, 12, h, 6, 14, h, 5, 13, l, 7, 15, l, 1, 28, 19, 22, 7, 0); +#undef PERM_START + + // 4 rounds with code 233 +#define PERM_START 2 + ROUND( 0, 4, h, 1, 5, l, 3, 7, h, 2, 6, l, 0, 29, 9, 15, 5, 1); +#undef PERM_START +#define PERM_START 6 + ROUND( 3, 7, l, 2, 6, h, 0, 4, l, 1, 5, h, 1, 29, 9, 15, 5, 1); +#undef PERM_START +#define PERM_START 3 + ROUND( 11, 15, l, 8, 12, l, 8, 12, h, 11, 15, h, 0, 4, 13, 10, 25, 1); +#undef PERM_START +#define PERM_START 0 + ROUND( 9, 13, h, 10, 14, h, 10, 14, l, 9, 13, l, 1, 4, 13, 10, 25, 1); +#undef PERM_START + + // 1 round as feed-forward +#define PERM_START 4 + STEP( S(0), S(1), S(2), S(3), S[0], S[1], 0, 4, 13, 0 ); + STEP( S(3), S(0), S(1), S(2), S[2], S[3], 0, 13, 10, 1 ); + STEP( S(2), S(3), S(0), S(1), S[4], S[5], 0, 10, 25, 2 ); + STEP( S(1), S(2), S(3), S(0), S[6], S[7], 0, 25, 4, 3 ); + + S[0] = S0l; S[1] = S0h; S[2] = S1l; S[3] = S1h; + S[4] = S2l; S[5] = S2h; S[6] = S3l; S[7] = S3h; + +#undef PERM_START +#undef STEP_1 +#undef STEP_1_ +#undef STEP_2 +#undef STEP_2_ +#undef STEP +#undef ROUND +#undef S +#undef F_0 +#undef F_1 +#undef Fl +#undef Fh +#undef MSG_l +#undef MSG_h +#undef MSG +} + +static void SIMD_2way_Compress( simd_2way_context *state, const void *m, int final ) +{ + m256_v16 Y[32]; + uint16_t *y = (uint16_t*) Y[0].u16; + + fft256_2way_msg( y, m, final ); + + rounds512_2way( state->A, m, y ); +} + +int simd_2way_init( simd_2way_context *state, int hashbitlen ) +{ + __m256i *A = (__m256i*)state->A; + int n = 8; + + state->hashbitlen = hashbitlen; + state->n_feistels = n; + state->blocksize = 128*8; + state->count = 0; + + for ( int i = 0; i < 8; i++ ) + A[i] = _mm256_set_epi32( SIMD_IV_512[4*i+3], SIMD_IV_512[4*i+2], + SIMD_IV_512[4*i+1], SIMD_IV_512[4*i+0], + SIMD_IV_512[4*i+3], SIMD_IV_512[4*i+2], + SIMD_IV_512[4*i+1], SIMD_IV_512[4*i+0] ); + return 0; +} + +int simd_2way_update( simd_2way_context *state, const void *data, + int databitlen ) +{ + int bs = state->blocksize; + int current = state->count & (bs - 1); + + while ( databitlen > 0 ) + { + if ( current == 0 && databitlen >= bs ) + { + // We can hash the data directly from the input buffer. + SIMD_2way_Compress( state, data, 0 ); + databitlen -= bs; + data += 2*(bs/8); + state->count += bs; + } + else + { + // Copy a chunk of data to the buffer + int len = bs - current; + if ( databitlen < len ) + { + memcpy( state->buffer + 2*(current/8), data, 2*((databitlen+7)/8) ); + state->count += databitlen; + return 0; + } + else + { + memcpy( state->buffer + 2*(current/8), data, 2*(len/8) ); + state->count += len; + databitlen -= len; + data += 2*(len/8); + current = 0; + SIMD_2way_Compress( state, state->buffer, 0 ); + } + } + } + return 0; +} + +int simd_2way_close( simd_2way_context *state, void *hashval ) +{ + uint64_t l; + int current = state->count & (state->blocksize - 1); + int i; + int isshort = 1; + + // If there is still some data in the buffer, hash it + if ( current ) + { + current = ( current+7 ) / 8; + memset( state->buffer + 2*current, 0, 2*( state->blocksize/8 - current ) ); + SIMD_2way_Compress( state, state->buffer, 0 ); + } + + //* Input the message length as the last block + memset( state->buffer, 0, 2*(state->blocksize / 8) ); + l = state->count; + for ( i = 0; i < 8; i++ ) + { + state->buffer[ i ] = l & 0xff; + state->buffer[ i+16 ] = l & 0xff; + l >>= 8; + } + if ( state->count < 16384 ) + isshort = 2; + + SIMD_2way_Compress( state, state->buffer, isshort ); + memcpy( hashval, state->A, 2*(state->hashbitlen / 8) ); + + return 0; +} + +int simd_2way_update_close( simd_2way_context *state, void *hashval, + const void *data, int databitlen ) +{ + int current, i; + int bs = state->blocksize; // bits in one lane + int isshort = 1; + uint64_t l; + + current = state->count & (bs - 1); + + while ( databitlen > 0 ) + { + if ( current == 0 && databitlen >= bs ) + { + // We can hash the data directly from the input buffer. + SIMD_2way_Compress( state, data, 0 ); + + databitlen -= bs; + data += 2*( bs/8 ); + state->count += bs; + } + else + { + // Copy a chunk of data to the buffer + int len = bs - current; + if ( databitlen < len ) + { + memcpy( state->buffer + 2*( current/8 ), data, 2*( (databitlen+7)/8 ) ); + state->count += databitlen; + break; + } + else + { + memcpy( state->buffer + 2*(current/8), data, 2*(len/8) ); + state->count += len; + databitlen -= len; + data += 2*( len/8 ); + current = 0; + SIMD_2way_Compress( state, state->buffer, 0 ); + } + } + } + + current = state->count & (state->blocksize - 1); + + // If there is still some data in the buffer, hash it + if ( current ) + { + current = ( current+7 ) / 8; + memset( state->buffer + 2*current, 0, 2*( state->blocksize/8 - current) ); + SIMD_2way_Compress( state, state->buffer, 0 ); + } + + //* Input the message length as the last block + memset( state->buffer, 0, 2*( state->blocksize/8 ) ); + l = state->count; + for ( i = 0; i < 8; i++ ) + { + state->buffer[ i ] = l & 0xff; + state->buffer[ i+16 ] = l & 0xff; + l >>= 8; + } + if ( state->count < 16384 ) + isshort = 2; + + SIMD_2way_Compress( state, state->buffer, isshort ); + memcpy( hashval, state->A, 2*( state->hashbitlen / 8 ) ); + return 0; +} + +int simd512_2way_ctx( simd_2way_context *state, void *hashval, + const void *data, int datalen ) +{ + __m256i *A = (__m256i*)state->A; + + state->hashbitlen = 512; + state->n_feistels = 8; + state->blocksize = 128*8; + state->count = 0; + + for ( int i = 0; i < 8; i++ ) + A[i] = _mm256_set_epi32( SIMD_IV_512[4*i+3], SIMD_IV_512[4*i+2], + SIMD_IV_512[4*i+1], SIMD_IV_512[4*i+0], + SIMD_IV_512[4*i+3], SIMD_IV_512[4*i+2], + SIMD_IV_512[4*i+1], SIMD_IV_512[4*i+0] ); + + int current, i; + int bs = state->blocksize; // bits in one lane + int isshort = 1; + uint64_t l; + int databitlen = datalen * 8; + + current = state->count & (bs - 1); + + while ( databitlen > 0 ) + { + if ( current == 0 && databitlen >= bs ) + { + // We can hash the data directly from the input buffer. + SIMD_2way_Compress( state, data, 0 ); + + databitlen -= bs; + data += 2*( bs/8 ); + state->count += bs; + } + else + { + // Copy a chunk of data to the buffer + int len = bs - current; + if ( databitlen < len ) + { + memcpy( state->buffer + 2*( current/8 ), data, 2*( (databitlen+7)/8 ) ); + state->count += databitlen; + break; + } + else + { + memcpy( state->buffer + 2*(current/8), data, 2*(len/8) ); + state->count += len; + databitlen -= len; + data += 2*( len/8 ); + current = 0; + SIMD_2way_Compress( state, state->buffer, 0 ); + } + } + } + + current = state->count & (state->blocksize - 1); + + // If there is still some data in the buffer, hash it + if ( current ) + { + current = ( current+7 ) / 8; + memset( state->buffer + 2*current, 0, 2*( state->blocksize/8 - current) ); + SIMD_2way_Compress( state, state->buffer, 0 ); + } + + //* Input the message length as the last block + memset( state->buffer, 0, 2*( state->blocksize/8 ) ); + l = state->count; + for ( i = 0; i < 8; i++ ) + { + state->buffer[ i ] = l & 0xff; + state->buffer[ i+16 ] = l & 0xff; + l >>= 8; + } + if ( state->count < 16384 ) + isshort = 2; + + SIMD_2way_Compress( state, state->buffer, isshort ); + memcpy( hashval, state->A, 2*( state->hashbitlen / 8 ) ); + return 0; +} + +int simd512_2way( void *hashval, const void *data, int datalen ) +{ + simd512_2way_context ctx; + simd512_2way_ctx( &ctx, hashval, data, datalen ); + return 0; +} + +#endif + +#if defined(__AVX512F__) && defined(__AVX512VL__) && defined(__AVX512DQ__) && defined(__AVX512BW__) + +//////////////////////////////////// +// +// SIMD 4 way AVX512 + +union _m512_v16 { + uint16_t u16[32]; + __m512i v512; +}; +typedef union _m512_v16 m512_v16; + +static const m512_v16 FFT64_Twiddle4w[] = +{ + {{ 1, 2, 4, 8, 16, 32, 64, 128, + 1, 2, 4, 8, 16, 32, 64, 128, + 1, 2, 4, 8, 16, 32, 64, 128, + 1, 2, 4, 8, 16, 32, 64, 128 }}, + {{ 1, 60, 2, 120, 4, -17, 8, -34, + 1, 60, 2, 120, 4, -17, 8, -34, + 1, 60, 2, 120, 4, -17, 8, -34, + 1, 60, 2, 120, 4, -17, 8, -34 }}, + {{ 1, 120, 8, -68, 64, -30, -2, 17, + 1, 120, 8, -68, 64, -30, -2, 17, + 1, 120, 8, -68, 64, -30, -2, 17, + 1, 120, 8, -68, 64, -30, -2, 17 }}, + {{ 1, 46, 60, -67, 2, 92, 120, 123, + 1, 46, 60, -67, 2, 92, 120, 123, + 1, 46, 60, -67, 2, 92, 120, 123, + 1, 46, 60, -67, 2, 92, 120, 123 }}, + {{ 1, 92, -17, -22, 32, 117, -30, 67, + 1, 92, -17, -22, 32, 117, -30, 67, + 1, 92, -17, -22, 32, 117, -30, 67, + 1, 92, -17, -22, 32, 117, -30, 67 }}, + {{ 1, -67, 120, -73, 8, -22, -68, -70, + 1, -67, 120, -73, 8, -22, -68, -70, + 1, -67, 120, -73, 8, -22, -68, -70, + 1, -67, 120, -73, 8, -22, -68, -70 }}, + {{ 1, 123, -34, -70, 128, 67, 17, 35, + 1, 123, -34, -70, 128, 67, 17, 35, + 1, 123, -34, -70, 128, 67, 17, 35, + 1, 123, -34, -70, 128, 67, 17, 35 }}, +}; + +static const m512_v16 FFT128_Twiddle4w[] = +{ + {{ 1, -118, 46, -31, 60, 116, -67, -61, + 1, -118, 46, -31, 60, 116, -67, -61, + 1, -118, 46, -31, 60, 116, -67, -61, + 1, -118, 46, -31, 60, 116, -67, -61 }}, + {{ 2, 21, 92, -62, 120, -25, 123, -122, + 2, 21, 92, -62, 120, -25, 123, -122, + 2, 21, 92, -62, 120, -25, 123, -122, + 2, 21, 92, -62, 120, -25, 123, -122 }}, + {{ 4, 42, -73, -124, -17, -50, -11, 13, + 4, 42, -73, -124, -17, -50, -11, 13, + 4, 42, -73, -124, -17, -50, -11, 13, + 4, 42, -73, -124, -17, -50, -11, 13 }}, + {{ 8, 84, 111, 9, -34, -100, -22, 26, + 8, 84, 111, 9, -34, -100, -22, 26, + 8, 84, 111, 9, -34, -100, -22, 26, + 8, 84, 111, 9, -34, -100, -22, 26 }}, + {{ 16, -89, -35, 18, -68, 57, -44, 52, + 16, -89, -35, 18, -68, 57, -44, 52, + 16, -89, -35, 18, -68, 57, -44, 52, + 16, -89, -35, 18, -68, 57, -44, 52 }}, + {{ 32, 79, -70, 36, 121, 114, -88, 104, + 32, 79, -70, 36, 121, 114, -88, 104, + 32, 79, -70, 36, 121, 114, -88, 104, + 32, 79, -70, 36, 121, 114, -88, 104 }}, + {{ 64, -99, 117, 72, -15, -29, 81, -49, + 64, -99, 117, 72, -15, -29, 81, -49, + 64, -99, 117, 72, -15, -29, 81, -49, + 64, -99, 117, 72, -15, -29, 81, -49 }}, + {{ 128, 59, -23, -113, -30, -58, -95, -98, + 128, 59, -23, -113, -30, -58, -95, -98, + 128, 59, -23, -113, -30, -58, -95, -98, + 128, 59, -23, -113, -30, -58, -95, -98 }}, +}; + +static const m512_v16 FFT256_Twiddle4w[] = +{ + {{ 1, 41, -118, 45, 46, 87, -31, 14, + 1, 41, -118, 45, 46, 87, -31, 14, + 1, 41, -118, 45, 46, 87, -31, 14, + 1, 41, -118, 45, 46, 87, -31, 14 }}, + {{ 60, -110, 116, -127, -67, 80, -61, 69, + 60, -110, 116, -127, -67, 80, -61, 69, + 60, -110, 116, -127, -67, 80, -61, 69, + 60, -110, 116, -127, -67, 80, -61, 69 }}, + {{ 2, 82, 21, 90, 92, -83, -62, 28, + 2, 82, 21, 90, 92, -83, -62, 28, + 2, 82, 21, 90, 92, -83, -62, 28, + 2, 82, 21, 90, 92, -83, -62, 28 }}, + {{ 120, 37, -25, 3, 123, -97, -122, -119, + 120, 37, -25, 3, 123, -97, -122, -119, + 120, 37, -25, 3, 123, -97, -122, -119, + 120, 37, -25, 3, 123, -97, -122, -119 }}, + {{ 4, -93, 42, -77, -73, 91, -124, 56, + 4, -93, 42, -77, -73, 91, -124, 56, + 4, -93, 42, -77, -73, 91, -124, 56, + 4, -93, 42, -77, -73, 91, -124, 56 }}, + {{ -17, 74, -50, 6, -11, 63, 13, 19, + -17, 74, -50, 6, -11, 63, 13, 19, + -17, 74, -50, 6, -11, 63, 13, 19, + -17, 74, -50, 6, -11, 63, 13, 19 }}, + {{ 8, 71, 84, 103, 111, -75, 9, 112, + 8, 71, 84, 103, 111, -75, 9, 112, + 8, 71, 84, 103, 111, -75, 9, 112, + 8, 71, 84, 103, 111, -75, 9, 112 }}, + {{ -34, -109, -100, 12, -22, 126, 26, 38, + -34, -109, -100, 12, -22, 126, 26, 38, + -34, -109, -100, 12, -22, 126, 26, 38, + -34, -109, -100, 12, -22, 126, 26, 38 }}, + {{ 16, -115, -89, -51, -35, 107, 18, -33, + 16, -115, -89, -51, -35, 107, 18, -33, + 16, -115, -89, -51, -35, 107, 18, -33, + 16, -115, -89, -51, -35, 107, 18, -33 }}, + {{ -68, 39, 57, 24, -44, -5, 52, 76, + -68, 39, 57, 24, -44, -5, 52, 76, + -68, 39, 57, 24, -44, -5, 52, 76, + -68, 39, 57, 24, -44, -5, 52, 76 }}, + {{ 32, 27, 79, -102, -70, -43, 36, -66, + 32, 27, 79, -102, -70, -43, 36, -66, + 32, 27, 79, -102, -70, -43, 36, -66, + 32, 27, 79, -102, -70, -43, 36, -66 }}, + {{ 121, 78, 114, 48, -88, -10, 104, -105, + 121, 78, 114, 48, -88, -10, 104, -105, + 121, 78, 114, 48, -88, -10, 104, -105, + 121, 78, 114, 48, -88, -10, 104, -105 }}, + {{ 64, 54, -99, 53, 117, -86, 72, 125, + 64, 54, -99, 53, 117, -86, 72, 125, + 64, 54, -99, 53, 117, -86, 72, 125, + 64, 54, -99, 53, 117, -86, 72, 125 }}, + {{ -15, -101, -29, 96, 81, -20, -49, 47, + -15, -101, -29, 96, 81, -20, -49, 47, + -15, -101, -29, 96, 81, -20, -49, 47, + -15, -101, -29, 96, 81, -20, -49, 47 }}, + {{ 128, 108, 59, 106, -23, 85, -113, -7, + 128, 108, 59, 106, -23, 85, -113, -7, + 128, 108, 59, 106, -23, 85, -113, -7, + 128, 108, 59, 106, -23, 85, -113, -7 }}, + {{ -30, 55, -58, -65, -95, -40, -98, 94, + -30, 55, -58, -65, -95, -40, -98, 94, + -30, 55, -58, -65, -95, -40, -98, 94, + -30, 55, -58, -65, -95, -40, -98, 94 }} +}; + +#define shufxor4w(x,s) _mm512_shuffle_epi32( x, XCAT( SHUFXOR_, s )) + +#define REDUCE4w(x) \ + _mm512_sub_epi16( _mm512_maskz_mov_epi8( 0x5555555555555555, x ), \ + _mm512_srai_epi16( x, 8 ) ) + +#define EXTRA_REDUCE_S4w(x) \ + _mm512_sub_epi16( x, _mm512_and_si512( \ + _mm512_set1_epi64( 0x0101010101010101 ), \ + _mm512_movm_epi16( _mm512_cmpgt_epi16_mask( \ + x, _mm512_set1_epi64( 0x0080008000800080 ) ) ) ) ) + +// generic, except it calls targetted macros +#define REDUCE_FULL_S4w( x ) EXTRA_REDUCE_S4w( REDUCE4w (x ) ) + +//#define DO_REDUCE4w( i ) X(i) = REDUCE4w( X(i) ) + +#define DO_REDUCE_FULL_S4w(i) \ +do { \ + X(i) = REDUCE4w( X(i) ); \ + X(i) = EXTRA_REDUCE_S4w( X(i) ); \ +} while(0) + + +// targetted +static void fft64_4way( void *a ) +{ + __m512i* const A = a; + register __m512i X0, X1, X2, X3, X4, X5, X6, X7; + +// generic +#define X(i) X##i + + X0 = A[0]; + X1 = A[1]; + X2 = A[2]; + X3 = A[3]; + X4 = A[4]; + X5 = A[5]; + X6 = A[6]; + X7 = A[7]; + +#define DO_REDUCE(i) X(i) = REDUCE4w( X(i) ) + + // Begin with 8 parallels DIF FFT_8 + // + // FFT_8 using w=4 as 8th root of unity + // Unrolled decimation in frequency (DIF) radix-2 NTT. + // Output data is in revbin_permuted order. + +// targetted +#define BUTTERFLY_0( i,j ) \ +do { \ + __m512i v = X(j); \ + X(j) = _mm512_add_epi16( X(i), X(j) ); \ + X(i) = _mm512_sub_epi16( X(i), v ); \ +} while(0) + +#define BUTTERFLY_N( i, j, w ) \ +do { \ + __m512i v = X(j); \ + X(j) = _mm512_add_epi16( X(i), X(j) ); \ + X(i) = _mm512_slli_epi16( _mm512_sub_epi16( X(i), v ), w ); \ +} while(0) + + BUTTERFLY_0( 0, 4 ); + BUTTERFLY_N( 1, 5, 2 ); + BUTTERFLY_N( 2, 6, 4 ); + BUTTERFLY_N( 3, 7, 6 ); + + DO_REDUCE( 2 ); + DO_REDUCE( 3 ); + + BUTTERFLY_0( 0, 2 ); + BUTTERFLY_0( 4, 6 ); + BUTTERFLY_N( 1, 3, 4 ); + BUTTERFLY_N( 5, 7, 4 ); + + DO_REDUCE( 1 ); + + BUTTERFLY_0( 0, 1 ); + BUTTERFLY_0( 2, 3 ); + BUTTERFLY_0( 4, 5 ); + BUTTERFLY_0( 6, 7 ); + + /* We don't need to reduce X(7) */ + DO_REDUCE_FULL_S4w( 0 ); + DO_REDUCE_FULL_S4w( 1 ); + DO_REDUCE_FULL_S4w( 2 ); + DO_REDUCE_FULL_S4w( 3 ); + DO_REDUCE_FULL_S4w( 4 ); + DO_REDUCE_FULL_S4w( 5 ); + DO_REDUCE_FULL_S4w( 6 ); + +#undef BUTTERFLY_0 +#undef BUTTERFLY_N + + // Multiply by twiddle factors + X(6) = _mm512_mullo_epi16( X(6), FFT64_Twiddle4w[0].v512 ); + X(5) = _mm512_mullo_epi16( X(5), FFT64_Twiddle4w[1].v512 ); + X(4) = _mm512_mullo_epi16( X(4), FFT64_Twiddle4w[2].v512 ); + X(3) = _mm512_mullo_epi16( X(3), FFT64_Twiddle4w[3].v512 ); + X(2) = _mm512_mullo_epi16( X(2), FFT64_Twiddle4w[4].v512 ); + X(1) = _mm512_mullo_epi16( X(1), FFT64_Twiddle4w[5].v512 ); + X(0) = _mm512_mullo_epi16( X(0), FFT64_Twiddle4w[6].v512 ); + + // Transpose the FFT state with a revbin order permutation + // on the rows and the column. + // This will make the full FFT_64 in order. +#define INTERLEAVE( i, j ) \ + do { \ + __m512i u = X(j); \ + X(j) = _mm512_unpackhi_epi16( X(i), X(j) ); \ + X(i) = _mm512_unpacklo_epi16( X(i), u ); \ + } while(0) + + INTERLEAVE( 1, 0 ); + INTERLEAVE( 3, 2 ); + INTERLEAVE( 5, 4 ); + INTERLEAVE( 7, 6 ); + + INTERLEAVE( 2, 0 ); + INTERLEAVE( 3, 1 ); + INTERLEAVE( 6, 4 ); + INTERLEAVE( 7, 5 ); + + INTERLEAVE( 4, 0 ); + INTERLEAVE( 5, 1 ); + INTERLEAVE( 6, 2 ); + INTERLEAVE( 7, 3 ); + +#undef INTERLEAVE + +#define BUTTERFLY_0( i,j ) \ +do { \ + __m512i u = X(j); \ + X(j) = _mm512_sub_epi16( X(j), X(i) ); \ + X(i) = _mm512_add_epi16( u, X(i) ); \ +} while(0) + + +#define BUTTERFLY_N( i, j, w ) \ +do { \ + __m512i u = X(j); \ + X(i) = _mm512_slli_epi16( X(i), w ); \ + X(j) = _mm512_sub_epi16( X(j), X(i) ); \ + X(i) = _mm512_add_epi16( u, X(i) ); \ +} while(0) + + DO_REDUCE( 0 ); + DO_REDUCE( 1 ); + DO_REDUCE( 2 ); + DO_REDUCE( 3 ); + DO_REDUCE( 4 ); + DO_REDUCE( 5 ); + DO_REDUCE( 6 ); + DO_REDUCE( 7 ); + + BUTTERFLY_0( 0, 1 ); + BUTTERFLY_0( 2, 3 ); + BUTTERFLY_0( 4, 5 ); + BUTTERFLY_0( 6, 7 ); + + BUTTERFLY_0( 0, 2 ); + BUTTERFLY_0( 4, 6 ); + BUTTERFLY_N( 1, 3, 4 ); + BUTTERFLY_N( 5, 7, 4 ); + + DO_REDUCE( 3 ); + + BUTTERFLY_0( 0, 4 ); + BUTTERFLY_N( 1, 5, 2 ); + BUTTERFLY_N( 2, 6, 4 ); + BUTTERFLY_N( 3, 7, 6 ); + + DO_REDUCE_FULL_S4w( 0 ); + DO_REDUCE_FULL_S4w( 1 ); + DO_REDUCE_FULL_S4w( 2 ); + DO_REDUCE_FULL_S4w( 3 ); + DO_REDUCE_FULL_S4w( 4 ); + DO_REDUCE_FULL_S4w( 5 ); + DO_REDUCE_FULL_S4w( 6 ); + DO_REDUCE_FULL_S4w( 7 ); + +#undef BUTTERFLY_0 +#undef BUTTERFLY_N +#undef DO_REDUCE + + A[0] = X0; + A[1] = X1; + A[2] = X2; + A[3] = X3; + A[4] = X4; + A[5] = X5; + A[6] = X6; + A[7] = X7; + +#undef X +} + +static void fft128_4way( void *a ) +{ + int i; + // Temp space to help for interleaving in the end + __m512i B[8]; + __m512i *A = (__m512i*) a; + + /* Size-2 butterflies */ + for ( i = 0; i<8; i++ ) + { + B[ i ] = _mm512_add_epi16( A[ i ], A[ i+8 ] ); + B[ i ] = REDUCE_FULL_S4w( B[ i ] ); + A[ i+8 ] = _mm512_sub_epi16( A[ i ], A[ i+8 ] ); + A[ i+8 ] = REDUCE_FULL_S4w( A[ i+8 ] ); + A[ i+8 ] = _mm512_mullo_epi16( A[ i+8 ], FFT128_Twiddle4w[i].v512 ); + A[ i+8 ] = REDUCE_FULL_S4w( A[ i+8 ] ); + } + + fft64_4way( B ); + fft64_4way( A+8 ); + + /* Transposi (i.e. interleave) */ + for ( i = 0; i < 8; i++ ) + { + A[ 2*i ] = _mm512_unpacklo_epi16( B[ i ], A[ i+8 ] ); + A[ 2*i+1 ] = _mm512_unpackhi_epi16( B[ i ], A[ i+8 ] ); + } +} + +static void fft256_4way_msg( uint16_t *a, const uint8_t *x, int final ) +{ + const __m512i zero = _mm512_setzero_si512(); + static const m512_v16 Tweak = {{ 0,0,0,0,0,0,0,1, 0,0,0,0,0,0,0,1, + 0,0,0,0,0,0,0,1, 0,0,0,0,0,0,0,1 }}; + static const m512_v16 FinalTweak = {{ 0,0,0,0,0,1,0,1, 0,0,0,0,0,1,0,1, + 0,0,0,0,0,1,0,1, 0,0,0,0,0,1,0,1 }}; + + __m512i *X = (__m512i*)x; + __m512i *A = (__m512i*)a; + +#define UNPACK( i ) \ +do { \ + __m512i t = X[i]; \ + A[ 2*i ] = _mm512_unpacklo_epi8( t, zero ); \ + A[ 2*i + 16 ] = _mm512_mullo_epi16( A[ 2*i ], \ + FFT256_Twiddle4w[ 2*i ].v512 ); \ + A[ 2*i + 16 ] = REDUCE4w( A[ 2*i + 16 ] ); \ + A[ 2*i + 1 ] = _mm512_unpackhi_epi8( t, zero ); \ + A[ 2*i + 17 ] = _mm512_mullo_epi16( A[ 2*i + 1 ], \ + FFT256_Twiddle4w[ 2*i + 1 ].v512 ); \ + A[ 2*i + 17 ] = REDUCE4w( A[ 2*i + 17 ] ); \ +} while(0) + + // This allows to tweak the last butterflies to introduce X^127 +#define UNPACK_TWEAK( i,tw ) \ +do { \ + __m512i t = X[i]; \ + __m512i tmp; \ + A[ 2*i ] = _mm512_unpacklo_epi8( t, zero ); \ + A[ 2*i + 16 ] = _mm512_mullo_epi16( A[ 2*i ], \ + FFT256_Twiddle4w[ 2*i ].v512 ); \ + A[ 2*i + 16 ] = REDUCE4w( A[ 2*i + 16 ] ); \ + tmp = _mm512_unpackhi_epi8( t, zero ); \ + A[ 2*i + 1 ] = _mm512_add_epi16( tmp, tw ); \ + A[ 2*i + 17 ] = _mm512_mullo_epi16( _mm512_sub_epi16( tmp, tw ), \ + FFT256_Twiddle4w[ 2*i + 1 ].v512 ); \ + } while(0) -#define SUM7_40 4 -#define SUM7_41 5 -#define SUM7_42 6 -#define SUM7_43 0 -#define SUM7_44 1 -#define SUM7_45 2 -#define SUM7_46 3 + UNPACK( 0 ); + UNPACK( 1 ); + UNPACK( 2 ); + UNPACK( 3 ); + UNPACK( 4 ); + UNPACK( 5 ); + UNPACK( 6 ); + if ( final ) + UNPACK_TWEAK( 7, FinalTweak.v512 ); + else + UNPACK_TWEAK( 7, Tweak.v512 ); -#define SUM7_50 5 -#define SUM7_51 6 -#define SUM7_52 0 -#define SUM7_53 1 -#define SUM7_54 2 -#define SUM7_55 3 -#define SUM7_56 4 +#undef UNPACK +#undef UNPACK_TWEAK -#define SUM7_60 6 -#define SUM7_61 0 -#define SUM7_62 1 -#define SUM7_63 2 -#define SUM7_64 3 -#define SUM7_65 4 -#define SUM7_66 5 + fft128_4way( a ); + fft128_4way( a+512 ); +} -#define PERM(z,d,a) XCAT(PERM_,XCAT(SUM7_##z,PERM_START))(d,a) +#define c1_16_512( x ) {{ x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x }} -#define PERM_0(d,a) /* XOR 1 */ \ -do { \ - d##l = shufxor( a##l, 1 ); \ - d##h = shufxor( a##h, 1 ); \ - } while(0) +static void rounds512_4way( uint32_t *state, const uint8_t *msg, uint16_t *fft ) +{ + register __m512i S0l, S1l, S2l, S3l; + register __m512i S0h, S1h, S2h, S3h; + __m512i *S = (__m512i*) state; + __m512i *M = (__m512i*) msg; + __m512i *W = (__m512i*) fft; -#define PERM_1(d,a) /* XOR 6 */ \ -do { \ - d##l = shufxor( a##h, 2 ); \ - d##h = shufxor( a##l, 2 ); \ -} while(0) + static const m512_v16 code[] = { c1_16_512(185), c1_16_512(233) }; -#define PERM_2(d,a) /* XOR 2 */ \ -do { \ - d##l = shufxor( a##l, 2 ); \ - d##h = shufxor( a##h, 2 ); \ -} while(0) + S0l = _mm512_xor_si512( S[0], M[0] ); + S0h = _mm512_xor_si512( S[1], M[1] ); + S1l = _mm512_xor_si512( S[2], M[2] ); + S1h = _mm512_xor_si512( S[3], M[3] ); + S2l = _mm512_xor_si512( S[4], M[4] ); + S2h = _mm512_xor_si512( S[5], M[5] ); + S3l = _mm512_xor_si512( S[6], M[6] ); + S3h = _mm512_xor_si512( S[7], M[7] ); -#define PERM_3(d,a) /* XOR 3 */ \ -do { \ - d##l = shufxor( a##l, 3 ); \ - d##h = shufxor( a##h, 3 ); \ -} while(0) +// targetted, local macros don't need a unique name +#define S(i) S##i -#define PERM_4(d,a) /* XOR 5 */ \ -do { \ - d##l = shufxor( a##h, 1 ); \ - d##h = shufxor( a##l, 1 ); \ -} while(0) +#define F_0( B, C, D ) _mm512_ternarylogic_epi32( B, C, D, 0xca ) +#define F_1( B, C, D ) _mm512_ternarylogic_epi32( B, C, D, 0xe8 ) -#define PERM_5(d,a) /* XOR 7 */ \ -do { \ - d##l = shufxor( a##h, 3 ); \ - d##h = shufxor( a##l, 3 ); \ -} while(0) +#define Fl(a,b,c,fun) F_##fun (a##l,b##l,c##l) +#define Fh(a,b,c,fun) F_##fun (a##h,b##h,c##h) -#define PERM_6(d,a) /* XOR 4 */ \ -do { \ - d##l = a##h; \ - d##h = a##l; \ -} while(0) -#endif + // We split the round function in two halfes + // so as to insert some independent computations in between +// targetted + #define STEP_1_(a,b,c,d,w,fun,r,s,z) \ do { \ TTl = Fl( a,b,c,fun ); \ TTh = Fh( a,b,c,fun ); \ - a##l = mm256_rol_32( a##l, r ); \ - a##h = mm256_rol_32( a##h, r ); \ - w##l = _mm256_add_epi32( w##l, d##l ); \ - w##h = _mm256_add_epi32( w##h, d##h ); \ - TTl = _mm256_add_epi32( TTl, w##l ); \ - TTh = _mm256_add_epi32( TTh, w##h ); \ - TTl = mm256_rol_32( TTl, s ); \ - TTh = mm256_rol_32( TTh, s ); \ - PERM( z,d,a, shufxor2w ); \ + a##l = mm512_rol_32( a##l, r ); \ + a##h = mm512_rol_32( a##h, r ); \ + w##l = _mm512_add_epi32( w##l, d##l ); \ + w##h = _mm512_add_epi32( w##h, d##h ); \ + TTl = _mm512_add_epi32( TTl, w##l ); \ + TTh = _mm512_add_epi32( TTh, w##h ); \ + TTl = mm512_rol_32( TTl, s ); \ + TTh = mm512_rol_32( TTh, s ); \ + PERM( z,d,a, shufxor4w ); \ } while(0) #define STEP_1( a,b,c,d,w,fun,r,s,z ) STEP_1_( a,b,c,d,w,fun,r,s,z ) #define STEP_2_( a,b,c,d,w,fun,r,s ) \ do { \ - d##l = _mm256_add_epi32( d##l, TTl ); \ - d##h = _mm256_add_epi32( d##h, TTh ); \ + d##l = _mm512_add_epi32( d##l, TTl ); \ + d##h = _mm512_add_epi32( d##h, TTh ); \ } while(0) #define STEP_2( a,b,c,d,w,fun,r,s ) STEP_2_( a,b,c,d,w,fun,r,s ) #define STEP( a,b,c,d,w1,w2,fun,r,s,z ) \ do { \ - register __m256i TTl, TTh, Wl=w1, Wh=w2; \ + register __m512i TTl, TTh, Wl=w1, Wh=w2; \ STEP_1( a,b,c,d,W,fun,r,s,z ); \ STEP_2( a,b,c,d,W,fun,r,s ); \ } while(0); @@ -1653,16 +2153,16 @@ do { \ do { \ int a = MSG_##u(hh); \ int b = MSG_##u(ll); \ - w##l = _mm256_unpacklo_epi16( W[a], W[b] ); \ - w##l = _mm256_mullo_epi16( w##l, code[z].v256 ); \ - w##h = _mm256_unpackhi_epi16( W[a], W[b]) ; \ - w##h = _mm256_mullo_epi16( w##h, code[z].v256 ); \ + w##l = _mm512_unpacklo_epi16( W[a], W[b] ); \ + w##l = _mm512_mullo_epi16( w##l, code[z].v512 ); \ + w##h = _mm512_unpackhi_epi16( W[a], W[b]) ; \ + w##h = _mm512_mullo_epi16( w##h, code[z].v512 ); \ } while(0) - + #define ROUND( h0,l0,u0,h1,l1,u1,h2,l2,u2,h3,l3,u3,fun,r,s,t,u,z ) \ do { \ - register __m256i W0l, W1l, W2l, W3l, TTl; \ - register __m256i W0h, W1h, W2h, W3h, TTh; \ + register __m512i W0l, W1l, W2l, W3l, TTl; \ + register __m512i W0h, W1h, W2h, W3h, TTh; \ MSG( W0, h0, l0, u0, z ); \ STEP_1( S(0), S(1), S(2), S(3), W0, fun, r, s, 0 ); \ MSG( W1, h1, l1, u1, z ); \ @@ -1732,21 +2232,21 @@ do { \ #undef MSG } -void SIMD_2way_Compress( simd_2way_context *state, const void *m, int final ) +static void SIMD_4way_Compress( simd_4way_context *state, const void *m, int final ) { - m256_v16 Y[32]; + m512_v16 Y[32]; uint16_t *y = (uint16_t*) Y[0].u16; - fft256_2way_msg( y, m, final ); + fft256_4way_msg( y, m, final ); - rounds512_2way( state->A, m, y ); + rounds512_4way( state->A, m, y ); } // imported from nist.c -int simd_2way_init( simd_2way_context *state, int hashbitlen ) +int simd_4way_init( simd_4way_context *state, int hashbitlen ) { - __m256i *A = (__m256i*)state->A; + __m512i *A = (__m512i*)state->A; int n = 8; state->hashbitlen = hashbitlen; @@ -1755,14 +2255,12 @@ int simd_2way_init( simd_2way_context *state, int hashbitlen ) state->count = 0; for ( int i = 0; i < 8; i++ ) - A[i] = _mm256_set_epi32( SIMD_IV_512[4*i+3], SIMD_IV_512[4*i+2], - SIMD_IV_512[4*i+1], SIMD_IV_512[4*i+0], - SIMD_IV_512[4*i+3], SIMD_IV_512[4*i+2], - SIMD_IV_512[4*i+1], SIMD_IV_512[4*i+0] ); + A[i] = _mm512_set4_epi32( SIMD_IV_512[4*i+3], SIMD_IV_512[4*i+2], + SIMD_IV_512[4*i+1], SIMD_IV_512[4*i+0] ); return 0; } -int simd_2way_update( simd_2way_context *state, const void *data, +int simd_4way_update( simd_4way_context *state, const void *data, int databitlen ) { int bs = state->blocksize; @@ -1770,12 +2268,12 @@ int simd_2way_update( simd_2way_context *state, const void *data, while ( databitlen > 0 ) { - if ( current == 0 && databitlen >= bs ) + if ( ( current == 0 ) && ( databitlen >= bs ) ) { // We can hash the data directly from the input buffer. - SIMD_2way_Compress( state, data, 0 ); + SIMD_4way_Compress( state, data, 0 ); databitlen -= bs; - data += 2*(bs/8); + data += 4*(bs/8); state->count += bs; } else @@ -1784,25 +2282,25 @@ int simd_2way_update( simd_2way_context *state, const void *data, int len = bs - current; if ( databitlen < len ) { - memcpy( state->buffer + 2*(current/8), data, 2*((databitlen+7)/8) ); + memcpy( state->buffer + 4 * (current/8), data, 4 * (databitlen/8) ); state->count += databitlen; return 0; } else { - memcpy( state->buffer + 2*(current/8), data, 2*(len/8) ); + memcpy( state->buffer + 4 * (current / 8), data, 4 * (len / 8) ); state->count += len; databitlen -= len; - data += 2*(len/8); + data += 4*(len/8); current = 0; - SIMD_2way_Compress( state, state->buffer, 0 ); + SIMD_4way_Compress( state, state->buffer, 0 ); } } } return 0; } -int simd_2way_close( simd_2way_context *state, void *hashval ) +int simd_4way_close( simd_4way_context *state, void *hashval ) { uint64_t l; int current = state->count & (state->blocksize - 1); @@ -1813,29 +2311,31 @@ int simd_2way_close( simd_2way_context *state, void *hashval ) if ( current ) { current = ( current+7 ) / 8; - memset( state->buffer + 2*current, 0, 2*( state->blocksize/8 - current ) ); - SIMD_2way_Compress( state, state->buffer, 0 ); + memset( state->buffer + 4*current, 0, 4*( state->blocksize/8 - current ) ); + SIMD_4way_Compress( state, state->buffer, 0 ); } //* Input the message length as the last block - memset( state->buffer, 0, 2*(state->blocksize / 8) ); + memset( state->buffer, 0, 4*(state->blocksize / 8) ); l = state->count; for ( i = 0; i < 8; i++ ) { - state->buffer[ i ] = l & 0xff; + state->buffer[ i ] = l & 0xff; state->buffer[ i+16 ] = l & 0xff; + state->buffer[ i+32 ] = l & 0xff; + state->buffer[ i+48 ] = l & 0xff; l >>= 8; } if ( state->count < 16384 ) isshort = 2; - SIMD_2way_Compress( state, state->buffer, isshort ); - memcpy( hashval, state->A, 2*(state->hashbitlen / 8) ); + SIMD_4way_Compress( state, state->buffer, isshort ); + memcpy( hashval, state->A, 4*(state->hashbitlen / 8) ); return 0; } -int simd_2way_update_close( simd_2way_context *state, void *hashval, +int simd_4way_update_close( simd_4way_context *state, void *hashval, const void *data, int databitlen ) { int current, i; @@ -1850,10 +2350,9 @@ int simd_2way_update_close( simd_2way_context *state, void *hashval, if ( current == 0 && databitlen >= bs ) { // We can hash the data directly from the input buffer. - SIMD_2way_Compress( state, data, 0 ); - + SIMD_4way_Compress( state, data, 0 ); databitlen -= bs; - data += 2*( bs/8 ); + data += 4*( bs/8 ); state->count += bs; } else @@ -1862,19 +2361,18 @@ int simd_2way_update_close( simd_2way_context *state, void *hashval, int len = bs - current; if ( databitlen < len ) { - - memcpy( state->buffer + 2*( current/8 ), data, 2*( (databitlen+7)/8 ) ); + memcpy( state->buffer + 4*( current/8 ), data, 4*( (databitlen)/8 ) ); state->count += databitlen; break; } else { - memcpy( state->buffer + 2*(current/8), data, 2*(len/8) ); + memcpy( state->buffer + 4*(current/8), data, 4*(len/8) ); state->count += len; databitlen -= len; - data += 2*( len/8 ); + data += 4*( len/8 ); current = 0; - SIMD_2way_Compress( state, state->buffer, 0 ); + SIMD_4way_Compress( state, state->buffer, 0 ); } } } @@ -1884,32 +2382,34 @@ int simd_2way_update_close( simd_2way_context *state, void *hashval, // If there is still some data in the buffer, hash it if ( current ) { - current = ( current+7 ) / 8; - memset( state->buffer + 2*current, 0, 2*( state->blocksize/8 - current) ); - SIMD_2way_Compress( state, state->buffer, 0 ); + current = current / 8; + memset( state->buffer + 4*current, 0, 4*( state->blocksize/8 - current) ); + SIMD_4way_Compress( state, state->buffer, 0 ); } //* Input the message length as the last block - memset( state->buffer, 0, 2*( state->blocksize/8 ) ); + memset( state->buffer, 0, 4*( state->blocksize/8 ) ); l = state->count; for ( i = 0; i < 8; i++ ) { state->buffer[ i ] = l & 0xff; state->buffer[ i+16 ] = l & 0xff; + state->buffer[ i+32 ] = l & 0xff; + state->buffer[ i+48 ] = l & 0xff; l >>= 8; } if ( state->count < 16384 ) isshort = 2; - SIMD_2way_Compress( state, state->buffer, isshort ); - memcpy( hashval, state->A, 2*( state->hashbitlen / 8 ) ); + SIMD_4way_Compress( state, state->buffer, isshort ); + memcpy( hashval, state->A, 4*( state->hashbitlen / 8 ) ); return 0; } -int simd512_2way_full( simd_2way_context *state, void *hashval, +int simd512_4way_ctx( simd_4way_context *state, void *hashval, const void *data, int datalen ) { - __m256i *A = (__m256i*)state->A; + __m512i *A = (__m512i*)state->A; state->hashbitlen = 512; state->n_feistels = 8; @@ -1917,10 +2417,8 @@ int simd512_2way_full( simd_2way_context *state, void *hashval, state->count = 0; for ( int i = 0; i < 8; i++ ) - A[i] = _mm256_set_epi32( SIMD_IV_512[4*i+3], SIMD_IV_512[4*i+2], - SIMD_IV_512[4*i+1], SIMD_IV_512[4*i+0], - SIMD_IV_512[4*i+3], SIMD_IV_512[4*i+2], - SIMD_IV_512[4*i+1], SIMD_IV_512[4*i+0] ); + A[i] = _mm512_set4_epi32( SIMD_IV_512[4*i+3], SIMD_IV_512[4*i+2], + SIMD_IV_512[4*i+1], SIMD_IV_512[4*i+0] ); int current, i; int bs = state->blocksize; // bits in one lane @@ -1935,10 +2433,9 @@ int simd512_2way_full( simd_2way_context *state, void *hashval, if ( current == 0 && databitlen >= bs ) { // We can hash the data directly from the input buffer. - SIMD_2way_Compress( state, data, 0 ); - + SIMD_4way_Compress( state, data, 0 ); databitlen -= bs; - data += 2*( bs/8 ); + data += 4*( bs/8 ); state->count += bs; } else @@ -1947,19 +2444,18 @@ int simd512_2way_full( simd_2way_context *state, void *hashval, int len = bs - current; if ( databitlen < len ) { - - memcpy( state->buffer + 2*( current/8 ), data, 2*( (databitlen+7)/8 ) ); + memcpy( state->buffer + 4*( current/8 ), data, 4*( (databitlen)/8 ) ); state->count += databitlen; break; } else { - memcpy( state->buffer + 2*(current/8), data, 2*(len/8) ); + memcpy( state->buffer + 4*(current/8), data, 4*(len/8) ); state->count += len; databitlen -= len; - data += 2*( len/8 ); + data += 4*( len/8 ); current = 0; - SIMD_2way_Compress( state, state->buffer, 0 ); + SIMD_4way_Compress( state, state->buffer, 0 ); } } } @@ -1969,27 +2465,36 @@ int simd512_2way_full( simd_2way_context *state, void *hashval, // If there is still some data in the buffer, hash it if ( current ) { - current = ( current+7 ) / 8; - memset( state->buffer + 2*current, 0, 2*( state->blocksize/8 - current) ); - SIMD_2way_Compress( state, state->buffer, 0 ); + current = current / 8; + memset( state->buffer + 4*current, 0, 4*( state->blocksize/8 - current) ); + SIMD_4way_Compress( state, state->buffer, 0 ); } //* Input the message length as the last block - memset( state->buffer, 0, 2*( state->blocksize/8 ) ); + memset( state->buffer, 0, 4*( state->blocksize/8 ) ); l = state->count; for ( i = 0; i < 8; i++ ) { state->buffer[ i ] = l & 0xff; state->buffer[ i+16 ] = l & 0xff; + state->buffer[ i+32 ] = l & 0xff; + state->buffer[ i+48 ] = l & 0xff; l >>= 8; } if ( state->count < 16384 ) isshort = 2; - SIMD_2way_Compress( state, state->buffer, isshort ); - memcpy( hashval, state->A, 2*( state->hashbitlen / 8 ) ); + SIMD_4way_Compress( state, state->buffer, isshort ); + memcpy( hashval, state->A, 4*( state->hashbitlen / 8 ) ); return 0; } +int simd512_4way( void *hashval, const void *data, int datalen ) +{ + simd512_4way_context ctx; + simd512_4way_ctx( &ctx, hashval, data, datalen ); + return 0; +} + +#endif // AVX512 -#endif diff --git a/algo/simd/simd-hash-2way.h b/algo/simd/simd-hash-2way.h index 9aad1450..2a94518c 100644 --- a/algo/simd/simd-hash-2way.h +++ b/algo/simd/simd-hash-2way.h @@ -2,53 +2,81 @@ #define SIMD_HASH_2WAY_H__ 1 #include "simd-compat.h" - -#if defined(__AVX2__) - #include "simd-utils.h" +#if defined(__SSE2__) || defined (__ARM_NEON) -#if defined(__AVX512F__) && defined(__AVX512VL__) && defined(__AVX512DQ__) && defined(__AVX512BW__) - -typedef struct { - uint32_t A[ 32*4 ]; - uint8_t buffer[ 128*4 ]; +typedef struct +{ + uint32_t A[32]; + uint8_t buffer[128]; uint64_t count; unsigned int hashbitlen; unsigned int blocksize; unsigned int n_feistels; +} simd512_context __attribute__((aligned(64))); -} simd_4way_context __attribute__((aligned(128))); +// datalen is bytes +int simd512_ctx( simd512_context *ctx, void *hashval, const void *data, + int datalen ); -int simd_4way_init( simd_4way_context *state, int hashbitlen ); -int simd_4way_update( simd_4way_context *state, const void *data, - int databitlen ); -int simd_4way_close( simd_4way_context *state, void *hashval ); -int simd_4way_update_close( simd_4way_context *state, void *hashval, - const void *data, int databitlen ); -int simd512_4way_full( simd_4way_context *state, void *hashval, - const void *data, int datalen ); +int simd512( void *hashval, const void *data, int datalen ); #endif -typedef struct { +#if defined(__AVX2__) + +typedef struct +{ uint32_t A[ 32*2 ]; uint8_t buffer[ 128*2 ]; uint64_t count; unsigned int hashbitlen; unsigned int blocksize; unsigned int n_feistels; - -} simd_2way_context __attribute__((aligned(128))); +} simd512_2way_context __attribute__((aligned(128))); +#define simd_2way_context simd512_2way_context +// databitlen is bits int simd_2way_init( simd_2way_context *state, int hashbitlen ); int simd_2way_update( simd_2way_context *state, const void *data, int databitlen ); int simd_2way_close( simd_2way_context *state, void *hashval ); int simd_2way_update_close( simd_2way_context *state, void *hashval, const void *data, int databitlen ); -int simd512_2way_full( simd_2way_context *state, void *hashval, +int simd512_2way_ctx( simd512_2way_context *state, void *hashval, + const void *data, int datalen ); +#define simd512_2way_full simd512_2way_ctx + +int simd512_2way( void *hashval, const void *data, int datalen ); + +#endif + +#if defined(__AVX512F__) && defined(__AVX512VL__) && defined(__AVX512DQ__) && defined(__AVX512BW__) + +typedef struct +{ + uint32_t A[ 32*4 ]; + uint8_t buffer[ 128*4 ]; + uint64_t count; + unsigned int hashbitlen; + unsigned int blocksize; + unsigned int n_feistels; +} simd512_4way_context __attribute__((aligned(128))); +#define simd_4way_context simd512_4way_context + +int simd_4way_init( simd_4way_context *state, int hashbitlen ); +int simd_4way_update( simd_4way_context *state, const void *data, + int databitlen ); +int simd_4way_close( simd_4way_context *state, void *hashval ); +int simd_4way_update_close( simd_4way_context *state, void *hashval, + const void *data, int databitlen ); +int simd512_4way_ctx( simd_4way_context *state, void *hashval, const void *data, int datalen ); +#define simd512_4way_full simd512_4way_ctx + +int simd512_4way( void *hashval, const void *data, int datalen ); #endif + #endif diff --git a/algo/x16/minotaur.c b/algo/x16/minotaur.c index d56a32b2..af196207 100644 --- a/algo/x16/minotaur.c +++ b/algo/x16/minotaur.c @@ -14,20 +14,19 @@ #include "algo/cubehash/cubehash_sse2.h" #if defined(__aarch64__) #include "algo/simd/sph_simd.h" - #include "algo/luffa/sph_luffa.h" #endif #include "algo/hamsi/sph_hamsi.h" #include "algo/shabal/sph_shabal.h" #include "algo/whirlpool/sph_whirlpool.h" #include "algo/sha/sph_sha2.h" #include "algo/yespower/yespower.h" -#if defined(__AES__) || defined(__ARM_FEATURE_AES) +//#if defined(__AES__) || defined(__ARM_FEATURE_AES) #include "algo/echo/aes_ni/hash_api.h" #include "algo/groestl/aes_ni/hash-groestl.h" -#else +//#else #include "algo/echo/sph_echo.h" #include "algo/groestl/sph_groestl.h" -#endif +//#endif #if defined(__AES__) #include "algo/fugue/fugue-aesni.h" #else @@ -48,7 +47,7 @@ typedef struct TortureGarden TortureGarden; // Graph of hash algos plus SPH contexts struct TortureGarden { -#if defined(__AES__) || defined(__ARM_FEATURE_AES) +#if defined(__AES__) // || defined(__ARM_FEATURE_AES) hashState_echo echo; hashState_groestl groestl; #else @@ -67,11 +66,7 @@ struct TortureGarden sph_keccak512_context keccak; cubehashParam cube; shavite512_context shavite; -#if defined(__aarch64__) - sph_luffa512_context luffa; -#else hashState_luffa luffa; -#endif #if defined(__aarch64__) sph_simd512_context simd; #else @@ -112,7 +107,7 @@ static int get_hash( void *output, const void *input, TortureGarden *garden, cubehashUpdateDigest( &garden->cube, hash, input, 64 ); break; case 3: -#if defined(__AES__) || defined(__ARM_FEATURE_AES) +#if defined(__AES__) // || defined(__ARM_FEATURE_AES) echo_full( &garden->echo, hash, 512, input, 64 ); #else sph_echo512_init( &garden->echo ); @@ -128,7 +123,7 @@ static int get_hash( void *output, const void *input, TortureGarden *garden, #endif break; case 5: -#if defined(__AES__) || defined(__ARM_FEATURE_AES) +#if defined(__AES__) // || defined(__ARM_FEATURE_AES) groestl512_full( &garden->groestl, hash, input, 512 ); #else sph_groestl512_init( &garden->groestl) ; @@ -157,13 +152,7 @@ static int get_hash( void *output, const void *input, TortureGarden *garden, sph_keccak512_close( &garden->keccak, hash ); break; case 10: -#if defined(__aarch64__) - sph_luffa512_init( &garden->luffa ); - sph_luffa512( &garden->luffa, input, 64 ); - sph_luffa512_close( &garden->luffa, hash ); -#else luffa_full( &garden->luffa, hash, 512, input, 64 ); -#endif break; case 11: sph_shabal512_init( &garden->shabal ); diff --git a/algo/x17/x17-4way.c b/algo/x17/x17-4way.c index 25689d13..61d00ab8 100644 --- a/algo/x17/x17-4way.c +++ b/algo/x17/x17-4way.c @@ -929,43 +929,31 @@ int scanhash_x17_4x64( struct work *work, uint32_t max_nonce, #elif defined(X17_2X64) // Need sph in some cases -//#include "algo/blake/sph_blake.h" -#include "algo/bmw/sph_bmw.h" -#include "algo/jh/sph_jh.h" -//#include "algo/keccak/sph_keccak.h" -#include "algo/skein/sph_skein.h" -#include "algo/luffa/sph_luffa.h" #include "algo/luffa/luffa_for_sse2.h" -//#include "algo/cubehash/sph_cubehash.h" #include "algo/cubehash/cubehash_sse2.h" -#include "algo/shavite/sph_shavite.h" #include "algo/simd/sph_simd.h" #include "algo/simd/nist.h" #include "algo/hamsi/sph_hamsi.h" #include "algo/shabal/sph_shabal.h" -#include "algo/whirlpool/sph_whirlpool.h" #include "algo/haval/sph-haval.h" -#include "algo/sha/sph_sha2.h" -#if !( defined(__AES__) || defined(__ARM_FEATURE_AES) ) +//#if !( defined(__AES__) || defined(__ARM_FEATURE_AES) ) #include "algo/groestl/sph_groestl.h" #include "algo/echo/sph_echo.h" -#endif +//#endif #include "algo/fugue/sph_fugue.h" union _x17_context_overlay { -// blake512_2x64_context blake; - blake512_context blake; -#if defined(__x86_64__) + blake512_2x64_context blake; bmw512_2x64_context bmw; -#else - sph_bmw512_context bmw; -#endif -#if defined(__AES__) || defined(__ARM_FEATURE_AES) +#if defined(__AES__) // || defined(__ARM_FEATURE_AES) hashState_groestl groestl; - hashState_echo echo; #else sph_groestl512_context groestl; +#endif +#if defined(__AES__) // || defined(__ARM_FEATURE_AES) + hashState_echo echo; +#else sph_echo512_context echo; #endif #if defined(__AES__) @@ -973,26 +961,14 @@ union _x17_context_overlay #else sph_fugue512_context fugue; #endif -#if defined(__x86_64__) jh512_2x64_context jh; -#else - sph_jh512_context jh; -#endif keccak512_2x64_context keccak; -#if defined(__x86_64__) skein512_2x64_context skein; -#else - sph_skein512_context skein; -#endif -#if defined(__x86_64__) hashState_luffa luffa; -#else - sph_luffa512_context luffa; -#endif cubehashParam cube; sph_shavite512_context shavite; #if defined(__x86_64__) - hashState_sd simd; + simd512_context simd; #else sph_simd512_context simd; #endif @@ -1003,11 +979,7 @@ union _x17_context_overlay #endif sph_shabal512_context shabal; sph_whirlpool_context whirlpool; -#if defined(__x86_64__) sha512_2x64_context sha; -#else - sph_sha512_context sha; -#endif sph_haval256_5_context haval; }; typedef union _x17_context_overlay x17_context_overlay; @@ -1019,30 +991,16 @@ int x17_2x64_hash( void *output, const void *input, int thr_id ) uint8_t hash1[64] __attribute__((aligned(64))); x17_context_overlay ctx; -// intrlv_2x64( vhash, input, input+80, 640 ); -// blake512_2x64_full( &ctx.blake, vhash, vhash, 80 ); -// dintrlv_2x64( hash0, hash1, vhash, 512 ); - - blake512_full( &ctx.blake, hash0, input, 80 ); - blake512_full( &ctx.blake, hash1, input+80, 80 ); + intrlv_2x64( vhash, input, input+80, 640 ); - -#if defined(__x86_64__) - intrlv_2x64( vhash, hash0, hash1, 512 ); + blake512_2x64_full( &ctx.blake, vhash, vhash, 80 ); bmw512_2x64_init( &ctx.bmw ); bmw512_2x64_update( &ctx.bmw, vhash, 64 ); bmw512_2x64_close( &ctx.bmw, vhash ); + dintrlv_2x64( hash0, hash1, vhash, 512 ); -#else - sph_bmw512_init( &ctx.bmw ); - sph_bmw512( &ctx.bmw, hash0, 64 ); - sph_bmw512_close( &ctx.bmw, hash0 ); - sph_bmw512_init( &ctx.bmw ); - sph_bmw512( &ctx.bmw, hash1, 64 ); - sph_bmw512_close( &ctx.bmw, hash1 ); -#endif -#if defined(__AES__) || defined(__ARM_FEATURE_AES) +#if defined(__AES__) // || defined(__ARM_FEATURE_AES) groestl512_full( &ctx.groestl, hash0, hash0, 512 ); groestl512_full( &ctx.groestl, hash1, hash1, 512 ); #else @@ -1054,47 +1012,16 @@ int x17_2x64_hash( void *output, const void *input, int thr_id ) sph_groestl512_close( &ctx.groestl, hash1 ); #endif -#if defined(__x86_64__) intrlv_2x64( vhash, hash0, hash1, 512 ); - skein512_2x64_full( &ctx.skein, vhash, vhash, 64 ); - dintrlv_2x64( hash0, hash1, vhash, 512 ); -#else - sph_skein512_init( &ctx.skein ); - sph_skein512( &ctx.skein, hash0, 64 ); - sph_skein512_close( &ctx.skein, hash0); - sph_skein512_init( &ctx.skein ); - sph_skein512( &ctx.skein, hash1, 64 ); - sph_skein512_close( &ctx.skein, hash1 ); -#endif -#if defined(__x86_64__) - intrlv_2x64( vhash, hash0, hash1, 512); + skein512_2x64_full( &ctx.skein, vhash, vhash, 64 ); jh512_2x64_ctx( &ctx.jh, vhash, vhash, 64 ); - dintrlv_2x64( hash0, hash1, vhash, 512 ); -#else - sph_jh512_init( &ctx.jh ); - sph_jh512( &ctx.jh, hash0, 64 ); - sph_jh512_close( &ctx.jh, hash0 ); - sph_jh512_init( &ctx.jh); - sph_jh512( &ctx.jh, hash1, 64 ); - sph_jh512_close( &ctx.jh, hash1 ); -#endif - - intrlv_2x64( vhash, hash0, hash1, 512); keccak512_2x64_ctx( &ctx.keccak, vhash, vhash, 64 ); + dintrlv_2x64( hash0, hash1, vhash, 512 ); -#if defined(__x86_64__) luffa_full( &ctx.luffa, hash0, 512, hash0, 64 ); luffa_full( &ctx.luffa, hash1, 512, hash1, 64 ); -#else - sph_luffa512_init( &ctx.luffa ); - sph_luffa512( &ctx.luffa, hash0, 64 ); - sph_luffa512_close( &ctx.luffa, hash0 ); - sph_luffa512_init( &ctx.luffa ); - sph_luffa512( &ctx.luffa, hash1, 64 ); - sph_luffa512_close( &ctx.luffa, hash1 ); -#endif cubehash_full( &ctx.cube, hash0, 512, hash0, 64 ); cubehash_full( &ctx.cube, hash1, 512, hash1, 64 ); @@ -1107,8 +1034,8 @@ int x17_2x64_hash( void *output, const void *input, int thr_id ) sph_shavite512_close( &ctx.shavite, hash1 ); #if defined(__x86_64__) - simd_full( &ctx.simd, hash0, hash0, 512 ); - simd_full( &ctx.simd, hash1, hash1, 512 ); + simd512_ctx( &ctx.simd, hash0, hash0, 64 ); + simd512_ctx( &ctx.simd, hash1, hash1, 64 ); #else sph_simd512_init( &ctx.simd ); sph_simd512( &ctx.simd, hash0, 64 ); @@ -1118,7 +1045,7 @@ int x17_2x64_hash( void *output, const void *input, int thr_id ) sph_simd512_close( &ctx.simd, hash1 ); #endif -#if defined(__AES__) || defined(__ARM_FEATURE_AES) +#if defined(__AES__) // || defined(__ARM_FEATURE_AES) echo_full( &ctx.echo, hash0, 512, hash0, 64 ); echo_full( &ctx.echo, hash1, 512, hash1, 64 ); #else @@ -1130,7 +1057,7 @@ int x17_2x64_hash( void *output, const void *input, int thr_id ) sph_echo512_close( &ctx.echo, hash1 ); #endif -#if defined(__SSE4_2__) // || defined(__ARM_NEON) +#if defined(__SSE4_2__) // || defined(__ARM_NEON) intrlv_2x64( vhash, hash0, hash1, 512 ); hamsi512_2x64_ctx( &ctx.hamsi, vhash, vhash, 64 ); dintrlv_2x64( hash0, hash1, vhash, 512 ); @@ -1165,18 +1092,9 @@ int x17_2x64_hash( void *output, const void *input, int thr_id ) sph_whirlpool( &ctx.whirlpool, hash1, 64 ); sph_whirlpool_close( &ctx.whirlpool, hash1 ); -#if defined(__x86_64__) intrlv_2x64( vhash, hash0, hash1, 512 ); sha512_2x64_ctx( &ctx.sha, vhash, vhash, 64 ); dintrlv_2x64( hash0, hash1, vhash, 512 ); -#else - sph_sha512_init( &ctx.sha ); - sph_sha512( &ctx.sha, hash0, 64 ); - sph_sha512_close( &ctx.sha, hash0 ); - sph_sha512_init( &ctx.sha ); - sph_sha512( &ctx.sha, hash1, 64 ); - sph_sha512_close( &ctx.sha, hash1 ); -#endif sph_haval256_5_init( &ctx.haval ); sph_haval256_5( &ctx.haval, hash0, 64 ); diff --git a/algo/x22/x22i.c b/algo/x22/x22i.c index 9e9bf4a7..4140e31a 100644 --- a/algo/x22/x22i.c +++ b/algo/x22/x22i.c @@ -210,7 +210,7 @@ int scanhash_x22i( struct work *work, uint32_t max_nonce, do { edata[19] = n; - if ( x22i_hash( hash64, edata, thr_id ) ); + if ( x22i_hash( hash64, edata, thr_id ) ) if ( unlikely( valid_hash( hash64, ptarget ) && !bench ) ) { pdata[19] = bswap_32( n ); diff --git a/algo/x22/x25x.c b/algo/x22/x25x.c index c734d007..4defb6ef 100644 --- a/algo/x22/x25x.c +++ b/algo/x22/x25x.c @@ -245,7 +245,7 @@ int scanhash_x25x( struct work *work, uint32_t max_nonce, do { edata[19] = n; - if ( x25x_hash( hash64, edata, thr_id ) ); + if ( x25x_hash( hash64, edata, thr_id ) ) if ( unlikely( valid_hash( hash64, ptarget ) && !bench ) ) { pdata[19] = bswap_32( n ); diff --git a/configure b/configure index c3215112..961c5e0c 100755 --- a/configure +++ b/configure @@ -1,6 +1,6 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.71 for cpuminer-opt 23.6. +# Generated by GNU Autoconf 2.71 for cpuminer-opt 23.7. # # # Copyright (C) 1992-1996, 1998-2017, 2020-2021 Free Software Foundation, @@ -608,8 +608,8 @@ MAKEFLAGS= # Identity of this package. PACKAGE_NAME='cpuminer-opt' PACKAGE_TARNAME='cpuminer-opt' -PACKAGE_VERSION='23.6' -PACKAGE_STRING='cpuminer-opt 23.6' +PACKAGE_VERSION='23.7' +PACKAGE_STRING='cpuminer-opt 23.7' PACKAGE_BUGREPORT='' PACKAGE_URL='' @@ -1360,7 +1360,7 @@ if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF -\`configure' configures cpuminer-opt 23.6 to adapt to many kinds of systems. +\`configure' configures cpuminer-opt 23.7 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1432,7 +1432,7 @@ fi if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of cpuminer-opt 23.6:";; + short | recursive ) echo "Configuration of cpuminer-opt 23.7:";; esac cat <<\_ACEOF @@ -1538,7 +1538,7 @@ fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -cpuminer-opt configure 23.6 +cpuminer-opt configure 23.7 generated by GNU Autoconf 2.71 Copyright (C) 2021 Free Software Foundation, Inc. @@ -1985,7 +1985,7 @@ cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. -It was created by cpuminer-opt $as_me 23.6, which was +It was created by cpuminer-opt $as_me 23.7, which was generated by GNU Autoconf 2.71. Invocation command line was $ $0$ac_configure_args_raw @@ -3593,7 +3593,7 @@ fi # Define the identity of the package. PACKAGE='cpuminer-opt' - VERSION='23.6' + VERSION='23.7' printf "%s\n" "#define PACKAGE \"$PACKAGE\"" >>confdefs.h @@ -7508,7 +7508,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" -This file was extended by cpuminer-opt $as_me 23.6, which was +This file was extended by cpuminer-opt $as_me 23.7, which was generated by GNU Autoconf 2.71. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -7576,7 +7576,7 @@ ac_cs_config_escaped=`printf "%s\n" "$ac_cs_config" | sed "s/^ //; s/'/'\\\\\\\\ cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config='$ac_cs_config_escaped' ac_cs_version="\\ -cpuminer-opt config.status 23.6 +cpuminer-opt config.status 23.7 configured by $0, generated by GNU Autoconf 2.71, with options \\"\$ac_cs_config\\" diff --git a/configure.ac b/configure.ac index 4ae2aaaf..a9da908a 100644 --- a/configure.ac +++ b/configure.ac @@ -1,4 +1,4 @@ -AC_INIT([cpuminer-opt], [23.6]) +AC_INIT([cpuminer-opt], [23.7]) AC_PREREQ([2.59c]) AC_CANONICAL_SYSTEM diff --git a/configure~ b/configure~ index d2b4db9a..62e4f599 100755 --- a/configure~ +++ b/configure~ @@ -1,10 +1,9 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.71 for cpuminer-opt 23.5. +# Generated by GNU Autoconf 2.69 for cpuminer-opt 23.7. # # -# Copyright (C) 1992-1996, 1998-2017, 2020-2021 Free Software Foundation, -# Inc. +# Copyright (C) 1992-1996, 1998-2012 Free Software Foundation, Inc. # # # This configure script is free software; the Free Software Foundation @@ -15,16 +14,14 @@ # Be more Bourne compatible DUALCASE=1; export DUALCASE # for MKS sh -as_nop=: -if test ${ZSH_VERSION+y} && (emulate sh) >/dev/null 2>&1 -then : +if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then : emulate sh NULLCMD=: # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which # is contrary to our usage. Disable this feature. alias -g '${1+"$@"}'='"$@"' setopt NO_GLOB_SUBST -else $as_nop +else case `(set -o) 2>/dev/null` in #( *posix*) : set -o posix ;; #( @@ -34,46 +31,46 @@ esac fi - -# Reset variables that may have inherited troublesome values from -# the environment. - -# IFS needs to be set, to space, tab, and newline, in precisely that order. -# (If _AS_PATH_WALK were called with IFS unset, it would have the -# side effect of setting IFS to empty, thus disabling word splitting.) -# Quoting is to prevent editors from complaining about space-tab. as_nl=' ' export as_nl -IFS=" "" $as_nl" - -PS1='$ ' -PS2='> ' -PS4='+ ' - -# Ensure predictable behavior from utilities with locale-dependent output. -LC_ALL=C -export LC_ALL -LANGUAGE=C -export LANGUAGE - -# We cannot yet rely on "unset" to work, but we need these variables -# to be unset--not just set to an empty or harmless value--now, to -# avoid bugs in old shells (e.g. pre-3.0 UWIN ksh). This construct -# also avoids known problems related to "unset" and subshell syntax -# in other old shells (e.g. bash 2.01 and pdksh 5.2.14). -for as_var in BASH_ENV ENV MAIL MAILPATH CDPATH -do eval test \${$as_var+y} \ - && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || : -done - -# Ensure that fds 0, 1, and 2 are open. -if (exec 3>&0) 2>/dev/null; then :; else exec 0&1) 2>/dev/null; then :; else exec 1>/dev/null; fi -if (exec 3>&2) ; then :; else exec 2>/dev/null; fi +# Printing a long string crashes Solaris 7 /usr/bin/printf. +as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' +as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo +as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo +# Prefer a ksh shell builtin over an external printf program on Solaris, +# but without wasting forks for bash or zsh. +if test -z "$BASH_VERSION$ZSH_VERSION" \ + && (test "X`print -r -- $as_echo`" = "X$as_echo") 2>/dev/null; then + as_echo='print -r --' + as_echo_n='print -rn --' +elif (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then + as_echo='printf %s\n' + as_echo_n='printf %s' +else + if test "X`(/usr/ucb/echo -n -n $as_echo) 2>/dev/null`" = "X-n $as_echo"; then + as_echo_body='eval /usr/ucb/echo -n "$1$as_nl"' + as_echo_n='/usr/ucb/echo -n' + else + as_echo_body='eval expr "X$1" : "X\\(.*\\)"' + as_echo_n_body='eval + arg=$1; + case $arg in #( + *"$as_nl"*) + expr "X$arg" : "X\\(.*\\)$as_nl"; + arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;; + esac; + expr "X$arg" : "X\\(.*\\)" | tr -d "$as_nl" + ' + export as_echo_n_body + as_echo_n='sh -c $as_echo_n_body as_echo' + fi + export as_echo_body + as_echo='sh -c $as_echo_body as_echo' +fi # The user is always right. -if ${PATH_SEPARATOR+false} :; then +if test "${PATH_SEPARATOR+set}" != set; then PATH_SEPARATOR=: (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && { (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 || @@ -82,6 +79,13 @@ if ${PATH_SEPARATOR+false} :; then fi +# IFS +# We need space, tab and new line, in precisely that order. Quoting is +# there to prevent editors from complaining about space-tab. +# (If _AS_PATH_WALK were called with IFS unset, it would disable word +# splitting by setting IFS to empty value.) +IFS=" "" $as_nl" + # Find who we are. Look in the path if we contain no directory separator. as_myself= case $0 in #(( @@ -90,12 +94,8 @@ case $0 in #(( for as_dir in $PATH do IFS=$as_save_IFS - case $as_dir in #((( - '') as_dir=./ ;; - */) ;; - *) as_dir=$as_dir/ ;; - esac - test -r "$as_dir$0" && as_myself=$as_dir$0 && break + test -z "$as_dir" && as_dir=. + test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break done IFS=$as_save_IFS @@ -107,10 +107,30 @@ if test "x$as_myself" = x; then as_myself=$0 fi if test ! -f "$as_myself"; then - printf "%s\n" "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 + $as_echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 exit 1 fi +# Unset variables that we do not need and which cause bugs (e.g. in +# pre-3.0 UWIN ksh). But do not cause bugs in bash 2.01; the "|| exit 1" +# suppresses any "Segmentation fault" message there. '((' could +# trigger a bug in pdksh 5.2.14. +for as_var in BASH_ENV ENV MAIL MAILPATH +do eval test x\${$as_var+set} = xset \ + && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || : +done +PS1='$ ' +PS2='> ' +PS4='+ ' + +# NLS nuisances. +LC_ALL=C +export LC_ALL +LANGUAGE=C +export LANGUAGE + +# CDPATH. +(unset CDPATH) >/dev/null 2>&1 && unset CDPATH # Use a proper internal environment variable to ensure we don't fall # into an infinite loop, continuously re-executing ourselves. @@ -132,22 +152,20 @@ esac exec $CONFIG_SHELL $as_opts "$as_myself" ${1+"$@"} # Admittedly, this is quite paranoid, since all the known shells bail # out after a failed `exec'. -printf "%s\n" "$0: could not re-execute with $CONFIG_SHELL" >&2 -exit 255 +$as_echo "$0: could not re-execute with $CONFIG_SHELL" >&2 +as_fn_exit 255 fi # We don't want this to propagate to other subprocesses. { _as_can_reexec=; unset _as_can_reexec;} if test "x$CONFIG_SHELL" = x; then - as_bourne_compatible="as_nop=: -if test \${ZSH_VERSION+y} && (emulate sh) >/dev/null 2>&1 -then : + as_bourne_compatible="if test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then : emulate sh NULLCMD=: # Pre-4.2 versions of Zsh do word splitting on \${1+\"\$@\"}, which # is contrary to our usage. Disable this feature. alias -g '\${1+\"\$@\"}'='\"\$@\"' setopt NO_GLOB_SUBST -else \$as_nop +else case \`(set -o) 2>/dev/null\` in #( *posix*) : set -o posix ;; #( @@ -167,53 +185,42 @@ as_fn_success || { exitcode=1; echo as_fn_success failed.; } as_fn_failure && { exitcode=1; echo as_fn_failure succeeded.; } as_fn_ret_success || { exitcode=1; echo as_fn_ret_success failed.; } as_fn_ret_failure && { exitcode=1; echo as_fn_ret_failure succeeded.; } -if ( set x; as_fn_ret_success y && test x = \"\$1\" ) -then : +if ( set x; as_fn_ret_success y && test x = \"\$1\" ); then : -else \$as_nop +else exitcode=1; echo positional parameters were not saved. fi test x\$exitcode = x0 || exit 1 -blah=\$(echo \$(echo blah)) -test x\"\$blah\" = xblah || exit 1 test -x / || exit 1" as_suggested=" as_lineno_1=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_1a=\$LINENO as_lineno_2=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_2a=\$LINENO eval 'test \"x\$as_lineno_1'\$as_run'\" != \"x\$as_lineno_2'\$as_run'\" && test \"x\`expr \$as_lineno_1'\$as_run' + 1\`\" = \"x\$as_lineno_2'\$as_run'\"' || exit 1 test \$(( 1 + 1 )) = 2 || exit 1" - if (eval "$as_required") 2>/dev/null -then : + if (eval "$as_required") 2>/dev/null; then : as_have_required=yes -else $as_nop +else as_have_required=no fi - if test x$as_have_required = xyes && (eval "$as_suggested") 2>/dev/null -then : + if test x$as_have_required = xyes && (eval "$as_suggested") 2>/dev/null; then : -else $as_nop +else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR as_found=false for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH do IFS=$as_save_IFS - case $as_dir in #((( - '') as_dir=./ ;; - */) ;; - *) as_dir=$as_dir/ ;; - esac + test -z "$as_dir" && as_dir=. as_found=: case $as_dir in #( /*) for as_base in sh bash ksh sh5; do # Try only shells that exist, to save several forks. - as_shell=$as_dir$as_base + as_shell=$as_dir/$as_base if { test -f "$as_shell" || test -f "$as_shell.exe"; } && - as_run=a "$as_shell" -c "$as_bourne_compatible""$as_required" 2>/dev/null -then : + { $as_echo "$as_bourne_compatible""$as_required" | as_run=a "$as_shell"; } 2>/dev/null; then : CONFIG_SHELL=$as_shell as_have_required=yes - if as_run=a "$as_shell" -c "$as_bourne_compatible""$as_suggested" 2>/dev/null -then : + if { $as_echo "$as_bourne_compatible""$as_suggested" | as_run=a "$as_shell"; } 2>/dev/null; then : break 2 fi fi @@ -221,21 +228,14 @@ fi esac as_found=false done -IFS=$as_save_IFS -if $as_found -then : - -else $as_nop - if { test -f "$SHELL" || test -f "$SHELL.exe"; } && - as_run=a "$SHELL" -c "$as_bourne_compatible""$as_required" 2>/dev/null -then : +$as_found || { if { test -f "$SHELL" || test -f "$SHELL.exe"; } && + { $as_echo "$as_bourne_compatible""$as_required" | as_run=a "$SHELL"; } 2>/dev/null; then : CONFIG_SHELL=$SHELL as_have_required=yes -fi -fi +fi; } +IFS=$as_save_IFS - if test "x$CONFIG_SHELL" != x -then : + if test "x$CONFIG_SHELL" != x; then : export CONFIG_SHELL # We cannot yet assume a decent shell, so we have to provide a # neutralization value for shells without unset; and this also @@ -253,19 +253,18 @@ esac exec $CONFIG_SHELL $as_opts "$as_myself" ${1+"$@"} # Admittedly, this is quite paranoid, since all the known shells bail # out after a failed `exec'. -printf "%s\n" "$0: could not re-execute with $CONFIG_SHELL" >&2 +$as_echo "$0: could not re-execute with $CONFIG_SHELL" >&2 exit 255 fi - if test x$as_have_required = xno -then : - printf "%s\n" "$0: This script requires a shell more modern than all" - printf "%s\n" "$0: the shells that I found on your system." - if test ${ZSH_VERSION+y} ; then - printf "%s\n" "$0: In particular, zsh $ZSH_VERSION has bugs and should" - printf "%s\n" "$0: be upgraded to zsh 4.3.4 or later." + if test x$as_have_required = xno; then : + $as_echo "$0: This script requires a shell more modern than all" + $as_echo "$0: the shells that I found on your system." + if test x${ZSH_VERSION+set} = xset ; then + $as_echo "$0: In particular, zsh $ZSH_VERSION has bugs and should" + $as_echo "$0: be upgraded to zsh 4.3.4 or later." else - printf "%s\n" "$0: Please tell bug-autoconf@gnu.org about your system, + $as_echo "$0: Please tell bug-autoconf@gnu.org about your system, $0: including any error possibly output before this $0: message. Then install a modern shell, or manually run $0: the script under such a shell if you do have one." @@ -292,7 +291,6 @@ as_fn_unset () } as_unset=as_fn_unset - # as_fn_set_status STATUS # ----------------------- # Set $? to STATUS, without forking. @@ -310,14 +308,6 @@ as_fn_exit () as_fn_set_status $1 exit $1 } # as_fn_exit -# as_fn_nop -# --------- -# Do nothing but, unlike ":", preserve the value of $?. -as_fn_nop () -{ - return $? -} -as_nop=as_fn_nop # as_fn_mkdir_p # ------------- @@ -332,7 +322,7 @@ as_fn_mkdir_p () as_dirs= while :; do case $as_dir in #( - *\'*) as_qdir=`printf "%s\n" "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'( + *\'*) as_qdir=`$as_echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'( *) as_qdir=$as_dir;; esac as_dirs="'$as_qdir' $as_dirs" @@ -341,7 +331,7 @@ $as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$as_dir" : 'X\(//\)[^/]' \| \ X"$as_dir" : 'X\(//\)$' \| \ X"$as_dir" : 'X\(/\)' \| . 2>/dev/null || -printf "%s\n" X"$as_dir" | +$as_echo X"$as_dir" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q @@ -380,13 +370,12 @@ as_fn_executable_p () # advantage of any shell optimizations that allow amortized linear growth over # repeated appends, instead of the typical quadratic growth present in naive # implementations. -if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null -then : +if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null; then : eval 'as_fn_append () { eval $1+=\$2 }' -else $as_nop +else as_fn_append () { eval $1=\$$1\$2 @@ -398,27 +387,18 @@ fi # as_fn_append # Perform arithmetic evaluation on the ARGs, and store the result in the # global $as_val. Take advantage of shells that can avoid forks. The arguments # must be portable across $(()) and expr. -if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null -then : +if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null; then : eval 'as_fn_arith () { as_val=$(( $* )) }' -else $as_nop +else as_fn_arith () { as_val=`expr "$@" || test $? -eq 1` } fi # as_fn_arith -# as_fn_nop -# --------- -# Do nothing but, unlike ":", preserve the value of $?. -as_fn_nop () -{ - return $? -} -as_nop=as_fn_nop # as_fn_error STATUS ERROR [LINENO LOG_FD] # ---------------------------------------- @@ -430,9 +410,9 @@ as_fn_error () as_status=$1; test $as_status -eq 0 && as_status=1 if test "$4"; then as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: $2" >&$4 + $as_echo "$as_me:${as_lineno-$LINENO}: error: $2" >&$4 fi - printf "%s\n" "$as_me: error: $2" >&2 + $as_echo "$as_me: error: $2" >&2 as_fn_exit $as_status } # as_fn_error @@ -459,7 +439,7 @@ as_me=`$as_basename -- "$0" || $as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ X"$0" : 'X\(//\)$' \| \ X"$0" : 'X\(/\)' \| . 2>/dev/null || -printf "%s\n" X/"$0" | +$as_echo X/"$0" | sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/ q @@ -503,7 +483,7 @@ as_cr_alnum=$as_cr_Letters$as_cr_digits s/-\n.*// ' >$as_me.lineno && chmod +x "$as_me.lineno" || - { printf "%s\n" "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2; as_fn_exit 1; } + { $as_echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2; as_fn_exit 1; } # If we had to re-execute with $CONFIG_SHELL, we're ensured to have # already done that, so ensure we don't try to do so again and fall @@ -517,10 +497,6 @@ as_cr_alnum=$as_cr_Letters$as_cr_digits exit } - -# Determine whether it's possible to make 'echo' print without a newline. -# These variables are no longer used directly by Autoconf, but are AC_SUBSTed -# for compatibility with existing Makefiles. ECHO_C= ECHO_N= ECHO_T= case `echo -n x` in #((((( -n*) @@ -534,13 +510,6 @@ case `echo -n x` in #((((( ECHO_N='-n';; esac -# For backward compatibility with old third-party macros, we provide -# the shell variables $as_echo and $as_echo_n. New code should use -# AS_ECHO(["message"]) and AS_ECHO_N(["message"]), respectively. -as_echo='printf %s\n' -as_echo_n='printf %s' - - rm -f conf$$ conf$$.exe conf$$.file if test -d conf$$.dir; then rm -f conf$$.dir/conf$$.file @@ -608,44 +577,48 @@ MAKEFLAGS= # Identity of this package. PACKAGE_NAME='cpuminer-opt' PACKAGE_TARNAME='cpuminer-opt' -PACKAGE_VERSION='23.5' -PACKAGE_STRING='cpuminer-opt 23.5' +PACKAGE_VERSION='23.7' +PACKAGE_STRING='cpuminer-opt 23.7' PACKAGE_BUGREPORT='' PACKAGE_URL='' ac_unique_file="cpu-miner.c" # Factoring default headers for most tests. ac_includes_default="\ -#include -#ifdef HAVE_STDIO_H -# include +#include +#ifdef HAVE_SYS_TYPES_H +# include +#endif +#ifdef HAVE_SYS_STAT_H +# include #endif -#ifdef HAVE_STDLIB_H +#ifdef STDC_HEADERS # include +# include +#else +# ifdef HAVE_STDLIB_H +# include +# endif #endif #ifdef HAVE_STRING_H +# if !defined STDC_HEADERS && defined HAVE_MEMORY_H +# include +# endif # include #endif +#ifdef HAVE_STRINGS_H +# include +#endif #ifdef HAVE_INTTYPES_H # include #endif #ifdef HAVE_STDINT_H # include #endif -#ifdef HAVE_STRINGS_H -# include -#endif -#ifdef HAVE_SYS_TYPES_H -# include -#endif -#ifdef HAVE_SYS_STAT_H -# include -#endif #ifdef HAVE_UNISTD_H # include #endif" -ac_header_c_list= ac_subst_vars='am__EXEEXT_FALSE am__EXEEXT_TRUE LTLIBOBJS @@ -710,9 +683,6 @@ AM_BACKSLASH AM_DEFAULT_VERBOSITY AM_DEFAULT_V AM_V -CSCOPE -ETAGS -CTAGS am__untar am__tar AMTAR @@ -880,6 +850,8 @@ do *) ac_optarg=yes ;; esac + # Accept the important Cygnus configure options, so we can diagnose typos. + case $ac_dashdash$ac_option in --) ac_dashdash=yes ;; @@ -920,9 +892,9 @@ do ac_useropt=`expr "x$ac_option" : 'x-*disable-\(.*\)'` # Reject names that are not valid shell variable names. expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && - as_fn_error $? "invalid feature name: \`$ac_useropt'" + as_fn_error $? "invalid feature name: $ac_useropt" ac_useropt_orig=$ac_useropt - ac_useropt=`printf "%s\n" "$ac_useropt" | sed 's/[-+.]/_/g'` + ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in *" "enable_$ac_useropt" @@ -946,9 +918,9 @@ do ac_useropt=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'` # Reject names that are not valid shell variable names. expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && - as_fn_error $? "invalid feature name: \`$ac_useropt'" + as_fn_error $? "invalid feature name: $ac_useropt" ac_useropt_orig=$ac_useropt - ac_useropt=`printf "%s\n" "$ac_useropt" | sed 's/[-+.]/_/g'` + ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in *" "enable_$ac_useropt" @@ -1159,9 +1131,9 @@ do ac_useropt=`expr "x$ac_option" : 'x-*with-\([^=]*\)'` # Reject names that are not valid shell variable names. expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && - as_fn_error $? "invalid package name: \`$ac_useropt'" + as_fn_error $? "invalid package name: $ac_useropt" ac_useropt_orig=$ac_useropt - ac_useropt=`printf "%s\n" "$ac_useropt" | sed 's/[-+.]/_/g'` + ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in *" "with_$ac_useropt" @@ -1175,9 +1147,9 @@ do ac_useropt=`expr "x$ac_option" : 'x-*without-\(.*\)'` # Reject names that are not valid shell variable names. expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && - as_fn_error $? "invalid package name: \`$ac_useropt'" + as_fn_error $? "invalid package name: $ac_useropt" ac_useropt_orig=$ac_useropt - ac_useropt=`printf "%s\n" "$ac_useropt" | sed 's/[-+.]/_/g'` + ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in *" "with_$ac_useropt" @@ -1221,9 +1193,9 @@ Try \`$0 --help' for more information" *) # FIXME: should be removed in autoconf 3.0. - printf "%s\n" "$as_me: WARNING: you should use --build, --host, --target" >&2 + $as_echo "$as_me: WARNING: you should use --build, --host, --target" >&2 expr "x$ac_option" : ".*[^-._$as_cr_alnum]" >/dev/null && - printf "%s\n" "$as_me: WARNING: invalid host type: $ac_option" >&2 + $as_echo "$as_me: WARNING: invalid host type: $ac_option" >&2 : "${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option}" ;; @@ -1239,7 +1211,7 @@ if test -n "$ac_unrecognized_opts"; then case $enable_option_checking in no) ;; fatal) as_fn_error $? "unrecognized options: $ac_unrecognized_opts" ;; - *) printf "%s\n" "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2 ;; + *) $as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2 ;; esac fi @@ -1303,7 +1275,7 @@ $as_expr X"$as_myself" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$as_myself" : 'X\(//\)[^/]' \| \ X"$as_myself" : 'X\(//\)$' \| \ X"$as_myself" : 'X\(/\)' \| . 2>/dev/null || -printf "%s\n" X"$as_myself" | +$as_echo X"$as_myself" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q @@ -1360,7 +1332,7 @@ if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF -\`configure' configures cpuminer-opt 23.5 to adapt to many kinds of systems. +\`configure' configures cpuminer-opt 23.7 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1432,7 +1404,7 @@ fi if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of cpuminer-opt 23.5:";; + short | recursive ) echo "Configuration of cpuminer-opt 23.7:";; esac cat <<\_ACEOF @@ -1490,9 +1462,9 @@ if test "$ac_init_help" = "recursive"; then case "$ac_dir" in .) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; *) - ac_dir_suffix=/`printf "%s\n" "$ac_dir" | sed 's|^\.[\\/]||'` + ac_dir_suffix=/`$as_echo "$ac_dir" | sed 's|^\.[\\/]||'` # A ".." for each directory in $ac_dir_suffix. - ac_top_builddir_sub=`printf "%s\n" "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'` + ac_top_builddir_sub=`$as_echo "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'` case $ac_top_builddir_sub in "") ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; @@ -1520,8 +1492,7 @@ esac ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix cd "$ac_dir" || { ac_status=$?; continue; } - # Check for configure.gnu first; this name is used for a wrapper for - # Metaconfig's "Configure" on case-insensitive file systems. + # Check for guested configure. if test -f "$ac_srcdir/configure.gnu"; then echo && $SHELL "$ac_srcdir/configure.gnu" --help=recursive @@ -1529,7 +1500,7 @@ ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix echo && $SHELL "$ac_srcdir/configure" --help=recursive else - printf "%s\n" "$as_me: WARNING: no configuration information is in $ac_dir" >&2 + $as_echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2 fi || ac_status=$? cd "$ac_pwd" || { ac_status=$?; break; } done @@ -1538,10 +1509,10 @@ fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -cpuminer-opt configure 23.5 -generated by GNU Autoconf 2.71 +cpuminer-opt configure 23.7 +generated by GNU Autoconf 2.69 -Copyright (C) 2021 Free Software Foundation, Inc. +Copyright (C) 2012 Free Software Foundation, Inc. This configure script is free software; the Free Software Foundation gives unlimited permission to copy, distribute and modify it. _ACEOF @@ -1558,14 +1529,14 @@ fi ac_fn_c_try_compile () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - rm -f conftest.$ac_objext conftest.beam + rm -f conftest.$ac_objext if { { ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -printf "%s\n" "$ac_try_echo"; } >&5 +$as_echo "$ac_try_echo"; } >&5 (eval "$ac_compile") 2>conftest.err ac_status=$? if test -s conftest.err; then @@ -1573,15 +1544,14 @@ printf "%s\n" "$ac_try_echo"; } >&5 cat conftest.er1 >&5 mv -f conftest.er1 conftest.err fi - printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err - } && test -s conftest.$ac_objext -then : + } && test -s conftest.$ac_objext; then : ac_retval=0 -else $as_nop - printf "%s\n" "$as_me: failed program was:" >&5 +else + $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_retval=1 @@ -1603,7 +1573,7 @@ case "(($ac_try" in *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -printf "%s\n" "$ac_try_echo"; } >&5 +$as_echo "$ac_try_echo"; } >&5 (eval "$ac_cpp conftest.$ac_ext") 2>conftest.err ac_status=$? if test -s conftest.err; then @@ -1611,15 +1581,14 @@ printf "%s\n" "$ac_try_echo"; } >&5 cat conftest.er1 >&5 mv -f conftest.er1 conftest.err fi - printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } > conftest.i && { test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || test ! -s conftest.err - } -then : + }; then : ac_retval=0 -else $as_nop - printf "%s\n" "$as_me: failed program was:" >&5 +else + $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_retval=1 @@ -1635,14 +1604,14 @@ fi ac_fn_cxx_try_compile () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - rm -f conftest.$ac_objext conftest.beam + rm -f conftest.$ac_objext if { { ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -printf "%s\n" "$ac_try_echo"; } >&5 +$as_echo "$ac_try_echo"; } >&5 (eval "$ac_compile") 2>conftest.err ac_status=$? if test -s conftest.err; then @@ -1650,15 +1619,14 @@ printf "%s\n" "$ac_try_echo"; } >&5 cat conftest.er1 >&5 mv -f conftest.er1 conftest.err fi - printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && { test -z "$ac_cxx_werror_flag" || test ! -s conftest.err - } && test -s conftest.$ac_objext -then : + } && test -s conftest.$ac_objext; then : ac_retval=0 -else $as_nop - printf "%s\n" "$as_me: failed program was:" >&5 +else + $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_retval=1 @@ -1668,6 +1636,135 @@ fi } # ac_fn_cxx_try_compile +# ac_fn_c_try_run LINENO +# ---------------------- +# Try to link conftest.$ac_ext, and return whether this succeeded. Assumes +# that executables *can* be run. +ac_fn_c_try_run () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + if { { ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_link") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } && { ac_try='./conftest$ac_exeext' + { { case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; }; then : + ac_retval=0 +else + $as_echo "$as_me: program exited with status $ac_status" >&5 + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_retval=$ac_status +fi + rm -rf conftest.dSYM conftest_ipa8_conftest.oo + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno + as_fn_set_status $ac_retval + +} # ac_fn_c_try_run + +# ac_fn_c_check_header_mongrel LINENO HEADER VAR INCLUDES +# ------------------------------------------------------- +# Tests whether HEADER exists, giving a warning if it cannot be compiled using +# the include files in INCLUDES and setting the cache variable VAR +# accordingly. +ac_fn_c_check_header_mongrel () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + if eval \${$3+:} false; then : + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 +$as_echo_n "checking for $2... " >&6; } +if eval \${$3+:} false; then : + $as_echo_n "(cached) " >&6 +fi +eval ac_res=\$$3 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 +$as_echo "$ac_res" >&6; } +else + # Is the header compilable? +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking $2 usability" >&5 +$as_echo_n "checking $2 usability... " >&6; } +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +$4 +#include <$2> +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + ac_header_compiler=yes +else + ac_header_compiler=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_header_compiler" >&5 +$as_echo "$ac_header_compiler" >&6; } + +# Is the header present? +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking $2 presence" >&5 +$as_echo_n "checking $2 presence... " >&6; } +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include <$2> +_ACEOF +if ac_fn_c_try_cpp "$LINENO"; then : + ac_header_preproc=yes +else + ac_header_preproc=no +fi +rm -f conftest.err conftest.i conftest.$ac_ext +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_header_preproc" >&5 +$as_echo "$ac_header_preproc" >&6; } + +# So? What about this header? +case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in #(( + yes:no: ) + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: accepted by the compiler, rejected by the preprocessor!" >&5 +$as_echo "$as_me: WARNING: $2: accepted by the compiler, rejected by the preprocessor!" >&2;} + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: proceeding with the compiler's result" >&5 +$as_echo "$as_me: WARNING: $2: proceeding with the compiler's result" >&2;} + ;; + no:yes:* ) + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: present but cannot be compiled" >&5 +$as_echo "$as_me: WARNING: $2: present but cannot be compiled" >&2;} + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: check for missing prerequisite headers?" >&5 +$as_echo "$as_me: WARNING: $2: check for missing prerequisite headers?" >&2;} + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: see the Autoconf documentation" >&5 +$as_echo "$as_me: WARNING: $2: see the Autoconf documentation" >&2;} + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: section \"Present But Cannot Be Compiled\"" >&5 +$as_echo "$as_me: WARNING: $2: section \"Present But Cannot Be Compiled\"" >&2;} + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: proceeding with the compiler's result" >&5 +$as_echo "$as_me: WARNING: $2: proceeding with the compiler's result" >&2;} + ;; +esac + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 +$as_echo_n "checking for $2... " >&6; } +if eval \${$3+:} false; then : + $as_echo_n "(cached) " >&6 +else + eval "$3=\$ac_header_compiler" +fi +eval ac_res=\$$3 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 +$as_echo "$ac_res" >&6; } +fi + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno + +} # ac_fn_c_check_header_mongrel + # ac_fn_c_check_header_compile LINENO HEADER VAR INCLUDES # ------------------------------------------------------- # Tests whether HEADER exists and can be compiled using the include files in @@ -1675,54 +1772,49 @@ fi ac_fn_c_check_header_compile () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 -printf %s "checking for $2... " >&6; } -if eval test \${$3+y} -then : - printf %s "(cached) " >&6 -else $as_nop + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 +$as_echo_n "checking for $2... " >&6; } +if eval \${$3+:} false; then : + $as_echo_n "(cached) " >&6 +else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $4 #include <$2> _ACEOF -if ac_fn_c_try_compile "$LINENO" -then : +if ac_fn_c_try_compile "$LINENO"; then : eval "$3=yes" -else $as_nop +else eval "$3=no" fi -rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi eval ac_res=\$$3 - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 -printf "%s\n" "$ac_res" >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 +$as_echo "$ac_res" >&6; } eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno } # ac_fn_c_check_header_compile -# ac_fn_check_decl LINENO SYMBOL VAR INCLUDES EXTRA-OPTIONS FLAG-VAR -# ------------------------------------------------------------------ +# ac_fn_c_check_decl LINENO SYMBOL VAR INCLUDES +# --------------------------------------------- # Tests whether SYMBOL is declared in INCLUDES, setting cache variable VAR -# accordingly. Pass EXTRA-OPTIONS to the compiler, using FLAG-VAR. -ac_fn_check_decl () +# accordingly. +ac_fn_c_check_decl () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack as_decl_name=`echo $2|sed 's/ *(.*//'` - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether $as_decl_name is declared" >&5 -printf %s "checking whether $as_decl_name is declared... " >&6; } -if eval test \${$3+y} -then : - printf %s "(cached) " >&6 -else $as_nop as_decl_use=`echo $2|sed -e 's/(/((/' -e 's/)/) 0&/' -e 's/,/) 0& (/g'` - eval ac_save_FLAGS=\$$6 - as_fn_append $6 " $5" + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $as_decl_name is declared" >&5 +$as_echo_n "checking whether $as_decl_name is declared... " >&6; } +if eval \${$3+:} false; then : + $as_echo_n "(cached) " >&6 +else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $4 int -main (void) +main () { #ifndef $as_decl_name #ifdef __cplusplus @@ -1736,22 +1828,19 @@ main (void) return 0; } _ACEOF -if ac_fn_c_try_compile "$LINENO" -then : +if ac_fn_c_try_compile "$LINENO"; then : eval "$3=yes" -else $as_nop +else eval "$3=no" fi -rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext - eval $6=\$ac_save_FLAGS - +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi eval ac_res=\$$3 - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 -printf "%s\n" "$ac_res" >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 +$as_echo "$ac_res" >&6; } eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno -} # ac_fn_check_decl +} # ac_fn_c_check_decl # ac_fn_c_check_type LINENO TYPE VAR INCLUDES # ------------------------------------------- @@ -1760,18 +1849,17 @@ printf "%s\n" "$ac_res" >&6; } ac_fn_c_check_type () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 -printf %s "checking for $2... " >&6; } -if eval test \${$3+y} -then : - printf %s "(cached) " >&6 -else $as_nop + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 +$as_echo_n "checking for $2... " >&6; } +if eval \${$3+:} false; then : + $as_echo_n "(cached) " >&6 +else eval "$3=no" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $4 int -main (void) +main () { if (sizeof ($2)) return 0; @@ -1779,13 +1867,12 @@ if (sizeof ($2)) return 0; } _ACEOF -if ac_fn_c_try_compile "$LINENO" -then : +if ac_fn_c_try_compile "$LINENO"; then : cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $4 int -main (void) +main () { if (sizeof (($2))) return 0; @@ -1793,19 +1880,18 @@ if (sizeof (($2))) return 0; } _ACEOF -if ac_fn_c_try_compile "$LINENO" -then : +if ac_fn_c_try_compile "$LINENO"; then : -else $as_nop +else eval "$3=yes" fi -rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi -rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi eval ac_res=\$$3 - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 -printf "%s\n" "$ac_res" >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 +$as_echo "$ac_res" >&6; } eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno } # ac_fn_c_check_type @@ -1816,14 +1902,14 @@ printf "%s\n" "$ac_res" >&6; } ac_fn_c_try_link () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - rm -f conftest.$ac_objext conftest.beam conftest$ac_exeext + rm -f conftest.$ac_objext conftest$ac_exeext if { { ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -printf "%s\n" "$ac_try_echo"; } >&5 +$as_echo "$ac_try_echo"; } >&5 (eval "$ac_link") 2>conftest.err ac_status=$? if test -s conftest.err; then @@ -1831,18 +1917,17 @@ printf "%s\n" "$ac_try_echo"; } >&5 cat conftest.er1 >&5 mv -f conftest.er1 conftest.err fi - printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest$ac_exeext && { test "$cross_compiling" = yes || test -x conftest$ac_exeext - } -then : + }; then : ac_retval=0 -else $as_nop - printf "%s\n" "$as_me: failed program was:" >&5 +else + $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_retval=1 @@ -1857,61 +1942,17 @@ fi } # ac_fn_c_try_link -# ac_fn_c_try_run LINENO -# ---------------------- -# Try to run conftest.$ac_ext, and return whether this succeeded. Assumes that -# executables *can* be run. -ac_fn_c_try_run () -{ - as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - if { { ac_try="$ac_link" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -printf "%s\n" "$ac_try_echo"; } >&5 - (eval "$ac_link") 2>&5 - ac_status=$? - printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; } && { ac_try='./conftest$ac_exeext' - { { case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -printf "%s\n" "$ac_try_echo"; } >&5 - (eval "$ac_try") 2>&5 - ac_status=$? - printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; }; } -then : - ac_retval=0 -else $as_nop - printf "%s\n" "$as_me: program exited with status $ac_status" >&5 - printf "%s\n" "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_retval=$ac_status -fi - rm -rf conftest.dSYM conftest_ipa8_conftest.oo - eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno - as_fn_set_status $ac_retval - -} # ac_fn_c_try_run - # ac_fn_c_check_func LINENO FUNC VAR # ---------------------------------- # Tests whether FUNC exists, setting the cache variable VAR accordingly ac_fn_c_check_func () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 -printf %s "checking for $2... " >&6; } -if eval test \${$3+y} -then : - printf %s "(cached) " >&6 -else $as_nop + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 +$as_echo_n "checking for $2... " >&6; } +if eval \${$3+:} false; then : + $as_echo_n "(cached) " >&6 +else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Define $2 to an innocuous variant, in case declares $2. @@ -1919,9 +1960,16 @@ else $as_nop #define $2 innocuous_$2 /* System header to define __stub macros and hopefully few prototypes, - which can conflict with char $2 (); below. */ + which can conflict with char $2 (); below. + Prefer to if __STDC__ is defined, since + exists even on freestanding compilers. */ + +#ifdef __STDC__ +# include +#else +# include +#endif -#include #undef $2 /* Override any GCC internal prototype to avoid an error. @@ -1939,56 +1987,35 @@ choke me #endif int -main (void) +main () { return $2 (); ; return 0; } _ACEOF -if ac_fn_c_try_link "$LINENO" -then : +if ac_fn_c_try_link "$LINENO"; then : eval "$3=yes" -else $as_nop +else eval "$3=no" fi -rm -f core conftest.err conftest.$ac_objext conftest.beam \ +rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext fi eval ac_res=\$$3 - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 -printf "%s\n" "$ac_res" >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 +$as_echo "$ac_res" >&6; } eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno } # ac_fn_c_check_func -ac_configure_args_raw= -for ac_arg -do - case $ac_arg in - *\'*) - ac_arg=`printf "%s\n" "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;; - esac - as_fn_append ac_configure_args_raw " '$ac_arg'" -done - -case $ac_configure_args_raw in - *$as_nl*) - ac_safe_unquote= ;; - *) - ac_unsafe_z='|&;<>()$`\\"*?[ '' ' # This string ends in space, tab. - ac_unsafe_a="$ac_unsafe_z#~" - ac_safe_unquote="s/ '\\([^$ac_unsafe_a][^$ac_unsafe_z]*\\)'/ \\1/g" - ac_configure_args_raw=` printf "%s\n" "$ac_configure_args_raw" | sed "$ac_safe_unquote"`;; -esac - cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. -It was created by cpuminer-opt $as_me 23.5, which was -generated by GNU Autoconf 2.71. Invocation command line was +It was created by cpuminer-opt $as_me 23.7, which was +generated by GNU Autoconf 2.69. Invocation command line was - $ $0$ac_configure_args_raw + $ $0 $@ _ACEOF exec 5>>config.log @@ -2021,12 +2048,8 @@ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS - case $as_dir in #((( - '') as_dir=./ ;; - */) ;; - *) as_dir=$as_dir/ ;; - esac - printf "%s\n" "PATH: $as_dir" + test -z "$as_dir" && as_dir=. + $as_echo "PATH: $as_dir" done IFS=$as_save_IFS @@ -2061,7 +2084,7 @@ do | -silent | --silent | --silen | --sile | --sil) continue ;; *\'*) - ac_arg=`printf "%s\n" "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;; + ac_arg=`$as_echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;; esac case $ac_pass in 1) as_fn_append ac_configure_args0 " '$ac_arg'" ;; @@ -2096,13 +2119,11 @@ done # WARNING: Use '\'' to represent an apostrophe within the trap. # WARNING: Do not start the trap code with a newline, due to a FreeBSD 4.0 bug. trap 'exit_status=$? - # Sanitize IFS. - IFS=" "" $as_nl" # Save into config.log some information that might help in debugging. { echo - printf "%s\n" "## ---------------- ## + $as_echo "## ---------------- ## ## Cache variables. ## ## ---------------- ##" echo @@ -2113,8 +2134,8 @@ trap 'exit_status=$? case $ac_val in #( *${as_nl}*) case $ac_var in #( - *_cv_*) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5 -printf "%s\n" "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; + *_cv_*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5 +$as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; esac case $ac_var in #( _ | IFS | as_nl) ;; #( @@ -2138,7 +2159,7 @@ printf "%s\n" "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ) echo - printf "%s\n" "## ----------------- ## + $as_echo "## ----------------- ## ## Output variables. ## ## ----------------- ##" echo @@ -2146,14 +2167,14 @@ printf "%s\n" "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} do eval ac_val=\$$ac_var case $ac_val in - *\'\''*) ac_val=`printf "%s\n" "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; + *\'\''*) ac_val=`$as_echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; esac - printf "%s\n" "$ac_var='\''$ac_val'\''" + $as_echo "$ac_var='\''$ac_val'\''" done | sort echo if test -n "$ac_subst_files"; then - printf "%s\n" "## ------------------- ## + $as_echo "## ------------------- ## ## File substitutions. ## ## ------------------- ##" echo @@ -2161,15 +2182,15 @@ printf "%s\n" "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} do eval ac_val=\$$ac_var case $ac_val in - *\'\''*) ac_val=`printf "%s\n" "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; + *\'\''*) ac_val=`$as_echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; esac - printf "%s\n" "$ac_var='\''$ac_val'\''" + $as_echo "$ac_var='\''$ac_val'\''" done | sort echo fi if test -s confdefs.h; then - printf "%s\n" "## ----------- ## + $as_echo "## ----------- ## ## confdefs.h. ## ## ----------- ##" echo @@ -2177,8 +2198,8 @@ printf "%s\n" "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} echo fi test "$ac_signal" != 0 && - printf "%s\n" "$as_me: caught signal $ac_signal" - printf "%s\n" "$as_me: exit $exit_status" + $as_echo "$as_me: caught signal $ac_signal" + $as_echo "$as_me: exit $exit_status" } >&5 rm -f core *.core core.conftest.* && rm -f -r conftest* confdefs* conf$$* $ac_clean_files && @@ -2192,48 +2213,63 @@ ac_signal=0 # confdefs.h avoids OS command line length limits that DEFS can exceed. rm -f -r conftest* confdefs.h -printf "%s\n" "/* confdefs.h */" > confdefs.h +$as_echo "/* confdefs.h */" > confdefs.h # Predefined preprocessor variables. -printf "%s\n" "#define PACKAGE_NAME \"$PACKAGE_NAME\"" >>confdefs.h +cat >>confdefs.h <<_ACEOF +#define PACKAGE_NAME "$PACKAGE_NAME" +_ACEOF -printf "%s\n" "#define PACKAGE_TARNAME \"$PACKAGE_TARNAME\"" >>confdefs.h +cat >>confdefs.h <<_ACEOF +#define PACKAGE_TARNAME "$PACKAGE_TARNAME" +_ACEOF -printf "%s\n" "#define PACKAGE_VERSION \"$PACKAGE_VERSION\"" >>confdefs.h +cat >>confdefs.h <<_ACEOF +#define PACKAGE_VERSION "$PACKAGE_VERSION" +_ACEOF -printf "%s\n" "#define PACKAGE_STRING \"$PACKAGE_STRING\"" >>confdefs.h +cat >>confdefs.h <<_ACEOF +#define PACKAGE_STRING "$PACKAGE_STRING" +_ACEOF -printf "%s\n" "#define PACKAGE_BUGREPORT \"$PACKAGE_BUGREPORT\"" >>confdefs.h +cat >>confdefs.h <<_ACEOF +#define PACKAGE_BUGREPORT "$PACKAGE_BUGREPORT" +_ACEOF -printf "%s\n" "#define PACKAGE_URL \"$PACKAGE_URL\"" >>confdefs.h +cat >>confdefs.h <<_ACEOF +#define PACKAGE_URL "$PACKAGE_URL" +_ACEOF # Let the site file select an alternate cache file if it wants to. # Prefer an explicitly selected file to automatically selected ones. +ac_site_file1=NONE +ac_site_file2=NONE if test -n "$CONFIG_SITE"; then - ac_site_files="$CONFIG_SITE" + # We do not want a PATH search for config.site. + case $CONFIG_SITE in #(( + -*) ac_site_file1=./$CONFIG_SITE;; + */*) ac_site_file1=$CONFIG_SITE;; + *) ac_site_file1=./$CONFIG_SITE;; + esac elif test "x$prefix" != xNONE; then - ac_site_files="$prefix/share/config.site $prefix/etc/config.site" + ac_site_file1=$prefix/share/config.site + ac_site_file2=$prefix/etc/config.site else - ac_site_files="$ac_default_prefix/share/config.site $ac_default_prefix/etc/config.site" + ac_site_file1=$ac_default_prefix/share/config.site + ac_site_file2=$ac_default_prefix/etc/config.site fi - -for ac_site_file in $ac_site_files +for ac_site_file in "$ac_site_file1" "$ac_site_file2" do - case $ac_site_file in #( - */*) : - ;; #( - *) : - ac_site_file=./$ac_site_file ;; -esac - if test -f "$ac_site_file" && test -r "$ac_site_file"; then - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: loading site script $ac_site_file" >&5 -printf "%s\n" "$as_me: loading site script $ac_site_file" >&6;} + test "x$ac_site_file" = xNONE && continue + if test /dev/null != "$ac_site_file" && test -r "$ac_site_file"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: loading site script $ac_site_file" >&5 +$as_echo "$as_me: loading site script $ac_site_file" >&6;} sed 's/^/| /' "$ac_site_file" >&5 . "$ac_site_file" \ - || { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -printf "%s\n" "$as_me: error: in \`$ac_pwd':" >&2;} + || { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "failed to load site script $ac_site_file See \`config.log' for more details" "$LINENO" 5; } fi @@ -2243,745 +2279,138 @@ if test -r "$cache_file"; then # Some versions of bash will fail to source /dev/null (special files # actually), so we avoid doing that. DJGPP emulates it as a regular file. if test /dev/null != "$cache_file" && test -f "$cache_file"; then - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: loading cache $cache_file" >&5 -printf "%s\n" "$as_me: loading cache $cache_file" >&6;} + { $as_echo "$as_me:${as_lineno-$LINENO}: loading cache $cache_file" >&5 +$as_echo "$as_me: loading cache $cache_file" >&6;} case $cache_file in [\\/]* | ?:[\\/]* ) . "$cache_file";; *) . "./$cache_file";; esac fi else - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: creating cache $cache_file" >&5 -printf "%s\n" "$as_me: creating cache $cache_file" >&6;} + { $as_echo "$as_me:${as_lineno-$LINENO}: creating cache $cache_file" >&5 +$as_echo "$as_me: creating cache $cache_file" >&6;} >$cache_file fi -# Test code for whether the C compiler supports C89 (global declarations) -ac_c_conftest_c89_globals=' -/* Does the compiler advertise C89 conformance? - Do not test the value of __STDC__, because some compilers set it to 0 - while being otherwise adequately conformant. */ -#if !defined __STDC__ -# error "Compiler does not advertise C89 conformance" -#endif +# Check that the precious variables saved in the cache have kept the same +# value. +ac_cache_corrupted=false +for ac_var in $ac_precious_vars; do + eval ac_old_set=\$ac_cv_env_${ac_var}_set + eval ac_new_set=\$ac_env_${ac_var}_set + eval ac_old_val=\$ac_cv_env_${ac_var}_value + eval ac_new_val=\$ac_env_${ac_var}_value + case $ac_old_set,$ac_new_set in + set,) + { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5 +$as_echo "$as_me: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2;} + ac_cache_corrupted=: ;; + ,set) + { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was not set in the previous run" >&5 +$as_echo "$as_me: error: \`$ac_var' was not set in the previous run" >&2;} + ac_cache_corrupted=: ;; + ,);; + *) + if test "x$ac_old_val" != "x$ac_new_val"; then + # differences in whitespace do not lead to failure. + ac_old_val_w=`echo x $ac_old_val` + ac_new_val_w=`echo x $ac_new_val` + if test "$ac_old_val_w" != "$ac_new_val_w"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' has changed since the previous run:" >&5 +$as_echo "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;} + ac_cache_corrupted=: + else + { $as_echo "$as_me:${as_lineno-$LINENO}: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&5 +$as_echo "$as_me: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&2;} + eval $ac_var=\$ac_old_val + fi + { $as_echo "$as_me:${as_lineno-$LINENO}: former value: \`$ac_old_val'" >&5 +$as_echo "$as_me: former value: \`$ac_old_val'" >&2;} + { $as_echo "$as_me:${as_lineno-$LINENO}: current value: \`$ac_new_val'" >&5 +$as_echo "$as_me: current value: \`$ac_new_val'" >&2;} + fi;; + esac + # Pass precious variables to config.status. + if test "$ac_new_set" = set; then + case $ac_new_val in + *\'*) ac_arg=$ac_var=`$as_echo "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"` ;; + *) ac_arg=$ac_var=$ac_new_val ;; + esac + case " $ac_configure_args " in + *" '$ac_arg' "*) ;; # Avoid dups. Use of quotes ensures accuracy. + *) as_fn_append ac_configure_args " '$ac_arg'" ;; + esac + fi +done +if $ac_cache_corrupted; then + { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} + { $as_echo "$as_me:${as_lineno-$LINENO}: error: changes in the environment can compromise the build" >&5 +$as_echo "$as_me: error: changes in the environment can compromise the build" >&2;} + as_fn_error $? "run \`make distclean' and/or \`rm $cache_file' and start over" "$LINENO" 5 +fi +## -------------------- ## +## Main body of script. ## +## -------------------- ## -#include -#include -struct stat; -/* Most of the following tests are stolen from RCS 5.7 src/conf.sh. */ -struct buf { int x; }; -struct buf * (*rcsopen) (struct buf *, struct stat *, int); -static char *e (p, i) - char **p; - int i; -{ - return p[i]; -} -static char *f (char * (*g) (char **, int), char **p, ...) -{ - char *s; - va_list v; - va_start (v,p); - s = g (p, va_arg (v,int)); - va_end (v); - return s; -} - -/* OSF 4.0 Compaq cc is some sort of almost-ANSI by default. It has - function prototypes and stuff, but not \xHH hex character constants. - These do not provoke an error unfortunately, instead are silently treated - as an "x". The following induces an error, until -std is added to get - proper ANSI mode. Curiously \x00 != x always comes out true, for an - array size at least. It is necessary to write \x00 == 0 to get something - that is true only with -std. */ -int osf4_cc_array ['\''\x00'\'' == 0 ? 1 : -1]; - -/* IBM C 6 for AIX is almost-ANSI by default, but it replaces macro parameters - inside strings and character constants. */ -#define FOO(x) '\''x'\'' -int xlc6_cc_array[FOO(a) == '\''x'\'' ? 1 : -1]; - -int test (int i, double x); -struct s1 {int (*f) (int a);}; -struct s2 {int (*f) (double a);}; -int pairnames (int, char **, int *(*)(struct buf *, struct stat *, int), - int, int);' - -# Test code for whether the C compiler supports C89 (body of main). -ac_c_conftest_c89_main=' -ok |= (argc == 0 || f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1]); -' - -# Test code for whether the C compiler supports C99 (global declarations) -ac_c_conftest_c99_globals=' -// Does the compiler advertise C99 conformance? -#if !defined __STDC_VERSION__ || __STDC_VERSION__ < 199901L -# error "Compiler does not advertise C99 conformance" -#endif - -#include -extern int puts (const char *); -extern int printf (const char *, ...); -extern int dprintf (int, const char *, ...); -extern void *malloc (size_t); - -// Check varargs macros. These examples are taken from C99 6.10.3.5. -// dprintf is used instead of fprintf to avoid needing to declare -// FILE and stderr. -#define debug(...) dprintf (2, __VA_ARGS__) -#define showlist(...) puts (#__VA_ARGS__) -#define report(test,...) ((test) ? puts (#test) : printf (__VA_ARGS__)) -static void -test_varargs_macros (void) -{ - int x = 1234; - int y = 5678; - debug ("Flag"); - debug ("X = %d\n", x); - showlist (The first, second, and third items.); - report (x>y, "x is %d but y is %d", x, y); -} - -// Check long long types. -#define BIG64 18446744073709551615ull -#define BIG32 4294967295ul -#define BIG_OK (BIG64 / BIG32 == 4294967297ull && BIG64 % BIG32 == 0) -#if !BIG_OK - #error "your preprocessor is broken" -#endif -#if BIG_OK -#else - #error "your preprocessor is broken" -#endif -static long long int bignum = -9223372036854775807LL; -static unsigned long long int ubignum = BIG64; - -struct incomplete_array -{ - int datasize; - double data[]; -}; - -struct named_init { - int number; - const wchar_t *name; - double average; -}; - -typedef const char *ccp; - -static inline int -test_restrict (ccp restrict text) -{ - // See if C++-style comments work. - // Iterate through items via the restricted pointer. - // Also check for declarations in for loops. - for (unsigned int i = 0; *(text+i) != '\''\0'\''; ++i) - continue; - return 0; -} - -// Check varargs and va_copy. -static bool -test_varargs (const char *format, ...) -{ - va_list args; - va_start (args, format); - va_list args_copy; - va_copy (args_copy, args); - - const char *str = ""; - int number = 0; - float fnumber = 0; - - while (*format) - { - switch (*format++) - { - case '\''s'\'': // string - str = va_arg (args_copy, const char *); - break; - case '\''d'\'': // int - number = va_arg (args_copy, int); - break; - case '\''f'\'': // float - fnumber = va_arg (args_copy, double); - break; - default: - break; - } - } - va_end (args_copy); - va_end (args); - - return *str && number && fnumber; -} -' - -# Test code for whether the C compiler supports C99 (body of main). -ac_c_conftest_c99_main=' - // Check bool. - _Bool success = false; - success |= (argc != 0); - - // Check restrict. - if (test_restrict ("String literal") == 0) - success = true; - char *restrict newvar = "Another string"; - - // Check varargs. - success &= test_varargs ("s, d'\'' f .", "string", 65, 34.234); - test_varargs_macros (); - - // Check flexible array members. - struct incomplete_array *ia = - malloc (sizeof (struct incomplete_array) + (sizeof (double) * 10)); - ia->datasize = 10; - for (int i = 0; i < ia->datasize; ++i) - ia->data[i] = i * 1.234; - - // Check named initializers. - struct named_init ni = { - .number = 34, - .name = L"Test wide string", - .average = 543.34343, - }; - - ni.number = 58; - - int dynamic_array[ni.number]; - dynamic_array[0] = argv[0][0]; - dynamic_array[ni.number - 1] = 543; - - // work around unused variable warnings - ok |= (!success || bignum == 0LL || ubignum == 0uLL || newvar[0] == '\''x'\'' - || dynamic_array[ni.number - 1] != 543); -' - -# Test code for whether the C compiler supports C11 (global declarations) -ac_c_conftest_c11_globals=' -// Does the compiler advertise C11 conformance? -#if !defined __STDC_VERSION__ || __STDC_VERSION__ < 201112L -# error "Compiler does not advertise C11 conformance" -#endif - -// Check _Alignas. -char _Alignas (double) aligned_as_double; -char _Alignas (0) no_special_alignment; -extern char aligned_as_int; -char _Alignas (0) _Alignas (int) aligned_as_int; - -// Check _Alignof. -enum -{ - int_alignment = _Alignof (int), - int_array_alignment = _Alignof (int[100]), - char_alignment = _Alignof (char) -}; -_Static_assert (0 < -_Alignof (int), "_Alignof is signed"); - -// Check _Noreturn. -int _Noreturn does_not_return (void) { for (;;) continue; } - -// Check _Static_assert. -struct test_static_assert -{ - int x; - _Static_assert (sizeof (int) <= sizeof (long int), - "_Static_assert does not work in struct"); - long int y; -}; - -// Check UTF-8 literals. -#define u8 syntax error! -char const utf8_literal[] = u8"happens to be ASCII" "another string"; - -// Check duplicate typedefs. -typedef long *long_ptr; -typedef long int *long_ptr; -typedef long_ptr long_ptr; - -// Anonymous structures and unions -- taken from C11 6.7.2.1 Example 1. -struct anonymous -{ - union { - struct { int i; int j; }; - struct { int k; long int l; } w; - }; - int m; -} v1; -' - -# Test code for whether the C compiler supports C11 (body of main). -ac_c_conftest_c11_main=' - _Static_assert ((offsetof (struct anonymous, i) - == offsetof (struct anonymous, w.k)), - "Anonymous union alignment botch"); - v1.i = 2; - v1.w.k = 5; - ok |= v1.i != 5; -' - -# Test code for whether the C compiler supports C11 (complete). -ac_c_conftest_c11_program="${ac_c_conftest_c89_globals} -${ac_c_conftest_c99_globals} -${ac_c_conftest_c11_globals} - -int -main (int argc, char **argv) -{ - int ok = 0; - ${ac_c_conftest_c89_main} - ${ac_c_conftest_c99_main} - ${ac_c_conftest_c11_main} - return ok; -} -" - -# Test code for whether the C compiler supports C99 (complete). -ac_c_conftest_c99_program="${ac_c_conftest_c89_globals} -${ac_c_conftest_c99_globals} - -int -main (int argc, char **argv) -{ - int ok = 0; - ${ac_c_conftest_c89_main} - ${ac_c_conftest_c99_main} - return ok; -} -" - -# Test code for whether the C compiler supports C89 (complete). -ac_c_conftest_c89_program="${ac_c_conftest_c89_globals} - -int -main (int argc, char **argv) -{ - int ok = 0; - ${ac_c_conftest_c89_main} - return ok; -} -" - -# Test code for whether the C++ compiler supports C++98 (global declarations) -ac_cxx_conftest_cxx98_globals=' -// Does the compiler advertise C++98 conformance? -#if !defined __cplusplus || __cplusplus < 199711L -# error "Compiler does not advertise C++98 conformance" -#endif - -// These inclusions are to reject old compilers that -// lack the unsuffixed header files. -#include -#include - -// and are *not* freestanding headers in C++98. -extern void assert (int); -namespace std { - extern int strcmp (const char *, const char *); -} - -// Namespaces, exceptions, and templates were all added after "C++ 2.0". -using std::exception; -using std::strcmp; - -namespace { - -void test_exception_syntax() -{ - try { - throw "test"; - } catch (const char *s) { - // Extra parentheses suppress a warning when building autoconf itself, - // due to lint rules shared with more typical C programs. - assert (!(strcmp) (s, "test")); - } -} - -template struct test_template -{ - T const val; - explicit test_template(T t) : val(t) {} - template T add(U u) { return static_cast(u) + val; } -}; - -} // anonymous namespace -' - -# Test code for whether the C++ compiler supports C++98 (body of main) -ac_cxx_conftest_cxx98_main=' - assert (argc); - assert (! argv[0]); -{ - test_exception_syntax (); - test_template tt (2.0); - assert (tt.add (4) == 6.0); - assert (true && !false); -} -' - -# Test code for whether the C++ compiler supports C++11 (global declarations) -ac_cxx_conftest_cxx11_globals=' -// Does the compiler advertise C++ 2011 conformance? -#if !defined __cplusplus || __cplusplus < 201103L -# error "Compiler does not advertise C++11 conformance" -#endif - -namespace cxx11test -{ - constexpr int get_val() { return 20; } - - struct testinit - { - int i; - double d; - }; - - class delegate - { - public: - delegate(int n) : n(n) {} - delegate(): delegate(2354) {} - - virtual int getval() { return this->n; }; - protected: - int n; - }; - - class overridden : public delegate - { - public: - overridden(int n): delegate(n) {} - virtual int getval() override final { return this->n * 2; } - }; - - class nocopy - { - public: - nocopy(int i): i(i) {} - nocopy() = default; - nocopy(const nocopy&) = delete; - nocopy & operator=(const nocopy&) = delete; - private: - int i; - }; - - // for testing lambda expressions - template Ret eval(Fn f, Ret v) - { - return f(v); - } - - // for testing variadic templates and trailing return types - template auto sum(V first) -> V - { - return first; - } - template auto sum(V first, Args... rest) -> V - { - return first + sum(rest...); - } -} -' - -# Test code for whether the C++ compiler supports C++11 (body of main) -ac_cxx_conftest_cxx11_main=' -{ - // Test auto and decltype - auto a1 = 6538; - auto a2 = 48573953.4; - auto a3 = "String literal"; - - int total = 0; - for (auto i = a3; *i; ++i) { total += *i; } - - decltype(a2) a4 = 34895.034; -} -{ - // Test constexpr - short sa[cxx11test::get_val()] = { 0 }; -} -{ - // Test initializer lists - cxx11test::testinit il = { 4323, 435234.23544 }; -} -{ - // Test range-based for - int array[] = {9, 7, 13, 15, 4, 18, 12, 10, 5, 3, - 14, 19, 17, 8, 6, 20, 16, 2, 11, 1}; - for (auto &x : array) { x += 23; } -} -{ - // Test lambda expressions - using cxx11test::eval; - assert (eval ([](int x) { return x*2; }, 21) == 42); - double d = 2.0; - assert (eval ([&](double x) { return d += x; }, 3.0) == 5.0); - assert (d == 5.0); - assert (eval ([=](double x) mutable { return d += x; }, 4.0) == 9.0); - assert (d == 5.0); -} -{ - // Test use of variadic templates - using cxx11test::sum; - auto a = sum(1); - auto b = sum(1, 2); - auto c = sum(1.0, 2.0, 3.0); -} -{ - // Test constructor delegation - cxx11test::delegate d1; - cxx11test::delegate d2(); - cxx11test::delegate d3(45); -} -{ - // Test override and final - cxx11test::overridden o1(55464); -} -{ - // Test nullptr - char *c = nullptr; -} -{ - // Test template brackets - test_template<::test_template> v(test_template(12)); -} -{ - // Unicode literals - char const *utf8 = u8"UTF-8 string \u2500"; - char16_t const *utf16 = u"UTF-8 string \u2500"; - char32_t const *utf32 = U"UTF-32 string \u2500"; -} -' - -# Test code for whether the C compiler supports C++11 (complete). -ac_cxx_conftest_cxx11_program="${ac_cxx_conftest_cxx98_globals} -${ac_cxx_conftest_cxx11_globals} +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu -int -main (int argc, char **argv) -{ - int ok = 0; - ${ac_cxx_conftest_cxx98_main} - ${ac_cxx_conftest_cxx11_main} - return ok; -} -" -# Test code for whether the C compiler supports C++98 (complete). -ac_cxx_conftest_cxx98_program="${ac_cxx_conftest_cxx98_globals} -int -main (int argc, char **argv) -{ - int ok = 0; - ${ac_cxx_conftest_cxx98_main} - return ok; -} -" -as_fn_append ac_header_c_list " stdio.h stdio_h HAVE_STDIO_H" -as_fn_append ac_header_c_list " stdlib.h stdlib_h HAVE_STDLIB_H" -as_fn_append ac_header_c_list " string.h string_h HAVE_STRING_H" -as_fn_append ac_header_c_list " inttypes.h inttypes_h HAVE_INTTYPES_H" -as_fn_append ac_header_c_list " stdint.h stdint_h HAVE_STDINT_H" -as_fn_append ac_header_c_list " strings.h strings_h HAVE_STRINGS_H" -as_fn_append ac_header_c_list " sys/stat.h sys_stat_h HAVE_SYS_STAT_H" -as_fn_append ac_header_c_list " sys/types.h sys_types_h HAVE_SYS_TYPES_H" -as_fn_append ac_header_c_list " unistd.h unistd_h HAVE_UNISTD_H" - -# Auxiliary files required by this configure script. -ac_aux_files="compile missing install-sh config.guess config.sub" - -# Locations in which to look for auxiliary files. -ac_aux_dir_candidates="${srcdir}${PATH_SEPARATOR}${srcdir}/..${PATH_SEPARATOR}${srcdir}/../.." - -# Search for a directory containing all of the required auxiliary files, -# $ac_aux_files, from the $PATH-style list $ac_aux_dir_candidates. -# If we don't find one directory that contains all the files we need, -# we report the set of missing files from the *first* directory in -# $ac_aux_dir_candidates and give up. -ac_missing_aux_files="" -ac_first_candidate=: -printf "%s\n" "$as_me:${as_lineno-$LINENO}: looking for aux files: $ac_aux_files" >&5 -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -as_found=false -for as_dir in $ac_aux_dir_candidates -do - IFS=$as_save_IFS - case $as_dir in #((( - '') as_dir=./ ;; - */) ;; - *) as_dir=$as_dir/ ;; - esac - as_found=: - printf "%s\n" "$as_me:${as_lineno-$LINENO}: trying $as_dir" >&5 - ac_aux_dir_found=yes - ac_install_sh= - for ac_aux in $ac_aux_files - do - # As a special case, if "install-sh" is required, that requirement - # can be satisfied by any of "install-sh", "install.sh", or "shtool", - # and $ac_install_sh is set appropriately for whichever one is found. - if test x"$ac_aux" = x"install-sh" - then - if test -f "${as_dir}install-sh"; then - printf "%s\n" "$as_me:${as_lineno-$LINENO}: ${as_dir}install-sh found" >&5 - ac_install_sh="${as_dir}install-sh -c" - elif test -f "${as_dir}install.sh"; then - printf "%s\n" "$as_me:${as_lineno-$LINENO}: ${as_dir}install.sh found" >&5 - ac_install_sh="${as_dir}install.sh -c" - elif test -f "${as_dir}shtool"; then - printf "%s\n" "$as_me:${as_lineno-$LINENO}: ${as_dir}shtool found" >&5 - ac_install_sh="${as_dir}shtool install -c" - else - ac_aux_dir_found=no - if $ac_first_candidate; then - ac_missing_aux_files="${ac_missing_aux_files} install-sh" - else - break - fi - fi - else - if test -f "${as_dir}${ac_aux}"; then - printf "%s\n" "$as_me:${as_lineno-$LINENO}: ${as_dir}${ac_aux} found" >&5 - else - ac_aux_dir_found=no - if $ac_first_candidate; then - ac_missing_aux_files="${ac_missing_aux_files} ${ac_aux}" - else - break - fi - fi - fi - done - if test "$ac_aux_dir_found" = yes; then - ac_aux_dir="$as_dir" +ac_aux_dir= +for ac_dir in "$srcdir" "$srcdir/.." "$srcdir/../.."; do + if test -f "$ac_dir/install-sh"; then + ac_aux_dir=$ac_dir + ac_install_sh="$ac_aux_dir/install-sh -c" + break + elif test -f "$ac_dir/install.sh"; then + ac_aux_dir=$ac_dir + ac_install_sh="$ac_aux_dir/install.sh -c" + break + elif test -f "$ac_dir/shtool"; then + ac_aux_dir=$ac_dir + ac_install_sh="$ac_aux_dir/shtool install -c" break fi - ac_first_candidate=false - - as_found=false done -IFS=$as_save_IFS -if $as_found -then : - -else $as_nop - as_fn_error $? "cannot find required auxiliary files:$ac_missing_aux_files" "$LINENO" 5 +if test -z "$ac_aux_dir"; then + as_fn_error $? "cannot find install-sh, install.sh, or shtool in \"$srcdir\" \"$srcdir/..\" \"$srcdir/../..\"" "$LINENO" 5 fi - # These three variables are undocumented and unsupported, # and are intended to be withdrawn in a future Autoconf release. # They can cause serious problems if a builder's source tree is in a directory # whose full name contains unusual characters. -if test -f "${ac_aux_dir}config.guess"; then - ac_config_guess="$SHELL ${ac_aux_dir}config.guess" -fi -if test -f "${ac_aux_dir}config.sub"; then - ac_config_sub="$SHELL ${ac_aux_dir}config.sub" -fi -if test -f "$ac_aux_dir/configure"; then - ac_configure="$SHELL ${ac_aux_dir}configure" -fi - -# Check that the precious variables saved in the cache have kept the same -# value. -ac_cache_corrupted=false -for ac_var in $ac_precious_vars; do - eval ac_old_set=\$ac_cv_env_${ac_var}_set - eval ac_new_set=\$ac_env_${ac_var}_set - eval ac_old_val=\$ac_cv_env_${ac_var}_value - eval ac_new_val=\$ac_env_${ac_var}_value - case $ac_old_set,$ac_new_set in - set,) - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5 -printf "%s\n" "$as_me: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2;} - ac_cache_corrupted=: ;; - ,set) - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was not set in the previous run" >&5 -printf "%s\n" "$as_me: error: \`$ac_var' was not set in the previous run" >&2;} - ac_cache_corrupted=: ;; - ,);; - *) - if test "x$ac_old_val" != "x$ac_new_val"; then - # differences in whitespace do not lead to failure. - ac_old_val_w=`echo x $ac_old_val` - ac_new_val_w=`echo x $ac_new_val` - if test "$ac_old_val_w" != "$ac_new_val_w"; then - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' has changed since the previous run:" >&5 -printf "%s\n" "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;} - ac_cache_corrupted=: - else - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&5 -printf "%s\n" "$as_me: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&2;} - eval $ac_var=\$ac_old_val - fi - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: former value: \`$ac_old_val'" >&5 -printf "%s\n" "$as_me: former value: \`$ac_old_val'" >&2;} - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: current value: \`$ac_new_val'" >&5 -printf "%s\n" "$as_me: current value: \`$ac_new_val'" >&2;} - fi;; - esac - # Pass precious variables to config.status. - if test "$ac_new_set" = set; then - case $ac_new_val in - *\'*) ac_arg=$ac_var=`printf "%s\n" "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"` ;; - *) ac_arg=$ac_var=$ac_new_val ;; - esac - case " $ac_configure_args " in - *" '$ac_arg' "*) ;; # Avoid dups. Use of quotes ensures accuracy. - *) as_fn_append ac_configure_args " '$ac_arg'" ;; - esac - fi -done -if $ac_cache_corrupted; then - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -printf "%s\n" "$as_me: error: in \`$ac_pwd':" >&2;} - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: changes in the environment can compromise the build" >&5 -printf "%s\n" "$as_me: error: changes in the environment can compromise the build" >&2;} - as_fn_error $? "run \`${MAKE-make} distclean' and/or \`rm $cache_file' - and start over" "$LINENO" 5 -fi -## -------------------- ## -## Main body of script. ## -## -------------------- ## - -ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu - - - +ac_config_guess="$SHELL $ac_aux_dir/config.guess" # Please don't use this var. +ac_config_sub="$SHELL $ac_aux_dir/config.sub" # Please don't use this var. +ac_configure="$SHELL $ac_aux_dir/configure" # Please don't use this var. +# Make sure we can run config.sub. +$SHELL "$ac_aux_dir/config.sub" sun4 >/dev/null 2>&1 || + as_fn_error $? "cannot run $SHELL $ac_aux_dir/config.sub" "$LINENO" 5 - - # Make sure we can run config.sub. -$SHELL "${ac_aux_dir}config.sub" sun4 >/dev/null 2>&1 || - as_fn_error $? "cannot run $SHELL ${ac_aux_dir}config.sub" "$LINENO" 5 - -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking build system type" >&5 -printf %s "checking build system type... " >&6; } -if test ${ac_cv_build+y} -then : - printf %s "(cached) " >&6 -else $as_nop +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking build system type" >&5 +$as_echo_n "checking build system type... " >&6; } +if ${ac_cv_build+:} false; then : + $as_echo_n "(cached) " >&6 +else ac_build_alias=$build_alias test "x$ac_build_alias" = x && - ac_build_alias=`$SHELL "${ac_aux_dir}config.guess"` + ac_build_alias=`$SHELL "$ac_aux_dir/config.guess"` test "x$ac_build_alias" = x && as_fn_error $? "cannot guess build type; you must specify one" "$LINENO" 5 -ac_cv_build=`$SHELL "${ac_aux_dir}config.sub" $ac_build_alias` || - as_fn_error $? "$SHELL ${ac_aux_dir}config.sub $ac_build_alias failed" "$LINENO" 5 +ac_cv_build=`$SHELL "$ac_aux_dir/config.sub" $ac_build_alias` || + as_fn_error $? "$SHELL $ac_aux_dir/config.sub $ac_build_alias failed" "$LINENO" 5 fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_build" >&5 -printf "%s\n" "$ac_cv_build" >&6; } +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_build" >&5 +$as_echo "$ac_cv_build" >&6; } case $ac_cv_build in *-*-*) ;; *) as_fn_error $? "invalid value of canonical build" "$LINENO" 5;; @@ -3000,22 +2429,21 @@ IFS=$ac_save_IFS case $build_os in *\ *) build_os=`echo "$build_os" | sed 's/ /-/g'`;; esac -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking host system type" >&5 -printf %s "checking host system type... " >&6; } -if test ${ac_cv_host+y} -then : - printf %s "(cached) " >&6 -else $as_nop +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking host system type" >&5 +$as_echo_n "checking host system type... " >&6; } +if ${ac_cv_host+:} false; then : + $as_echo_n "(cached) " >&6 +else if test "x$host_alias" = x; then ac_cv_host=$ac_cv_build else - ac_cv_host=`$SHELL "${ac_aux_dir}config.sub" $host_alias` || - as_fn_error $? "$SHELL ${ac_aux_dir}config.sub $host_alias failed" "$LINENO" 5 + ac_cv_host=`$SHELL "$ac_aux_dir/config.sub" $host_alias` || + as_fn_error $? "$SHELL $ac_aux_dir/config.sub $host_alias failed" "$LINENO" 5 fi fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_host" >&5 -printf "%s\n" "$ac_cv_host" >&6; } +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_host" >&5 +$as_echo "$ac_cv_host" >&6; } case $ac_cv_host in *-*-*) ;; *) as_fn_error $? "invalid value of canonical host" "$LINENO" 5;; @@ -3034,22 +2462,21 @@ IFS=$ac_save_IFS case $host_os in *\ *) host_os=`echo "$host_os" | sed 's/ /-/g'`;; esac -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking target system type" >&5 -printf %s "checking target system type... " >&6; } -if test ${ac_cv_target+y} -then : - printf %s "(cached) " >&6 -else $as_nop +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking target system type" >&5 +$as_echo_n "checking target system type... " >&6; } +if ${ac_cv_target+:} false; then : + $as_echo_n "(cached) " >&6 +else if test "x$target_alias" = x; then ac_cv_target=$ac_cv_host else - ac_cv_target=`$SHELL "${ac_aux_dir}config.sub" $target_alias` || - as_fn_error $? "$SHELL ${ac_aux_dir}config.sub $target_alias failed" "$LINENO" 5 + ac_cv_target=`$SHELL "$ac_aux_dir/config.sub" $target_alias` || + as_fn_error $? "$SHELL $ac_aux_dir/config.sub $target_alias failed" "$LINENO" 5 fi fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_target" >&5 -printf "%s\n" "$ac_cv_target" >&6; } +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_target" >&5 +$as_echo "$ac_cv_target" >&6; } case $ac_cv_target in *-*-*) ;; *) as_fn_error $? "invalid value of canonical target" "$LINENO" 5;; @@ -3082,8 +2509,7 @@ ac_config_headers="$ac_config_headers cpuminer-config.h" am__api_version='1.16' - - # Find a good install program. We prefer a C program (faster), +# Find a good install program. We prefer a C program (faster), # so one script is as good as another. But avoid the broken or # incompatible versions: # SysV /etc/install, /usr/sbin/install @@ -3097,25 +2523,20 @@ am__api_version='1.16' # OS/2's system install, which has a completely different semantic # ./install, which can be erroneously created by make from ./install.sh. # Reject install programs that cannot install multiple files. -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for a BSD-compatible install" >&5 -printf %s "checking for a BSD-compatible install... " >&6; } +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for a BSD-compatible install" >&5 +$as_echo_n "checking for a BSD-compatible install... " >&6; } if test -z "$INSTALL"; then -if test ${ac_cv_path_install+y} -then : - printf %s "(cached) " >&6 -else $as_nop +if ${ac_cv_path_install+:} false; then : + $as_echo_n "(cached) " >&6 +else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS - case $as_dir in #((( - '') as_dir=./ ;; - */) ;; - *) as_dir=$as_dir/ ;; - esac - # Account for fact that we put trailing slashes in our PATH walk. -case $as_dir in #(( - ./ | /[cC]/* | \ + test -z "$as_dir" && as_dir=. + # Account for people who put trailing slashes in PATH elements. +case $as_dir/ in #(( + ./ | .// | /[cC]/* | \ /etc/* | /usr/sbin/* | /usr/etc/* | /sbin/* | /usr/afsws/bin/* | \ ?:[\\/]os2[\\/]install[\\/]* | ?:[\\/]OS2[\\/]INSTALL[\\/]* | \ /usr/ucb/* ) ;; @@ -3125,13 +2546,13 @@ case $as_dir in #(( # by default. for ac_prog in ginstall scoinst install; do for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir$ac_prog$ac_exec_ext"; then + if as_fn_executable_p "$as_dir/$ac_prog$ac_exec_ext"; then if test $ac_prog = install && - grep dspmsg "$as_dir$ac_prog$ac_exec_ext" >/dev/null 2>&1; then + grep dspmsg "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then # AIX install. It has an incompatible calling convention. : elif test $ac_prog = install && - grep pwplus "$as_dir$ac_prog$ac_exec_ext" >/dev/null 2>&1; then + grep pwplus "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then # program-specific install script used by HP pwplus--don't use. : else @@ -3139,12 +2560,12 @@ case $as_dir in #(( echo one > conftest.one echo two > conftest.two mkdir conftest.dir - if "$as_dir$ac_prog$ac_exec_ext" -c conftest.one conftest.two "`pwd`/conftest.dir/" && + if "$as_dir/$ac_prog$ac_exec_ext" -c conftest.one conftest.two "`pwd`/conftest.dir" && test -s conftest.one && test -s conftest.two && test -s conftest.dir/conftest.one && test -s conftest.dir/conftest.two then - ac_cv_path_install="$as_dir$ac_prog$ac_exec_ext -c" + ac_cv_path_install="$as_dir/$ac_prog$ac_exec_ext -c" break 3 fi fi @@ -3160,7 +2581,7 @@ IFS=$as_save_IFS rm -rf conftest.one conftest.two conftest.dir fi - if test ${ac_cv_path_install+y}; then + if test "${ac_cv_path_install+set}" = set; then INSTALL=$ac_cv_path_install else # As a last resort, use the slow shell script. Don't cache a @@ -3170,8 +2591,8 @@ fi INSTALL=$ac_install_sh fi fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $INSTALL" >&5 -printf "%s\n" "$INSTALL" >&6; } +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $INSTALL" >&5 +$as_echo "$INSTALL" >&6; } # Use test -z because SunOS4 sh mishandles braces in ${var-val}. # It thinks the first close brace ends the variable substitution. @@ -3181,8 +2602,8 @@ test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL}' test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether build environment is sane" >&5 -printf %s "checking whether build environment is sane... " >&6; } +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether build environment is sane" >&5 +$as_echo_n "checking whether build environment is sane... " >&6; } # Reject unsafe characters in $srcdir or the absolute working directory # name. Accept space and tab only in the latter. am_lf=' @@ -3236,8 +2657,8 @@ else as_fn_error $? "newly created file is older than distributed files! Check your system clock" "$LINENO" 5 fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -printf "%s\n" "yes" >&6; } +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } # If we didn't sleep, we still need to ensure time stamps of config.status and # generated files are strictly newer. am_sleep_pid= @@ -3256,23 +2677,26 @@ test "$program_suffix" != NONE && # Double any \ or $. # By default was `s,x,x', remove it if useless. ac_script='s/[\\$]/&&/g;s/;s,x,x,$//' -program_transform_name=`printf "%s\n" "$program_transform_name" | sed "$ac_script"` - +program_transform_name=`$as_echo "$program_transform_name" | sed "$ac_script"` # Expand $ac_aux_dir to an absolute path. am_aux_dir=`cd "$ac_aux_dir" && pwd` - - if test x"${MISSING+set}" != xset; then - MISSING="\${SHELL} '$am_aux_dir/missing'" +if test x"${MISSING+set}" != xset; then + case $am_aux_dir in + *\ * | *\ *) + MISSING="\${SHELL} \"$am_aux_dir/missing\"" ;; + *) + MISSING="\${SHELL} $am_aux_dir/missing" ;; + esac fi # Use eval to expand $SHELL if eval "$MISSING --is-lightweight"; then am_missing_run="$MISSING " else am_missing_run= - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: 'missing' script is too old or missing" >&5 -printf "%s\n" "$as_me: WARNING: 'missing' script is too old or missing" >&2;} + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: 'missing' script is too old or missing" >&5 +$as_echo "$as_me: WARNING: 'missing' script is too old or missing" >&2;} fi if test x"${install_sh+set}" != xset; then @@ -3292,12 +2716,11 @@ if test "$cross_compiling" != no; then if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}strip", so it can be a program name with args. set dummy ${ac_tool_prefix}strip; ac_word=$2 -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -printf %s "checking for $ac_word... " >&6; } -if test ${ac_cv_prog_STRIP+y} -then : - printf %s "(cached) " >&6 -else $as_nop +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_STRIP+:} false; then : + $as_echo_n "(cached) " >&6 +else if test -n "$STRIP"; then ac_cv_prog_STRIP="$STRIP" # Let the user override the test. else @@ -3305,15 +2728,11 @@ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS - case $as_dir in #((( - '') as_dir=./ ;; - */) ;; - *) as_dir=$as_dir/ ;; - esac + test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_STRIP="${ac_tool_prefix}strip" - printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done @@ -3324,11 +2743,11 @@ fi fi STRIP=$ac_cv_prog_STRIP if test -n "$STRIP"; then - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $STRIP" >&5 -printf "%s\n" "$STRIP" >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $STRIP" >&5 +$as_echo "$STRIP" >&6; } else - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 -printf "%s\n" "no" >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } fi @@ -3337,12 +2756,11 @@ if test -z "$ac_cv_prog_STRIP"; then ac_ct_STRIP=$STRIP # Extract the first word of "strip", so it can be a program name with args. set dummy strip; ac_word=$2 -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -printf %s "checking for $ac_word... " >&6; } -if test ${ac_cv_prog_ac_ct_STRIP+y} -then : - printf %s "(cached) " >&6 -else $as_nop +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_ac_ct_STRIP+:} false; then : + $as_echo_n "(cached) " >&6 +else if test -n "$ac_ct_STRIP"; then ac_cv_prog_ac_ct_STRIP="$ac_ct_STRIP" # Let the user override the test. else @@ -3350,15 +2768,11 @@ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS - case $as_dir in #((( - '') as_dir=./ ;; - */) ;; - *) as_dir=$as_dir/ ;; - esac + test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_STRIP="strip" - printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done @@ -3369,11 +2783,11 @@ fi fi ac_ct_STRIP=$ac_cv_prog_ac_ct_STRIP if test -n "$ac_ct_STRIP"; then - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_STRIP" >&5 -printf "%s\n" "$ac_ct_STRIP" >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_STRIP" >&5 +$as_echo "$ac_ct_STRIP" >&6; } else - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 -printf "%s\n" "no" >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } fi if test "x$ac_ct_STRIP" = x; then @@ -3381,8 +2795,8 @@ fi else case $cross_compiling:$ac_tool_warned in yes:) -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 -printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac STRIP=$ac_ct_STRIP @@ -3394,31 +2808,25 @@ fi fi INSTALL_STRIP_PROGRAM="\$(install_sh) -c -s" - - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for a race-free mkdir -p" >&5 -printf %s "checking for a race-free mkdir -p... " >&6; } +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for a thread-safe mkdir -p" >&5 +$as_echo_n "checking for a thread-safe mkdir -p... " >&6; } if test -z "$MKDIR_P"; then - if test ${ac_cv_path_mkdir+y} -then : - printf %s "(cached) " >&6 -else $as_nop + if ${ac_cv_path_mkdir+:} false; then : + $as_echo_n "(cached) " >&6 +else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH$PATH_SEPARATOR/opt/sfw/bin do IFS=$as_save_IFS - case $as_dir in #((( - '') as_dir=./ ;; - */) ;; - *) as_dir=$as_dir/ ;; - esac + test -z "$as_dir" && as_dir=. for ac_prog in mkdir gmkdir; do for ac_exec_ext in '' $ac_executable_extensions; do - as_fn_executable_p "$as_dir$ac_prog$ac_exec_ext" || continue - case `"$as_dir$ac_prog$ac_exec_ext" --version 2>&1` in #( - 'mkdir ('*'coreutils) '* | \ - 'BusyBox '* | \ + as_fn_executable_p "$as_dir/$ac_prog$ac_exec_ext" || continue + case `"$as_dir/$ac_prog$ac_exec_ext" --version 2>&1` in #( + 'mkdir (GNU coreutils) '* | \ + 'mkdir (coreutils) '* | \ 'mkdir (fileutils) '4.1*) - ac_cv_path_mkdir=$as_dir$ac_prog$ac_exec_ext + ac_cv_path_mkdir=$as_dir/$ac_prog$ac_exec_ext break 3;; esac done @@ -3429,7 +2837,7 @@ IFS=$as_save_IFS fi test -d ./--version && rmdir ./--version - if test ${ac_cv_path_mkdir+y}; then + if test "${ac_cv_path_mkdir+set}" = set; then MKDIR_P="$ac_cv_path_mkdir -p" else # As a last resort, use the slow shell script. Don't cache a @@ -3439,19 +2847,18 @@ fi MKDIR_P="$ac_install_sh -d" fi fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $MKDIR_P" >&5 -printf "%s\n" "$MKDIR_P" >&6; } +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $MKDIR_P" >&5 +$as_echo "$MKDIR_P" >&6; } for ac_prog in gawk mawk nawk awk do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -printf %s "checking for $ac_word... " >&6; } -if test ${ac_cv_prog_AWK+y} -then : - printf %s "(cached) " >&6 -else $as_nop +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_AWK+:} false; then : + $as_echo_n "(cached) " >&6 +else if test -n "$AWK"; then ac_cv_prog_AWK="$AWK" # Let the user override the test. else @@ -3459,15 +2866,11 @@ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS - case $as_dir in #((( - '') as_dir=./ ;; - */) ;; - *) as_dir=$as_dir/ ;; - esac + test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_AWK="$ac_prog" - printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done @@ -3478,25 +2881,24 @@ fi fi AWK=$ac_cv_prog_AWK if test -n "$AWK"; then - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $AWK" >&5 -printf "%s\n" "$AWK" >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $AWK" >&5 +$as_echo "$AWK" >&6; } else - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 -printf "%s\n" "no" >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } fi test -n "$AWK" && break done -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether ${MAKE-make} sets \$(MAKE)" >&5 -printf %s "checking whether ${MAKE-make} sets \$(MAKE)... " >&6; } +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ${MAKE-make} sets \$(MAKE)" >&5 +$as_echo_n "checking whether ${MAKE-make} sets \$(MAKE)... " >&6; } set x ${MAKE-make} -ac_make=`printf "%s\n" "$2" | sed 's/+/p/g; s/[^a-zA-Z0-9_]/_/g'` -if eval test \${ac_cv_prog_make_${ac_make}_set+y} -then : - printf %s "(cached) " >&6 -else $as_nop +ac_make=`$as_echo "$2" | sed 's/+/p/g; s/[^a-zA-Z0-9_]/_/g'` +if eval \${ac_cv_prog_make_${ac_make}_set+:} false; then : + $as_echo_n "(cached) " >&6 +else cat >conftest.make <<\_ACEOF SHELL = /bin/sh all: @@ -3512,12 +2914,12 @@ esac rm -f conftest.make fi if eval test \$ac_cv_prog_make_${ac_make}_set = yes; then - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -printf "%s\n" "yes" >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } SET_MAKE= else - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 -printf "%s\n" "no" >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } SET_MAKE="MAKE=${MAKE-make}" fi @@ -3531,8 +2933,7 @@ fi rmdir .tst 2>/dev/null # Check whether --enable-silent-rules was given. -if test ${enable_silent_rules+y} -then : +if test "${enable_silent_rules+set}" = set; then : enableval=$enable_silent_rules; fi @@ -3542,13 +2943,12 @@ case $enable_silent_rules in # ((( *) AM_DEFAULT_VERBOSITY=1;; esac am_make=${MAKE-make} -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether $am_make supports nested variables" >&5 -printf %s "checking whether $am_make supports nested variables... " >&6; } -if test ${am_cv_make_support_nested_variables+y} -then : - printf %s "(cached) " >&6 -else $as_nop - if printf "%s\n" 'TRUE=$(BAR$(V)) +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $am_make supports nested variables" >&5 +$as_echo_n "checking whether $am_make supports nested variables... " >&6; } +if ${am_cv_make_support_nested_variables+:} false; then : + $as_echo_n "(cached) " >&6 +else + if $as_echo 'TRUE=$(BAR$(V)) BAR0=false BAR1=true V=1 @@ -3560,8 +2960,8 @@ else am_cv_make_support_nested_variables=no fi fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $am_cv_make_support_nested_variables" >&5 -printf "%s\n" "$am_cv_make_support_nested_variables" >&6; } +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_make_support_nested_variables" >&5 +$as_echo "$am_cv_make_support_nested_variables" >&6; } if test $am_cv_make_support_nested_variables = yes; then AM_V='$(V)' AM_DEFAULT_V='$(AM_DEFAULT_VERBOSITY)' @@ -3593,13 +2993,17 @@ fi # Define the identity of the package. PACKAGE='cpuminer-opt' - VERSION='23.5' + VERSION='23.7' -printf "%s\n" "#define PACKAGE \"$PACKAGE\"" >>confdefs.h +cat >>confdefs.h <<_ACEOF +#define PACKAGE "$PACKAGE" +_ACEOF -printf "%s\n" "#define VERSION \"$VERSION\"" >>confdefs.h +cat >>confdefs.h <<_ACEOF +#define VERSION "$VERSION" +_ACEOF # Some tools Automake needs. @@ -3639,20 +3043,6 @@ am__tar='$${TAR-tar} chof - "$$tardir"' am__untar='$${TAR-tar} xf -' -# Variables for tags utilities; see am/tags.am -if test -z "$CTAGS"; then - CTAGS=ctags -fi - -if test -z "$ETAGS"; then - ETAGS=etags -fi - -if test -z "$CSCOPE"; then - CSCOPE=cscope -fi - - # POSIX will say in a future version that running "rm -f" with no argument # is OK; and we want to be able to make that assumption in our Makefile @@ -3698,18 +3088,17 @@ fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether to enable maintainer-specific portions of Makefiles" >&5 -printf %s "checking whether to enable maintainer-specific portions of Makefiles... " >&6; } +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to enable maintainer-specific portions of Makefiles" >&5 +$as_echo_n "checking whether to enable maintainer-specific portions of Makefiles... " >&6; } # Check whether --enable-maintainer-mode was given. -if test ${enable_maintainer_mode+y} -then : +if test "${enable_maintainer_mode+set}" = set; then : enableval=$enable_maintainer_mode; USE_MAINTAINER_MODE=$enableval -else $as_nop +else USE_MAINTAINER_MODE=no fi - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $USE_MAINTAINER_MODE" >&5 -printf "%s\n" "$USE_MAINTAINER_MODE" >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $USE_MAINTAINER_MODE" >&5 +$as_echo "$USE_MAINTAINER_MODE" >&6; } if test $USE_MAINTAINER_MODE = yes; then MAINTAINER_MODE_TRUE= MAINTAINER_MODE_FALSE='#' @@ -3722,21 +3111,12 @@ fi - - - - - - - - - DEPDIR="${am__leading_dot}deps" ac_config_commands="$ac_config_commands depfiles" -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether ${MAKE-make} supports the include directive" >&5 -printf %s "checking whether ${MAKE-make} supports the include directive... " >&6; } +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ${MAKE-make} supports the include directive" >&5 +$as_echo_n "checking whether ${MAKE-make} supports the include directive... " >&6; } cat > confinc.mk << 'END' am__doit: @echo this is the am__doit target >confinc.out @@ -3772,12 +3152,11 @@ esac fi done rm -f confinc.* confmf.* -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: ${_am_result}" >&5 -printf "%s\n" "${_am_result}" >&6; } +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: ${_am_result}" >&5 +$as_echo "${_am_result}" >&6; } # Check whether --enable-dependency-tracking was given. -if test ${enable_dependency_tracking+y} -then : +if test "${enable_dependency_tracking+set}" = set; then : enableval=$enable_dependency_tracking; fi @@ -3803,12 +3182,11 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args. set dummy ${ac_tool_prefix}gcc; ac_word=$2 -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -printf %s "checking for $ac_word... " >&6; } -if test ${ac_cv_prog_CC+y} -then : - printf %s "(cached) " >&6 -else $as_nop +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_CC+:} false; then : + $as_echo_n "(cached) " >&6 +else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else @@ -3816,15 +3194,11 @@ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS - case $as_dir in #((( - '') as_dir=./ ;; - */) ;; - *) as_dir=$as_dir/ ;; - esac + test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_CC="${ac_tool_prefix}gcc" - printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done @@ -3835,11 +3209,11 @@ fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 -printf "%s\n" "$CC" >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 +$as_echo "$CC" >&6; } else - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 -printf "%s\n" "no" >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } fi @@ -3848,12 +3222,11 @@ if test -z "$ac_cv_prog_CC"; then ac_ct_CC=$CC # Extract the first word of "gcc", so it can be a program name with args. set dummy gcc; ac_word=$2 -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -printf %s "checking for $ac_word... " >&6; } -if test ${ac_cv_prog_ac_ct_CC+y} -then : - printf %s "(cached) " >&6 -else $as_nop +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_ac_ct_CC+:} false; then : + $as_echo_n "(cached) " >&6 +else if test -n "$ac_ct_CC"; then ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. else @@ -3861,15 +3234,11 @@ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS - case $as_dir in #((( - '') as_dir=./ ;; - */) ;; - *) as_dir=$as_dir/ ;; - esac + test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_CC="gcc" - printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done @@ -3880,11 +3249,11 @@ fi fi ac_ct_CC=$ac_cv_prog_ac_ct_CC if test -n "$ac_ct_CC"; then - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 -printf "%s\n" "$ac_ct_CC" >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 +$as_echo "$ac_ct_CC" >&6; } else - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 -printf "%s\n" "no" >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } fi if test "x$ac_ct_CC" = x; then @@ -3892,8 +3261,8 @@ fi else case $cross_compiling:$ac_tool_warned in yes:) -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 -printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac CC=$ac_ct_CC @@ -3906,12 +3275,11 @@ if test -z "$CC"; then if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args. set dummy ${ac_tool_prefix}cc; ac_word=$2 -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -printf %s "checking for $ac_word... " >&6; } -if test ${ac_cv_prog_CC+y} -then : - printf %s "(cached) " >&6 -else $as_nop +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_CC+:} false; then : + $as_echo_n "(cached) " >&6 +else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else @@ -3919,15 +3287,11 @@ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS - case $as_dir in #((( - '') as_dir=./ ;; - */) ;; - *) as_dir=$as_dir/ ;; - esac + test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_CC="${ac_tool_prefix}cc" - printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done @@ -3938,11 +3302,11 @@ fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 -printf "%s\n" "$CC" >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 +$as_echo "$CC" >&6; } else - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 -printf "%s\n" "no" >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } fi @@ -3951,12 +3315,11 @@ fi if test -z "$CC"; then # Extract the first word of "cc", so it can be a program name with args. set dummy cc; ac_word=$2 -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -printf %s "checking for $ac_word... " >&6; } -if test ${ac_cv_prog_CC+y} -then : - printf %s "(cached) " >&6 -else $as_nop +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_CC+:} false; then : + $as_echo_n "(cached) " >&6 +else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else @@ -3965,19 +3328,15 @@ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS - case $as_dir in #((( - '') as_dir=./ ;; - */) ;; - *) as_dir=$as_dir/ ;; - esac + test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then - if test "$as_dir$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then ac_prog_rejected=yes continue fi ac_cv_prog_CC="cc" - printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done @@ -3993,18 +3352,18 @@ if test $ac_prog_rejected = yes; then # However, it has the same basename, so the bogon will be chosen # first if we set CC to just the basename; use the full file name. shift - ac_cv_prog_CC="$as_dir$ac_word${1+' '}$@" + ac_cv_prog_CC="$as_dir/$ac_word${1+' '}$@" fi fi fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 -printf "%s\n" "$CC" >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 +$as_echo "$CC" >&6; } else - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 -printf "%s\n" "no" >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } fi @@ -4015,12 +3374,11 @@ if test -z "$CC"; then do # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. set dummy $ac_tool_prefix$ac_prog; ac_word=$2 -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -printf %s "checking for $ac_word... " >&6; } -if test ${ac_cv_prog_CC+y} -then : - printf %s "(cached) " >&6 -else $as_nop +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_CC+:} false; then : + $as_echo_n "(cached) " >&6 +else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else @@ -4028,15 +3386,11 @@ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS - case $as_dir in #((( - '') as_dir=./ ;; - */) ;; - *) as_dir=$as_dir/ ;; - esac + test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_CC="$ac_tool_prefix$ac_prog" - printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done @@ -4047,11 +3401,11 @@ fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 -printf "%s\n" "$CC" >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 +$as_echo "$CC" >&6; } else - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 -printf "%s\n" "no" >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } fi @@ -4064,12 +3418,11 @@ if test -z "$CC"; then do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -printf %s "checking for $ac_word... " >&6; } -if test ${ac_cv_prog_ac_ct_CC+y} -then : - printf %s "(cached) " >&6 -else $as_nop +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_ac_ct_CC+:} false; then : + $as_echo_n "(cached) " >&6 +else if test -n "$ac_ct_CC"; then ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. else @@ -4077,15 +3430,11 @@ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS - case $as_dir in #((( - '') as_dir=./ ;; - */) ;; - *) as_dir=$as_dir/ ;; - esac + test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_CC="$ac_prog" - printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done @@ -4096,11 +3445,11 @@ fi fi ac_ct_CC=$ac_cv_prog_ac_ct_CC if test -n "$ac_ct_CC"; then - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 -printf "%s\n" "$ac_ct_CC" >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 +$as_echo "$ac_ct_CC" >&6; } else - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 -printf "%s\n" "no" >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } fi @@ -4112,138 +3461,34 @@ done else case $cross_compiling:$ac_tool_warned in yes:) -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 -printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} -ac_tool_warned=yes ;; -esac - CC=$ac_ct_CC - fi -fi - -fi -if test -z "$CC"; then - if test -n "$ac_tool_prefix"; then - # Extract the first word of "${ac_tool_prefix}clang", so it can be a program name with args. -set dummy ${ac_tool_prefix}clang; ac_word=$2 -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -printf %s "checking for $ac_word... " >&6; } -if test ${ac_cv_prog_CC+y} -then : - printf %s "(cached) " >&6 -else $as_nop - if test -n "$CC"; then - ac_cv_prog_CC="$CC" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - case $as_dir in #((( - '') as_dir=./ ;; - */) ;; - *) as_dir=$as_dir/ ;; - esac - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then - ac_cv_prog_CC="${ac_tool_prefix}clang" - printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -CC=$ac_cv_prog_CC -if test -n "$CC"; then - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 -printf "%s\n" "$CC" >&6; } -else - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 -printf "%s\n" "no" >&6; } -fi - - -fi -if test -z "$ac_cv_prog_CC"; then - ac_ct_CC=$CC - # Extract the first word of "clang", so it can be a program name with args. -set dummy clang; ac_word=$2 -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -printf %s "checking for $ac_word... " >&6; } -if test ${ac_cv_prog_ac_ct_CC+y} -then : - printf %s "(cached) " >&6 -else $as_nop - if test -n "$ac_ct_CC"; then - ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - case $as_dir in #((( - '') as_dir=./ ;; - */) ;; - *) as_dir=$as_dir/ ;; - esac - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then - ac_cv_prog_ac_ct_CC="clang" - printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -ac_ct_CC=$ac_cv_prog_ac_ct_CC -if test -n "$ac_ct_CC"; then - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 -printf "%s\n" "$ac_ct_CC" >&6; } -else - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 -printf "%s\n" "no" >&6; } -fi - - if test "x$ac_ct_CC" = x; then - CC="" - else - case $cross_compiling:$ac_tool_warned in -yes:) -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 -printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac CC=$ac_ct_CC fi -else - CC="$ac_cv_prog_CC" fi fi -test -z "$CC" && { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -printf "%s\n" "$as_me: error: in \`$ac_pwd':" >&2;} +test -z "$CC" && { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "no acceptable C compiler found in \$PATH See \`config.log' for more details" "$LINENO" 5; } # Provide some information about the compiler. -printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for C compiler version" >&5 +$as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler version" >&5 set X $ac_compile ac_compiler=$2 -for ac_option in --version -v -V -qversion -version; do +for ac_option in --version -v -V -qversion; do { { ac_try="$ac_compiler $ac_option >&5" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -printf "%s\n" "$ac_try_echo"; } >&5 +$as_echo "$ac_try_echo"; } >&5 (eval "$ac_compiler $ac_option >&5") 2>conftest.err ac_status=$? if test -s conftest.err; then @@ -4253,7 +3498,7 @@ printf "%s\n" "$ac_try_echo"; } >&5 cat conftest.er1 >&5 fi rm -f conftest.er1 conftest.err - printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } done @@ -4261,7 +3506,7 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int -main (void) +main () { ; @@ -4273,9 +3518,9 @@ ac_clean_files="$ac_clean_files a.out a.out.dSYM a.exe b.out" # Try to create an executable without -o first, disregard a.out. # It will help us diagnose broken compilers, and finding out an intuition # of exeext. -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether the C compiler works" >&5 -printf %s "checking whether the C compiler works... " >&6; } -ac_link_default=`printf "%s\n" "$ac_link" | sed 's/ -o *conftest[^ ]*//'` +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the C compiler works" >&5 +$as_echo_n "checking whether the C compiler works... " >&6; } +ac_link_default=`$as_echo "$ac_link" | sed 's/ -o *conftest[^ ]*//'` # The possible output files: ac_files="a.out conftest.exe conftest a.exe a_out.exe b.out conftest.*" @@ -4296,12 +3541,11 @@ case "(($ac_try" in *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -printf "%s\n" "$ac_try_echo"; } >&5 +$as_echo "$ac_try_echo"; } >&5 (eval "$ac_link_default") 2>&5 ac_status=$? - printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; } -then : + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then : # Autoconf-2.13 could set the ac_cv_exeext variable to `no'. # So ignore a value of `no', otherwise this would lead to `EXEEXT = no' # in a Makefile. We should not override ac_cv_exeext if it was cached, @@ -4318,7 +3562,7 @@ do # certainly right. break;; *.* ) - if test ${ac_cv_exeext+y} && test "$ac_cv_exeext" != no; + if test "${ac_cv_exeext+set}" = set && test "$ac_cv_exeext" != no; then :; else ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` fi @@ -4334,46 +3578,44 @@ do done test "$ac_cv_exeext" = no && ac_cv_exeext= -else $as_nop +else ac_file='' fi -if test -z "$ac_file" -then : - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 -printf "%s\n" "no" >&6; } -printf "%s\n" "$as_me: failed program was:" >&5 +if test -z "$ac_file"; then : + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +$as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 -{ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -printf "%s\n" "$as_me: error: in \`$ac_pwd':" >&2;} +{ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error 77 "C compiler cannot create executables See \`config.log' for more details" "$LINENO" 5; } -else $as_nop - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -printf "%s\n" "yes" >&6; } -fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for C compiler default output file name" >&5 -printf %s "checking for C compiler default output file name... " >&6; } -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_file" >&5 -printf "%s\n" "$ac_file" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler default output file name" >&5 +$as_echo_n "checking for C compiler default output file name... " >&6; } +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_file" >&5 +$as_echo "$ac_file" >&6; } ac_exeext=$ac_cv_exeext rm -f -r a.out a.out.dSYM a.exe conftest$ac_cv_exeext b.out ac_clean_files=$ac_clean_files_save -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for suffix of executables" >&5 -printf %s "checking for suffix of executables... " >&6; } +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for suffix of executables" >&5 +$as_echo_n "checking for suffix of executables... " >&6; } if { { ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -printf "%s\n" "$ac_try_echo"; } >&5 +$as_echo "$ac_try_echo"; } >&5 (eval "$ac_link") 2>&5 ac_status=$? - printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; } -then : + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then : # If both `conftest.exe' and `conftest' are `present' (well, observable) # catch `conftest.exe'. For instance with Cygwin, `ls conftest' will # work properly (i.e., refer to `conftest.exe'), while it won't with @@ -4387,15 +3629,15 @@ for ac_file in conftest.exe conftest conftest.*; do * ) break;; esac done -else $as_nop - { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -printf "%s\n" "$as_me: error: in \`$ac_pwd':" >&2;} +else + { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "cannot compute suffix of executables: cannot compile and link See \`config.log' for more details" "$LINENO" 5; } fi rm -f conftest conftest$ac_cv_exeext -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_exeext" >&5 -printf "%s\n" "$ac_cv_exeext" >&6; } +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_exeext" >&5 +$as_echo "$ac_cv_exeext" >&6; } rm -f conftest.$ac_ext EXEEXT=$ac_cv_exeext @@ -4404,7 +3646,7 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include int -main (void) +main () { FILE *f = fopen ("conftest.out", "w"); return ferror (f) || fclose (f) != 0; @@ -4416,8 +3658,8 @@ _ACEOF ac_clean_files="$ac_clean_files conftest.out" # Check that the compiler produces executables we can run. If not, either # the compiler is broken, or we cross compile. -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether we are cross compiling" >&5 -printf %s "checking whether we are cross compiling... " >&6; } +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are cross compiling" >&5 +$as_echo_n "checking whether we are cross compiling... " >&6; } if test "$cross_compiling" != yes; then { { ac_try="$ac_link" case "(($ac_try" in @@ -4425,10 +3667,10 @@ case "(($ac_try" in *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -printf "%s\n" "$ac_try_echo"; } >&5 +$as_echo "$ac_try_echo"; } >&5 (eval "$ac_link") 2>&5 ac_status=$? - printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } if { ac_try='./conftest$ac_cv_exeext' { { case "(($ac_try" in @@ -4436,40 +3678,39 @@ printf "%s\n" "$ac_try_echo"; } >&5 *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -printf "%s\n" "$ac_try_echo"; } >&5 +$as_echo "$ac_try_echo"; } >&5 (eval "$ac_try") 2>&5 ac_status=$? - printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; }; then cross_compiling=no else if test "$cross_compiling" = maybe; then cross_compiling=yes else - { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -printf "%s\n" "$as_me: error: in \`$ac_pwd':" >&2;} -as_fn_error 77 "cannot run C compiled programs. + { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? "cannot run C compiled programs. If you meant to cross compile, use \`--host'. See \`config.log' for more details" "$LINENO" 5; } fi fi fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $cross_compiling" >&5 -printf "%s\n" "$cross_compiling" >&6; } +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $cross_compiling" >&5 +$as_echo "$cross_compiling" >&6; } rm -f conftest.$ac_ext conftest$ac_cv_exeext conftest.out ac_clean_files=$ac_clean_files_save -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for suffix of object files" >&5 -printf %s "checking for suffix of object files... " >&6; } -if test ${ac_cv_objext+y} -then : - printf %s "(cached) " >&6 -else $as_nop +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for suffix of object files" >&5 +$as_echo_n "checking for suffix of object files... " >&6; } +if ${ac_cv_objext+:} false; then : + $as_echo_n "(cached) " >&6 +else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int -main (void) +main () { ; @@ -4483,12 +3724,11 @@ case "(($ac_try" in *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -printf "%s\n" "$ac_try_echo"; } >&5 +$as_echo "$ac_try_echo"; } >&5 (eval "$ac_compile") 2>&5 ac_status=$? - printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; } -then : + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then : for ac_file in conftest.o conftest.obj conftest.*; do test -f "$ac_file" || continue; case $ac_file in @@ -4497,32 +3737,31 @@ then : break;; esac done -else $as_nop - printf "%s\n" "$as_me: failed program was:" >&5 +else + $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 -{ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -printf "%s\n" "$as_me: error: in \`$ac_pwd':" >&2;} +{ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "cannot compute suffix of object files: cannot compile See \`config.log' for more details" "$LINENO" 5; } fi rm -f conftest.$ac_cv_objext conftest.$ac_ext fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_objext" >&5 -printf "%s\n" "$ac_cv_objext" >&6; } +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_objext" >&5 +$as_echo "$ac_cv_objext" >&6; } OBJEXT=$ac_cv_objext ac_objext=$OBJEXT -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether the compiler supports GNU C" >&5 -printf %s "checking whether the compiler supports GNU C... " >&6; } -if test ${ac_cv_c_compiler_gnu+y} -then : - printf %s "(cached) " >&6 -else $as_nop +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are using the GNU C compiler" >&5 +$as_echo_n "checking whether we are using the GNU C compiler... " >&6; } +if ${ac_cv_c_compiler_gnu+:} false; then : + $as_echo_n "(cached) " >&6 +else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int -main (void) +main () { #ifndef __GNUC__ choke me @@ -4532,33 +3771,29 @@ main (void) return 0; } _ACEOF -if ac_fn_c_try_compile "$LINENO" -then : +if ac_fn_c_try_compile "$LINENO"; then : ac_compiler_gnu=yes -else $as_nop +else ac_compiler_gnu=no fi -rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext ac_cv_c_compiler_gnu=$ac_compiler_gnu fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_compiler_gnu" >&5 -printf "%s\n" "$ac_cv_c_compiler_gnu" >&6; } -ac_compiler_gnu=$ac_cv_c_compiler_gnu - +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_compiler_gnu" >&5 +$as_echo "$ac_cv_c_compiler_gnu" >&6; } if test $ac_compiler_gnu = yes; then GCC=yes else GCC= fi -ac_test_CFLAGS=${CFLAGS+y} +ac_test_CFLAGS=${CFLAGS+set} ac_save_CFLAGS=$CFLAGS -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether $CC accepts -g" >&5 -printf %s "checking whether $CC accepts -g... " >&6; } -if test ${ac_cv_prog_cc_g+y} -then : - printf %s "(cached) " >&6 -else $as_nop +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC accepts -g" >&5 +$as_echo_n "checking whether $CC accepts -g... " >&6; } +if ${ac_cv_prog_cc_g+:} false; then : + $as_echo_n "(cached) " >&6 +else ac_save_c_werror_flag=$ac_c_werror_flag ac_c_werror_flag=yes ac_cv_prog_cc_g=no @@ -4567,60 +3802,57 @@ else $as_nop /* end confdefs.h. */ int -main (void) +main () { ; return 0; } _ACEOF -if ac_fn_c_try_compile "$LINENO" -then : +if ac_fn_c_try_compile "$LINENO"; then : ac_cv_prog_cc_g=yes -else $as_nop +else CFLAGS="" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int -main (void) +main () { ; return 0; } _ACEOF -if ac_fn_c_try_compile "$LINENO" -then : +if ac_fn_c_try_compile "$LINENO"; then : -else $as_nop +else ac_c_werror_flag=$ac_save_c_werror_flag CFLAGS="-g" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int -main (void) +main () { ; return 0; } _ACEOF -if ac_fn_c_try_compile "$LINENO" -then : +if ac_fn_c_try_compile "$LINENO"; then : ac_cv_prog_cc_g=yes fi -rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi -rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi -rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext ac_c_werror_flag=$ac_save_c_werror_flag fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_g" >&5 -printf "%s\n" "$ac_cv_prog_cc_g" >&6; } -if test $ac_test_CFLAGS; then +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_g" >&5 +$as_echo "$ac_cv_prog_cc_g" >&6; } +if test "$ac_test_CFLAGS" = set; then CFLAGS=$ac_save_CFLAGS elif test $ac_cv_prog_cc_g = yes; then if test "$GCC" = yes; then @@ -4635,144 +3867,94 @@ else CFLAGS= fi fi -ac_prog_cc_stdc=no -if test x$ac_prog_cc_stdc = xno -then : - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $CC option to enable C11 features" >&5 -printf %s "checking for $CC option to enable C11 features... " >&6; } -if test ${ac_cv_prog_cc_c11+y} -then : - printf %s "(cached) " >&6 -else $as_nop - ac_cv_prog_cc_c11=no +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $CC option to accept ISO C89" >&5 +$as_echo_n "checking for $CC option to accept ISO C89... " >&6; } +if ${ac_cv_prog_cc_c89+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_cv_prog_cc_c89=no ac_save_CC=$CC cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ -$ac_c_conftest_c11_program -_ACEOF -for ac_arg in '' -std=gnu11 -do - CC="$ac_save_CC $ac_arg" - if ac_fn_c_try_compile "$LINENO" -then : - ac_cv_prog_cc_c11=$ac_arg -fi -rm -f core conftest.err conftest.$ac_objext conftest.beam - test "x$ac_cv_prog_cc_c11" != "xno" && break -done -rm -f conftest.$ac_ext -CC=$ac_save_CC -fi +#include +#include +struct stat; +/* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */ +struct buf { int x; }; +FILE * (*rcsopen) (struct buf *, struct stat *, int); +static char *e (p, i) + char **p; + int i; +{ + return p[i]; +} +static char *f (char * (*g) (char **, int), char **p, ...) +{ + char *s; + va_list v; + va_start (v,p); + s = g (p, va_arg (v,int)); + va_end (v); + return s; +} + +/* OSF 4.0 Compaq cc is some sort of almost-ANSI by default. It has + function prototypes and stuff, but not '\xHH' hex character constants. + These don't provoke an error unfortunately, instead are silently treated + as 'x'. The following induces an error, until -std is added to get + proper ANSI mode. Curiously '\x00'!='x' always comes out true, for an + array size at least. It's necessary to write '\x00'==0 to get something + that's true only with -std. */ +int osf4_cc_array ['\x00' == 0 ? 1 : -1]; -if test "x$ac_cv_prog_cc_c11" = xno -then : - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5 -printf "%s\n" "unsupported" >&6; } -else $as_nop - if test "x$ac_cv_prog_cc_c11" = x -then : - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: none needed" >&5 -printf "%s\n" "none needed" >&6; } -else $as_nop - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c11" >&5 -printf "%s\n" "$ac_cv_prog_cc_c11" >&6; } - CC="$CC $ac_cv_prog_cc_c11" -fi - ac_cv_prog_cc_stdc=$ac_cv_prog_cc_c11 - ac_prog_cc_stdc=c11 -fi -fi -if test x$ac_prog_cc_stdc = xno -then : - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $CC option to enable C99 features" >&5 -printf %s "checking for $CC option to enable C99 features... " >&6; } -if test ${ac_cv_prog_cc_c99+y} -then : - printf %s "(cached) " >&6 -else $as_nop - ac_cv_prog_cc_c99=no -ac_save_CC=$CC -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -$ac_c_conftest_c99_program -_ACEOF -for ac_arg in '' -std=gnu99 -std=c99 -c99 -qlanglvl=extc1x -qlanglvl=extc99 -AC99 -D_STDC_C99= -do - CC="$ac_save_CC $ac_arg" - if ac_fn_c_try_compile "$LINENO" -then : - ac_cv_prog_cc_c99=$ac_arg -fi -rm -f core conftest.err conftest.$ac_objext conftest.beam - test "x$ac_cv_prog_cc_c99" != "xno" && break -done -rm -f conftest.$ac_ext -CC=$ac_save_CC -fi +/* IBM C 6 for AIX is almost-ANSI by default, but it replaces macro parameters + inside strings and character constants. */ +#define FOO(x) 'x' +int xlc6_cc_array[FOO(a) == 'x' ? 1 : -1]; -if test "x$ac_cv_prog_cc_c99" = xno -then : - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5 -printf "%s\n" "unsupported" >&6; } -else $as_nop - if test "x$ac_cv_prog_cc_c99" = x -then : - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: none needed" >&5 -printf "%s\n" "none needed" >&6; } -else $as_nop - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c99" >&5 -printf "%s\n" "$ac_cv_prog_cc_c99" >&6; } - CC="$CC $ac_cv_prog_cc_c99" -fi - ac_cv_prog_cc_stdc=$ac_cv_prog_cc_c99 - ac_prog_cc_stdc=c99 -fi -fi -if test x$ac_prog_cc_stdc = xno -then : - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $CC option to enable C89 features" >&5 -printf %s "checking for $CC option to enable C89 features... " >&6; } -if test ${ac_cv_prog_cc_c89+y} -then : - printf %s "(cached) " >&6 -else $as_nop - ac_cv_prog_cc_c89=no -ac_save_CC=$CC -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -$ac_c_conftest_c89_program +int test (int i, double x); +struct s1 {int (*f) (int a);}; +struct s2 {int (*f) (double a);}; +int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int); +int argc; +char **argv; +int +main () +{ +return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1]; + ; + return 0; +} _ACEOF -for ac_arg in '' -qlanglvl=extc89 -qlanglvl=ansi -std -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__" +for ac_arg in '' -qlanglvl=extc89 -qlanglvl=ansi -std \ + -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__" do CC="$ac_save_CC $ac_arg" - if ac_fn_c_try_compile "$LINENO" -then : + if ac_fn_c_try_compile "$LINENO"; then : ac_cv_prog_cc_c89=$ac_arg fi -rm -f core conftest.err conftest.$ac_objext conftest.beam +rm -f core conftest.err conftest.$ac_objext test "x$ac_cv_prog_cc_c89" != "xno" && break done rm -f conftest.$ac_ext CC=$ac_save_CC -fi -if test "x$ac_cv_prog_cc_c89" = xno -then : - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5 -printf "%s\n" "unsupported" >&6; } -else $as_nop - if test "x$ac_cv_prog_cc_c89" = x -then : - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: none needed" >&5 -printf "%s\n" "none needed" >&6; } -else $as_nop - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c89" >&5 -printf "%s\n" "$ac_cv_prog_cc_c89" >&6; } - CC="$CC $ac_cv_prog_cc_c89" -fi - ac_cv_prog_cc_stdc=$ac_cv_prog_cc_c89 - ac_prog_cc_stdc=c89 fi +# AC_CACHE_VAL +case "x$ac_cv_prog_cc_c89" in + x) + { $as_echo "$as_me:${as_lineno-$LINENO}: result: none needed" >&5 +$as_echo "none needed" >&6; } ;; + xno) + { $as_echo "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5 +$as_echo "unsupported" >&6; } ;; + *) + CC="$CC $ac_cv_prog_cc_c89" + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c89" >&5 +$as_echo "$ac_cv_prog_cc_c89" >&6; } ;; +esac +if test "x$ac_cv_prog_cc_c89" != xno; then : + fi ac_ext=c @@ -4781,23 +3963,21 @@ ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu - - ac_ext=c +ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether $CC understands -c and -o together" >&5 -printf %s "checking whether $CC understands -c and -o together... " >&6; } -if test ${am_cv_prog_cc_c_o+y} -then : - printf %s "(cached) " >&6 -else $as_nop +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC understands -c and -o together" >&5 +$as_echo_n "checking whether $CC understands -c and -o together... " >&6; } +if ${am_cv_prog_cc_c_o+:} false; then : + $as_echo_n "(cached) " >&6 +else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int -main (void) +main () { ; @@ -4825,8 +4005,8 @@ _ACEOF rm -f core conftest* unset am_i fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $am_cv_prog_cc_c_o" >&5 -printf "%s\n" "$am_cv_prog_cc_c_o" >&6; } +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_prog_cc_c_o" >&5 +$as_echo "$am_cv_prog_cc_c_o" >&6; } if test "$am_cv_prog_cc_c_o" != yes; then # Losing compiler, so override with the script. # FIXME: It is wrong to rewrite CC. @@ -4844,12 +4024,11 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu depcc="$CC" am_compiler_list= -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking dependency style of $depcc" >&5 -printf %s "checking dependency style of $depcc... " >&6; } -if test ${am_cv_CC_dependencies_compiler_type+y} -then : - printf %s "(cached) " >&6 -else $as_nop +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking dependency style of $depcc" >&5 +$as_echo_n "checking dependency style of $depcc... " >&6; } +if ${am_cv_CC_dependencies_compiler_type+:} false; then : + $as_echo_n "(cached) " >&6 +else if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then # We make a subdir and do the tests there. Otherwise we can end up # making bogus files that we don't know about and never remove. For @@ -4956,8 +4135,8 @@ else fi fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $am_cv_CC_dependencies_compiler_type" >&5 -printf "%s\n" "$am_cv_CC_dependencies_compiler_type" >&6; } +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_CC_dependencies_compiler_type" >&5 +$as_echo "$am_cv_CC_dependencies_compiler_type" >&6; } CCDEPMODE=depmode=$am_cv_CC_dependencies_compiler_type if @@ -4971,6 +4150,182 @@ else fi + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $CC option to accept ISO C99" >&5 +$as_echo_n "checking for $CC option to accept ISO C99... " >&6; } +if ${ac_cv_prog_cc_c99+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_cv_prog_cc_c99=no +ac_save_CC=$CC +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +#include +#include +#include +#include + +// Check varargs macros. These examples are taken from C99 6.10.3.5. +#define debug(...) fprintf (stderr, __VA_ARGS__) +#define showlist(...) puts (#__VA_ARGS__) +#define report(test,...) ((test) ? puts (#test) : printf (__VA_ARGS__)) +static void +test_varargs_macros (void) +{ + int x = 1234; + int y = 5678; + debug ("Flag"); + debug ("X = %d\n", x); + showlist (The first, second, and third items.); + report (x>y, "x is %d but y is %d", x, y); +} + +// Check long long types. +#define BIG64 18446744073709551615ull +#define BIG32 4294967295ul +#define BIG_OK (BIG64 / BIG32 == 4294967297ull && BIG64 % BIG32 == 0) +#if !BIG_OK + your preprocessor is broken; +#endif +#if BIG_OK +#else + your preprocessor is broken; +#endif +static long long int bignum = -9223372036854775807LL; +static unsigned long long int ubignum = BIG64; + +struct incomplete_array +{ + int datasize; + double data[]; +}; + +struct named_init { + int number; + const wchar_t *name; + double average; +}; + +typedef const char *ccp; + +static inline int +test_restrict (ccp restrict text) +{ + // See if C++-style comments work. + // Iterate through items via the restricted pointer. + // Also check for declarations in for loops. + for (unsigned int i = 0; *(text+i) != '\0'; ++i) + continue; + return 0; +} + +// Check varargs and va_copy. +static void +test_varargs (const char *format, ...) +{ + va_list args; + va_start (args, format); + va_list args_copy; + va_copy (args_copy, args); + + const char *str; + int number; + float fnumber; + + while (*format) + { + switch (*format++) + { + case 's': // string + str = va_arg (args_copy, const char *); + break; + case 'd': // int + number = va_arg (args_copy, int); + break; + case 'f': // float + fnumber = va_arg (args_copy, double); + break; + default: + break; + } + } + va_end (args_copy); + va_end (args); +} + +int +main () +{ + + // Check bool. + _Bool success = false; + + // Check restrict. + if (test_restrict ("String literal") == 0) + success = true; + char *restrict newvar = "Another string"; + + // Check varargs. + test_varargs ("s, d' f .", "string", 65, 34.234); + test_varargs_macros (); + + // Check flexible array members. + struct incomplete_array *ia = + malloc (sizeof (struct incomplete_array) + (sizeof (double) * 10)); + ia->datasize = 10; + for (int i = 0; i < ia->datasize; ++i) + ia->data[i] = i * 1.234; + + // Check named initializers. + struct named_init ni = { + .number = 34, + .name = L"Test wide string", + .average = 543.34343, + }; + + ni.number = 58; + + int dynamic_array[ni.number]; + dynamic_array[ni.number - 1] = 543; + + // work around unused variable warnings + return (!success || bignum == 0LL || ubignum == 0uLL || newvar[0] == 'x' + || dynamic_array[ni.number - 1] != 543); + + ; + return 0; +} +_ACEOF +for ac_arg in '' -std=gnu99 -std=c99 -c99 -AC99 -D_STDC_C99= -qlanglvl=extc99 +do + CC="$ac_save_CC $ac_arg" + if ac_fn_c_try_compile "$LINENO"; then : + ac_cv_prog_cc_c99=$ac_arg +fi +rm -f core conftest.err conftest.$ac_objext + test "x$ac_cv_prog_cc_c99" != "xno" && break +done +rm -f conftest.$ac_ext +CC=$ac_save_CC + +fi +# AC_CACHE_VAL +case "x$ac_cv_prog_cc_c99" in + x) + { $as_echo "$as_me:${as_lineno-$LINENO}: result: none needed" >&5 +$as_echo "none needed" >&6; } ;; + xno) + { $as_echo "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5 +$as_echo "unsupported" >&6; } ;; + *) + CC="$CC $ac_cv_prog_cc_c99" + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c99" >&5 +$as_echo "$ac_cv_prog_cc_c99" >&6; } ;; +esac +if test "x$ac_cv_prog_cc_c99" != xno; then : + +fi + ac_ext=c @@ -4978,36 +4333,40 @@ ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking how to run the C preprocessor" >&5 -printf %s "checking how to run the C preprocessor... " >&6; } +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to run the C preprocessor" >&5 +$as_echo_n "checking how to run the C preprocessor... " >&6; } # On Suns, sometimes $CPP names a directory. if test -n "$CPP" && test -d "$CPP"; then CPP= fi if test -z "$CPP"; then - if test ${ac_cv_prog_CPP+y} -then : - printf %s "(cached) " >&6 -else $as_nop - # Double quotes because $CC needs to be expanded - for CPP in "$CC -E" "$CC -E -traditional-cpp" cpp /lib/cpp + if ${ac_cv_prog_CPP+:} false; then : + $as_echo_n "(cached) " >&6 +else + # Double quotes because CPP needs to be expanded + for CPP in "$CC -E" "$CC -E -traditional-cpp" "/lib/cpp" do ac_preproc_ok=false for ac_c_preproc_warn_flag in '' yes do # Use a header file that comes with gcc, so configuring glibc # with a fresh cross-compiler works. + # Prefer to if __STDC__ is defined, since + # exists even on freestanding compilers. # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. "Syntax error" is here to catch this case. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ -#include +#ifdef __STDC__ +# include +#else +# include +#endif Syntax error _ACEOF -if ac_fn_c_try_cpp "$LINENO" -then : +if ac_fn_c_try_cpp "$LINENO"; then : -else $as_nop +else # Broken: fails on valid input. continue fi @@ -5019,11 +4378,10 @@ rm -f conftest.err conftest.i conftest.$ac_ext /* end confdefs.h. */ #include _ACEOF -if ac_fn_c_try_cpp "$LINENO" -then : +if ac_fn_c_try_cpp "$LINENO"; then : # Broken: success on invalid input. continue -else $as_nop +else # Passes both tests. ac_preproc_ok=: break @@ -5033,8 +4391,7 @@ rm -f conftest.err conftest.i conftest.$ac_ext done # Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. rm -f conftest.i conftest.err conftest.$ac_ext -if $ac_preproc_ok -then : +if $ac_preproc_ok; then : break fi @@ -5046,24 +4403,29 @@ fi else ac_cv_prog_CPP=$CPP fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $CPP" >&5 -printf "%s\n" "$CPP" >&6; } +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $CPP" >&5 +$as_echo "$CPP" >&6; } ac_preproc_ok=false for ac_c_preproc_warn_flag in '' yes do # Use a header file that comes with gcc, so configuring glibc # with a fresh cross-compiler works. + # Prefer to if __STDC__ is defined, since + # exists even on freestanding compilers. # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. "Syntax error" is here to catch this case. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ -#include +#ifdef __STDC__ +# include +#else +# include +#endif Syntax error _ACEOF -if ac_fn_c_try_cpp "$LINENO" -then : +if ac_fn_c_try_cpp "$LINENO"; then : -else $as_nop +else # Broken: fails on valid input. continue fi @@ -5075,11 +4437,10 @@ rm -f conftest.err conftest.i conftest.$ac_ext /* end confdefs.h. */ #include _ACEOF -if ac_fn_c_try_cpp "$LINENO" -then : +if ac_fn_c_try_cpp "$LINENO"; then : # Broken: success on invalid input. continue -else $as_nop +else # Passes both tests. ac_preproc_ok=: break @@ -5089,12 +4450,11 @@ rm -f conftest.err conftest.i conftest.$ac_ext done # Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. rm -f conftest.i conftest.err conftest.$ac_ext -if $ac_preproc_ok -then : +if $ac_preproc_ok; then : -else $as_nop - { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -printf "%s\n" "$as_me: error: in \`$ac_pwd':" >&2;} +else + { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "C preprocessor \"$CPP\" fails sanity check See \`config.log' for more details" "$LINENO" 5; } fi @@ -5106,12 +4466,11 @@ ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $ ac_compiler_gnu=$ac_cv_c_compiler_gnu -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for grep that handles long lines and -e" >&5 -printf %s "checking for grep that handles long lines and -e... " >&6; } -if test ${ac_cv_path_GREP+y} -then : - printf %s "(cached) " >&6 -else $as_nop +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for grep that handles long lines and -e" >&5 +$as_echo_n "checking for grep that handles long lines and -e... " >&6; } +if ${ac_cv_path_GREP+:} false; then : + $as_echo_n "(cached) " >&6 +else if test -z "$GREP"; then ac_path_GREP_found=false # Loop through the user's path and test for each of PROGNAME-LIST @@ -5119,15 +4478,10 @@ else $as_nop for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin do IFS=$as_save_IFS - case $as_dir in #((( - '') as_dir=./ ;; - */) ;; - *) as_dir=$as_dir/ ;; - esac - for ac_prog in grep ggrep - do + test -z "$as_dir" && as_dir=. + for ac_prog in grep ggrep; do for ac_exec_ext in '' $ac_executable_extensions; do - ac_path_GREP="$as_dir$ac_prog$ac_exec_ext" + ac_path_GREP="$as_dir/$ac_prog$ac_exec_ext" as_fn_executable_p "$ac_path_GREP" || continue # Check for GNU ac_path_GREP and select it if it is found. # Check for GNU $ac_path_GREP @@ -5136,13 +4490,13 @@ case `"$ac_path_GREP" --version 2>&1` in ac_cv_path_GREP="$ac_path_GREP" ac_path_GREP_found=:;; *) ac_count=0 - printf %s 0123456789 >"conftest.in" + $as_echo_n 0123456789 >"conftest.in" while : do cat "conftest.in" "conftest.in" >"conftest.tmp" mv "conftest.tmp" "conftest.in" cp "conftest.in" "conftest.nl" - printf "%s\n" 'GREP' >> "conftest.nl" + $as_echo 'GREP' >> "conftest.nl" "$ac_path_GREP" -e 'GREP$' -e '-(cannot match)-' < "conftest.nl" >"conftest.out" 2>/dev/null || break diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break as_fn_arith $ac_count + 1 && ac_count=$as_val @@ -5170,17 +4524,16 @@ else fi fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_GREP" >&5 -printf "%s\n" "$ac_cv_path_GREP" >&6; } +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_GREP" >&5 +$as_echo "$ac_cv_path_GREP" >&6; } GREP="$ac_cv_path_GREP" -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for egrep" >&5 -printf %s "checking for egrep... " >&6; } -if test ${ac_cv_path_EGREP+y} -then : - printf %s "(cached) " >&6 -else $as_nop +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for egrep" >&5 +$as_echo_n "checking for egrep... " >&6; } +if ${ac_cv_path_EGREP+:} false; then : + $as_echo_n "(cached) " >&6 +else if echo a | $GREP -E '(a|b)' >/dev/null 2>&1 then ac_cv_path_EGREP="$GREP -E" else @@ -5191,15 +4544,10 @@ else $as_nop for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin do IFS=$as_save_IFS - case $as_dir in #((( - '') as_dir=./ ;; - */) ;; - *) as_dir=$as_dir/ ;; - esac - for ac_prog in egrep - do + test -z "$as_dir" && as_dir=. + for ac_prog in egrep; do for ac_exec_ext in '' $ac_executable_extensions; do - ac_path_EGREP="$as_dir$ac_prog$ac_exec_ext" + ac_path_EGREP="$as_dir/$ac_prog$ac_exec_ext" as_fn_executable_p "$ac_path_EGREP" || continue # Check for GNU ac_path_EGREP and select it if it is found. # Check for GNU $ac_path_EGREP @@ -5208,13 +4556,13 @@ case `"$ac_path_EGREP" --version 2>&1` in ac_cv_path_EGREP="$ac_path_EGREP" ac_path_EGREP_found=:;; *) ac_count=0 - printf %s 0123456789 >"conftest.in" + $as_echo_n 0123456789 >"conftest.in" while : do cat "conftest.in" "conftest.in" >"conftest.tmp" mv "conftest.tmp" "conftest.in" cp "conftest.in" "conftest.nl" - printf "%s\n" 'EGREP' >> "conftest.nl" + $as_echo 'EGREP' >> "conftest.nl" "$ac_path_EGREP" 'EGREP$' < "conftest.nl" >"conftest.out" 2>/dev/null || break diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break as_fn_arith $ac_count + 1 && ac_count=$as_val @@ -5243,18 +4591,17 @@ fi fi fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_EGREP" >&5 -printf "%s\n" "$ac_cv_path_EGREP" >&6; } +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_EGREP" >&5 +$as_echo "$ac_cv_path_EGREP" >&6; } EGREP="$ac_cv_path_EGREP" if test $ac_cv_c_compiler_gnu = yes; then - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether $CC needs -traditional" >&5 -printf %s "checking whether $CC needs -traditional... " >&6; } -if test ${ac_cv_prog_gcc_traditional+y} -then : - printf %s "(cached) " >&6 -else $as_nop + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC needs -traditional" >&5 +$as_echo_n "checking whether $CC needs -traditional... " >&6; } +if ${ac_cv_prog_gcc_traditional+:} false; then : + $as_echo_n "(cached) " >&6 +else ac_pattern="Autoconf.*'x'" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ @@ -5262,13 +4609,12 @@ else $as_nop Autoconf TIOCGETP _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - $EGREP "$ac_pattern" >/dev/null 2>&1 -then : + $EGREP "$ac_pattern" >/dev/null 2>&1; then : ac_cv_prog_gcc_traditional=yes -else $as_nop +else ac_cv_prog_gcc_traditional=no fi -rm -rf conftest* +rm -f conftest* if test $ac_cv_prog_gcc_traditional = no; then @@ -5278,16 +4624,15 @@ rm -rf conftest* Autoconf TCGETA _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - $EGREP "$ac_pattern" >/dev/null 2>&1 -then : + $EGREP "$ac_pattern" >/dev/null 2>&1; then : ac_cv_prog_gcc_traditional=yes fi -rm -rf conftest* +rm -f conftest* fi fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_gcc_traditional" >&5 -printf "%s\n" "$ac_cv_prog_gcc_traditional" >&6; } +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_gcc_traditional" >&5 +$as_echo "$ac_cv_prog_gcc_traditional" >&6; } if test $ac_cv_prog_gcc_traditional = yes; then CC="$CC -traditional" fi @@ -5303,12 +4648,11 @@ test "${CCASFLAGS+set}" = set || CCASFLAGS=$CFLAGS depcc="$CCAS" am_compiler_list= -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking dependency style of $depcc" >&5 -printf %s "checking dependency style of $depcc... " >&6; } -if test ${am_cv_CCAS_dependencies_compiler_type+y} -then : - printf %s "(cached) " >&6 -else $as_nop +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking dependency style of $depcc" >&5 +$as_echo_n "checking dependency style of $depcc... " >&6; } +if ${am_cv_CCAS_dependencies_compiler_type+:} false; then : + $as_echo_n "(cached) " >&6 +else if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then # We make a subdir and do the tests there. Otherwise we can end up # making bogus files that we don't know about and never remove. For @@ -5413,8 +4757,8 @@ else fi fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $am_cv_CCAS_dependencies_compiler_type" >&5 -printf "%s\n" "$am_cv_CCAS_dependencies_compiler_type" >&6; } +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_CCAS_dependencies_compiler_type" >&5 +$as_echo "$am_cv_CCAS_dependencies_compiler_type" >&6; } CCASDEPMODE=depmode=$am_cv_CCAS_dependencies_compiler_type if @@ -5431,12 +4775,11 @@ fi if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}ranlib", so it can be a program name with args. set dummy ${ac_tool_prefix}ranlib; ac_word=$2 -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -printf %s "checking for $ac_word... " >&6; } -if test ${ac_cv_prog_RANLIB+y} -then : - printf %s "(cached) " >&6 -else $as_nop +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_RANLIB+:} false; then : + $as_echo_n "(cached) " >&6 +else if test -n "$RANLIB"; then ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test. else @@ -5444,15 +4787,11 @@ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS - case $as_dir in #((( - '') as_dir=./ ;; - */) ;; - *) as_dir=$as_dir/ ;; - esac + test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_RANLIB="${ac_tool_prefix}ranlib" - printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done @@ -5463,11 +4802,11 @@ fi fi RANLIB=$ac_cv_prog_RANLIB if test -n "$RANLIB"; then - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $RANLIB" >&5 -printf "%s\n" "$RANLIB" >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $RANLIB" >&5 +$as_echo "$RANLIB" >&6; } else - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 -printf "%s\n" "no" >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } fi @@ -5476,12 +4815,11 @@ if test -z "$ac_cv_prog_RANLIB"; then ac_ct_RANLIB=$RANLIB # Extract the first word of "ranlib", so it can be a program name with args. set dummy ranlib; ac_word=$2 -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -printf %s "checking for $ac_word... " >&6; } -if test ${ac_cv_prog_ac_ct_RANLIB+y} -then : - printf %s "(cached) " >&6 -else $as_nop +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_ac_ct_RANLIB+:} false; then : + $as_echo_n "(cached) " >&6 +else if test -n "$ac_ct_RANLIB"; then ac_cv_prog_ac_ct_RANLIB="$ac_ct_RANLIB" # Let the user override the test. else @@ -5489,15 +4827,11 @@ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS - case $as_dir in #((( - '') as_dir=./ ;; - */) ;; - *) as_dir=$as_dir/ ;; - esac + test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_RANLIB="ranlib" - printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done @@ -5508,11 +4842,11 @@ fi fi ac_ct_RANLIB=$ac_cv_prog_ac_ct_RANLIB if test -n "$ac_ct_RANLIB"; then - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_RANLIB" >&5 -printf "%s\n" "$ac_ct_RANLIB" >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_RANLIB" >&5 +$as_echo "$ac_ct_RANLIB" >&6; } else - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 -printf "%s\n" "no" >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } fi if test "x$ac_ct_RANLIB" = x; then @@ -5520,8 +4854,8 @@ fi else case $cross_compiling:$ac_tool_warned in yes:) -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 -printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac RANLIB=$ac_ct_RANLIB @@ -5530,12 +4864,6 @@ else RANLIB="$ac_cv_prog_RANLIB" fi - - - - - - ac_ext=cpp ac_cpp='$CXXCPP $CPPFLAGS' ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' @@ -5546,16 +4874,15 @@ if test -z "$CXX"; then CXX=$CCC else if test -n "$ac_tool_prefix"; then - for ac_prog in g++ c++ gpp aCC CC cxx cc++ cl.exe FCC KCC RCC xlC_r xlC clang++ + for ac_prog in g++ c++ gpp aCC CC cxx cc++ cl.exe FCC KCC RCC xlC_r xlC do # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. set dummy $ac_tool_prefix$ac_prog; ac_word=$2 -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -printf %s "checking for $ac_word... " >&6; } -if test ${ac_cv_prog_CXX+y} -then : - printf %s "(cached) " >&6 -else $as_nop +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_CXX+:} false; then : + $as_echo_n "(cached) " >&6 +else if test -n "$CXX"; then ac_cv_prog_CXX="$CXX" # Let the user override the test. else @@ -5563,15 +4890,11 @@ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS - case $as_dir in #((( - '') as_dir=./ ;; - */) ;; - *) as_dir=$as_dir/ ;; - esac + test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_CXX="$ac_tool_prefix$ac_prog" - printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done @@ -5582,11 +4905,11 @@ fi fi CXX=$ac_cv_prog_CXX if test -n "$CXX"; then - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $CXX" >&5 -printf "%s\n" "$CXX" >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CXX" >&5 +$as_echo "$CXX" >&6; } else - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 -printf "%s\n" "no" >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } fi @@ -5595,16 +4918,15 @@ fi fi if test -z "$CXX"; then ac_ct_CXX=$CXX - for ac_prog in g++ c++ gpp aCC CC cxx cc++ cl.exe FCC KCC RCC xlC_r xlC clang++ + for ac_prog in g++ c++ gpp aCC CC cxx cc++ cl.exe FCC KCC RCC xlC_r xlC do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -printf %s "checking for $ac_word... " >&6; } -if test ${ac_cv_prog_ac_ct_CXX+y} -then : - printf %s "(cached) " >&6 -else $as_nop +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_ac_ct_CXX+:} false; then : + $as_echo_n "(cached) " >&6 +else if test -n "$ac_ct_CXX"; then ac_cv_prog_ac_ct_CXX="$ac_ct_CXX" # Let the user override the test. else @@ -5612,15 +4934,11 @@ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS - case $as_dir in #((( - '') as_dir=./ ;; - */) ;; - *) as_dir=$as_dir/ ;; - esac + test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_CXX="$ac_prog" - printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done @@ -5631,11 +4949,11 @@ fi fi ac_ct_CXX=$ac_cv_prog_ac_ct_CXX if test -n "$ac_ct_CXX"; then - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CXX" >&5 -printf "%s\n" "$ac_ct_CXX" >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CXX" >&5 +$as_echo "$ac_ct_CXX" >&6; } else - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 -printf "%s\n" "no" >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } fi @@ -5647,8 +4965,8 @@ done else case $cross_compiling:$ac_tool_warned in yes:) -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 -printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac CXX=$ac_ct_CXX @@ -5658,7 +4976,7 @@ fi fi fi # Provide some information about the compiler. -printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for C++ compiler version" >&5 +$as_echo "$as_me:${as_lineno-$LINENO}: checking for C++ compiler version" >&5 set X $ac_compile ac_compiler=$2 for ac_option in --version -v -V -qversion; do @@ -5668,7 +4986,7 @@ case "(($ac_try" in *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -printf "%s\n" "$ac_try_echo"; } >&5 +$as_echo "$ac_try_echo"; } >&5 (eval "$ac_compiler $ac_option >&5") 2>conftest.err ac_status=$? if test -s conftest.err; then @@ -5678,21 +4996,20 @@ printf "%s\n" "$ac_try_echo"; } >&5 cat conftest.er1 >&5 fi rm -f conftest.er1 conftest.err - printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } done -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether the compiler supports GNU C++" >&5 -printf %s "checking whether the compiler supports GNU C++... " >&6; } -if test ${ac_cv_cxx_compiler_gnu+y} -then : - printf %s "(cached) " >&6 -else $as_nop +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are using the GNU C++ compiler" >&5 +$as_echo_n "checking whether we are using the GNU C++ compiler... " >&6; } +if ${ac_cv_cxx_compiler_gnu+:} false; then : + $as_echo_n "(cached) " >&6 +else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int -main (void) +main () { #ifndef __GNUC__ choke me @@ -5702,33 +5019,29 @@ main (void) return 0; } _ACEOF -if ac_fn_cxx_try_compile "$LINENO" -then : +if ac_fn_cxx_try_compile "$LINENO"; then : ac_compiler_gnu=yes -else $as_nop +else ac_compiler_gnu=no fi -rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext ac_cv_cxx_compiler_gnu=$ac_compiler_gnu fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_cxx_compiler_gnu" >&5 -printf "%s\n" "$ac_cv_cxx_compiler_gnu" >&6; } -ac_compiler_gnu=$ac_cv_cxx_compiler_gnu - +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_cxx_compiler_gnu" >&5 +$as_echo "$ac_cv_cxx_compiler_gnu" >&6; } if test $ac_compiler_gnu = yes; then GXX=yes else GXX= fi -ac_test_CXXFLAGS=${CXXFLAGS+y} +ac_test_CXXFLAGS=${CXXFLAGS+set} ac_save_CXXFLAGS=$CXXFLAGS -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether $CXX accepts -g" >&5 -printf %s "checking whether $CXX accepts -g... " >&6; } -if test ${ac_cv_prog_cxx_g+y} -then : - printf %s "(cached) " >&6 -else $as_nop +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CXX accepts -g" >&5 +$as_echo_n "checking whether $CXX accepts -g... " >&6; } +if ${ac_cv_prog_cxx_g+:} false; then : + $as_echo_n "(cached) " >&6 +else ac_save_cxx_werror_flag=$ac_cxx_werror_flag ac_cxx_werror_flag=yes ac_cv_prog_cxx_g=no @@ -5737,60 +5050,57 @@ else $as_nop /* end confdefs.h. */ int -main (void) +main () { ; return 0; } _ACEOF -if ac_fn_cxx_try_compile "$LINENO" -then : +if ac_fn_cxx_try_compile "$LINENO"; then : ac_cv_prog_cxx_g=yes -else $as_nop +else CXXFLAGS="" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int -main (void) +main () { ; return 0; } _ACEOF -if ac_fn_cxx_try_compile "$LINENO" -then : +if ac_fn_cxx_try_compile "$LINENO"; then : -else $as_nop +else ac_cxx_werror_flag=$ac_save_cxx_werror_flag CXXFLAGS="-g" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int -main (void) +main () { ; return 0; } _ACEOF -if ac_fn_cxx_try_compile "$LINENO" -then : +if ac_fn_cxx_try_compile "$LINENO"; then : ac_cv_prog_cxx_g=yes fi -rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi -rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi -rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext ac_cxx_werror_flag=$ac_save_cxx_werror_flag fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cxx_g" >&5 -printf "%s\n" "$ac_cv_prog_cxx_g" >&6; } -if test $ac_test_CXXFLAGS; then +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cxx_g" >&5 +$as_echo "$ac_cv_prog_cxx_g" >&6; } +if test "$ac_test_CXXFLAGS" = set; then CXXFLAGS=$ac_save_CXXFLAGS elif test $ac_cv_prog_cxx_g = yes; then if test "$GXX" = yes; then @@ -5805,100 +5115,6 @@ else CXXFLAGS= fi fi -ac_prog_cxx_stdcxx=no -if test x$ac_prog_cxx_stdcxx = xno -then : - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $CXX option to enable C++11 features" >&5 -printf %s "checking for $CXX option to enable C++11 features... " >&6; } -if test ${ac_cv_prog_cxx_11+y} -then : - printf %s "(cached) " >&6 -else $as_nop - ac_cv_prog_cxx_11=no -ac_save_CXX=$CXX -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -$ac_cxx_conftest_cxx11_program -_ACEOF -for ac_arg in '' -std=gnu++11 -std=gnu++0x -std=c++11 -std=c++0x -qlanglvl=extended0x -AA -do - CXX="$ac_save_CXX $ac_arg" - if ac_fn_cxx_try_compile "$LINENO" -then : - ac_cv_prog_cxx_cxx11=$ac_arg -fi -rm -f core conftest.err conftest.$ac_objext conftest.beam - test "x$ac_cv_prog_cxx_cxx11" != "xno" && break -done -rm -f conftest.$ac_ext -CXX=$ac_save_CXX -fi - -if test "x$ac_cv_prog_cxx_cxx11" = xno -then : - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5 -printf "%s\n" "unsupported" >&6; } -else $as_nop - if test "x$ac_cv_prog_cxx_cxx11" = x -then : - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: none needed" >&5 -printf "%s\n" "none needed" >&6; } -else $as_nop - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cxx_cxx11" >&5 -printf "%s\n" "$ac_cv_prog_cxx_cxx11" >&6; } - CXX="$CXX $ac_cv_prog_cxx_cxx11" -fi - ac_cv_prog_cxx_stdcxx=$ac_cv_prog_cxx_cxx11 - ac_prog_cxx_stdcxx=cxx11 -fi -fi -if test x$ac_prog_cxx_stdcxx = xno -then : - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $CXX option to enable C++98 features" >&5 -printf %s "checking for $CXX option to enable C++98 features... " >&6; } -if test ${ac_cv_prog_cxx_98+y} -then : - printf %s "(cached) " >&6 -else $as_nop - ac_cv_prog_cxx_98=no -ac_save_CXX=$CXX -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -$ac_cxx_conftest_cxx98_program -_ACEOF -for ac_arg in '' -std=gnu++98 -std=c++98 -qlanglvl=extended -AA -do - CXX="$ac_save_CXX $ac_arg" - if ac_fn_cxx_try_compile "$LINENO" -then : - ac_cv_prog_cxx_cxx98=$ac_arg -fi -rm -f core conftest.err conftest.$ac_objext conftest.beam - test "x$ac_cv_prog_cxx_cxx98" != "xno" && break -done -rm -f conftest.$ac_ext -CXX=$ac_save_CXX -fi - -if test "x$ac_cv_prog_cxx_cxx98" = xno -then : - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5 -printf "%s\n" "unsupported" >&6; } -else $as_nop - if test "x$ac_cv_prog_cxx_cxx98" = x -then : - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: none needed" >&5 -printf "%s\n" "none needed" >&6; } -else $as_nop - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cxx_cxx98" >&5 -printf "%s\n" "$ac_cv_prog_cxx_cxx98" >&6; } - CXX="$CXX $ac_cv_prog_cxx_cxx98" -fi - ac_cv_prog_cxx_stdcxx=$ac_cv_prog_cxx_cxx98 - ac_prog_cxx_stdcxx=cxx98 -fi -fi - ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' @@ -5907,12 +5123,11 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu depcc="$CXX" am_compiler_list= -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking dependency style of $depcc" >&5 -printf %s "checking dependency style of $depcc... " >&6; } -if test ${am_cv_CXX_dependencies_compiler_type+y} -then : - printf %s "(cached) " >&6 -else $as_nop +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking dependency style of $depcc" >&5 +$as_echo_n "checking dependency style of $depcc... " >&6; } +if ${am_cv_CXX_dependencies_compiler_type+:} false; then : + $as_echo_n "(cached) " >&6 +else if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then # We make a subdir and do the tests there. Otherwise we can end up # making bogus files that we don't know about and never remove. For @@ -6019,8 +5234,8 @@ else fi fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $am_cv_CXX_dependencies_compiler_type" >&5 -printf "%s\n" "$am_cv_CXX_dependencies_compiler_type" >&6; } +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_CXX_dependencies_compiler_type" >&5 +$as_echo "$am_cv_CXX_dependencies_compiler_type" >&6; } CXXDEPMODE=depmode=$am_cv_CXX_dependencies_compiler_type if @@ -6029,335 +5244,289 @@ CXXDEPMODE=depmode=$am_cv_CXX_dependencies_compiler_type am__fastdepCXX_TRUE= am__fastdepCXX_FALSE='#' else - am__fastdepCXX_TRUE='#' - am__fastdepCXX_FALSE= + am__fastdepCXX_TRUE='#' + am__fastdepCXX_FALSE= +fi + + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ANSI C header files" >&5 +$as_echo_n "checking for ANSI C header files... " >&6; } +if ${ac_cv_header_stdc+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +#include +#include +#include + +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + ac_cv_header_stdc=yes +else + ac_cv_header_stdc=no fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +if test $ac_cv_header_stdc = yes; then + # SunOS 4.x string.h does not declare mem*, contrary to ANSI. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "memchr" >/dev/null 2>&1; then : -ac_header= ac_cache= -for ac_item in $ac_header_c_list -do - if test $ac_cache; then - ac_fn_c_check_header_compile "$LINENO" $ac_header ac_cv_header_$ac_cache "$ac_includes_default" - if eval test \"x\$ac_cv_header_$ac_cache\" = xyes; then - printf "%s\n" "#define $ac_item 1" >> confdefs.h - fi - ac_header= ac_cache= - elif test $ac_header; then - ac_cache=$ac_item - else - ac_header=$ac_item - fi -done - +else + ac_cv_header_stdc=no +fi +rm -f conftest* +fi +if test $ac_cv_header_stdc = yes; then + # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "free" >/dev/null 2>&1; then : +else + ac_cv_header_stdc=no +fi +rm -f conftest* +fi +if test $ac_cv_header_stdc = yes; then + # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi. + if test "$cross_compiling" = yes; then : + : +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +#include +#if ((' ' & 0x0FF) == 0x020) +# define ISLOWER(c) ('a' <= (c) && (c) <= 'z') +# define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c)) +#else +# define ISLOWER(c) \ + (('a' <= (c) && (c) <= 'i') \ + || ('j' <= (c) && (c) <= 'r') \ + || ('s' <= (c) && (c) <= 'z')) +# define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c)) +#endif -if test $ac_cv_header_stdlib_h = yes && test $ac_cv_header_string_h = yes -then : +#define XOR(e, f) (((e) && !(f)) || (!(e) && (f))) +int +main () +{ + int i; + for (i = 0; i < 256; i++) + if (XOR (islower (i), ISLOWER (i)) + || toupper (i) != TOUPPER (i)) + return 2; + return 0; +} +_ACEOF +if ac_fn_c_try_run "$LINENO"; then : -printf "%s\n" "#define STDC_HEADERS 1" >>confdefs.h +else + ac_cv_header_stdc=no +fi +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ + conftest.$ac_objext conftest.beam conftest.$ac_ext +fi fi -# Autoupdate added the next two lines to ensure that your configure -# script's behavior did not change. They are probably safe to remove. +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_stdc" >&5 +$as_echo "$ac_cv_header_stdc" >&6; } +if test $ac_cv_header_stdc = yes; then -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for egrep" >&5 -printf %s "checking for egrep... " >&6; } -if test ${ac_cv_path_EGREP+y} -then : - printf %s "(cached) " >&6 -else $as_nop - if echo a | $GREP -E '(a|b)' >/dev/null 2>&1 - then ac_cv_path_EGREP="$GREP -E" - else - if test -z "$EGREP"; then - ac_path_EGREP_found=false - # Loop through the user's path and test for each of PROGNAME-LIST - as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin -do - IFS=$as_save_IFS - case $as_dir in #((( - '') as_dir=./ ;; - */) ;; - *) as_dir=$as_dir/ ;; - esac - for ac_prog in egrep - do - for ac_exec_ext in '' $ac_executable_extensions; do - ac_path_EGREP="$as_dir$ac_prog$ac_exec_ext" - as_fn_executable_p "$ac_path_EGREP" || continue -# Check for GNU ac_path_EGREP and select it if it is found. - # Check for GNU $ac_path_EGREP -case `"$ac_path_EGREP" --version 2>&1` in -*GNU*) - ac_cv_path_EGREP="$ac_path_EGREP" ac_path_EGREP_found=:;; -*) - ac_count=0 - printf %s 0123456789 >"conftest.in" - while : - do - cat "conftest.in" "conftest.in" >"conftest.tmp" - mv "conftest.tmp" "conftest.in" - cp "conftest.in" "conftest.nl" - printf "%s\n" 'EGREP' >> "conftest.nl" - "$ac_path_EGREP" 'EGREP$' < "conftest.nl" >"conftest.out" 2>/dev/null || break - diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break - as_fn_arith $ac_count + 1 && ac_count=$as_val - if test $ac_count -gt ${ac_path_EGREP_max-0}; then - # Best one so far, save it but keep looking for a better one - ac_cv_path_EGREP="$ac_path_EGREP" - ac_path_EGREP_max=$ac_count - fi - # 10*(2^10) chars as input seems more than enough - test $ac_count -gt 10 && break - done - rm -f conftest.in conftest.tmp conftest.nl conftest.out;; -esac +$as_echo "#define STDC_HEADERS 1" >>confdefs.h - $ac_path_EGREP_found && break 3 - done - done - done -IFS=$as_save_IFS - if test -z "$ac_cv_path_EGREP"; then - as_fn_error $? "no acceptable egrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5 - fi -else - ac_cv_path_EGREP=$EGREP fi - fi -fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_EGREP" >&5 -printf "%s\n" "$ac_cv_path_EGREP" >&6; } - EGREP="$ac_cv_path_EGREP" +# On IRIX 5.3, sys/types and inttypes.h are conflicting. +for ac_header in sys/types.h sys/stat.h stdlib.h string.h memory.h strings.h \ + inttypes.h stdint.h unistd.h +do : + as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` +ac_fn_c_check_header_compile "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default +" +if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : + cat >>confdefs.h <<_ACEOF +#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 +_ACEOF +fi +done -ac_fn_c_check_header_compile "$LINENO" "sys/endian.h" "ac_cv_header_sys_endian_h" "$ac_includes_default" -if test "x$ac_cv_header_sys_endian_h" = xyes -then : - printf "%s\n" "#define HAVE_SYS_ENDIAN_H 1" >>confdefs.h -fi -ac_fn_c_check_header_compile "$LINENO" "sys/param.h" "ac_cv_header_sys_param_h" "$ac_includes_default" -if test "x$ac_cv_header_sys_param_h" = xyes -then : - printf "%s\n" "#define HAVE_SYS_PARAM_H 1" >>confdefs.h +for ac_header in sys/endian.h sys/param.h syslog.h +do : + as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` +ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default" +if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : + cat >>confdefs.h <<_ACEOF +#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 +_ACEOF fi -ac_fn_c_check_header_compile "$LINENO" "syslog.h" "ac_cv_header_syslog_h" "$ac_includes_default" -if test "x$ac_cv_header_syslog_h" = xyes -then : - printf "%s\n" "#define HAVE_SYSLOG_H 1" >>confdefs.h -fi +done # sys/sysctl.h requires sys/types.h on FreeBSD # sys/sysctl.h requires sys/param.h on OpenBSD -ac_fn_c_check_header_compile "$LINENO" "sys/sysctl.h" "ac_cv_header_sys_sysctl_h" "#include +for ac_header in sys/sysctl.h +do : + ac_fn_c_check_header_compile "$LINENO" "sys/sysctl.h" "ac_cv_header_sys_sysctl_h" "#include #ifdef HAVE_SYS_PARAM_H #include #endif " -if test "x$ac_cv_header_sys_sysctl_h" = xyes -then : - printf "%s\n" "#define HAVE_SYS_SYSCTL_H 1" >>confdefs.h +if test "x$ac_cv_header_sys_sysctl_h" = xyes; then : + cat >>confdefs.h <<_ACEOF +#define HAVE_SYS_SYSCTL_H 1 +_ACEOF fi +done -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $CC options needed to detect all undeclared functions" >&5 -printf %s "checking for $CC options needed to detect all undeclared functions... " >&6; } -if test ${ac_cv_c_undeclared_builtin_options+y} -then : - printf %s "(cached) " >&6 -else $as_nop - ac_save_CFLAGS=$CFLAGS - ac_cv_c_undeclared_builtin_options='cannot detect' - for ac_arg in '' -fno-builtin; do - CFLAGS="$ac_save_CFLAGS $ac_arg" - # This test program should *not* compile successfully. - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -int -main (void) -{ -(void) strchr; - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO" -then : - -else $as_nop - # This test program should compile successfully. - # No library function is consistently available on - # freestanding implementations, so test against a dummy - # declaration. Include always-available headers on the - # off chance that they somehow elicit warnings. - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include -#include -#include -#include -extern void ac_decl (int, char *); - -int -main (void) -{ -(void) ac_decl (0, (char *) 0); - (void) ac_decl; - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO" -then : - if test x"$ac_arg" = x -then : - ac_cv_c_undeclared_builtin_options='none needed' -else $as_nop - ac_cv_c_undeclared_builtin_options=$ac_arg -fi - break -fi -rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext -fi -rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext - done - CFLAGS=$ac_save_CFLAGS - -fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_undeclared_builtin_options" >&5 -printf "%s\n" "$ac_cv_c_undeclared_builtin_options" >&6; } - case $ac_cv_c_undeclared_builtin_options in #( - 'cannot detect') : - { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -printf "%s\n" "$as_me: error: in \`$ac_pwd':" >&2;} -as_fn_error $? "cannot make $CC report undeclared builtins -See \`config.log' for more details" "$LINENO" 5; } ;; #( - 'none needed') : - ac_c_undeclared_builtin_options='' ;; #( - *) : - ac_c_undeclared_builtin_options=$ac_cv_c_undeclared_builtin_options ;; -esac -ac_fn_check_decl "$LINENO" "be32dec" "ac_cv_have_decl_be32dec" "$ac_includes_default +ac_fn_c_check_decl "$LINENO" "be32dec" "ac_cv_have_decl_be32dec" "$ac_includes_default #ifdef HAVE_SYS_ENDIAN_H #include #endif -" "$ac_c_undeclared_builtin_options" "CFLAGS" -if test "x$ac_cv_have_decl_be32dec" = xyes -then : +" +if test "x$ac_cv_have_decl_be32dec" = xyes; then : ac_have_decl=1 -else $as_nop +else ac_have_decl=0 fi -printf "%s\n" "#define HAVE_DECL_BE32DEC $ac_have_decl" >>confdefs.h -ac_fn_check_decl "$LINENO" "le32dec" "ac_cv_have_decl_le32dec" "$ac_includes_default + +cat >>confdefs.h <<_ACEOF +#define HAVE_DECL_BE32DEC $ac_have_decl +_ACEOF +ac_fn_c_check_decl "$LINENO" "le32dec" "ac_cv_have_decl_le32dec" "$ac_includes_default #ifdef HAVE_SYS_ENDIAN_H #include #endif -" "$ac_c_undeclared_builtin_options" "CFLAGS" -if test "x$ac_cv_have_decl_le32dec" = xyes -then : +" +if test "x$ac_cv_have_decl_le32dec" = xyes; then : ac_have_decl=1 -else $as_nop +else ac_have_decl=0 fi -printf "%s\n" "#define HAVE_DECL_LE32DEC $ac_have_decl" >>confdefs.h -ac_fn_check_decl "$LINENO" "be32enc" "ac_cv_have_decl_be32enc" "$ac_includes_default + +cat >>confdefs.h <<_ACEOF +#define HAVE_DECL_LE32DEC $ac_have_decl +_ACEOF +ac_fn_c_check_decl "$LINENO" "be32enc" "ac_cv_have_decl_be32enc" "$ac_includes_default #ifdef HAVE_SYS_ENDIAN_H #include #endif -" "$ac_c_undeclared_builtin_options" "CFLAGS" -if test "x$ac_cv_have_decl_be32enc" = xyes -then : +" +if test "x$ac_cv_have_decl_be32enc" = xyes; then : ac_have_decl=1 -else $as_nop +else ac_have_decl=0 fi -printf "%s\n" "#define HAVE_DECL_BE32ENC $ac_have_decl" >>confdefs.h -ac_fn_check_decl "$LINENO" "le32enc" "ac_cv_have_decl_le32enc" "$ac_includes_default + +cat >>confdefs.h <<_ACEOF +#define HAVE_DECL_BE32ENC $ac_have_decl +_ACEOF +ac_fn_c_check_decl "$LINENO" "le32enc" "ac_cv_have_decl_le32enc" "$ac_includes_default #ifdef HAVE_SYS_ENDIAN_H #include #endif -" "$ac_c_undeclared_builtin_options" "CFLAGS" -if test "x$ac_cv_have_decl_le32enc" = xyes -then : +" +if test "x$ac_cv_have_decl_le32enc" = xyes; then : ac_have_decl=1 -else $as_nop +else ac_have_decl=0 fi -printf "%s\n" "#define HAVE_DECL_LE32ENC $ac_have_decl" >>confdefs.h -ac_fn_check_decl "$LINENO" "le16dec" "ac_cv_have_decl_le16dec" "$ac_includes_default + +cat >>confdefs.h <<_ACEOF +#define HAVE_DECL_LE32ENC $ac_have_decl +_ACEOF +ac_fn_c_check_decl "$LINENO" "le16dec" "ac_cv_have_decl_le16dec" "$ac_includes_default #ifdef HAVE_SYS_ENDIAN_H #include #endif -" "$ac_c_undeclared_builtin_options" "CFLAGS" -if test "x$ac_cv_have_decl_le16dec" = xyes -then : +" +if test "x$ac_cv_have_decl_le16dec" = xyes; then : ac_have_decl=1 -else $as_nop +else ac_have_decl=0 fi -printf "%s\n" "#define HAVE_DECL_LE16DEC $ac_have_decl" >>confdefs.h -ac_fn_check_decl "$LINENO" "le16enc" "ac_cv_have_decl_le16enc" "$ac_includes_default + +cat >>confdefs.h <<_ACEOF +#define HAVE_DECL_LE16DEC $ac_have_decl +_ACEOF +ac_fn_c_check_decl "$LINENO" "le16enc" "ac_cv_have_decl_le16enc" "$ac_includes_default #ifdef HAVE_SYS_ENDIAN_H #include #endif -" "$ac_c_undeclared_builtin_options" "CFLAGS" -if test "x$ac_cv_have_decl_le16enc" = xyes -then : +" +if test "x$ac_cv_have_decl_le16enc" = xyes; then : ac_have_decl=1 -else $as_nop +else ac_have_decl=0 fi -printf "%s\n" "#define HAVE_DECL_LE16ENC $ac_have_decl" >>confdefs.h + +cat >>confdefs.h <<_ACEOF +#define HAVE_DECL_LE16ENC $ac_have_decl +_ACEOF ac_fn_c_check_type "$LINENO" "size_t" "ac_cv_type_size_t" "$ac_includes_default" -if test "x$ac_cv_type_size_t" = xyes -then : +if test "x$ac_cv_type_size_t" = xyes; then : -else $as_nop +else -printf "%s\n" "#define size_t unsigned int" >>confdefs.h +cat >>confdefs.h <<_ACEOF +#define size_t unsigned int +_ACEOF fi # The Ultrix 4.2 mips builtin alloca declared by alloca.h only works # for constant arguments. Useless! -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for working alloca.h" >&5 -printf %s "checking for working alloca.h... " >&6; } -if test ${ac_cv_working_alloca_h+y} -then : - printf %s "(cached) " >&6 -else $as_nop +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for working alloca.h" >&5 +$as_echo_n "checking for working alloca.h... " >&6; } +if ${ac_cv_working_alloca_h+:} false; then : + $as_echo_n "(cached) " >&6 +else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include int -main (void) +main () { char *p = (char *) alloca (2 * sizeof (int)); if (p) return 0; @@ -6365,52 +5534,52 @@ char *p = (char *) alloca (2 * sizeof (int)); return 0; } _ACEOF -if ac_fn_c_try_link "$LINENO" -then : +if ac_fn_c_try_link "$LINENO"; then : ac_cv_working_alloca_h=yes -else $as_nop +else ac_cv_working_alloca_h=no fi -rm -f core conftest.err conftest.$ac_objext conftest.beam \ +rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_working_alloca_h" >&5 -printf "%s\n" "$ac_cv_working_alloca_h" >&6; } +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_working_alloca_h" >&5 +$as_echo "$ac_cv_working_alloca_h" >&6; } if test $ac_cv_working_alloca_h = yes; then -printf "%s\n" "#define HAVE_ALLOCA_H 1" >>confdefs.h +$as_echo "#define HAVE_ALLOCA_H 1" >>confdefs.h fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for alloca" >&5 -printf %s "checking for alloca... " >&6; } -if test ${ac_cv_func_alloca_works+y} -then : - printf %s "(cached) " >&6 -else $as_nop - if test $ac_cv_working_alloca_h = yes; then - ac_cv_func_alloca_works=yes +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for alloca" >&5 +$as_echo_n "checking for alloca... " >&6; } +if ${ac_cv_func_alloca_works+:} false; then : + $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ -#include -#include -#ifndef alloca -# ifdef __GNUC__ -# define alloca __builtin_alloca -# elif defined _MSC_VER +#ifdef __GNUC__ +# define alloca __builtin_alloca +#else +# ifdef _MSC_VER # include # define alloca _alloca # else -# ifdef __cplusplus -extern "C" -# endif +# ifdef HAVE_ALLOCA_H +# include +# else +# ifdef _AIX + #pragma alloca +# else +# ifndef alloca /* predefined by HP cc +Olibcalls */ void *alloca (size_t); +# endif +# endif +# endif # endif #endif int -main (void) +main () { char *p = (char *) alloca (1); if (p) return 0; @@ -6418,22 +5587,20 @@ char *p = (char *) alloca (1); return 0; } _ACEOF -if ac_fn_c_try_link "$LINENO" -then : +if ac_fn_c_try_link "$LINENO"; then : ac_cv_func_alloca_works=yes -else $as_nop +else ac_cv_func_alloca_works=no fi -rm -f core conftest.err conftest.$ac_objext conftest.beam \ +rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_func_alloca_works" >&5 -printf "%s\n" "$ac_cv_func_alloca_works" >&6; } -fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_func_alloca_works" >&5 +$as_echo "$ac_cv_func_alloca_works" >&6; } if test $ac_cv_func_alloca_works = yes; then -printf "%s\n" "#define HAVE_ALLOCA 1" >>confdefs.h +$as_echo "#define HAVE_ALLOCA 1" >>confdefs.h else # The SVR3 libPW and SVR4 libucb both contain incompatible functions @@ -6443,19 +5610,58 @@ else ALLOCA=\${LIBOBJDIR}alloca.$ac_objext -printf "%s\n" "#define C_ALLOCA 1" >>confdefs.h +$as_echo "#define C_ALLOCA 1" >>confdefs.h + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether \`alloca.c' needs Cray hooks" >&5 +$as_echo_n "checking whether \`alloca.c' needs Cray hooks... " >&6; } +if ${ac_cv_os_cray+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#if defined CRAY && ! defined CRAY2 +webecray +#else +wenotbecray +#endif + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "webecray" >/dev/null 2>&1; then : + ac_cv_os_cray=yes +else + ac_cv_os_cray=no +fi +rm -f conftest* + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_os_cray" >&5 +$as_echo "$ac_cv_os_cray" >&6; } +if test $ac_cv_os_cray = yes; then + for ac_func in _getb67 GETB67 getb67; do + as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` +ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var" +if eval test \"x\$"$as_ac_var"\" = x"yes"; then : + +cat >>confdefs.h <<_ACEOF +#define CRAY_STACKSEG_END $ac_func +_ACEOF + + break +fi + done +fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking stack direction for C alloca" >&5 -printf %s "checking stack direction for C alloca... " >&6; } -if test ${ac_cv_c_stack_direction+y} -then : - printf %s "(cached) " >&6 -else $as_nop - if test "$cross_compiling" = yes -then : +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking stack direction for C alloca" >&5 +$as_echo_n "checking stack direction for C alloca... " >&6; } +if ${ac_cv_c_stack_direction+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test "$cross_compiling" = yes; then : ac_cv_c_stack_direction=0 -else $as_nop +else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $ac_includes_default @@ -6476,10 +5682,9 @@ main (int argc, char **argv) return find_stack_direction (0, argc + !argv + 20) < 0; } _ACEOF -if ac_fn_c_try_run "$LINENO" -then : +if ac_fn_c_try_run "$LINENO"; then : ac_cv_c_stack_direction=1 -else $as_nop +else ac_cv_c_stack_direction=-1 fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ @@ -6487,19 +5692,25 @@ rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ fi fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_stack_direction" >&5 -printf "%s\n" "$ac_cv_c_stack_direction" >&6; } -printf "%s\n" "#define STACK_DIRECTION $ac_cv_c_stack_direction" >>confdefs.h +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_stack_direction" >&5 +$as_echo "$ac_cv_c_stack_direction" >&6; } +cat >>confdefs.h <<_ACEOF +#define STACK_DIRECTION $ac_cv_c_stack_direction +_ACEOF fi -ac_fn_c_check_func "$LINENO" "getopt_long" "ac_cv_func_getopt_long" -if test "x$ac_cv_func_getopt_long" = xyes -then : - printf "%s\n" "#define HAVE_GETOPT_LONG 1" >>confdefs.h +for ac_func in getopt_long +do : + ac_fn_c_check_func "$LINENO" "getopt_long" "ac_cv_func_getopt_long" +if test "x$ac_cv_func_getopt_long" = xyes; then : + cat >>confdefs.h <<_ACEOF +#define HAVE_GETOPT_LONG 1 +_ACEOF fi +done MINGW_TARGET=`$CC -dumpmachine 2>&1` @@ -6531,143 +5742,137 @@ case $MINGW_TARGET in esac # Check whether --enable-assembly was given. -if test ${enable_assembly+y} -then : +if test "${enable_assembly+set}" = set; then : enableval=$enable_assembly; fi if test x$enable_assembly != xno; then -printf "%s\n" "#define USE_ASM 1" >>confdefs.h +$as_echo "#define USE_ASM 1" >>confdefs.h fi if test x$enable_assembly != xno -a x$have_x86_64 = xtrue then - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether we can compile AVX code" >&5 -printf %s "checking whether we can compile AVX code... " >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we can compile AVX code" >&5 +$as_echo_n "checking whether we can compile AVX code... " >&6; } cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int -main (void) +main () { asm ("vmovdqa %ymm0, %ymm1"); ; return 0; } _ACEOF -if ac_fn_c_try_compile "$LINENO" -then : +if ac_fn_c_try_compile "$LINENO"; then : -printf "%s\n" "#define USE_AVX 1" >>confdefs.h +$as_echo "#define USE_AVX 1" >>confdefs.h - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -printf "%s\n" "yes" >&6; } - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether we can compile XOP code" >&5 -printf %s "checking whether we can compile XOP code... " >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we can compile XOP code" >&5 +$as_echo_n "checking whether we can compile XOP code... " >&6; } cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int -main (void) +main () { asm ("vprotd \$7, %xmm0, %xmm1"); ; return 0; } _ACEOF -if ac_fn_c_try_compile "$LINENO" -then : +if ac_fn_c_try_compile "$LINENO"; then : -printf "%s\n" "#define USE_XOP 1" >>confdefs.h +$as_echo "#define USE_XOP 1" >>confdefs.h - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -printf "%s\n" "yes" >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } -else $as_nop - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 -printf "%s\n" "no" >&6; } - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: The assembler does not support the XOP instruction set." >&5 -printf "%s\n" "$as_me: WARNING: The assembler does not support the XOP instruction set." >&2;} +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: The assembler does not support the XOP instruction set." >&5 +$as_echo "$as_me: WARNING: The assembler does not support the XOP instruction set." >&2;} fi -rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether we can compile AVX2 code" >&5 -printf %s "checking whether we can compile AVX2 code... " >&6; } +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we can compile AVX2 code" >&5 +$as_echo_n "checking whether we can compile AVX2 code... " >&6; } cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int -main (void) +main () { asm ("vpaddd %ymm0, %ymm1, %ymm2"); ; return 0; } _ACEOF -if ac_fn_c_try_compile "$LINENO" -then : +if ac_fn_c_try_compile "$LINENO"; then : -printf "%s\n" "#define USE_AVX2 1" >>confdefs.h +$as_echo "#define USE_AVX2 1" >>confdefs.h - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -printf "%s\n" "yes" >&6; } - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether we can compile AVX512 code" >&5 -printf %s "checking whether we can compile AVX512 code... " >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we can compile AVX512 code" >&5 +$as_echo_n "checking whether we can compile AVX512 code... " >&6; } cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int -main (void) +main () { asm ("vpaddd %zmm0, %zmm1, %zmm2{%k1}"); ; return 0; } _ACEOF -if ac_fn_c_try_compile "$LINENO" -then : +if ac_fn_c_try_compile "$LINENO"; then : -printf "%s\n" "#define USE_AVX512 1" >>confdefs.h +$as_echo "#define USE_AVX512 1" >>confdefs.h - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -printf "%s\n" "yes" >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } -else $as_nop - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 -printf "%s\n" "no" >&6; } - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: The assembler does not support the AVX512 instruction set." >&5 -printf "%s\n" "$as_me: WARNING: The assembler does not support the AVX512 instruction set." >&2;} +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: The assembler does not support the AVX512 instruction set." >&5 +$as_echo "$as_me: WARNING: The assembler does not support the AVX512 instruction set." >&2;} fi -rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -else $as_nop - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 -printf "%s\n" "no" >&6; } - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: The assembler does not support the AVX2 instruction set." >&5 -printf "%s\n" "$as_me: WARNING: The assembler does not support the AVX2 instruction set." >&2;} +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: The assembler does not support the AVX2 instruction set." >&5 +$as_echo "$as_me: WARNING: The assembler does not support the AVX2 instruction set." >&2;} fi -rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -else $as_nop - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 -printf "%s\n" "no" >&6; } - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: The assembler does not support the AVX instruction set." >&5 -printf "%s\n" "$as_me: WARNING: The assembler does not support the AVX instruction set." >&2;} +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: The assembler does not support the AVX instruction set." >&5 +$as_echo "$as_me: WARNING: The assembler does not support the AVX instruction set." >&2;} fi -rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for json_loads in -ljansson" >&5 -printf %s "checking for json_loads in -ljansson... " >&6; } -if test ${ac_cv_lib_jansson_json_loads+y} -then : - printf %s "(cached) " >&6 -else $as_nop +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for json_loads in -ljansson" >&5 +$as_echo_n "checking for json_loads in -ljansson... " >&6; } +if ${ac_cv_lib_jansson_json_loads+:} false; then : + $as_echo_n "(cached) " >&6 +else ac_check_lib_save_LIBS=$LIBS LIBS="-ljansson $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -6676,31 +5881,32 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif char json_loads (); int -main (void) +main () { return json_loads (); ; return 0; } _ACEOF -if ac_fn_c_try_link "$LINENO" -then : +if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_jansson_json_loads=yes -else $as_nop +else ac_cv_lib_jansson_json_loads=no fi -rm -f core conftest.err conftest.$ac_objext conftest.beam \ +rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_jansson_json_loads" >&5 -printf "%s\n" "$ac_cv_lib_jansson_json_loads" >&6; } -if test "x$ac_cv_lib_jansson_json_loads" = xyes -then : +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_jansson_json_loads" >&5 +$as_echo "$ac_cv_lib_jansson_json_loads" >&6; } +if test "x$ac_cv_lib_jansson_json_loads" = xyes; then : request_jansson=false -else $as_nop +else request_jansson=true fi @@ -6708,12 +5914,11 @@ fi # GC2 for GNU static if test "x$have_win32" = "xtrue" ; then # MinGW - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for pthread_create in -lpthread" >&5 -printf %s "checking for pthread_create in -lpthread... " >&6; } -if test ${ac_cv_lib_pthread_pthread_create+y} -then : - printf %s "(cached) " >&6 -else $as_nop + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for pthread_create in -lpthread" >&5 +$as_echo_n "checking for pthread_create in -lpthread... " >&6; } +if ${ac_cv_lib_pthread_pthread_create+:} false; then : + $as_echo_n "(cached) " >&6 +else ac_check_lib_save_LIBS=$LIBS LIBS="-lpthread $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -6722,39 +5927,39 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif char pthread_create (); int -main (void) +main () { return pthread_create (); ; return 0; } _ACEOF -if ac_fn_c_try_link "$LINENO" -then : +if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_pthread_pthread_create=yes -else $as_nop +else ac_cv_lib_pthread_pthread_create=no fi -rm -f core conftest.err conftest.$ac_objext conftest.beam \ +rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_pthread_pthread_create" >&5 -printf "%s\n" "$ac_cv_lib_pthread_pthread_create" >&6; } -if test "x$ac_cv_lib_pthread_pthread_create" = xyes -then : +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_pthread_pthread_create" >&5 +$as_echo "$ac_cv_lib_pthread_pthread_create" >&6; } +if test "x$ac_cv_lib_pthread_pthread_create" = xyes; then : PTHREAD_LIBS="-lpthreadGC2" fi else - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for pthread_create in -lpthread" >&5 -printf %s "checking for pthread_create in -lpthread... " >&6; } -if test ${ac_cv_lib_pthread_pthread_create+y} -then : - printf %s "(cached) " >&6 -else $as_nop + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for pthread_create in -lpthread" >&5 +$as_echo_n "checking for pthread_create in -lpthread... " >&6; } +if ${ac_cv_lib_pthread_pthread_create+:} false; then : + $as_echo_n "(cached) " >&6 +else ac_check_lib_save_LIBS=$LIBS LIBS="-lpthread $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -6763,29 +5968,30 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif char pthread_create (); int -main (void) +main () { return pthread_create (); ; return 0; } _ACEOF -if ac_fn_c_try_link "$LINENO" -then : +if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_pthread_pthread_create=yes -else $as_nop +else ac_cv_lib_pthread_pthread_create=no fi -rm -f core conftest.err conftest.$ac_objext conftest.beam \ +rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_pthread_pthread_create" >&5 -printf "%s\n" "$ac_cv_lib_pthread_pthread_create" >&6; } -if test "x$ac_cv_lib_pthread_pthread_create" = xyes -then : +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_pthread_pthread_create" >&5 +$as_echo "$ac_cv_lib_pthread_pthread_create" >&6; } +if test "x$ac_cv_lib_pthread_pthread_create" = xyes; then : PTHREAD_LIBS="-lpthread" fi @@ -6794,33 +6000,32 @@ fi LDFLAGS="$PTHREAD_LDFLAGS $LDFLAGS" # PTHREAD_LIBS="$PTHREAD_LIBS" -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether __uint128_t is supported" >&5 -printf %s "checking whether __uint128_t is supported... " >&6; } +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether __uint128_t is supported" >&5 +$as_echo_n "checking whether __uint128_t is supported... " >&6; } cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ static __uint128_t i = 100; int -main (void) +main () { ; return 0; } _ACEOF -if ac_fn_c_try_compile "$LINENO" -then : +if ac_fn_c_try_compile "$LINENO"; then : -printf "%s\n" "#define USE_INT128 1" >>confdefs.h +$as_echo "#define USE_INT128 1" >>confdefs.h - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -printf "%s\n" "yes" >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } -else $as_nop - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 -printf "%s\n" "no" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } fi -rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext # allow if in Makefile.am if test x$request_jansson = xtrue; then @@ -6889,8 +6094,7 @@ fi # libcurl install path (for mingw : --with-curl=/usr/local) # Check whether --with-curl was given. -if test ${with_curl+y} -then : +if test "${with_curl+set}" = set; then : withval=$with_curl; fi @@ -6905,8 +6109,7 @@ fi # SSL install path (for mingw : --with-crypto=/usr/local/ssl) # Check whether --with-crypto was given. -if test ${with_crypto+y} -then : +if test "${with_crypto+set}" = set; then : withval=$with_crypto; fi @@ -6972,8 +6175,8 @@ _ACEOF case $ac_val in #( *${as_nl}*) case $ac_var in #( - *_cv_*) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5 -printf "%s\n" "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; + *_cv_*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5 +$as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; esac case $ac_var in #( _ | IFS | as_nl) ;; #( @@ -7003,15 +6206,15 @@ printf "%s\n" "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} /^ac_cv_env_/b end t clear :clear - s/^\([^=]*\)=\(.*[{}].*\)$/test ${\1+y} || &/ + s/^\([^=]*\)=\(.*[{}].*\)$/test "${\1+set}" = set || &/ t end s/^\([^=]*\)=\(.*\)$/\1=${\1=\2}/ :end' >>confcache if diff "$cache_file" confcache >/dev/null 2>&1; then :; else if test -w "$cache_file"; then if test "x$cache_file" != "x/dev/null"; then - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: updating cache $cache_file" >&5 -printf "%s\n" "$as_me: updating cache $cache_file" >&6;} + { $as_echo "$as_me:${as_lineno-$LINENO}: updating cache $cache_file" >&5 +$as_echo "$as_me: updating cache $cache_file" >&6;} if test ! -f "$cache_file" || test -h "$cache_file"; then cat confcache >"$cache_file" else @@ -7025,8 +6228,8 @@ printf "%s\n" "$as_me: updating cache $cache_file" >&6;} fi fi else - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: not updating unwritable cache $cache_file" >&5 -printf "%s\n" "$as_me: not updating unwritable cache $cache_file" >&6;} + { $as_echo "$as_me:${as_lineno-$LINENO}: not updating unwritable cache $cache_file" >&5 +$as_echo "$as_me: not updating unwritable cache $cache_file" >&6;} fi fi rm -f confcache @@ -7043,7 +6246,7 @@ U= for ac_i in : $LIBOBJS; do test "x$ac_i" = x: && continue # 1. Remove the extension, and $U if already installed. ac_script='s/\$U\././;s/\.o$//;s/\.obj$//' - ac_i=`printf "%s\n" "$ac_i" | sed "$ac_script"` + ac_i=`$as_echo "$ac_i" | sed "$ac_script"` # 2. Prepend LIBOBJDIR. When used with automake>=1.10 LIBOBJDIR # will be set to the directory where LIBOBJS objects are built. as_fn_append ac_libobjs " \${LIBOBJDIR}$ac_i\$U.$ac_objext" @@ -7054,14 +6257,14 @@ LIBOBJS=$ac_libobjs LTLIBOBJS=$ac_ltlibobjs -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking that generated files are newer than configure" >&5 -printf %s "checking that generated files are newer than configure... " >&6; } +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking that generated files are newer than configure" >&5 +$as_echo_n "checking that generated files are newer than configure... " >&6; } if test -n "$am_sleep_pid"; then # Hide warnings about reused PIDs. wait $am_sleep_pid 2>/dev/null fi - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: done" >&5 -printf "%s\n" "done" >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: result: done" >&5 +$as_echo "done" >&6; } if test -n "$EXEEXT"; then am__EXEEXT_TRUE= am__EXEEXT_FALSE='#' @@ -7123,8 +6326,8 @@ fi ac_write_fail=0 ac_clean_files_save=$ac_clean_files ac_clean_files="$ac_clean_files $CONFIG_STATUS" -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: creating $CONFIG_STATUS" >&5 -printf "%s\n" "$as_me: creating $CONFIG_STATUS" >&6;} +{ $as_echo "$as_me:${as_lineno-$LINENO}: creating $CONFIG_STATUS" >&5 +$as_echo "$as_me: creating $CONFIG_STATUS" >&6;} as_write_fail=0 cat >$CONFIG_STATUS <<_ASEOF || as_write_fail=1 #! $SHELL @@ -7147,16 +6350,14 @@ cat >>$CONFIG_STATUS <<\_ASEOF || as_write_fail=1 # Be more Bourne compatible DUALCASE=1; export DUALCASE # for MKS sh -as_nop=: -if test ${ZSH_VERSION+y} && (emulate sh) >/dev/null 2>&1 -then : +if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then : emulate sh NULLCMD=: # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which # is contrary to our usage. Disable this feature. alias -g '${1+"$@"}'='"$@"' setopt NO_GLOB_SUBST -else $as_nop +else case `(set -o) 2>/dev/null` in #( *posix*) : set -o posix ;; #( @@ -7166,46 +6367,46 @@ esac fi - -# Reset variables that may have inherited troublesome values from -# the environment. - -# IFS needs to be set, to space, tab, and newline, in precisely that order. -# (If _AS_PATH_WALK were called with IFS unset, it would have the -# side effect of setting IFS to empty, thus disabling word splitting.) -# Quoting is to prevent editors from complaining about space-tab. as_nl=' ' export as_nl -IFS=" "" $as_nl" - -PS1='$ ' -PS2='> ' -PS4='+ ' - -# Ensure predictable behavior from utilities with locale-dependent output. -LC_ALL=C -export LC_ALL -LANGUAGE=C -export LANGUAGE - -# We cannot yet rely on "unset" to work, but we need these variables -# to be unset--not just set to an empty or harmless value--now, to -# avoid bugs in old shells (e.g. pre-3.0 UWIN ksh). This construct -# also avoids known problems related to "unset" and subshell syntax -# in other old shells (e.g. bash 2.01 and pdksh 5.2.14). -for as_var in BASH_ENV ENV MAIL MAILPATH CDPATH -do eval test \${$as_var+y} \ - && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || : -done - -# Ensure that fds 0, 1, and 2 are open. -if (exec 3>&0) 2>/dev/null; then :; else exec 0&1) 2>/dev/null; then :; else exec 1>/dev/null; fi -if (exec 3>&2) ; then :; else exec 2>/dev/null; fi +# Printing a long string crashes Solaris 7 /usr/bin/printf. +as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' +as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo +as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo +# Prefer a ksh shell builtin over an external printf program on Solaris, +# but without wasting forks for bash or zsh. +if test -z "$BASH_VERSION$ZSH_VERSION" \ + && (test "X`print -r -- $as_echo`" = "X$as_echo") 2>/dev/null; then + as_echo='print -r --' + as_echo_n='print -rn --' +elif (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then + as_echo='printf %s\n' + as_echo_n='printf %s' +else + if test "X`(/usr/ucb/echo -n -n $as_echo) 2>/dev/null`" = "X-n $as_echo"; then + as_echo_body='eval /usr/ucb/echo -n "$1$as_nl"' + as_echo_n='/usr/ucb/echo -n' + else + as_echo_body='eval expr "X$1" : "X\\(.*\\)"' + as_echo_n_body='eval + arg=$1; + case $arg in #( + *"$as_nl"*) + expr "X$arg" : "X\\(.*\\)$as_nl"; + arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;; + esac; + expr "X$arg" : "X\\(.*\\)" | tr -d "$as_nl" + ' + export as_echo_n_body + as_echo_n='sh -c $as_echo_n_body as_echo' + fi + export as_echo_body + as_echo='sh -c $as_echo_body as_echo' +fi # The user is always right. -if ${PATH_SEPARATOR+false} :; then +if test "${PATH_SEPARATOR+set}" != set; then PATH_SEPARATOR=: (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && { (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 || @@ -7214,6 +6415,13 @@ if ${PATH_SEPARATOR+false} :; then fi +# IFS +# We need space, tab and new line, in precisely that order. Quoting is +# there to prevent editors from complaining about space-tab. +# (If _AS_PATH_WALK were called with IFS unset, it would disable word +# splitting by setting IFS to empty value.) +IFS=" "" $as_nl" + # Find who we are. Look in the path if we contain no directory separator. as_myself= case $0 in #(( @@ -7222,12 +6430,8 @@ case $0 in #(( for as_dir in $PATH do IFS=$as_save_IFS - case $as_dir in #((( - '') as_dir=./ ;; - */) ;; - *) as_dir=$as_dir/ ;; - esac - test -r "$as_dir$0" && as_myself=$as_dir$0 && break + test -z "$as_dir" && as_dir=. + test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break done IFS=$as_save_IFS @@ -7239,10 +6443,30 @@ if test "x$as_myself" = x; then as_myself=$0 fi if test ! -f "$as_myself"; then - printf "%s\n" "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 + $as_echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 exit 1 fi +# Unset variables that we do not need and which cause bugs (e.g. in +# pre-3.0 UWIN ksh). But do not cause bugs in bash 2.01; the "|| exit 1" +# suppresses any "Segmentation fault" message there. '((' could +# trigger a bug in pdksh 5.2.14. +for as_var in BASH_ENV ENV MAIL MAILPATH +do eval test x\${$as_var+set} = xset \ + && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || : +done +PS1='$ ' +PS2='> ' +PS4='+ ' + +# NLS nuisances. +LC_ALL=C +export LC_ALL +LANGUAGE=C +export LANGUAGE + +# CDPATH. +(unset CDPATH) >/dev/null 2>&1 && unset CDPATH # as_fn_error STATUS ERROR [LINENO LOG_FD] @@ -7255,14 +6479,13 @@ as_fn_error () as_status=$1; test $as_status -eq 0 && as_status=1 if test "$4"; then as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: $2" >&$4 + $as_echo "$as_me:${as_lineno-$LINENO}: error: $2" >&$4 fi - printf "%s\n" "$as_me: error: $2" >&2 + $as_echo "$as_me: error: $2" >&2 as_fn_exit $as_status } # as_fn_error - # as_fn_set_status STATUS # ----------------------- # Set $? to STATUS, without forking. @@ -7289,20 +6512,18 @@ as_fn_unset () { eval $1=; unset $1;} } as_unset=as_fn_unset - # as_fn_append VAR VALUE # ---------------------- # Append the text in VALUE to the end of the definition contained in VAR. Take # advantage of any shell optimizations that allow amortized linear growth over # repeated appends, instead of the typical quadratic growth present in naive # implementations. -if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null -then : +if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null; then : eval 'as_fn_append () { eval $1+=\$2 }' -else $as_nop +else as_fn_append () { eval $1=\$$1\$2 @@ -7314,13 +6535,12 @@ fi # as_fn_append # Perform arithmetic evaluation on the ARGs, and store the result in the # global $as_val. Take advantage of shells that can avoid forks. The arguments # must be portable across $(()) and expr. -if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null -then : +if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null; then : eval 'as_fn_arith () { as_val=$(( $* )) }' -else $as_nop +else as_fn_arith () { as_val=`expr "$@" || test $? -eq 1` @@ -7351,7 +6571,7 @@ as_me=`$as_basename -- "$0" || $as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ X"$0" : 'X\(//\)$' \| \ X"$0" : 'X\(/\)' \| . 2>/dev/null || -printf "%s\n" X/"$0" | +$as_echo X/"$0" | sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/ q @@ -7373,10 +6593,6 @@ as_cr_Letters=$as_cr_letters$as_cr_LETTERS as_cr_digits='0123456789' as_cr_alnum=$as_cr_Letters$as_cr_digits - -# Determine whether it's possible to make 'echo' print without a newline. -# These variables are no longer used directly by Autoconf, but are AC_SUBSTed -# for compatibility with existing Makefiles. ECHO_C= ECHO_N= ECHO_T= case `echo -n x` in #((((( -n*) @@ -7390,12 +6606,6 @@ case `echo -n x` in #((((( ECHO_N='-n';; esac -# For backward compatibility with old third-party macros, we provide -# the shell variables $as_echo and $as_echo_n. New code should use -# AS_ECHO(["message"]) and AS_ECHO_N(["message"]), respectively. -as_echo='printf %s\n' -as_echo_n='printf %s' - rm -f conf$$ conf$$.exe conf$$.file if test -d conf$$.dir; then rm -f conf$$.dir/conf$$.file @@ -7437,7 +6647,7 @@ as_fn_mkdir_p () as_dirs= while :; do case $as_dir in #( - *\'*) as_qdir=`printf "%s\n" "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'( + *\'*) as_qdir=`$as_echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'( *) as_qdir=$as_dir;; esac as_dirs="'$as_qdir' $as_dirs" @@ -7446,7 +6656,7 @@ $as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$as_dir" : 'X\(//\)[^/]' \| \ X"$as_dir" : 'X\(//\)$' \| \ X"$as_dir" : 'X\(/\)' \| . 2>/dev/null || -printf "%s\n" X"$as_dir" | +$as_echo X"$as_dir" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q @@ -7508,8 +6718,8 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" -This file was extended by cpuminer-opt $as_me 23.5, which was -generated by GNU Autoconf 2.71. Invocation command line was +This file was extended by cpuminer-opt $as_me 23.7, which was +generated by GNU Autoconf 2.69. Invocation command line was CONFIG_FILES = $CONFIG_FILES CONFIG_HEADERS = $CONFIG_HEADERS @@ -7571,16 +6781,14 @@ $config_commands Report bugs to the package provider." _ACEOF -ac_cs_config=`printf "%s\n" "$ac_configure_args" | sed "$ac_safe_unquote"` -ac_cs_config_escaped=`printf "%s\n" "$ac_cs_config" | sed "s/^ //; s/'/'\\\\\\\\''/g"` cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 -ac_cs_config='$ac_cs_config_escaped' +ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\ -cpuminer-opt config.status 23.5 -configured by $0, generated by GNU Autoconf 2.71, +cpuminer-opt config.status 23.7 +configured by $0, generated by GNU Autoconf 2.69, with options \\"\$ac_cs_config\\" -Copyright (C) 2021 Free Software Foundation, Inc. +Copyright (C) 2012 Free Software Foundation, Inc. This config.status script is free software; the Free Software Foundation gives unlimited permission to copy, distribute and modify it." @@ -7620,15 +6828,15 @@ do -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r) ac_cs_recheck=: ;; --version | --versio | --versi | --vers | --ver | --ve | --v | -V ) - printf "%s\n" "$ac_cs_version"; exit ;; + $as_echo "$ac_cs_version"; exit ;; --config | --confi | --conf | --con | --co | --c ) - printf "%s\n" "$ac_cs_config"; exit ;; + $as_echo "$ac_cs_config"; exit ;; --debug | --debu | --deb | --de | --d | -d ) debug=: ;; --file | --fil | --fi | --f ) $ac_shift case $ac_optarg in - *\'*) ac_optarg=`printf "%s\n" "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;; + *\'*) ac_optarg=`$as_echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;; '') as_fn_error $? "missing file argument" ;; esac as_fn_append CONFIG_FILES " '$ac_optarg'" @@ -7636,7 +6844,7 @@ do --header | --heade | --head | --hea ) $ac_shift case $ac_optarg in - *\'*) ac_optarg=`printf "%s\n" "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;; + *\'*) ac_optarg=`$as_echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;; esac as_fn_append CONFIG_HEADERS " '$ac_optarg'" ac_need_defaults=false;; @@ -7645,7 +6853,7 @@ do as_fn_error $? "ambiguous option: \`$1' Try \`$0 --help' for more information.";; --help | --hel | -h ) - printf "%s\n" "$ac_cs_usage"; exit ;; + $as_echo "$ac_cs_usage"; exit ;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil | --si | --s) ac_cs_silent=: ;; @@ -7673,7 +6881,7 @@ cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 if \$ac_cs_recheck; then set X $SHELL '$0' $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion shift - \printf "%s\n" "running CONFIG_SHELL=$SHELL \$*" >&6 + \$as_echo "running CONFIG_SHELL=$SHELL \$*" >&6 CONFIG_SHELL='$SHELL' export CONFIG_SHELL exec "\$@" @@ -7687,7 +6895,7 @@ exec 5>>config.log sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX ## Running $as_me. ## _ASBOX - printf "%s\n" "$ac_log" + $as_echo "$ac_log" } >&5 _ACEOF @@ -7721,9 +6929,9 @@ done # We use the long form for the default assignment because of an extremely # bizarre bug on SunOS 4.1.3. if $ac_need_defaults; then - test ${CONFIG_FILES+y} || CONFIG_FILES=$config_files - test ${CONFIG_HEADERS+y} || CONFIG_HEADERS=$config_headers - test ${CONFIG_COMMANDS+y} || CONFIG_COMMANDS=$config_commands + test "${CONFIG_FILES+set}" = set || CONFIG_FILES=$config_files + test "${CONFIG_HEADERS+set}" = set || CONFIG_HEADERS=$config_headers + test "${CONFIG_COMMANDS+set}" = set || CONFIG_COMMANDS=$config_commands fi # Have a temporary directory for convenience. Make it in the build tree @@ -8059,7 +7267,7 @@ do esac || as_fn_error 1 "cannot find input file: \`$ac_f'" "$LINENO" 5;; esac - case $ac_f in *\'*) ac_f=`printf "%s\n" "$ac_f" | sed "s/'/'\\\\\\\\''/g"`;; esac + case $ac_f in *\'*) ac_f=`$as_echo "$ac_f" | sed "s/'/'\\\\\\\\''/g"`;; esac as_fn_append ac_file_inputs " '$ac_f'" done @@ -8067,17 +7275,17 @@ do # use $as_me), people would be surprised to read: # /* config.h. Generated by config.status. */ configure_input='Generated from '` - printf "%s\n" "$*" | sed 's|^[^:]*/||;s|:[^:]*/|, |g' + $as_echo "$*" | sed 's|^[^:]*/||;s|:[^:]*/|, |g' `' by configure.' if test x"$ac_file" != x-; then configure_input="$ac_file. $configure_input" - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: creating $ac_file" >&5 -printf "%s\n" "$as_me: creating $ac_file" >&6;} + { $as_echo "$as_me:${as_lineno-$LINENO}: creating $ac_file" >&5 +$as_echo "$as_me: creating $ac_file" >&6;} fi # Neutralize special characters interpreted by sed in replacement strings. case $configure_input in #( *\&* | *\|* | *\\* ) - ac_sed_conf_input=`printf "%s\n" "$configure_input" | + ac_sed_conf_input=`$as_echo "$configure_input" | sed 's/[\\\\&|]/\\\\&/g'`;; #( *) ac_sed_conf_input=$configure_input;; esac @@ -8094,7 +7302,7 @@ $as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$ac_file" : 'X\(//\)[^/]' \| \ X"$ac_file" : 'X\(//\)$' \| \ X"$ac_file" : 'X\(/\)' \| . 2>/dev/null || -printf "%s\n" X"$ac_file" | +$as_echo X"$ac_file" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q @@ -8118,9 +7326,9 @@ printf "%s\n" X"$ac_file" | case "$ac_dir" in .) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; *) - ac_dir_suffix=/`printf "%s\n" "$ac_dir" | sed 's|^\.[\\/]||'` + ac_dir_suffix=/`$as_echo "$ac_dir" | sed 's|^\.[\\/]||'` # A ".." for each directory in $ac_dir_suffix. - ac_top_builddir_sub=`printf "%s\n" "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'` + ac_top_builddir_sub=`$as_echo "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'` case $ac_top_builddir_sub in "") ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; @@ -8182,8 +7390,8 @@ ac_sed_dataroot=' case `eval "sed -n \"\$ac_sed_dataroot\" $ac_file_inputs"` in *datarootdir*) ac_datarootdir_seen=yes;; *@datadir@*|*@docdir@*|*@infodir@*|*@localedir@*|*@mandir@*) - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&5 -printf "%s\n" "$as_me: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&2;} + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&5 +$as_echo "$as_me: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&2;} _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_datarootdir_hack=' @@ -8227,9 +7435,9 @@ test -z "$ac_datarootdir_hack$ac_datarootdir_seen" && { ac_out=`sed -n '/\${datarootdir}/p' "$ac_tmp/out"`; test -n "$ac_out"; } && { ac_out=`sed -n '/^[ ]*datarootdir[ ]*:*=/p' \ "$ac_tmp/out"`; test -z "$ac_out"; } && - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file contains a reference to the variable \`datarootdir' + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file contains a reference to the variable \`datarootdir' which seems to be undefined. Please make sure it is defined" >&5 -printf "%s\n" "$as_me: WARNING: $ac_file contains a reference to the variable \`datarootdir' +$as_echo "$as_me: WARNING: $ac_file contains a reference to the variable \`datarootdir' which seems to be undefined. Please make sure it is defined" >&2;} rm -f "$ac_tmp/stdin" @@ -8245,20 +7453,20 @@ which seems to be undefined. Please make sure it is defined" >&2;} # if test x"$ac_file" != x-; then { - printf "%s\n" "/* $configure_input */" >&1 \ + $as_echo "/* $configure_input */" \ && eval '$AWK -f "$ac_tmp/defines.awk"' "$ac_file_inputs" } >"$ac_tmp/config.h" \ || as_fn_error $? "could not create $ac_file" "$LINENO" 5 if diff "$ac_file" "$ac_tmp/config.h" >/dev/null 2>&1; then - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: $ac_file is unchanged" >&5 -printf "%s\n" "$as_me: $ac_file is unchanged" >&6;} + { $as_echo "$as_me:${as_lineno-$LINENO}: $ac_file is unchanged" >&5 +$as_echo "$as_me: $ac_file is unchanged" >&6;} else rm -f "$ac_file" mv "$ac_tmp/config.h" "$ac_file" \ || as_fn_error $? "could not create $ac_file" "$LINENO" 5 fi else - printf "%s\n" "/* $configure_input */" >&1 \ + $as_echo "/* $configure_input */" \ && eval '$AWK -f "$ac_tmp/defines.awk"' "$ac_file_inputs" \ || as_fn_error $? "could not create -" "$LINENO" 5 fi @@ -8278,7 +7486,7 @@ $as_expr X"$_am_arg" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$_am_arg" : 'X\(//\)[^/]' \| \ X"$_am_arg" : 'X\(//\)$' \| \ X"$_am_arg" : 'X\(/\)' \| . 2>/dev/null || -printf "%s\n" X"$_am_arg" | +$as_echo X"$_am_arg" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q @@ -8298,8 +7506,8 @@ printf "%s\n" X"$_am_arg" | s/.*/./; q'`/stamp-h$_am_stamp_count ;; - :C) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: executing $ac_file commands" >&5 -printf "%s\n" "$as_me: executing $ac_file commands" >&6;} + :C) { $as_echo "$as_me:${as_lineno-$LINENO}: executing $ac_file commands" >&5 +$as_echo "$as_me: executing $ac_file commands" >&6;} ;; esac @@ -8325,7 +7533,7 @@ esac for am_mf do # Strip MF so we end up with the name of the file. - am_mf=`printf "%s\n" "$am_mf" | sed -e 's/:.*$//'` + am_mf=`$as_echo "$am_mf" | sed -e 's/:.*$//'` # Check whether this is an Automake generated Makefile which includes # dependency-tracking related rules and includes. # Grep'ing the whole file directly is not great: AIX grep has a line @@ -8337,7 +7545,7 @@ $as_expr X"$am_mf" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$am_mf" : 'X\(//\)[^/]' \| \ X"$am_mf" : 'X\(//\)$' \| \ X"$am_mf" : 'X\(/\)' \| . 2>/dev/null || -printf "%s\n" X"$am_mf" | +$as_echo X"$am_mf" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q @@ -8359,7 +7567,7 @@ printf "%s\n" X"$am_mf" | $as_expr X/"$am_mf" : '.*/\([^/][^/]*\)/*$' \| \ X"$am_mf" : 'X\(//\)$' \| \ X"$am_mf" : 'X\(/\)' \| . 2>/dev/null || -printf "%s\n" X/"$am_mf" | +$as_echo X/"$am_mf" | sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/ q @@ -8384,12 +7592,10 @@ printf "%s\n" X/"$am_mf" | (exit $ac_status); } || am_rc=$? done if test $am_rc -ne 0; then - { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -printf "%s\n" "$as_me: error: in \`$ac_pwd':" >&2;} + { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "Something went wrong bootstrapping makefile fragments - for automatic dependency tracking. If GNU make was not used, consider - re-running the configure script with MAKE=\"gmake\" (or whatever is - necessary). You can also try re-running configure with the + for automatic dependency tracking. Try re-running configure with the '--disable-dependency-tracking' option to at least be able to build the package (albeit without support for automatic dependency tracking). See \`config.log' for more details" "$LINENO" 5; } @@ -8435,8 +7641,7 @@ if test "$no_create" != yes; then $ac_cs_success || as_fn_exit 1 fi if test -n "$ac_unrecognized_opts" && test "$enable_option_checking" != no; then - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: unrecognized options: $ac_unrecognized_opts" >&5 -printf "%s\n" "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2;} + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: unrecognized options: $ac_unrecognized_opts" >&5 +$as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2;} fi - diff --git a/cpu-miner.c b/cpu-miner.c index adc9a0fb..3da0c3a5 100644 --- a/cpu-miner.c +++ b/cpu-miner.c @@ -3685,7 +3685,8 @@ void get_defconfig_path(char *out, size_t bufsize, char *argv0); #include "simd-utils.h" -#include "algo/sha/sha512-hash.h" +#include "algo/hamsi/hamsi-hash-4way.h" +#include "algo/hamsi/sph_hamsi.h" int main(int argc, char *argv[]) { @@ -3693,34 +3694,6 @@ int main(int argc, char *argv[]) long flags; int i, err; - -/* -uint64_t h1[8] __attribute__((aligned(32)));; -uint64_t h2[8*2] __attribute__((aligned(32))); -uint64_t hx[8*2] __attribute__((aligned(32))); - -uint64_t inp[20*2] __attribute__((aligned(32))) = {0}; - -sha512_2x64_context ctx2; -sph_sha512_context ctx1; - -sha512_2x64_ctx( &ctx2, h2, inp, 80 ); -sha512_2x64_init( &ctx2 ); -sha512_2x64_update( &ctx2, inp, 80 ); -sha512_2x64_close( &ctx2, h2 ); - -sph_sha512_init( &ctx1 ); -sph_sha512( &ctx1, inp, 80 ); -sph_sha512_close( &ctx1, h1 ); - - -printf("h1: %016lx %016lx %016lx %016lx %016lx %016lx %016lx %016lx\n", h1[0], h1[1], h1[2], h1[3], h1[4], h1[5], h1[6], h1[7]); - -printf("h2: %016lx %016lx %016lx %016lx %016lx %016lx %016lx %016lx\n\n", h2[0], h2[2], h2[4], h2[ 6], h2[ 8], h2[10], h2[12], h2[14]); - -exit(0); -*/ - pthread_mutex_init(&applog_lock, NULL); show_credits(); @@ -4082,7 +4055,7 @@ exit(0); applog( LOG_INFO, "%d of %d miner threads started using '%s' algorithm", opt_n_threads, num_cpus, algo_names[opt_algo] ); - /* main loop - simply wait for workio thread to exit */ + /* main loop - simply wait for workio thread to exit */ pthread_join( thr_info[work_thr_id].pth, NULL ); applog( LOG_WARNING, "workio thread dead, exiting." ); return 0; diff --git a/simd-utils/intrlv.h b/simd-utils/intrlv.h index 400d0ad5..e9813575 100644 --- a/simd-utils/intrlv.h +++ b/simd-utils/intrlv.h @@ -1527,6 +1527,17 @@ static inline void v128_bswap32_intrlv80_2x64( void *d, const void *src ) #endif } +static inline void extr_lane_2x64( void *dst, const void *src, + const int lane, const int bit_len ) +{ + uint64_t *d = (uint64_t*)dst; + const uint64_t *s = (const uint64_t*)src; + d[ 0] = s[ lane ]; d[ 1] = s[ lane+ 2 ]; + d[ 2] = s[ lane+ 4 ]; d[ 3] = s[ lane+ 6 ]; + if ( bit_len <= 256 ) return; + d[ 4] = s[ lane+ 8 ]; d[ 5] = s[ lane+10 ]; + d[ 6] = s[ lane+12 ]; d[ 7] = s[ lane+14 ]; +} // 4x64 (AVX2) diff --git a/simd-utils/simd-128.h b/simd-utils/simd-128.h index e60947ff..5a784f10 100644 --- a/simd-utils/simd-128.h +++ b/simd-utils/simd-128.h @@ -152,16 +152,6 @@ #define v128_unpacklo8 _mm_unpacklo_epi8 #define v128_unpackhi8 _mm_unpackhi_epi8 -// New shorter agnostic name -#define v128_ziplo64 _mm_unpacklo_epi64 -#define v128_ziphi64 _mm_unpackhi_epi64 -#define v128_ziplo32 _mm_unpacklo_epi32 -#define v128_ziphi32 _mm_unpackhi_epi32 -#define v128_ziplo16 _mm_unpacklo_epi16 -#define v128_ziphi16 _mm_unpackhi_epi16 -#define v128_ziplo8 _mm_unpacklo_epi8 -#define v128_ziphi8 _mm_unpackhi_epi8 - // AES #define v128_aesenc _mm_aesenc_si128 #define v128_aesenclast _mm_aesenclast_si128 @@ -171,7 +161,8 @@ // Used instead if casting. typedef union { - __m128i m128; + v128_t v128; + __m128i m128; uint32_t u32[4]; } __attribute__ ((aligned (16))) m128_ovly; #define v128_ovly m128_ovly @@ -218,19 +209,41 @@ static inline __m128i mm128_mov32_128( const uint32_t n ) return a; } -// Emulate broadcast & insert instructions not available in SSE2 -// FYI only, not used anywhere -//#define mm128_bcast_m64( v ) _mm_shuffle_epi32( v, 0x44 ) -//#define mm128_bcast_m32( v ) _mm_shuffle_epi32( v, 0x00 ) +// broadcast lane 0 to all lanes +#define v128_bcast64(v) _mm_shuffle_epi32( v, 0x44 ) +#define v128_bcast32(v) _mm_shuffle_epi32( v, 0x00 ) + +#if defined(__AVX2__) + +#define v128_bcast16(v) _mm_broadcastw_epi16(v) + +#else + +#define v128_bcast16(v) \ + v128_bcast32( v128_or( v128_sl32( v, 16 ), v ) ) + +#endif + +// broadcast lane l to all lanes +#define v128_replane64( v, l ) \ + ( (l) == 0 ) ? _mm_shuffle_epi32( v, 0x44 ) \ + : _mm_shuffle_epi32( v, 0xee ) + +#define v128_replane32( v, l ) \ + ( (l) == 0 ) ? _mm_shuffle_epi32( v, 0x00 ) \ + : ( (l) == 1 ) ? _mm_shuffle_epi32( v, 0x55 ) \ + : ( (l) == 2 ) ? _mm_shuffle_epi32( v, 0xaa ) \ + : _mm_shuffle_epi32( v, 0xff ) // Pseudo constants #define v128_zero _mm_setzero_si128() -#define m128_zero v128_zero +#define m128_zero _mm_setzero_si128() + #if defined(__SSE4_1__) // Bitwise AND, return 1 if result is all bits clear. -#define v128_and_eq0 _mm_testz_si128 +#define v128_and_eq0 _mm_testz_si128 static inline int v128_cmpeq0( v128_t v ) { return v128_and_eq0( v, v ); } @@ -341,9 +354,12 @@ static inline __m128i v128_neg1_fn() */ +#define mm128_mask_32( v, m ) mm128_xim_32( v, v, m ) + // Zero 32 bit elements when corresponding bit in 4 bit mask is set. -static inline __m128i mm128_mask_32( const __m128i v, const int m ) -{ return mm128_xim_32( v, v, m ); } +//static inline __m128i mm128_mask_32( const __m128i v, const int m ) +//{ return mm128_xim_32( v, v, m ); } +#define v128_mask32 mm128_mask_32 // Copy element i2 of v2 to element i1 of dest and copy remaining elements from v1. #define v128_movlane32( v1, l1, v0, l0 ) \ @@ -483,10 +499,6 @@ static inline void memcpy_128( __m128i *dst, const __m128i *src, const int n ) // // Bit rotations -// Neon has fast xor-ror, useful for big blake, if it actually works. -#define v128_xror64( v1, v0, c ) v128_ror64( v128_xor( v1, v0 ) c ) - - // Slow bit rotation, used as last resort #define mm128_ror_64_sse2( v, c ) \ _mm_or_si128( _mm_srli_epi64( v, c ), _mm_slli_epi64( v, 64-(c) ) ) @@ -645,32 +657,55 @@ static inline void memcpy_128( __m128i *dst, const __m128i *src, const int n ) // Limited 2 input shuffle, combines shuffle with blend. The destination low // half is always taken from v1, and the high half from v2. -#define mm128_shuffle2_64( v1, v2, c ) \ +#define v128_shuffle2_64( v1, v2, c ) \ _mm_castpd_si128( _mm_shuffle_pd( _mm_castsi128_pd( v1 ), \ _mm_castsi128_pd( v2 ), c ) ); +#define mm128_shuffle2_64 v128_shuffle2_64 -#define mm128_shuffle2_32( v1, v2, c ) \ +#define v128_shuffle2_32( v1, v2, c ) \ _mm_castps_si128( _mm_shuffle_ps( _mm_castsi128_ps( v1 ), \ _mm_castsi128_ps( v2 ), c ) ); +#define mm128_shuffle2_32 v128_shuffle2_32 // Rotate vector elements accross all lanes -#define mm128_swap_64( v ) _mm_shuffle_epi32( v, 0x4e ) -#define v128_swap64 mm128_swap_64 -#define mm128_shuflr_64 mm128_swap_64 -#define mm128_shufll_64 mm128_swap_64 +#define v128_shuffle16( v, c ) \ + _mm_or_si128( _mm_shufflehi_epi16( v, c ), _mm_shufflelo_epi16( v, c ) ) + +// reverse elements in vector +#define v128_swap64(v) _mm_shuffle_epi32( v, 0x4e ) // grandfathered +#define v128_rev64(v) _mm_shuffle_epi32( v, 0x4e ) // preferred +#define v128_rev32(v) _mm_shuffle_epi32( v, 0x1b ) +#define v128_rev16(v) v128_shuffle16( v, 0x1b ) -// Don't use as an alias for byte sized bit rotation -#define mm128_shuflr_32( v ) _mm_shuffle_epi32( v, 0x39 ) -#define v128_shuflr32 mm128_shuflr_32 +// rotate vector elements +#define v128_shuflr32(v) _mm_shuffle_epi32( v, 0x39 ) +#define v128_shufll32(v) _mm_shuffle_epi32( v, 0x93 ) -#define mm128_shufll_32( v ) _mm_shuffle_epi32( v, 0x93 ) -#define v128_shufll32 mm128_shufll_32 +#define v128_shuflr16(v) v128_shuffle16( v, 0x39 ) +#define v128_shufll16(v) v128_shuffle16( v, 0x93 ) -#define v128_swap64_32( v ) v128_ror64( v, 32 ) +// Some sub-vector shuffles are identical to bit rotation. Shuffle is faster. +// Bit rotation already promotes faster widths. Usage of these versions +// are context sensitive. -#define mm128_rev_32( v ) _mm_shuffle_epi32( v, 0x1b ) -#define v128_rev32 mm128_rev_32 +// reverse elements in vector lanes +#define v128_qrev32(v) v128_ror64( v, 32 ) +#define v128_swap64_32(v) v128_ror64( v, 32 ) // grandfathered + +#define v128_qrev16(v) \ + _mm_or_si128( _mm_shufflehi_epi16( v, v128u16( 0x1b ) ) \ + _mm_shufflelo_epi16( v, v128u16( 0x1b ) ) ) + +#define v128_lrev16(v) v128_ror32( v, 16 ) + +// alias bswap +#define v128_qrev8(v) _mm_shuffle_epi8( v, v128_8( 0,1,2,3,4,5,6,7 ) ) +#define v128_lrev8(v) _mm_shuffle_epi8( v, v128_8( 4,5,6,7, 0,1,2,3 ) ) +#define v128_wrev8(v) _mm_shuffle_epi8( v, v128_8( 6,7, 4,5, 2,3, 1,0 ) ) + +// reverse bits, can it be done? +//#define v128_bitrev8( v ) vrbitq_u8 /* Not used #if defined(__SSSE3__) @@ -682,7 +717,6 @@ static inline __m128i mm128_shuflr_x8( const __m128i v, const int c ) #endif */ -// // Endian byte swap. #if defined(__SSSE3__) @@ -798,8 +832,7 @@ static inline __m128i mm128_bswap_16( __m128i v ) return _mm_or_si128( _mm_slli_epi16( v, 8 ), _mm_srli_epi16( v, 8 ) ); } -#define mm128_bswap_128( v ) \ - mm128_swap_64( mm128_bswap_64( v ) ) +#define mm128_bswap_128( v ) v128_qrev32( v128_bswap64( v ) ) static inline void mm128_block_bswap_64( __m128i *d, const __m128i *s ) { @@ -846,7 +879,7 @@ static inline void mm128_block_bswap_32( __m128i *d, const __m128i *s ) d[7] = mm128_bswap_32( s[7] ); } #define mm128_block_bswap32_256 mm128_block_bswap_32 -#define v128_block_bswap32_256 mm128_block_bswap_32 +#define v128_block_bswap32_256 mm128_block_bswap_32 static inline void mm128_block_bswap32_512( __m128i *d, const __m128i *s ) { diff --git a/simd-utils/simd-256.h b/simd-utils/simd-256.h index b996091c..4174ef71 100644 --- a/simd-utils/simd-256.h +++ b/simd-utils/simd-256.h @@ -375,16 +375,27 @@ static inline __m256i mm256_not( const __m256i v ) // Cross lane shuffles // // Rotate elements accross all lanes. +#define mm256_shuffle_16( v, c ) \ + _mm256_or_si256( _mm256_shufflehi_epi16( v, c ), \ + _mm256_shufflelo_epi16( v, c ) ) // Swap 128 bit elements in 256 bit vector. #define mm256_swap_128( v ) _mm256_permute4x64_epi64( v, 0x4e ) -#define mm256_shuflr_128 mm256_swap_128 -#define mm256_shufll_128 mm256_swap_128 +#define mm256_rev_128( v ) _mm256_permute4x64_epi64( v, 0x4e ) // Rotate 256 bit vector by one 64 bit element #define mm256_shuflr_64( v ) _mm256_permute4x64_epi64( v, 0x39 ) #define mm256_shufll_64( v ) _mm256_permute4x64_epi64( v, 0x93 ) +// Reverse 64 bit elements +#define mm256_rev_64( v ) _mm256_permute4x64_epi64( v, 0x1b ) + +#define mm256_rev_32( v ) \ + _mm256_permute8x32_epi64( v, 0x0000000000000001, 0x0000000200000003, \ + 0x0000000400000005, 0x0000000600000007 ) + +#define mm256_rev_16( v ) \ + _mm256_permute4x64_epi64( mm256_shuffle_16( v, 0x1b ), 0x4e ) /* Not used // Rotate 256 bit vector by one 32 bit element. @@ -423,12 +434,16 @@ static inline __m256i mm256_shufll_32( const __m256i v ) _mm256_castps_si256( _mm256_shuffle_ps( _mm256_castsi256_ps( v1 ), \ _mm256_castsi256_ps( v2 ), c ) ); -#define mm256_swap128_64( v ) _mm256_shuffle_epi32( v, 0x4e ) -#define mm256_shuflr128_64 mm256_swap128_64 -#define mm256_shufll128_64 mm256_swap128_64 +#define mm256_swap128_64(v) _mm256_shuffle_epi32( v, 0x4e ) +#define mm256_rev128_64(v) _mm256_shuffle_epi32( v, 0x4e ) +#define mm256_rev128_32(v) _mm256_shuffle_epi32( v, 0x1b ) +#define mm256_rev128_16(v) mm256_shuffle_16( v, 0x1b ) -#define mm256_shuflr128_32( v ) _mm256_shuffle_epi32( v, 0x39 ) -#define mm256_shufll128_32( v ) _mm256_shuffle_epi32( v, 0x93 ) +#define mm256_shuflr128_32(v) _mm256_shuffle_epi32( v, 0x39 ) +#define mm256_shufll128_32(v) _mm256_shuffle_epi32( v, 0x93 ) + +#define mm256_shuflr128_16(v) _mm256_shuffle_epi16( v, 0x39 ) +#define mm256_shufll128_16(v) _mm256_shuffle_epi16( v, 0x93 ) /* Not used static inline __m256i mm256_shuflr128_x8( const __m256i v, const int c ) @@ -436,7 +451,19 @@ static inline __m256i mm256_shuflr128_x8( const __m256i v, const int c ) */ // Same as bit rotation but logically used as byte/word rotation. -#define mm256_swap64_32( v ) mm256_ror_64( v, 32 ) +#define mm256_swap64_32( v ) mm256_ror_64( v, 32 ) // grandfathered +#define mm256_rev64_32( v ) mm256_ror_64( v, 32 ) + +#define mm256_shuflr64_16(v) _mm256_ror_epi64( v, 16 ) +#define mm256_shufll64_16(v) _mm256_rol_epi64( v, 16 ) + +#define mm256_shuflr64_8(v) _mm256_ror_epi64( v, 8 ) +#define mm256_shufll64_8(v) _mm256_rol_epi64( v, 8 ) + +#define mm256_rev32_16( v ) mm256_ror_32( v, 16 ) + +#define mm256_shuflr32_8(v) _mm256_ror_epi32( v, 8 ) +#define mm256_shufll32_8(v) _mm256_rol_epi32( v, 8 ) // Reverse byte order in elements, endian bswap. #define mm256_bswap_64( v ) \ diff --git a/simd-utils/simd-neon.h b/simd-utils/simd-neon.h index f209e3c4..2a7714ea 100644 --- a/simd-utils/simd-neon.h +++ b/simd-utils/simd-neon.h @@ -15,11 +15,11 @@ // vxarq_u64( v1, v0, n ) ror( xor( v1, v0 ), n ) // vraxlq_u64( v1, v0 ) xor( rol( v1, 1 ), rol( v0, 1 ) ) // vbcaxq( v2, v1, v0 ) xor( v2, and( v1, not(v0) ) ) +// vsraq_n( v1, v0, n ) add( v1, sr( v0, n ) ) // -// might not work, not tried yet: +// Doesn't work on RPi but works on OPi: // // vornq( v1, v0 ) or( v1, not( v0 ) ) -// vsraq_n( v1, v0, n ) add( v1, sr( v0, n ) ) #define v128_t uint32x4_t // default, #define v128u64_t uint64x2_t @@ -31,6 +31,15 @@ #define v128_load( p ) vld1q_u32( (uint32_t*)(p) ) #define v128_store( p, v ) vst1q_u32( (uint32_t*)(p), v ) +#define v128u64_load( p ) vld1q_u64( (uint64_t*)(p) ) +#define v128u64_store( p, v ) vst1q_u64( (uint64_t*)(p), v ) +#define v128u32_load( p ) vld1q_u32( (uint32_t*)(p) ) +#define v128u32_store( p, v ) vst1q_u32( (uint32_t*)(p), v ) +#define v128u16_load( p ) vld1q_u16( (uint16_t*)(p) ) +#define v128u16_store( p, v ) vst1q_u16( (uint16_t*)(p), v ) +#define v128u8_load( p ) vld1q_u16( (uint8_t*)(p) ) +#define v128u8_store( p, v ) vst1q_u16( (uint8_t*)(p), v ) + // load & set1 combined #define v128_load1_64(p) vld1q_dup_u64( (uint64_t*)(p) ) #define v128_load1_32(p) vld1q_dup_u32( (uint32_t*)(p) ) @@ -74,6 +83,9 @@ static inline uint64x2_t v128_mulw32( uint32x4_t v1, uint32x4_t v0 ) #define v128_cmpeq0 vceqzq_u64 +// Not yet needed +//#define v128_cmpeq1 + #define v128_cmpgt64 vcgtq_u64 #define v128_cmpgt32 vcgtq_u32 #define v128_cmpgt16 vcgtq_u16 @@ -95,7 +107,7 @@ static inline uint64x2_t v128_mulw32( uint32x4_t v1, uint32x4_t v0 ) #define v128_sr16 vshrq_n_u16 #define v128_sr8 vshrq_n_u8 -// Maybe signed shift will work. +// Unit tested, working. #define v128_sra64 vshrq_n_s64 #define v128_sra32 vshrq_n_s32 #define v128_sra16 vshrq_n_s16 @@ -103,25 +115,47 @@ static inline uint64x2_t v128_mulw32( uint32x4_t v1, uint32x4_t v0 ) // unary logic #define v128_not vmvnq_u32 -// binary +// binary logic #define v128_or vorrq_u32 #define v128_and vandq_u32 #define v128_xor veorq_u32 -#define v128_andnot vandq_u32 + +// ~v1 & v0 +#define v128_andnot( v1, v0 ) vandq_u32( vmvnq_u32( v1 ), v0 ) + +// ~( a ^ b ), same as (~a) ^ b #define v128_xnor( v1, v0 ) v128_not( v128_xor( v1, v0 ) ) -#define v128_ornot vornq_u32 -// ternary logic, veorq_u32 not defined +// ~v1 | v0, x86_64 convention, first arg is not'ed +#define v128_ornot( v1, v0 ) vornq_u32( v0, v1 ) + +// ternary logic + +// v2 ^ v1 ^ v0 +// veorq_u32 not defined //#define v128_xor3 veor3q_u32 #define v128_xor3( v2, v1, v0 ) veorq_u32( v2, veorq_u32( v1, v0 ) ) -#define v128_nor vornq_u32 + +// v2 & v1 & v0 +#define v128_and3( v2, v1, v0 ) v128_and( v2, v128_and( v1, v0 ) ) + +// v2 | v1 | v0 +#define v128_or3( v2, v1, v0 ) v128_or( v2, v128_or( v1, v0 ) ) + +// a ^ ( ~b & c ) #define v128_xorandnot( v2, v1, v0 ) v128_xor( v2, v128_andnot( v1, v0 ) ) -#define v128_and3( a, b, c ) v128_and( a, v128_and( b, c ) ) -#define v128_or3( a, b, c ) v128_or( a, v128_or( b, c ) ) -#define v128_xorand( a, b, c ) v128_xor( a, v128_and( b, c ) ) -#define v128_andxor( a, b, c ) v128_and( a, v128_xor( b, c ) ) -#define v128_xoror( a, b, c ) v128_xor( a, v128_or( b, c ) ) -#define v128_orand( a, b, c ) v128_or( a, v128_and( b, c ) ) + +// a ^ ( b & c ) +#define v128_xorand( v2, v1, v0 ) v128_xor( v2, v128_and( v1, v0 ) ) + +// a & ( b ^ c ) +#define v128_andxor( v2, v1, v0 ) v128_and( v2, v128_xor( v1, v0 ) ) + +// a ^ ( b | c ) +#define v128_xoror( v2, v1, v0 ) v128_xor( v2, v128_or( v1, v0 ) ) + +// v2 | ( v1 & v0 ) +#define v128_orand( v2, v1, v0 ) v128_or( v2, v128_and( v1, v0 ) ) // shift 2 concatenated vectors right. #define v128_alignr64( v1, v0, c ) vextq_u64( v0, v1, c ) @@ -129,24 +163,15 @@ static inline uint64x2_t v128_mulw32( uint32x4_t v1, uint32x4_t v0 ) #define v128_alignr8( v1, v0, c ) vextq_u8( v0, v1, c ) // Intetleave high or low half of 2 vectors. -#define v128_unpacklo64( v1, v0 ) vzip1q_u64( v0, v1 ) -#define v128_unpackhi64( v1, v0 ) vzip2q_u64( v0, v1 ) -#define v128_unpacklo32( v1, v0 ) vzip1q_u32( v0, v1 ) -#define v128_unpackhi32( v1, v0 ) vzip2q_u32( v0, v1 ) -#define v128_unpacklo16( v1, v0 ) vzip1q_u16( v0, v1 ) -#define v128_unpackhi16( v1, v0 ) vzip2q_u16( v0, v1 ) -#define v128_unpacklo8( v1, v0 ) vzip1q_u8( v0, v1 ) -#define v128_unpackhi8( v1, v0 ) vzip2q_u8( v0, v1 ) - -// Shorter achchitecture agnostic names for unpack using NEON-like mnemonics -#define v128_ziplo64 vzip1q_u64 -#define v128_ziphi64 vzip2q_u64 -#define v128_ziplo32 vzip1q_u32 -#define v128_ziphi32 vzip2q_u32 -#define v128_ziplo16 vzip1q_u16 -#define v128_ziphi16 vzip2q_u16 -#define v128_ziplo8 vzip1q_u8 -#define v128_ziphi8 vzip2q_u8 +#define v128_unpacklo64( v1, v0 ) vzip1q_u64( v1, v0 ) +#define v128_unpackhi64( v1, v0 ) vzip2q_u64( v1, v0 ) +#define v128_unpacklo32( v1, v0 ) vzip1q_u32( v1, v0 ) +#define v128_unpackhi32( v1, v0 ) vzip2q_u32( v1, v0 ) +#define v128_unpacklo16( v1, v0 ) vzip1q_u16( v1, v0 ) +#define v128_unpackhi16( v1, v0 ) vzip2q_u16( v1, v0 ) +#define v128_unpacklo8( v1, v0 ) vzip1q_u8( v1, v0 ) +#define v128_unpackhi8( v1, v0 ) vzip2q_u8( v1, v0 ) + // AES // consistent with Intel AES, break up for optimizing @@ -158,10 +183,22 @@ static inline uint64x2_t v128_mulw32( uint32x4_t v1, uint32x4_t v0 ) typedef union { + uint32x4_t v128; uint32x4_t m128; - uint32_t u32[4]; + uint32_t u32[4]; } __attribute__ ((aligned (16))) v128_ovly; + +// Broadcast lane 0 to all lanes +#define v128_bcast64(v) vdupq_laneq_u64( v, 0 ) +#define v128_bcast32(v) vdupq_laneq_u32( v, 0 ) +#define v128_bcast16(v) vdupq_laneq_u16( v, 0 ) + +// Replicate (broadcast) lane l to all lanes +#define v128_replane64( v, l ) vdupq_laneq_u64( v, l ) +#define v128_replane32( v, l ) vdupq_laneq_u32( v, l ) +#define v128_replane16( v, l ) vdupq_laneq_u16( v, l ) + // pointer indexing #define casti_v128( p, i ) (((uint32x4_t*)(p))[i]) #define cast_v128( p ) (*((uint32x4_t*)(p))) @@ -255,12 +292,13 @@ typedef union #define v128_negate16 vnegq_s16 #define v128_negate8 vnegq_s8 +// Nothing else seems to work static inline void v128_memset_zero( void *dst, const int n ) { - for( int i = 0; i < n; i++ ) - ((uint32x4_t*)dst)[n] = (uint32x4_t)(uint128_t)0; + memset( dst, 0, n*16 ); } + static inline void v128_memset( void *dst, const void *src, const int n ) { for( int i = 0; i < n; i++ ) @@ -273,67 +311,40 @@ static inline void v128_memcpy( void *dst, const void *src, const int n ) ((uint32x4_t*)dst)[i] = ((const uint32x4_t*)src)[i]; } -// how to build a bitmask from vector elements? +// how to build a bitmask from vector elements? Efficiently??? #define v128_movmask32 #define v128_movmask64 // Bit rotation -//TODO, maybe, Optimize 64 bit rotations -// Fall back for odd bit rotations -static inline uint64x2_t v128_ror64( uint64x2_t v, int c ) -{ - return vsriq_n_u64( vshlq_n_u64( (uint64x2_t)v, 64-c ), (uint64x2_t)v, c ); -} - -static inline uint64x2_t v128_rol64( uint64x2_t v, int c ) -{ - return vsliq_n_u64( vshrq_n_u64( (uint64x2_t)v, 64-c ), (uint64x2_t)v, c ); -} - -//static inline uint64x2_t v128_rol64( uint64x2_t v, int c ) -//{ return vsriq_n_u64( vshlq_n_u64( v, c ), v, 64-c ); } - -static inline uint32x4_t v128_ror32( uint32x4_t v, int c ) -{ return vsriq_n_u32( vshlq_n_u32( v, 32-c ), v, c ); } - -static inline uint32x4_t v128_rol32( uint32x4_t v, int c ) -{ return vsliq_n_u32( vshrq_n_u32( v, 32-c ), v, c ); } - -//static inline uint32x4_t v128_rol32( uint32x4_t v, int c ) -//{ return vsriq_n_u32( vshlq_n_u32( v, c ), v, 32-c ); } - -static inline uint16x8_t v128_ror16( uint16x8_t v, int c ) -{ return vsriq_n_u16( vshlq_n_u16( v, 16-c ), v, c ); } - -static inline uint16x8_t v128_rol16( uint16x8_t v, int c ) -{ return vsliq_n_u16( vshrq_n_u16( v, 16-c ), v, c ); } +#define v128_ror64( v, c ) \ + ( (c) == 32 ) ? (uint64x2_t)vrev64q_u32( ((uint64x2_t)v) ) \ + : vsriq_n_u64( vshlq_n_u64( ((uint64x2_t)v), 64-c ), ((uint64x2_t)v), c ) -//static inline uint16x8_t v128_rol16( uint16x8_t v, int c ) -//{ return vsriq_n_u16( vshlq_n_u16( v, c ), v, 16-c ); } +#define v128_rol64( v, c ) \ + ( (c) == 32 ) ? (uint64x2_t)vrev64q_u32( ((uint64x2_t)v) ) \ + : vsliq_n_u64( vshrq_n_u64( ((uint64x2_t)v), 64-c ), ((uint64x2_t)v), c ) -static inline uint8x16_t v128_ror8( uint8x16_t v, int c ) -{ return vsriq_n_u8( vshlq_n_u8( v, 8-c ), v, c ); } +#define v128_ror32( v, c ) \ + ( (c) == 16 ) ? (uint32x4_t)vrev32q_u16( ((uint32x4_t)v) ) \ + : vsriq_n_u32( vshlq_n_u32( ((uint32x4_t)v), 32-c ), ((uint32x4_t)v), c ) -static inline uint8x16_t v128_rol8( uint8x16_t v, int c ) -{ return vsliq_n_u8( vshrq_n_u8( v, 8-c ), v, c ); } +#define v128_rol32( v, c ) \ + ( (c) == 16 ) ? (uint32x4_t)vrev32q_u16( ((uint32x4_t)v) ) \ + : vsliq_n_u32( vshrq_n_u32( ((uint32x4_t)v), 32-c ), ((uint32x4_t)v), c ) -//static inline uint8x16_t v128_rol8( uint16x8_t v, int c ) -//{ return vsriq_n_u8( vshlq_n_u8( v, c ), v, 8-c ); } +#define v128_ror16( v, c ) \ + ( (c) == 8 ) ? (uint16x8_t)vrev16q_u8( ((uint16x8_t)v) ) \ + : vsriq_n_u16( vshlq_n_u16( ((uint16x8_t)v), 16-c ), ((uint16x8_t)v), c ) -/* -// Optimzed for half element rotations (swap) -#define v128_ror64( v, c ) \ - ( (c) == 32 ) ? (uint64x2_t)vrev64q_u32( v ) : v128_ror64_neon( v, c ) +#define v128_rol16( v, c ) \ + ( (c) == 8 ) ? (uint16x8_t)vrev16q_u8( ((uint16x8_t)v) ) \ + : vsliq_n_u16( vshrq_n_u16( ((uint16x8_t)v), 16-c ), ((uint16x8_t)v), c ) -#define v128_rol64( v, c ) \ - ( (c) == 32 ) ? (uint64x2_t)vrev64q_u32( v ) : v128_rol64_neon( v, c ) - -#define v128_ror32( v, c ) \ - ( (c) == 16 ) ? (uint32x4_t)vrev32q_u16( v ) : v128_ror32_neon( v, c ) +#define v128_ror8( v, c ) \ + vsriq_n_u8( vshlq_n_u8( ((uint8x16_t)v), 8-c ), ((uint8x16_t)v), c ) -#define v128_rol32( v, c ) \ - ( (c) == 16 ) ? (uint32x4_t)vrev32q_u16( v ) : v128_rol32_neon( v, c ) -*/ +#define v128_rol8( v, c ) \ + vsliq_n_u8( vshrq_n_u8( ((uint8x16_t)v), 8-c ), ((uint8x16_t)v), c ) #define v128_2ror64( v1, v0, c ) \ { \ @@ -361,7 +372,7 @@ static inline uint8x16_t v128_rol8( uint8x16_t v, int c ) uint32x4_t t1 = vshrq_n_u32( v1, c ); \ v0 = vsliq_n_u32( v0, 32-(c) ); \ v1 = vsliq_n_u32( v1, 32-(c) ); \ - v0 = vorrq_u32( v0, t0 ); \ + v0 = vorrq_32( v0, t0 ); \ v1 = vorrq_u32( v1, t1 ); \ } @@ -375,16 +386,6 @@ static inline uint8x16_t v128_rol8( uint8x16_t v, int c ) v1 = vorrq_u32( v1, t1 ); \ } -// vector rotation , size? -static inline uint64x2_t v128_swap64( uint64x2_t v ) -{ return vextq_u64( v, v, 1 ); } - -static inline uint32x4_t v128_shuflr32( uint32x4_t v ) -{ return vextq_u32( v, v, 1 ); } - -static inline uint32x4_t v128_shufll32( uint32x4_t v ) -{ return vextq_u32( v, v, 3 ); } - // Cross lane shuffles, no programmable shuffle in NEON // vector mask, use as last resort. prefer rev, alignr, etc @@ -413,29 +414,54 @@ static inline uint32x4_t v128_shufll32( uint32x4_t v ) ((uint8_t*)&v)[ ((uint8_t*)(&vmask))[ 1] ], \ ((uint8_t*)&v)[ ((uint8_t*)(&vmask))[ 0] ] ) -#define v128_swap64_32( v ) vrev64q_u32( v ) -#define v128_v128_shuflr64_16( v ) v128_ror_64( v, 16 ) -#define v128_v128_shufll64_16( v ) v128_rol_64( v, 16 ) +// sub-vector shuffles sometimes mirror bit rotation. Shuffle is faster. +// Bit rotation already promotes faster widths. Usage is context sensitive. +// preferred. + +// reverse elements in vector lanes +#define v128_qrev32 vrev64q_u32 +#define v128_swap64_32 vrev64q_u32 // grandfathered + +#define v128_qrev16 vrev64q_u16 +#define v128_lrev16 vrev32q_u16 + +// aka bswap +#define v128_qrev8 vrev64q_u8 +#define v128_lrev8 vrev32q_u8 +#define v128_wrev8 vrev16q_u8 + +// full vector rotation + +// reverse elements in vector +static inline uint64x2_t v128_rev64( uint64x2_t v ) +{ return vextq_u64( v, v, 1 ); } +#define v128_swap64 v128_rev64 // grandfathered + +#define v128_rev32(v) v128_rev64( v128_qrev32( v ) ) +#define v128_rev16(v) v128_rev64( v128_qrev16( v ) ) + +// shuffle-rotate vector elements +static inline uint32x4_t v128_shuflr32( uint32x4_t v ) +{ return vextq_u32( v, v, 1 ); } + +static inline uint32x4_t v128_shufll32( uint32x4_t v ) +{ return vextq_u32( v, v, 3 ); } -// Don't use as an alias for byte sized bit rotation -#define v128_swap32_16( v ) vrev64q_u16( v ) -#define v128_v128_shuflr32_8( v ) v128_ror_32( v, 8 ) -#define v128_v128_shufll32_8( v ) v128_rol_32( v, 8 ) +static inline uint16x8_t v128_shuflr16( uint16x8_t v ) +{ return vextq_u16( v, v, 1 ); } -// reverse elements -#define v128_rev32( v ) vrev64q_u32( v ) -#define v128_rev16( v ) vrev64q_u16( v ) -#define v128_rev8( v ) vrev64q_u8( v ) +static inline uint16x8_t v128_shufll16( uint16x8_t v ) +{ return vextq_u16( v, v, 7 ); } -// reverse bits, nothing like it in x86_64 -#define v128_bitrev8( v ) vrbitq_u8 +// reverse bits in bytes, nothing like it in x86_64 +#define v128_bitrev8 vrbitq_u8 // reverse byte order -#define v128_bswap16(v) (uint16x8_t)vrev16q_u8( (uint8x16_t)(v) ) -#define v128_bswap32(v) (uint32x4_t)vrev32q_u8( (uint8x16_t)(v) ) -#define v128_bswap64(v) (uint64x2_t)vrev64q_u8( (uint8x16_t)(v) ) -#define v128_bswap128(v) (uint32x4_t)v128_swap64( v128_bswap64(v) ) -#define v128_bswap256(p) v128_bswap128( (p)[0], (p)[1] ) +#define v128_bswap16(v) (uint16x8_t)vrev16q_u8( (uint8x16_t)(v) ) +#define v128_bswap32(v) (uint32x4_t)vrev32q_u8( (uint8x16_t)(v) ) +#define v128_bswap64(v) (uint64x2_t)vrev64q_u8( (uint8x16_t)(v) ) +#define v128_bswap128(v) (uint32x4_t)v128_swap64( v128_bswap64(v) ) +#define v128_bswap256(p) v128_bswap128( (p)[0], (p)[1] ) // Usefull for x86_64 but does nothing for ARM #define v128_block_bswap32( dst, src ) \