Bug 31796 - Evaluate remquo/remainder/drem at compile-time
Summary: Evaluate remquo/remainder/drem at compile-time
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: middle-end (show other bugs)
Version: 4.3.0
: P3 enhancement
Target Milestone: 4.3.0
Assignee: Kaveh Ghazi
URL: http://gcc.gnu.org/ml/gcc-patches/200...
Keywords: missed-optimization
Depends on: 29335
Blocks:
  Show dependency treegraph
 
Reported: 2007-05-03 03:59 UTC by Kaveh Ghazi
Modified: 2007-05-19 05:14 UTC (History)
1 user (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
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.