8g: use FCHS, not FMUL, for minus float

Fixes #1052.

R=ken2
CC=golang-dev
https://golang.org/cl/2055041
This commit is contained in:
Russ Cox 2010-08-27 14:02:00 -04:00
parent 1a0b62a16a
commit 9686ab2da9
2 changed files with 7 additions and 9 deletions

View File

@ -392,23 +392,16 @@ uop: // unary
gmove(&n1, res);
return;
flt: // floating-point. 387 (not SSE2) to interoperate with 6c
flt: // floating-point. 387 (not SSE2) to interoperate with 8c
nodreg(&f0, nl->type, D_F0);
nodreg(&f1, n->type, D_F0+1);
if(nr != N)
goto flt2;
if(n->op == OMINUS) {
nr = nodintconst(-1);
convlit(&nr, n->type);
n->op = OMUL;
goto flt2;
}
// unary
cgen(nl, &f0);
if(n->op != OCONV && n->op != OPLUS)
gins(foptoas(n->op, n->type, 0), &f0, &f0);
gins(foptoas(n->op, n->type, 0), N, N);
gmove(&f0, res);
return;

View File

@ -661,6 +661,11 @@ foptoas(int op, Type *t, int flg)
return AFCOMDP;
case FCASE(OCMP, TFLOAT64, Fpop2):
return AFCOMDPP;
case FCASE(OMINUS, TFLOAT32, 0):
return AFCHS;
case FCASE(OMINUS, TFLOAT64, 0):
return AFCHS;
}
fatal("foptoas %O %T %#x", op, t, flg);