mirror of
https://github.com/golang/go
synced 2024-10-05 18:21:21 -06:00
[dev.power64] cmd/9g: fix floating-point comparison for NaN
LGTM=minux R=minux CC=golang-codereviews https://golang.org/cl/127300043
This commit is contained in:
parent
f3f332851f
commit
27e657ef68
@ -1267,12 +1267,21 @@ bgen(Node *n, int true, int likely, Prog *to)
|
|||||||
l = &n1;
|
l = &n1;
|
||||||
r = &n2;
|
r = &n2;
|
||||||
gins(optoas(OCMP, nr->type), l, r);
|
gins(optoas(OCMP, nr->type), l, r);
|
||||||
|
if(isfloat[nr->type->etype] && (n->op == OLE || n->op == OGE)) {
|
||||||
// TODO(minux): determine the reason for failed test/floatcmp.go.
|
// To get NaN right, must rewrite x <= y into separate x < y or x = y.
|
||||||
// we might need to specially handle floating point comparisons.
|
switch(n->op) {
|
||||||
/*if(isfloat[nr->type->etype] && (n->op == OEQ || n->op == ONE)) {
|
case OLE:
|
||||||
} else*/
|
a = OLT;
|
||||||
|
break;
|
||||||
|
case OGE:
|
||||||
|
a = OGT;
|
||||||
|
break;
|
||||||
|
}
|
||||||
patch(gbranch(optoas(a, nr->type), nr->type, likely), to);
|
patch(gbranch(optoas(a, nr->type), nr->type, likely), to);
|
||||||
|
patch(gbranch(optoas(OEQ, nr->type), nr->type, likely), to);
|
||||||
|
} else {
|
||||||
|
patch(gbranch(optoas(a, nr->type), nr->type, likely), to);
|
||||||
|
}
|
||||||
regfree(&n1);
|
regfree(&n1);
|
||||||
regfree(&n2);
|
regfree(&n2);
|
||||||
break;
|
break;
|
||||||
|
Loading…
Reference in New Issue
Block a user