mirror of
https://github.com/golang/go
synced 2024-11-18 20:04:52 -07:00
go/analyis/passes/asmdecl: allow loading both parts of a complex with one instruction
Update golang/go#35264 Change-Id: I4317c75cc5acc592ab739b0aab4cd85280858219 Reviewed-on: https://go-review.googlesource.com/c/tools/+/204537 Reviewed-by: Alan Donovan <adonovan@google.com> Run-TryBot: Keith Randall <khr@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org>
This commit is contained in:
parent
fda23558a1
commit
6b7b8b79ae
@ -661,6 +661,10 @@ func asmCheckVar(badf func(string, ...interface{}), fn *asmFunc, line, expr stri
|
|||||||
src = 4
|
src = 4
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
|
if op == "MOVO" || op == "MOVOU" {
|
||||||
|
src = 16
|
||||||
|
break
|
||||||
|
}
|
||||||
if strings.HasPrefix(op, "SET") {
|
if strings.HasPrefix(op, "SET") {
|
||||||
// SETEQ, etc
|
// SETEQ, etc
|
||||||
src = 1
|
src = 1
|
||||||
@ -736,6 +740,11 @@ func asmCheckVar(badf func(string, ...interface{}), fn *asmFunc, line, expr stri
|
|||||||
vk = v.inner[0].kind
|
vk = v.inner[0].kind
|
||||||
vs = v.inner[0].size
|
vs = v.inner[0].size
|
||||||
vt = v.inner[0].typ
|
vt = v.inner[0].typ
|
||||||
|
case asmComplex:
|
||||||
|
// Allow a single instruction to load both parts of a complex.
|
||||||
|
if int(kind) == vs {
|
||||||
|
kind = asmComplex
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if addr {
|
if addr {
|
||||||
vk = asmKind(archDef.ptrSize)
|
vk = asmKind(archDef.ptrSize)
|
||||||
|
@ -228,7 +228,6 @@ TEXT ·argiface(SB),0,$0-32
|
|||||||
|
|
||||||
TEXT ·argcomplex(SB),0,$24 // want `wrong argument size 0; expected \$\.\.\.-24`
|
TEXT ·argcomplex(SB),0,$24 // want `wrong argument size 0; expected \$\.\.\.-24`
|
||||||
MOVSS x+0(FP), X0 // want `invalid MOVSS of x\+0\(FP\); complex64 is 8-byte value containing x_real\+0\(FP\) and x_imag\+4\(FP\)`
|
MOVSS x+0(FP), X0 // want `invalid MOVSS of x\+0\(FP\); complex64 is 8-byte value containing x_real\+0\(FP\) and x_imag\+4\(FP\)`
|
||||||
MOVSD x+0(FP), X0 // want `invalid MOVSD of x\+0\(FP\); complex64 is 8-byte value containing x_real\+0\(FP\) and x_imag\+4\(FP\)`
|
|
||||||
MOVSS x_real+0(FP), X0
|
MOVSS x_real+0(FP), X0
|
||||||
MOVSD x_real+0(FP), X0 // want `invalid MOVSD of x_real\+0\(FP\); real\(complex64\) is 4-byte value`
|
MOVSD x_real+0(FP), X0 // want `invalid MOVSD of x_real\+0\(FP\); real\(complex64\) is 4-byte value`
|
||||||
MOVSS x_real+4(FP), X0 // want `invalid offset x_real\+4\(FP\); expected x_real\+0\(FP\)`
|
MOVSS x_real+4(FP), X0 // want `invalid offset x_real\+4\(FP\); expected x_real\+0\(FP\)`
|
||||||
@ -242,6 +241,13 @@ TEXT ·argcomplex(SB),0,$24 // want `wrong argument size 0; expected \$\.\.\.-24
|
|||||||
MOVSS y_imag+16(FP), X0 // want `invalid MOVSS of y_imag\+16\(FP\); imag\(complex128\) is 8-byte value`
|
MOVSS y_imag+16(FP), X0 // want `invalid MOVSS of y_imag\+16\(FP\); imag\(complex128\) is 8-byte value`
|
||||||
MOVSD y_imag+16(FP), X0
|
MOVSD y_imag+16(FP), X0
|
||||||
MOVSS y_imag+24(FP), X0 // want `invalid offset y_imag\+24\(FP\); expected y_imag\+16\(FP\)`
|
MOVSS y_imag+24(FP), X0 // want `invalid offset y_imag\+24\(FP\); expected y_imag\+16\(FP\)`
|
||||||
|
// Loading both parts of a complex is ok: see issue 35264.
|
||||||
|
MOVSD x+0(FP), X0
|
||||||
|
MOVO y+8(FP), X0
|
||||||
|
MOVOU y+8(FP), X0
|
||||||
|
// These are not ok.
|
||||||
|
MOVO x+0(FP), X0 // want `invalid MOVO of x\+0\(FP\); complex64 is 8-byte value containing x_real\+0\(FP\) and x_imag\+4\(FP\)`
|
||||||
|
MOVOU x+0(FP), X0 // want `invalid MOVOU of x\+0\(FP\); complex64 is 8-byte value containing x_real\+0\(FP\) and x_imag\+4\(FP\)`
|
||||||
RET
|
RET
|
||||||
|
|
||||||
TEXT ·argstruct(SB),0,$64 // want `wrong argument size 0; expected \$\.\.\.-24`
|
TEXT ·argstruct(SB),0,$64 // want `wrong argument size 0; expected \$\.\.\.-24`
|
||||||
|
Loading…
Reference in New Issue
Block a user