From 444d1f1a3bdb2072e01683d838748f988dcbdfbb Mon Sep 17 00:00:00 2001 From: Jeffrey Walton Date: Tue, 21 Jul 2015 14:37:55 -0400 Subject: [PATCH] Cut-in to utilize GNU_ATT_SYNTAX and GNU_INTEL_SYNTAX macros. Also see LLVM Bug 18916 (https://llvm.org/bugs/show_bug.cgi?id=18916) --- gcm.cpp | 8 ++++---- integer.cpp | 14 +++++++------- panama.cpp | 4 ++-- rijndael.cpp | 4 ++-- salsa.cpp | 4 ++-- sha.cpp | 8 ++++---- sosemanuk.cpp | 4 ++-- tiger.cpp | 4 ++-- vmac.cpp | 4 ++-- whrlpool.cpp | 4 ++-- 10 files changed, 29 insertions(+), 29 deletions(-) diff --git a/gcm.cpp b/gcm.cpp index 8a2c2c56..df802784 100644 --- a/gcm.cpp +++ b/gcm.cpp @@ -574,7 +574,7 @@ size_t GCM_Base::AuthenticateBlocks(const byte *data, size_t len) #ifdef __GNUC__ __asm__ __volatile__ ( - ".intel_syntax noprefix;" + GNU_INTEL_SYNTAX #elif defined(CRYPTOPP_GENERATE_X64_MASM) ALIGN 8 GCM_AuthenticateBlocks_2K PROC FRAME @@ -702,7 +702,7 @@ size_t GCM_Base::AuthenticateBlocks(const byte *data, size_t len) AS_POP_IF86( bx) #ifdef __GNUC__ - ".att_syntax prefix;" + GNU_ATT_SYNTAX : : "c" (data), "d" (len/16), "S" (hashBuffer), "D" (s_reductionTable) : "memory", "cc", "%eax" @@ -725,7 +725,7 @@ size_t GCM_Base::AuthenticateBlocks(const byte *data, size_t len) #ifdef __GNUC__ __asm__ __volatile__ ( - ".intel_syntax noprefix;" + GNU_INTEL_SYNTAX #elif defined(CRYPTOPP_GENERATE_X64_MASM) ALIGN 8 GCM_AuthenticateBlocks_64K PROC FRAME @@ -779,7 +779,7 @@ size_t GCM_Base::AuthenticateBlocks(const byte *data, size_t len) AS2( movdqa [WORD_REG(si)], xmm0 ) #ifdef __GNUC__ - ".att_syntax prefix;" + GNU_ATT_SYNTAX : : "c" (data), "d" (len/16), "S" (hashBuffer) : "memory", "cc", "%edi", "%eax" diff --git a/integer.cpp b/integer.cpp index 3d52ae74..f96bad16 100644 --- a/integer.cpp +++ b/integer.cpp @@ -450,9 +450,9 @@ inline word DWord::operator%(word a) int result; \ __asm__ __volatile__ \ ( \ - ".intel_syntax noprefix;" + GNU_INTEL_SYNTAX #define AddEpilogue \ - ".att_syntax prefix;" \ + GNU_ATT_SYNTAX \ : "=a" (result)\ : "d" (C), "a" (A), "D" (B), "c" (N) \ : "%esi", "memory", "cc" \ @@ -461,12 +461,12 @@ inline word DWord::operator%(word a) #define MulPrologue \ __asm__ __volatile__ \ ( \ - ".intel_syntax noprefix;" \ + GNU_INTEL_SYNTAX \ AS1( push ebx) \ AS2( mov ebx, edx) #define MulEpilogue \ AS1( pop ebx) \ - ".att_syntax prefix;" \ + GNU_ATT_SYNTAX \ : \ : "d" (s_maskLow16), "c" (C), "a" (A), "D" (B) \ : "%esi", "memory", "cc" \ @@ -474,7 +474,7 @@ inline word DWord::operator%(word a) #define SquPrologue MulPrologue #define SquEpilogue \ AS1( pop ebx) \ - ".att_syntax prefix;" \ + GNU_ATT_SYNTAX \ : \ : "d" (s_maskLow16), "c" (C), "a" (A) \ : "%esi", "%edi", "memory", "cc" \ @@ -482,7 +482,7 @@ inline word DWord::operator%(word a) #define TopPrologue MulPrologue #define TopEpilogue \ AS1( pop ebx) \ - ".att_syntax prefix;" \ + GNU_ATT_SYNTAX \ : \ : "d" (s_maskLow16), "c" (C), "a" (A), "D" (B), "S" (L) \ : "memory", "cc" \ @@ -570,7 +570,7 @@ int Baseline_Sub(size_t N, word *C, const word *A, const word *B) word result; __asm__ __volatile__ ( - ".intel_syntax;" + GNU_INTEL_SYNTAX AS1( neg %1) ASJ( jz, 1, f) AS2( mov %0,[%3+8*%1]) diff --git a/panama.cpp b/panama.cpp index 40c619fa..94964fff 100644 --- a/panama.cpp +++ b/panama.cpp @@ -45,7 +45,7 @@ void CRYPTOPP_NOINLINE Panama_SSE2_Pull(size_t count, word32 *state, word32 *z, #ifdef CRYPTOPP_GNU_STYLE_INLINE_ASSEMBLY asm __volatile__ ( - ".intel_syntax noprefix;" + GNU_INTEL_SYNTAX AS_PUSH_IF86( bx) #else AS2( mov AS_REG_1, count) @@ -289,7 +289,7 @@ void CRYPTOPP_NOINLINE Panama_SSE2_Pull(size_t count, word32 *state, word32 *z, #ifdef CRYPTOPP_GNU_STYLE_INLINE_ASSEMBLY AS_POP_IF86( bx) - ".att_syntax prefix;" + GNU_ATT_SYNTAX : #if CRYPTOPP_BOOL_X64 : "D" (count), "S" (state), "d" (z), "c" (y) diff --git a/rijndael.cpp b/rijndael.cpp index c872104f..87d51316 100644 --- a/rijndael.cpp +++ b/rijndael.cpp @@ -614,7 +614,7 @@ CRYPTOPP_NAKED void CRYPTOPP_FASTCALL Rijndael_Enc_AdvancedProcessBlocks(void *l #elif defined(__GNUC__) __asm__ __volatile__ ( - ".intel_syntax noprefix;" + GNU_INTEL_SYNTAX #if CRYPTOPP_BOOL_X64 AS2( mov L_REG, rcx) #endif @@ -969,7 +969,7 @@ CRYPTOPP_NAKED void CRYPTOPP_FASTCALL Rijndael_Enc_AdvancedProcessBlocks(void *l Rijndael_Enc_AdvancedProcessBlocks ENDP #endif #ifdef __GNUC__ - ".att_syntax prefix;" + GNU_ATT_SYNTAX : : "c" (locals), "d" (k), "S" (Te), "D" (g_cacheLineSize) : "memory", "cc", "%eax" diff --git a/salsa.cpp b/salsa.cpp index aefe74c7..cddb20aa 100644 --- a/salsa.cpp +++ b/salsa.cpp @@ -150,7 +150,7 @@ void Salsa20_Policy::OperateKeystream(KeystreamOperation operation, byte *output #ifdef __GNUC__ __asm__ __volatile__ ( - ".intel_syntax noprefix;" + GNU_INTEL_SYNTAX AS_PUSH_IF86( bx) #else void *s = m_state.data(); @@ -458,7 +458,7 @@ void Salsa20_Policy::OperateKeystream(KeystreamOperation operation, byte *output AS_POP_IF86( bp) #ifdef __GNUC__ AS_POP_IF86( bx) - ".att_syntax prefix;" + GNU_ATT_SYNTAX #if CRYPTOPP_BOOL_X64 : "+r" (input), "+r" (output), "+r" (iterationCount) : "r" (m_rounds), "r" (m_state.m_ptr), "r" (workspace) diff --git a/sha.cpp b/sha.cpp index 153fc00b..11fb92fe 100644 --- a/sha.cpp +++ b/sha.cpp @@ -244,7 +244,7 @@ static void CRYPTOPP_FASTCALL X86_SHA256_HashBlocks(word32 *state, const word32 #if CRYPTOPP_BOOL_X64 "lea %4, %%r8;" #endif - ".intel_syntax noprefix;" + GNU_INTEL_SYNTAX #elif defined(CRYPTOPP_GENERATE_X64_MASM) ALIGN 8 X86_SHA256_HashBlocks PROC FRAME @@ -424,7 +424,7 @@ static void CRYPTOPP_FASTCALL X86_SHA256_HashBlocks(word32 *state, const word32 #endif #ifdef __GNUC__ - ".att_syntax prefix;" + GNU_ATT_SYNTAX : : "c" (state), "d" (data), "S" (SHA256_K+48), "D" (len) #if CRYPTOPP_BOOL_X64 @@ -675,7 +675,7 @@ CRYPTOPP_NAKED static void CRYPTOPP_FASTCALL SHA512_SSE2_Transform(word64 *state #ifdef __GNUC__ __asm__ __volatile__ ( - ".intel_syntax noprefix;" + GNU_INTEL_SYNTAX AS1( push ebx) AS2( mov ebx, eax) #else @@ -841,7 +841,7 @@ CRYPTOPP_NAKED static void CRYPTOPP_FASTCALL SHA512_SSE2_Transform(word64 *state #if defined(__GNUC__) AS1( pop ebx) - ".att_syntax prefix;" + GNU_ATT_SYNTAX : : "a" (SHA512_K), "c" (state), "d" (data) : "%esi", "%edi", "memory", "cc" diff --git a/sosemanuk.cpp b/sosemanuk.cpp index 0cc798f8..918c5d48 100644 --- a/sosemanuk.cpp +++ b/sosemanuk.cpp @@ -355,7 +355,7 @@ void SosemanukPolicy::OperateKeystream(KeystreamOperation operation, byte *outpu #endif __asm__ __volatile__ ( - ".intel_syntax noprefix;" + GNU_INTEL_SYNTAX AS_PUSH_IF86( bx) #else word32 *state = m_state; @@ -595,7 +595,7 @@ void SosemanukPolicy::OperateKeystream(KeystreamOperation operation, byte *outpu #ifdef __GNUC__ AS_POP_IF86( bx) - ".att_syntax prefix;" + GNU_ATT_SYNTAX : : "a" (m_state.m_ptr), "c" (iterationCount), "S" (s_sosemanukMulTables), "D" (output), "d" (input) #if CRYPTOPP_BOOL_X64 diff --git a/tiger.cpp b/tiger.cpp index c6c05cae..185816e9 100644 --- a/tiger.cpp +++ b/tiger.cpp @@ -38,7 +38,7 @@ void Tiger::Transform (word64 *digest, const word64 *X) #ifdef __GNUC__ __asm__ __volatile__ ( - ".intel_syntax noprefix;" + GNU_INTEL_SYNTAX AS1( push ebx) #else #if _MSC_VER < 1300 @@ -194,7 +194,7 @@ void Tiger::Transform (word64 *digest, const word64 *X) AS1( emms) #ifdef __GNUC__ AS1( pop ebx) - ".att_syntax prefix;" + GNU_ATT_SYNTAX : : "a" (digest), "S" (X), "d" (table) : "%ecx", "%edi", "memory", "cc" diff --git a/vmac.cpp b/vmac.cpp index 86d4b2ee..cb78d4e2 100644 --- a/vmac.cpp +++ b/vmac.cpp @@ -158,7 +158,7 @@ VMAC_Base::VHASH_Update_SSE2(const word64 *data, size_t blocksRemainingInWord64, ( AS2( mov %%ebx, %0) AS2( mov %1, %%ebx) - ".intel_syntax noprefix;" + GNU_INTEL_SYNTAX #else #if _MSC_VER < 1300 || defined(__INTEL_COMPILER) char isFirstBlock = m_isFirstBlock; @@ -377,7 +377,7 @@ VMAC_Base::VHASH_Update_SSE2(const word64 *data, size_t blocksRemainingInWord64, AS1( pop ebp) AS1( emms) #ifdef __GNUC__ - ".att_syntax prefix;" + GNU_ATT_SYNTAX AS2( mov %0, %%ebx) : "=m" (temp) : "m" (L1KeyLength), "c" (blocksRemainingInWord64), "S" (data), "D" (nhK+tagPart*2), "d" (m_isFirstBlock), "a" (polyS+tagPart*4) diff --git a/whrlpool.cpp b/whrlpool.cpp index 6de6747f..39830abb 100644 --- a/whrlpool.cpp +++ b/whrlpool.cpp @@ -401,7 +401,7 @@ void Whirlpool::Transform(word64 *digest, const word64 *block) #endif __asm__ __volatile__ ( - ".intel_syntax noprefix;" + GNU_INTEL_SYNTAX AS_PUSH_IF86( bx) AS2( mov AS_REG_6, WORD_REG(ax)) #else @@ -569,7 +569,7 @@ void Whirlpool::Transform(word64 *digest, const word64 *block) AS_POP_IF86( bx) #endif #ifdef __GNUC__ - ".att_syntax prefix;" + GNU_ATT_SYNTAX : : "a" (Whirlpool_C), "c" (digest), "d" (block) #if CRYPTOPP_BOOL_X64