shithub: riscv

ref: d65589c29941b16a5239f6f2e9c8f6fea5c863a2
dir: /sys/src/ape/lib/ap/68020/memchr.s/

View raw version
	TEXT	memchr(SB),$0
	MOVL	n+8(FP),R0
	BEQ	ret
	MOVL	s1+0(FP),A1
	MOVL	c+4(FP),R1

l1:	CMPB	R1,(A1)+
	BEQ	eq
	SUBL	$1,R0
	BNE	l1
	RTS

eq:	MOVL	A1,R0
	SUBL	$1,R0
ret:	RTS