From: WANG Xuerui Date: Tue, 4 Apr 2023 08:35:06 +0000 (+0800) Subject: cmd/link: bump loong64 function alignment to 16 bytes X-Git-Tag: go1.21rc1~993 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=0d3c23fe87ca0ee727d833ce11ab16b405a93ea3;p=gostls13.git 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 TryBot-Result: Gopher Robot Reviewed-by: Ian Lance Taylor Run-TryBot: Ian Lance Taylor Run-TryBot: WANG Xuerui Reviewed-by: Keith Randall Reviewed-by: Keith Randall --- diff --git a/src/cmd/link/internal/loong64/l.go b/src/cmd/link/internal/loong64/l.go index e97a8686bf..a6309f1a3a 100644 --- a/src/cmd/link/internal/loong64/l.go +++ b/src/cmd/link/internal/loong64/l.go @@ -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 */