public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Eric Botcazou <ebotcazou@adacore.com>
To: Uros Bizjak <ubizjak@gmail.com>
Cc: gcc-patches@gcc.gnu.org
Subject: Re: [SPARC] Fix PR target/69706
Date: Tue, 01 Mar 2016 00:22:00 -0000	[thread overview]
Message-ID: <1798610.LvR26iygsb@polaris> (raw)
In-Reply-To: <CAFULd4Y_1TqoHcRVwOubAURJ5U=1cVL4Me9cgT9gE=F6=EKabA@mail.gmail.com>

[-- Attachment #1: Type: text/plain, Size: 623 bytes --]

> +/* Number of words (partially) occupied for a given size in units.  */
> +#define NWORDS_UP(SIZE) (((SIZE) + UNITS_PER_WORD - 1) / UNITS_PER_WORD)
> 
> -#define ROUND_ADVANCE(SIZE) (((SIZE) + UNITS_PER_WORD - 1) /
> UNITS_PER_WORD)
> 
> You can use CEIL macro from system.h here.

Good idea, thanks, applied on the mainline.


	PR target/69706
	* config/sparc/sparc.c (NWORDS_UP): Rename to...
	(CEIL_NWORDS): ...this.  Use CEIL macro.
	(compute_fp_layout): Adjust to above renaming.
	(function_arg_union_value): Likewise.
	(sparc_arg_partial_bytes): Likewise.
	(sparc_function_arg_advance): Likewise.

-- 
Eric Botcazou

[-- Attachment #2: p.diff --]
[-- Type: text/x-patch, Size: 2213 bytes --]

Index: config/sparc/sparc.c
===================================================================
--- config/sparc/sparc.c	(revision 233808)
+++ config/sparc/sparc.c	(working copy)
@@ -6086,7 +6086,7 @@ conventions.  */
 /* Maximum number of fp regs for args.  */
 #define SPARC_FP_ARG_MAX 16
 /* Number of words (partially) occupied for a given size in units.  */
-#define NWORDS_UP(SIZE) (((SIZE) + UNITS_PER_WORD - 1) / UNITS_PER_WORD)
+#define CEIL_NWORDS(SIZE) CEIL((SIZE), UNITS_PER_WORD)
 
 /* Handle the INIT_CUMULATIVE_ARGS macro.
    Initialize a variable CUM of type CUMULATIVE_ARGS
@@ -6429,7 +6429,7 @@ compute_fp_layout (const_tree field, HOS
   else
     nregs = 1;
 
-  nslots = NWORDS_UP (nregs * GET_MODE_SIZE (mode));
+  nslots = CEIL_NWORDS (nregs * GET_MODE_SIZE (mode));
 
   if (nslots > SPARC_FP_ARG_MAX - this_slotno)
     {
@@ -6661,7 +6661,7 @@ static rtx
 function_arg_union_value (int size, machine_mode mode, int slotno,
 			  int regno)
 {
-  int nwords = NWORDS_UP (size), i;
+  int nwords = CEIL_NWORDS (size), i;
   rtx regs;
 
   /* See comment in previous function for empty structures.  */
@@ -6893,8 +6893,8 @@ sparc_arg_partial_bytes (cumulative_args
   if (TARGET_ARCH32)
     {
       if ((slotno + (mode == BLKmode
-		     ? NWORDS_UP (int_size_in_bytes (type))
-		     : NWORDS_UP (GET_MODE_SIZE (mode))))
+		     ? CEIL_NWORDS (int_size_in_bytes (type))
+		     : CEIL_NWORDS (GET_MODE_SIZE (mode))))
 	  > SPARC_INT_ARG_MAX)
 	return (SPARC_INT_ARG_MAX - slotno) * UNITS_PER_WORD;
     }
@@ -7004,8 +7004,8 @@ sparc_function_arg_advance (cumulative_a
 
   if (TARGET_ARCH32)
     cum->words += (mode == BLKmode
-		   ? NWORDS_UP (int_size_in_bytes (type))
-		   : NWORDS_UP (GET_MODE_SIZE (mode)));
+		   ? CEIL_NWORDS (int_size_in_bytes (type))
+		   : CEIL_NWORDS (GET_MODE_SIZE (mode)));
   else
     {
       if (type && AGGREGATE_TYPE_P (type))
@@ -7021,8 +7021,8 @@ sparc_function_arg_advance (cumulative_a
 	}
       else
 	cum->words += (mode == BLKmode
-		       ? NWORDS_UP (int_size_in_bytes (type))
-		       : NWORDS_UP (GET_MODE_SIZE (mode)));
+		       ? CEIL_NWORDS (int_size_in_bytes (type))
+		       : CEIL_NWORDS (GET_MODE_SIZE (mode)));
     }
 }
 

  reply	other threads:[~2016-03-01  0:22 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-02-29 11:17 Uros Bizjak
2016-03-01  0:22 ` Eric Botcazou [this message]
  -- strict thread matches above, loose matches on Subject: below --
2016-02-29 10:21 Eric Botcazou

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=1798610.LvR26iygsb@polaris \
    --to=ebotcazou@adacore.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=ubizjak@gmail.com \
    /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).