CryptoPkg/IntrinsicLib: Corrects __ashrdi3 and adds __lshrdi3

The ashrdi3 function should do arithmetic shift instead of logic using
sar instruction. Also adds __lshrdi3 implementation to correct build
using LLVM

Signed-off-by: Savva Mitrofanov <savvamtr@gmail.com>
This commit is contained in:
Savva Mitrofanov 2023-02-06 23:06:26 +06:00 committed by Mikhail Krichanov
parent e19d725d4c
commit 9252fc0e1a
1 changed files with 25 additions and 1 deletions

View File

@ -23,6 +23,31 @@
;------------------------------------------------------------------------------
global ASM_PFX(__ashrdi3)
ASM_PFX(__ashrdi3):
cmp cl,0x40
jnc ReturnZero
cmp cl,0x20
jnc CounterMore32
shrd eax,edx,cl
sar edx,cl
ret
CounterMore32:
mov eax,edx
xor edx,edx
and cl,0x1f
sar eax,cl
ret
ReturnZero:
xor eax,eax
xor edx,edx
ret
;------------------------------------------------------------------------------
;
; void __cdecl __lshrdi3 (void)
;
;------------------------------------------------------------------------------
global ASM_PFX(__lshrdi3)
ASM_PFX(__lshrdi3):
cmp cl,0x40
jnc _Exit
cmp cl,0x20
@ -40,4 +65,3 @@ _Exit:
xor eax,eax
xor edx,edx
ret