Patchwork RFA: Fix bootstrap/46358

login
register
mail settings
Submitter Joern Rennecke
Date Nov. 8, 2010, 9:57 a.m.
Message ID <20101108045743.4e05vgz5wk00w4g0-nzlynne@webmail.spamcop.net>
Download mbox | patch
Permalink /patch/70406/
State New
Headers show

Comments

Joern Rennecke - Nov. 8, 2010, 9:57 a.m.
Currently bootstrapping on i686-pc-linux-gnu.
2010-11-08  Joern Rennecke  <amylaar@spamcop.net>

	PR bootstrap/46358
	* config/i386/i386.c (ix86_expand_split_stack_prologue):
	Avoid warnings when HOST_WIDE_INT is 32 bit.
Richard Henderson - Nov. 8, 2010, 4:40 p.m.
On 11/08/2010 01:57 AM, Joern Rennecke wrote:
> +	  gcc_assert ((allocate & (HOST_WIDE_INT) 0xffffffff) == allocate);
> +	  gcc_assert (((HOST_WIDE_INT) args_size & (HOST_WIDE_INT) 0xffffffff)
>  		      == (HOST_WIDE_INT) args_size);

Please just promote args_size to HOST_WIDE_INT.

> +	  argval = (HOST_BITS_PER_WIDE_INT > 32
> +		    ? (HOST_WIDE_INT) args_size << 32 : 0) + allocate;

Cleaner to split to the shift in two.

Ok with those changes.


r~
Joern Rennecke - Nov. 8, 2010, 5:11 p.m.
Quoting Richard Henderson <rth@redhat.com>:

> On 11/08/2010 01:57 AM, Joern Rennecke wrote:
>> +	  gcc_assert ((allocate & (HOST_WIDE_INT) 0xffffffff) == allocate);
>> +	  gcc_assert (((HOST_WIDE_INT) args_size & (HOST_WIDE_INT) 0xffffffff)
>>  		      == (HOST_WIDE_INT) args_size);
>
> Please just promote args_size to HOST_WIDE_INT.

It already is - this has no effect because HOST_WIDE_INT is just a 32  
bit long.
Or do you mean unsigned HOST_WIDE_INT?

>
>> +	  argval = (HOST_BITS_PER_WIDE_INT > 32
>> +		    ? (HOST_WIDE_INT) args_size << 32 : 0) + allocate;
>
> Cleaner to split to the shift in two.

Like this?
argval = ((HOST_WIDE_INT) args_size << 16) << 16) + allocate;
Richard Henderson - Nov. 8, 2010, 5:14 p.m.
On 11/08/2010 09:11 AM, Joern Rennecke wrote:
> Quoting Richard Henderson <rth@redhat.com>:
> 
>> On 11/08/2010 01:57 AM, Joern Rennecke wrote:
>>> +      gcc_assert ((allocate & (HOST_WIDE_INT) 0xffffffff) == allocate);
>>> +      gcc_assert (((HOST_WIDE_INT) args_size & (HOST_WIDE_INT) 0xffffffff)
>>>                == (HOST_WIDE_INT) args_size);
>>
>> Please just promote args_size to HOST_WIDE_INT.
> 
> It already is - this has no effect because HOST_WIDE_INT is just a 32 bit long.

I don't see that in my tree.

ix86_expand_split_stack_prologue (void)
{
  struct ix86_frame frame;
  HOST_WIDE_INT allocate;
  int args_size;

  ^^^

> Like this?
> argval = ((HOST_WIDE_INT) args_size << 16) << 16) + allocate;

Yes, thanks.


r~
Ian Taylor - Nov. 8, 2010, 5:20 p.m.
Joern Rennecke <amylaar@spamcop.net> writes:

> Currently bootstrapping on i686-pc-linux-gnu.
> 2010-11-08  Joern Rennecke  <amylaar@spamcop.net>
>
> 	PR bootstrap/46358
> 	* config/i386/i386.c (ix86_expand_split_stack_prologue):
> 	Avoid warnings when HOST_WIDE_INT is 32 bit.

Thanks, sorry about that.

Ian
Joern Rennecke - Nov. 8, 2010, 5:23 p.m.
Quoting Richard Henderson <rth@redhat.com>:

> I don't see that in my tree.

I mean the current version in svn already casts it to HOST_WIDE_INT.
Richard Henderson - Nov. 8, 2010, 6:11 p.m.
On 11/08/2010 09:23 AM, amylaar@spamcop.net wrote:
> Quoting Richard Henderson <rth@redhat.com>:
> 
>> I don't see that in my tree.
> 
> I mean the current version in svn already casts it to HOST_WIDE_INT.

I mean that you should change the type of the variable instead
of casting it nearly every place it gets used.


r~

Patch

Index: config/i386/i386.c
===================================================================
--- config/i386/i386.c	(revision 166429)
+++ config/i386/i386.c	(working copy)
@@ -11171,8 +11171,8 @@  ix86_expand_split_stack_prologue (void)
 	     different function: __morestack_large.  We pass the
 	     argument size in the upper 32 bits of r10 and pass the
 	     frame size in the lower 32 bits.  */
-	  gcc_assert ((allocate & 0xffffffff) == allocate);
-	  gcc_assert (((HOST_WIDE_INT) args_size & 0xffffffff)
+	  gcc_assert ((allocate & (HOST_WIDE_INT) 0xffffffff) == allocate);
+	  gcc_assert (((HOST_WIDE_INT) args_size & (HOST_WIDE_INT) 0xffffffff)
 		      == (HOST_WIDE_INT) args_size);
 
 	  if (split_stack_fn_large == NULL_RTX)
@@ -11202,7 +11202,8 @@  ix86_expand_split_stack_prologue (void)
 
 	  fn = reg11;
 
-	  argval = ((HOST_WIDE_INT) args_size << 32) + allocate;
+	  argval = (HOST_BITS_PER_WIDE_INT > 32
+		    ? (HOST_WIDE_INT) args_size << 32 : 0) + allocate;
 	  emit_move_insn (reg10, GEN_INT (argval));
 	}
       else