or rcx, 0xFFFFFFFFFFFFFFFF
This is an optimization for size, but it does not break the dependency on the old value of rcx
(at least not yet, maybe someday, it's not an impossible feature). That's a minor point compared to overall cost of a strlen
but it's something to know so you can make the choice deliberately.
cld
Should be redundant, typical calling conventions specify that the direction flag is cleared at function call boundaries so your strlen
shouldn't be called with it set to backwards.
mov rax, 0xFFFFFFFFFFFFFFFF
sub rax, rcx
mov-ing a 64bit immediate is surprisingly slow, and also a huge instruction. An alternative is:
not rcx
mov rax, rcx