fix(loong64): FP immediates through R30 and unsigned branch forms

Assisted-by: GLM 5.3
This commit is contained in:
2026-09-19 23:49:13 +02:00
parent 79a2c16bac
commit ebdf14939f
8 changed files with 168 additions and 28 deletions
+18
View File
@@ -0,0 +1,18 @@
// Copyright (c) 2026 Petr Balvín <opensource@petrbalvin.org> (https://petrbalvin.org)
// SPDX-License-Identifier: BSD-3-Clause
// branchu exercises the unsigned 16-bit branches in their two- and
// three-operand spellings: with a single register the toolchain keeps the
// register-register form against R0 (never taken) rather than a zero-form
// pseudo. Byte-parity-checked against go tool asm.
#include "textflag.h"
TEXT ·unsigned(SB), NOSPLIT, $0
BLTU R4, done
BGEU R5, done
BLTU R6, R7, done
BGEU R8, R9, done
done:
RET
+17
View File
@@ -0,0 +1,17 @@
// Copyright (c) 2026 Petr Balvín <opensource@petrbalvin.org> (https://petrbalvin.org)
// SPDX-License-Identifier: BSD-3-Clause
// movwfp exercises MOVW $c, Fd, the immediate-to-F-register form the
// toolchain's optab accepts: the constant is materialised in R30 (ori for
// the positive span, addi.w for the negative span) and moved across with
// movgr2fr.w. Byte-parity-checked against go tool asm.
#include "textflag.h"
TEXT ·movwfp(SB), NOSPLIT, $0
MOVW $1, F0
MOVW $0x2, F4
MOVW $0x7ff, F8
MOVW $-1, F12
MOVW $-2048, F16
RET