cmd/compile: don't use MOVOstore for move on plan9/amd64

The SSA compiler currently generates MOVOstore instructions
to optimize 16 bytes moves on AMD64 architecture.

However, we can't use the MOVOstore instruction on Plan 9,
because floating point operations are not allowed in the
note handler.

We rely on the useSSE flag to disable the use of the
MOVOstore instruction on Plan 9 and replace it by two
MOVQstore instructions.

Fixes #21625

Change-Id: Idfefcceadccafe1752b059b5fe113ce566c0e71c
Reviewed-on: https://go-review.googlesource.com/59171
Run-TryBot: David du Colombier <0intro@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ilya Tocar <ilya.tocar@intel.com>
This commit is contained in:
David du Colombier 2017-08-26 23:05:36 +02:00
parent c875cea7ae
commit adbfdfe377
3 changed files with 135 additions and 14 deletions

View file

@ -261,6 +261,11 @@ var allAsmTests = []*asmTests{
os: "linux",
tests: linuxPPC64LETests,
},
{
arch: "amd64",
os: "plan9",
tests: plan9AMD64Tests,
},
}
var linuxAMD64Tests = []*asmTest{
@ -2126,6 +2131,34 @@ var linuxPPC64LETests = []*asmTest{
},
}
var plan9AMD64Tests = []*asmTest{
// We should make sure that the compiler doesn't generate floating point
// instructions for non-float operations on Plan 9, because floating point
// operations are not allowed in the note handler.
// Array zeroing.
{
`
func $() [16]byte {
var a [16]byte
return a
}
`,
[]string{"\tMOVQ\t\\$0, \"\""},
[]string{},
},
// Array copy.
{
`
func $(a [16]byte) (b [16]byte) {
b = a
return
}
`,
[]string{"\tMOVQ\t\"\"\\.a\\+[0-9]+\\(SP\\), (AX|CX)", "\tMOVQ\t(AX|CX), \"\"\\.b\\+[0-9]+\\(SP\\)"},
[]string{},
},
}
// TestLineNumber checks to make sure the generated assembly has line numbers
// see issue #16214
func TestLineNumber(t *testing.T) {