-/* $OpenBSD: bcmp.S,v 1.4 2004/10/08 14:42:09 pefo Exp $ */
+/* $OpenBSD: bcmp.S,v 1.5 2022/01/29 05:47:36 visa Exp $ */
/*-
* Copyright (c) 1991, 1993
* The Regents of the University of California. All rights reserved.
*/
LEAF(bcmp, 0)
.set noreorder
- blt a2, 16, smallcmp # is it worth any trouble?
+ blt a2, 16, .Lsmallcmp # is it worth any trouble?
xor v0, a0, a1 # compare low two bits of addresses
and v0, v0, 3
PTR_SUBU a3, zero, a1 # compute # bytes to word align address
- bne v0, zero, unalignedcmp # not possible to align addresses
+ bne v0, zero, .Lunalignedcmp # not possible to align addresses
and a3, a3, 3
beq a3, zero, 1f
LWHI v0, 0(a0) # read 1, 2, or 3 bytes
LWHI v1, 0(a1)
PTR_ADDU a1, a1, a3
- bne v0, v1, nomatch
+ bne v0, v1, .Lnomatch
PTR_ADDU a0, a0, a3
1:
and a3, a2, ~3 # compute number of whole words left
lw v0, 0(a0) # compare words
lw v1, 0(a1)
PTR_ADDU a0, a0, 4
- bne v0, v1, nomatch
+ bne v0, v1, .Lnomatch
PTR_ADDU a1, a1, 4
bne a0, a3, 2b
nop
- b smallcmp # finish remainder
+ b .Lsmallcmp # finish remainder
nop
-unalignedcmp:
+.Lunalignedcmp:
beq a3, zero, 2f
PTR_SUBU a2, a2, a3 # subtract from remaining count
PTR_ADDU a3, a3, a0 # compute ending address
lbu v0, 0(a0) # compare bytes until a1 word aligned
lbu v1, 0(a1)
PTR_ADDU a0, a0, 1
- bne v0, v1, nomatch
+ bne v0, v1, .Lnomatch
PTR_ADDU a1, a1, 1
bne a0, a3, 1b
nop
LWLO v0, 3(a0)
lw v1, 0(a1)
PTR_ADDU a0, a0, 4
- bne v0, v1, nomatch
+ bne v0, v1, .Lnomatch
PTR_ADDU a1, a1, 4
bne a0, a3, 3b
nop
-smallcmp:
- ble a2, zero, match
+.Lsmallcmp:
+ ble a2, zero, .Lmatch
PTR_ADDU a3, a2, a0 # compute ending address
1:
lbu v0, 0(a0)
lbu v1, 0(a1)
PTR_ADDU a0, a0, 1
- bne v0, v1, nomatch
+ bne v0, v1, .Lnomatch
PTR_ADDU a1, a1, 1
bne a0, a3, 1b
nop
-match:
+.Lmatch:
j ra
move v0, zero
-nomatch:
+.Lnomatch:
j ra
dli v0, 1
END(bcmp)
-/* $OpenBSD: bzero.S,v 1.6 2004/10/08 14:42:09 pefo Exp $ */
+/* $OpenBSD: bzero.S,v 1.7 2022/01/29 05:47:36 visa Exp $ */
/*-
* Copyright (c) 1991, 1993
* The Regents of the University of California. All rights reserved.
ALEAF(blkclr)
.set noreorder
#ifdef _STANDALONE
- blt a1, 12, smallclr # small amount to clear?
+ blt a1, 12, .Lsmallclr # small amount to clear?
PTR_SUBU a3, zero, a0 # compute # bytes to word align address
and a3, a3, 3
beq a3, zero, 1f # skip if word aligned
bne a0, a3, 2b # unrolling loop does not help
sw zero, -4(a0) # since we are limited by memory speed
#else
- blt a1, 24, smallclr # small amount to clear?
+ blt a1, 24, .Lsmallclr # small amount to clear?
PTR_SUBU a3, zero, a0 # compute # bytes to word align address
and a3, a3, 7
beq a3, zero, 1f # skip if word aligned
bne a0, a3, 2b # unrolling loop does not help
sd zero, -8(a0) # since we are limited by memory speed
#endif
-smallclr:
+.Lsmallclr:
ble a1, zero, 2f
PTR_ADDU a3, a1, a0 # compute ending address
1:
-/* $OpenBSD: memmove.S,v 1.5 2016/11/14 15:02:54 visa Exp $ */
+/* $OpenBSD: memmove.S,v 1.6 2022/01/29 05:47:36 visa Exp $ */
/*-
* Copyright (c) 1991, 1993
* The Regents of the University of California. All rights reserved.
PTR_ADDU t0, a0, a2 # t0 = end of s1 region
sltu t1, a1, t0
sltu t2, a0, a1
- j forward # do forward copy
+ j .Lforward # do forward copy
slt t2, a2, 12 # check for small copy
ALEAF(memmove)
sltu t1, a1, t0
sltu t2, a0, a1
and t1, t1, t2 # t1 = true if from < to < (from+len)
- beq t1, zero, forward # non overlapping, do forward copy
+ beq t1, zero, .Lforward # non overlapping, do forward copy
slt t2, a2, 12 # check for small copy
ble a2, zero, 2f
2:
j ra
nop
-forward:
+.Lforward:
#ifdef _STANDALONE
- bne t2, zero, smallcpy # do a small bcopy
+ bne t2, zero, .Lsmallcpy # do a small bcopy
xor v1, a0, a1 # compare low two bits of addresses
and v1, v1, 3
PTR_SUBU a3, zero, a1 # compute # bytes to word align address
- beq v1, zero, aligned # addresses can be word aligned
+ beq v1, zero, .Laligned # addresses can be word aligned
and a3, a3, 3
beq a3, zero, 1f
PTR_ADDU a1, a1, 4
bne a0, a3, 2b
nop # We have to do this mmu-bug.
- b smallcpy
+ b .Lsmallcpy
nop
-aligned:
+.Laligned:
beq a3, zero, 1f
PTR_SUBU a2, a2, a3 # subtract from remaining count
LWHI v1, 0(a0) # copy 1, 2, or 3 bytes to align
bne a0, a3, 2b
PTR_ADDU a1, a1, 4
#else
- bne t2, zero, smallcpy # do a small bcopy
+ bne t2, zero, .Lsmallcpy # do a small bcopy
xor v1, a0, a1 # compare low three bits of addresses
and v1, v1, 7
PTR_SUBU a3, zero, a1 # compute # bytes to dword align address
- beq v1, zero, aligned # addresses can be dword aligned
+ beq v1, zero, .Laligned # addresses can be dword aligned
and a3, a3, 7
beq a3, zero, 1f
1:
and v1, a2, 7 # compute number of dwords left
PTR_SUBU a3, a2, v1
- beq a3, zero, smallcpy
+ beq a3, zero, .Lsmallcpy
move a2, v1
PTR_ADDU a3, a3, a0 # compute ending address
2:
PTR_ADDU a1, a1, 8
bne a0, a3, 2b
nop # We have to do this mmu-bug.
- b smallcpy
+ b .Lsmallcpy
nop
-aligned:
+.Laligned:
beq a3, zero, 1f
PTR_SUBU a2, a2, a3 # subtract from remaining count
LDHI v1, 0(a0) # copy 1-7 bytes to align
1:
and v1, a2, 7 # compute number of whole dwords left
PTR_SUBU a3, a2, v1
- beq a3, zero, smallcpy
+ beq a3, zero, .Lsmallcpy
move a2, v1
PTR_ADDU a3, a3, a0 # compute ending address
2:
bne a0, a3, 2b
PTR_ADDU a1, a1, 8
#endif
-smallcpy:
+.Lsmallcpy:
ble a2, zero, 2f
PTR_ADDU a3, a2, a0 # compute ending address
1:
-/* $OpenBSD: strcmp.S,v 1.4 2004/10/08 14:42:09 pefo Exp $ */
+/* $OpenBSD: strcmp.S,v 1.5 2022/01/29 05:47:36 visa Exp $ */
/*-
* Copyright (c) 1991, 1993
* The Regents of the University of California. All rights reserved.
1:
lbu t0, 0(a0) # get two bytes and compare them
lbu t1, 0(a1)
- beq t0, zero, LessOrEq # end of first string?
+ beq t0, zero, .LessOrEq # end of first string?
nop
- bne t0, t1, NotEq
+ bne t0, t1, .LNotEq
nop
lbu t0, 1(a0) # unroll loop
lbu t1, 1(a1)
- beq t0, zero, LessOrEq # end of first string?
+ beq t0, zero, .LessOrEq # end of first string?
PTR_ADDU a0, a0, 2
beq t0, t1, 1b
PTR_ADDU a1, a1, 2
-NotEq:
+.LNotEq:
j ra
PTR_SUBU v0, t0, t1
-LessOrEq:
+.LessOrEq:
j ra
PTR_SUBU v0, zero, t1
END(strcmp)