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]

PATCH: use SCALAR_FLOAT_MODE_P more widely


This patch replaces a handful of instances of the idiom:

	GET_MODE_CLASS (x) == MODE_FLOAT
with:
	SCALAR_FLOAT_MODE_P (x).

Okay for the trunk?  Tested with a bootstrap on i686-pc-linux-gnu.

Ben


2005-11-18  Ben Elliston  <bje@au.ibm.com>

	* optabs.c (expand_abs_nojump): Use SCALAR_FLOAT_MODE_P instead of
	explicitly testing GET_MODE_CLASS (x) == MODE_FLOAT.
	* genopinit.c (gen_insn): Likewise.
	* reload.c (find_equiv_reg): Likewise.
	* loop.c (load_mems): Likewise.
	* rtlanal.c (may_trap_p_1, canonicalize_condition): Likewise.
	* cse.c (find_comparison_args, fold_rtx): Likewise.
	* dwarf2out.c (add_const_value_attribute): Likewise.
	* expr.c (convert_move): Likewise.
	* recog.c (general_operand, register_operand): Likewise.
	* reg-stack.c (replace_reg): Likewise.
	* tree-vect-generic.c (type_for_widest_vector_mode): Likewise.
	* c-common.c (handle_vector_size_attribute): Likewise.
	* simplify-rtx.c (simplify_const_unary_operation): Likewise.
	(simplify_binary_operation_1): Likewise.
	(simplify_const_binary_operation): Likewise.
	(simplify_relational_operation): Likewise.
	(simplify_const_relational_operation): Likewise.
	(simplify_immed_subreg): Likewise.
	* emit-rtl.c (gen_lowpart_common): Likewise.
	* expmed.c (expand_mult): Likewise.
	* stor-layout.c (layout_type): Likewise.

Index: optabs.c
===================================================================
--- optabs.c	(revision 107262)
+++ optabs.c	(working copy)
@@ -2641,7 +2641,7 @@
     return temp;
 
   /* For floating point modes, try clearing the sign bit.  */
-  if (GET_MODE_CLASS (mode) == MODE_FLOAT)
+  if (SCALAR_FLOAT_MODE_P (mode))
     {
       temp = expand_absneg_bit (ABS, mode, op0, target);
       if (temp)
Index: genopinit.c
===================================================================
--- genopinit.c	(revision 107262)
+++ genopinit.c	(working copy)
@@ -354,7 +354,7 @@
 	  case 'I':  case 'F':  case 'N':
 	    break;
 	  case 'V':
-            if (GET_MODE_CLASS (m1) == MODE_FLOAT)
+	    if (SCALAR_FLOAT_MODE_P (m1))
               printf ("v");
             break;
 	  case 'a':
Index: reload.c
===================================================================
--- reload.c	(revision 107262)
+++ reload.c	(working copy)
@@ -6518,7 +6518,7 @@
       enum rtx_code code = GET_CODE (XEXP (goal, 0));
       if (MEM_VOLATILE_P (goal))
 	return 0;
-      if (flag_float_store && GET_MODE_CLASS (GET_MODE (goal)) == MODE_FLOAT)
+      if (flag_float_store && SCALAR_FLOAT_MODE_P (GET_MODE (goal)))
 	return 0;
       /* An address with side effects must be reexecuted.  */
       switch (code)
@@ -6609,8 +6609,7 @@
 			       = true_regnum (valtry = SET_DEST (pat))) >= 0)
 			  || (REG_P (SET_DEST (pat))
 			      && GET_CODE (XEXP (tem, 0)) == CONST_DOUBLE
-			      && (GET_MODE_CLASS (GET_MODE (XEXP (tem, 0)))
-				  == MODE_FLOAT)
+			      && SCALAR_FLOAT_MODE_P (GET_MODE (XEXP (tem, 0)))
 			      && GET_CODE (goal) == CONST_INT
 			      && 0 != (goaltry
 				       = operand_subword (XEXP (tem, 0), 0, 0,
@@ -6624,8 +6623,7 @@
 							  NULL_RTX))
 		      && REG_P (SET_DEST (pat))
 		      && GET_CODE (XEXP (tem, 0)) == CONST_DOUBLE
-		      && (GET_MODE_CLASS (GET_MODE (XEXP (tem, 0)))
-			  == MODE_FLOAT)
+		      && SCALAR_FLOAT_MODE_P (GET_MODE (XEXP (tem, 0)))
 		      && GET_CODE (goal) == CONST_INT
 		      && 0 != (goaltry = operand_subword (XEXP (tem, 0), 1, 0,
 							  VOIDmode))
Index: loop.c
===================================================================
--- loop.c	(revision 107262)
+++ loop.c	(working copy)
@@ -10816,7 +10816,7 @@
 	}
 
       if (flag_float_store && written
-	  && GET_MODE_CLASS (GET_MODE (mem)) == MODE_FLOAT)
+	  && SCALAR_FLOAT_MODE_P (GET_MODE (mem)))
 	loop_info->mems[i].optimize = 0;
 
       /* If this MEM is written to, we must be sure that there
Index: rtlanal.c
===================================================================
--- rtlanal.c	(revision 107262)
+++ rtlanal.c	(working copy)
@@ -2155,7 +2155,7 @@
     case UMOD:
       if (HONOR_SNANS (GET_MODE (x)))
 	return 1;
-      if (GET_MODE_CLASS (GET_MODE (x)) == MODE_FLOAT)
+      if (SCALAR_FLOAT_MODE_P (GET_MODE (x)))
 	return flag_trapping_math;
       if (!CONSTANT_P (XEXP (x, 1)) || (XEXP (x, 1) == const0_rtx))
 	return 1;
@@ -2212,7 +2212,7 @@
 
     default:
       /* Any floating arithmetic may trap.  */
-      if (GET_MODE_CLASS (GET_MODE (x)) == MODE_FLOAT
+      if (SCALAR_FLOAT_MODE_P (GET_MODE (x))
 	  && flag_trapping_math)
 	return 1;
     }
@@ -4683,7 +4683,7 @@
 				<< (GET_MODE_BITSIZE (inner_mode) - 1))))
 #ifdef FLOAT_STORE_FLAG_VALUE
 		     || (code == LT
-			 && GET_MODE_CLASS (inner_mode) == MODE_FLOAT
+			 && SCALAR_FLOAT_MODE_P (inner_mode)
 			 && (fsfv = FLOAT_STORE_FLAG_VALUE (inner_mode),
 			     REAL_VALUE_NEGATIVE (fsfv)))
 #endif
@@ -4703,7 +4703,7 @@
 				<< (GET_MODE_BITSIZE (inner_mode) - 1))))
 #ifdef FLOAT_STORE_FLAG_VALUE
 		     || (code == GE
-			 && GET_MODE_CLASS (inner_mode) == MODE_FLOAT
+			 && SCALAR_FLOAT_MODE_P (inner_mode)
 			 && (fsfv = FLOAT_STORE_FLAG_VALUE (inner_mode),
 			     REAL_VALUE_NEGATIVE (fsfv)))
 #endif
Index: cse.c
===================================================================
--- cse.c	(revision 107262)
+++ cse.c	(working copy)
@@ -3088,7 +3088,7 @@
 	      || (GET_MODE_CLASS (GET_MODE (arg1)) == MODE_INT
 		  && code == LT && STORE_FLAG_VALUE == -1)
 #ifdef FLOAT_STORE_FLAG_VALUE
-	      || (GET_MODE_CLASS (GET_MODE (arg1)) == MODE_FLOAT
+	      || (SCALAR_FLOAT_MODE_P (arg1)
 		  && (fsfv = FLOAT_STORE_FLAG_VALUE (GET_MODE (arg1)),
 		      REAL_VALUE_NEGATIVE (fsfv)))
 #endif
@@ -3098,7 +3098,7 @@
 		   || (GET_MODE_CLASS (GET_MODE (arg1)) == MODE_INT
 		       && code == GE && STORE_FLAG_VALUE == -1)
 #ifdef FLOAT_STORE_FLAG_VALUE
-		   || (GET_MODE_CLASS (GET_MODE (arg1)) == MODE_FLOAT
+		   || (SCALAR_FLOAT_MODE_P (arg1)
 		       && (fsfv = FLOAT_STORE_FLAG_VALUE (GET_MODE (arg1)),
 			   REAL_VALUE_NEGATIVE (fsfv)))
 #endif
@@ -3161,7 +3161,7 @@
 			      << (GET_MODE_BITSIZE (inner_mode) - 1))))
 #ifdef FLOAT_STORE_FLAG_VALUE
 		   || (code == LT
-		       && GET_MODE_CLASS (inner_mode) == MODE_FLOAT
+		       && SCALAR_FLOAT_MODE_P (inner_mode)
 		       && (fsfv = FLOAT_STORE_FLAG_VALUE (GET_MODE (arg1)),
 			   REAL_VALUE_NEGATIVE (fsfv)))
 #endif
@@ -3181,7 +3181,7 @@
 			       << (GET_MODE_BITSIZE (inner_mode) - 1))))
 #ifdef FLOAT_STORE_FLAG_VALUE
 		    || (code == GE
-			&& GET_MODE_CLASS (inner_mode) == MODE_FLOAT
+			&& SCALAR_FLOAT_MODE_P (inner_mode)
 			&& (fsfv = FLOAT_STORE_FLAG_VALUE (GET_MODE (arg1)),
 			    REAL_VALUE_NEGATIVE (fsfv)))
 #endif
@@ -3946,7 +3946,7 @@
 	  enum machine_mode mode_arg1;
 
 #ifdef FLOAT_STORE_FLAG_VALUE
-	  if (GET_MODE_CLASS (mode) == MODE_FLOAT)
+	  if (SCALAR_FLOAT_MODE (mode))
 	    {
 	      true_rtx = (CONST_DOUBLE_FROM_REAL_VALUE
 			  (FLOAT_STORE_FLAG_VALUE (mode), mode));
@@ -4061,7 +4061,7 @@
 	      rtx true_rtx = const_true_rtx, false_rtx = const0_rtx;
 
 #ifdef FLOAT_STORE_FLAG_VALUE
-	      if (GET_MODE_CLASS (mode) == MODE_FLOAT)
+	      if (SCALAR_FLOAT_MODE_P (mode))
 		{
 		  true_rtx = (CONST_DOUBLE_FROM_REAL_VALUE
 			  (FLOAT_STORE_FLAG_VALUE (mode), mode));
Index: dwarf2out.c
===================================================================
--- dwarf2out.c	(revision 107262)
+++ dwarf2out.c	(working copy)
@@ -9787,7 +9787,7 @@
       {
 	enum machine_mode mode = GET_MODE (rtl);
 
-	if (GET_MODE_CLASS (mode) == MODE_FLOAT)
+	if (SCALAR_FLOAT_MODE_P (mode))
 	  {
 	    unsigned int length = GET_MODE_SIZE (mode);
 	    unsigned char *array = ggc_alloc (length);
Index: expr.c
===================================================================
--- expr.c	(revision 107262)
+++ expr.c	(working copy)
@@ -349,8 +349,8 @@
 {
   enum machine_mode to_mode = GET_MODE (to);
   enum machine_mode from_mode = GET_MODE (from);
-  int to_real = GET_MODE_CLASS (to_mode) == MODE_FLOAT;
-  int from_real = GET_MODE_CLASS (from_mode) == MODE_FLOAT;
+  int to_real = SCALAR_FLOAT_MODE_P (to_mode);
+  int from_real = SCALAR_FLOAT_MODE_P (from_mode);
   enum insn_code code;
   rtx libcall;
 
Index: recog.c
===================================================================
--- recog.c	(revision 107262)
+++ recog.c	(working copy)
@@ -1003,7 +1003,7 @@
 
       /* FLOAT_MODE subregs can't be paradoxical.  Combine will occasionally
 	 create such rtl, and we must reject it.  */
-      if (GET_MODE_CLASS (GET_MODE (op)) == MODE_FLOAT
+      if (SCALAR_FLOAT_MODE_P (GET_MODE (op))
 	  && GET_MODE_SIZE (GET_MODE (op)) > GET_MODE_SIZE (GET_MODE (sub)))
 	return 0;
 
@@ -1087,7 +1087,7 @@
 
       /* FLOAT_MODE subregs can't be paradoxical.  Combine will occasionally
 	 create such rtl, and we must reject it.  */
-      if (GET_MODE_CLASS (GET_MODE (op)) == MODE_FLOAT
+      if (SCALAR_FLOAT_MODE_P (GET_MODE (op))
 	  && GET_MODE_SIZE (GET_MODE (op)) > GET_MODE_SIZE (GET_MODE (sub)))
 	return 0;
 
Index: stor-layout.c
===================================================================
--- stor-layout.c	(revision 107262)
+++ stor-layout.c	(working copy)
@@ -1645,7 +1645,7 @@
 	    enum machine_mode mode;
 
 	    /* First, look for a supported vector type.  */
-	    if (GET_MODE_CLASS (innermode) == MODE_FLOAT)
+	    if (SCALAR_FLOAT_MODE_P (innermode))
 	      mode = MIN_MODE_VECTOR_FLOAT;
 	    else
 	      mode = MIN_MODE_VECTOR_INT;
Index: expmed.c
===================================================================
--- expmed.c	(revision 107262)
+++ expmed.c	(working copy)
@@ -3155,7 +3155,7 @@
 
   /* Expand x*2.0 as x+x.  */
   if (GET_CODE (op1) == CONST_DOUBLE
-      && GET_MODE_CLASS (mode) == MODE_FLOAT)
+      && SCALAR_FLOAT_MODE_P (mode))
     {
       REAL_VALUE_TYPE d;
       REAL_VALUE_FROM_CONST_DOUBLE (d, op1);
Index: emit-rtl.c
===================================================================
--- emit-rtl.c	(revision 107262)
+++ emit-rtl.c	(working copy)
@@ -1162,7 +1162,7 @@
     return 0;
 
   /* Don't allow generating paradoxical FLOAT_MODE subregs.  */
-  if (GET_MODE_CLASS (mode) == MODE_FLOAT && msize > xsize)
+  if (SCALAR_FLOAT_MODE_P (mode) && msize > xsize)
     return 0;
 
   offset = subreg_lowpart_offset (mode, innermode);
Index: simplify-rtx.c
===================================================================
--- simplify-rtx.c	(revision 107262)
+++ simplify-rtx.c	(working copy)
@@ -983,7 +983,7 @@
     }
 
   else if (GET_CODE (op) == CONST_DOUBLE
-	   && GET_MODE_CLASS (mode) == MODE_FLOAT)
+	   && SCALAR_FLOAT_MODE_P (mode))
     {
       REAL_VALUE_TYPE d, t;
       REAL_VALUE_FROM_CONST_DOUBLE (d, op);
@@ -1029,7 +1029,7 @@
     }
 
   else if (GET_CODE (op) == CONST_DOUBLE
-	   && GET_MODE_CLASS (GET_MODE (op)) == MODE_FLOAT
+	   && SCALAR_FLOAT_MODE_P (GET_MODE (op))
 	   && GET_MODE_CLASS (mode) == MODE_INT
 	   && width <= 2*HOST_BITS_PER_WIDE_INT && width > 0)
     {
@@ -1610,7 +1610,7 @@
 
       /* x*2 is x+x and x*(-1) is -x */
       if (GET_CODE (trueop1) == CONST_DOUBLE
-	  && GET_MODE_CLASS (GET_MODE (trueop1)) == MODE_FLOAT
+	  && SCALAR_FLOAT_MODE_P (GET_MODE (trueop1))
 	  && GET_MODE (op0) == mode)
 	{
 	  REAL_VALUE_TYPE d;
@@ -1792,7 +1792,7 @@
 
     case DIV:
       /* Handle floating point and integers separately.  */
-      if (GET_MODE_CLASS (mode) == MODE_FLOAT)
+      if (SCALAR_FLOAT_MODE_P (mode))
 	{
 	  /* Maybe change 0.0 / x to 0.0.  This transformation isn't
 	     safe for modes with NaNs, since 0.0 / 0.0 will then be
@@ -2146,7 +2146,7 @@
       return gen_rtx_CONST_VECTOR (mode, v);
     }
 
-  if (GET_MODE_CLASS (mode) == MODE_FLOAT
+  if (SCALAR_FLOAT_MODE_P (mode)
       && GET_CODE (op0) == CONST_DOUBLE
       && GET_CODE (op1) == CONST_DOUBLE
       && mode == GET_MODE (op0) && mode == GET_MODE (op1))
@@ -2890,7 +2890,7 @@
   tem = simplify_const_relational_operation (code, cmp_mode, op0, op1);
   if (tem)
     {
-      if (GET_MODE_CLASS (mode) == MODE_FLOAT)
+      if (SCALAR_FLOAT_MODE_P (mode))
 	{
           if (tem == const0_rtx)
             return CONST0_RTX (mode);
@@ -3108,7 +3108,7 @@
      the result.  */
   else if (GET_CODE (trueop0) == CONST_DOUBLE
 	   && GET_CODE (trueop1) == CONST_DOUBLE
-	   && GET_MODE_CLASS (GET_MODE (trueop0)) == MODE_FLOAT)
+	   && SCALAR_FLOAT_MODE_P (GET_MODE (trueop0)))
     {
       REAL_VALUE_TYPE d0, d1;
 
@@ -3642,7 +3642,7 @@
 	      long tmp[max_bitsize / 32];
 	      int bitsize = GET_MODE_BITSIZE (GET_MODE (el));
 
-	      gcc_assert (GET_MODE_CLASS (GET_MODE (el)) == MODE_FLOAT);
+	      gcc_assert (SCALAR_FLOAT_MODE_P (GET_MODE (el)));
 	      gcc_assert (bitsize <= elem_bitsize);
 	      gcc_assert (bitsize % value_bit == 0);
 
Index: tree-vect-generic.c
===================================================================
--- tree-vect-generic.c	(revision 107262)
+++ tree-vect-generic.c	(working copy)
@@ -348,7 +348,7 @@
   enum machine_mode best_mode = VOIDmode, mode;
   int best_nunits = 0;
 
-  if (GET_MODE_CLASS (inner_mode) == MODE_FLOAT)
+  if (SCALAR_FLOAT_MODE_P (inner_mode))
     mode = MIN_MODE_VECTOR_FLOAT;
   else
     mode = MIN_MODE_VECTOR_INT;
Index: c-common.c
===================================================================
--- c-common.c	(revision 107262)
+++ c-common.c	(working copy)
@@ -5164,7 +5164,7 @@
   orig_mode = TYPE_MODE (type);
 
   if (TREE_CODE (type) == RECORD_TYPE
-      || (GET_MODE_CLASS (orig_mode) != MODE_FLOAT
+      || (!SCALAR_FLOAT_MODE_P (orig_mode)
 	  && GET_MODE_CLASS (orig_mode) != MODE_INT)
       || !host_integerp (TYPE_SIZE_UNIT (type), 1))
     {
Index: reg-stack.c
===================================================================
--- reg-stack.c	(revision 107262)
+++ reg-stack.c	(working copy)
@@ -690,7 +690,7 @@
   gcc_assert (regno <= LAST_STACK_REG);
   gcc_assert (STACK_REG_P (*reg));
 
-  gcc_assert (GET_MODE_CLASS (GET_MODE (*reg)) == MODE_FLOAT
+  gcc_assert (SCALAR_FLOAT_MODE_P (GET_MODE (*reg))
 	      || GET_MODE_CLASS (GET_MODE (*reg)) == MODE_COMPLEX_FLOAT);
 
   *reg = FP_MODE_REG (regno, GET_MODE (*reg));


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