Patchwork RFA (middle-end): Allow PUSH_ROUNDING to have a type.

login
register
mail settings
Submitter Joern Rennecke
Date Nov. 5, 2010, 1:07 p.m.
Message ID <20101105090742.axvmosw48ck88oos-nzlynne@webmail.spamcop.net>
Download mbox | patch
Permalink /patch/70260/
State New
Headers show

Comments

Joern Rennecke - Nov. 5, 2010, 1:07 p.m.
Most of the contexts where PUSH_ROUNDING is used are suitable for
an unsigned value, but there is one place in expr.cwhere only a signed
value will do without eliciting signed/unsigned comparison warnings.
Target ports that define PUSH_ROUNDING entirely with a macro get by
because the argument to PUSH_ROUNDING likewise varies in signedness, but
m32c is out of luck as it uses a function to define the macro.
Prohibiting the use of a function to define PUSH_ROUNDING wouldn't help
with our goal to move towards the use of target hooks, and requiring
C++ overloading doesn't really make sense either.

Therefore, I think it should be possible to define PUSH_ROUNDING in a way
that it returns one specific type.  As the value is naturally unsigned, and
the majority of sites which use it require an unsigned definition, I think it
is best to adjust the one site that currently requires a signed definition.

bootstrapped on i686-pc-linux-gnu.
2010-11-05  Joern Rennecke  <amylaar@spamcop.net>

	PR bootstrap/44756
	* expr.c (emit_push_insn): Cast value of PUSH_ROUNDING before
	comparing it to a signed value.
Richard Guenther - Nov. 5, 2010, 1:09 p.m.
On Fri, Nov 5, 2010 at 2:07 PM, Joern Rennecke <amylaar@spamcop.net> wrote:
> Most of the contexts where PUSH_ROUNDING is used are suitable for
> an unsigned value, but there is one place in expr.cwhere only a signed
> value will do without eliciting signed/unsigned comparison warnings.
> Target ports that define PUSH_ROUNDING entirely with a macro get by
> because the argument to PUSH_ROUNDING likewise varies in signedness, but
> m32c is out of luck as it uses a function to define the macro.
> Prohibiting the use of a function to define PUSH_ROUNDING wouldn't help
> with our goal to move towards the use of target hooks, and requiring
> C++ overloading doesn't really make sense either.
>
> Therefore, I think it should be possible to define PUSH_ROUNDING in a way
> that it returns one specific type.  As the value is naturally unsigned, and
> the majority of sites which use it require an unsigned definition, I think
> it
> is best to adjust the one site that currently requires a signed definition.
>
> bootstrapped on i686-pc-linux-gnu.

Ok.

Richard.

>
>
> 2010-11-05  Joern Rennecke  <amylaar@spamcop.net>
>
>        PR bootstrap/44756
>        * expr.c (emit_push_insn): Cast value of PUSH_ROUNDING before
>        comparing it to a signed value.
>
> Index: expr.c
> ===================================================================
> --- expr.c      (revision 166313)
> +++ expr.c      (working copy)
> @@ -3775,7 +3775,7 @@ emit_push_insn (rtx x, enum machine_mode
>              || align >= BIGGEST_ALIGNMENT
>              || (PUSH_ROUNDING (align / BITS_PER_UNIT)
>                  == (align / BITS_PER_UNIT)))
> -         && PUSH_ROUNDING (INTVAL (size)) == INTVAL (size))
> +         && (HOST_WIDE_INT) PUSH_ROUNDING (INTVAL (size)) == INTVAL (size))
>        {
>          /* Push padding now if padding above and stack grows down,
>             or if padding below and stack grows up.
>
>

Patch

Index: expr.c
===================================================================
--- expr.c	(revision 166313)
+++ expr.c	(working copy)
@@ -3775,7 +3775,7 @@  emit_push_insn (rtx x, enum machine_mode
 	      || align >= BIGGEST_ALIGNMENT
 	      || (PUSH_ROUNDING (align / BITS_PER_UNIT)
 		  == (align / BITS_PER_UNIT)))
-	  && PUSH_ROUNDING (INTVAL (size)) == INTVAL (size))
+	  && (HOST_WIDE_INT) PUSH_ROUNDING (INTVAL (size)) == INTVAL (size))
 	{
 	  /* Push padding now if padding above and stack grows down,
 	     or if padding below and stack grows up.