Fairly trivial patch that introduces no functional changes.

2015-10-12  Uros Bizjak  <ubiz...@gmail.com>

    * config/rs6000/rs6000.h (RS6000_ALIGN): Implement using
    ROUND_UP macro.
    * config/rs6000/rs6000.c (rs6000_darwin64_record_arg_advance_flush):
    Use ROUND_UP and ROUND_DOWN macros where applicable.
    (rs6000_darwin64_record_arg_flush): Ditto.
    (rs6000_function_arg): Use ROUND_UP to calculate align_words.
    (rs6000_emit_probe_stack_range): Use ROUND_DOWN to calculate
    rounded_size.

Tested by building a crosscompiler to powerpc64-linux-gnu.

OK for mainline?

Uros.
Index: config/rs6000/rs6000.c
===================================================================
--- config/rs6000/rs6000.c      (revision 228703)
+++ config/rs6000/rs6000.c      (working copy)
@@ -9790,12 +9790,12 @@ rs6000_darwin64_record_arg_advance_flush (CUMULATI
             e.g., in packed structs when there are 3 bytes to load.
             Back intoffset back to the beginning of the word in this
             case.  */
-         intoffset = intoffset & -BITS_PER_WORD;
+         intoffset = ROUND_DOWN (intoffset, BITS_PER_WORD);
        }
     }
 
-  startbit = intoffset & -BITS_PER_WORD;
-  endbit = (bitpos + BITS_PER_WORD - 1) & -BITS_PER_WORD;
+  startbit = ROUND_DOWN (intoffset, BITS_PER_WORD);
+  endbit = ROUND_UP (bitpos, BITS_PER_WORD);
   intregs = (endbit - startbit) / BITS_PER_WORD;
   cum->words += intregs;
   /* words should be unsigned. */
@@ -10255,15 +10255,15 @@ rs6000_darwin64_record_arg_flush (CUMULATIVE_ARGS
             e.g., in packed structs when there are 3 bytes to load.
             Back intoffset back to the beginning of the word in this
             case.  */
-        intoffset = intoffset & -BITS_PER_WORD;
-        mode = word_mode;
+         intoffset = ROUND_DOWN (intoffset, BITS_PER_WORD);
+         mode = word_mode;
        }
     }
   else
     mode = word_mode;
 
-  startbit = intoffset & -BITS_PER_WORD;
-  endbit = (bitpos + BITS_PER_WORD - 1) & -BITS_PER_WORD;
+  startbit = ROUND_DOWN (intoffset, BITS_PER_WORD);
+  endbit = ROUND_UP (bitpos, BITS_PER_WORD);
   intregs = (endbit - startbit) / BITS_PER_WORD;
   this_regno = cum->words + intoffset / BITS_PER_WORD;
 
@@ -10622,7 +10622,7 @@ rs6000_function_arg (cumulative_args_t cum_v, mach
         save area?  */
       if (TARGET_64BIT && ! cum->prototype)
        {
-         int align_words = (cum->words + 1) & ~1;
+         int align_words = ROUND_UP (cum->words, 2);
          k = rs6000_psave_function_arg (mode, type, align_words, rvec);
        }
 
@@ -23336,7 +23336,7 @@ rs6000_emit_probe_stack_range (HOST_WIDE_INT first
 
       /* Step 1: round SIZE to the previous multiple of the interval.  */
 
-      rounded_size = size & -PROBE_INTERVAL;
+      rounded_size = ROUND_DOWN (size, PROBE_INTERVAL);
 
 
       /* Step 2: compute initial and final value of the loop counter.  */
Index: config/rs6000/rs6000.h
===================================================================
--- config/rs6000/rs6000.h      (revision 228703)
+++ config/rs6000/rs6000.h      (working copy)
@@ -1615,7 +1615,7 @@ extern enum reg_class rs6000_constraints[RS6000_CO
   ((DEFAULT_ABI == ABI_ELFv2 ? 12 : 20) << (TARGET_64BIT ? 1 : 0))
 
 /* Align an address */
-#define RS6000_ALIGN(n,a) (((n) + (a) - 1) & ~((a) - 1))
+#define RS6000_ALIGN(n,a) ROUND_UP ((n), (a))
 
 /* Offset within stack frame to start allocating local variables at.
    If FRAME_GROWS_DOWNWARD, this is the offset to the END of the

Reply via email to