cmd/5g etc: mechanical cleanup

Run rsc.io/grind rev a26569f on C->Go conversions.

The new change in grind is the inlining of goto targets.
If code says 'goto x' and the block starting at label x is unreachable
except through that goto and the code can be moved to where
the goto is without changing the meaning of its variable names,
grind does that move. Simlarly, a goto to a plain return statement
turns into that return statement (even if there are other paths to
the return statement).

Combined, these remove many long-distance gotos, which in turn
makes it possible to reduce the scope of more variable declarations.
(Because gotos can't jump across declarations, the gotos were
keeping the declarations from moving.)

Checked bit-for-bit compatibility with toolstash + buildall.

Reduces compiler runtime in html/template by about 12%.

Change-Id: Id727c0bd7763a61aa22f3daa00aeb8fccbc057a3
Reviewed-on: https://go-review.googlesource.com/6472
Reviewed-by: Aram Hăvărneanu <aram@mgk.ro>
Reviewed-by: Dmitry Vyukov <dvyukov@google.com>
diff --git a/src/cmd/8g/ggen.go b/src/cmd/8g/ggen.go
index ca2a79f..7aba85e 100644
--- a/src/cmd/8g/ggen.go
+++ b/src/cmd/8g/ggen.go
@@ -934,7 +934,27 @@
 	gc.Nodreg(&f0, nl.Type, i386.REG_F0)
 	gc.Nodreg(&f1, n.Type, i386.REG_F0+1)
 	if nr != nil {
-		goto flt2
+		// binary
+		if nl.Ullman >= nr.Ullman {
+			cgen(nl, &f0)
+			if nr.Addable != 0 {
+				gins(foptoas(int(n.Op), n.Type, 0), nr, &f0)
+			} else {
+				cgen(nr, &f0)
+				gins(foptoas(int(n.Op), n.Type, Fpop), &f0, &f1)
+			}
+		} else {
+			cgen(nr, &f0)
+			if nl.Addable != 0 {
+				gins(foptoas(int(n.Op), n.Type, Frev), nl, &f0)
+			} else {
+				cgen(nl, &f0)
+				gins(foptoas(int(n.Op), n.Type, Frev|Fpop), &f0, &f1)
+			}
+		}
+
+		gmove(&f0, res)
+		return
 	}
 
 	// unary
@@ -945,28 +965,6 @@
 	}
 	gmove(&f0, res)
 	return
-
-flt2: // binary
-	if nl.Ullman >= nr.Ullman {
-		cgen(nl, &f0)
-		if nr.Addable != 0 {
-			gins(foptoas(int(n.Op), n.Type, 0), nr, &f0)
-		} else {
-			cgen(nr, &f0)
-			gins(foptoas(int(n.Op), n.Type, Fpop), &f0, &f1)
-		}
-	} else {
-		cgen(nr, &f0)
-		if nl.Addable != 0 {
-			gins(foptoas(int(n.Op), n.Type, Frev), nl, &f0)
-		} else {
-			cgen(nl, &f0)
-			gins(foptoas(int(n.Op), n.Type, Frev|Fpop), &f0, &f1)
-		}
-	}
-
-	gmove(&f0, res)
-	return
 }
 
 func cgen_floatsse(n *gc.Node, res *gc.Node) {
@@ -1064,7 +1062,47 @@
 	var n2 gc.Node
 	var ax gc.Node
 	if gc.Use_sse != 0 {
-		goto sse
+		if nl.Addable == 0 {
+			var n1 gc.Node
+			gc.Tempname(&n1, nl.Type)
+			cgen(nl, &n1)
+			nl = &n1
+		}
+
+		if nr.Addable == 0 {
+			var tmp gc.Node
+			gc.Tempname(&tmp, nr.Type)
+			cgen(nr, &tmp)
+			nr = &tmp
+		}
+
+		var n2 gc.Node
+		regalloc(&n2, nr.Type, nil)
+		gmove(nr, &n2)
+		nr = &n2
+
+		if nl.Op != gc.OREGISTER {
+			var n3 gc.Node
+			regalloc(&n3, nl.Type, nil)
+			gmove(nl, &n3)
+			nl = &n3
+		}
+
+		if a == gc.OGE || a == gc.OGT {
+			// only < and <= work right with NaN; reverse if needed
+			r := nr
+
+			nr = nl
+			nl = r
+			a = gc.Brrev(a)
+		}
+
+		gins(foptoas(gc.OCMP, nr.Type, 0), nl, nr)
+		if nl.Op == gc.OREGISTER {
+			regfree(nl)
+		}
+		regfree(nr)
+		goto ret
 	} else {
 		goto x87
 	}
@@ -1118,47 +1156,6 @@
 
 	goto ret
 
-sse:
-	if nl.Addable == 0 {
-		var n1 gc.Node
-		gc.Tempname(&n1, nl.Type)
-		cgen(nl, &n1)
-		nl = &n1
-	}
-
-	if nr.Addable == 0 {
-		var tmp gc.Node
-		gc.Tempname(&tmp, nr.Type)
-		cgen(nr, &tmp)
-		nr = &tmp
-	}
-
-	regalloc(&n2, nr.Type, nil)
-	gmove(nr, &n2)
-	nr = &n2
-
-	if nl.Op != gc.OREGISTER {
-		var n3 gc.Node
-		regalloc(&n3, nl.Type, nil)
-		gmove(nl, &n3)
-		nl = &n3
-	}
-
-	if a == gc.OGE || a == gc.OGT {
-		// only < and <= work right with NaN; reverse if needed
-		r := nr
-
-		nr = nl
-		nl = r
-		a = gc.Brrev(a)
-	}
-
-	gins(foptoas(gc.OCMP, nr.Type, 0), nl, nr)
-	if nl.Op == gc.OREGISTER {
-		regfree(nl)
-	}
-	regfree(nr)
-
 ret:
 	if a == gc.OEQ {
 		// neither NE nor P