]> Cypherpunks repositories - gostls13.git/commitdiff
cmd/8g: fix sse2 compare code gen
authorRuss Cox <rsc@golang.org>
Thu, 14 Feb 2013 19:49:04 +0000 (14:49 -0500)
committerRuss Cox <rsc@golang.org>
Thu, 14 Feb 2013 19:49:04 +0000 (14:49 -0500)
Fixes #4785.

R=ken2
CC=golang-dev
https://golang.org/cl/7300109

src/cmd/8g/ggen.c
test/fixedbugs/issue4785.go [new file with mode: 0644]

index 465177f1369e24af7e6d5c4980c6859e4b0d4ba2..30663aabe5af6ce4d1ae0316ae08fe73ea0eee44 100644 (file)
@@ -1053,35 +1053,16 @@ x87:
        goto ret;
 
 sse:
-       if(nr->ullman >= UINF) {
-               if(!nl->addable) {
-                       tempname(&n1, nl->type);
-                       cgen(nl, &n1);
-                       nl = &n1;
-               }
-               if(!nr->addable) {
-                       tempname(&tmp, nr->type);
-                       cgen(nr, &tmp);
-                       nr = &tmp;
-               }
-               regalloc(&n2, nr->type, N);
-               cgen(nr, &n2);
-               nr = &n2;
-               goto ssecmp;
-       }
-
        if(!nl->addable) {
                tempname(&n1, nl->type);
                cgen(nl, &n1);
                nl = &n1;
        }
-
        if(!nr->addable) {
                tempname(&tmp, nr->type);
                cgen(nr, &tmp);
                nr = &tmp;
        }
-
        regalloc(&n2, nr->type, N);
        gmove(nr, &n2);
        nr = &n2;
@@ -1092,7 +1073,6 @@ sse:
                nl = &n3;
        }
 
-ssecmp:
        if(a == OGE || a == OGT) {
                // only < and <= work right with NaN; reverse if needed
                r = nr;
diff --git a/test/fixedbugs/issue4785.go b/test/fixedbugs/issue4785.go
new file mode 100644 (file)
index 0000000..c3dd629
--- /dev/null
@@ -0,0 +1,20 @@
+// run
+
+// Copyright 2013 The Go Authors.  All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+// issue 4785: used to fail to compile
+
+package main
+
+func t(x, y interface{}) interface{} {
+       return x.(float64) > y.(float64)
+}
+
+func main() {
+       v := t(1.0, 2.0)
+       if v != false {
+               panic("bad comparison")
+       }
+}