Commit 6da41be2 authored by Russ Cox's avatar Russ Cox

fix float32 comparison. was doing l op l instead of l op r.

R=ken
OCL=31190
CL=31190
parent 86987055
...@@ -812,16 +812,17 @@ bgen(Node *n, int true, Prog *to) ...@@ -812,16 +812,17 @@ bgen(Node *n, int true, Prog *to)
cgen(nl, &tmp); cgen(nl, &tmp);
gins(AFUCOMPP, &tmp, &n2); gins(AFUCOMPP, &tmp, &n2);
} else { } else {
// NOTE(rsc): This is wrong. // TODO(rsc): The moves back and forth to memory
// It's right for comparison but presumably all the // here are for truncating the value to 32 bits.
// other ops have the same problem. We need to // This handles 32-bit comparison but presumably
// figure out what the right solution is, besides // all the other ops have the same problem.
// tell people to use float64. // We need to figure out what the right general
// solution is, besides telling people to use float64.
tempalloc(&t1, types[TFLOAT32]); tempalloc(&t1, types[TFLOAT32]);
tempalloc(&t2, types[TFLOAT32]); tempalloc(&t2, types[TFLOAT32]);
cgen(nr, &t1); cgen(nr, &t1);
cgen(nl, &t2); cgen(nl, &t2);
gmove(&t1, &tmp); gmove(&t2, &tmp);
gins(AFCOMFP, &t1, &tmp); gins(AFCOMFP, &t1, &tmp);
tempfree(&t2); tempfree(&t2);
tempfree(&t1); tempfree(&t1);
......
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