1
0
mirror of https://github.com/golang/go synced 2024-11-22 21:30:02 -07:00
go/src/runtime/memclr_mips64x.s
Tobias Klauser f19e400180 all: remove more leftover // +build lines
CL 344955 and CL 359476 removed almost all // +build lines, but leaving
some assembly files and generating scripts. Also, some files were added
with // +build lines after CL 359476 was merged. Remove these or rename
files where more appropriate.

For #41184

Change-Id: I7eb85a498ed9788b42a636e775f261d755504ffa
Reviewed-on: https://go-review.googlesource.com/c/go/+/361480
Trust: Tobias Klauser <tobias.klauser@gmail.com>
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Bryan C. Mills <bcmills@google.com>
2021-11-06 10:24:44 +00:00

100 lines
1.7 KiB
ArmAsm
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

// Copyright 2015 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
//go:build mips64 || mips64le
#include "go_asm.h"
#include "textflag.h"
// See memclrNoHeapPointers Go doc for important implementation constraints.
// func memclrNoHeapPointers(ptr unsafe.Pointer, n uintptr)
TEXT runtime·memclrNoHeapPointers(SB),NOSPLIT,$0-16
MOVV ptr+0(FP), R1
MOVV n+8(FP), R2
ADDV R1, R2, R4
// if less than 16 bytes or no MSA, do words check
SGTU $16, R2, R3
BNE R3, no_msa
MOVBU internalcpu·MIPS64X+const_offsetMIPS64XHasMSA(SB), R3
BEQ R3, R0, no_msa
VMOVB $0, W0
SGTU $128, R2, R3
BEQ R3, msa_large
AND $15, R2, R5
XOR R2, R5, R6
ADDVU R1, R6
msa_small:
VMOVB W0, (R1)
ADDVU $16, R1
SGTU R6, R1, R3
BNE R3, R0, msa_small
BEQ R5, R0, done
VMOVB W0, -16(R4)
JMP done
msa_large:
AND $127, R2, R5
XOR R2, R5, R6
ADDVU R1, R6
msa_large_loop:
VMOVB W0, (R1)
VMOVB W0, 16(R1)
VMOVB W0, 32(R1)
VMOVB W0, 48(R1)
VMOVB W0, 64(R1)
VMOVB W0, 80(R1)
VMOVB W0, 96(R1)
VMOVB W0, 112(R1)
ADDVU $128, R1
SGTU R6, R1, R3
BNE R3, R0, msa_large_loop
BEQ R5, R0, done
VMOVB W0, -128(R4)
VMOVB W0, -112(R4)
VMOVB W0, -96(R4)
VMOVB W0, -80(R4)
VMOVB W0, -64(R4)
VMOVB W0, -48(R4)
VMOVB W0, -32(R4)
VMOVB W0, -16(R4)
JMP done
no_msa:
// if less than 8 bytes, do one byte at a time
SGTU $8, R2, R3
BNE R3, out
// do one byte at a time until 8-aligned
AND $7, R1, R3
BEQ R3, words
MOVB R0, (R1)
ADDV $1, R1
JMP -4(PC)
words:
// do 8 bytes at a time if there is room
ADDV $-7, R4, R2
SGTU R2, R1, R3
BEQ R3, out
MOVV R0, (R1)
ADDV $8, R1
JMP -4(PC)
out:
BEQ R1, R4, done
MOVB R0, (R1)
ADDV $1, R1
JMP -3(PC)
done:
RET