diff --git a/src/cmd/8g/galign.go b/src/cmd/8g/galign.go index e92802d0b5f2685ca6e15389219b6e53a84be848..1c03df59079df1a97d61132eb20504e2d79db207 100644 --- a/src/cmd/8g/galign.go +++ b/src/cmd/8g/galign.go @@ -54,6 +54,7 @@ func main() { case "387": gc.Thearch.FREGMIN = x86.REG_F0 gc.Thearch.FREGMAX = x86.REG_F7 + gc.Thearch.Use387 = true case "sse2": gc.Thearch.FREGMIN = x86.REG_X0 gc.Thearch.FREGMAX = x86.REG_X7 diff --git a/src/cmd/8g/ggen.go b/src/cmd/8g/ggen.go index 949156eda897457bd70f9e898e9585e789755bdb..a4a373c346a27fc3afd4df10c16c424463dac796 100644 --- a/src/cmd/8g/ggen.go +++ b/src/cmd/8g/ggen.go @@ -617,10 +617,10 @@ func cgen_float(n *gc.Node, res *gc.Node) { return } - if gc.Use_sse { - cgen_floatsse(n, res) - } else { + if gc.Thearch.Use387 { cgen_float387(n, res) + } else { + cgen_floatsse(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 { + if !gc.Thearch.Use387 { if nl.Addable == 0 { var n1 gc.Node gc.Tempname(&n1, nl.Type) diff --git a/src/cmd/8g/gsubr.go b/src/cmd/8g/gsubr.go index 7ca4dacf917603fc597a405c471d368e289c24ed..929cbaedfc80d745f83af7a38e1ed183fa09e61f 100644 --- a/src/cmd/8g/gsubr.go +++ b/src/cmd/8g/gsubr.go @@ -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 { + if !gc.Thearch.Use387 { 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,10 +1036,10 @@ func floatmove(f *gc.Node, t *gc.Node) { switch uint32(ft)<<16 | uint32(tt) { default: - if gc.Use_sse { - floatmove_sse(f, t) - } else { + if gc.Thearch.Use387 { floatmove_387(f, t) + } else { + floatmove_sse(f, t) } return diff --git a/src/cmd/internal/gc/go.go b/src/cmd/internal/gc/go.go index 1abbfe41d096e347c3a5b80fef3aae8c125e9a6f..c5a7bc4e495018585fb8d3ab3d8bd6f12141d883 100644 --- a/src/cmd/internal/gc/go.go +++ b/src/cmd/internal/gc/go.go @@ -632,8 +632,6 @@ var typesw *Node var nblank *Node -var Use_sse bool // should we generate SSE2 instructions for 386 targets - var hunk string var nhunk int32 @@ -832,6 +830,7 @@ type Arch struct { Optoas func(int, *Type) int Doregbits func(int) uint64 Regnames func(*int) []string + Use387 bool // should 8g use 387 FP instructions instead of sse2. } var pcloc int32 diff --git a/src/cmd/internal/gc/gsubr.go b/src/cmd/internal/gc/gsubr.go index 499c21642588be73e77f05e6e80d5c889a53a57d..d54f90594c53115213f8536b67dbb1acc06cdc37 100644 --- a/src/cmd/internal/gc/gsubr.go +++ b/src/cmd/internal/gc/gsubr.go @@ -688,7 +688,7 @@ Switch: Fatal("out of fixed registers") case TFLOAT32, TFLOAT64: - if Thearch.Thechar == '8' && !Use_sse { + if Thearch.Use387 { i = Thearch.FREGMIN // x86.REG_F0 break Switch } diff --git a/src/cmd/internal/gc/lex.go b/src/cmd/internal/gc/lex.go index cc259292c81218cf767d657df1b70258038ff8cd..323b5c5d4731c860a76969a33fdd057becb01220 100644 --- a/src/cmd/internal/gc/lex.go +++ b/src/cmd/internal/gc/lex.go @@ -277,17 +277,6 @@ func Main() { Debug['l'] = 1 - Debug['l'] } - if Thearch.Thechar == '8' { - switch v := obj.Getgo386(); v { - case "387": - Use_sse = false - case "sse2": - Use_sse = true - default: - log.Fatalf("unsupported setting GO386=%s", v) - } - } - Thearch.Betypeinit() if Widthptr == 0 { Fatal("betypeinit failed")