feat(arm64): whole-vector moves, bookkeeping ops and truncating-move lowering
Assisted-by: GLM 5.3 Flash
This commit is contained in:
Vendored
+31
@@ -0,0 +1,31 @@
|
||||
// Copyright (c) 2026 Petr Balvín <opensource@petrbalvin.org> (https://petrbalvin.org)
|
||||
// SPDX-License-Identifier: BSD-3-Clause
|
||||
|
||||
// Differential kernel for the arm64 bookkeeping statements: the funcdata.h
|
||||
// pseudo-directives (GO_ARGS, NO_LOCAL_POINTERS, FUNCDATA, PCDATA) contribute
|
||||
// no instruction bytes, and every function is byte-compared against
|
||||
// go tool asm.
|
||||
|
||||
#include "textflag.h"
|
||||
#include "funcdata.h"
|
||||
|
||||
// func bookkeep()
|
||||
TEXT ·bookkeep(SB), NOSPLIT, $8-0
|
||||
GO_ARGS
|
||||
FUNCDATA $3, inline_tree(SB)
|
||||
PCDATA $1, $2
|
||||
MOVD R1, 0(RSP)
|
||||
RET
|
||||
|
||||
// func bookkeepNoLocals()
|
||||
TEXT ·bookkeepNoLocals(SB), NOSPLIT, $16-0
|
||||
NO_LOCAL_POINTERS
|
||||
PCDATA $0, $0
|
||||
PCDATA $1, $1
|
||||
MOVD R2, 8(RSP)
|
||||
RET
|
||||
|
||||
// func bookkeepPlain()
|
||||
TEXT ·bookkeepPlain(SB), NOSPLIT, $0-0
|
||||
MOVD R3, R4
|
||||
RET
|
||||
Vendored
+57
@@ -0,0 +1,57 @@
|
||||
// Copyright (c) 2026 Petr Balvín <opensource@petrbalvin.org> (https://petrbalvin.org)
|
||||
// SPDX-License-Identifier: BSD-3-Clause
|
||||
|
||||
// Differential kernel for the arm64 whole-vector moves between a general
|
||||
// register and an arranged vector (VMOV/VDUP Rs, Vd.<T>), the two-operand
|
||||
// accumulate spellings VADD/VSUB Vm, Vn, and the toolchain-reserved
|
||||
// R18_PLATFORM register name. Every function is byte-compared against
|
||||
// go tool asm.
|
||||
|
||||
#include "textflag.h"
|
||||
|
||||
// func gpIntoVector()
|
||||
TEXT ·gpIntoVector(SB), NOSPLIT, $0-0
|
||||
VMOV R1, V2.B8
|
||||
VMOV R3, V4.B16
|
||||
VMOV R5, V6.H4
|
||||
VMOV R7, V8.H8
|
||||
VMOV R9, V10.S2
|
||||
VMOV R11, V12.S4
|
||||
VMOV R13, V14.D2
|
||||
VDUP R15, V16.B8
|
||||
VDUP R17, V18.B16
|
||||
VDUP R19, V20.H8
|
||||
VDUP R21, V22.S4
|
||||
VDUP R23, V24.D2
|
||||
RET
|
||||
|
||||
// func simdAccumulate()
|
||||
TEXT ·simdAccumulate(SB), NOSPLIT, $0-0
|
||||
VADD V7, V8
|
||||
VSUB V7, V8
|
||||
VADD V1, V2
|
||||
VSUB V30, V31
|
||||
VADD V0.B16, V1.B16, V2.B16
|
||||
VSUB V0.S4, V1.S4, V2.S4
|
||||
RET
|
||||
|
||||
// func truncMove()
|
||||
TEXT ·truncMove(SB), NOSPLIT, $0-0
|
||||
MOVB R3, R4
|
||||
MOVH R5, R6
|
||||
MOVW R9, R10
|
||||
MOVBU R3, R4
|
||||
MOVHU R3, R4
|
||||
MOVWU R3, R4
|
||||
MOVD R3, R4
|
||||
RET
|
||||
|
||||
// func platformRegister()
|
||||
TEXT ·platformRegister(SB), NOSPLIT, $0-0
|
||||
MOVD R18_PLATFORM, R3
|
||||
MOVW R18_PLATFORM, R4
|
||||
MOVD R3, R18_PLATFORM
|
||||
MOVD 0x68(R18_PLATFORM), R5
|
||||
MOVD R5, 0x68(R18_PLATFORM)
|
||||
MOVW 8(R18_PLATFORM), R6
|
||||
RET
|
||||
Reference in New Issue
Block a user