5 ms·
Shouldn't your snippet be using lzcnt? I can't see how this would result in the desired lookup. for Zen5 rustc creates the following: utf8_sequence_length_l
by shiftingleft 11mo ago
Shouldn't your snippet be using lzcnt? I can't see how this would result in the desired lookup.
for Zen5 rustc creates the following:
utf8_sequence_length_lookup:
shl edi, 24
mov ecx, 274945
not edi
lzcnt eax, edi
shl al, 2
shrx rax, rcx, rax
and al, 7
ret
https://rust.godbolt.org/z/hz1eKjnaG https://rust.godbolt.org/z/hz1eKjnaG
- Cold_Miserable 11mo agoI can't see any elegant solution. \n Struggling proc \n lzcnt ecx,ecx \n test cl,cl \n setz al \n lea edx,[ecx-2] ;[0,1,2] \n cmp rdx,2 \n cmovle eax,ecx \n ret \n Struggling endp
- userbinator 11mo agoand the leading count comes in cl We can assume the count has already been done.
- shiftingleft 11mo agoAh I can't read, thanks :-)