Skip to content

Instantly share code, notes, and snippets.

@Unam3dd
Created May 30, 2023 16:34
Show Gist options
  • Save Unam3dd/12f4f436d77b7a4903a351ebc9475910 to your computer and use it in GitHub Desktop.
Save Unam3dd/12f4f436d77b7a4903a351ebc9475910 to your computer and use it in GitHub Desktop.
Strlen SSE 4.2
.intel_syntax noprefix
.file "__strlen_sse42"
.section .text, "ax"
.globl __vs_strlen_sse42
__vs_strlen_sse42:
endbr64
xor rax, rax
test rdi, rdi
jz .L_null
mov rdx, rdi
pxor xmm0, xmm0
.L_loop:
pcmpistri xmm0, xmmword ptr [rdx+rax*1], 0b1000
add eax, ecx
test ecx, ecx
jnz .L_loop
.L_null:
ret
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment