Bug 31796

Summary: Evaluate remquo/remainder/drem at compile-time
Product: gcc Reporter: Kaveh Ghazi <ghazi>
Component: middle-endAssignee: Kaveh Ghazi <ghazi>
Status: RESOLVED FIXED    
Severity: enhancement CC: gcc-bugs
Priority: P3 Keywords: missed-optimization
Version: 4.3.0   
Target Milestone: 4.3.0   
URL: http://gcc.gnu.org/ml/gcc-patches/2007-05/msg00297.html
Host: Target:
Build: Known to work:
Known to fail: Last reconfirmed:
Bug Depends on: 29335    
Bug Blocks:    

Description Kaveh Ghazi 2007-05-03 03:59:50 UTC
GCC should use MPFR to evaluate builtins remquo, remainder (and the common extension function drem) at compile-time when they are provided with constant arguments.  The forthcoming mpfr-2.3.0 has suitable functionality to do this.
Comment 1 Kaveh Ghazi 2007-05-05 18:57:03 UTC
Patch posted here:

http://gcc.gnu.org/ml/gcc-patches/2007-05/msg00297.html
Comment 2 patchapp@dberlin.org 2007-05-05 19:45:24 UTC
Subject: Bug number PR middle-end/31796

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/msg00297.html
Comment 3 Kaveh Ghazi 2007-05-18 02:31:51 UTC
Subject: Bug 31796

Author: ghazi
Date: Fri May 18 01:31:20 2007
New Revision: 124820

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=124820
Log:
	PR middle-end/31796
	* builtins.c (do_mpfr_remquo): New.
	(fold_builtin_2): Handle BUILT_IN_DREM/BUILT_IN_REMAINDER.
	(fold_builtin_3): Handle BUILT_IN_REMQUO.

testsuite:
	* gcc.dg/torture/builtin-math-2.c: Add tests for remquo, remainder
	and drem.
	* 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

Comment 4 Kaveh Ghazi 2007-05-19 05:14:33 UTC
Functionality installed on trunk.