diff mbox

[i386] : Use CEIL where applicable.

Message ID CAFULd4bgnmTWcF8Bjh0wYw9_pkvYT9PP2RxqKH9=zfDQOYQ4jQ@mail.gmail.com
State New
Headers show

Commit Message

Uros Bizjak Oct. 13, 2015, 6:58 p.m. UTC
No functional changes.

2015-10-13  Uros Bizjak  <ubizjak@gmail.com>

    * config/i386/i386.c (classify_argument): Use CEIL where applicable.
    (ix86_function_arg_advance): Ditto.
    (ix86_function_arg): Ditto.
    (ix86_gimplify_va_arg): Ditto.
    (ix86_class_max_nregs): Ditto.
    (inline_memory_move_cost): Ditto.
    (ix86_set_reg_reg_cost): Ditto.
    * config/i386/i386.h (HARD_REGNO_NREGS): Ditto.

Bootstrapped and regression tested on x86_64-linux-gnu {-m32},
committed to mainline SVN.

Uros.
diff mbox

Patch

Index: config/i386/i386.c
===================================================================
--- config/i386/i386.c	(revision 228770)
+++ config/i386/i386.c	(working copy)
@@ -7925,8 +7925,7 @@  classify_argument (machine_mode mode, const_tree t
 {
   HOST_WIDE_INT bytes =
     (mode == BLKmode) ? int_size_in_bytes (type) : (int) GET_MODE_SIZE (mode);
-  int words
-    = (bytes + (bit_offset % 64) / 8 + UNITS_PER_WORD - 1) / UNITS_PER_WORD;
+  int words = CEIL (bytes + (bit_offset % 64) / 8, UNITS_PER_WORD);
 
   /* Variable sized entities are always passed/returned in memory.  */
   if (bytes < 0)
@@ -8791,7 +8790,7 @@  ix86_function_arg_advance (cumulative_args_t cum_v
     bytes = int_size_in_bytes (type);
   else
     bytes = GET_MODE_SIZE (mode);
-  words = (bytes + UNITS_PER_WORD - 1) / UNITS_PER_WORD;
+  words = CEIL (bytes, UNITS_PER_WORD);
 
   if (type)
     mode = type_natural_mode (type, NULL, false);
@@ -9124,7 +9123,7 @@  ix86_function_arg (cumulative_args_t cum_v, machin
     bytes = int_size_in_bytes (type);
   else
     bytes = GET_MODE_SIZE (mode);
-  words = (bytes + UNITS_PER_WORD - 1) / UNITS_PER_WORD;
+  words = CEIL (bytes, UNITS_PER_WORD);
 
   /* To simplify the code below, represent vector types with a vector mode
      even if MMX/SSE are not active.  */
@@ -10271,7 +10270,7 @@  ix86_gimplify_va_arg (tree valist, tree type, gimp
   if (indirect_p)
     type = build_pointer_type (type);
   size = int_size_in_bytes (type);
-  rsize = (size + UNITS_PER_WORD - 1) / UNITS_PER_WORD;
+  rsize = CEIL (size, UNITS_PER_WORD);
 
   nat_mode = type_natural_mode (type, NULL, false);
   switch (nat_mode)
@@ -42971,7 +42970,7 @@  ix86_class_max_nregs (reg_class_t rclass, machine_
       else if (mode == XCmode)
 	return (TARGET_64BIT ? 4 : 6);
       else
-	return ((GET_MODE_SIZE (mode) + UNITS_PER_WORD - 1) / UNITS_PER_WORD);
+	return CEIL (GET_MODE_SIZE (mode), UNITS_PER_WORD);
     }
   else
     {
@@ -43130,8 +43129,7 @@  inline_memory_move_cost (machine_mode mode, enum r
 	  cost = ix86_cost->int_load[2];
 	else
 	  cost = ix86_cost->int_store[2];
-	return (cost * (((int) GET_MODE_SIZE (mode)
-		        + UNITS_PER_WORD - 1) / UNITS_PER_WORD));
+	return cost * CEIL ((int) GET_MODE_SIZE (mode), UNITS_PER_WORD);
     }
 }
 
@@ -43417,7 +43415,7 @@  ix86_set_reg_reg_cost (machine_mode mode)
 
   /* Return the cost of moving between two registers of mode MODE,
      assuming that the move will be in pieces of at most UNITS bytes.  */
-  return COSTS_N_INSNS ((GET_MODE_SIZE (mode) + units - 1) / units);
+  return COSTS_N_INSNS (CEIL (GET_MODE_SIZE (mode), units));
 }
 
 /* Compute a (partial) cost for rtx X.  Return true if the complete
Index: config/i386/i386.h
===================================================================
--- config/i386/i386.h	(revision 228770)
+++ config/i386/i386.h	(working copy)
@@ -1084,9 +1084,9 @@  extern const char *host_detect_local_cpu (int argc
    ? (COMPLEX_MODE_P (MODE) ? 2 : 1)					\
    : ((MODE) == XFmode							\
       ? (TARGET_64BIT ? 2 : 3)						\
-      : (MODE) == XCmode						\
-      ? (TARGET_64BIT ? 4 : 6)						\
-      : ((GET_MODE_SIZE (MODE) + UNITS_PER_WORD - 1) / UNITS_PER_WORD)))
+      : ((MODE) == XCmode						\
+	 ? (TARGET_64BIT ? 4 : 6)					\
+	 : CEIL (GET_MODE_SIZE (MODE), UNITS_PER_WORD))))
 
 #define HARD_REGNO_NREGS_HAS_PADDING(REGNO, MODE)			\
   ((TARGET_128BIT_LONG_DOUBLE && !TARGET_64BIT)				\