1
0
mirror of https://github.com/golang/go synced 2024-11-18 03:44:46 -07:00

go/types: match cmd/compile's alignment for complex64

Fixes #17584.

Change-Id: I3af31cc1f2e9c906f3b73e77f3b092624ba78fbe
Reviewed-on: https://go-review.googlesource.com/31939
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Robert Griesemer <gri@golang.org>
This commit is contained in:
Matthew Dempsky 2016-10-25 08:39:19 -07:00
parent 1986a450dd
commit 213ee3d20e
3 changed files with 12 additions and 0 deletions

View File

@ -42,3 +42,4 @@ func noptr(x int)
func wrapper(x int)
func f15271() (x uint32)
func f17584(x float32, y complex64)

View File

@ -306,3 +306,10 @@ TEXT ·f15271(SB), NOSPLIT, $0-4
// Return them.
PEXTRD $0, X0, x+0(FP)
RET
// issue 17584
TEXT ·f17584(SB), NOSPLIT, $12
MOVSS x+0(FP), X0
MOVSS y_real+4(FP), X0
MOVSS y_imag+8(FP), X0
RET

View File

@ -79,6 +79,10 @@ func (s *StdSizes) Alignof(T Type) int64 {
if a < 1 {
return 1
}
// complex{64,128} are aligned like [2]float{32,64}.
if isComplex(T) {
a /= 2
}
if a > s.MaxAlign {
return s.MaxAlign
}