1
0
mirror of https://github.com/golang/go synced 2024-11-17 02:14:42 -07:00

cmd/link: bump loong64 function alignment to 16 bytes

The loong64 PCALIGN directive works with PCs relative to beginning of
functions. So if the function alignment is less than that requested by
PCALIGN, the following code may in fact not be aligned as such, leading
to unexpected performance.

The current function alignment on loong64 is 8 bytes, which seems to
stem from mips64 or riscv64. In order to make performance more
predictable on loong64, it is raised to 16 bytes to ensure that at
least `PCALIGN $16` works.

As alignment of loops written in Go is yet to be tackled, and the
codegen is not otherwise touched, benchmark numbers for this change are
not going to be meaningful, and not included.

Change-Id: I2120ef3746ce067e274920c82091810073bfa3be
Reviewed-on: https://go-review.googlesource.com/c/go/+/481936
Auto-Submit: Ian Lance Taylor <iant@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Run-TryBot: Ian Lance Taylor <iant@google.com>
Run-TryBot: WANG Xuerui <git@xen0n.name>
Reviewed-by: Keith Randall <khr@google.com>
Reviewed-by: Keith Randall <khr@golang.org>
This commit is contained in:
WANG Xuerui 2023-04-04 16:35:06 +08:00 committed by Gopher Robot
parent 157999f512
commit 0d3c23fe87

View File

@ -7,7 +7,7 @@ package loong64
const (
maxAlign = 32 // max data alignment
minAlign = 1 // min data alignment
funcAlign = 8
funcAlign = 16
)
/* Used by ../../internal/ld/dwarf.go */