]> Cypherpunks repositories - gostls13.git/commitdiff
cmd/compile: don't use duffzero on Plan 9
authorDavid du Colombier <0intro@gmail.com>
Wed, 24 Feb 2016 18:00:10 +0000 (19:00 +0100)
committerDavid du Colombier <0intro@gmail.com>
Wed, 24 Feb 2016 18:05:10 +0000 (18:05 +0000)
In CL 14408, the implementation of duffzero on amd64
was changed to replace the use of the MOVQ instructions
by MOVUPS.

However, it broke the build on plan9/amd64, since
Plan 9 doesn't allow floating point in note handler.

This change disables the use of duffzero on Plan 9.
We also take care to not use the MOVUPS instruction.

Fixes #14471.

Change-Id: I8277b485dfe65a68d7d8338e52a048c5d45069bf
Reviewed-on: https://go-review.googlesource.com/19890
Reviewed-by: Keith Randall <khr@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
src/cmd/compile/internal/amd64/ggen.go

index 84c3d5d7d49a640067bf905717efe3001ec66f1c..b9e5bfb15fc3dab843968965e608546def2a681f 100644 (file)
@@ -10,6 +10,9 @@ import (
        "cmd/internal/obj/x86"
 )
 
+// no floating point in note handlers on Plan 9
+var isPlan9 = obj.Getgoos() == "plan9"
+
 func defframe(ptxt *obj.Prog) {
        var n *gc.Node
 
@@ -126,7 +129,7 @@ func zerorange(p *obj.Prog, frame int64, lo int64, hi int64, ax *uint32, x0 *uin
                        *ax = 1
                }
                p = appendpp(p, x86.AMOVQ, obj.TYPE_REG, x86.REG_AX, 0, obj.TYPE_MEM, x86.REG_SP, frame+lo)
-       } else if cnt <= int64(8*gc.Widthreg) {
+       } else if !isPlan9 && cnt <= int64(8*gc.Widthreg) {
                if *x0 == 0 {
                        p = appendpp(p, x86.AXORPS, obj.TYPE_REG, x86.REG_X0, 0, obj.TYPE_REG, x86.REG_X0, 0)
                        *x0 = 1
@@ -139,12 +142,11 @@ func zerorange(p *obj.Prog, frame int64, lo int64, hi int64, ax *uint32, x0 *uin
                if cnt%16 != 0 {
                        p = appendpp(p, x86.AMOVUPS, obj.TYPE_REG, x86.REG_X0, 0, obj.TYPE_MEM, x86.REG_SP, frame+lo+cnt-int64(16))
                }
-       } else if !gc.Nacl && (cnt <= int64(128*gc.Widthreg)) {
+       } else if !gc.Nacl && !isPlan9 && (cnt <= int64(128*gc.Widthreg)) {
                if *x0 == 0 {
                        p = appendpp(p, x86.AXORPS, obj.TYPE_REG, x86.REG_X0, 0, obj.TYPE_REG, x86.REG_X0, 0)
                        *x0 = 1
                }
-
                p = appendpp(p, leaptr, obj.TYPE_MEM, x86.REG_SP, frame+lo+dzDI(cnt), obj.TYPE_REG, x86.REG_DI, 0)
                p = appendpp(p, obj.ADUFFZERO, obj.TYPE_NONE, 0, 0, obj.TYPE_ADDR, 0, dzOff(cnt))
                p.To.Sym = gc.Linksym(gc.Pkglookup("duffzero", gc.Runtimepkg))
@@ -563,7 +565,7 @@ func clearfat(nl *gc.Node) {
 
        w := nl.Type.Width
 
-       if w > 1024 || (gc.Nacl && w >= 64) {
+       if w > 1024 || (w >= 64 && (gc.Nacl || isPlan9)) {
                var oldn1 gc.Node
                var n1 gc.Node
                savex(x86.REG_DI, &n1, &oldn1, nil, gc.Types[gc.Tptr])
@@ -630,6 +632,22 @@ func clearfat(nl *gc.Node) {
 }
 
 func clearfat_tail(n1 *gc.Node, b int64) {
+       if b >= 16 && isPlan9 {
+               var z gc.Node
+               gc.Nodconst(&z, gc.Types[gc.TUINT64], 0)
+               q := b / 8
+               for ; q > 0; q-- {
+                       n1.Type = z.Type
+                       gins(x86.AMOVQ, &z, n1)
+                       n1.Xoffset += 8
+                       b -= 8
+               }
+               if b != 0 {
+                       n1.Xoffset -= 8 - b
+                       gins(x86.AMOVQ, &z, n1)
+               }
+               return
+       }
        if b >= 16 {
                var vec_zero gc.Node
                gc.Regalloc(&vec_zero, gc.Types[gc.TFLOAT64], nil)