mirror of
https://github.com/golang/go
synced 2024-10-14 11:53:56 +00:00
cmd/8g: fix sse2 compare code gen
Fixes #4785. R=ken2 CC=golang-dev https://golang.org/cl/7300109
This commit is contained in:
parent
d340a89d9c
commit
ac1015e7f3
|
@ -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;
|
||||
|
|
20
test/fixedbugs/issue4785.go
Normal file
20
test/fixedbugs/issue4785.go
Normal 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")
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue