Commit ac1015e7 authored by Russ Cox's avatar Russ Cox

cmd/8g: fix sse2 compare code gen

Fixes #4785.

R=ken2
CC=golang-dev
https://golang.org/cl/7300109
parent d340a89d
...@@ -1053,35 +1053,16 @@ x87: ...@@ -1053,35 +1053,16 @@ x87:
goto ret; goto ret;
sse: 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) { if(!nl->addable) {
tempname(&n1, nl->type); tempname(&n1, nl->type);
cgen(nl, &n1); cgen(nl, &n1);
nl = &n1; nl = &n1;
} }
if(!nr->addable) { if(!nr->addable) {
tempname(&tmp, nr->type); tempname(&tmp, nr->type);
cgen(nr, &tmp); cgen(nr, &tmp);
nr = &tmp; nr = &tmp;
} }
regalloc(&n2, nr->type, N); regalloc(&n2, nr->type, N);
gmove(nr, &n2); gmove(nr, &n2);
nr = &n2; nr = &n2;
...@@ -1092,7 +1073,6 @@ sse: ...@@ -1092,7 +1073,6 @@ sse:
nl = &n3; nl = &n3;
} }
ssecmp:
if(a == OGE || a == OGT) { if(a == OGE || a == OGT) {
// only < and <= work right with NaN; reverse if needed // only < and <= work right with NaN; reverse if needed
r = nr; r = nr;
......
// 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")
}
}
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment