* Re: [PATCH, rs6000]: Use ROUND_UP and ROUND_DOWN macros
@ 2015-10-12 13:08 David Edelsohn
0 siblings, 0 replies; 2+ messages in thread
From: David Edelsohn @ 2015-10-12 13:08 UTC (permalink / raw)
To: Uros Bizjak; +Cc: GCC Patches
> Fairly trivial patch that introduces no functional changes.
2015-10-12 Uros Bizjak <ubizjak@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?
Okay.
Thanks, David
^ permalink raw reply [flat|nested] 2+ messages in thread
* [PATCH, rs6000]: Use ROUND_UP and ROUND_DOWN macros
@ 2015-10-12 9:08 Uros Bizjak
0 siblings, 0 replies; 2+ messages in thread
From: Uros Bizjak @ 2015-10-12 9:08 UTC (permalink / raw)
To: gcc-patches
[-- Attachment #1: Type: text/plain, Size: 599 bytes --]
Fairly trivial patch that introduces no functional changes.
2015-10-12 Uros Bizjak <ubizjak@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.
[-- Attachment #2: r.diff.txt --]
[-- Type: text/plain, Size: 2779 bytes --]
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
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2015-10-12 13:08 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-10-12 13:08 [PATCH, rs6000]: Use ROUND_UP and ROUND_DOWN macros David Edelsohn
-- strict thread matches above, loose matches on Subject: below --
2015-10-12 9:08 Uros Bizjak
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).