]> Cypherpunks repositories - gostls13.git/commitdiff
cmd/link: bump loong64 function alignment to 16 bytes
authorWANG Xuerui <git@xen0n.name>
Tue, 4 Apr 2023 08:35:06 +0000 (16:35 +0800)
committerGopher Robot <gobot@golang.org>
Fri, 7 Apr 2023 20:21:44 +0000 (20:21 +0000)
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>
src/cmd/link/internal/loong64/l.go

index e97a8686bf51f1bf0b35ba9614174c67e0bbe735..a6309f1a3a296c817b3ea23114e1e35c6ffc6897 100644 (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 */