strchr.s - scc - simple c99 compiler
(HTM) git clone git://git.simple-cc.org/scc
(DIR) Log
(DIR) Files
(DIR) Refs
(DIR) Submodules
(DIR) README
(DIR) LICENSE
---
strchr.s (325B)
---
1 .file "strchr.s"
2
3 .text
4 .globl strchr,_strchr
5 _strchr:
6 strchr:
7 movq %rdi,%r8
8
9 movb $0,%al
10 movq $-1,%rcx
11 cld
12 repne
13 scasb
14
15 leaq 0(%rdi),%rcx
16 subq %r8,%rcx
17
18 cmp %rdi,%rsi /* set ZF to 0 */
19
20 movq %r8,%rdi
21 movb %sil,%al
22 repne
23 scasb
24 je found
25
26 none:
27 xor %rax,%rax
28 ret
29
30 found:
31 leaq -1(%rdi),%rax
32 ret