Kaveh R. GHAZI - [PATCH]: add folding of builtin modf (original) (raw)

This is the mail archive of the gcc-patches@gcc.gnu.orgmailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

This patch adds folding of builtin modf when the first argument is a constant.

Tested on sparc-sun-solaris2.10, no regressions.

Okay for mainline?

    Thanks,
    --Kaveh

2007-02-24 Kaveh R. Ghazi ghazi@caip.rutgers.edu

* builtins.c (fold_builtin_modf): New.
(fold_builtin_2): Use it.

testsuite: * gcc.dg/torture/builtin-modf-1.c: New test.

diff -rup orig/egcc-SVN20070223/gcc/builtins.c egcc-SVN20070223/gcc/builtins.c --- orig/egcc-SVN20070223/gcc/builtins.c 2007-02-23 09:49:47.000000000 -0500 +++ egcc-SVN20070223/gcc/builtins.c 2007-02-24 00:40:02.563843168 -0500 @@ -9214,6 +9214,62 @@ fold_builtin_load_exponent (tree arg0, t return NULL_TREE; }

+/* Fold a call to builtin modf. */ + +static tree +fold_builtin_modf (tree arg0, tree arg1, tree rettype) +{

@@ -9690,6 +9746,9 @@ fold_builtin_2 (tree fndecl, tree arg0, CASE_FLT_FN (BUILT_IN_FREXP): return fold_builtin_frexp (arg0, arg1, type);

diff -rup orig/egcc-SVN20070223/gcc/testsuite/gcc.dg/torture/builtin-modf-1.c egcc-SVN20070223/gcc/testsuite/gcc.dg/torture/builtin-modf-1.c --- orig/egcc-SVN20070223/gcc/testsuite/gcc.dg/torture/builtin-modf-1.c 2007-02-23 11:30:15.106672005 -0500 +++ egcc-SVN20070223/gcc/testsuite/gcc.dg/torture/builtin-modf-1.c 2007-02-24 01:08:14.114118356 -0500 @@ -0,0 +1,159 @@ +/* Copyright (C) 2007 Free Software Foundation. +


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]