1
0
mirror of https://github.com/golang/go synced 2024-11-20 00:44:45 -07:00

cmd/8g, cmd/internal/gc: fix GO386=387 build

Adjust Thearch.FREG_MIN/MAX when using non sse2 mode in 8g.

Also, gc.Use_sse is treated as a bool, so make it a bool.

Change-Id: I840411605344bb31c32f492b3e6729166c084f0c
Reviewed-on: https://go-review.googlesource.com/7993
Reviewed-by: Aram Hăvărneanu <aram@mgk.ro>
Reviewed-by: Rob Pike <r@golang.org>
Reviewed-by: Dave Cheney <dave@cheney.net>
Run-TryBot: Dave Cheney <dave@cheney.net>
This commit is contained in:
Dave Cheney 2015-03-24 22:16:48 +11:00
parent 2c4cf2f6f2
commit 8fc73a39ef
6 changed files with 26 additions and 14 deletions

View File

@ -50,8 +50,16 @@ func main() {
gc.Thearch.REGRETURN = x86.REG_AX
gc.Thearch.REGMIN = x86.REG_AX
gc.Thearch.REGMAX = x86.REG_DI
gc.Thearch.FREGMIN = x86.REG_X0
gc.Thearch.FREGMAX = x86.REG_X7
switch v := obj.Getgo386(); v {
case "387":
gc.Thearch.FREGMIN = x86.REG_F0
gc.Thearch.FREGMAX = x86.REG_F7
case "sse2":
gc.Thearch.FREGMIN = x86.REG_X0
gc.Thearch.FREGMAX = x86.REG_X7
default:
gc.Fatal("unsupported setting GO386=%s", v)
}
gc.Thearch.MAXWIDTH = MAXWIDTH
gc.Thearch.ReservedRegs = resvd

View File

@ -617,7 +617,7 @@ func cgen_float(n *gc.Node, res *gc.Node) {
return
}
if gc.Use_sse != 0 {
if gc.Use_sse {
cgen_floatsse(n, res)
} else {
cgen_float387(n, res)
@ -761,7 +761,7 @@ func bgen_float(n *gc.Node, true_ int, likely int, to *obj.Prog) {
var et int
var n2 gc.Node
var ax gc.Node
if gc.Use_sse != 0 {
if gc.Use_sse {
if nl.Addable == 0 {
var n1 gc.Node
gc.Tempname(&n1, nl.Type)

View File

@ -402,7 +402,7 @@ func foptoas(op int, t *gc.Type, flg int) int {
a := obj.AXXX
et := int(gc.Simtype[t.Etype])
if gc.Use_sse != 0 {
if gc.Use_sse {
switch uint32(op)<<16 | uint32(et) {
default:
gc.Fatal("foptoas-sse: no entry %v-%v", gc.Oconv(int(op), 0), gc.Tconv(t, 0))
@ -1036,7 +1036,7 @@ func floatmove(f *gc.Node, t *gc.Node) {
switch uint32(ft)<<16 | uint32(tt) {
default:
if gc.Use_sse != 0 {
if gc.Use_sse {
floatmove_sse(f, t)
} else {
floatmove_387(f, t)

View File

@ -632,7 +632,7 @@ var typesw *Node
var nblank *Node
var Use_sse int
var Use_sse bool // should we generate SSE2 instructions for 386 targets
var hunk string

View File

@ -692,6 +692,10 @@ Switch:
Fatal("out of fixed registers")
case TFLOAT32, TFLOAT64:
if Thearch.Thechar == '8' && !Use_sse {
i = Thearch.FREGMIN // x86.REG_F0
break Switch
}
if o != nil && o.Op == OREGISTER {
i = int(o.Val.U.Reg)
if Thearch.FREGMIN <= i && i <= Thearch.FREGMAX {

View File

@ -278,13 +278,13 @@ func Main() {
}
if Thearch.Thechar == '8' {
p := obj.Getgo386()
if p == "387" {
Use_sse = 0
} else if p == "sse2" {
Use_sse = 1
} else {
log.Fatalf("unsupported setting GO386=%s", p)
switch v := obj.Getgo386(); v {
case "387":
Use_sse = false
case "sse2":
Use_sse = true
default:
log.Fatalf("unsupported setting GO386=%s", v)
}
}