cmd/8g, cmd/internal/gc: clean up GO386 handling
This change cleans up some of the uglyness introduced in 8fc73a39efe1
by moving the gc.Use_sse into the gc.Arch struct and adjusting its
zero value to be more useful.
Change-Id: I26ff5d9ac57b3f25e936519e443de6583cdafa56
Reviewed-on: https://go-review.googlesource.com/7994
Reviewed-by: Russ Cox <rsc@golang.org>
diff --git a/src/cmd/internal/gc/go.go b/src/cmd/internal/gc/go.go
index 1abbfe4..c5a7bc4 100644
--- a/src/cmd/internal/gc/go.go
+++ b/src/cmd/internal/gc/go.go
@@ -632,8 +632,6 @@
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 @@
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 499c216..d54f905 100644
--- a/src/cmd/internal/gc/gsubr.go
+++ b/src/cmd/internal/gc/gsubr.go
@@ -688,7 +688,7 @@
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 cc25929..323b5c5 100644
--- a/src/cmd/internal/gc/lex.go
+++ b/src/cmd/internal/gc/lex.go
@@ -277,17 +277,6 @@
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")