[PATCH] Implement log1p as built-in x87 intrinsic
Uros Bizjak
uros@kss-loka.si
Thu May 6 10:19:00 GMT 2004
Hello!
Attached to this message, please find a patch that implements log1p as
built-in x87 intrinsic. This patch is modelled after log1p() function in
glibc's mathinline.h, however, it generates pentium-pro & co.'s fcomip
instructions instead of fcompp for compare, and brings in all other RTL
optimizing effects for log1p instruction. Patch was bootstrapped on
i686-pc-linux-gnu, tested with builtins-33.c test and with custom
torture tests to test accuracy.
OK for mainline CVS?
2004-05-06 Uros Bizjak <uros@kss-loka.si>
* optabs.h (enum optab_index): Add new OTI_log1p.
(log1p_optab): Define corresponding macro.
* optabs.c (init_optabs): Initialize log1p_optab.
* genopinit.c (optabs): Implement log1p_optab using log1p?f2
patterns.
* builtins.c (expand_builtin_mathfn): Handle BUILT_IN_LOG1P{,F,L}
using log1p_optab.
(expand_builtin): Expand BUILT_IN_LOG1P{,F,L} using
expand_builtin_mathfn if flag_unsafe_math_optimizations is set.
* reg-stack.c (subst_stack_regs_pat): Handle UNSPEC_FYL2XP1.
* config/i386/i386.md (UNSPEC_FYL2XP1): New unspec to represent x87's
fyl2xp1 instruction.
(*fyl2x_xf3): Rename insn definition to fyl2x_xf3.
(fyl2xp1_xf3): New pattern to implement fyl2xp1 x87 instruction.
(log1psf2, log1pdf2, log1pxf2): New expanders to implement log1pf,
log1p and log1pl built-ins as inline x87 intrinsics.
testsuite:
* testsuite/gcc.dg/builtins-33.c: Also check log1p*.
Uros.
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: log1p.diff
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20040506/36ef33b0/attachment.ksh>
More information about the Gcc-patches
mailing list