feat(riscv64,loong64): operand tail, float DATA and honest port classification
Assisted-by: GLM 5.3 Flash
This commit is contained in:
Vendored
+40
@@ -0,0 +1,40 @@
|
||||
// Copyright (c) 2026 Petr Balvín <opensource@petrbalvin.org> (https://petrbalvin.org)
|
||||
// SPDX-License-Identifier: BSD-3-Clause
|
||||
|
||||
// Differential kernel for the riscv64 bookkeeping statements and the
|
||||
// slot-relative branches: FUNCDATA and PCDATA (the expanded forms of the
|
||||
// funcdata.h macros, contributing no bytes), UNDEF (the toolchain's ebreak),
|
||||
// and the JMP N(PC) slot jumps including the self-loop and the backward form.
|
||||
|
||||
#include "textflag.h"
|
||||
|
||||
TEXT ·bookkeep(SB), NOSPLIT, $8-8
|
||||
FUNCDATA $1, marks<>(SB)
|
||||
PCDATA $1, $-1
|
||||
MOV ZERO, ret+0(FP)
|
||||
PCDATA $1, $1
|
||||
UNDEF
|
||||
MOV $1, X10
|
||||
RET
|
||||
|
||||
TEXT ·slots(SB), NOSPLIT, $0-0
|
||||
MOV $1, X10
|
||||
JMP 2(PC)
|
||||
MOV $64, X11
|
||||
MOV $128, X12
|
||||
MOV $2, X11
|
||||
MOV $3, X12
|
||||
BEQ X10, X11, skip
|
||||
JMP -2(PC)
|
||||
|
||||
skip:
|
||||
JMP 0(PC)
|
||||
|
||||
TEXT ·marksreader(SB), NOSPLIT, $0-8
|
||||
MOV $marks<>(SB), X10
|
||||
MOV (X10), X11
|
||||
MOV X11, ret+0(FP)
|
||||
RET
|
||||
|
||||
GLOBL marks<>(SB), RODATA, $8
|
||||
DATA marks<>+0(SB)/8, $1234605616436508552
|
||||
Vendored
+21
@@ -0,0 +1,21 @@
|
||||
// Copyright (c) 2026 Petr Balvín <opensource@petrbalvin.org> (https://petrbalvin.org)
|
||||
// SPDX-License-Identifier: BSD-3-Clause
|
||||
|
||||
// Differential kernel for the loong64 two-operand BEQ/BNE spellings the
|
||||
// msan trampolines use: BEQ Rj, target compares against R0 (the beqz form).
|
||||
|
||||
#include "textflag.h"
|
||||
|
||||
TEXT ·branch2(SB), NOSPLIT, $0-8
|
||||
MOVV arg+0(FP), R4
|
||||
BEQ R4, zero
|
||||
ADDV $1, R4, R4
|
||||
|
||||
zero:
|
||||
MOVV $16, R5
|
||||
BNE R4, done
|
||||
ADDV $2, R4, R4
|
||||
|
||||
done:
|
||||
MOVV R4, ret+0(FP)
|
||||
RET
|
||||
Vendored
+27
@@ -0,0 +1,27 @@
|
||||
// Copyright (c) 2026 Petr Balvín <opensource@petrbalvin.org> (https://petrbalvin.org)
|
||||
// SPDX-License-Identifier: BSD-3-Clause
|
||||
|
||||
// Differential kernel for the loong64 DATA value forms the runtime's exp and
|
||||
// asm files use: floating-point initialisers stored as IEEE-754 bits and
|
||||
// string initialisers zero-padded within their declared width.
|
||||
|
||||
#include "textflag.h"
|
||||
|
||||
TEXT ·floatbits(SB), NOSPLIT, $0-8
|
||||
MOVV $floats<>(SB), R12
|
||||
MOVD 8(R12), F0
|
||||
MOVD F0, ret+0(FP)
|
||||
RET
|
||||
|
||||
TEXT ·stringhead(SB), NOSPLIT, $0-8
|
||||
MOVV $msg<>(SB), R12
|
||||
MOVV (R12), R13
|
||||
MOVV R13, ret+0(FP)
|
||||
RET
|
||||
|
||||
GLOBL floats<>(SB), RODATA, $16
|
||||
DATA floats<>+0(SB)/8, $0.0
|
||||
DATA floats<>+8(SB)/8, $0.5
|
||||
|
||||
GLOBL msg<>(SB), RODATA, $20
|
||||
DATA msg<>+0(SB)/20, $"call frame too large"
|
||||
Vendored
+40
@@ -0,0 +1,40 @@
|
||||
// Copyright (c) 2026 Petr Balvín <opensource@petrbalvin.org> (https://petrbalvin.org)
|
||||
// SPDX-License-Identifier: BSD-3-Clause
|
||||
|
||||
// Differential kernel for the riscv64 wide MOV immediates: the 64-bit
|
||||
// constants the toolchain materialises through shifted 32-bit parts or loads
|
||||
// from its pooled $i64 data symbols, and the frame-address immediates
|
||||
// ($name+off(FP)) lowered to ADDI against the hardware stack pointer.
|
||||
|
||||
#include "textflag.h"
|
||||
|
||||
TEXT ·poolload(SB), NOSPLIT, $0-16
|
||||
MOV arg+0(FP), X10
|
||||
MOV $0x0101010101010101, X16
|
||||
MUL X10, X16, X17
|
||||
MOV $0x123456789, X18
|
||||
ADD X18, X17, X17
|
||||
MOV X17, ret+8(FP)
|
||||
RET
|
||||
|
||||
TEXT ·shiftload(SB), NOSPLIT, $0-16
|
||||
MOV arg+0(FP), X10
|
||||
MOV $0x8000000000000000, X20
|
||||
MOV $0x100000000, X21
|
||||
ADD X21, X20, X20
|
||||
MOV $0x000fffffffffffda, X22
|
||||
XOR X22, X20, X20
|
||||
ADD X20, X10, X10
|
||||
MOV X10, ret+8(FP)
|
||||
RET
|
||||
|
||||
TEXT ·frameaddr(SB), NOSPLIT, $32-16
|
||||
MOV $ret+8(FP), X12
|
||||
MOV $scratch+0(FP), X13
|
||||
ADD X12, X13, X13
|
||||
MOV $slot+16(SP), X14
|
||||
SUB X14, X13, X13
|
||||
MOV X13, ret+8(FP)
|
||||
RET
|
||||
|
||||
GLOBL scratch<>(SB), NOPTR, $8
|
||||
Reference in New Issue
Block a user