cmd/8g: fix sse2 compare code gen

Fixes #4785.

R=ken2
CC=golang-dev
https://golang.org/cl/7300109
This commit is contained in:
Russ Cox 2013-02-14 14:49:04 -05:00
parent d340a89d9c
commit ac1015e7f3
2 changed files with 20 additions and 20 deletions

View 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;

View file

@ -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")
}
}