Kaveh R. GHAZI - Re: [PATCH]: Add folding of builtin frexp (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]

On Thu, 22 Feb 2007, Richard Guenther wrote:

On 2/22/07, Kaveh R. GHAZI ghazi@caip.rutgers.edu wrote:

This patch folds builtin frexp where thet first argument is constant.

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

Okay for mainline?

This is ok with the change below

if (!validate_arg (arg0, REAL_TYPE) || !validate_arg (arg1, POINTER_TYPE)) return NULL_TREE;

STRIP_NOPS (arg0);

if (!(TREE_CODE (arg0) == REAL_CST && ! TREE_OVERFLOW (arg0))) return NULL_TREE;

...

avoids unnecessary large indents. Thanks, Richard.

Thanks for the review, here's what I installed after another round of testing:

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

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

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

diff -rup orig/egcc-SVN20070220/gcc/builtins.c egcc-SVN20070220/gcc/builtins.c --- orig/egcc-SVN20070220/gcc/builtins.c 2007-02-20 20:02:30.000000000 -0500 +++ egcc-SVN20070220/gcc/builtins.c 2007-02-22 12:14:18.204381151 -0500 @@ -9017,6 +9017,62 @@ fold_builtin_carg (tree arg, tree type) return NULL_TREE; }

+/* Fold a call to builtin frexp, we can assume the base is 2. */ + +static tree +fold_builtin_frexp (tree arg0, tree arg1, tree rettype) +{

diff -rup orig/egcc-SVN20070220/gcc/testsuite/gcc.dg/torture/builtin-frexp-1.c egcc-SVN20070220/gcc/testsuite/gcc.dg/torture/builtin-frexp-1.c --- orig/egcc-SVN20070220/gcc/testsuite/gcc.dg/torture/builtin-frexp-1.c 2007-02-22 12🔞09.538586437 -0500 +++ egcc-SVN20070220/gcc/testsuite/gcc.dg/torture/builtin-frexp-1.c 2007-02-22 12:11:46.804239374 -0500 @@ -0,0 +1,118 @@ +/* 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]