Kaveh R. GHAZI - [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]

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

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

Okay for mainline?

    Thanks,
    --Kaveh

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-21 21:50:19.870945237 -0500 @@ -9017,6 +9017,63 @@ 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-21 21:58:09.481950576 -0500 +++ egcc-SVN20070220/gcc/testsuite/gcc.dg/torture/builtin-frexp-1.c 2007-02-21 21:49:46.565888014 -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]