34 lines
626 B
ArmAsm
34 lines
626 B
ArmAsm
// 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
|