feat(riscv64,loong64): PCALIGN, branch relaxation and operand shapes
Assisted-by: GLM 5.3 Flash
This commit is contained in:
Vendored
+33
@@ -0,0 +1,33 @@
|
||||
// PCALIGN padding on loong64: andi $0, $0, 0 (the architecture's NOP), plus
|
||||
// the automatic loop-head alignment to a 16-byte boundary.
|
||||
#include "textflag.h"
|
||||
|
||||
// func Pad16(x int64) int64
|
||||
TEXT ·Pad16(SB), NOSPLIT, $0-16
|
||||
MOVV x+0(FP), R4
|
||||
PCALIGN $16
|
||||
ADDV $1, R4
|
||||
MOVV R4, ret+8(FP)
|
||||
RET
|
||||
|
||||
// func Pad32(x int64) int64
|
||||
TEXT ·Pad32(SB), NOSPLIT, $0-16
|
||||
MOVV x+0(FP), R4
|
||||
PCALIGN $32
|
||||
ADDV $1, R4
|
||||
MOVV R4, ret+8(FP)
|
||||
RET
|
||||
|
||||
// func LoopAlign(x int64) int64
|
||||
TEXT ·LoopAlign(SB), NOSPLIT, $0-16
|
||||
MOVV x+0(FP), R4
|
||||
MOVV $10, R5
|
||||
|
||||
loop:
|
||||
BEQ R4, R5, done
|
||||
ADDV $1, R4
|
||||
JMP loop
|
||||
|
||||
done:
|
||||
MOVV R4, ret+8(FP)
|
||||
RET
|
||||
Reference in New Issue
Block a user