From: Uros Bizjak <ubizjak@gmail.com>
To: "gcc-patches@gcc.gnu.org" <gcc-patches@gcc.gnu.org>
Subject: [PATCH, mips]: Use ROUND_UP and ROUND_DOWN macros
Date: Mon, 12 Oct 2015 17:22:00 -0000 [thread overview]
Message-ID: <CAFULd4YD9wpXHd0LOeUcJHaGeDTHRwint8efYVRh2qopsiq-sQ@mail.gmail.com> (raw)
[-- Attachment #1: Type: text/plain, Size: 467 bytes --]
Fairly trivial patch that introduces no functional changes.
* config/mips/mips.h (MIPS_STACK_ALIGN): Implement using
ROUND_UP macro.
* config/mips/mips.c (mips_setup_incoming_varargs): Use
ROUND_DOWN to calculate off.
(mips_gimplify_va_arg_expr): Use ROUND_UP to calculate rsize.
(mips_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: m.diff.txt --]
[-- Type: text/plain, Size: 1978 bytes --]
Index: config/mips/mips.c
===================================================================
--- config/mips/mips.c (revision 228726)
+++ config/mips/mips.c (working copy)
@@ -6080,7 +6080,7 @@ mips_setup_incoming_varargs (cumulative_args_t cum
/* Set OFF to the offset from virtual_incoming_args_rtx of
the first float register. The FP save area lies below
the integer one, and is aligned to UNITS_PER_FPVALUE bytes. */
- off = (-gp_saved * UNITS_PER_WORD) & -UNITS_PER_FPVALUE;
+ off = ROUND_DOWN (-gp_saved * UNITS_PER_WORD, UNITS_PER_FPVALUE);
off -= fp_saved * UNITS_PER_FPREG;
mode = TARGET_SINGLE_FLOAT ? SFmode : DFmode;
@@ -6444,7 +6444,7 @@ mips_gimplify_va_arg_expr (tree valist, tree type,
unshare_expr (valist), f_gtop, NULL_TREE);
off = build3 (COMPONENT_REF, TREE_TYPE (f_goff),
unshare_expr (valist), f_goff, NULL_TREE);
- rsize = (size + UNITS_PER_WORD - 1) & -UNITS_PER_WORD;
+ rsize = ROUND_UP (size, UNITS_PER_WORD);
if (rsize > UNITS_PER_WORD)
{
/* [1] Emit code for: off &= -rsize. */
@@ -11320,7 +11320,7 @@ mips_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/mips/mips.h
===================================================================
--- config/mips/mips.h (revision 228726)
+++ config/mips/mips.h (working copy)
@@ -2486,7 +2486,7 @@ typedef struct mips_args {
/* Treat LOC as a byte offset from the stack pointer and round it up
to the next fully-aligned offset. */
#define MIPS_STACK_ALIGN(LOC) \
- (TARGET_NEWABI ? ((LOC) + 15) & -16 : ((LOC) + 7) & -8)
+ (TARGET_NEWABI ? ROUND_UP ((LOC), 16) : ROUND_UP ((LOC), 8))
\f
/* Output assembler code to FILE to increment profiler label # LABELNO
next reply other threads:[~2015-10-12 17:22 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-10-12 17:22 Uros Bizjak [this message]
2015-10-14 21:38 ` Matthew Fortune
2015-10-14 21:47 ` Uros Bizjak
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=CAFULd4YD9wpXHd0LOeUcJHaGeDTHRwint8efYVRh2qopsiq-sQ@mail.gmail.com \
--to=ubizjak@gmail.com \
--cc=gcc-patches@gcc.gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).