[LLVMbugs] [Bug 372] NEW: [llvmgcc/libc] isnan(x) function should turn into llvm.isunordered(X, 0)
bugzilla-daemon at cs.uiuc.edu
bugzilla-daemon at cs.uiuc.edu
Thu Jun 17 22:38:52 PDT 2004
http://llvm.cs.uiuc.edu/bugs/show_bug.cgi?id=372
Summary: [llvmgcc/libc] isnan(x) function should turn into
llvm.isunordered(X, 0)
Product: tools
Version: trunk
Platform: All
OS/Version: All
Status: NEW
Severity: enhancement
Priority: P2
Component: llvm-gcc
AssignedTo: unassignedbugs at nondot.org
ReportedBy: sabre at nondot.org
glibc is currently turning calls to isnan into calls to __isnan* functions
defined in glibc. Since this is a single machine instruction and we can
generate it inline, it would be nice to be able to do so!
Unfortunately my fixincludes-fu is quite weak. In particular, I am able to make
the fix, but I get all kinds of wierd errors from the resultant math.h
indicating that something bad happened. The strange thing about this is that
when I diff the resultant math.h to the original one, only my fix has been
applied. Because of this I really don't know what is going on, so I must punt
until someone with more fu can look at this.
Here's my fixincludes hack, which DOES work, but breaks things when math.h is fixed:
/* This transforms the glibc implementation of isnan(X) into
* __builtin_isunordered(X,0) instead of calling __isnan*.
*/
fix = {
hackname = llvm_isnan_glibc;
files = math.h;
select = "^# ifdef __NO_LONG_DOUBLE_MATH\n(#[ \t]*define isnan)";
c_fix = format;
c_fix_arg = "# ifdef __llvm__\n"
"# define isnan((X)) __builtin_isunordered(X, 0)\n"
"# elif defined(__NO_LONG_DOUBLE_MATH)\n%1";
test_text =
"# ifdef __NO_LONG_DOUBLE_MATH\n"
"# define isnan(x) \\\n";
};
This hacks on this macro in the glibc math.h file:
# ifdef __NO_LONG_DOUBLE_MATH
# define isnan(x) \
(sizeof (x) == sizeof (float) ? __isnanf (x) : __isnan (x))
# else
# define isnan(x) \
(sizeof (x) == sizeof (float) \
? __isnanf (x) \
: sizeof (x) == sizeof (double) \
? __isnan (x) : __isnanl (x))
# endif
-Chris
------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.
More information about the llvm-bugs
mailing list