1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071 |
- .set noreorder
- .set noat
- .align 3
- .globl strchr
- .ent strchr
- strchr:
- .frame sp, 0, ra
- .prologue 0
- zapnot a1, 1, a1
- ldq_u t0, 0(a0)
- sll a1, 8, t5
- andnot a0, 7, v0
- or t5, a1, a1
- lda t4, -1
- sll a1, 16, t5
- cmpbge zero, t0, t2
- mskqh t4, a0, t4
- or t5, a1, a1
- sll a1, 32, t5
- cmpbge zero, t4, t4
- or t5, a1, a1
- xor t0, a1, t1
- cmpbge zero, t1, t3
- or t2, t3, t0
- andnot t0, t4, t0
- bne t0, $found
- $loop: ldq t0, 8(v0)
- addq v0, 8, v0
- nop
- xor t0, a1, t1
- cmpbge zero, t0, t2
- cmpbge zero, t1, t3
- or t2, t3, t0
- beq t0, $loop
- $found: negq t0, t1
- and t0, t1, t0
- and t0, t3, t1
- beq t1, $retnull
- and t0, 0xf0, t2
- and t0, 0xcc, t3
- and t0, 0xaa, t4
- cmovne t2, 4, t2
- cmovne t3, 2, t3
- cmovne t4, 1, t4
- addq t2, t3, t2
- addq v0, t4, v0
- addq v0, t2, v0
- ret
- $retnull:
- mov zero, v0
- ret
- .end strchr
- EXPORT_SYMBOL(strchr)
|