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)
+{
+ if (validate_arg (arg0, REAL_TYPE) && validate_arg (arg1, POINTER_TYPE))
+ {
+ STRIP_NOPS (arg0);
+
+ if (TREE_CODE (arg0) == REAL_CST && ! TREE_OVERFLOW (arg0))
+ {