Commit 9686ab2d authored by Russ Cox's avatar Russ Cox

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

Fixes #1052.

R=ken2
CC=golang-dev
https://golang.org/cl/2055041
parent 1a0b62a1
......@@ -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;
......
......@@ -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);
......
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