feat(riscv64,loong64): PCALIGN, branch relaxation and operand shapes
Assisted-by: GLM 5.3 Flash
This commit is contained in:
Vendored
+51
@@ -0,0 +1,51 @@
|
||||
// The subtract-immediate fold, the TEQ/TNE trap pseudos, PRELDX, the FP
|
||||
// condition branches and the N(PC) branch spellings, against the toolchain.
|
||||
#include "textflag.h"
|
||||
|
||||
// func SubFold(x int64) int64
|
||||
TEXT ·SubFold(SB), NOSPLIT, $0-16
|
||||
MOVV x+0(FP), R8
|
||||
SUBV $0, R8
|
||||
SUBV $4, R9, R10
|
||||
SUBV $4096, R11
|
||||
SUBV $-4, R12
|
||||
SUB $1, R13
|
||||
SUBVU $4, R14
|
||||
SUBV $1048576, R15
|
||||
MOVV R8, ret+8(FP)
|
||||
RET
|
||||
|
||||
// func Traps(x int64) int64
|
||||
TEXT ·Traps(SB), NOSPLIT, $0-16
|
||||
MOVV x+0(FP), R4
|
||||
TEQ $4, R4, R5
|
||||
TEQ $4, R4
|
||||
TNE $6, R5, R6
|
||||
MOVV R4, ret+8(FP)
|
||||
RET
|
||||
|
||||
// func Prefetch(x int64) int64
|
||||
TEXT ·Prefetch(SB), NOSPLIT, $0-16
|
||||
MOVV x+0(FP), R7
|
||||
PRELDX 0(R7), $0x80001021, $0
|
||||
PRELDX -1(R7), $0x1021, $2
|
||||
MOVV R7, ret+8(FP)
|
||||
RET
|
||||
|
||||
// func BranchForms(x int64) int64
|
||||
TEXT ·BranchForms(SB), NOSPLIT, $0-16
|
||||
MOVV x+0(FP), R4
|
||||
|
||||
l1:
|
||||
BFPT l1
|
||||
BFPT FCC3, l1
|
||||
BFPF l1
|
||||
JMP -4(PC)
|
||||
JAL 1(PC)
|
||||
JAL (R4)
|
||||
|
||||
loop:
|
||||
ADDV $1, R4
|
||||
BEQ R4, R5, loop
|
||||
BNE R4, l1
|
||||
RET
|
||||
Reference in New Issue
Block a user