1TEXT strchr(SB), $-4 2 MOVBU c+4(FP), R1 3 CMP $0, R1 4 BEQ _null 5 6_strchr: /* not looking for a null, byte at a time */ 7 MOVBU.P 1(R0), R2 8 CMP R1, R2 9 BEQ _sub1 10 11 CMP $0, R2 12 BNE _strchr 13 14_return0: /* character not found in string, return 0 */ 15 MOVW $0, R0 16 RET 17 18_null: /* looking for null, align */ 19 AND.S $3, R0, R2 20 BEQ _aligned 21 22 MOVBU.P 1(R0), R4 23 CMP $0, R4 24 BEQ _sub1 25 B _null 26 27_aligned: 28 MOVW $0xFF, R3 /* mask */ 29 30_loop: 31 MOVW.P 4(R0), R4 /* 4 at a time */ 32 TST R4, R3 /* AND.S R2, R3, Rx */ 33 BEQ _sub4 34 TST R4>>8, R3 35 BEQ _sub3 36 TST R4>>16, R3 37 BEQ _sub2 38 TST R4>>24, R3 39 BNE _loop 40 41_sub1: /* compensate for pointer increment */ 42 SUB $1, R0 43 RET 44_sub2: 45 SUB $2, R0 46 RET 47_sub3: 48 SUB $3, R0 49 RET 50_sub4: 51 SUB $4, R0 52 RET 53