diff options
author | Jack Lloyd <[email protected]> | 2019-11-23 12:52:50 -0500 |
---|---|---|
committer | Jack Lloyd <[email protected]> | 2019-11-23 12:52:50 -0500 |
commit | e6f10d14a2ca4f58f507ee6d7e2ec6e3f16cb4c8 (patch) | |
tree | 377a2187d71409b12fc40cee0e9429c573752897 | |
parent | 44c04ef0419c38e6ab8ff2c9e3615447e89962fb (diff) | |
parent | 9767150d9c23efa52b5ed777a21bcb083751126d (diff) |
Merge GH #2204 Remove 32-bit x86 asm for MSVC
-rw-r--r-- | src/lib/math/mp/mp_asmi.h | 266 | ||||
-rw-r--r-- | src/lib/math/mp/mp_madd.h | 10 |
2 files changed, 4 insertions, 272 deletions
diff --git a/src/lib/math/mp/mp_asmi.h b/src/lib/math/mp/mp_asmi.h index c99d8b7e5..e1518d51c 100644 --- a/src/lib/math/mp/mp_asmi.h +++ b/src/lib/math/mp/mp_asmi.h @@ -154,33 +154,6 @@ inline word word8_add2(word x[8], const word y[8], word carry) : "cc", "memory"); return carry; -#elif defined(BOTAN_MP_USE_X86_32_MSVC_ASM) - - __asm { - mov edx,[x] - mov esi,[y] - xor eax,eax - sub eax,[carry] //force CF=1 iff *carry==1 - mov eax,[esi] - adc [edx],eax - mov eax,[esi+4] - adc [edx+4],eax - mov eax,[esi+8] - adc [edx+8],eax - mov eax,[esi+12] - adc [edx+12],eax - mov eax,[esi+16] - adc [edx+16],eax - mov eax,[esi+20] - adc [edx+20],eax - mov eax,[esi+24] - adc [edx+24],eax - mov eax,[esi+28] - adc [edx+28],eax - sbb eax,eax - neg eax - } - #else x[0] = word_add(x[0], y[0], &carry); x[1] = word_add(x[1], y[1], &carry); @@ -217,50 +190,6 @@ inline word word8_add3(word z[8], const word x[8], : "cc", "memory"); return carry; -#elif defined(BOTAN_MP_USE_X86_32_MSVC_ASM) - - __asm { - mov edi,[x] - mov esi,[y] - mov ebx,[z] - xor eax,eax - sub eax,[carry] //force CF=1 iff *carry==1 - mov eax,[edi] - adc eax,[esi] - mov [ebx],eax - - mov eax,[edi+4] - adc eax,[esi+4] - mov [ebx+4],eax - - mov eax,[edi+8] - adc eax,[esi+8] - mov [ebx+8],eax - - mov eax,[edi+12] - adc eax,[esi+12] - mov [ebx+12],eax - - mov eax,[edi+16] - adc eax,[esi+16] - mov [ebx+16],eax - - mov eax,[edi+20] - adc eax,[esi+20] - mov [ebx+20],eax - - mov eax,[edi+24] - adc eax,[esi+24] - mov [ebx+24],eax - - mov eax,[edi+28] - adc eax,[esi+28] - mov [ebx+28],eax - - sbb eax,eax - neg eax - } - #else z[0] = word_add(x[0], y[0], &carry); z[1] = word_add(x[1], y[1], &carry); @@ -327,41 +256,6 @@ inline word word8_sub2(word x[8], const word y[8], word carry) : "cc", "memory"); return carry; -#elif defined(BOTAN_MP_USE_X86_32_MSVC_ASM) - - __asm { - mov edi,[x] - mov esi,[y] - xor eax,eax - sub eax,[carry] //force CF=1 iff *carry==1 - mov eax,[edi] - sbb eax,[esi] - mov [edi],eax - mov eax,[edi+4] - sbb eax,[esi+4] - mov [edi+4],eax - mov eax,[edi+8] - sbb eax,[esi+8] - mov [edi+8],eax - mov eax,[edi+12] - sbb eax,[esi+12] - mov [edi+12],eax - mov eax,[edi+16] - sbb eax,[esi+16] - mov [edi+16],eax - mov eax,[edi+20] - sbb eax,[esi+20] - mov [edi+20],eax - mov eax,[edi+24] - sbb eax,[esi+24] - mov [edi+24],eax - mov eax,[edi+28] - sbb eax,[esi+28] - mov [edi+28],eax - sbb eax,eax - neg eax - } - #else x[0] = word_sub(x[0], y[0], &carry); x[1] = word_sub(x[1], y[1], &carry); @@ -433,42 +327,6 @@ inline word word8_sub3(word z[8], const word x[8], : "cc", "memory"); return carry; -#elif defined(BOTAN_MP_USE_X86_32_MSVC_ASM) - - __asm { - mov edi,[x] - mov esi,[y] - xor eax,eax - sub eax,[carry] //force CF=1 iff *carry==1 - mov ebx,[z] - mov eax,[edi] - sbb eax,[esi] - mov [ebx],eax - mov eax,[edi+4] - sbb eax,[esi+4] - mov [ebx+4],eax - mov eax,[edi+8] - sbb eax,[esi+8] - mov [ebx+8],eax - mov eax,[edi+12] - sbb eax,[esi+12] - mov [ebx+12],eax - mov eax,[edi+16] - sbb eax,[esi+16] - mov [ebx+16],eax - mov eax,[edi+20] - sbb eax,[esi+20] - mov [ebx+20],eax - mov eax,[edi+24] - sbb eax,[esi+24] - mov [ebx+24],eax - mov eax,[edi+28] - sbb eax,[esi+28] - mov [ebx+28],eax - sbb eax,eax - neg eax - } - #else z[0] = word_sub(x[0], y[0], &carry); z[1] = word_sub(x[1], y[1], &carry); @@ -504,68 +362,6 @@ inline word word8_linmul2(word x[8], word y, word carry) : "cc", "%rax", "%rdx"); return carry; -#elif defined(BOTAN_MP_USE_X86_32_MSVC_ASM) - - __asm { - mov esi,[x] - mov eax,[esi] //load a - mul [y] //edx(hi):eax(lo)=a*b - add eax,[carry] //sum lo carry - adc edx,0 //sum hi carry - mov ecx,edx //store carry - mov [esi],eax //load a - - mov eax,[esi+4] //load a - mul [y] //edx(hi):eax(lo)=a*b - add eax,ecx //sum lo carry - adc edx,0 //sum hi carry - mov ecx,edx //store carry - mov [esi+4],eax //load a - - mov eax,[esi+8] //load a - mul [y] //edx(hi):eax(lo)=a*b - add eax,ecx //sum lo carry - adc edx,0 //sum hi carry - mov ecx,edx //store carry - mov [esi+8],eax //load a - - mov eax,[esi+12] //load a - mul [y] //edx(hi):eax(lo)=a*b - add eax,ecx //sum lo carry - adc edx,0 //sum hi carry - mov ecx,edx //store carry - mov [esi+12],eax //load a - - mov eax,[esi+16] //load a - mul [y] //edx(hi):eax(lo)=a*b - add eax,ecx //sum lo carry - adc edx,0 //sum hi carry - mov ecx,edx //store carry - mov [esi+16],eax //load a - - mov eax,[esi+20] //load a - mul [y] //edx(hi):eax(lo)=a*b - add eax,ecx //sum lo carry - adc edx,0 //sum hi carry - mov ecx,edx //store carry - mov [esi+20],eax //load a - - mov eax,[esi+24] //load a - mul [y] //edx(hi):eax(lo)=a*b - add eax,ecx //sum lo carry - adc edx,0 //sum hi carry - mov ecx,edx //store carry - mov [esi+24],eax //load a - - mov eax,[esi+28] //load a - mul [y] //edx(hi):eax(lo)=a*b - add eax,ecx //sum lo carry - adc edx,0 //sum hi carry - mov [esi+28],eax //load a - - mov eax,edx //store carry - } - #else x[0] = word_madd2(x[0], y, &carry); x[1] = word_madd2(x[1], y, &carry); @@ -600,68 +396,6 @@ inline word word8_linmul3(word z[8], const word x[8], word y, word carry) : "cc", "%rax", "%rdx"); return carry; -#elif defined(BOTAN_MP_USE_X86_32_MSVC_ASM) - - __asm { - mov edi,[z] - mov esi,[x] - mov eax,[esi] //load a - mul [y] //edx(hi):eax(lo)=a*b - add eax,[carry] //sum lo carry - adc edx,0 //sum hi carry - mov ecx,edx //store carry - mov [edi],eax //load a - - mov eax,[esi+4] //load a - mul [y] //edx(hi):eax(lo)=a*b - add eax,ecx //sum lo carry - adc edx,0 //sum hi carry - mov ecx,edx //store carry - mov [edi+4],eax //load a - - mov eax,[esi+8] //load a - mul [y] //edx(hi):eax(lo)=a*b - add eax,ecx //sum lo carry - adc edx,0 //sum hi carry - mov ecx,edx //store carry - mov [edi+8],eax //load a - - mov eax,[esi+12] //load a - mul [y] //edx(hi):eax(lo)=a*b - add eax,ecx //sum lo carry - adc edx,0 //sum hi carry - mov ecx,edx //store carry - mov [edi+12],eax //load a - - mov eax,[esi+16] //load a - mul [y] //edx(hi):eax(lo)=a*b - add eax,ecx //sum lo carry - adc edx,0 //sum hi carry - mov ecx,edx //store carry - mov [edi+16],eax //load a - - mov eax,[esi+20] //load a - mul [y] //edx(hi):eax(lo)=a*b - add eax,ecx //sum lo carry - adc edx,0 //sum hi carry - mov ecx,edx //store carry - mov [edi+20],eax //load a - - mov eax,[esi+24] //load a - mul [y] //edx(hi):eax(lo)=a*b - add eax,ecx //sum lo carry - adc edx,0 //sum hi carry - mov ecx,edx //store carry - mov [edi+24],eax //load a - - mov eax,[esi+28] //load a - mul [y] //edx(hi):eax(lo)=a*b - add eax,ecx //sum lo carry - adc edx,0 //sum hi carry - mov [edi+28],eax //load a - mov eax,edx //store carry - } - #else z[0] = word_madd2(x[0], y, &carry); z[1] = word_madd2(x[1], y, &carry); diff --git a/src/lib/math/mp/mp_madd.h b/src/lib/math/mp/mp_madd.h index 25659172b..531d6e663 100644 --- a/src/lib/math/mp/mp_madd.h +++ b/src/lib/math/mp/mp_madd.h @@ -30,16 +30,14 @@ namespace Botan { #error BOTAN_MP_WORD_BITS must be 32 or 64 #endif -#if defined(BOTAN_TARGET_ARCH_IS_X86_32) && (BOTAN_MP_WORD_BITS == 32) +#if defined(BOTAN_USE_GCC_INLINE_ASM) - #if defined(BOTAN_USE_GCC_INLINE_ASM) + #if defined(BOTAN_TARGET_ARCH_IS_X86_32) && (BOTAN_MP_WORD_BITS == 32) #define BOTAN_MP_USE_X86_32_ASM - #elif defined(BOTAN_BUILD_COMPILER_IS_MSVC) - #define BOTAN_MP_USE_X86_32_MSVC_ASM + #elif defined(BOTAN_TARGET_ARCH_IS_X86_64) && (BOTAN_MP_WORD_BITS == 64) + #define BOTAN_MP_USE_X86_64_ASM #endif -#elif defined(BOTAN_TARGET_ARCH_IS_X86_64) && (BOTAN_MP_WORD_BITS == 64) && defined(BOTAN_USE_GCC_INLINE_ASM) - #define BOTAN_MP_USE_X86_64_ASM #endif /* |