This is the mail archive of the gcc-patches@gcc.gnu.org mailing 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]

[RFC PATCH]: are we using FIX_*_EXPR ?


Some questions:

1.  I noticed in tree.def we have FIX_TRUNC_EXPR, FIX_CEIL_EXPR,
    FIX_FLOOR_EXPR and FIX_ROUND_EXPR, but we don't seem to actually
    build them anywhere.  Are they used at all?

2.  Second, in looking at where we use them I noticed we usually
    either handle all four or we handle just FIX_TRUNC_EXPR.  But in
    two cases where we handled more than one, we were missing
    FIX_ROUND_EXPR.

    So I have an untested patch for in those two cases.  I'm not sure
    how to test these code paths though.

Thoughts on #1 and #2 appreciated.

		Thanks,
		--Kaveh


2004-04-30  Kaveh R. Ghazi  <ghazi@caip.rutgers.edu>

	* fold-const.c (fold_convert_const, fold): Add missing
	FIX_ROUND_EXPR case.

diff -rup orig/egcc-CVS20040420/gcc/fold-const.c egcc-CVS20040420/gcc/fold-const.c
--- orig/egcc-CVS20040420/gcc/fold-const.c	2004-04-20 20:08:40.000000000 -0400
+++ egcc-CVS20040420/gcc/fold-const.c	2004-04-21 22:07:23.615543047 -0400
@@ -1788,6 +1788,10 @@ fold_convert_const (enum tree_code code,
 	      real_floor (&r, VOIDmode, &x);
 	      break;
 
+	    case FIX_ROUND_EXPR:
+	      real_round (&r, VOIDmode, &x);
+	      break;
+
 	    default:
 	      abort ();
 	    }
@@ -5630,6 +5634,7 @@ fold (tree expr)
     case FIX_TRUNC_EXPR:
     case FIX_CEIL_EXPR:
     case FIX_FLOOR_EXPR:
+    case FIX_ROUND_EXPR:
       if (TREE_TYPE (TREE_OPERAND (t, 0)) == type)
 	return TREE_OPERAND (t, 0);
 


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