Apply the same workaround for clang to amd64's version of ldexp.c (as in
r212976): order the incoming arguments to fscale as st(0), st(1), and mark temp2 volatile (only in case of compilation with clang) to force clang to pop it correctly. No binary change when compiled with gcc. This fixes ldexp() when compiled with clang on amd64, which makes drand48() and friends work correctly again, and this in turn fixes perl's tempfile(). Reported by: Renato Botelho, Derek Tattersall Approved by: rpaulo (mentor)
This commit is contained in:
parent
6854be25a8
commit
12894d9d66
@ -36,6 +36,8 @@ static char sccsid[] = "@(#)ldexp.c 8.1 (Berkeley) 6/4/93";
|
||||
#include <sys/cdefs.h>
|
||||
__FBSDID("$FreeBSD$");
|
||||
|
||||
#include <math.h>
|
||||
|
||||
/*
|
||||
* ldexp(value, exp): return value * (2 ** exp).
|
||||
*
|
||||
@ -49,12 +51,16 @@ __FBSDID("$FreeBSD$");
|
||||
double
|
||||
ldexp (double value, int exp)
|
||||
{
|
||||
double temp, texp, temp2;
|
||||
double temp, texp;
|
||||
#ifdef __clang__
|
||||
volatile
|
||||
#endif
|
||||
double temp2;
|
||||
texp = exp;
|
||||
#ifdef __GNUC__
|
||||
__asm ("fscale "
|
||||
: "=u" (temp2), "=t" (temp)
|
||||
: "0" (texp), "1" (value));
|
||||
: "=t" (temp), "=u" (temp2)
|
||||
: "0" (value), "1" (texp));
|
||||
#else
|
||||
#error unknown asm
|
||||
#endif
|
||||
|
Loading…
x
Reference in New Issue
Block a user