GCC Bugzilla has been upgraded from version 4.4.9 to 5.0rc3. If you see any problem, please report it to bug 64968.

Bug 30250

Summary: Evaluate lgamma/gamma at compile-time
Product: gcc Reporter: Kaveh Ghazi <ghazi>
Component: middle-endAssignee: Kaveh Ghazi <ghazi>
Status: ASSIGNED ---    
Severity: enhancement CC: gcc-bugs, vincent-gcc
Priority: P3 Keywords: missed-optimization
Version: 4.3.0   
Target Milestone: ---   
Host: Target:
Build: Known to work:
Known to fail: Last reconfirmed: 2006-12-24 03:33:42
Bug Depends on: 29335    
Bug Blocks:    

Description Kaveh Ghazi 2006-12-18 14:50:39 UTC
We should use MPFR to evaluate c99 lgamma function (and the common extension function gamma).  However we have to wait until MPFR implements a suitable interface as described here:

http://gforge.inria.fr/plugins/scmsvn/viewcvs.php/trunk/TODO?root=mpfr&rev=4214&r1=4205&r2=4214
Comment 1 Andrew Pinski 2006-12-24 03:33:42 UTC
Confirmed.
Comment 2 Kaveh Ghazi 2007-05-07 07:35:38 UTC
I'll be doing the reentrant lgamma_r/gamma_r versions as well.  (They're actually easier because I get the signgam identifer as a pointer parameter rather than having to find it at global scope.)

Comment 3 patchapp@dberlin.org 2007-05-07 17:05:17 UTC
Subject: Bug number PR middle-end/30250

A patch for this bug has been added to the patch tracker.
The mailing list url for the patch is http://gcc.gnu.org/ml/gcc-patches/2007-05/msg00408.html
Comment 4 patchapp@dberlin.org 2007-05-10 08:14:36 UTC
Subject: Bug number PR middle-end/30250

A patch for this bug has been added to the patch tracker.
The mailing list url for the patch is http://gcc.gnu.org/ml/gcc-patches/2007-05/msg00619.html
Comment 5 Kaveh Ghazi 2007-05-19 05:18:27 UTC
Subject: Bug 30250

Author: ghazi
Date: Sat May 19 04:18:05 2007
New Revision: 124849

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=124849
Log:
	PR middle-end/30250
	* builtins.c (do_mpfr_lgamma_r): New.
	(fold_builtin_2): Handle builtin gamma_r/lgamma_r.
	* tree.h (CASE_FLT_FN_REENT): New.

testsuite:
	* gcc.dg/torture/builtin-math-2.c: Add gamma_r/lgamma_r tests.
	* gcc.dg/torture/builtin-math-4.c: Likewise.


Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/builtins.c
    trunk/gcc/testsuite/ChangeLog
    trunk/gcc/testsuite/gcc.dg/torture/builtin-math-2.c
    trunk/gcc/testsuite/gcc.dg/torture/builtin-math-4.c
    trunk/gcc/tree.h