The previous code can be improved in replacing partial registers (al and sil) with the fill register.
Replace MOV AL,BYTE PTR [rcx] with MOVZX rax,BYTE PTR [rcx] and
Replace MOV SIL,AL with MOV RSI,rax and
Replace MOV AL,SIL with MOV RAX,RSI.
It becomes:
push rsi
xor r8d,r8d
xor eax,eax
xor edx,edx
jmp SHORT @Loop_0
; ==================================================================================
ALIGN 16
; ==================================================================================
@Loop :
or r8,rax
@Loop_0 :
movzx rax,BYTE PTR [rcx]
mov rsi,rax
inc rcx
test al,al
jz SHORT @EndLoop
shl r8,4
cmp al,'9'
cmovg ax,dx
cmp al,'0'
cmovl ax,dx
and al,0fh
jnz SHORT @Loop
mov rax,rsi
and al,5fh
cmp al,'F'
cmovg rax,rdx
cmp al,'A'
cmovl rax,rdx
sub al,37h
jmp SHORT @Loop
@EndLoop :
pop rsi
mov rax,r8
ret