mirror of
git://repo.or.cz/tinycc.git
synced 2026-06-23 21:34:19 +08:00
Long double Constant problem
This commit is contained in:
parent
fbef90a703
commit
405aef9155
6
tccgen.c
6
tccgen.c
@ -3024,7 +3024,7 @@ static void gen_opif(int op)
|
|||||||
case '-': f1 -= f2; break;
|
case '-': f1 -= f2; break;
|
||||||
case '*': f1 *= f2; break;
|
case '*': f1 *= f2; break;
|
||||||
case '/':
|
case '/':
|
||||||
if (f2 == 0.0) {
|
if (f2 == (f1-f1) ) {
|
||||||
union { float f; unsigned u; } x1, x2, y;
|
union { float f; unsigned u; } x1, x2, y;
|
||||||
/* If not in initializer we need to potentially generate
|
/* If not in initializer we need to potentially generate
|
||||||
FP exceptions at runtime, otherwise we want to fold. */
|
FP exceptions at runtime, otherwise we want to fold. */
|
||||||
@ -3033,7 +3033,7 @@ static void gen_opif(int op)
|
|||||||
/* the run-time result of 0.0/0.0 on x87, also of other compilers
|
/* the run-time result of 0.0/0.0 on x87, also of other compilers
|
||||||
when used to compile the f1 /= f2 below, would be -nan */
|
when used to compile the f1 /= f2 below, would be -nan */
|
||||||
x1.f = f1, x2.f = f2;
|
x1.f = f1, x2.f = f2;
|
||||||
if (f1 == 0.0)
|
if (f1 == (f1-f1) )
|
||||||
y.u = 0x7fc00000; /* nan */
|
y.u = 0x7fc00000; /* nan */
|
||||||
else
|
else
|
||||||
y.u = 0x7f800000; /* infinity */
|
y.u = 0x7f800000; /* infinity */
|
||||||
@ -8102,7 +8102,7 @@ static void init_putv(init_params *p, CType *type, unsigned long c)
|
|||||||
else if (sizeof (long double) == sizeof (double))
|
else if (sizeof (long double) == sizeof (double))
|
||||||
__asm__("fldl %1\nfstpt %0\n" : "=m" (*ptr) : "m" (vtop->c.ld));
|
__asm__("fldl %1\nfstpt %0\n" : "=m" (*ptr) : "m" (vtop->c.ld));
|
||||||
#endif
|
#endif
|
||||||
else if (vtop->c.ld == 0.0)
|
else if (vtop->c.ld == (f1-f1) )
|
||||||
;
|
;
|
||||||
else
|
else
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user