Re: libgo patch committed: Add timeout for tests

2011-04-01 Thread Rainer Orth
Ian Lance Taylor  writes:

> This patch to libgo adds a timeout for the libgo tests.  The default is
> 60 seconds.  It can be changed by an argument to gotest, which would
> normally be used as, e.g.,
>   make GOTESTFLAGS="--timeout=120" check-target-libgo

Great, thanks.

Shouldn't the default match the DejaGnu default of 300, though?

Rainer

-- 
-
Rainer Orth, Center for Biotechnology, Bielefeld University


[wwwdocs]

2011-04-01 Thread Devang S
Found a bug on the cvs.html web page. How to start the web page patching
I followed the instruction on the http://gcc.gnu.org/cvs.html page,
downloaded the wwwdocs via cvs, validated the web page to be updated.
Now I want to commit the changes to the repo. But for that I need
write access(obviously). Please let me know what I need to do to
commit the changes. Or please can someone do that on my behalf? I can
let you know the details to be made.


Changelog:

Index: wwwdocs/htdocs/cvs.html
===
RCS file: /cvs/gcc/wwwdocs/htdocs/cvs.html,v
retrieving revision 1.219
diff -u -3 -r1.219 cvs.html
--- wwwdocs/htdocs/cvs.html    8 Jan 2011 16:50:20 -    1.219
+++ wwwdocs/htdocs/cvs.html    1 Apr 2011 07:01:58 -
@@ -1,5 +1,6 @@
 

+
 
 
 
@@ -21,7 +22,7 @@

 
  Set CVS_RSH in your environment to ssh.
- cvs -qz -d :ext:username@gcc.gnu.org:/cvs/gcc checkout
+ cvs -qz 0 -d :ext:username@gcc.gnu.org:/cvs/gcc checkout
 -P wwwdocs where username is your user name at gcc.gnu.org
 

===



--
Cheers,
Devang S
http://celeritas9.wordpress.com


Re: [wwwdocs]

2011-04-01 Thread Devang S
Background/Test:

The cvs command  needs to know the compression level while using
the -z option. Hence we need to provide compression level for network
traffic ranging from 0 to 9. 0 for default. This value for -z command
is not mentioned in the 2nd step. Hence it gives error.

On Fri, Apr 1, 2011 at 12:47 PM, Devang S  wrote:
>
> Found a bug on the cvs.html web page. How to start the web page patching
> I followed the instruction on the http://gcc.gnu.org/cvs.html page,
> downloaded the wwwdocs via cvs, validated the web page to be updated.
> Now I want to commit the changes to the repo. But for that I need
> write access(obviously). Please let me know what I need to do to
> commit the changes. Or please can someone do that on my behalf? I can
> let you know the details to be made.
>
>
> Changelog:
>
> Index: wwwdocs/htdocs/cvs.html
> ===
> RCS file: /cvs/gcc/wwwdocs/htdocs/cvs.html,v
> retrieving revision 1.219
> diff -u -3 -r1.219 cvs.html
> --- wwwdocs/htdocs/cvs.html    8 Jan 2011 16:50:20 -    1.219
> +++ wwwdocs/htdocs/cvs.html    1 Apr 2011 07:01:58 -
> @@ -1,5 +1,6 @@
>  
>
> +
>  
>  
>  
> @@ -21,7 +22,7 @@
>
>  
>   Set CVS_RSH in your environment to ssh.
> - cvs -qz -d :ext:username@gcc.gnu.org:/cvs/gcc checkout
> + cvs -qz 0 -d :ext:username@gcc.gnu.org:/cvs/gcc checkout
>  -P wwwdocs where username is your user name at gcc.gnu.org
>  
>
> ===
>
>
>
> --
> Cheers,
> Devang S
> http://celeritas9.wordpress.com



--
Thanks,
Devang S
http://celeritas9.wordpress.com


Re: [libgo] Account for 32-bit fds_bits on Solaris 2

2011-04-01 Thread Rainer Orth
Ian Lance Taylor  writes:

> Thanks.  I'm going to try gambling that every uses the type "long" for
> the fds_bits array.  If so, I think this patch will work.  Bootstrapped
> and ran Go testsuite on x86_64-unknown-linux-gnu (forcing the use of
> select).  Committed to mainline.

I fear you lost ;-)

* On Solaris, it's always long (i.e. either 32 or 64-bit).

* On IRIX 6.5, it's long for 32-bit and int for 64-bit (i.e. always
  32-bit), while 64-bit long is 64-bit.

* On Tru64 UNIX V5.1, it's always int (i.e. 32-bit), while long is
  64-bit.

This has to be system-dependent, I fear.

Rainer

-- 
-
Rainer Orth, Center for Biotechnology, Bielefeld University


Re: [3/3] Record the number of generator arguments in insn_data

2011-04-01 Thread Richard Sandiford
Richard Henderson  writes:
> On 03/31/2011 01:09 PM, Richard Sandiford wrote:
>>> I think the assert should be retained (for now) as
>>>
>>>   gcc_assert (nops == 4 || nops == 6);
>>>
>>> at least until we add such verification to some genfoo.
>> 
>> After the patch we have:
>> 
>>   gcc_assert (nops == (unsigned int) insn_data[(int) 
>> icode].n_generator_args);
>> 
>> in maybe_gen_insn, which should catch this.  Just to check: do you want
>> the assertion here anyway?
>
> Well, it won't because we initialized nops *with .n_generator_args.
>
> If nops was initialized with
>
>   nops = 4;
>   create the first 4 args
>
>   if (.n_generator_args == 6)
> {
>   nops = 6;
>   create the last two args
> }
>
> then the assert you mention *would* do the trick.

Ah, yeah.  You're right of course.  Here's what I installed.

Richard


gcc/
* expr.c (emit_block_move_via_movmem): Use n_generator_args
instead of n_operands.
(set_storage_via_setmem): Likewise.
* optabs.c (maybe_gen_insn): Likewise.
* config/arm/arm.c (arm_init_neon_builtins): Likewise.
* config/mips/mips.c (mips_expand_builtin_compare_1): Likewise.
(mips_expand_builtin_direct): Likewise.
* config/spu/spu.c (expand_builtin_args): Likewise.

Index: gcc/expr.c
===
--- gcc/expr.c  2011-04-01 08:43:30.0 +0100
+++ gcc/expr.c  2011-04-01 08:44:22.0 +0100
@@ -1293,11 +1293,8 @@ emit_block_move_via_movmem (rtx x, rtx y
 nice if there were some way to inform the backend, so
 that it doesn't fail the expansion because it thinks
 emitting the libcall would be more efficient.  */
- nops = insn_data[(int) code].n_operands;
- /* ??? n_operands includes match_scratches; find some other
-way to select the 6 operand variant, or force all targets
-to have exactly 6 operands.  */
- gcc_assert (nops >= 4 && nops <= 6);
+ nops = insn_data[(int) code].n_generator_args;
+ gcc_assert (nops == 4 || nops == 6);
 
  create_fixed_operand (&ops[0], x);
  create_fixed_operand (&ops[1], y);
@@ -2719,11 +2716,8 @@ set_storage_via_setmem (rtx object, rtx 
  struct expand_operand ops[6];
  unsigned int nops;
 
- nops = insn_data[(int) code].n_operands;
- /* ??? n_operands includes match_scratches; find some other
-way to select the 6 operand variant, or force all targets
-to have exactly 6 operands.  */
- gcc_assert (nops >= 4 && nops <= 6);
+ nops = insn_data[(int) code].n_generator_args;
+ gcc_assert (nops == 4 || nops == 6);
 
  create_fixed_operand (&ops[0], object);
  /* The check above guarantees that this size conversion is valid.  */
Index: gcc/optabs.c
===
--- gcc/optabs.c2011-04-01 08:43:30.0 +0100
+++ gcc/optabs.c2011-04-01 08:43:32.0 +0100
@@ -7149,9 +7149,7 @@ maybe_legitimize_operands (enum insn_cod
 maybe_gen_insn (enum insn_code icode, unsigned int nops,
struct expand_operand *ops)
 {
-  /* n_operands includes any automatically-generated match_scratches,
- so we can't check for equality here.  */
-  gcc_assert (nops <= (unsigned int) insn_data[(int) icode].n_operands);
+  gcc_assert (nops == (unsigned int) insn_data[(int) icode].n_generator_args);
   if (!maybe_legitimize_operands (icode, 0, nops, ops))
 return NULL_RTX;
 
Index: gcc/config/arm/arm.c
===
--- gcc/config/arm/arm.c2011-04-01 08:43:30.0 +0100
+++ gcc/config/arm/arm.c2011-04-01 08:43:32.0 +0100
@@ -18944,7 +18944,7 @@ arm_init_neon_builtins (void)
/* Build a function type directly from the insn_data for this
   builtin.  The build_function_type() function takes care of
   removing duplicates for us.  */
-   for (k = insn_data[icode].n_operands - 1; k >= 0; k--)
+   for (k = insn_data[icode].n_generator_args - 1; k >= 0; k--)
  {
tree eltype;
 
Index: gcc/config/mips/mips.c
===
--- gcc/config/mips/mips.c  2011-04-01 08:43:30.0 +0100
+++ gcc/config/mips/mips.c  2011-04-01 08:43:32.0 +0100
@@ -13252,7 +13252,7 @@ mips_expand_builtin_compare_1 (enum insn
 
   /* The instruction should have a target operand, an operand for each
  argument, and an operand for COND.  */
-  gcc_assert (nargs + 2 == insn_data[(int) icode].n_operands);
+  gcc_assert (nargs + 2 == insn_data[(int) icode].n_generator_args);
 
   opno = 0;
   create_output_operand (&ops[opno++], NULL_RTX,
@@ -13280,11 +13280,9 @@ mips_expand_builtin_direct (enum insn_co
   if (has_targ

Re: [PATCH] Fix expansion issues on type changing MEM_REFs on LHS (PR middle-end/48335)

2011-04-01 Thread Eric Botcazou
> --- gcc/expr.c.jj 2011-03-23 17:15:55.0 +0100
> +++ gcc/expr.c2011-03-30 11:38:15.0 +0200
> @@ -4278,16 +4278,47 @@ expand_assignment (tree to, tree from, b
>/* Handle expand_expr of a complex value returning a CONCAT.  */
>else if (GET_CODE (to_rtx) == CONCAT)
>   {
> -   if (COMPLEX_MODE_P (TYPE_MODE (TREE_TYPE (from
> +   unsigned short mode_bitsize = GET_MODE_BITSIZE (GET_MODE (to_rtx));
> +   if (COMPLEX_MODE_P (TYPE_MODE (TREE_TYPE (from)))
> +   && bitpos == 0
> +   && bitsize == mode_bitsize)
> + result = store_expr (from, to_rtx, false, nontemporal);
> +   else if (bitsize == mode_bitsize / 2
> +&& (bitpos == 0 || bitpos == GET_MODE_BITSIZE (mode1)))
> + result = store_expr (from, XEXP (to_rtx, bitpos != 0), false,
> +  nontemporal);

Why GET_MODE_BITSIZE (mode1) and not mode_bitsize / 2 here?

>   {
> -   gcc_assert (bitpos == 0 || bitpos == GET_MODE_BITSIZE (mode1));
> -   result = store_expr (from, XEXP (to_rtx, bitpos != 0), false,
> -nontemporal);
> +   rtx temp = assign_stack_temp (GET_MODE (to_rtx),
> + GET_MODE_SIZE (GET_MODE (to_rtx)),
> + 0);
> +   write_complex_part (temp, XEXP (to_rtx, 0), false);
> +   write_complex_part (temp, XEXP (to_rtx, 1), true);
> +   result = store_field (temp, bitsize, bitpos, mode1, from,
> + TREE_TYPE (tem), get_alias_set (to),
> + nontemporal);
> +   emit_move_insn (XEXP (to_rtx, 0), read_complex_part (temp, 
> false));
> +   emit_move_insn (XEXP (to_rtx, 1), read_complex_part (temp, true));
>   }

Can't you add result = NULL at the end of the block?

> : (! SLOW_UNALIGNED_ACCESS (fieldmode, MEM_ALIGN (op0))
> :
>|| (offset * BITS_PER_UNIT % bitsize == 0
>
> -  && MEM_ALIGN (op0) % GET_MODE_BITSIZE (fieldmode) == 0
> +  && MEM_ALIGN (op0) % GET_MODE_BITSIZE (fieldmode) == 0)))
> +  && (MEM_P (op0)
> +   || GET_MODE (op0) == fieldmode
> +   || validate_subreg (fieldmode, GET_MODE (op0), op0, byte_offset)))

This partially duplicates the existing test.  Can't the new code be retrofitted 
into the existing test?

> @@ -1045,22 +1052,32 @@ store_split_bit_field (rtx op0, unsigned
>if (GET_CODE (op0) == SUBREG)
>   {
> int word_offset = (SUBREG_BYTE (op0) / UNITS_PER_WORD) + offset;
> -   word = operand_subword_force (SUBREG_REG (op0), word_offset,
> - GET_MODE (SUBREG_REG (op0)));
> +   enum machine_mode sub_mode = GET_MODE (SUBREG_REG (op0));
> +   if (sub_mode != BLKmode && GET_MODE_SIZE (sub_mode) < UNITS_PER_WORD)
> + word = word_offset ? const0_rtx : op0;
> +   else
> + word = operand_subword_force (SUBREG_REG (op0), word_offset,
> +   GET_MODE (SUBREG_REG (op0)));
> offset = 0;
>   }
>else if (REG_P (op0))
>   {
> -   word = operand_subword_force (op0, offset, GET_MODE (op0));
> +   enum machine_mode op0_mode = GET_MODE (op0);
> +   if (op0_mode != BLKmode && GET_MODE_SIZE (op0_mode) < UNITS_PER_WORD)
> + word = offset ? const0_rtx : op0;
> +   else
> + word = operand_subword_force (op0, offset, GET_MODE (op0));
> offset = 0;
>   }
>else
>   word = op0;
>
>/* OFFSET is in UNITs, and UNIT is in bits.
> - store_fixed_bit_field wants offset in bytes.  */
> -  store_fixed_bit_field (word, offset * unit / BITS_PER_UNIT,
> thissize, -thispos, part);
> +  store_fixed_bit_field wants offset in bytes.  If WORD is const0_rtx,
> +  it is jut an out of bounds access.  Ignore it.  */
> +  if (word != const0_rtx)
> + store_fixed_bit_field (word, offset * unit / BITS_PER_UNIT, thissize,
> +thispos, part);
>bitsdone += thissize;

"it is just an out-of-bounds access."

-- 
Eric Botcazou


Re: [PATCH] Fix expansion issues on type changing MEM_REFs on LHS (PR middle-end/48335)

2011-04-01 Thread Jakub Jelinek
On Fri, Apr 01, 2011 at 12:52:04PM +0200, Eric Botcazou wrote:
> > --- gcc/expr.c.jj   2011-03-23 17:15:55.0 +0100
> > +++ gcc/expr.c  2011-03-30 11:38:15.0 +0200
> > @@ -4278,16 +4278,47 @@ expand_assignment (tree to, tree from, b
> >/* Handle expand_expr of a complex value returning a CONCAT.  */
> >else if (GET_CODE (to_rtx) == CONCAT)
> > {
> > - if (COMPLEX_MODE_P (TYPE_MODE (TREE_TYPE (from
> > + unsigned short mode_bitsize = GET_MODE_BITSIZE (GET_MODE (to_rtx));
> > + if (COMPLEX_MODE_P (TYPE_MODE (TREE_TYPE (from)))
> > + && bitpos == 0
> > + && bitsize == mode_bitsize)
> > +   result = store_expr (from, to_rtx, false, nontemporal);
> > + else if (bitsize == mode_bitsize / 2
> > +  && (bitpos == 0 || bitpos == GET_MODE_BITSIZE (mode1)))
> > +   result = store_expr (from, XEXP (to_rtx, bitpos != 0), false,
> > +nontemporal);
> 
> Why GET_MODE_BITSIZE (mode1) and not mode_bitsize / 2 here?

It should be mode_bitsize / 2 yeah, GET_MODE_BITSIZE (mode1) just came
from the original code.  Will change.

> > {
> > - gcc_assert (bitpos == 0 || bitpos == GET_MODE_BITSIZE (mode1));
> > - result = store_expr (from, XEXP (to_rtx, bitpos != 0), false,
> > -  nontemporal);
> > + rtx temp = assign_stack_temp (GET_MODE (to_rtx),
> > +   GET_MODE_SIZE (GET_MODE (to_rtx)),
> > +   0);
> > + write_complex_part (temp, XEXP (to_rtx, 0), false);
> > + write_complex_part (temp, XEXP (to_rtx, 1), true);
> > + result = store_field (temp, bitsize, bitpos, mode1, from,
> > +   TREE_TYPE (tem), get_alias_set (to),
> > +   nontemporal);
> > + emit_move_insn (XEXP (to_rtx, 0), read_complex_part (temp, 
> > false));
> > + emit_move_insn (XEXP (to_rtx, 1), read_complex_part (temp, true));
> > }
> 
> Can't you add result = NULL at the end of the block?

result is set there from store_field, and result is only used in
  if (result)
preserve_temp_slots (result);
afterwards.  store_field might want to preserve_temp_slots perhaps, so
clearing result afterwards might be wrong.

> >   : (! SLOW_UNALIGNED_ACCESS (fieldmode, MEM_ALIGN (op0))
> >   :
> >  || (offset * BITS_PER_UNIT % bitsize == 0
> >
> > -&& MEM_ALIGN (op0) % GET_MODE_BITSIZE (fieldmode) == 0
> > +&& MEM_ALIGN (op0) % GET_MODE_BITSIZE (fieldmode) == 0)))
> > +  && (MEM_P (op0)
> > + || GET_MODE (op0) == fieldmode
> > + || validate_subreg (fieldmode, GET_MODE (op0), op0, byte_offset)))
> 
> This partially duplicates the existing test.  Can't the new code be 
> retrofitted 
> into the existing test?

You mean just with the MEM_P test?  So something like:

@@ -418,8 +418,11 @@ store_bit_field_1 (rtx str_rtx, unsigned
   && bitsize == GET_MODE_BITSIZE (fieldmode)
   && (!MEM_P (op0)
  ? ((GET_MODE_SIZE (fieldmode) >= UNITS_PER_WORD
-|| GET_MODE_SIZE (GET_MODE (op0)) == GET_MODE_SIZE (fieldmode))
-&& byte_offset % GET_MODE_SIZE (fieldmode) == 0)
+ || GET_MODE_SIZE (GET_MODE (op0)) == GET_MODE_SIZE (fieldmode))
+&& byte_offset % GET_MODE_SIZE (fieldmode) == 0
+&& (GET_MODE (op0) == fieldmode
+|| validate_subreg (fieldmode, GET_MODE (op0), op0,
+byte_offset)))
  : (! SLOW_UNALIGNED_ACCESS (fieldmode, MEM_ALIGN (op0))
 || (offset * BITS_PER_UNIT % bitsize == 0
 && MEM_ALIGN (op0) % GET_MODE_BITSIZE (fieldmode) == 0

instead?

> >/* OFFSET is in UNITs, and UNIT is in bits.
> > - store_fixed_bit_field wants offset in bytes.  */
> > -  store_fixed_bit_field (word, offset * unit / BITS_PER_UNIT,
> > thissize, -  thispos, part);
> > +store_fixed_bit_field wants offset in bytes.  If WORD is const0_rtx,
> > +it is jut an out of bounds access.  Ignore it.  */
> > +  if (word != const0_rtx)
> > +   store_fixed_bit_field (word, offset * unit / BITS_PER_UNIT, thissize,
> > +  thispos, part);
> >bitsdone += thissize;
> 
> "it is just an out-of-bounds access."

Ok, will change, thanks.

Jakub


Re: [PATCH] Fix expansion issues on type changing MEM_REFs on LHS (PR middle-end/48335)

2011-04-01 Thread Jakub Jelinek
Hi!

Here is the updated patch, without the result = NULL addition but
instead with remembering result also from the only case which was
clearing result.  out-of-bounds changed also in the ChangeLog entry.

2011-04-01  Jakub Jelinek  

PR middle-end/48335
* expr.c (expand_assignment): Handle all possibilities
if TO_RTX is CONCAT.
* expmed.c (store_bit_field_1): Avoid trying to create
invalid SUBREGs.
(store_split_bit_field): If SUBREG_REG (op0) or
op0 itself has smaller mode than word, return it
for offset 0 and const0_rtx for out-of-bounds stores.
If word is const0_rtx, skip it.

* gcc.c-torture/compile/pr48335-1.c: New test.
* gcc.dg/pr48335-1.c: New test.
* gcc.dg/pr48335-2.c: New test.
* gcc.dg/pr48335-3.c: New test.
* gcc.dg/pr48335-4.c: New test.
* gcc.dg/pr48335-5.c: New test.
* gcc.dg/pr48335-6.c: New test.
* gcc.dg/pr48335-7.c: New test.
* gcc.dg/pr48335-8.c: New test.
* gcc.target/i386/pr48335-1.c: New test.

--- gcc/expr.c.jj   2011-04-01 13:35:51.113644464 +0200
+++ gcc/expr.c  2011-04-01 13:41:36.585402545 +0200
@@ -4280,16 +4280,47 @@ expand_assignment (tree to, tree from, b
   /* Handle expand_expr of a complex value returning a CONCAT.  */
   else if (GET_CODE (to_rtx) == CONCAT)
{
- if (COMPLEX_MODE_P (TYPE_MODE (TREE_TYPE (from
+ unsigned short mode_bitsize = GET_MODE_BITSIZE (GET_MODE (to_rtx));
+ if (COMPLEX_MODE_P (TYPE_MODE (TREE_TYPE (from)))
+ && bitpos == 0
+ && bitsize == mode_bitsize)
+   result = store_expr (from, to_rtx, false, nontemporal);
+ else if (bitsize == mode_bitsize / 2
+  && (bitpos == 0 || bitpos == mode_bitsize / 2))
+   result = store_expr (from, XEXP (to_rtx, bitpos != 0), false,
+nontemporal);
+ else if (bitpos + bitsize <= mode_bitsize / 2)
+   result = store_field (XEXP (to_rtx, 0), bitsize, bitpos,
+ mode1, from, TREE_TYPE (tem),
+ get_alias_set (to), nontemporal);
+ else if (bitpos >= mode_bitsize / 2)
+   result = store_field (XEXP (to_rtx, 1), bitsize,
+ bitpos - mode_bitsize / 2, mode1, from,
+ TREE_TYPE (tem), get_alias_set (to),
+ nontemporal);
+ else if (bitpos == 0 && bitsize == mode_bitsize)
{
- gcc_assert (bitpos == 0);
- result = store_expr (from, to_rtx, false, nontemporal);
+ rtx from_rtx;
+ result = expand_normal (from);
+ from_rtx = simplify_gen_subreg (GET_MODE (to_rtx), result,
+ TYPE_MODE (TREE_TYPE (from)), 0);
+ emit_move_insn (XEXP (to_rtx, 0),
+ read_complex_part (from_rtx, false));
+ emit_move_insn (XEXP (to_rtx, 1),
+ read_complex_part (from_rtx, true));
}
  else
{
- gcc_assert (bitpos == 0 || bitpos == GET_MODE_BITSIZE (mode1));
- result = store_expr (from, XEXP (to_rtx, bitpos != 0), false,
-  nontemporal);
+ rtx temp = assign_stack_temp (GET_MODE (to_rtx),
+   GET_MODE_SIZE (GET_MODE (to_rtx)),
+   0);
+ write_complex_part (temp, XEXP (to_rtx, 0), false);
+ write_complex_part (temp, XEXP (to_rtx, 1), true);
+ result = store_field (temp, bitsize, bitpos, mode1, from,
+   TREE_TYPE (tem), get_alias_set (to),
+   nontemporal);
+ emit_move_insn (XEXP (to_rtx, 0), read_complex_part (temp, 
false));
+ emit_move_insn (XEXP (to_rtx, 1), read_complex_part (temp, true));
}
}
   else
--- gcc/expmed.c.jj 2011-04-01 13:35:51.153501638 +0200
+++ gcc/expmed.c2011-04-01 13:42:34.703671186 +0200
@@ -418,8 +418,11 @@ store_bit_field_1 (rtx str_rtx, unsigned
   && bitsize == GET_MODE_BITSIZE (fieldmode)
   && (!MEM_P (op0)
  ? ((GET_MODE_SIZE (fieldmode) >= UNITS_PER_WORD
-|| GET_MODE_SIZE (GET_MODE (op0)) == GET_MODE_SIZE (fieldmode))
-&& byte_offset % GET_MODE_SIZE (fieldmode) == 0)
+ || GET_MODE_SIZE (GET_MODE (op0)) == GET_MODE_SIZE (fieldmode))
+&& byte_offset % GET_MODE_SIZE (fieldmode) == 0
+&& (GET_MODE (op0) == fieldmode
+|| validate_subreg (fieldmode, GET_MODE (op0), op0,
+byte_offset)))
  : (! SLOW_UNALIGNED_ACCESS (fieldmode, MEM_ALIGN (op0))
 || (offset * BITS_PER_UNIT % bitsize ==

Re: [patch] c-decl.c(grokdeclarator) trivial formating fixes

2011-04-01 Thread Joseph S. Myers
This patch is OK.

-- 
Joseph S. Myers
jos...@codesourcery.com


More old target toplevel cleanup

2011-04-01 Thread Joseph S. Myers
This patch does some more toplevel configure cleanup related to targets no 
longer supported by GCC:

* The code to enable libgomp on hosted POSIX systems handled *-*-sysv4*; 
GCC no longer supports any such targets.

* The md_exec_prefix code covered lots of targets that either are no 
longer supported by GCC, or that no longer define MD_EXEC_PREFIX after my 
cleanups for 4.6; this is reduced to the set of targets that actually 
define this macro in current GCC (DJGPP, HP-UX, QNX, Solaris).  (In the 
VMS case, a different macro, STANDARD_EXEC_PREFIX, is defined - but it's 
"/gnu/libexec/gcc/" in xm-vms.h, not the value in this script.)

OK to commit?

2011-04-01  Joseph Myers  

* configure.ac (*-*-sysv4*): Don't enable libgomp.
(alpha*-*-*vms*, i[[34567]]86-*-sco3.2v5*, mn10300-*-*,
powerpc-*-chorusos*, powerpc*-*-eabi*, powerpc*-*-sysv*,
powerpc*-*-kaos*, s390x-ibm-tpf*, sparc64-*-elf*, v850*-*-*,
xtensa*-*-elf*, *-*-beos*, *-*-elf*, *-*-netware*, *-*-rtems*,
*-*-sysv[[45]]*, *-*-vxworks*, *-wrs-windiss): Remove
md_exec_prefix cases.
* configure: Regenerate.

Index: configure.ac
===
--- configure.ac(revision 171827)
+++ configure.ac(working copy)
@@ -506,7 +506,7 @@
;;
 *-*-netbsd* | *-*-freebsd* | *-*-openbsd* | *-*-dragonfly*)
;;
-*-*-solaris2* | *-*-sysv4* | *-*-irix6* | *-*-osf* | *-*-hpux11*)
+*-*-solaris2* | *-*-irix6* | *-*-osf* | *-*-hpux11*)
;;
 *-*-darwin* | *-*-aix*)
;;
@@ -2174,46 +2174,12 @@
 # the *-*-osname triplets last.
 md_exec_prefix=
 case "${target}" in
-  alpha*-*-*vms*)
-md_exec_prefix=/gnu/lib/gcc-lib
-;;
   i[[34567]]86-pc-msdosdjgpp*)
 md_exec_prefix=/dev/env/DJDIR/bin
 ;;
-  i[[34567]]86-*-sco3.2v5*)
-if test $with_gnu_as = yes; then
-  md_exec_prefix=/usr/gnu/bin
-else
-  md_exec_prefix=/usr/ccs/bin/elf
-fi
-;;
-
-  mn10300-*-* | \
-  powerpc-*-chorusos* | \
-  powerpc*-*-eabi* | \
-  powerpc*-*-sysv* | \
-  powerpc*-*-kaos* | \
-  s390x-ibm-tpf*)
-md_exec_prefix=/usr/ccs/bin
-;;
-  sparc64-*-elf*)
-;;
-  v850*-*-*)
-md_exec_prefix=/usr/ccs/bin
-;;
-  xtensa*-*-elf*)
-;;
-
-  *-*-beos* | \
-  *-*-elf* | \
   *-*-hpux* | \
-  *-*-netware* | \
   *-*-nto-qnx* | \
-  *-*-rtems* | \
-  *-*-solaris2* | \
-  *-*-sysv[[45]]* | \
-  *-*-vxworks* | \
-  *-wrs-windiss)
+  *-*-solaris2*)
 md_exec_prefix=/usr/ccs/bin
 ;;
 esac

-- 
Joseph S. Myers
jos...@codesourcery.com


Re: Remove old host cases from toplevel configure

2011-04-01 Thread Joseph S. Myers
On Fri, 25 Mar 2011, Paolo Bonzini wrote:

> On 03/24/2011 08:49 PM, Joseph S. Myers wrote:
> > Related to that point, I notice a piece of code starting "we might need to
> > use some other shell than /bin/sh for running subshells" that tries to
> > determine a shell on Windows hosts.  It's autoconf's job to find a
> > suitable shell, so if this code is still relevant I think there's
> > something missing in autoconf.
> 
> That code is dead because
> 
>   if test x${CONFIG_SHELL} = x ; then
> 
> will never be true.

OK to commit this patch to remove this code?

2011-04-01  Joseph Myers  

* configure.ac: Remove code setting CONFIG_SHELL, config_shell and
moveifchange.
* configure: Regenerate.
* Makefile.tpl: Use @SHELL@ not @config_shell@.
* Makefile.in: Regenerate.

Index: configure.ac
===
--- configure.ac(revision 171827)
+++ configure.ac(working copy)
@@ -89,42 +89,6 @@
 AC_PROG_SED
 AC_PROG_AWK
 
-### we might need to use some other shell than /bin/sh for running subshells
-### If we are on Windows, search for the shell.  This will permit people
-### to not have /bin/sh, but to be able to see /SOME/PATH/sh configure
-### without also having to set CONFIG_SHELL.  This code will work when
-### using bash, which sets OSTYPE.
-case "${OSTYPE}" in
-*win32*)
-  if test x${CONFIG_SHELL} = x ; then
-if test ! -f /bin/sh ; then
-  if test x${SHELL} != x && test -f ${SHELL} ; then
-   CONFIG_SHELL=${SHELL}
-   export CONFIG_SHELL
-  else
-   for prog in sh sh.exe bash bash.exe; do
- IFS="${IFS=   }"; save_ifs="$IFS"; IFS="${IFS}:"
- for dir in $PATH; do
-   test -z "$dir" && dir=.
-   if test -f $dir/$prog; then
- CONFIG_SHELL=$dir/$prog
- export CONFIG_SHELL
- break
-   fi
- done
- IFS="$save_ifs"
- test -n "${CONFIG_SHELL}" && break
-   done
-  fi
-fi
-  fi
-  ;;
-esac
-
-config_shell=${CONFIG_SHELL-/bin/sh}
-
-moveifchange=${srcdir}/move-if-change
-
 srcpwd=`cd ${srcdir} ; ${PWDCMD-pwd}`
 
 # We pass INSTALL explicitly to sub-makes.  Make sure that it is not
@@ -3019,7 +2983,6 @@
 AC_SUBST(RANLIB_FOR_BUILD)
 AC_SUBST(WINDMC_FOR_BUILD)
 AC_SUBST(WINDRES_FOR_BUILD)
-AC_SUBST(config_shell)
 
 # Generate default definitions for YACC, M4, LEX and other programs that run
 # on the build machine.  These are used if the Makefile can't locate these
Index: Makefile.tpl
===
--- Makefile.tpl(revision 171827)
+++ Makefile.tpl(working copy)
@@ -323,7 +323,7 @@
 # Programs producing files for the BUILD machine
 # --
 
-SHELL = @config_shell@
+SHELL = @SHELL@
 
 # pwd command to use.  Allow user to override default by setting PWDCMD in
 # the environment to account for automounters.  The make variable must not

-- 
Joseph S. Myers
jos...@codesourcery.com


Re: More old target toplevel cleanup

2011-04-01 Thread Paolo Bonzini

On 04/01/2011 02:34 PM, Joseph S. Myers wrote:

This patch does some more toplevel configure cleanup related to targets no
longer supported by GCC:

* The code to enable libgomp on hosted POSIX systems handled *-*-sysv4*;
GCC no longer supports any such targets.

* The md_exec_prefix code covered lots of targets that either are no
longer supported by GCC, or that no longer define MD_EXEC_PREFIX after my
cleanups for 4.6; this is reduced to the set of targets that actually
define this macro in current GCC (DJGPP, HP-UX, QNX, Solaris).  (In the
VMS case, a different macro, STANDARD_EXEC_PREFIX, is defined - but it's
"/gnu/libexec/gcc/" in xm-vms.h, not the value in this script.)

OK to commit?


Nice, thanks.

Paolo



Re: Remove old host cases from toplevel configure

2011-04-01 Thread Ralf Wildenhues
* Joseph S. Myers wrote on Fri, Apr 01, 2011 at 02:40:45PM CEST:
> OK to commit this patch to remove this code?

OK.

Thanks,
Ralf

> 2011-04-01  Joseph Myers  
> 
>   * configure.ac: Remove code setting CONFIG_SHELL, config_shell and
>   moveifchange.
>   * configure: Regenerate.
>   * Makefile.tpl: Use @SHELL@ not @config_shell@.
>   * Makefile.in: Regenerate.


Re: Cleaning up expand optabs code

2011-04-01 Thread Georg-Johann Lay
Richard Sandiford schrieb:
> Georg-Johann Lay  writes:
>> Richard Henderson schrieb:
>>> On 03/25/2011 05:41 AM, Georg-Johann Lay wrote:
> On 03/22/2011 06:48 PM, Richard Henderson wrote:
>
>> Ok.  Watch out for other target problems this week.
 libgcc fails to build for avr (SVN 171446)

 ../../../../../gcc.gnu.org/trunk/libgcc/../gcc/libgcc2.c: In function
 '__negdi2':
 ../../../../../gcc.gnu.org/trunk/libgcc/../gcc/libgcc2.c:68:17:
 internal compiler error: in maybe_gen_insn, at  optabs.c:7123
>>> This is due to a miscommunication between the middle-end and the backend
>>> about how many arguments the setmemhi pattern takes.
>>>
>>> (define_expand "setmemhi"
>>>   [(parallel [(set (match_operand:BLK 0 "memory_operand" "")
>>>(match_operand 2 "const_int_operand" ""))
>>>   (use (match_operand:HI 1 "const_int_operand" ""))
>>>   (use (match_operand:HI 3 "const_int_operand" "n"))
>>>   (clobber (match_scratch:HI 4 ""))
>>>   (clobber (match_dup 5))])]
>>>
>>> The match_scratch is counted in .n_operands, which makes the count of
>>> operands not equal 4, so we assume 6 operands are necessary.  We can
>>> fix this for the special case of avr by only assuming 6 operands when
>>> there are in fact 6 operands, but of course this could fail just as
>>> easily if there were two scratches.
>>>
>>> All of which suggests that optional arguments to a named optab is a
>>> mistake that ought to be rectified.
>>>
>>> I plan to commit the following after bootstrap and check.
>>>
>>>
>> Hi, there is still trouble with "setmemhi" on avr, again for the
>> negdi2 from libgcc:
>>
>> #1  0x0839ccd7 in maybe_legitimize_operand (icode=CODE_FOR_setmemhi,
>> opno=4, op=0xbfffd22c) at ../../../gcc.gnu.org/trunk/gcc/optabs.c:7024
>> (gdb) p *op
>> $11 = {type = EXPAND_OUTPUT, unsigned_p = 0, unused = 0, mode =
>> VOIDmode, value = 0xb7d63360}
>> (gdb) p op->value
>> $12 = (rtx) 0xb7d63360
>> (gdb) pr
>> (use:CC (nil))
>>
>>
>> i.e. there is garbage in op->value
>>
>> (gdb)
>> (gdb) frame 0
>> #0  fancy_abort (file=0x88099f0
>> "../../../gcc.gnu.org/trunk/gcc/optabs.c", line=7024,
>> function=0x880a280 "maybe_legitimize_operand") at
>> ../../../gcc.gnu.org/trunk/gcc/diagnostic.c:893
>> (gdb)
> 
> Yeah, as things stand, we need to set nops to 4 if was originally 5.
> 
> I'm testing a series of patches to make the number of generator
> arguments available in insn_data.  I'll post them once they pass
> (hopefully later today).
> 
> Richard

Thanks, I can build avr-gcc again.

Johann





[PATCH] macroize some rs6000 call patterns

2011-04-01 Thread Nathan Froyd
This patch does as $SUBJECT suggests.  It doesn't macroize all the call insns,
as iterators don't support substituting CONST_INTs, but it does clean up
quite a bit.

Tested on powerpc64-unknown-linux-gnu.  OK to commit?

-Nathan

* config/rs6000/rs6000.md (*call_local32): Rename to...
(*call_local): ...this and combine with...
(*call_local64): ...this using mode iterators.
(*call_value_local32, *call_value_local,
*call_value_local64): Likewise.
(*call_nonlocal_aix32, *call_nonlocal_aix):
(*call_nonlocal_aix64): Likewise.
(*call_value_nonlocal_aix32, *call_value_nonlocal_aix):
(*call_value_nonlocal_aix64): Likewise.
(*sibcall_local32, *sibcall_local, *sibcall_local64):
Likewise.
(*sibcall_value_local32, *sibcall_value_local):
(*sibcall_value_local64): Likewise.
(*sibcall_nonlocal_aix32, *sibcall_nonlocal_aix):
(*sibcall_nonlocal_aix64): Likewise.
(*sibcall_value_nonlocal_aix32, *sibcall_value_nonlocal_aix):
(*sibcall_value_nonlocal_aix64): Likewise.

diff --git a/gcc/config/rs6000/rs6000.md b/gcc/config/rs6000/rs6000.md
index 21287c9..ba6ca01 100644
--- a/gcc/config/rs6000/rs6000.md
+++ b/gcc/config/rs6000/rs6000.md
@@ -11907,8 +11907,8 @@
 ;; variable argument function.  It is > 0 if FP registers were passed
 ;; and < 0 if they were not.
 
-(define_insn "*call_local32"
-  [(call (mem:SI (match_operand:SI 0 "current_file_function_operand" "s,s"))
+(define_insn "*call_local"
+  [(call (mem:SI (match_operand:P 0 "current_file_function_operand" "s,s"))
 (match_operand 1 "" "g,g"))
(use (match_operand:SI 2 "immediate_operand" "O,n"))
(clobber (reg:SI LR_REGNO))]
@@ -11926,28 +11926,9 @@
   [(set_attr "type" "branch")
(set_attr "length" "4,8")])
 
-(define_insn "*call_local64"
-  [(call (mem:SI (match_operand:DI 0 "current_file_function_operand" "s,s"))
-(match_operand 1 "" "g,g"))
-   (use (match_operand:SI 2 "immediate_operand" "O,n"))
-   (clobber (reg:SI LR_REGNO))]
-  "TARGET_64BIT && (INTVAL (operands[2]) & CALL_LONG) == 0"
-  "*
-{
-  if (INTVAL (operands[2]) & CALL_V4_SET_FP_ARGS)
-output_asm_insn (\"crxor 6,6,6\", operands);
-
-  else if (INTVAL (operands[2]) & CALL_V4_CLEAR_FP_ARGS)
-output_asm_insn (\"creqv 6,6,6\", operands);
-
-  return (DEFAULT_ABI == ABI_V4 && flag_pic) ? \"bl %z0@local\" : \"bl %z0\";
-}"
-  [(set_attr "type" "branch")
-   (set_attr "length" "4,8")])
-
-(define_insn "*call_value_local32"
+(define_insn "*call_value_local"
   [(set (match_operand 0 "" "")
-   (call (mem:SI (match_operand:SI 1 "current_file_function_operand" 
"s,s"))
+   (call (mem:SI (match_operand:P 1 "current_file_function_operand" "s,s"))
  (match_operand 2 "" "g,g")))
(use (match_operand:SI 3 "immediate_operand" "O,n"))
(clobber (reg:SI LR_REGNO))]
@@ -11965,27 +11946,6 @@
   [(set_attr "type" "branch")
(set_attr "length" "4,8")])
 
-
-(define_insn "*call_value_local64"
-  [(set (match_operand 0 "" "")
-   (call (mem:SI (match_operand:DI 1 "current_file_function_operand" 
"s,s"))
- (match_operand 2 "" "g,g")))
-   (use (match_operand:SI 3 "immediate_operand" "O,n"))
-   (clobber (reg:SI LR_REGNO))]
-  "TARGET_64BIT && (INTVAL (operands[3]) & CALL_LONG) == 0"
-  "*
-{
-  if (INTVAL (operands[3]) & CALL_V4_SET_FP_ARGS)
-output_asm_insn (\"crxor 6,6,6\", operands);
-
-  else if (INTVAL (operands[3]) & CALL_V4_CLEAR_FP_ARGS)
-output_asm_insn (\"creqv 6,6,6\", operands);
-
-  return (DEFAULT_ABI == ABI_V4 && flag_pic) ? \"bl %z1@local\" : \"bl %z1\";
-}"
-  [(set_attr "type" "branch")
-   (set_attr "length" "4,8")])
-
 ;; Call to function which may be in another module.  Restore the TOC
 ;; pointer (r2) after the call unless this is System V.
 ;; Operand2 is nonzero if we are using the V.4 calling sequence and
@@ -12029,13 +11989,12 @@
   [(set_attr "type" "jmpreg")
(set_attr "length" "8")])
 
-(define_insn "*call_nonlocal_aix32"
-  [(call (mem:SI (match_operand:SI 0 "symbol_ref_operand" "s"))
+(define_insn "*call_nonlocal_aix"
+  [(call (mem:SI (match_operand:P 0 "symbol_ref_operand" "s"))
 (match_operand 1 "" "g"))
(use (match_operand:SI 2 "immediate_operand" "O"))
(clobber (reg:SI LR_REGNO))]
-  "TARGET_32BIT
-   && DEFAULT_ABI == ABI_AIX
+  "DEFAULT_ABI == ABI_AIX
&& (INTVAL (operands[2]) & CALL_LONG) == 0"
   "bl %z0\;%."
   [(set_attr "type" "branch")
@@ -12078,18 +12037,6 @@
   [(set_attr "type" "jmpreg")
(set_attr "length" "8")])
 
-(define_insn "*call_nonlocal_aix64"
-  [(call (mem:SI (match_operand:DI 0 "symbol_ref_operand" "s"))
-(match_operand 1 "" "g"))
-   (use (match_operand:SI 2 "immediate_operand" "O"))
-   (clobber (reg:SI LR_REGNO))]
-  "TARGET_64BIT
-   && DEFAULT_ABI == ABI_AIX
-   && (INTVAL (operands[2]) & CALL_LONG) == 0"
-  "bl %z0\;%."
-  [(set_attr "type" "branch")
-   (set_attr "length" "8")])
-
 (define_insn_and_split "*call_val

Re: [patch, fortran] Extend character optimization to LLE and friends

2011-04-01 Thread Jerry DeLisle

On 03/28/2011 11:50 AM, Thomas Koenig wrote:

Hello world,

the attached patch extends the character optimizations to the lexical comparison
functions (LLE and friends).

Regression-tested. OK for trunk?



Yes, this patch is OK?

Thanks,

Jerry


[patch][cprop.c] Allow splitting of critical edges to expose implicit sets

2011-04-01 Thread Steven Bosscher
Hi,

With this patch, it is OK for find_implicit_sets to split an edge if
that makes it possible to record an implicit set on that edge. This is
possible and cheap now because CPROP runs in cfglayout mode.

Bootstrapped and tested on x86_64-unknown-linux-gnu. Shaves off ~1kb
of cc1, which isn't very much but still kind of nice.
OK?

Ciao!
Steven
* cprop.c (implicit_set_cond_p): Assume nothing about COND, move
checks on form of COND from find_implicit_sets to here.
(find_implicit_sets): Cleanup control flow. Split critical edges
if it exposes implicit sets.  Allocate/resize implicit_sets as
necessary.
(one_cprop_pass): Only delete unreachable blocks if local_cprop_pass
changed something.  Run df_analyze after find_implicit_sets if any
edges were split.  Do not allocate implicit_sets here.

*** cprop.c.v4  2011-03-31 23:40:16.0 +0200
--- cprop.c 2011-04-01 13:22:34.0 +0200
*** fis_get_condition (rtx jump)
*** 1343,1356 
return get_condition (jump, NULL, false, true);
  }
  
! /* Check the comparison COND to see if we can safely form an implicit set from
!it.  COND is either an EQ or NE comparison.  */
  
  static bool
  implicit_set_cond_p (const_rtx cond)
  {
!   const enum machine_mode mode = GET_MODE (XEXP (cond, 0));
!   const_rtx cst = XEXP (cond, 1);
  
/* We can't perform this optimization if either operand might be or might
   contain a signed zero.  */
--- 1343,1369 
return get_condition (jump, NULL, false, true);
  }
  
! /* Check the comparison COND to see if we can safely form an implicit
!set from it.  */
  
  static bool
  implicit_set_cond_p (const_rtx cond)
  {
!   enum machine_mode mode;
!   rtx cst;
! 
!   /* COND must be either an EQ or NE comparison.  */
!   if (GET_CODE (cond) != EQ && GET_CODE (cond) != NE)
! return false;
! 
!   /* The first operand of COND must be a pseudo-reg.  */
!   if (! REG_P (XEXP (cond, 0))
!   || HARD_REGISTER_P (XEXP (cond, 0)))
! return false;
! 
!   /* The second operand of COND must be a suitable constant.  */
!   mode = GET_MODE (XEXP (cond, 0));
!   cst = XEXP (cond, 1);
  
/* We can't perform this optimization if either operand might be or might
   contain a signed zero.  */
*** implicit_set_cond_p (const_rtx cond)
*** 1382,1436 
 function records the set patterns that are implicit at the start of each
 basic block.
  
!FIXME: This would be more effective if critical edges are pre-split.  As
! it is now, we can't record implicit sets for blocks that have
! critical successor edges.  This results in missed optimizations
! and in more (unnecessary) work in cfgcleanup.c:thread_jump().  */
  
! static void
  find_implicit_sets (void)
  {
basic_block bb, dest;
-   unsigned int count;
rtx cond, new_rtx;
  
-   count = 0;
FOR_EACH_BB (bb)
! /* Check for more than one successor.  */
! if (EDGE_COUNT (bb->succs) > 1)
!   {
!   cond = fis_get_condition (BB_END (bb));
  
!   if (cond
!   && (GET_CODE (cond) == EQ || GET_CODE (cond) == NE)
!   && REG_P (XEXP (cond, 0))
!   && REGNO (XEXP (cond, 0)) >= FIRST_PSEUDO_REGISTER
!   && implicit_set_cond_p (cond))
! {
!   dest = GET_CODE (cond) == EQ ? BRANCH_EDGE (bb)->dest
!: FALLTHRU_EDGE (bb)->dest;
! 
!   if (dest
!   /* Record nothing for a critical edge.  */
!   && single_pred_p (dest)
!   && dest != EXIT_BLOCK_PTR)
! {
!   new_rtx = gen_rtx_SET (VOIDmode, XEXP (cond, 0),
!XEXP (cond, 1));
!   implicit_sets[dest->index] = new_rtx;
!   if (dump_file)
! {
!   fprintf(dump_file, "Implicit set of reg %d in ",
!   REGNO (XEXP (cond, 0)));
!   fprintf(dump_file, "basic block %d\n", dest->index);
! }
!   count++;
! }
! }
}
  
if (dump_file)
  fprintf (dump_file, "Found %d implicit sets\n", count);
  }
  
  /* Bypass conditional jumps.  */
--- 1395,1472 
 function records the set patterns that are implicit at the start of each
 basic block.
  
!If an implicit set is found but the set is implicit on a critical edge,
!this critical edge is split.
! 
!Return true if the CFG was modified, false otherwise.  */
  
! static bool
  find_implicit_sets (void)
  {
basic_block bb, dest;
rtx cond, new_rtx;
+   unsigned int count = 0;
+   bool edges_split = false;
+   size_t implicit_sets_size = last_basic_block + 10;
+ 
+   implicit_sets = XCNEWVEC (rtx, implicit_sets_size);
  
FOR_EACH_BB (bb)
! {
!   /* Check for more than one successor.  */
!   if (! EDGE_COUNT (bb->succs) > 1)
!   continue;
! 
! 

Re: [patch, fortran] Extend character optimization to LLE and friends

2011-04-01 Thread Jerry DeLisle

On 04/01/2011 06:29 AM, Jerry DeLisle wrote:

On 03/28/2011 11:50 AM, Thomas Koenig wrote:

Hello world,

the attached patch extends the character optimizations to the lexical comparison
functions (LLE and friends).

Regression-tested. OK for trunk?



Yes, this patch is OK?


Fat fingers, s/?/./

No question.

Jerry


Re: libgo patch committed: Add timeout for tests

2011-04-01 Thread Ian Lance Taylor
Rainer Orth  writes:

> Ian Lance Taylor  writes:
>
>> This patch to libgo adds a timeout for the libgo tests.  The default is
>> 60 seconds.  It can be changed by an argument to gotest, which would
>> normally be used as, e.g.,
>>   make GOTESTFLAGS="--timeout=120" check-target-libgo
>
> Great, thanks.
>
> Shouldn't the default match the DejaGnu default of 300, though?

Sure, it could, but why?  If any of these tests fail to complete in a
minute, something is badly wrong.

Ian


Re: libgo patch committed: Add timeout for tests

2011-04-01 Thread Rainer Orth
Ian Lance Taylor  writes:

>> Shouldn't the default match the DejaGnu default of 300, though?
>
> Sure, it could, but why?  If any of these tests fail to complete in a
> minute, something is badly wrong.

Ok, I'll see how long they take on my 250 MHz R10k MIPS :-)

Rainer

-- 
-
Rainer Orth, Center for Biotechnology, Bielefeld University


Re: [patch mingw]: Enable optional thread-model posix for mingw-targets

2011-04-01 Thread Kai Tietz
2011/3/31 Ralf Wildenhues :
> * Kai Tietz wrote on Thu, Mar 31, 2011 at 12:19:51PM CEST:
>> --- gcc.orig/gcc/config.gcc   2011-03-23 21:15:32.0 +0100
>> +++ gcc/gcc/config.gcc        2011-03-31 10:50:05.559129000 +0200
>
>> @@ -1420,6 +1420,10 @@ i[34567]86-*-mingw* | x86_64-*-mingw*)
>>               *)
>>                       ;;
>>       esac
>> +     if test x$enable_threads = xposix ; then
>> +             tm_file="${tm_file} i386/mingw-pthread.h"
>> +     fi
>> +     tm_file="${tm_file} i386/mingw32.h"
>>       # This makes the logic if mingw's or the w64 feature set has to be used
>>       case ${target} in
>>               *-w64-*)
>> @@ -1486,10 +1490,14 @@ i[34567]86-*-mingw* | x86_64-*-mingw*)
>>       cxx_target_objs="${cxx_target_objs} winnt-cxx.o msformat-c.o"
>>       default_use_cxa_atexit=yes
>>       use_gcc_stdint=wrap
>> -     case ${enable_threads} in
>> -       "" | yes | win32)       thread_file='win32'
>> -       tmake_file="${tmake_file} i386/t-gthr-win32"
>> -       ;;
>> +     case x${enable_threads} in
>> +       x | xyes | xwin32)      thread_file='win32'
>> +         tmake_file="${tmake_file} i386/t-gthr-win32"
>> +         ;;
>> +       xposix)
>> +         thread_file='posix'
>> +         tmake_file="i386/t-mingw-pthread ${tmake_file}"
>> +         ;;
>>       esac
>
> For what it's worth, the 'x' escaping is not ever needed for case
> statements (unlike for some 'test' statements), so you can write
>
>  case $enable_threads in
>  "" | yes | win32) ...
>  posix) ...
>  esac
>
> Cheers,
> Ralf
>

Applied patch at revision 171833 with the adjustment Ralf suggested.

Regards,
Kai


Re: [PATCH, PR43920, 1/9] ARM specific part.

2011-04-01 Thread Tom de Vries
Reposting, with ChangeLog.
2011-04-01  Tom de Vries  

	PR target/43920
	* config/arm/arm.h (BRANCH_COST): Set to 1 for Thumb-2 when optimizing
	for size.

Index: gcc/config/arm/arm.h
===
--- gcc/config/arm/arm.h	(revision 293961)
+++ gcc/config/arm/arm.h	(revision 293962)
@@ -2201,7 +2201,8 @@ typedef struct
 /* Try to generate sequences that don't involve branches, we can then use
conditional instructions */
 #define BRANCH_COST(speed_p, predictable_p) \
-  (TARGET_32BIT ? 4 : (optimize > 0 ? 2 : 0))
+  (TARGET_32BIT ? (TARGET_THUMB2 && optimize_size ? 1 : 4) \
+		: (optimize > 0 ? 2 : 0))
 
 /* Position Independent Code.  */
 /* We decide which register to use based on the compilation options and


Re: [PATCH, PR43920, 2/9] ARM specific part - test case

2011-04-01 Thread Tom de Vries
Reposting, with ChangeLog.
2011-04-01  Tom de Vries  

	PR target/43920
	* gcc/testsuite/gcc.target/arm/pr43920-1.c: New test.

Index: gcc/testsuite/gcc.target/arm/pr43920-1.c
===
--- gcc/testsuite/gcc.target/arm/pr43920-1.c	(revision 0)
+++ gcc/testsuite/gcc.target/arm/pr43920-1.c	(revision 0)
@@ -0,0 +1,20 @@
+/* { dg-do compile } */
+/* { dg-options "-march=armv7-a -mthumb -Os" } */
+
+int
+f (int start, int end, int *start_)
+{
+  if (start == -1 || end == -1)
+return -1;
+
+  if (end - start)
+return -1;
+
+  *start_ = start;
+
+  return 0;
+}
+
+/* { dg-final { scan-assembler-times "\torr" 0 } } */
+/* { dg-final { scan-assembler-times "\tit\t" 0 } } */
+/* { dg-final { scan-assembler "\tbeq" } } */


Re: [PATCH, PR43920, 3/9] Cleanup.

2011-04-01 Thread Tom de Vries
Reposting, with ChangeLog.
2011-04-01  Tom de Vries  

	PR target/43920
	* gcc/cfgcleanup.c (try_crossjump_bb): Remove 2 superfluous variables.

diff -u gcc/cfgcleanup.c gcc/cfgcleanup.c
--- gcc/cfgcleanup.c	(working copy)
+++ gcc/cfgcleanup.c	(working copy)
@@ -1961,7 +1961,6 @@
   edge e, e2, fallthru;
   bool changed;
   unsigned max, ix, ix2;
-  basic_block ev, ev2;
 
   /* Nothing to do if there is not at least two incoming edges.  */
   if (EDGE_COUNT (bb->preds) < 2)
@@ -2001,9 +2000,9 @@
   fallthru = find_fallthru_edge (bb->preds);
 
   changed = false;
-  for (ix = 0, ev = bb; ix < EDGE_COUNT (ev->preds); )
+  for (ix = 0; ix < EDGE_COUNT (bb->preds);)
 {
-  e = EDGE_PRED (ev, ix);
+  e = EDGE_PRED (bb, ix);
   ix++;
 
   /* As noted above, first try with the fallthru predecessor (or, a
@@ -2021,7 +2020,6 @@
 	{
 	  changed = true;
 	  ix = 0;
-	  ev = bb;
 	  continue;
 	}
 	}
@@ -2045,10 +2043,9 @@
   if (EDGE_SUCC (e->src, 0) != e)
 	continue;
 
-  for (ix2 = 0, ev2 = bb; ix2 < EDGE_COUNT (ev2->preds); )
+  for (ix2 = 0; ix2 < EDGE_COUNT (bb->preds); ix2++)
 	{
-	  e2 = EDGE_PRED (ev2, ix2);
-	  ix2++;
+	  e2 = EDGE_PRED (bb, ix2);
 
 	  if (e2 == e)
 	continue;
@@ -2071,7 +2068,6 @@
 	  if (try_crossjump_to_edge (mode, e, e2))
 	{
 	  changed = true;
-	  ev2 = bb;
 	  ix = 0;
 	  break;
 	}


Re: [PATCH, PR43920, 4/9] Cross-jumping - Don't count use or clobber.

2011-04-01 Thread Tom de Vries
Reposting, with ChangeLog.
2011-04-01  Tom de Vries  

	PR target/43920
	* cfgcleanup.c (flow_find_cross_jump): Don't count USE or CLOBBER as
	insn.

Index: gcc/cfgcleanup.c
===
--- gcc/cfgcleanup.c	(revision 170556)
+++ gcc/cfgcleanup.c	(working copy)
@@ -1074,6 +1074,7 @@ flow_find_cross_jump (basic_block bb1, b
 {
   rtx i1, i2, last1, last2, afterlast1, afterlast2;
   int ninsns = 0;
+  rtx p1;
 
   /* Skip simple jumps at the end of the blocks.  Complex jumps still
  need to be compared for equivalence, which we'll do below.  */
@@ -1122,7 +1123,9 @@ flow_find_cross_jump (basic_block bb1, b
 
 	  afterlast1 = last1, afterlast2 = last2;
 	  last1 = i1, last2 = i2;
-	  ninsns++;
+	  p1 = PATTERN (i1);
+	  if (!(GET_CODE (p1) == USE || GET_CODE (p1) == CLOBBER))
+ninsns++;
 	}
 
   i1 = PREV_INSN (i1);


Re: [PATCH, PR43920, 5/9] Cross-jumping - Add missing use of return register.

2011-04-01 Thread Tom de Vries
Reposting, with ChangeLog.
2011-04-01  Tom de Vries  

	PR target/43920
	* function.c (emit_use_return_register_into_block): New function.
	(thread_prologue_and_epilogue_insns): Use
	emit_use_return_register_into_block.

Index: gcc/function.c
===
--- gcc/function.c	(revision 170556)
+++ gcc/function.c	(working copy)
@@ -5241,6 +5241,19 @@ prologue_epilogue_contains (const_rtx in
   return 0;
 }
 
+/* Insert use of return register before the end of BB.  */
+
+static void
+emit_use_return_register_into_block (basic_block bb)
+{
+  rtx seq;
+  start_sequence ();
+  use_return_register ();
+  seq = get_insns ();
+  end_sequence ();
+  emit_insn_before (seq, BB_END (bb));
+}
+
 #ifdef HAVE_return
 /* Insert gen_return at the end of block BB.  This also means updating
block_for_insn appropriately.  */
@@ -5395,6 +5408,15 @@ thread_prologue_and_epilogue_insns (void
 		 with a simple return instruction.  */
 	  if (simplejump_p (jump))
 		{
+		  /* The use of the return register might be present in the exit
+		 fallthru block.  Either:
+		 - removing the use is safe, and we should remove the use in
+		   the exit fallthru block, or
+		 - removing the use is not safe, and we should add it here.
+		 For now, we conservatively choose the latter.  Either of the
+		 2 helps in crossjumping.  */
+		  emit_use_return_register_into_block (bb);
+
 		  emit_return_into_block (bb);
 		  delete_insn (jump);
 		}
@@ -5409,6 +5431,9 @@ thread_prologue_and_epilogue_insns (void
 		  continue;
 		}
 
+  /* See comment in simple_jump_p case above.  */
+		  emit_use_return_register_into_block (bb);
+
 		  /* If this block has only one successor, it both jumps
 		 and falls through to the fallthru block, so we can't
 		 delete the edge.  */


Re: [PATCH, PR43920, 6/9] Cross-jumping - Use reg-notes.

2011-04-01 Thread Tom de Vries
On 03/31/2011 11:16 PM, Tom de Vries wrote:
> On 03/31/2011 08:52 PM, Jeff Law wrote:
> 
>> On 03/31/11 12:42, Tom de Vries wrote:
>>> Uses regnotes to analyze whether we can replace insn a by insn b, even
>>> if we cannot replace insn b by insn a. Uses this info in crossjumping.
> 
>> Shouldn't this be using single_set rather than digging through PATTERN,
>> then verifying both are SETs, etc.?
>>
>> Otherwise don't you miss most of the benefit on architectures where most
>> insns clobber the flags register in a PARALLEL with the SET?
> 
> I see what you mean about missing these insns currently.
> 
> I guess I will have to check that the non-SET part of the PARALLEL is
> identical between the 2 insns.
> 
> I'll update the patch to handle this case.

changes compared to previous posting:
- add ChangeLog.
- use single_set
- add equal_different_set_p and use it in can_replace_by

Retested on x86_64.

Thanks,
- Tom
2011-04-01  Tom de Vries  

	PR target/43920
	* cfgcleanup.c (equal_different_set_p, can_replace_by, merge_dir): New
	function.
	(old_insns_match_p): Change return type.  Replace return false/true with
	return dir_none/dir_both.  Use can_replace_by.
	(flow_find_cross_jump): Add dir_p parameter.  Init replacement direction
	from dir_p.  Register replacement direction in dir, last_dir and
	afterlast_dir.	Handle new return type of old_insns_match_p using
	merge_dir.  Return replacement direction in dir_p.
	(flow_find_head_matching_sequence, outgoing_edges_match): Handle new
	return type of old_insns_match_p.
	(try_crossjump_to_edge): Add argument to call to flow_find_cross_jump.
	* ifcvt.c ( cond_exec_process_if_block): Add argument to call to
	flow_find_cross_jump.
	* basic-block.h (enum replace_direction): New type.
	(flow_find_cross_jump): Add parameter to declaration.

diff -u gcc/cfgcleanup.c gcc/cfgcleanup.c
--- gcc/cfgcleanup.c	(working copy)
+++ gcc/cfgcleanup.c	(working copy)
@@ -72,7 +72,7 @@
 static bool try_crossjump_to_edge (int, edge, edge);
 static bool try_crossjump_bb (int, basic_block);
 static bool outgoing_edges_match (int, basic_block, basic_block);
-static bool old_insns_match_p (int, rtx, rtx);
+static enum replace_direction old_insns_match_p (int, rtx, rtx);
 
 static void merge_blocks_move_predecessor_nojumps (basic_block, basic_block);
 static void merge_blocks_move_successor_nojumps (basic_block, basic_block);
@@ -950,27 +950,143 @@
 }
 
 
+ /* Checks if patterns P1 and P2 are equivalent, apart from the possibly
+different single sets S1 and S2.  */
+
+static bool
+equal_different_set_p (rtx p1, rtx s1, rtx p2, rtx s2)
+{
+  int i;
+  rtx e1, e2;
+
+  if (p1 == s1 && p2 == s2)
+return true;
+
+  if (GET_CODE (p1) != PARALLEL || GET_CODE (p2) != PARALLEL)
+return false;
+
+  if (XVECLEN (p1, 0) != XVECLEN (p2, 0))
+return false;
+
+  for (i = 0; i < XVECLEN (p1, 0); i++)
+{
+  e1 = XVECEXP (p1, 0, i);
+  e2 = XVECEXP (p2, 0, i);
+  if (e1 == s1 && e2 == s2)
+continue;
+  if (reload_completed
+  ? rtx_renumbered_equal_p (e1, e2) : rtx_equal_p (e1, e2))
+continue;
+
+return false;
+}
+
+  return true;
+}
+
+/* Examine register notes on I1 and I2 and return:
+   - dir_forward if I1 can be replaced by I2, or
+   - dir_backward if I2 can be replaced by I1, or
+   - dir_both if both are the case.  */
+
+static enum replace_direction
+can_replace_by (rtx i1, rtx i2)
+{
+  rtx s1, s2, d1, d2, src1, src2, note1, note2;
+  bool c1, c2;
+
+  /* Check for 2 sets.  */
+  s1 = single_set (i1);
+  s2 = single_set (i2);
+  if (s1 == NULL_RTX || s2 == NULL_RTX)
+return dir_none;
+
+  /* Check that the 2 sets set the same dest.  */
+  d1 = SET_DEST (s1);
+  d2 = SET_DEST (s2);
+  if (!(reload_completed
+? rtx_renumbered_equal_p (d1, d2) : rtx_equal_p (d1, d2)))
+return dir_none;
+
+  /* Find identical req_equiv or reg_equal note, which implies that the 2 sets
+ set dest to the same value.  */
+  note1 = find_reg_equal_equiv_note (i1);
+  note2 = find_reg_equal_equiv_note (i2);
+  if (!note1 || !note2 || !rtx_equal_p (XEXP (note1, 0), XEXP (note2, 0))
+  || !CONST_INT_P (XEXP (note1, 0)))
+return dir_none;
+
+  if (!equal_different_set_p (PATTERN (i1), s1, PATTERN (i2), s2))
+return dir_none;
+
+  /* Although the 2 sets set dest to the same value, we cannot replace
+   (set (dest) (const_int))
+ by
+   (set (dest) (reg))
+ because we don't know if the reg is live and has the same value at the
+ location of replacement.  */
+  src1 = SET_SRC (s1);
+  src2 = SET_SRC (s2);
+  c1 = CONST_INT_P (src1);
+  c2 = CONST_INT_P (src2);
+  if (c1 && c2)
+return dir_both;
+  else if (c2)
+return dir_forward;
+  else if (c1)
+return dir_backward;
+
+  return dir_none;
+}
+
+/* Merges directions A and B.  */
+
+static enum replace_direction
+merge_dir (enum replace_direction a, enum replace_direction b)
+{
+  /* Implements the following table:
+|bo fw bw no
+ ---+-

Re: [PATCH, PR43920, 7/9] Cross-jumping - Extend search scope.

2011-04-01 Thread Tom de Vries
Reposting, with ChangeLog.

2011-04-01  Tom de Vries  

	PR target/43920
	* cfgcleanup.c (walk_to_nondebug_insn): New function.
	(flow_find_cross_jump): Use walk_to_nondebug_insn.  Recalculate bb1 and
	bb2.
	(try_crossjump_to_edge): Handle case that newpos1 or newpos2 is not src1
	or src2.  Redirect edges to the last basic block.  Update frequency and
	count on multiple basic blocks in case of fallthru.

diff -u gcc/cfgcleanup.c gcc/cfgcleanup.c
--- gcc/cfgcleanup.c	(working copy)
+++ gcc/cfgcleanup.c	(working copy)
@@ -1139,6 +1139,43 @@
 }
 }
 
+ /* Walks from I1 in BB1 backward till the next non-debug insn, and returns the
+resulting insn in I1, and the corresponding bb in BB1.  At the head of a
+bb, if there is a predecessor bb that reaches this bb via fallthru, and
+FOLLOW_FALLTHRU, walks further in the predecessor bb and registers this in
+DID_FALLTHRU.  Otherwise, stops at the head of the bb.  */
+
+static void
+walk_to_nondebug_insn (rtx *i1, basic_block *bb1, bool follow_fallthru,
+   bool *did_fallthru)
+{
+  edge fallthru;
+
+  *did_fallthru = false;
+
+  /* Ignore notes.  */
+  while (!NONDEBUG_INSN_P (*i1))
+{
+  if (*i1 != BB_HEAD (*bb1))
+{
+  *i1 = PREV_INSN (*i1);
+  continue;
+}
+
+  if (!follow_fallthru)
+return;
+
+  fallthru = find_fallthru_edge ((*bb1)->preds);
+  if (!fallthru || fallthru->src == ENTRY_BLOCK_PTR_FOR_FUNCTION (cfun)
+  || !single_succ_p (fallthru->src))
+return;
+
+  *bb1 = fallthru->src;
+  *i1 = BB_END (*bb1);
+  *did_fallthru = true;
+ }
+}
+
 /* Look through the insns at the end of BB1 and BB2 and find the longest
sequence that are equivalent.  Store the first insns for that sequence
in *F1 and *F2 and return the sequence length.
@@ -1153,6 +1190,7 @@
   rtx i1, i2, last1, last2, afterlast1, afterlast2;
   int ninsns = 0;
   enum replace_direction dir, last_dir, afterlast_dir;
+  bool follow_fallthru, did_fallthru;
 
   if (dir_p)
 dir = *dir_p;
@@ -1187,11 +1225,30 @@
   while (true)
 {
-  /* Ignore notes.  */
-  while (!NONDEBUG_INSN_P (i1) && i1 != BB_HEAD (bb1))
-	i1 = PREV_INSN (i1);
-
-  while (!NONDEBUG_INSN_P (i2) && i2 != BB_HEAD (bb2))
-	i2 = PREV_INSN (i2);
+  /* In the following example, we can replace all jumps to C by jumps to A.
+
+ This removes 4 duplicate insns.
+ [bb A] insn1[bb C] insn1
+insn2   insn2
+ [bb B] insn3   insn3
+insn4   insn4
+jump_insn   jump_insn
+
+ We could also replace all jumps to A by jumps to C, but that leaves B
+ alive, and removes only 2 duplicate insns.  In a subsequent crossjump
+ step, all jumps to B would be replaced with jumps to the middle of C,
+ achieving the same result with more effort.
+ So we allow only the first possibility, which means that we don't allow
+ fallthru in the block that's being replaced.  */
+
+  follow_fallthru = dir_p && dir != dir_forward;
+  walk_to_nondebug_insn (&i1, &bb1, follow_fallthru, &did_fallthru);
+  if (did_fallthru)
+dir = dir_backward;
+
+  follow_fallthru = dir_p && dir != dir_backward;
+  walk_to_nondebug_insn (&i2, &bb2, follow_fallthru, &did_fallthru);
+  if (did_fallthru)
+dir = dir_forward;
 
   if (i1 == BB_HEAD (bb1) || i2 == BB_HEAD (bb2))
 	break;
@@ -1230,12 +1287,14 @@
  Two, it keeps line number notes as matched as may be.  */
   if (ninsns)
 {
+  bb1 = BLOCK_FOR_INSN (last1);
   while (last1 != BB_HEAD (bb1) && !NONDEBUG_INSN_P (PREV_INSN (last1)))
 	last1 = PREV_INSN (last1);
 
   if (last1 != BB_HEAD (bb1) && LABEL_P (PREV_INSN (last1)))
 	last1 = PREV_INSN (last1);
 
+  bb2 = BLOCK_FOR_INSN (last2);
   while (last2 != BB_HEAD (bb2) && !NONDEBUG_INSN_P (PREV_INSN (last2)))
 	last2 = PREV_INSN (last2);
 
@@ -1659,6 +1718,7 @@
   int nmatch;
   basic_block src1 = e1->src, src2 = e2->src;
   basic_block redirect_to, redirect_from, to_remove;
+  basic_block osrc1, osrc2, redirect_edges_to, tmp;
   enum replace_direction dir;
   rtx newpos1, newpos2;
   edge s;
@@ -1720,8 +1780,15 @@
 return false;
 
   /* ... and part the second.  */
   dir = dir_forward;
   nmatch = flow_find_cross_jump (src1, src2, &newpos1, &newpos2, &dir);
+
+  osrc1 = src1;
+  osrc2 = src2;
+  if (newpos1 != NULL_RTX)
+src1 = BLOCK_FOR_INSN (newpos1);
+  if (newpos2 != NULL_RTX)
+src2 = BLOCK_FOR_INSN (newpos2);
 
   /* Don't proceed with the crossjump unless we found a sufficient number
  of matching instructions or the 'from' block was totally matched
@@ -1745,8 +1812,8 @@
   rtx label1, label2;
   rtx table1, table2;
 
-  if (tablejump_p (BB_END (src1), &label1, &table1)
-	  && tablejump_p (BB_END (src2), &label2, &table2)
+  if (tablejump_

Re: [PATCH, PR43920, 8/9] Cross-jumping - Extend search scope - test case.

2011-04-01 Thread Tom de Vries
Reposting, with ChangeLog.
2011-04-01  Tom de Vries  

	PR target/43920
	* testsuite/gcc.target/arm/pr43920-2.c: New test.

Index: gcc/testsuite/gcc.target/arm/pr43920-2.c
===
--- gcc/testsuite/gcc.target/arm/pr43920-2.c	(revision 0)
+++ gcc/testsuite/gcc.target/arm/pr43920-2.c	(revision 0)
@@ -0,0 +1,28 @@
+/* { dg-do compile } */
+/* { dg-options "-march=armv7-a -mthumb -Os" } */
+
+#include 
+
+int getFileStartAndLength (int fd, int *start_, size_t *length_)
+{
+  int start, end;
+  size_t length;
+
+  start = lseek (fd, 0L, SEEK_CUR);
+  end = lseek (fd, 0L, SEEK_END);
+
+  if (start == -1 || end == -1)
+ return -1;
+
+  length = end - start;
+  if (length == 0)
+ return -1;
+
+  *start_ = start;
+  *length_ = length;
+
+  return 0;
+}
+
+/* { dg-final { scan-assembler-times "pop" 2 } } */
+/* { dg-final { scan-assembler-times "beq" 3 } } */


Re: [PATCH, PR43920, 9/9] Cross-jumping - Allow both directions.

2011-04-01 Thread Tom de Vries
Reposting, with ChangeLog.
2011-04-01  Tom de Vries  

	PR target/43920
	* cfgcleanup.c (try_crossjump_to_edge): Add dir parameter.  Pass dir to
	flow_find_cross_jump.  Swap variables to implement backward replacement.
	(try_crossjump_bb): Add argument to try_crossjump_to_edge.

diff -u gcc/cfgcleanup.c gcc/cfgcleanup.c
--- gcc/cfgcleanup.c	(working copy)
+++ gcc/cfgcleanup.c	(working copy)
@@ -69,7 +69,7 @@
information; we should run df_analyze to enable more opportunities.  */
 static bool block_was_dirty;
 
-static bool try_crossjump_to_edge (int, edge, edge);
+static bool try_crossjump_to_edge (int, edge, edge, enum replace_direction);
 static bool try_crossjump_bb (int, basic_block);
 static bool outgoing_edges_match (int, basic_block, basic_block);
 static enum replace_direction old_insns_match_p (int, rtx, rtx);
@@ -1695,15 +1695,17 @@
 /* E1 and E2 are edges with the same destination block.  Search their
predecessors for common code.  If found, redirect control flow from
-   (maybe the middle of) E1->SRC to (maybe the middle of) E2->SRC.  */
+   (maybe the middle of) E1->SRC to (maybe the middle of) E2->SRC (dir_forward),
+   or the other way around (dir_backward).  DIR specifies the allowed
+   replacement direction.  */
 
 static bool
-try_crossjump_to_edge (int mode, edge e1, edge e2)
+try_crossjump_to_edge (int mode, edge e1, edge e2,
+   enum replace_direction dir)
 {
   int nmatch;
   basic_block src1 = e1->src, src2 = e2->src;
   basic_block redirect_to, redirect_from, to_remove;
   basic_block osrc1, osrc2, redirect_edges_to, tmp;
-  enum replace_direction dir;
   rtx newpos1, newpos2;
   edge s;
   edge_iterator ei;
@@ -1757,8 +1759,7 @@
 return false;
 
   /* ... and part the second.  */
-  dir = dir_forward;
   nmatch = flow_find_cross_jump (src1, src2, &newpos1, &newpos2, &dir);
 
   osrc1 = src1;
   osrc2 = src2;
@@ -1767,5 +1768,15 @@
   if (newpos2 != NULL_RTX)
 src2 = BLOCK_FOR_INSN (newpos2);
 
+  if (dir == dir_backward)
+{
+#define SWAP(T, X, Y) do { T tmp = (X); (X) = (Y); (Y) = tmp; } while (0)
+  SWAP (basic_block, osrc1, osrc2);
+  SWAP (basic_block, src1, src2);
+  SWAP (edge, e1, e2);
+  SWAP (rtx, newpos1, newpos2);
+#undef SWAP
+}
+
   /* Don't proceed with the crossjump unless we found a sufficient number
  of matching instructions or the 'from' block was totally matched
@@ -2020,7 +2031,7 @@
 		   || (fallthru->src->flags & BB_MODIFIED)))
 	continue;
 
-	  if (try_crossjump_to_edge (mode, e, fallthru))
+	  if (try_crossjump_to_edge (mode, e, fallthru, dir_forward))
 	{
 	  changed = true;
 	  ix = 0;
@@ -2068,7 +2079,9 @@
 		   || (e2->src->flags & BB_MODIFIED)))
 	continue;
 
-	  if (try_crossjump_to_edge (mode, e, e2))
+	  /* Both e and e2 are not fallthru edges, so we can crossjump in either
+	 direction.  */
+	  if (try_crossjump_to_edge (mode, e, e2, dir_both))
 	{
 	  changed = true;
 	  ix = 0;


[PATCH] Avoid bitfield stores to clobber adjacent variables (PR middle-end/48124)

2011-04-01 Thread Jakub Jelinek
Hi!

This patch changes get_best_mode, so that it doesn't suggest using larger
modes if it means it could clobber variables located after the containing
one.

On the attached testcase on x86_64, the structure is 12 bytes wide,
and the last bitfield occupies 14 bits in the bytes 8 and 9 from the
beginning of the structure, then there are 2 padding bytes.
get_best_mode returns DImode as preferred way to store the structure,
which means it reads and stores not just the 2 remaining bits in
the 9th byte and two padding bytes, but also for unrelated bytes afterwards.
The aliasing code, when comparing mem access that stores to that bitfield
using DImode and another store to the following 32-bit variable, sees
both stores are to different variables and say they must not alias.
So we end up incorrect:
movqe+8(%rip), %rax
movl$2, f(%rip)
andq$-16384, %rax
movq%rax, e+8(%rip)
instead of:
movle+8(%rip), %eax
movl$2, f(%rip)
andl$-16384, %eax
movl%eax, e+8(%rip)
(with the patch) or:
movqe+8(%rip), %rax
andq$-16384, %rax
movq%rax, e+8(%rip)
movl$2, f(%rip)
(if aliasing didn't say accesses to e and f don't alias).

This patch fixes this by passing get_best_mode the type of the containing
object, so get_best_mode can better decide what mode to use (the intent
is mainly for Aldy to do something more strict for C++0x memory model,
currently it just looks at TYPE_SIZE).

Bootstrapped/regtested on x86_64-linux and i686-linux, ok for trunk
and after a while to 4.6?

I've also done instrumented bootstrap/regtest on both of these targets,
which showed that the patch only makes difference in get_best_mode
return value on libmudflap/testsuite/libmudflap.c/fail38-frag.c (main)
(both -m32 and -m64) and on the two newly added testcases (only -m64).

2011-04-01  Jakub Jelinek  

PR middle-end/48124
* stor-layout.c (get_best_mode): Add TYPE argument, if non-NULL
and bitpos + tmode's bitsize is bigger than TYPE_SIZE, don't
use tmode as wider_mode.
* rtl.h (get_best_mode): New prototype.
* machmode.h (get_best_mode): Remove prototype.
* expmed.c (store_fixed_bit_field, store_split_bit_field,
store_bit_field_1): Add ORIG_MEM argument, pass it down and
pass its MEM_EXPR's type to get_best_mode.
(store_bit_field): Pass str_rtx as ORIG_MEM to store_bit_field_1
if it is a MEM.
(extract_bit_field_1, extract_fixed_bit_field): Pass NULL as
last argument to get_best_mode.
* expr.c (optimize_bitfield_assignment_op): Pass MEM_EXPR (str_rtx)
type as last argument to get_best_mode.
* fold-const.c (optimize_bit_field_compare, fold_truthop): Pass
NULL as last argument to get_best_mode.

* gcc.c-torture/execute/pr48124.c: New test.
* gcc.dg/pr48124.c: New test.

--- gcc/stor-layout.c.jj2011-03-11 12:16:39.0 +0100
+++ gcc/stor-layout.c   2011-03-31 15:58:05.0 +0200
@@ -2445,7 +2445,8 @@ fixup_unsigned_type (tree type)
 
 enum machine_mode
 get_best_mode (int bitsize, int bitpos, unsigned int align,
-  enum machine_mode largest_mode, int volatilep)
+  enum machine_mode largest_mode, int volatilep,
+  tree type)
 {
   enum machine_mode mode;
   unsigned int unit = 0;
@@ -2484,7 +2485,12 @@ get_best_mode (int bitsize, int bitpos, 
  && unit <= BITS_PER_WORD
  && unit <= MIN (align, BIGGEST_ALIGNMENT)
  && (largest_mode == VOIDmode
- || unit <= GET_MODE_BITSIZE (largest_mode)))
+ || unit <= GET_MODE_BITSIZE (largest_mode))
+ && (type == NULL_TREE
+ || !host_integerp (TYPE_SIZE (type), 1)
+ || bitpos + (unsigned HOST_WIDE_INT) GET_MODE_BITSIZE (tmode)
+<= (unsigned HOST_WIDE_INT)
+   tree_low_cst (TYPE_SIZE (type), 1)))
wide_mode = tmode;
}
 
--- gcc/rtl.h.jj2011-03-31 08:51:04.0 +0200
+++ gcc/rtl.h   2011-03-31 14:07:18.0 +0200
@@ -2525,6 +2525,11 @@ extern bool expensive_function_p (int);
 extern unsigned int variable_tracking_main (void);
 
 /* In stor-layout.c.  */
+
+/* Find the best mode to use to access a bit field.  */
+extern enum machine_mode get_best_mode (int, int, unsigned int,
+   enum machine_mode, int, tree);
+
 extern void get_mode_bounds (enum machine_mode, int, enum machine_mode,
 rtx *, rtx *);
 
--- gcc/machmode.h.jj   2011-01-06 10:21:52.0 +0100
+++ gcc/machmode.h  2011-03-31 14:06:54.0 +0200
@@ -246,11 +246,6 @@ extern enum machine_mode int_mode_for_mo
 
 extern enum machine_mode mode_for_vector (enum machine_mode, unsigned);
 
-/* Find the best mode to use to access a bit field.  */
-
-extern enum machine_mode g

Re: [PATCH, PR43920, 8/9] Cross-jumping - Extend search scope - test case.

2011-04-01 Thread Jakub Jelinek
On Fri, Apr 01, 2011 at 04:56:10PM +0200, Tom de Vries wrote:
> Reposting, with ChangeLog.

> 2011-04-01  Tom de Vries  
> 
>   PR target/43920
>   * testsuite/gcc.target/arm/pr43920-2.c: New test.

gcc/testsuite/ has its own ChangeLog, so the ChangeLog entry
should say just
* gcc.target/arm/pr43920-2.c: New test.
Similarly one of your patches had
* gcc/cfgcleanup.c (whatever): Whatever.
in the ChangeLog, should be just
* cfgcleanup.c (whatever): Whatever.

Jakub


Re: [PATCH] Fix expansion issues on type changing MEM_REFs on LHS (PR middle-end/48335)

2011-04-01 Thread Jakub Jelinek
On Fri, Apr 01, 2011 at 01:46:55PM +0200, Jakub Jelinek wrote:
> Here is the updated patch, without the result = NULL addition but
> instead with remembering result also from the only case which was
> clearing result.  out-of-bounds changed also in the ChangeLog entry.

Bootstrapped/regtested now on x86_64-linux and i686-linux.

Jakub


Re: [PATCH, PR43920] Improve code-size optimizations

2011-04-01 Thread Tom de Vries
Hi Eric,

On 03/31/2011 11:02 PM, Eric Botcazou wrote:
>> Patches will be posted separately.
> 
> Always post a ChangeLog entry with a patch.
> 

Sorry about that. I reposted the patches with ChangeLog entries.

Thanks,
- Tom


Re: [PATCH] ICE on mainline bootstrap with powerpc64 -mcmodel={medium,large}

2011-04-01 Thread Richard Henderson
On 03/31/2011 10:41 PM, Alan Modra wrote:
>   * dwarf2out.c (mem_loc_descriptor): Recurse on LO_SUM.

Ok.


r~


Re: [PATCH, PR43920, 3/9] Cleanup.

2011-04-01 Thread Tom de Vries
On 04/01/2011 05:01 PM, Jakub Jelinek wrote:
> On Fri, Apr 01, 2011 at 04:56:10PM +0200, Tom de Vries wrote:
>> Reposting, with ChangeLog.
>
> Similarly one of your patches had
>   * gcc/cfgcleanup.c (whatever): Whatever.
> in the ChangeLog, should be just
>   * cfgcleanup.c (whatever): Whatever.
>
>   Jakub

Fixed ChangeLog.

Thanks,
- Tom
2011-04-01  Tom de Vries  

	PR target/43920
	* cfgcleanup.c (try_crossjump_bb): Remove 2 superfluous variables.

diff -u gcc/cfgcleanup.c gcc/cfgcleanup.c
--- gcc/cfgcleanup.c	(working copy)
+++ gcc/cfgcleanup.c	(working copy)
@@ -1961,7 +1961,6 @@
   edge e, e2, fallthru;
   bool changed;
   unsigned max, ix, ix2;
-  basic_block ev, ev2;
 
   /* Nothing to do if there is not at least two incoming edges.  */
   if (EDGE_COUNT (bb->preds) < 2)
@@ -2001,9 +2000,9 @@
   fallthru = find_fallthru_edge (bb->preds);
 
   changed = false;
-  for (ix = 0, ev = bb; ix < EDGE_COUNT (ev->preds); )
+  for (ix = 0; ix < EDGE_COUNT (bb->preds);)
 {
-  e = EDGE_PRED (ev, ix);
+  e = EDGE_PRED (bb, ix);
   ix++;
 
   /* As noted above, first try with the fallthru predecessor (or, a
@@ -2021,7 +2020,6 @@
 	{
 	  changed = true;
 	  ix = 0;
-	  ev = bb;
 	  continue;
 	}
 	}
@@ -2045,10 +2043,9 @@
   if (EDGE_SUCC (e->src, 0) != e)
 	continue;
 
-  for (ix2 = 0, ev2 = bb; ix2 < EDGE_COUNT (ev2->preds); )
+  for (ix2 = 0; ix2 < EDGE_COUNT (bb->preds); ix2++)
 	{
-	  e2 = EDGE_PRED (ev2, ix2);
-	  ix2++;
+	  e2 = EDGE_PRED (bb, ix2);
 
 	  if (e2 == e)
 	continue;
@@ -2071,7 +2068,6 @@
 	  if (try_crossjump_to_edge (mode, e, e2))
 	{
 	  changed = true;
-	  ev2 = bb;
 	  ix = 0;
 	  break;
 	}


Re: [PATCH, PR43920, 2/9] ARM specific part - test case

2011-04-01 Thread Tom de Vries
On 04/01/2011 05:01 PM, Jakub Jelinek wrote:
> On Fri, Apr 01, 2011 at 04:56:10PM +0200, Tom de Vries wrote:
>> Reposting, with ChangeLog.
>
> gcc/testsuite/ has its own ChangeLog, so the ChangeLog entry
> should say just
>   * gcc.target/arm/pr43920-2.c: New test.
>
>   Jakub

Fixed ChangeLog.

Thanks,
- Tom
2011-04-01  Tom de Vries  

	PR target/43920
	* gcc.target/arm/pr43920-1.c: New test.

Index: gcc/testsuite/gcc.target/arm/pr43920-1.c
===
--- gcc/testsuite/gcc.target/arm/pr43920-1.c	(revision 0)
+++ gcc/testsuite/gcc.target/arm/pr43920-1.c	(revision 0)
@@ -0,0 +1,20 @@
+/* { dg-do compile } */
+/* { dg-options "-march=armv7-a -mthumb -Os" } */
+
+int
+f (int start, int end, int *start_)
+{
+  if (start == -1 || end == -1)
+return -1;
+
+  if (end - start)
+return -1;
+
+  *start_ = start;
+
+  return 0;
+}
+
+/* { dg-final { scan-assembler-times "\torr" 0 } } */
+/* { dg-final { scan-assembler-times "\tit\t" 0 } } */
+/* { dg-final { scan-assembler "\tbeq" } } */


Re: [PATCH, PR43920, 8/9] Cross-jumping - Extend search scope - test case.

2011-04-01 Thread Tom de Vries
On 04/01/2011 05:01 PM, Jakub Jelinek wrote:
> On Fri, Apr 01, 2011 at 04:56:10PM +0200, Tom de Vries wrote:
>> Reposting, with ChangeLog.
> 
>> 2011-04-01  Tom de Vries  
>>
>>  PR target/43920
>>  * testsuite/gcc.target/arm/pr43920-2.c: New test.
> 
> gcc/testsuite/ has its own ChangeLog, so the ChangeLog entry
> should say just
>   * gcc.target/arm/pr43920-2.c: New test.
> 
>   Jakub

Fixed ChangeLog.

Thanks,
- Tom
2011-04-01  Tom de Vries  

	PR target/43920
	* gcc.target/arm/pr43920-2.c: New test.

Index: gcc/testsuite/gcc.target/arm/pr43920-2.c
===
--- gcc/testsuite/gcc.target/arm/pr43920-2.c	(revision 0)
+++ gcc/testsuite/gcc.target/arm/pr43920-2.c	(revision 0)
@@ -0,0 +1,28 @@
+/* { dg-do compile } */
+/* { dg-options "-march=armv7-a -mthumb -Os" } */
+
+#include 
+
+int getFileStartAndLength (int fd, int *start_, size_t *length_)
+{
+  int start, end;
+  size_t length;
+
+  start = lseek (fd, 0L, SEEK_CUR);
+  end = lseek (fd, 0L, SEEK_END);
+
+  if (start == -1 || end == -1)
+ return -1;
+
+  length = end - start;
+  if (length == 0)
+ return -1;
+
+  *start_ = start;
+  *length_ = length;
+
+  return 0;
+}
+
+/* { dg-final { scan-assembler-times "pop" 2 } } */
+/* { dg-final { scan-assembler-times "beq" 3 } } */


Re: [PATCH, PR43920, 1/9] ARM specific part.

2011-04-01 Thread Richard Earnshaw

On Fri, 2011-04-01 at 16:45 +0200, Tom de Vries wrote:
> Reposting, with ChangeLog.

 #define BRANCH_COST(speed_p, predictable_p) \
-  (TARGET_32BIT ? 4 : (optimize > 0 ? 2 : 0))
+  (TARGET_32BIT ? (TARGET_THUMB2 && optimize_size ? 1 : 4) \
+   : (optimize > 0 ? 2 : 0))

Don't use optimize_size here, use !speed_p.

Otherwise OK.

R.




Re: [PATCH, PR43920, 2/9] ARM specific part - test case

2011-04-01 Thread Richard Earnshaw
On Fri, 2011-04-01 at 16:47 +0200, Tom de Vries wrote:
> Reposting, with ChangeLog.

+/* { dg-options "-march=armv7-a -mthumb -Os" } */

No, use dg-require-effective-target.  The above doesn't work properly
with multilib testing.

R.





Re: [PATCH] Fix expansion issues on type changing MEM_REFs on LHS (PR middle-end/48335)

2011-04-01 Thread Eric Botcazou
> result is set there from store_field, and result is only used in
>   if (result)
> preserve_temp_slots (result);
> afterwards.  store_field might want to preserve_temp_slots perhaps, so
> clearing result afterwards might be wrong.

You're very likely right, but then this should apply to the case just above.

> You mean just with the MEM_P test?  So something like:
>
> @@ -418,8 +418,11 @@ store_bit_field_1 (rtx str_rtx, unsigned
>&& bitsize == GET_MODE_BITSIZE (fieldmode)
>&& (!MEM_P (op0)
> ? ((GET_MODE_SIZE (fieldmode) >= UNITS_PER_WORD
> -  || GET_MODE_SIZE (GET_MODE (op0)) == GET_MODE_SIZE (fieldmode))
> -  && byte_offset % GET_MODE_SIZE (fieldmode) == 0)
> +   || GET_MODE_SIZE (GET_MODE (op0)) == GET_MODE_SIZE (fieldmode))
> +  && byte_offset % GET_MODE_SIZE (fieldmode) == 0
> +  && (GET_MODE (op0) == fieldmode
> +  || validate_subreg (fieldmode, GET_MODE (op0), op0,
> +  byte_offset)))
>
> : (! SLOW_UNALIGNED_ACCESS (fieldmode, MEM_ALIGN (op0))
> :
>|| (offset * BITS_PER_UNIT % bitsize == 0
>
>&& MEM_ALIGN (op0) % GET_MODE_BITSIZE (fieldmode) == 0
>
> instead?

Yes, but I think that this can be further simplified.  The test:

  byte_offset % GET_MODE_SIZE (fieldmode) == 0

is the first thing the call to validate_subreg does.  And it's clear that the 
case GET_MODE (op0) == fieldmode requires byte_offset to be 0.  So I think:

Index: expmed.c
===
--- expmed.c(revision 171818)
+++ expmed.c(working copy)
@@ -419,7 +419,9 @@ store_bit_field_1 (rtx str_rtx, unsigned
   && (!MEM_P (op0)
  ? ((GET_MODE_SIZE (fieldmode) >= UNITS_PER_WORD
 || GET_MODE_SIZE (GET_MODE (op0)) == GET_MODE_SIZE (fieldmode))
-&& byte_offset % GET_MODE_SIZE (fieldmode) == 0)
+&& ((GET_MODE (op0) == fieldmode && byte_offset == 0)
+|| validate_subreg (fieldmode, GET_MODE (op0), op0,
+byte_offset)))
  : (! SLOW_UNALIGNED_ACCESS (fieldmode, MEM_ALIGN (op0))
 || (offset * BITS_PER_UNIT % bitsize == 0
 && MEM_ALIGN (op0) % GET_MODE_BITSIZE (fieldmode) == 0

should work.

-- 
Eric Botcazou


Re: [debug] Don't add DW_AT_low_pc if the CU has no associated code

2011-04-01 Thread Richard Henderson
On 03/31/2011 02:17 PM, Mark Wielaard wrote:
> * dwarf2out.c (dwarf2out_finish): Don't add low_pc and/or
> high_pc attribute if the CU has no associated code. Only output
> DW_AT_entry_pc for CU if not generating strict dwarf and
> dwarf_version < 4.

Ok.


r~


Re: [PATCH] Fix expansion issues on type changing MEM_REFs on LHS (PR middle-end/48335)

2011-04-01 Thread Jakub Jelinek
On Fri, Apr 01, 2011 at 05:35:53PM +0200, Eric Botcazou wrote:
> > result is set there from store_field, and result is only used in
> >   if (result)
> > preserve_temp_slots (result);
> > afterwards.  store_field might want to preserve_temp_slots perhaps, so
> > clearing result afterwards might be wrong.
> 
> You're very likely right, but then this should apply to the case just above.

See the patch I've posted in the mean time.

> --- expmed.c(revision 171818)
> +++ expmed.c(working copy)
> @@ -419,7 +419,9 @@ store_bit_field_1 (rtx str_rtx, unsigned
>&& (!MEM_P (op0)
>   ? ((GET_MODE_SIZE (fieldmode) >= UNITS_PER_WORD
>  || GET_MODE_SIZE (GET_MODE (op0)) == GET_MODE_SIZE (fieldmode))
> -&& byte_offset % GET_MODE_SIZE (fieldmode) == 0)
> +&& ((GET_MODE (op0) == fieldmode && byte_offset == 0)
> +|| validate_subreg (fieldmode, GET_MODE (op0), op0,
> +byte_offset)))
>   : (! SLOW_UNALIGNED_ACCESS (fieldmode, MEM_ALIGN (op0))
>  || (offset * BITS_PER_UNIT % bitsize == 0
>  && MEM_ALIGN (op0) % GET_MODE_BITSIZE (fieldmode) == 0
> 
> should work.

You're right.
I'm now bootstrapping/regtesting following adjusted patch, ok if it passes?

2011-04-01  Jakub Jelinek  

PR middle-end/48335
* expr.c (expand_assignment): Handle all possibilities
if TO_RTX is CONCAT.
* expmed.c (store_bit_field_1): Avoid trying to create
invalid SUBREGs.
(store_split_bit_field): If SUBREG_REG (op0) or
op0 itself has smaller mode than word, return it
for offset 0 and const0_rtx for out-of-bounds stores.
If word is const0_rtx, skip it.

* gcc.c-torture/compile/pr48335-1.c: New test.
* gcc.dg/pr48335-1.c: New test.
* gcc.dg/pr48335-2.c: New test.
* gcc.dg/pr48335-3.c: New test.
* gcc.dg/pr48335-4.c: New test.
* gcc.dg/pr48335-5.c: New test.
* gcc.dg/pr48335-6.c: New test.
* gcc.dg/pr48335-7.c: New test.
* gcc.dg/pr48335-8.c: New test.
* gcc.target/i386/pr48335-1.c: New test.

--- gcc/expr.c.jj   2011-04-01 13:35:51.113644464 +0200
+++ gcc/expr.c  2011-04-01 13:41:36.585402545 +0200
@@ -4280,16 +4280,47 @@ expand_assignment (tree to, tree from, b
   /* Handle expand_expr of a complex value returning a CONCAT.  */
   else if (GET_CODE (to_rtx) == CONCAT)
{
- if (COMPLEX_MODE_P (TYPE_MODE (TREE_TYPE (from
+ unsigned short mode_bitsize = GET_MODE_BITSIZE (GET_MODE (to_rtx));
+ if (COMPLEX_MODE_P (TYPE_MODE (TREE_TYPE (from)))
+ && bitpos == 0
+ && bitsize == mode_bitsize)
+   result = store_expr (from, to_rtx, false, nontemporal);
+ else if (bitsize == mode_bitsize / 2
+  && (bitpos == 0 || bitpos == mode_bitsize / 2))
+   result = store_expr (from, XEXP (to_rtx, bitpos != 0), false,
+nontemporal);
+ else if (bitpos + bitsize <= mode_bitsize / 2)
+   result = store_field (XEXP (to_rtx, 0), bitsize, bitpos,
+ mode1, from, TREE_TYPE (tem),
+ get_alias_set (to), nontemporal);
+ else if (bitpos >= mode_bitsize / 2)
+   result = store_field (XEXP (to_rtx, 1), bitsize,
+ bitpos - mode_bitsize / 2, mode1, from,
+ TREE_TYPE (tem), get_alias_set (to),
+ nontemporal);
+ else if (bitpos == 0 && bitsize == mode_bitsize)
{
- gcc_assert (bitpos == 0);
- result = store_expr (from, to_rtx, false, nontemporal);
+ rtx from_rtx;
+ result = expand_normal (from);
+ from_rtx = simplify_gen_subreg (GET_MODE (to_rtx), result,
+ TYPE_MODE (TREE_TYPE (from)), 0);
+ emit_move_insn (XEXP (to_rtx, 0),
+ read_complex_part (from_rtx, false));
+ emit_move_insn (XEXP (to_rtx, 1),
+ read_complex_part (from_rtx, true));
}
  else
{
- gcc_assert (bitpos == 0 || bitpos == GET_MODE_BITSIZE (mode1));
- result = store_expr (from, XEXP (to_rtx, bitpos != 0), false,
-  nontemporal);
+ rtx temp = assign_stack_temp (GET_MODE (to_rtx),
+   GET_MODE_SIZE (GET_MODE (to_rtx)),
+   0);
+ write_complex_part (temp, XEXP (to_rtx, 0), false);
+ write_complex_part (temp, XEXP (to_rtx, 1), true);
+ result = store_field (temp, bitsize, bitpos, mode1, from,
+   TREE_TYPE (tem), get_alias_set (to),
+  

Re: [PATCH] Fix expansion issues on type changing MEM_REFs on LHS (PR middle-end/48335)

2011-04-01 Thread Eric Botcazou
> I'm now bootstrapping/regtesting following adjusted patch, ok if it passes?
>
> 2011-04-01  Jakub Jelinek  
>
>   PR middle-end/48335
>   * expr.c (expand_assignment): Handle all possibilities
>   if TO_RTX is CONCAT.
>   * expmed.c (store_bit_field_1): Avoid trying to create
>   invalid SUBREGs.
>   (store_split_bit_field): If SUBREG_REG (op0) or
>   op0 itself has smaller mode than word, return it
>   for offset 0 and const0_rtx for out-of-bounds stores.
>   If word is const0_rtx, skip it.
>
>   * gcc.c-torture/compile/pr48335-1.c: New test.
>   * gcc.dg/pr48335-1.c: New test.
>   * gcc.dg/pr48335-2.c: New test.
>   * gcc.dg/pr48335-3.c: New test.
>   * gcc.dg/pr48335-4.c: New test.
>   * gcc.dg/pr48335-5.c: New test.
>   * gcc.dg/pr48335-6.c: New test.
>   * gcc.dg/pr48335-7.c: New test.
>   * gcc.dg/pr48335-8.c: New test.
>   * gcc.target/i386/pr48335-1.c: New test.

Yes, fine by me, thanks.

-- 
Eric Botcazou


Re: [PATCH, PR43920] Improve code-size optimizations

2011-04-01 Thread Eric Botcazou
> Sorry about that. I reposted the patches with ChangeLog entries.

Thanks!

-- 
Eric Botcazou


Re: [PATCH, PR43920, 1/9] ARM specific part.

2011-04-01 Thread Tom de Vries
On 04/01/2011 05:18 PM, Richard Earnshaw wrote:
> 
> On Fri, 2011-04-01 at 16:45 +0200, Tom de Vries wrote:
>> Reposting, with ChangeLog.
> 
>  #define BRANCH_COST(speed_p, predictable_p) \
> -  (TARGET_32BIT ? 4 : (optimize > 0 ? 2 : 0))
> +  (TARGET_32BIT ? (TARGET_THUMB2 && optimize_size ? 1 : 4) \
> +   : (optimize > 0 ? 2 : 0))
> 
> Don't use optimize_size here, use !speed_p.
> 
> Otherwise OK.
> 

Replaced optimize_size by !speed_p.

Thanks,
- Tom
2011-04-01  Tom de Vries  

	PR target/43920
	* config/arm/arm.h (BRANCH_COST): Set to 1 for Thumb-2 when optimizing
	for size.

Index: gcc/config/arm/arm.h
===
--- gcc/config/arm/arm.h	(revision 293961)
+++ gcc/config/arm/arm.h	(revision 293962)
@@ -2201,7 +2201,8 @@ typedef struct
 /* Try to generate sequences that don't involve branches, we can then use
conditional instructions */
 #define BRANCH_COST(speed_p, predictable_p) \
-  (TARGET_32BIT ? 4 : (optimize > 0 ? 2 : 0))
+  (TARGET_32BIT ? (TARGET_THUMB2 && !speed_p ? 1 : 4) \
+		: (optimize > 0 ? 2 : 0))
 
 /* Position Independent Code.  */
 /* We decide which register to use based on the compilation options and


Re: [PATCH, PR43920, 2/9] ARM specific part - test case

2011-04-01 Thread Tom de Vries
On 04/01/2011 05:34 PM, Richard Earnshaw wrote:
> On Fri, 2011-04-01 at 16:47 +0200, Tom de Vries wrote:
>> Reposting, with ChangeLog.
> 
> +/* { dg-options "-march=armv7-a -mthumb -Os" } */
> 
> No, use dg-require-effective-target.  The above doesn't work properly
> with multilib testing.
> 

Changed it into:

+/* { dg-options "-mthumb -Os" }  */
+/* { dg-require-effective-target arm_thumb2_ok } */

Thanks,
- Tom
2011-04-01  Tom de Vries  

	PR target/43920
	* gcc.target/arm/pr43920-1.c: New test.

Index: gcc/testsuite/gcc.target/arm/pr43920-1.c
===
--- gcc/testsuite/gcc.target/arm/pr43920-1.c	(revision 0)
+++ gcc/testsuite/gcc.target/arm/pr43920-1.c	(revision 0)
@@ -0,0 +1,21 @@
+/* { dg-do compile } */
+/* { dg-options "-mthumb -Os" }  */
+/* { dg-require-effective-target arm_thumb2_ok } */
+
+int
+f (int start, int end, int *start_)
+{
+  if (start == -1 || end == -1)
+return -1;
+
+  if (end - start)
+return -1;
+
+  *start_ = start;
+
+  return 0;
+}
+
+/* { dg-final { scan-assembler-times "\torr" 0 } } */
+/* { dg-final { scan-assembler-times "\tit\t" 0 } } */
+/* { dg-final { scan-assembler "\tbeq" } } */


Re: [PATCH, PR43920, 8/9] Cross-jumping - Extend search scope - test case.

2011-04-01 Thread Tom de Vries
On 04/01/2011 05:34 PM, Richard Earnshaw wrote:
> On Fri, 2011-04-01 at 16:47 +0200, Tom de Vries wrote:
> Reposting, with ChangeLog.
>
> +/* { dg-options "-march=armv7-a -mthumb -Os" } */
>
> No, use dg-require-effective-target.  The above doesn't work properly
> with multilib testing.
>

Changed it into:

+/* { dg-options "-mthumb -Os" }  */
+/* { dg-require-effective-target arm_thumb2_ok } */

Thanks,
- Tom
2011-04-01  Tom de Vries  

	PR target/43920
	* gcc.target/arm/pr43920-2.c: New test.

Index: gcc/testsuite/gcc.target/arm/pr43920-2.c
===
--- gcc/testsuite/gcc.target/arm/pr43920-2.c	(revision 0)
+++ gcc/testsuite/gcc.target/arm/pr43920-2.c	(revision 0)
@@ -0,0 +1,29 @@
+/* { dg-do compile } */
+/* { dg-options "-mthumb -Os" }  */
+/* { dg-require-effective-target arm_thumb2_ok } */
+
+#include 
+
+int getFileStartAndLength (int fd, int *start_, size_t *length_)
+{
+  int start, end;
+  size_t length;
+
+  start = lseek (fd, 0L, SEEK_CUR);
+  end = lseek (fd, 0L, SEEK_END);
+
+  if (start == -1 || end == -1)
+ return -1;
+
+  length = end - start;
+  if (length == 0)
+ return -1;
+
+  *start_ = start;
+  *length_ = length;
+
+  return 0;
+}
+
+/* { dg-final { scan-assembler-times "pop" 2 } } */
+/* { dg-final { scan-assembler-times "beq" 3 } } */


Re: [cxx-mem-model] bitfield tests

2011-04-01 Thread Richard Henderson
On 03/31/2011 08:28 AM, Richard Guenther wrote:
>>> Well, I'm not sure that strict-align targets that provide byte access do
>>> not simply hide the issue inside the CPU (thus, perform the 
>>> read-modify-write
>>> there and do not guarantee any atomicity unless you ask for it).
>> Certainly some do this internally, but that's clearly out of our
>> control.
> 
> Sure.  My argument is that the memory model which guarantees
> this kind of things for _any_ memory access is fundamentally flawed.
> They should have simply required annotating objects which should
> behave that way (and then only behave that way "per object", not
> for any concurrent field accesses).

(0) Let's limit our discussion to cpus that are actually put into SMP systems,
and have been manufactured in the last decade.

(1) Do we agree that all such cpus have user-level store insns with byte
granularity.  Honestly the only non-microcontroler I ever heard of 
without this was the original Alpha.  Which is excluded per (0).

(2) Do we agree that all such cpus have on-chip caches?

(3) Let us at this point limit our discussion to cacheable, i.e. non-I/O,
memory.  I believe we can agree that all sorts of system-dependent stuff
happens in memory-mapped registers.

(4) Do we agree that all such cpus transfer entire cachelines to and fro
the memory bus?  And further that they simultaneously transfer a 
modification mask as part of their cache coherency protocol?

(5) Do we agree that all such cpus use a byte-granular modification mask?

I'm guessing that you don't actually agree on point (5), but ... honestly,
please name the offender because I can't think of one.  For the mainstream
processors we really care about, I think every one of them Does The Right Thing.



r~


Re: [toplevel] remove tentative_cc

2011-04-01 Thread Joseph S. Myers
I see there's more than just tentative_cc that tries to deal with compiler 
settings in ways that should be the responsibility of autoconf.  There's 
the

# Make sure that the compiler is able to generate an executable.  If it
# can't, we are probably in trouble.  We don't care whether we can run the
# executable--we might be using a cross compiler--we only care whether it
# can be created.  At this point the main configure script has set CC.

code - and there's probably a better autoconf-native way of testing that 
the compiler can link an executable than the shell code here.  And that's 
immediately followed by

# The Solaris /usr/ucb/cc compiler does not appear to work.

which is surely outside what the script ought to be doing.  I don't think 
the

# hpux11 in 64bit mode has libraries in a weird place.  Arrange to find
# them automatically.

code makes any sense now either; autoconf knows about /usr/X11R6/include 
if you use the right macros, while GCC appears to have known to search in 
/usr/lib/pa20_64 for this target since at least 2004.

-- 
Joseph S. Myers
jos...@codesourcery.com


[commit] Fix SPU build issue (Re: Remove US_SOFTWARE_GOFAST)

2011-04-01 Thread Ulrich Weigand
Joseph Myers wrote:

> Index: gcc/config/spu/t-spu-elf
> ===
> --- gcc/config/spu/t-spu-elf  (revision 167746)
> +++ gcc/config/spu/t-spu-elf  (working copy)

>  dp-bit.c: $(srcdir)/config/fp-bit.c $(srcdir)/config/spu/t-spu-elf
> - echo '#undef US_SOFTWARE_GOFAST' > dp-bit.c
>   cat $(srcdir)/config/fp-bit.c >> dp-bit.c

This change causes occasional build problems since the dp-bit.c file is
now no longer truncated before adding new contents.  Fixed by using >
instead of >> to create the file.

Tested on spu-elf, committed to mainline and 4.6 branch.

Bye,
Ulrich

ChangeLog:

* config/spu/t-spu-elf (dp-bit.c): Use > instead of >>.

Index: gcc/config/spu/t-spu-elf
===
*** gcc/config/spu/t-spu-elf(revision 171686)
--- gcc/config/spu/t-spu-elf(working copy)
***
*** 1,4 
! #  Copyright (C) 2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
  #
  #  This file is free software; you can redistribute it and/or modify it under
  #  the terms of the GNU General Public License as published by the Free
--- 1,5 
! #  Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011
! #  Free Software Foundation, Inc.
  #
  #  This file is free software; you can redistribute it and/or modify it under
  #  the terms of the GNU General Public License as published by the Free
*** FPBIT = fp-bit.c
*** 55,61 
  DPBIT = dp-bit.c
  
  dp-bit.c: $(srcdir)/config/fp-bit.c $(srcdir)/config/spu/t-spu-elf
!   cat $(srcdir)/config/fp-bit.c >> dp-bit.c
  
  fp-bit.c: $(srcdir)/config/fp-bit.c $(srcdir)/config/spu/t-spu-elf
echo '#define FLOAT' > fp-bit.c
--- 56,62 
  DPBIT = dp-bit.c
  
  dp-bit.c: $(srcdir)/config/fp-bit.c $(srcdir)/config/spu/t-spu-elf
!   cat $(srcdir)/config/fp-bit.c > dp-bit.c
  
  fp-bit.c: $(srcdir)/config/fp-bit.c $(srcdir)/config/spu/t-spu-elf
echo '#define FLOAT' > fp-bit.c

-- 
  Dr. Ulrich Weigand
  GNU Toolchain for Linux on System z and Cell BE
  ulrich.weig...@de.ibm.com


Re: [PING]RE: [H8300] Hookize target macros

2011-04-01 Thread Anatoly Sokolov
Hi.

On 09/17/2010 12:54:36, Naveen H. S wrote:
> Can you please commit the patch if it's OK?

> Thanks & Regards,
> Naveen

> -Original Message-
> From: Richard Henderson [mailto:r...@redhat.com] 
> Sent: Friday, September 03, 2010 8:34 PM
> To: Naveen H. S
> Cc: gcc-patches@gcc.gnu.org; Prafulla Thakare
> Subject: Re: [H8300] Hookize target macros

> On 09/01/2010 02:39 AM, Naveen H. S wrote:
>>   * config/h8300/h8300.c (h8300_print_operand_address): Make static.
>>   Adjust comments. Declare.
>>   (h8300_print_operand): Likewise.
>>   (h8300_print_operand_punct_valid_p): Moved from h8300.h file. 
>>   (h8300_function_value): Likewise.
>>   (h8300_function_value_regno_p): Likewise.
>>   (h8300_register_move_cost): Likewise.
>>   (TARGET_PRINT_OPERAND_PUNCT_VALID_P, TARGET_PRINT_OPERAND
>>   TARGET_PRINT_OPERAND_ADDRESS, TARGET_REGISTER_MOVE_COST
>>   TARGET_FUNCTION_VALUE, TARGET_FUNCTION_VALUE_REGNO_P): Define.
>>   * config/h8300/h8300.h (PRINT_OPERAND_ADDRESS, PRINT_OPERAND
>>   PRINT_OPERAND_PUNCT_VALID_P, REGISTER_MOVE_COST, FUNCTION_VALUE
>>   FUNCTION_VALUE_REGNO_P): Delete.
>>   * config/h8300/h8300-protos.h (print_operand): Delete.
>>   (print_operand_address): Delete.

> Ok.

> r~

  Since TARGET_FUNCTION_VALUE and TARGET_FUNCTION_VALUE_REGNO_P macros
already transformed in to target hooks, they are removed from this patch.
Also I add mark 'mode' argument in h8300_register_move_cost function as 
unused and slightly corrected ChangeLog entry.

  Because old patch is approved I will commit new version in four days is no 
objection.

  Regression tested on h8300-unknown-elf with no new failure.


2011-04-01  Naveen H.S  

* config/h8300/h8300.c (print_operand_address): Rename to...
(h8300_print_operand_address): ...this. Make static. Adjust comments.
Call h8300_print_operand and h8300_print_operand_address instead of
print_operand and print_operand_address. Declare.
(print_operand): Renake to...
(h8300_print_operand): ...this. Make static. Adjust comments.
Call h8300_print_operand instead of print_operand. Declare.
(h8300_print_operand_punct_valid_p): Moved from h8300.h file.
(h8300_register_move_cost): Likewise.
(TARGET_PRINT_OPERAND_PUNCT_VALID_P, TARGET_PRINT_OPERAND
TARGET_PRINT_OPERAND_ADDRESS, TARGET_REGISTER_MOVE_COST): Define.
* config/h8300/h8300.h (PRINT_OPERAND_ADDRESS, PRINT_OPERAND
PRINT_OPERAND_PUNCT_VALID_P, REGISTER_MOVE_COST): Delete.
* config/h8300/h8300-protos.h (print_operand): Delete.
(print_operand_address): Delete

Index: gcc/config/h8300/h8300.c
===
--- gcc/config/h8300/h8300.c(revision 171793)
+++ gcc/config/h8300/h8300.c(working copy)
@@ -93,9 +93,13 @@
 static tree h8300_handle_fndecl_attribute (tree *, tree, tree, int, bool *);
 static tree h8300_handle_eightbit_data_attribute (tree *, tree, tree, int, 
bool *);
 static tree h8300_handle_tiny_data_attribute (tree *, tree, tree, int, bool *);
+static void h8300_print_operand_address (FILE *, rtx);
+static void h8300_print_operand (FILE *, rtx, int);
+static bool h8300_print_operand_punct_valid_p (unsigned char code);
 #ifndef OBJECT_FORMAT_ELF
 static void h8300_asm_named_section (const char *, unsigned int, tree);
 #endif
+static int h8300_register_move_cost (enum machine_mode, reg_class_t, 
reg_class_t);
 static int h8300_and_costs (rtx);
 static int h8300_shift_costs (rtx);
 static void  h8300_push_pop   (int, int, bool, bool);
@@ -1182,6 +1188,22 @@
 }
 
 
+/* Implements TARGET_REGISTER_MOVE_COST.
+
+   Any SI register-to-register move may need to be reloaded,
+   so inmplement h8300_register_move_cost to return > 2 so that reload never
+   shortcuts.  */
+
+static int
+h8300_register_move_cost (enum machine_mode mode ATTRIBUTE_UNUSED,
+ reg_class_t from, reg_class_t to)
+{
+  if (from == MAC_REGS || to == MAC_REG)
+return 6;
+  else
+return 3;
+}
+
 /* Compute the cost of an and insn.  */
 
 static int
@@ -1450,8 +1472,8 @@
 /* Print operand X using operand code CODE to assembly language output file
FILE.  */
 
-void
-print_operand (FILE *file, rtx x, int code)
+static void
+h8300_print_operand (FILE *file, rtx x, int code)
 {
   /* This is used for communication between codes V,W,Z and Y.  */
   static int bitint;
@@ -1530,7 +1552,7 @@
   if (GET_CODE (x) == REG)
fprintf (file, "%s%c", names_big[REGNO (x)], bitint > 7 ? 'h' : 'l');
   else
-   print_operand (file, x, 'R');
+   h8300_print_operand (file, x, 'R');
   bitint = -1;
   break;
 case 'Z':
@@ -1563,7 +1585,7 @@
fprintf (file, "%s", names_upper_extended[REGNO (x)]);
  break;
case MEM:
- print_operand (file, x, 0);
+ h8300_print_operand (file, x, 0);
  break;
 

Re: [PING]RE: [H8300] Hookize target macros

2011-04-01 Thread Richard Henderson
On 04/01/2011 10:25 AM, Anatoly Sokolov wrote:
> * config/h8300/h8300.c (print_operand_address): Rename to...
> (h8300_print_operand_address): ...this. Make static. Adjust comments.
> Call h8300_print_operand and h8300_print_operand_address instead of
> print_operand and print_operand_address. Declare.
> (print_operand): Renake to...
> (h8300_print_operand): ...this. Make static. Adjust comments.
> Call h8300_print_operand instead of print_operand. Declare.
> (h8300_print_operand_punct_valid_p): Moved from h8300.h file.
> (h8300_register_move_cost): Likewise.
> (TARGET_PRINT_OPERAND_PUNCT_VALID_P, TARGET_PRINT_OPERAND
> TARGET_PRINT_OPERAND_ADDRESS, TARGET_REGISTER_MOVE_COST): Define.
> * config/h8300/h8300.h (PRINT_OPERAND_ADDRESS, PRINT_OPERAND
> PRINT_OPERAND_PUNCT_VALID_P, REGISTER_MOVE_COST): Delete.
> * config/h8300/h8300-protos.h (print_operand): Delete.
> (print_operand_address): Delete

The new patch is ok too.


r~


[google] Add testcase for relative paths for FDO (issue4354042)

2011-04-01 Thread Martin Thuresson
This patch should go into google/main.

Add testcase to verify that relative profile paths workes.

Bootstraped without regression on x86_64.


2011-04-01  Martin Thuresson  

PR gcov-profile/47793
* gcc/testsuite/gcc.dg/pr47793.c: New test

Index: gcc/testsuite/gcc.dg/pr47793.c
===
--- gcc/testsuite/gcc.dg/pr47793.c  (revision 0)
+++ gcc/testsuite/gcc.dg/pr47793.c  (revision 0)
@@ -0,0 +1,12 @@
+/* Bug pr47793: Allow relative paths in profile-generate.  */
+/* { dg-do run } */
+/* { dg-options "-O -fprofile-generate=./" } */
+/* { dg-final { scan-file pr47793.gcda "."} } */
+
+int
+main(void)
+{
+  return 0;
+}
+
+/* { dg-final { cleanup-coverage-files } } */

--
This patch is available for review at http://codereview.appspot.com/4354042


[patch i386]: Set for method-functions default calling-convention to thiscall for 32-bit msabi

2011-04-01 Thread Kai Tietz
Hello,

this patch sets for c++ methods, which are not stdarg ones, the
default calling-convention to thiscall for ms_abi 32-bit, as vendor
specific compiler does.

ChangeLog

2011-04-01  Kai Tietz

* i386.c (ix86_is_msabi_thiscall): New helper function.
(ix86_comp_type_attributes): Handle thiscall for method-functions
special.
(init_cumulative_args): Likewise.
(find_drap_reg): Likewise.
(ix86_static_chain): Likewise.
(x86_this_parameter): Likewise.
(x86_output_mi_thunk): Likewise.


Tested for i686-w64-mingw32 (some parts of the g++ testsuite are still
running). Regression tested for i686-pc-cygwin, x86_64-pc-linux-gnu.
Ok for apply?

Regards,
Kai
Index: gcc/gcc/config/i386/i386.c
===
--- gcc.orig/gcc/config/i386/i386.c 2011-04-01 18:26:53.207236300 +0200
+++ gcc/gcc/config/i386/i386.c  2011-04-01 19:31:25.24000 +0200
@@ -5436,6 +5436,20 @@ ix86_handle_cconv_attribute (tree *node,
   return NULL_TREE;
 }
 
+/* This function checks if the method-function has default __thiscall
+   calling-convention for 32-bit msabi.
+   It returns true if TYPE is of kind METHOD_TYPE, no stdarg function,
+   and the MS_ABI 32-bit is used.  Otherwise it returns false.  */
+
+static bool
+ix86_is_msabi_thiscall (const_tree type)
+{
+  if (TARGET_64BIT || ix86_function_type_abi (type) != MS_ABI
+  || TREE_CODE (type) != METHOD_TYPE || stdarg_p (type))
+return false;
+  return true;
+}
+
 /* Return 0 if the attributes for two types are incompatible, 1 if they
are compatible, and 2 if they are nearly compatible (which causes a
warning to be generated).  */
@@ -5444,7 +5458,8 @@ static int
 ix86_comp_type_attributes (const_tree type1, const_tree type2)
 {
   /* Check for mismatch of non-default calling convention.  */
-  const char *const rtdstr = TARGET_RTD ? "cdecl" : "stdcall";
+  bool is_thiscall = ix86_is_msabi_thiscall (type1);
+  const char *const rtdstr = TARGET_RTD ? (is_thiscall ? "thiscall" : "cdecl") 
: "stdcall";
 
   if (TREE_CODE (type1) != FUNCTION_TYPE
   && TREE_CODE (type1) != METHOD_TYPE)
@@ -5463,9 +5478,18 @@ ix86_comp_type_attributes (const_tree ty
 return 0;
 
   /* Check for mismatched thiscall types.  */
-  if (!lookup_attribute ("thiscall", TYPE_ATTRIBUTES (type1))
-  != !lookup_attribute ("thiscall", TYPE_ATTRIBUTES (type2)))
-return 0;
+  if (is_thiscall && !TARGET_RTD)
+{
+  if (!lookup_attribute ("cdecl", TYPE_ATTRIBUTES (type1))
+ != !lookup_attribute ("cdecl", TYPE_ATTRIBUTES (type2)))
+   return 0;
+}
+  else if (!is_thiscall || TARGET_RTD)
+{
+  if (!lookup_attribute ("thiscall", TYPE_ATTRIBUTES (type1))
+ != !lookup_attribute ("thiscall", TYPE_ATTRIBUTES (type2)))
+   return 0;
+}
 
   /* Check for mismatched return types (cdecl vs stdcall).  */
   if (!lookup_attribute (rtdstr, TYPE_ATTRIBUTES (type1))
@@ -5500,7 +5524,8 @@ ix86_function_regparm (const_tree type,
   if (lookup_attribute ("fastcall", TYPE_ATTRIBUTES (type)))
 return 2;
 
-  if (lookup_attribute ("thiscall", TYPE_ATTRIBUTES (type)))
+  if (lookup_attribute ("thiscall", TYPE_ATTRIBUTES (type))
+  || ix86_is_msabi_thiscall (type))
 return 1;
 
   /* Use register calling convention for local functions when possible.  */
@@ -5666,7 +5691,8 @@ ix86_return_pops_args (tree fundecl, tre
  variable args.  */
   if (lookup_attribute ("stdcall", TYPE_ATTRIBUTES (funtype))
  || lookup_attribute ("fastcall", TYPE_ATTRIBUTES (funtype))
-  || lookup_attribute ("thiscall", TYPE_ATTRIBUTES (funtype)))
+  || lookup_attribute ("thiscall", TYPE_ATTRIBUTES (funtype))
+  || ix86_is_msabi_thiscall (funtype))
rtd = 1;
 
   if (rtd && ! stdarg_p (funtype))
@@ -6004,7 +6030,8 @@ init_cumulative_args (CUMULATIVE_ARGS *c
 else look for regparm information.  */
   if (fntype)
{
- if (lookup_attribute ("thiscall", TYPE_ATTRIBUTES (fntype)))
+ if (lookup_attribute ("thiscall", TYPE_ATTRIBUTES (fntype))
+ || ix86_is_msabi_thiscall (fntype))
{
  cum->nregs = 1;
  cum->fastcall = 1; /* Same first register as in fastcall.  */
@@ -9799,7 +9826,8 @@ find_drap_reg (void)
  && !lookup_attribute ("fastcall",
TYPE_ATTRIBUTES (TREE_TYPE (decl)))
  && !lookup_attribute ("thiscall",
-   TYPE_ATTRIBUTES (TREE_TYPE (decl
+   TYPE_ATTRIBUTES (TREE_TYPE (decl)))
+ && ! ix86_is_msabi_thiscall (TREE_TYPE (decl)))
return CX_REG;
   else
return DI_REG;
@@ -23249,7 +23277,8 @@ ix86_static_chain (const_tree fndecl, bo
 us with EAX for the static chain.  */
  regno = AX_REG;
}
-  else if (lookup_attribute ("thiscall", TYPE_ATTRIBUTES (fntype)))
+  else

Re: [patch i386]: Set for method-functions default calling-convention to thiscall for 32-bit msabi

2011-04-01 Thread Nathan Froyd
On Fri, Apr 01, 2011 at 07:39:13PM +0200, Kai Tietz wrote:
> this patch sets for c++ methods, which are not stdarg ones, the
> default calling-convention to thiscall for ms_abi 32-bit, as vendor
> specific compiler does.

I think it might be worthwhile to pull this pattern:

> @@ -5500,7 +5524,8 @@ ix86_function_regparm (const_tree type,
>if (lookup_attribute ("fastcall", TYPE_ATTRIBUTES (type)))
>  return 2;
>  
> -  if (lookup_attribute ("thiscall", TYPE_ATTRIBUTES (type)))
> +  if (lookup_attribute ("thiscall", TYPE_ATTRIBUTES (type))
> +  || ix86_is_msabi_thiscall (type))

into a separate function.?  That function could also be used for
negative tests like this one:

> @@ -9799,7 +9826,8 @@ find_drap_reg (void)
> && !lookup_attribute ("fastcall",
>   TYPE_ATTRIBUTES (TREE_TYPE (decl)))
> && !lookup_attribute ("thiscall",
> - TYPE_ATTRIBUTES (TREE_TYPE (decl
> + TYPE_ATTRIBUTES (TREE_TYPE (decl)))
> +   && ! ix86_is_msabi_thiscall (TREE_TYPE (decl)))

WDYT?

-Nathan


[PING] [PATCH] convert h8300 to constraints.md

2011-04-01 Thread Anatoly Sokolov

Hi.

- Original Message - 
From: "Nathan Froyd"

Sent: Tuesday, February 15, 2011 4:19 AM
Subject: [PATCH] convert h8300 to constraints.md



Tested with cross to h8300-elf (which doesn't totally build right now,
but the patch doesn't make things any worse).  OK to commit?



http://gcc.gnu.org/ml/gcc-patches/2011-02/msg00935.html

Anatoly.



Re: [patch i386]: Set for method-functions default calling-convention to thiscall for 32-bit msabi

2011-04-01 Thread Kai Tietz
2011/4/1 Nathan Froyd :
> On Fri, Apr 01, 2011 at 07:39:13PM +0200, Kai Tietz wrote:
>> this patch sets for c++ methods, which are not stdarg ones, the
>> default calling-convention to thiscall for ms_abi 32-bit, as vendor
>> specific compiler does.
>
> I think it might be worthwhile to pull this pattern:
>
>> @@ -5500,7 +5524,8 @@ ix86_function_regparm (const_tree type,
>>    if (lookup_attribute ("fastcall", TYPE_ATTRIBUTES (type)))
>>      return 2;
>>
>> -  if (lookup_attribute ("thiscall", TYPE_ATTRIBUTES (type)))
>> +  if (lookup_attribute ("thiscall", TYPE_ATTRIBUTES (type))
>> +      || ix86_is_msabi_thiscall (type))
>
> into a separate function.?  That function could also be used for
> negative tests like this one:
>
>> @@ -9799,7 +9826,8 @@ find_drap_reg (void)
>>         && !lookup_attribute ("fastcall",
>>                               TYPE_ATTRIBUTES (TREE_TYPE (decl)))
>>         && !lookup_attribute ("thiscall",
>> -                             TYPE_ATTRIBUTES (TREE_TYPE (decl
>> +                             TYPE_ATTRIBUTES (TREE_TYPE (decl)))
>> +       && ! ix86_is_msabi_thiscall (TREE_TYPE (decl)))
>
> WDYT?
>
> -Nathan
>

Nathan, good idea. I modified patch for this.

ChangeLog

2011-04-01  Kai Tietz

* i386.c (ix86_is_msabi_thiscall): New helper function.
(ix86_is_type_thiscall): New helper function.
(ix86_comp_type_attributes): Handle thiscall for method-functions
special.
(init_cumulative_args): Likewise.
(find_drap_reg): Likewise.
(ix86_static_chain): Likewise.
(x86_this_parameter): Likewise.
(x86_output_mi_thunk): Likewise.

Regards,
Kai
Index: gcc/gcc/config/i386/i386.c
===
--- gcc.orig/gcc/config/i386/i386.c 2011-04-01 18:26:53.207236300 +0200
+++ gcc/gcc/config/i386/i386.c  2011-04-01 20:08:15.344145300 +0200
@@ -5436,6 +5436,33 @@ ix86_handle_cconv_attribute (tree *node,
   return NULL_TREE;
 }
 
+/* This function checks if the method-function has default __thiscall
+   calling-convention for 32-bit msabi.
+   It returns true if TYPE is of kind METHOD_TYPE, no stdarg function,
+   and the MS_ABI 32-bit is used.  Otherwise it returns false.  */
+
+static bool
+ix86_is_msabi_thiscall (const_tree type)
+{
+  if (TARGET_64BIT || ix86_function_type_abi (type) != MS_ABI
+  || TREE_CODE (type) != METHOD_TYPE || stdarg_p (type))
+return false;
+  return true;
+}
+
+/* This function checks if the thiscall attribute is set for the TYPE,
+   or if it is an method-type with default thiscall convention.
+   It returns true if function match, otherwise false is returned.  */
+
+static bool
+ix86_is_type_thiscall (const_tree type)
+{
+  if (lookup_attribute ("thiscall", TYPE_ATTRIBUTES (type))
+  || ix86_is_msabi_thiscall (type))
+return true;
+  return false;
+}
+
 /* Return 0 if the attributes for two types are incompatible, 1 if they
are compatible, and 2 if they are nearly compatible (which causes a
warning to be generated).  */
@@ -5444,7 +5471,8 @@ static int
 ix86_comp_type_attributes (const_tree type1, const_tree type2)
 {
   /* Check for mismatch of non-default calling convention.  */
-  const char *const rtdstr = TARGET_RTD ? "cdecl" : "stdcall";
+  bool is_thiscall = ix86_is_msabi_thiscall (type1);
+  const char *const rtdstr = TARGET_RTD ? (is_thiscall ? "thiscall" : "cdecl") 
: "stdcall";
 
   if (TREE_CODE (type1) != FUNCTION_TYPE
   && TREE_CODE (type1) != METHOD_TYPE)
@@ -5463,9 +5491,18 @@ ix86_comp_type_attributes (const_tree ty
 return 0;
 
   /* Check for mismatched thiscall types.  */
-  if (!lookup_attribute ("thiscall", TYPE_ATTRIBUTES (type1))
-  != !lookup_attribute ("thiscall", TYPE_ATTRIBUTES (type2)))
-return 0;
+  if (is_thiscall && !TARGET_RTD)
+{
+  if (!lookup_attribute ("cdecl", TYPE_ATTRIBUTES (type1))
+ != !lookup_attribute ("cdecl", TYPE_ATTRIBUTES (type2)))
+   return 0;
+}
+  else if (!is_thiscall || TARGET_RTD)
+{
+  if (!lookup_attribute ("thiscall", TYPE_ATTRIBUTES (type1))
+ != !lookup_attribute ("thiscall", TYPE_ATTRIBUTES (type2)))
+   return 0;
+}
 
   /* Check for mismatched return types (cdecl vs stdcall).  */
   if (!lookup_attribute (rtdstr, TYPE_ATTRIBUTES (type1))
@@ -5500,7 +5537,7 @@ ix86_function_regparm (const_tree type,
   if (lookup_attribute ("fastcall", TYPE_ATTRIBUTES (type)))
 return 2;
 
-  if (lookup_attribute ("thiscall", TYPE_ATTRIBUTES (type)))
+  if (ix86_is_type_thiscall (type))
 return 1;
 
   /* Use register calling convention for local functions when possible.  */
@@ -5666,7 +5703,7 @@ ix86_return_pops_args (tree fundecl, tre
  variable args.  */
   if (lookup_attribute ("stdcall", TYPE_ATTRIBUTES (funtype))
  || lookup_attribute ("fastcall", TYPE_ATTRIBUTES (funtype))
-  || lookup_attribute ("thiscall", TYPE_ATTRIBUTES (funtype)))
+  || ix86_is_type_t

Re: [toplevel] remove tentative_cc

2011-04-01 Thread Ralf Wildenhues
* Joseph S. Myers wrote on Fri, Apr 01, 2011 at 07:04:30PM CEST:
> I see there's more than just tentative_cc that tries to deal with compiler 
> settings in ways that should be the responsibility of autoconf.  There's 
> the
> 
> # Make sure that the compiler is able to generate an executable.  If it
> # can't, we are probably in trouble.  We don't care whether we can run the
> # executable--we might be using a cross compiler--we only care whether it
> # can be created.  At this point the main configure script has set CC.

The first macro invoked out of the set AC_PROG_{CC,CXX,F77,FC,OBJC} will
ensure that compiling and linking a small program of the given language
works.

So this code seems unneeded.

Thanks,
Ralf


[Patch,AVR]: Fix PR45263

2011-04-01 Thread Georg-Johann Lay
This is straight forward fix for PR45263 (R20 clobbered by
constructor/destructor).

Using call-saved register like R15 is undesired because upcoming
ATtiny10 architecture.

2011-04-01  Georg-Johann Lay  

PR target/45263
* config/avr/libgcc.S (__do_global_ctors, __do_global_dtors):   
Save
R20 around calls of __tablejump_elpm__
Index: config/avr/libgcc.S
===
--- config/avr/libgcc.S	(Revision 171824)
+++ config/avr/libgcc.S	(Arbeitskopie)
@@ -802,7 +802,9 @@ __do_global_ctors:
 	mov_h	r31, r29
 	mov_l	r30, r28
 	out __RAMPZ__, r20
+	push	r20
 	XCALL	__tablejump_elpm__
+	pop	r20
 .L__do_global_ctors_start:
 	cpi	r28, lo8(__ctors_start)
 	cpc	r29, r17
@@ -843,7 +845,9 @@ __do_global_dtors:
 	mov_h	r31, r29
 	mov_l	r30, r28
 	out __RAMPZ__, r20
+	push	r20
 	XCALL	__tablejump_elpm__
+	pop	r20
 .L__do_global_dtors_start:
 	cpi	r28, lo8(__dtors_end)
 	cpc	r29, r17


Re: [PATCH], PR 48262, fix failing vector support on powerpc

2011-04-01 Thread David Edelsohn
On Thu, Mar 31, 2011 at 2:37 PM, Michael Meissner
 wrote:

> 2011-03-31  Andrew Pinski  
>            Michael Meissner  
>
>        PR target/48262
>        * config/rs6000/vector.md (movmisalign): Allow for memory
>        operands, as per the specifications.
>
>        * config/rs6000/altivec.md (vec_extract_evenv4si): Correct modes.
>        (vec_extract_evenv4sf): Ditto.
>        (vec_extract_evenv8hi): Ditto.
>        (vec_extract_evenv16qi): Ditto.
>        (vec_extract_oddv4si): Ditto.

Okay.

Thanks, David


Re: [patch i386]: Set for method-functions default calling-convention to thiscall for 32-bit msabi

2011-04-01 Thread Richard Henderson
On 04/01/2011 11:10 AM, Kai Tietz wrote:
>   * i386.c (ix86_is_msabi_thiscall): New helper function.
>   (ix86_is_type_thiscall): New helper function.
>   (ix86_comp_type_attributes): Handle thiscall for method-functions
>   special.
>   (init_cumulative_args): Likewise.
>   (find_drap_reg): Likewise.
>   (ix86_static_chain): Likewise.
>   (x86_this_parameter): Likewise.
>   (x86_output_mi_thunk): Likewise.

Ok.


r~


[wwwdocs] Buildstat update for 4.6

2011-04-01 Thread Tom G. Christensen
First round of results for the new release.

-tgc

Testresults for 4.6.0:
  alpha-dec-osf5.1b (2)
  armv7l-unknown-linux-gnueabi
  hppa2.0w-hp-hpux11.11
  hppa64-hp-hpux11.11
  i386-pc-solaris2.8 (5)
  i386-pc-solaris2.9 (3)
  i386-pc-solaris2.10 (4)
  i386-pc-solaris2.11 (4)
  i686-pc-linux-gnu (3)
  mips-sgi-irix6.5 (4)
  s390-ibm-linux-gnu
  s390x-ibm-linux-gnu
  sparc-sun-solaris2.8 (4)
  sparc-sun-solaris2.9 (3)
  sparc-sun-solaris2.10 (3)
  sparc-sun-solaris2.11 (3)
  x86_64-apple-darwin10.7.0
  x86_64-unknown-linux-gnu (2)
Index: buildstat.html
===
RCS file: /cvs/gcc/wwwdocs/htdocs/gcc-4.6/buildstat.html,v
retrieving revision 1.1
diff -u -r1.1 buildstat.html
--- buildstat.html  14 Mar 2011 13:52:00 -  1.1
+++ buildstat.html  1 Apr 2011 18:26:10 -
@@ -20,5 +20,181 @@
 http://gcc.gnu.org/install/finalinstall.html";>
 Installing GCC: Final Installation.
 
+
+
+
+alpha-dec-osf5.1b
+ 
+Test results:
+http://gcc.gnu.org/ml/gcc-testresults/2011-03/msg02726.html";>4.6.0
+http://gcc.gnu.org/ml/gcc-testresults/2011-04/msg00050.html";>4.6.0,
+
+
+
+
+armv7l-unknown-linux-gnueabi
+ 
+Test results:
+http://gcc.gnu.org/ml/gcc-testresults/2011-03/msg03105.html";>4.6.0
+
+
+
+
+hppa2.0w-hp-hpux11.11
+ 
+Test results:
+http://gcc.gnu.org/ml/gcc-testresults/2011-03/msg02630.html";>4.6.0
+
+
+
+
+hppa64-hp-hpux11.11
+ 
+Test results:
+http://gcc.gnu.org/ml/gcc-testresults/2011-03/msg02801.html";>4.6.0
+
+
+
+
+i386-pc-solaris2.8
+ 
+Test results:
+http://gcc.gnu.org/ml/gcc-testresults/2011-03/msg02713.html";>4.6.0
+http://gcc.gnu.org/ml/gcc-testresults/2011-03/msg02717.html";>4.6.0,
+http://gcc.gnu.org/ml/gcc-testresults/2011-03/msg02832.html";>4.6.0,
+http://gcc.gnu.org/ml/gcc-testresults/2011-03/msg02960.html";>4.6.0,
+http://gcc.gnu.org/ml/gcc-testresults/2011-03/msg03106.html";>4.6.0,
+
+
+
+
+i386-pc-solaris2.9
+ 
+Test results:
+http://gcc.gnu.org/ml/gcc-testresults/2011-03/msg02708.html";>4.6.0
+http://gcc.gnu.org/ml/gcc-testresults/2011-03/msg02718.html";>4.6.0,
+http://gcc.gnu.org/ml/gcc-testresults/2011-03/msg02831.html";>4.6.0,
+
+
+
+
+i386-pc-solaris2.10
+ 
+Test results:
+http://gcc.gnu.org/ml/gcc-testresults/2011-03/msg02683.html";>4.6.0
+http://gcc.gnu.org/ml/gcc-testresults/2011-03/msg02704.html";>4.6.0,
+http://gcc.gnu.org/ml/gcc-testresults/2011-03/msg02705.html";>4.6.0,
+http://gcc.gnu.org/ml/gcc-testresults/2011-03/msg02738.html";>4.6.0,
+
+
+
+
+i386-pc-solaris2.11
+ 
+Test results:
+http://gcc.gnu.org/ml/gcc-testresults/2011-03/msg02699.html";>4.6.0
+http://gcc.gnu.org/ml/gcc-testresults/2011-03/msg02702.html";>4.6.0,
+http://gcc.gnu.org/ml/gcc-testresults/2011-03/msg02741.html";>4.6.0,
+http://gcc.gnu.org/ml/gcc-testresults/2011-03/msg03084.html";>4.6.0,
+
+
+
+
+i686-pc-linux-gnu
+ 
+Test results:
+http://gcc.gnu.org/ml/gcc-testresults/2011-03/msg02753.html";>4.6.0
+http://gcc.gnu.org/ml/gcc-testresults/2011-03/msg02849.html";>4.6.0,
+http://gcc.gnu.org/ml/gcc-testresults/2011-03/msg03104.html";>4.6.0,
+
+
+
+
+mips-sgi-irix6.5
+ 
+Test results:
+http://gcc.gnu.org/ml/gcc-testresults/2011-03/msg02828.html";>4.6.0
+http://gcc.gnu.org/ml/gcc-testresults/2011-03/msg02830.html";>4.6.0,
+http://gcc.gnu.org/ml/gcc-testresults/2011-04/msg00031.html";>4.6.0,
+http://gcc.gnu.org/ml/gcc-testresults/2011-04/msg00060.html";>4.6.0,
+
+
+
+
+s390-ibm-linux-gnu
+ 
+Test results:
+http://gcc.gnu.org/ml/gcc-testresults/2011-03/msg02491.html";>4.6.0
+
+
+
+
+s390x-ibm-linux-gnu
+ 
+Test results:
+http://gcc.gnu.org/ml/gcc-testresults/2011-03/msg02513.html";>4.6.0
+
+
+
+
+sparc-sun-solaris2.8
+ 
+Test results:
+http://gcc.gnu.org/ml/gcc-testresults/2011-03/msg02712.html";>4.6.0
+http://gcc.gnu.org/ml/gcc-testresults/2011-03/msg02716.html";>4.6.0,
+http://gcc.gnu.org/ml/gcc-testresults/2011-03/msg02933.html";>4.6.0,
+http://gcc.gnu.org/ml/gcc-testresults/2011-03/msg02959.html";>4.6.0,
+
+
+
+
+sparc-sun-solaris2.9
+ 
+Test results:
+http://gcc.gnu.org/ml/gcc-testresults/2011-03/msg02721.html";>4.6.0
+http://gcc.gnu.org/ml/gcc-testresults/2011-03/msg02724.html";>4.6.0,
+http://gcc.gnu.org/ml/gcc-testresults/2011-03/msg02934.html";>4.6.0,
+
+
+
+
+sparc-sun-solaris2.10
+ 
+Test results:
+http://gcc.gnu.org/ml/gcc-testresults/2011-03/msg02714.html";>4.6.0
+http://gcc.gnu.org/ml/gcc-testresults/2011-03/msg02725.html";>4.6.0,
+http://gcc.gnu.org/ml/gcc-testresults/2011-03/msg02835.html";>4.6.0,
+
+
+
+
+sparc-sun-solaris2.11
+ 
+Test results:
+http://gcc.gnu.org/ml/gcc-testresults/2011-03/msg02710.html";>4.6.0
+http://gcc.gnu.org/ml/gcc-testresults/2011-03/msg02723.html";>4.6.0,
+http://gcc.gnu.org/ml/gcc-testresults/2011-03/msg02854.html";>4.6.0,
+
+
+
+
+x86_64-apple-darwin10.7.0
+ 
+Test results:
+http://gcc.gnu.org/ml/gcc-testresults/2011-03/msg02755.html";>4.6.0
+
+
+
+
+x86_64-unknown-linux-gnu
+ 
+Test results:
+http://gcc.gnu.org/ml/gcc-testresults/2011-03/msg02754.html";>4.6.0
+http://gcc.gnu.org/ml/gcc-testresults/2011-03/ms

Re: Try simplifying memory operands during optabs expansion

2011-04-01 Thread Richard Henderson
On 03/31/2011 03:19 AM, Richard Sandiford wrote:
>   * recog.h (insn_operand_data): Add an "allows_mem" field.
>   * genoutput.c (output_operand_data): Initialize it.
>   * optabs.c (maybe_legitimize_operand_same_code): New function.
>   (maybe_legitimize_operand): Use it when matching the original
>   op->value.

Ok, with

>old_volatile_ok = volatile_ok;
>mode = op->mode;
> -  result = false;
>switch (op->type)
>  {
>  case EXPAND_FIXED:
>volatile_ok = true;
> -  break;
> +  result = maybe_legitimize_operand_same_code (icode, opno, op);
> +  volatile_ok = old_volatile_ok;
> +  return result;

You can now move all references to volatile_ok into this case.

> +  return insn_operand_matches (icode, opno, op->value);
...
> +  return insn_operand_matches (icode, opno, op->value);
...
> +  return insn_operand_matches (icode, opno, op->value);

And leave this common call at the end of the function.


r~


Re: [patch i386]: Set for method-functions default calling-convention to thiscall for 32-bit msabi

2011-04-01 Thread Kai Tietz
2011/4/1 Richard Henderson :
> On 04/01/2011 11:10 AM, Kai Tietz wrote:
>>       * i386.c (ix86_is_msabi_thiscall): New helper function.
>>       (ix86_is_type_thiscall): New helper function.
>>       (ix86_comp_type_attributes): Handle thiscall for method-functions
>>       special.
>>       (init_cumulative_args): Likewise.
>>       (find_drap_reg): Likewise.
>>       (ix86_static_chain): Likewise.
>>       (x86_this_parameter): Likewise.
>>       (x86_output_mi_thunk): Likewise.
>
> Ok.
>
>
> r~
>

I just found a nit about thiscall default and checking of other
calling-conventions. I've updated patch in ix86_is_msabi_thiscall so
that it checks explicit for different calling-abis.
It might be a good thing to extract those call-abi lookups into a
specific function, which returns numbers for the selected on. By this
we can avoid double lookup of attributes here.
But I would like to do this in a separate patch.

Regards,
Kai
Index: gcc/gcc/config/i386/i386.c
===
--- gcc.orig/gcc/config/i386/i386.c 2011-04-01 18:26:53.207236300 +0200
+++ gcc/gcc/config/i386/i386.c  2011-04-01 20:32:34.012872700 +0200
@@ -5436,6 +5436,40 @@ ix86_handle_cconv_attribute (tree *node,
   return NULL_TREE;
 }
 
+/* This function checks if the method-function has default __thiscall
+   calling-convention for 32-bit msabi.
+   It returns true if TYPE is of kind METHOD_TYPE, no stdarg function,
+   and the MS_ABI 32-bit is used.  Otherwise it returns false.  */
+
+static bool
+ix86_is_msabi_thiscall (const_tree type)
+{
+  if (TARGET_64BIT || ix86_function_type_abi (type) != MS_ABI
+  || TREE_CODE (type) != METHOD_TYPE || stdarg_p (type))
+return false;
+  /* Check for different calling-conventions.  */
+  if (lookup_attribute ("cdecl", TYPE_ATTRIBUTES (type))
+  || lookup_attribute ("stdcall", TYPE_ATTRIBUTES (type))
+  || lookup_attribute ("fastcall", TYPE_ATTRIBUTES (type))
+  || lookup_attribute ("regparm", TYPE_ATTRIBUTES (type))
+  || lookup_attribute ("sseregparm", TYPE_ATTRIBUTES (type)))
+return false;
+  return true;
+}
+
+/* This function checks if the thiscall attribute is set for the TYPE,
+   or if it is an method-type with default thiscall convention.
+   It returns true if function match, otherwise false is returned.  */
+
+static bool
+ix86_is_type_thiscall (const_tree type)
+{
+  if (lookup_attribute ("thiscall", TYPE_ATTRIBUTES (type))
+  || ix86_is_msabi_thiscall (type))
+return true;
+  return false;
+}
+
 /* Return 0 if the attributes for two types are incompatible, 1 if they
are compatible, and 2 if they are nearly compatible (which causes a
warning to be generated).  */
@@ -5444,7 +5478,8 @@ static int
 ix86_comp_type_attributes (const_tree type1, const_tree type2)
 {
   /* Check for mismatch of non-default calling convention.  */
-  const char *const rtdstr = TARGET_RTD ? "cdecl" : "stdcall";
+  bool is_thiscall = ix86_is_msabi_thiscall (type1);
+  const char *const rtdstr = TARGET_RTD ? (is_thiscall ? "thiscall" : "cdecl") 
: "stdcall";
 
   if (TREE_CODE (type1) != FUNCTION_TYPE
   && TREE_CODE (type1) != METHOD_TYPE)
@@ -5463,9 +5498,18 @@ ix86_comp_type_attributes (const_tree ty
 return 0;
 
   /* Check for mismatched thiscall types.  */
-  if (!lookup_attribute ("thiscall", TYPE_ATTRIBUTES (type1))
-  != !lookup_attribute ("thiscall", TYPE_ATTRIBUTES (type2)))
-return 0;
+  if (is_thiscall && !TARGET_RTD)
+{
+  if (!lookup_attribute ("cdecl", TYPE_ATTRIBUTES (type1))
+ != !lookup_attribute ("cdecl", TYPE_ATTRIBUTES (type2)))
+   return 0;
+}
+  else if (!is_thiscall || TARGET_RTD)
+{
+  if (!lookup_attribute ("thiscall", TYPE_ATTRIBUTES (type1))
+ != !lookup_attribute ("thiscall", TYPE_ATTRIBUTES (type2)))
+   return 0;
+}
 
   /* Check for mismatched return types (cdecl vs stdcall).  */
   if (!lookup_attribute (rtdstr, TYPE_ATTRIBUTES (type1))
@@ -5500,7 +5544,7 @@ ix86_function_regparm (const_tree type,
   if (lookup_attribute ("fastcall", TYPE_ATTRIBUTES (type)))
 return 2;
 
-  if (lookup_attribute ("thiscall", TYPE_ATTRIBUTES (type)))
+  if (ix86_is_type_thiscall (type))
 return 1;
 
   /* Use register calling convention for local functions when possible.  */
@@ -5666,7 +5710,7 @@ ix86_return_pops_args (tree fundecl, tre
  variable args.  */
   if (lookup_attribute ("stdcall", TYPE_ATTRIBUTES (funtype))
  || lookup_attribute ("fastcall", TYPE_ATTRIBUTES (funtype))
-  || lookup_attribute ("thiscall", TYPE_ATTRIBUTES (funtype)))
+  || ix86_is_type_thiscall (funtype))
rtd = 1;
 
   if (rtd && ! stdarg_p (funtype))
@@ -6004,7 +6048,7 @@ init_cumulative_args (CUMULATIVE_ARGS *c
 else look for regparm information.  */
   if (fntype)
{
- if (lookup_attribute ("thiscall", TYPE_ATTRIBUTES (fntype)))
+ if (ix86_is_type_thiscall (fntype))
   

Re: Split up toplevel library-disabling cases

2011-04-01 Thread Michael Eager

Joseph S. Myers wrote:

This patch, relative to a tree with
 (pending
review) applied, continues toplevel configure cleanup by splitting the
disabling of some libraries into separate case statements for those
libraries.  Separating the logic like this brings things closer to the
desired state of this configuration being in fragments in
subdirectories rather than hardcoded directly in the toplevel
configure script, as well as making it easier to clean up this logic
where the directory disabling is not in fact appropriate.


This sounds like a good idea.


Target maintainers: I'd like to understand why it is necessary to
disable libssp for AVR, AIX and Microblaze


I believe that at some time in the past libssp failed to build for
MicroBlaze, but I don't recall the details.  It currently builds
without error, so disabling it for MicroBlaze is no longer needed.

--
Michael Eagerea...@eagercon.com
1960 Park Blvd., Palo Alto, CA 94306  650-325-8077


[wwwdocs] Buildstat update for 4.6

2011-04-01 Thread Tom G. Christensen
Please disregard previous patch, it had the entries in the wrong order.

First round of results for the new release.

-tgc

Testresults for 4.6.0:
  alpha-dec-osf5.1b (2)
  armv7l-unknown-linux-gnueabi
  hppa2.0w-hp-hpux11.11
  hppa64-hp-hpux11.11
  i386-pc-solaris2.8 (5)
  i386-pc-solaris2.9 (3)
  i386-pc-solaris2.10 (4)
  i386-pc-solaris2.11 (4)
  i686-pc-linux-gnu (3)
  mips-sgi-irix6.5 (4)
  s390-ibm-linux-gnu
  s390x-ibm-linux-gnu
  sparc-sun-solaris2.8 (4)
  sparc-sun-solaris2.9 (3)
  sparc-sun-solaris2.10 (3)
  sparc-sun-solaris2.11 (3)
  x86_64-apple-darwin10.7.0
  x86_64-unknown-linux-gnu (2)
Index: buildstat.html
===
RCS file: /cvs/gcc/wwwdocs/htdocs/gcc-4.6/buildstat.html,v
retrieving revision 1.1
diff -u -r1.1 buildstat.html
--- buildstat.html  14 Mar 2011 13:52:00 -  1.1
+++ buildstat.html  1 Apr 2011 18:38:47 -
@@ -20,5 +20,181 @@
 http://gcc.gnu.org/install/finalinstall.html";>
 Installing GCC: Final Installation.
 
+
+
+
+alpha-dec-osf5.1b
+ 
+Test results:
+http://gcc.gnu.org/ml/gcc-testresults/2011-04/msg00050.html";>4.6.0,
+http://gcc.gnu.org/ml/gcc-testresults/2011-03/msg02726.html";>4.6.0
+
+
+
+
+armv7l-unknown-linux-gnueabi
+ 
+Test results:
+http://gcc.gnu.org/ml/gcc-testresults/2011-03/msg03105.html";>4.6.0
+
+
+
+
+hppa2.0w-hp-hpux11.11
+ 
+Test results:
+http://gcc.gnu.org/ml/gcc-testresults/2011-03/msg02630.html";>4.6.0
+
+
+
+
+hppa64-hp-hpux11.11
+ 
+Test results:
+http://gcc.gnu.org/ml/gcc-testresults/2011-03/msg02801.html";>4.6.0
+
+
+
+
+i386-pc-solaris2.8
+ 
+Test results:
+http://gcc.gnu.org/ml/gcc-testresults/2011-03/msg03106.html";>4.6.0,
+http://gcc.gnu.org/ml/gcc-testresults/2011-03/msg02960.html";>4.6.0,
+http://gcc.gnu.org/ml/gcc-testresults/2011-03/msg02832.html";>4.6.0,
+http://gcc.gnu.org/ml/gcc-testresults/2011-03/msg02717.html";>4.6.0,
+http://gcc.gnu.org/ml/gcc-testresults/2011-03/msg02713.html";>4.6.0
+
+
+
+
+i386-pc-solaris2.9
+ 
+Test results:
+http://gcc.gnu.org/ml/gcc-testresults/2011-03/msg02831.html";>4.6.0,
+http://gcc.gnu.org/ml/gcc-testresults/2011-03/msg02718.html";>4.6.0,
+http://gcc.gnu.org/ml/gcc-testresults/2011-03/msg02708.html";>4.6.0
+
+
+
+
+i386-pc-solaris2.10
+ 
+Test results:
+http://gcc.gnu.org/ml/gcc-testresults/2011-03/msg02738.html";>4.6.0,
+http://gcc.gnu.org/ml/gcc-testresults/2011-03/msg02705.html";>4.6.0,
+http://gcc.gnu.org/ml/gcc-testresults/2011-03/msg02704.html";>4.6.0,
+http://gcc.gnu.org/ml/gcc-testresults/2011-03/msg02683.html";>4.6.0
+
+
+
+
+i386-pc-solaris2.11
+ 
+Test results:
+http://gcc.gnu.org/ml/gcc-testresults/2011-03/msg03084.html";>4.6.0,
+http://gcc.gnu.org/ml/gcc-testresults/2011-03/msg02741.html";>4.6.0,
+http://gcc.gnu.org/ml/gcc-testresults/2011-03/msg02702.html";>4.6.0,
+http://gcc.gnu.org/ml/gcc-testresults/2011-03/msg02699.html";>4.6.0
+
+
+
+
+i686-pc-linux-gnu
+ 
+Test results:
+http://gcc.gnu.org/ml/gcc-testresults/2011-03/msg03104.html";>4.6.0,
+http://gcc.gnu.org/ml/gcc-testresults/2011-03/msg02849.html";>4.6.0,
+http://gcc.gnu.org/ml/gcc-testresults/2011-03/msg02753.html";>4.6.0
+
+
+
+
+mips-sgi-irix6.5
+ 
+Test results:
+http://gcc.gnu.org/ml/gcc-testresults/2011-04/msg00060.html";>4.6.0,
+http://gcc.gnu.org/ml/gcc-testresults/2011-04/msg00031.html";>4.6.0,
+http://gcc.gnu.org/ml/gcc-testresults/2011-03/msg02830.html";>4.6.0,
+http://gcc.gnu.org/ml/gcc-testresults/2011-03/msg02828.html";>4.6.0
+
+
+
+
+s390-ibm-linux-gnu
+ 
+Test results:
+http://gcc.gnu.org/ml/gcc-testresults/2011-03/msg02491.html";>4.6.0
+
+
+
+
+s390x-ibm-linux-gnu
+ 
+Test results:
+http://gcc.gnu.org/ml/gcc-testresults/2011-03/msg02513.html";>4.6.0
+
+
+
+
+sparc-sun-solaris2.8
+ 
+Test results:
+http://gcc.gnu.org/ml/gcc-testresults/2011-03/msg02959.html";>4.6.0,
+http://gcc.gnu.org/ml/gcc-testresults/2011-03/msg02933.html";>4.6.0,
+http://gcc.gnu.org/ml/gcc-testresults/2011-03/msg02716.html";>4.6.0,
+http://gcc.gnu.org/ml/gcc-testresults/2011-03/msg02712.html";>4.6.0
+
+
+
+
+sparc-sun-solaris2.9
+ 
+Test results:
+http://gcc.gnu.org/ml/gcc-testresults/2011-03/msg02934.html";>4.6.0,
+http://gcc.gnu.org/ml/gcc-testresults/2011-03/msg02724.html";>4.6.0,
+http://gcc.gnu.org/ml/gcc-testresults/2011-03/msg02721.html";>4.6.0
+
+
+
+
+sparc-sun-solaris2.10
+ 
+Test results:
+http://gcc.gnu.org/ml/gcc-testresults/2011-03/msg02835.html";>4.6.0,
+http://gcc.gnu.org/ml/gcc-testresults/2011-03/msg02725.html";>4.6.0,
+http://gcc.gnu.org/ml/gcc-testresults/2011-03/msg02714.html";>4.6.0
+
+
+
+
+sparc-sun-solaris2.11
+ 
+Test results:
+http://gcc.gnu.org/ml/gcc-testresults/2011-03/msg02854.html";>4.6.0,
+http://gcc.gnu.org/ml/gcc-testresults/2011-03/msg02723.html";>4.6.0,
+http://gcc.gnu.org/ml/gcc-testresults/2011-03/msg02710.html";>4.6.0
+
+
+
+
+x86_64-apple-darwin10.7.0
+ 
+Test results:
+http://gcc.gnu.org/ml/gcc-testresults/2011-03/msg02755.html";>4.6.0
+
+
+
+
+x86_64-unknown-linux-gnu
+ 
+Test results:
+http://gcc.gnu.org/ml/gcc-testresults/2011-0

Re: [patch i386]: Set for method-functions default calling-convention to thiscall for 32-bit msabi

2011-04-01 Thread Richard Henderson
On 04/01/2011 11:36 AM, Kai Tietz wrote:
> It might be a good thing to extract those call-abi lookups into a
> specific function, which returns numbers for the selected on. By this
> we can avoid double lookup of attributes here.
> But I would like to do this in a separate patch.

Sure.


r~


Re: [PATCH 1/6] Disallow predicating the prologue

2011-04-01 Thread H.J. Lu
On Wed, Mar 23, 2011 at 7:45 AM, Bernd Schmidt  wrote:
> With prologues appearing in blocks other than the entry block, ifcvt can
> decide to predicate them. This is not a good idea, as dwarf2out will
> blow up trying to handle predicated frame-related things.
>

One of your changes breaks GCC bootstrap:

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=48403

-- 
H.J.


[PATCH] make CONST_DECL a direct subclass of tree_decl_common

2011-04-01 Thread Nathan Froyd
Nobody touches CONST_DECL's DECL_RTL, so there's no reason to for
CONST_DECL to inherit from tree_decl_with_rtl.  This patch adjusts the
inheritance structure accordingly.

Bootstrapped on x86_64-unknown-linux-gnu; tests in progress.  OK to
commit once those complete?

-Nathan

* tree.h (struct tree_const_decl): Inherit from tree_decl_common.
* tree.c (initialize_tree_contains_struct): Adjust accordingly.

diff --git a/gcc/tree.c b/gcc/tree.c
index 69d5ecb..3d8abee 100644
--- a/gcc/tree.c
+++ b/gcc/tree.c
@@ -439,6 +439,7 @@ initialize_tree_contains_struct (void)
  break;
 
case TS_DECL_WRTL:
+   case TS_CONST_DECL:
  MARK_TS_DECL_COMMON (code);
  break;
 
@@ -450,7 +451,6 @@ initialize_tree_contains_struct (void)
case TS_PARM_DECL:
case TS_LABEL_DECL:
case TS_RESULT_DECL:
-   case TS_CONST_DECL:
  MARK_TS_DECL_WRTL (code);
  break;
 
@@ -488,7 +488,6 @@ initialize_tree_contains_struct (void)
   gcc_assert (tree_contains_struct[TRANSLATION_UNIT_DECL][TS_DECL_COMMON]);
   gcc_assert (tree_contains_struct[LABEL_DECL][TS_DECL_COMMON]);
   gcc_assert (tree_contains_struct[FIELD_DECL][TS_DECL_COMMON]);
-  gcc_assert (tree_contains_struct[CONST_DECL][TS_DECL_WRTL]);
   gcc_assert (tree_contains_struct[VAR_DECL][TS_DECL_WRTL]);
   gcc_assert (tree_contains_struct[PARM_DECL][TS_DECL_WRTL]);
   gcc_assert (tree_contains_struct[RESULT_DECL][TS_DECL_WRTL]);
diff --git a/gcc/tree.h b/gcc/tree.h
index 9a288cb..e166ae3 100644
--- a/gcc/tree.h
+++ b/gcc/tree.h
@@ -2962,7 +2962,7 @@ struct GTY(()) tree_result_decl {
 };
 
 struct GTY(()) tree_const_decl {
-  struct tree_decl_with_rtl common;
+  struct tree_decl_common common;
 };
 
 /* For a PARM_DECL, records the data type used to pass the argument,


Re: [PATCH] convert h8300 to constraints.md

2011-04-01 Thread Richard Henderson
On 02/14/2011 04:19 PM, Nathan Froyd wrote:
> +(define_constraint "WU"
> +  "@internal"
> +  (and (match_code "mem")
> +   (match_test "satisfies_constraint_U (op)")))

Based on

-#define EXTRA_MEMORY_CONSTRAINT(C, STR) \
-  ((C) == 'W')

This one should be define_memory_constraint.

Otherwise ok.



r~


Re: Split up toplevel library-disabling cases

2011-04-01 Thread Joseph S. Myers
On Fri, 1 Apr 2011, Michael Eager wrote:

> > Target maintainers: I'd like to understand why it is necessary to
> > disable libssp for AVR, AIX and Microblaze
> 
> I believe that at some time in the past libssp failed to build for
> MicroBlaze, but I don't recall the details.  It currently builds
> without error, so disabling it for MicroBlaze is no longer needed.

Thanks.  I've applied this patch to remove that disabling and add a 
comment about why it's disabled for AVR.

Index: configure.ac
===
--- configure.ac(revision 171847)
+++ configure.ac(working copy)
@@ -483,14 +483,12 @@
 # Disable libssp for some systems.
 case "${target}" in
   avr-*-*)
+# No hosted I/O support.
 noconfigdirs="$noconfigdirs target-libssp"
 ;;
   powerpc-*-aix* | rs6000-*-aix*)
 noconfigdirs="$noconfigdirs target-libssp"
 ;;
-  microblaze*)
-noconfigdirs="$noconfigdirs target-libssp"
-;;
 esac
 
 # Disable target libiberty for some systems.
Index: ChangeLog
===
--- ChangeLog   (revision 171847)
+++ ChangeLog   (working copy)
@@ -1,5 +1,11 @@
 2011-04-01  Joseph Myers  
 
+   * configure.ac (avr-*-*): Add comment about why libssp is disabled.
+   (microblaze*): Don't disable libssp.
+   * configure: Regenerate.
+
+2011-04-01  Joseph Myers  
+
* configure.ac: Remove code setting CONFIG_SHELL, config_shell and
moveifchange.
* configure: Regenerate.
Index: configure
===
--- configure   (revision 171847)
+++ configure   (working copy)
@@ -3036,14 +3036,12 @@
 # Disable libssp for some systems.
 case "${target}" in
   avr-*-*)
+# No hosted I/O support.
 noconfigdirs="$noconfigdirs target-libssp"
 ;;
   powerpc-*-aix* | rs6000-*-aix*)
 noconfigdirs="$noconfigdirs target-libssp"
 ;;
-  microblaze*)
-noconfigdirs="$noconfigdirs target-libssp"
-;;
 esac
 
 # Disable target libiberty for some systems.

-- 
Joseph S. Myers
jos...@codesourcery.com


Re: testcase for PR c/36299

2011-04-01 Thread Joseph S. Myers
On Fri, 11 Mar 2011, Vincent Lefevre wrote:

> As asked in PR c/36299[*], here's a testcase for this PR. It checks
> the absence of warning for some valid C code, to make sure the warning
> no longer reappears in future GCC versions.
> 
> [*] http://gcc.gnu.org/bugzilla/show_bug.cgi?id=36299#c10

I'm not convinced either way about what the desired semantics should be 
about whether there is a warning, but I've committed the testcase so at 
least any future change is deliberate rather than accidental.

-- 
Joseph S. Myers
jos...@codesourcery.com


Re: [patch, fortran] Fix PR 48352 - regression with ICE with front end optimization

2011-04-01 Thread Thomas Koenig

Hi Jerry,


Regression-tested. OK for trunk?


OK.  Do you plan to open a second PR for this TODO?


Sendingfortran/ChangeLog
Sendingfortran/frontend-passes.c
Sendingtestsuite/ChangeLog
Adding testsuite/gfortran.dg/function_optimize_3.f90
Transmitting file data 
Committed revision 171849.

I have opened PR 48405 to track the issue.

Thanks for the review!

Thomas


Re: [cxx-mem-model] bitfield tests

2011-04-01 Thread Andrew Pinski
On Fri, Apr 1, 2011 at 9:24 AM, Richard Henderson  wrote:
> (1) Do we agree that all such cpus have user-level store insns with byte
>    granularity.  Honestly the only non-microcontroler I ever heard of
>    without this was the original Alpha.  Which is excluded per (0).

And SPU which is excluded per (0) based on it is not a SMP but rather
AMP as it does not share memory.

-- Pinski


Re: [PATCH 1/6] Disallow predicating the prologue

2011-04-01 Thread Bernd Schmidt
On 04/01/2011 08:59 PM, H.J. Lu wrote:
> On Wed, Mar 23, 2011 at 7:45 AM, Bernd Schmidt  
> wrote:
>> With prologues appearing in blocks other than the entry block, ifcvt can
>> decide to predicate them. This is not a good idea, as dwarf2out will
>> blow up trying to handle predicated frame-related things.
>>
> 
> One of your changes breaks GCC bootstrap:
> 
> http://gcc.gnu.org/bugzilla/show_bug.cgi?id=48403

I bootstrapped and tested on i686-linux, so it would be useful if you
could narrow it down.


Bernd



[patch, testsuite, ia64] patch for gcc.dg/mtune.c

2011-04-01 Thread Steve Ellcey
The gcc.dg/mtune.c test is failing on ia64-*-* because in addition to
the expected error message that is output it also prints out a note
about the valid values for mtune.

$ gcc -mtune=foo mtune.c
gcc: error: unrecognized argument in option '-mtune=foo'
gcc: note: valid arguments to '-mtune=' are: itanium2 mckinley

Looking into why this doesn't happen on other systems, it looks like
the difference is that IA64 uses -mtune to set an enum variable and
most (all?) the other platforms use it to set a string variable.

Since the message seems reasonable I propose to just change the test
to expect it.  The patch was tested on IA64 HP-UX and Linux.  If I
don't hear any objections I will just check it in as an obvious fix.

Steve Ellcey
s...@cup.hp.com



2011-04-01  Steve Ellcey  

* gcc.dg/mtune.c: Add expected note for target ia64-*-*.


Index: gcc.dg/mtune.c
===
--- gcc.dg/mtune.c  (revision 171815)
+++ gcc.dg/mtune.c  (working copy)
@@ -4,4 +4,5 @@
 /* { dg-error "mtune" "" { target *-*-* } 0 } */
 /* { dg-bogus "march" "" { target *-*-* } 0 } */
 /* { dg-bogus "mcpu" "" { target *-*-* } 0 } */
+/* { dg-message "note: valid arguments" "" { target ia64-*-* } 0 } */
 int i;


[PATCH] (partially) fix lto bootstrap (PR bootstrap/48148)

2011-04-01 Thread Jakub Jelinek
Hi!

richi's lto-cgraph.c change actually didn't do anything, because
DECL_ABSTRACT_ORIGIN is still NULL there, see PR for details.
This patch instead doesn't try to force dies for DECL_ABSTRACT_ORIGIN
DECL_EXTERNAL decls, as dwarf2out isn't prepared to handle them.

Bootstrapped/regtested on x86_64-linux and i686-linux,
attempted also LTO bootstrap, but it failed in other unrelated
places (x86_64 somewhere in Ada and i686 because it was trying
to emit .Ldebug_info0 twice).  I'll try to look at those later,
but this is a step forward, approved on IRC by rth.

2011-04-01  Jakub Jelinek  

PR bootstrap/48148
* dwarf2out.c (resolve_addr): Don't call force_decl_die
if DECL_EXTERNAL has non-NULL DECL_ABSTRACT_ORIGIN.

Revert:
2011-03-17  Richard Guenther  

PR bootstrap/48148
* lto-cgraph.c (input_overwrite_node): Clear the abstract
origin for decls in other ltrans units.
(input_varpool_node): Likewise.

--- gcc/dwarf2out.c.jj  2011-04-01 11:04:36.0 +0200
+++ gcc/dwarf2out.c 2011-04-01 18:08:30.864796302 +0200
@@ -23023,7 +23023,9 @@ resolve_addr (dw_die_ref die)
  {
tree tdecl = SYMBOL_REF_DECL (a->dw_attr_val.v.val_addr);
dw_die_ref tdie = lookup_decl_die (tdecl);
-   if (tdie == NULL && DECL_EXTERNAL (tdecl))
+   if (tdie == NULL
+   && DECL_EXTERNAL (tdecl)
+   && DECL_ABSTRACT_ORIGIN (tdecl) == NULL_TREE)
  {
force_decl_die (tdecl);
tdie = lookup_decl_die (tdecl);
--- gcc/lto-cgraph.c.jj 2011-03-17 16:20:09.0 +0100
+++ gcc/lto-cgraph.c2011-04-01 18:02:37.570845862 +0200
@@ -975,7 +975,6 @@ input_overwrite_node (struct lto_file_de
  || node->clone_of->decl != node->decl))
 {
   DECL_EXTERNAL (node->decl) = 1;
-  DECL_ABSTRACT_ORIGIN (node->decl) = NULL_TREE;
   TREE_STATIC (node->decl) = 0;
 }
   node->alias = bp_unpack_value (bp, 1);
@@ -1147,7 +1146,6 @@ input_varpool_node (struct lto_file_decl
   if (node->in_other_partition)
 {
   DECL_EXTERNAL (node->decl) = 1;
-  DECL_ABSTRACT_ORIGIN (node->decl) = NULL_TREE;
   TREE_STATIC (node->decl) = 0;
 }
   aliases_p = bp_unpack_value (&bp, 1);

Jakub


Re: libgo patch committed: Add timeout for tests

2011-04-01 Thread Mike Stump
On Apr 1, 2011, at 12:14 AM, Rainer Orth wrote:
> Ian Lance Taylor  writes:
> 
>> This patch to libgo adds a timeout for the libgo tests.  The default is
>> 60 seconds.  It can be changed by an argument to gotest, which would
>> normally be used as, e.g.,
>>  make GOTESTFLAGS="--timeout=120" check-target-libgo
> 
> Great, thanks.
> 
> Shouldn't the default match the DejaGnu default of 300, though?

No...  I like the idea that people trim it down to something sane.  If nothing 
else, as a way to discourage them from big stupid test cases.


Re: libgo patch committed: Add timeout for tests

2011-04-01 Thread Mike Stump
On Apr 1, 2011, at 7:21 AM, Rainer Orth wrote:
> Ian Lance Taylor  writes:
> 
>>> Shouldn't the default match the DejaGnu default of 300, though?
>> 
>> Sure, it could, but why?  If any of these tests fail to complete in a
>> minute, something is badly wrong.
> 
> Ok, I'll see how long they take on my 250 MHz R10k MIPS :-)

I'd rather slow environments and slow machines setup a scaling factor with 
which they can expand the time as needed.  So, using a rs232 port at 110 to 
download testcases, scaling_factor=1000 or so.


Re: [Patch,AVR]: Fix PR45263

2011-04-01 Thread Georg-Johann Lay
This is a better fix that does not need push/pop and does not increase 
numer of instructions.


r16 takes the role of r20, and the value formerly in r16,
i.e. hh8(__dtors_end resp. __ctors_start) is recreated as needed.

2011-04-02  Georg-Johann Lay  

PR target/45263
* config/avr/libgcc.S (__do_global_ctors, __do_global_dtors): Don't use
r20 around calls of __tablejump_elpm__
Index: libgcc.S
===
--- libgcc.S(Revision 171857)
+++ libgcc.S(Arbeitskopie)
@@ -791,22 +791,22 @@
 #if defined(__AVR_HAVE_RAMPZ__)
 __do_global_ctors:
ldi r17, hi8(__ctors_start)
-   ldi r16, hh8(__ctors_start)
ldi r28, lo8(__ctors_end)
ldi r29, hi8(__ctors_end)
-   ldi r20, hh8(__ctors_end)
+   ldi r16, hh8(__ctors_end)
rjmp.L__do_global_ctors_start
 .L__do_global_ctors_loop:
sbiwr28, 2
-   sbc r20, __zero_reg__
+   sbc r16, __zero_reg__
mov_h   r31, r29
mov_l   r30, r28
-   out __RAMPZ__, r20
+   out __RAMPZ__, r16
XCALL   __tablejump_elpm__
 .L__do_global_ctors_start:
cpi r28, lo8(__ctors_start)
cpc r29, r17
-   cpc r20, r16
+   ldi r24, hh8(__ctors_start)
+   cpc r16, r24
brne.L__do_global_ctors_loop
 #else
 __do_global_ctors:
@@ -832,22 +832,22 @@
 #if defined(__AVR_HAVE_RAMPZ__)
 __do_global_dtors:
ldi r17, hi8(__dtors_end)
-   ldi r16, hh8(__dtors_end)
ldi r28, lo8(__dtors_start)
ldi r29, hi8(__dtors_start)
-   ldi r20, hh8(__dtors_start)
+   ldi r16, hh8(__dtors_start)
rjmp.L__do_global_dtors_start
 .L__do_global_dtors_loop:
sbiwr28, 2
-   sbc r20, __zero_reg__
+   sbc r16, __zero_reg__
mov_h   r31, r29
mov_l   r30, r28
-   out __RAMPZ__, r20
+   out __RAMPZ__, r16
XCALL   __tablejump_elpm__
 .L__do_global_dtors_start:
cpi r28, lo8(__dtors_end)
cpc r29, r17
-   cpc r20, r16
+   ldi r24, hh8(__dtors_end)
+   cpc r16, r24
brne.L__do_global_dtors_loop
 #else
 __do_global_dtors:


Re: [Patch] [C++0x] Support decltype-specifier as start of nested-name-specifier. (Bug 6709)

2011-04-01 Thread Jason Merrill
Now that we're in stage 1 again, I'd like to get your decltype changes 
integrated.  Sorry I didn't respond sooner.


On 01/20/2011 11:51 AM, Adam Butcher wrote:

The attached patch attempts to resolve bug
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=6709  Allowing
decltype(expr) to appear as the start of a nested-name-specifier.

However there is something wrong.  Although it parses fine, the
resulting tree seems to be treated as if it were dependent on a template
parameter.  An additional 'typename' prefix is required to get the
desired behaviour.

Although this seems to work for many scenarios, the resulting tree
seems to be treated as dependent (in the sense of dependent on a
template parameter) even when used outside of a template.  For
instance:

   struct X {};
   struct Y { typedef X Inner; enum { E = 7 }; };
   Y y;
   decltype(y)::Inner x;  // error: 'Inner' does not name a type


It's not that it's treated as dependent; the patch to 
cp_parser_simple_type parses the nested-name-specifier, then discards it 
and doesn't rewind the input stream, so the later call to 
cp_parser_nested_name_specifier doesn't see it and it's as though the 
"decltype(y)::" didn't exist.


I think you want to arrange to skip the lower calls to 
cp_parser_global_scope_opt and cp_parser_nested_name_specifier in this case.


Do you have tests for your decltype patches?

Jason


RE: [Patch,AVR]: Fix PR45263

2011-04-01 Thread Weddington, Eric


> -Original Message-
> From: Georg-Johann Lay [mailto:a...@gjlay.de]
> Sent: Friday, April 01, 2011 4:01 PM
> To: Georg-Johann Lay
> Cc: gcc-patches@gcc.gnu.org; Denis Chertykov; Anatoly Sokolov; Weddington,
> Eric
> Subject: Re: [Patch,AVR]: Fix PR45263
> 
> This is a better fix that does not need push/pop and does not increase
> numer of instructions.
> 
> r16 takes the role of r20, and the value formerly in r16,
> i.e. hh8(__dtors_end resp. __ctors_start) is recreated as needed.
> 

Hi Johann,

Have you tested this patch against the test case in bug #45263?

Eric


Re: [libgo] Account for 32-bit fds_bits on Solaris 2

2011-04-01 Thread Ian Lance Taylor
Rainer Orth  writes:

> Ian Lance Taylor  writes:
>
>> Thanks.  I'm going to try gambling that every uses the type "long" for
>> the fds_bits array.  If so, I think this patch will work.  Bootstrapped
>> and ran Go testsuite on x86_64-unknown-linux-gnu (forcing the use of
>> select).  Committed to mainline.
>
> I fear you lost ;-)
>
> * On Solaris, it's always long (i.e. either 32 or 64-bit).
>
> * On IRIX 6.5, it's long for 32-bit and int for 64-bit (i.e. always
>   32-bit), while 64-bit long is 64-bit.
>
> * On Tru64 UNIX V5.1, it's always int (i.e. 32-bit), while long is
>   64-bit.
>
> This has to be system-dependent, I fear.

Bother.

OK, for my next attempt I committed the appended patch, in which
mksysinfo tries to guess the right type to use.  Let me know where this
fails.  Bootstrapped and ran Go testsuite on x86_64-unknown-linux-gnu.
Committed to mainline.

Ian

diff -r fa0bb5137d66 libgo/configure.ac
--- a/libgo/configure.ac	Thu Mar 31 22:09:27 2011 -0700
+++ b/libgo/configure.ac	Fri Apr 01 15:47:05 2011 -0700
@@ -417,7 +417,7 @@
   ;;
 esac
 
-AC_CHECK_HEADERS(sys/mman.h syscall.h sys/epoll.h sys/ptrace.h sys/syscall.h sys/user.h sys/utsname.h)
+AC_CHECK_HEADERS(sys/mman.h syscall.h sys/epoll.h sys/ptrace.h sys/syscall.h sys/user.h sys/utsname.h sys/select.h)
 AM_CONDITIONAL(HAVE_SYS_MMAN_H, test "$ac_cv_header_sys_mman_h" = yes)
 
 AC_CHECK_FUNCS(srandom random strerror_r strsignal wait4)
diff -r fa0bb5137d66 libgo/mksysinfo.sh
--- a/libgo/mksysinfo.sh	Thu Mar 31 22:09:27 2011 -0700
+++ b/libgo/mksysinfo.sh	Fri Apr 01 15:47:05 2011 -0700
@@ -73,6 +73,9 @@
 #if defined(HAVE_SYS_UTSNAME_H)
 #include 
 #endif
+#if defined(HAVE_SYS_SELECT_H)
+#include 
+#endif
 #include 
 EOF
 
@@ -438,4 +441,12 @@
   -e 's/_in_addr/[4]byte/g' \
 >> ${OUT}
 
+# Try to guess the type to use for fd_set.
+fd_set=`grep '^type _fd_set ' gen-sysinfo.go || true`
+fds_bits_type="_C_long"
+if test "$fd_set" != ""; then
+fds_bits_type=`echo $fd_set | sed -e 's/.*[]]\([^;]*\); }$/\1/'`
+fi
+echo "type fds_bits_type $fds_bits_type" >> ${OUT}
+
 exit $?
diff -r fa0bb5137d66 libgo/syscalls/sysfile_posix.go
--- a/libgo/syscalls/sysfile_posix.go	Thu Mar 31 22:09:27 2011 -0700
+++ b/libgo/syscalls/sysfile_posix.go	Fri Apr 01 15:47:05 2011 -0700
@@ -181,10 +181,10 @@
   return;
 }
 
-const nfdbits = unsafe.Sizeof(_C_long) * 8
+const nfdbits = unsafe.Sizeof(fds_bits_type) * 8
 
 type FdSet_t struct {
-	Fds_bits [(FD_SETSIZE + nfdbits - 1) / nfdbits]_C_long
+	Fds_bits [(FD_SETSIZE + nfdbits - 1) / nfdbits]fds_bits_type
 }
 
 func FDSet(fd int, set *FdSet_t) {


Re: [RFC PATCH, go]: Port to ALPHA arch

2011-04-01 Thread Ian Lance Taylor
On Wed, Mar 30, 2011 at 12:58 PM, Uros Bizjak  wrote:
>
> Attached ports go to ALPHA architecture.

Thanks!

Committed.


> b) alpha doesn't define "struct user_regs_struct" from which "type
> PtraceRegs" is derived. I have manually created PtraceRegs from
> pt_regs structure and patched generated libgo/sysinfo.go in build
> directory after the build broke. However - the comment from sys/user.h
> says that this file is for GDB and GDB only...

libgo uses it to support ptrace, which in effect is the same as what
gdb does.  If mksysinfo.sh is unable to provide any definition for the
structure, then the choices are either to patch up mksysinfo.sh so
that it works, or to simply define the structure in
libgo/syscalls/syscall_linux_alpha.go.  it is unlikely to change so
the latter seems acceptable if patching mksysinfo is too hard.

> c) some weird issue with double definition of "const _SOCK_NONBLOCK"
> in gen-sysinfo.go and consequently sysinfo.go.

The code in gcc/godump.c uses a hash table to keep this from
happening; I'm not sure why that is not working in this case.  Is
SOCK_NONBLOCK both a #define macro and an enum value?

> The test results from "make -k check" in libgo directory are quite 
> encouraging:

Yes.

> FAIL: cmath
> panic: runtime error: integer divide by zero or floating point error

This is peculiar--it looks like there is something systematically
causing a division by zero.  I wonder what it could be.

Ian


Re: [RFC PATCH, go]: Port to ALPHA arch - sysinfo.go fixup

2011-04-01 Thread Ian Lance Taylor
On Wed, Mar 30, 2011 at 1:12 PM, Uros Bizjak  wrote:
>
> d) The definition of "type Stat_t struct" also includes additional
> struct and this confuses compilation.

This seems like something that we could teach mksysinfo.sh to handle.
What does the struct look like in gen-sysinfo.go?

Ian


Re: [RFC PATCH, go]: Port to ALPHA arch - sysinfo.go fixup

2011-04-01 Thread Ian Lance Taylor
Rainer Orth  writes:

> I've got a similar issue on IRIX 6.5:  has
>
> struct timeval {
> #if _MIPS_SZLONG == 64
>   __int32_t :32;
> #endif
>   time_t  tv_sec; /* seconds */
>   longtv_usec;/* and microseconds */
> };
>
> which causes the 64-bit libgo build to break.

I don't immediately see why that would break anything.  For a case like
this I would expect layout_decl to turn the first field into an ordinary
non-bit-field anyhow.

What does the line for timeval look like in gen-sysinfo.go?

> It would be good to have a generic solution for this problem which will
> probably return on other platforms.

Unfortunately I have not been able to think of a generic solution.  The
basic problem is that we need to get Go representations of structures
that the libc functions use, and we need to have names for the fields
that the library can use.  The -fdump-go-spec= option can give us the Go
representations.  The trick is getting the names for the fields.

Ian


Re: support for dwarf AT_GNAT_descriptive_type

2011-04-01 Thread Eric Botcazou
>  I suppose this should wait until stage 1 reopens.

I've installed the attached slight variant after testing on x86_64-suse-linux.
The main change is the default value of LANG_HOOKS_DESCRIPTIVE_TYPE, NULL like 
other similar debug hooks.

-- 
Eric Botcazou
Index: langhooks-def.h
===
--- langhooks-def.h	(revision 171818)
+++ langhooks-def.h	(working copy)
@@ -1,6 +1,6 @@
 /* Default macros to initialize the lang_hooks data structure.
-   Copyright 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010
-   Free Software Foundation, Inc.
+   Copyright 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010,
+   2011 Free Software Foundation, Inc.
Contributed by Alexandre Oliva  
 
 This file is part of GCC.
@@ -176,6 +176,7 @@ extern tree lhd_make_node (enum tree_cod
 #define LANG_HOOKS_TYPE_HASH_EQ		NULL
 #define LANG_HOOKS_GET_ARRAY_DESCR_INFO	NULL
 #define LANG_HOOKS_GET_SUBRANGE_BOUNDS	NULL
+#define LANG_HOOKS_DESCRIPTIVE_TYPE	NULL
 #define LANG_HOOKS_RECONSTRUCT_COMPLEX_TYPE reconstruct_complex_type
 
 #define LANG_HOOKS_FOR_TYPES_INITIALIZER { \
@@ -193,6 +194,7 @@ extern tree lhd_make_node (enum tree_cod
   LANG_HOOKS_TYPE_HASH_EQ, \
   LANG_HOOKS_GET_ARRAY_DESCR_INFO, \
   LANG_HOOKS_GET_SUBRANGE_BOUNDS, \
+  LANG_HOOKS_DESCRIPTIVE_TYPE, \
   LANG_HOOKS_RECONSTRUCT_COMPLEX_TYPE \
 }
 
Index: langhooks.h
===
--- langhooks.h	(revision 171818)
+++ langhooks.h	(working copy)
@@ -1,6 +1,6 @@
 /* The lang_hooks data structure.
-   Copyright 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010
-   Free Software Foundation, Inc.
+   Copyright 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010,
+   2011 Free Software Foundation, Inc.
 
 This file is part of GCC.
 
@@ -132,6 +132,11 @@ struct lang_hooks_for_types
   /* Fill in information for the debugger about the bounds of TYPE.  */
   void (*get_subrange_bounds) (const_tree, tree *, tree *);
 
+  /* A type descriptive of TYPE's complex layout generated to help the
+ debugger to decode variable-length or self-referential constructs.
+ This is only used for the AT_GNAT_descriptive_type DWARF attribute.  */
+  tree (*descriptive_type) (const_tree);
+
   /* If we requested a pointer to a vector, build up the pointers that
  we stripped off while looking for the inner type.  Similarly for
  return values from functions.  The argument TYPE is the top of the
Index: dwarf2out.c
===
--- dwarf2out.c	(revision 171818)
+++ dwarf2out.c	(working copy)
@@ -6497,6 +6497,7 @@ static bool add_location_or_const_value_
 static bool tree_add_const_value_attribute (dw_die_ref, tree);
 static bool tree_add_const_value_attribute_for_decl (dw_die_ref, tree);
 static void add_name_attribute (dw_die_ref, const char *);
+static void add_gnat_descriptive_type_attribute (dw_die_ref, tree, dw_die_ref);
 static void add_comp_dir_attribute (dw_die_ref);
 static void add_bound_info (dw_die_ref, enum dwarf_attribute, tree);
 static void add_subscript_info (dw_die_ref, tree, bool);
@@ -7139,6 +7140,7 @@ dwarf_attr_name (unsigned int attr)
   return "DW_AT_body_begin";
 case DW_AT_body_end:
   return "DW_AT_body_end";
+
 case DW_AT_GNU_vector:
   return "DW_AT_GNU_vector";
 case DW_AT_GNU_guarded_by:
@@ -7176,6 +7178,9 @@ dwarf_attr_name (unsigned int attr)
 case DW_AT_GNU_all_source_call_sites:
   return "DW_AT_GNU_all_source_call_sites";
 
+case DW_AT_GNAT_descriptive_type:
+  return "DW_AT_GNAT_descriptive_type";
+
 case DW_AT_VMS_rtnbeg_pd_address:
   return "DW_AT_VMS_rtnbeg_pd_address";
 
@@ -12857,6 +12862,7 @@ modified_type_die (tree type, int is_con
 	   useful source coordinates anyway.  */
 	name = DECL_NAME (name);
   add_name_attribute (mod_type_die, IDENTIFIER_POINTER (name));
+  add_gnat_descriptive_type_attribute (mod_type_die, type, context_die);
 }
   /* This probably indicates a bug.  */
   else if (mod_type_die && mod_type_die->die_tag == DW_TAG_base_type)
@@ -17304,6 +17310,38 @@ add_name_attribute (dw_die_ref die, cons
 }
 }
 
+/* Retrieve the descriptive type of TYPE, if any, make sure it has a
+   DIE and attach a DW_AT_GNAT_descriptive_type attribute to the DIE
+   of TYPE accordingly.
+
+   ??? This is a temporary measure until after we're able to generate
+   regular DWARF for the complex Ada type system.  */
+
+static void 
+add_gnat_descriptive_type_attribute (dw_die_ref die, tree type,
+ dw_die_ref context_die)
+{
+  tree dtype;
+  dw_die_ref dtype_die;
+
+  if (!lang_hooks.types.descriptive_type)
+return;
+
+  dtype = lang_hooks.types.descriptive_type (type);
+  if (!dtype)
+return;
+
+  dtype_die = lookup_type_die (dtype);
+  if (!dtype_die)
+{
+  gen_type_die (dtype, context_die);
+  dtype_die = lookup_type_die (dtype);
+  gcc_assert (dt

Add ToLower .opt facility

2011-04-01 Thread Joseph S. Myers
This patch adds a ToLower .opt feature, for option arguments that are
case-insensitive and should be converted to a canonical lowercase
form.

This is relevant to at least mips, mn10300 and rx.  This patch makes
rx use it, thereby causing an existing spec that tested only for a
lowercase option form to start to work correctly with both variants
(since specs only need to match canonical options).

Bootstrapped with no regressions on x86_64-unknown-linux-gnu, and
tested building cc1 and xgcc for cross to rx-elf.  Will commit to
trunk in the absence of target maintainer objections.

2011-04-01  Joseph Myers  

* doc/options.texi (ToLower): Document.
* opt-functions.awk (switch_bit_fields): Initialize cl_tolower
field.
* opts-common.c (decode_cmdline_option): Handle cl_tolower.
* opts.h (cl_option): Add cl_tolower field.
* config/rx/rx.c (rx_handle_option): Use strcmp of -mcpu=
arguments with lowercase strings.
* config/rx/rx.opt (mcpu=): Add ToLower.
* config/rx/t-rx (MULTILIB_MATCHES): Don't handle uppercase -mcpu=
argument.

Index: gcc/doc/options.texi
===
--- gcc/doc/options.texi(revision 171804)
+++ gcc/doc/options.texi(working copy)
@@ -257,6 +257,11 @@ option handler.  @code{UInteger} should 
 @code{-falign-loops}=@var{n} are supported to make sure the saved
 options are given a full integer.
 
+@item ToLower
+The option's argument should be converted to lowercase as part of
+putting it in canonical form, and before comparing with the strings
+indicated by any @code{Enum} property.
+
 @item NoDriverArg
 For an option marked @code{Separate}, the option only takes an
 argument in the compiler proper, not in the driver.  This is for
Index: gcc/opts-common.c
===
--- gcc/opts-common.c   (revision 171804)
+++ gcc/opts-common.c   (working copy)
@@ -567,6 +567,19 @@ decode_cmdline_option (const char **argv
   if (!option_ok_for_language (option, lang_mask))
 errors |= CL_ERR_WRONG_LANG;
 
+  /* Convert the argument to lowercase if appropriate.  */
+  if (arg && option->cl_tolower)
+{
+  size_t j;
+  size_t len = strlen (arg);
+  char *arg_lower = XNEWVEC (char, len + 1);
+
+  for (j = 0; j < len; j++)
+   arg_lower[j] = TOLOWER ((unsigned char) arg[j]);
+  arg_lower[len] = 0;
+  arg = arg_lower;
+}
+
   /* If the switch takes an integer, convert it.  */
   if (arg && option->cl_uinteger)
 {
Index: gcc/opts.h
===
--- gcc/opts.h  (revision 171804)
+++ gcc/opts.h  (working copy)
@@ -96,6 +96,8 @@ struct cl_option
   BOOL_BITFIELD cl_missing_ok : 1;
   /* Argument is an integer >=0.  */
   BOOL_BITFIELD cl_uinteger : 1;
+  /* Argument should be converted to lowercase.  */
+  BOOL_BITFIELD cl_tolower : 1;
   /* Report argument with -fverbose-asm  */
   BOOL_BITFIELD cl_report : 1;
   /* Offset of field for this option in struct gcc_options, or
Index: gcc/opt-functions.awk
===
--- gcc/opt-functions.awk   (revision 171804)
+++ gcc/opt-functions.awk   (working copy)
@@ -126,6 +126,7 @@ function switch_bit_fields (flags)
  flag_init("RejectNegative", flags) \
  flag_init("JoinedOrMissing", flags) \
  flag_init("UInteger", flags) \
+ flag_init("ToLower", flags) \
  flag_init("Report", flags)
 
sub(", $", "", result)
Index: gcc/config/rx/rx.c
===
--- gcc/config/rx/rx.c  (revision 171804)
+++ gcc/config/rx/rx.c  (working copy)
@@ -2308,14 +2308,14 @@ rx_handle_option (struct gcc_options *op
   return value >= 0 && value <= 4;
 
 case OPT_mcpu_:
-  if (strcasecmp (arg, "RX610") == 0)
+  if (strcmp (arg, "rx610") == 0)
rx_cpu_type = RX610;
-  else if (strcasecmp (arg, "RX200") == 0)
+  else if (strcmp (arg, "rx200") == 0)
{
  target_flags |= MASK_NO_USE_FPU;
  rx_cpu_type = RX200;
}
-  else if (strcasecmp (arg, "RX600") != 0)
+  else if (strcmp (arg, "rx600") != 0)
warning (0, "unrecognized argument '%s' to -mcpu= option", arg);
   break;
   
Index: gcc/config/rx/rx.opt
===
--- gcc/config/rx/rx.opt(revision 171804)
+++ gcc/config/rx/rx.opt(working copy)
@@ -1,5 +1,5 @@
 ; Command line options for the Renesas RX port of GCC.
-; Copyright (C) 2008, 2009, 2010 Free Software Foundation, Inc.
+; Copyright (C) 2008, 2009, 2010, 2011 Free Software Foundation, Inc.
 ; Contributed by Red Hat.
 ;
 ; This file is part of GCC.
@@ -43,7 +43,7 @@ Enable the use of RX FPU instructions.  
 ;---
 
 mcpu=
-Target RejectNegat

Re: [patch, testsuite, ia64] patch for gcc.dg/mtune.c

2011-04-01 Thread Joseph S. Myers
On Fri, 1 Apr 2011, Steve Ellcey wrote:

> Looking into why this doesn't happen on other systems, it looks like
> the difference is that IA64 uses -mtune to set an enum variable and
> most (all?) the other platforms use it to set a string variable.

As an increasing number of targets will start using the Enum facility, it 
would be good to be able to just to accept such a note on all targets 
without requiring it.  But if that isn't possible, then this patch seems 
appropriate (and similar changes to the test will be needed for other 
targets using Enum here).

-- 
Joseph S. Myers
jos...@codesourcery.com


libgo patch committed: Sort test log files

2011-04-01 Thread Ian Lance Taylor
This patch to libgo sorts the generated libgo.sum and libgo.log files
into a consistent order.  This will make it easier to compare them over
time.  It also now reports the net and syslog tests as UNTESTED when
GCCGO_RUN_ALL_TESTS is not defined, rather than just skipping them.
Bootstrapped and ran Go testsuite on x86_64-unknown-linux-gnu.
Committed to mainline.

Ian

diff -r 3979800b637b libgo/Makefile.am
--- a/libgo/Makefile.am	Fri Apr 01 16:01:39 2011 -0700
+++ b/libgo/Makefile.am	Fri Apr 01 17:25:54 2011 -0700
@@ -1547,32 +1547,42 @@
 
 # Check a package.
 CHECK = \
-	@GC="$(GOC) -L `${PWD_COMMAND}` -L `${PWD_COMMAND}`/.libs -Wl,-R,`${PWD_COMMAND}`/.libs"; \
+	GC="$(GOC) -L `${PWD_COMMAND}` -L `${PWD_COMMAND}`/.libs -Wl,-R,`${PWD_COMMAND}`/.libs"; \
 	export GC; \
 	RUNTESTFLAGS="$(RUNTESTFLAGS)"; \
 	export RUNTESTFLAGS; \
 	MAKE="$(MAKE)"; \
 	export MAKE; \
-	rm -f $@-testlog; \
+	rm -f $@-testsum $@-testlog; \
 	prefix=`if test "$(@D)" = "regexp"; then echo regexp-test; else dirname $(@D); fi`; \
 	test "$${prefix}" != "." || prefix="$(@D)"; \
 	if test "$(use_dejagnu)" = "yes"; then \
 	  $(SHELL) $(srcdir)/testsuite/gotest --dejagnu=yes --basedir=$(srcdir) --srcdir=$(srcdir)/go/$(@D) --prefix="libgo_$${prefix}" --pkgfiles="$(go_$(subst /,_,$(@D))_files)" --testname="$(@D)" $(GOTESTFLAGS); \
 	else \
 	  if $(SHELL) $(srcdir)/testsuite/gotest --basedir=$(srcdir) --srcdir=$(srcdir)/go/$(@D) --prefix="libgo_$${prefix}" --pkgfiles="$(go_$(subst /,_,$(@D))_files)" $(GOTESTFLAGS) >>$@-testlog 2>&1; then \
+	echo "PASS: $(@D)" >> $@-testlog; \
 	echo "PASS: $(@D)"; \
-	echo "PASS: $(@D)" >> libgo.sum; \
-	echo "PASS: $(@D)" >> $@-testlog; \
-	cat $@-testlog >> libgo.log; \
+	echo "PASS: $(@D)" > $@-testsum; \
 	  else \
 	echo "FAIL: $(@D)" >> $@-testlog; \
 	cat $@-testlog; \
-	echo "FAIL: $(@D)" >> libgo.sum; \
-	cat $@-testlog >> libgo.log; \
+	echo "FAIL: $(@D)" > $@-testsum; \
 	exit 1; \
 	  fi; \
 	fi
 
+# Check a package that is only tested if GCCGO_RUN_ALL_TESTS is set.
+CHECK_ON_REQUEST = \
+	if test "$$GCCGO_RUN_ALL_TESTS" != ""; then \
+	  $(CHECK); \
+	else \
+	  rm -f $@-testsum $@-testlog; \
+	  echo "Set GCCGO_RUN_ALL_TESTS in environment to run $(@D) test" > $@-testlog; \
+	  echo "UNTESTED: $(@D)" >> $@-testlog; \
+	  echo "UNTESTED: $(@D)"; \
+	  echo "UNTESTED: $(@D)" > $@-testsum; \
+	fi
+
 # Build all packages before checking any.
 CHECK_DEPS = libgo.la libgobegin.a \
 	$(toolexeclibgo_DATA) \
@@ -1603,19 +1613,19 @@
 		strconv.gox strings.gox time.gox
 	$(BUILDPACKAGE)
 asn1/check: $(CHECK_DEPS)
-	$(CHECK)
+	@$(CHECK)
 .PHONY: asn1/check
 
 big/big.lo: $(go_big_files) fmt.gox rand.gox strings.gox os.gox
 	$(BUILDPACKAGE)
 big/check: $(CHECK_DEPS)
-	$(CHECK)
+	@$(CHECK)
 .PHONY: big/check
 
 bufio/bufio.lo: $(go_bufio_files) bytes.gox io.gox os.gox strconv.gox utf8.gox
 	$(BUILDPACKAGE)
 bufio/check: $(CHECK_DEPS)
-	$(CHECK)
+	@$(CHECK)
 .PHONY: bufio/check
 
 bytes/bytes.lo: $(go_bytes_files) io.gox os.gox unicode.gox utf8.gox
@@ -1623,52 +1633,52 @@
 bytes/index.lo: $(go_bytes_c_files) bytes/bytes.lo
 	$(LTCOMPILE) -c -o bytes/index.lo $(srcdir)/go/bytes/indexbyte.c
 bytes/check: $(CHECK_DEPS)
-	$(CHECK)
+	@$(CHECK)
 .PHONY: bytes/check
 
 cmath/cmath.lo: $(go_cmath_files) math.gox
 	$(BUILDPACKAGE)
 cmath/check: $(CHECK_DEPS)
-	$(CHECK)
+	@$(CHECK)
 .PHONY: cmath/check
 
 crypto/crypto.lo: $(go_crypto_files) hash.gox
 	$(BUILDPACKAGE)
 crypto/check: $(CHECK_DEPS)
-	$(CHECK)
+	@$(CHECK)
 .PHONY: crypto/check
 
 ebnf/ebnf.lo: $(go_ebnf_files) container/vector.gox go/scanner.gox \
 		go/token.gox os.gox strconv.gox unicode.gox utf8.gox
 	$(BUILDPACKAGE)
 ebnf/check: $(CHECK_DEPS)
-	$(CHECK)
+	@$(CHECK)
 .PHONY: ebnf/check
 
 exec/exec.lo: $(go_exec_files) os.gox strconv.gox strings.gox
 	$(BUILDPACKAGE)
 exec/check: $(CHECK_DEPS)
-	$(CHECK)
+	@$(CHECK)
 .PHONY: exec/check
 
 expvar/expvar.lo: $(go_expvar_files) bytes.gox fmt.gox http.gox json.gox \
 		log.gox os.gox runtime.gox strconv.gox sync.gox
 	$(BUILDPACKAGE)
 expvar/check: $(CHECK_DEPS)
-	$(CHECK)
+	@$(CHECK)
 .PHONY: expvar/check
 
 flag/flag.lo: $(go_flag_files) fmt.gox os.gox strconv.gox
 	$(BUILDPACKAGE)
 flag/check: $(CHECK_DEPS)
-	$(CHECK)
+	@$(CHECK)
 .PHONY: flag/check
 
 fmt/fmt.lo: $(go_fmt_files) bytes.gox io.gox math.gox os.gox reflect.gox \
 		strconv.gox strings.gox unicode.gox utf8.gox
 	$(BUILDPACKAGE)
 fmt/check: $(CHECK_DEPS)
-	$(CHECK)
+	@$(CHECK)
 .PHONY: fmt/check
 
 gob/gob.lo: $(go_gob_files) bufio.gox bytes.gox fmt.gox io.gox math.gox \
@@ -1676,20 +1686,20 @@
 		unicode.gox utf8.gox
 	$(BUILDPACKAGE)
 gob/check: $(CHECK_DEPS)
-	$(CHECK)
+	@$(CHECK)
 .PHONY: gob/check
 
 hash/hash.lo: $(go_hash_files) io.gox
 	$(BUILDPACKAGE)
 hash/check: $(CHECK_DEPS)
-	$(CHECK)
+	@$(CHECK)
 .PHONY: hash/check
 
 html/html.lo: $(go_html_files) bytes.gox io.gox os.gox strconv.gox strings.gox \
 		utf8.gox
 	$(BUILDPACKAGE)
 html/check: $(CHECK_DEPS)
-	$(CHECK)
+	@$(CHEC

Re: Scheduler cleanups, 1/N

2011-04-01 Thread H.J. Lu
On Thu, Mar 24, 2011 at 6:07 AM, Bernd Schmidt  wrote:
> I have a number of patches that will be necessary for a new target. Some
> of these can be applied now as cleanups, so I'm submit them now.
>
> This changes the schedule_block main loop not to move instructions while
> computing the schedule. Instead, we collect them in a VEC and modify the
> RTL afterwards. The real motivation for this is to add support for
> backtracking later.
>
> Bootstrapped and tested on i686-linux. No changes in generated code on
> any of my testcases.
>

This caused:

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=48403

-- 
H.J.


patch to solve PR48380

2011-04-01 Thread Vladimir Makarov
The following patch is to solve the PR.  The reason for the problem is 
described on


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=48380

I also found some problem with function fix_reg_equiv_init (it calls 
grow_reg_equivs) whose code is never executed anymore because 
grow_reg_equivs is called before fix_reg_equiv_init now.  I fixed that, 
please see all difference for file ira.c


Ok to commit if the patch is successfully bootstrapped on x86_64 and x86 
with H.J.'s tester parameters (unfortunately right now I can not check 
my patch because a recent patch resulted in a bootstrap failure).


2011-04-01  Vladimir Makarov 

PR target/48380
* ira.c (ira): Call grow_reg_equivs when fix_reg_equiv_init is
  not called.

* ira-emit.c (emit_move_list): Update reg equiv init insn list.

Index: ira.c
===
--- ira.c   (revision 171852)
+++ ira.c   (working copy)
@@ -3657,8 +3657,6 @@ ira (FILE *f)
   if (delete_trivially_dead_insns (get_insns (), max_reg_num ()))
 df_analyze ();
 
-  grow_reg_equivs ();
-
   if (max_regno != max_regno_before_ira)
 {
   regstat_free_n_sets_and_refs ();
@@ -3667,10 +3665,10 @@ ira (FILE *f)
   regstat_compute_ri ();
 }
 
-  allocate_initial_values (reg_equivs);
-
   overall_cost_before = ira_overall_cost;
-  if (ira_conflicts_p)
+  if (! ira_conflicts_p)
+grow_reg_equivs ();
+  else
 {
   fix_reg_equiv_init ();
 
@@ -3686,6 +3684,7 @@ ira (FILE *f)
   memset (ira_spilled_reg_stack_slots, 0,
  max_regno * sizeof (struct ira_spilled_reg_stack_slot));
 }
+  allocate_initial_values (reg_equivs);
 
   timevar_pop (TV_IRA);
 
Index: ira-emit.c
===
--- ira-emit.c  (revision 171852)
+++ ira-emit.c  (working copy)
@@ -900,8 +900,8 @@ modify_move_list (move_t list)
 static rtx
 emit_move_list (move_t list, int freq)
 {
-  int cost;
-  rtx result, insn;
+  int cost, regno;
+  rtx result, insn, set, to;
   enum machine_mode mode;
   enum reg_class aclass;
 
@@ -913,12 +913,34 @@ emit_move_list (move_t list, int freq)
  allocno_emit_reg (list->from));
   list->insn = get_insns ();
   end_sequence ();
-  /* The reload needs to have set up insn codes.  If the reload
-sets up insn codes by itself, it may fail because insns will
-have hard registers instead of pseudos and there may be no
-machine insn with given hard registers.  */
   for (insn = list->insn; insn != NULL_RTX; insn = NEXT_INSN (insn))
-   recog_memoized (insn);
+   {
+ /* The reload needs to have set up insn codes.  If the
+reload sets up insn codes by itself, it may fail because
+insns will have hard registers instead of pseudos and
+there may be no machine insn with given hard
+registers.  */
+ recog_memoized (insn);
+ /* Add insn to equiv init insn list if it is necessary.
+Otherwise reload will not remove this insn if it decides
+to use the equivalence.  */
+ if ((set = single_set (insn)) != NULL_RTX)
+   {
+ to = SET_DEST (set);
+ if (GET_CODE (to) == SUBREG)
+   to = SUBREG_REG (to);
+ ira_assert (REG_P (to));
+ regno =  REGNO (to);
+ if (regno >= ira_reg_equiv_len
+ || (! ira_reg_equiv_invariant_p[regno]
+ && ira_reg_equiv_const[regno] == NULL_RTX))
+   continue; /* regno has no equivalence.  */
+ ira_assert (VEC_length (reg_equivs_t, reg_equivs)
+ >= ira_reg_equiv_len);
+ reg_equiv_init (regno)
+   = gen_rtx_INSN_LIST (VOIDmode, insn, reg_equiv_init (regno));
+   }
+   }
   emit_insn (list->insn);
   mode = ALLOCNO_MODE (list->to);
   aclass = ALLOCNO_CLASS (list->to);


[x32] PR target/47744: [x32] ICE: in reload_cse_simplify_operands, at postreload.c:403

2011-04-01 Thread H.J. Lu
I checked in this patch.

H.J.
---
commit 230fad69a62607b1845bc04f4b33bdad398cc4e4
Author: H.J. Lu 
Date:   Thu Mar 17 18:26:35 2011 -0700

Add ZERO_EXTEND PLUS base support to ix86_simplify_base_disp.

diff --git a/gcc/ChangeLog.x32 b/gcc/ChangeLog.x32
index 6d5eda6..8dd7196 100644
--- a/gcc/ChangeLog.x32
+++ b/gcc/ChangeLog.x32
@@ -1,3 +1,9 @@
+2011-03-17  H.J. Lu  
+
+   PR target/47744
+   * config/i386/i386.c (ix86_simplify_base_disp): Add ZERO_EXTEND
+   PLUS base support.
+
 2011-03-16  H.J. Lu  
 
PR rtl-optimization/48155
diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c
index fd49865..73ce73a 100644
--- a/gcc/config/i386/i386.c
+++ b/gcc/config/i386/i386.c
@@ -11637,6 +11637,19 @@ ix86_live_on_entry (bitmap regs)
  (reg/f:SI 7 sp))
 (const_int [CONST1 + CONST2])))
 
+   We also translate
+
+   (plus:DI (zero_extend:DI (plus:SI (plus:SI (reg:SI 4 si [70])
+ (reg:SI 2 cx [86]))
+(const_int CONST1)))
+   (const_int CONST2))
+
+   into
+
+   (plus:DI (zero_extend:DI (plus:SI (reg:SI 4 si [70])
+(reg:SI 2 cx [86]))
+   (const_int [CONST1 + CONST2])))
+
If PLUS is true, we also translate
 
(set (reg:SI 40 r11)
@@ -11678,7 +11691,13 @@ ix86_simplify_base_disp (rtx *base_p, rtx *disp_p, 
bool plus)
   rtx op1 = XEXP (base, 1);
   rtx addend;
 
-  if (REG_P (op0) && CONST_INT_P (op1))
+  if ((REG_P (op0)
+  || (!plus
+  && GET_CODE (op0) == PLUS
+  && GET_MODE (op0) == ptr_mode
+  && REG_P (XEXP (op0, 0))
+  && REG_P (XEXP (op0, 1
+ && CONST_INT_P (op1))
{
  base = op0;
  addend = op1;
@@ -11717,7 +11736,12 @@ ix86_simplify_base_disp (rtx *base_p, rtx *disp_p, 
bool plus)
*disp_p = GEN_INT (INTVAL (disp) + INTVAL (addend));
 
   if (!plus)
-   *base_p = gen_rtx_REG (ptr_mode, REGNO (base));
+   {
+ if (REG_P (base))
+   *base_p = gen_rtx_REG (ptr_mode, REGNO (base));
+ else
+   *base_p = base;
+   }
 }
 }
 


Re: PATCH: copy_addr_to_reg: Convert to Pmode if needed

2011-04-01 Thread H.J. Lu
On Mon, Mar 21, 2011 at 9:05 AM, Richard Sandiford
 wrote:
> "H.J. Lu"  writes:
>> diff --git a/gcc/explow.c b/gcc/explow.c
>> index 460af1f..9b3c082 100644
>> --- a/gcc/explow.c
>> +++ b/gcc/explow.c
>> @@ -611,6 +611,8 @@ copy_to_reg (rtx x)
>>  rtx
>>  copy_addr_to_reg (rtx x)
>>  {
>> +  if (GET_MODE (x) != VOIDmode && GET_MODE (x) != Pmode)
>> +    x = convert_to_mode (Pmode, x, 1);
>>    return copy_to_mode_reg (Pmode, x);
>>  }
>
> I think you need to say why the conversion should be done here
> rather than in the caller.
>
> Regardless of that, though: I think this should be convert_memory_address
> rather than convert_to_mode.  Paasing 1 is wrong, because pointers are
> signed on some targets.
>
> Richard
>

I checked in this patch instead.

-- 
H.J.
---
commit be4544a925b433d8638be0ca42d2156ceb23cad9
Author: H.J. Lu 
Date:   Mon Mar 21 09:52:00 2011 -0700

Call convert_memory_address in ix86_expand_builtin.

diff --git a/gcc/ChangeLog.x32 b/gcc/ChangeLog.x32
index 86e4425..fa9d384 100644
--- a/gcc/ChangeLog.x32
+++ b/gcc/ChangeLog.x32
@@ -1,6 +1,12 @@
 2011-03-21  H.J. Lu  

PR target/48084
+   * config/i386/i386.c (ix86_expand_builtin): Call
+   convert_memory_address.
+
+2011-03-21  H.J. Lu  
+
+   PR target/48084
* explow.c (copy_addr_to_reg): Don't convert to Pmode here.

 2011-03-17  H.J. Lu  
diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c
index 73ce73a..4ac335f 100644
--- a/gcc/config/i386/i386.c
+++ b/gcc/config/i386/i386.c
@@ -27790,7 +27790,10 @@ rdrand_step:
   arg0 = CALL_EXPR_ARG (exp, 0);
   op1 = expand_normal (arg0);
   if (!address_operand (op1, VOIDmode))
-   op1 = copy_addr_to_reg (op1);
+   {
+ op1 = convert_memory_address (Pmode, op1);
+ op1 = copy_addr_to_reg (op1);
+   }
   emit_move_insn (gen_rtx_MEM (mode0, op1), op0);
   return target;


[PATCH] start a gitignore

2011-04-01 Thread Mike Frysinger
I committed this to the sourceware repo a while ago before I was made
aware of the top level needing to be kept in sync with gcc.  So this
syncs that commit from sourceware CVS to gcc SVN.

---
 .gitignore |   40 
 ChangeLog  |4 
 2 files changed, 44 insertions(+), 0 deletions(-)
 create mode 100644 .gitignore

diff --git a/.gitignore b/.gitignore
new file mode 100644
index 000..dc1bf3f
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,40 @@
+*.diff
+*.patch
+*.orig
+*.rej
+
+*~
+*.a
+*.flt
+*.gdb
+*.gmo
+*.info
+*.la
+*.lo
+*.o
+*.tmp
+
+.deps
+.libs
+
+autom4te.cache
+config.cache
+config.h
+config.intl
+config.log
+config.status
+libtool
+Makefile
+stamp-*
+POTFILES
+*-POTFILES
+*/po/Makefile.in
+
+.gdbinit
+.gdb_history
+core
+
+lost+found
+
+*.log
+*.sum
diff --git a/ChangeLog b/ChangeLog
index f97c1ab..22c8fc5 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2010-11-17  Mike Frysinger  
+
+   * .gitignore: New file.
+
 2010-11-05  Michael Eager  
 
* COPYING.LIBGLOSS: Correct typo in microblaze.
-- 
1.7.4.1



Re: [x32] PR target/47744: [x32] ICE: in reload_cse_simplify_operands, at postreload.c:403

2011-04-01 Thread H.J. Lu
On Fri, Apr 1, 2011 at 10:30 PM, H.J. Lu  wrote:
> I checked in this patch.
>
> H.J.
> ---
> commit 230fad69a62607b1845bc04f4b33bdad398cc4e4
> Author: H.J. Lu 
> Date:   Thu Mar 17 18:26:35 2011 -0700
>
>    Add ZERO_EXTEND PLUS base support to ix86_simplify_base_disp.
>
> diff --git a/gcc/ChangeLog.x32 b/gcc/ChangeLog.x32
> index 6d5eda6..8dd7196 100644
> --- a/gcc/ChangeLog.x32
> +++ b/gcc/ChangeLog.x32
> @@ -1,3 +1,9 @@
> +2011-03-17  H.J. Lu  
> +
> +       PR target/47744
> +       * config/i386/i386.c (ix86_simplify_base_disp): Add ZERO_EXTEND
> +       PLUS base support.
> +
>  2011-03-16  H.J. Lu  
>
>        PR rtl-optimization/48155

Another patch.

-- 
H.J.
---
commit 44ae6b13b2d1ce6823b470db6a484d35fbb7e8bc
Author: H.J. Lu 
Date:   Mon Mar 28 21:18:46 2011 -0700

Add symbol plus constant support.

diff --git a/gcc/ChangeLog.x32 b/gcc/ChangeLog.x32
index d28d87d..b75b2b5 100644
--- a/gcc/ChangeLog.x32
+++ b/gcc/ChangeLog.x32
@@ -1,5 +1,11 @@
 2011-03-28  H.J. Lu  

+   PR target/47744
+   * config/i386/i386.c (ix86_simplify_base_disp): Add symbol plus
+   constant support.
+
+2011-03-28  H.J. Lu  
+
PR rtl-optimization/47958
* reload.c (find_reloads): Don't put symbol reference in memory
in ptr_mode.
diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c
index 4b719fd..d7a5c02 100644
--- a/gcc/config/i386/i386.c
+++ b/gcc/config/i386/i386.c
@@ -11659,6 +11659,20 @@ ix86_live_on_entry (bitmap regs)
 (reg:SI 2 cx [86]))
(const_int [CONST1 + CONST2])))

+   We also translate
+
+   (plus:SI (plus:SI (plus:SI (reg:SI 4 si [70])
+ (reg:SI 2 cx [86]))
+(symbol_ref:SI ("A.193.2210")))
+   (const_int CONST))
+
+   into
+
+   (plus:SI (plus:SI (reg:SI 4 si [70])
+(reg:SI 2 cx [86]))
+   (const (plus:SI (symbol_ref:SI ("A.193.2210"))
+   (const_int CONST
+
If PLUS is true, we also translate

(set (reg:SI 40 r11)
@@ -11706,12 +11720,17 @@ ix86_simplify_base_disp (rtx *base_p, rtx
*disp_p, bool plus)
   && GET_MODE (op0) == ptr_mode
   && REG_P (XEXP (op0, 0))
   && REG_P (XEXP (op0, 1
- && CONST_INT_P (op1))
+ && (CONST_INT_P (op1)
+ || GET_CODE (op1) == SYMBOL_REF
+ || GET_CODE (op1) == LABEL_REF))
{
  base = op0;
  addend = op1;
}
-  else if (REG_P (op1) && CONST_INT_P (op0))
+  else if (REG_P (op1)
+  && (CONST_INT_P (op0)
+  || GET_CODE (op0) == SYMBOL_REF
+  || GET_CODE (op0) == LABEL_REF))
{
  base = op1;
  addend = op0;
@@ -11742,7 +11761,15 @@ ix86_simplify_base_disp (rtx *base_p, rtx
*disp_p, bool plus)
   if (disp == NULL_RTX || disp == const0_rtx)
*disp_p = addend;
   else
-   *disp_p = GEN_INT (INTVAL (disp) + INTVAL (addend));
+   {
+ if (CONST_INT_P (addend))
+   *disp_p = GEN_INT (INTVAL (disp) + INTVAL (addend));
+ else
+   {
+ disp = gen_rtx_PLUS (ptr_mode, addend, disp);
+ *disp_p = gen_rtx_CONST (ptr_mode, disp);
+   }
+   }

   if (!plus)
{


Re: [google] Add testcase for relative paths for FDO (issue4354042)

2011-04-01 Thread Diego Novillo
On Fri, Apr 1, 2011 at 19:37, Martin Thuresson  wrote:

> 2011-04-01  Martin Thuresson  
>
>        PR gcov-profile/47793
>        * gcc/testsuite/gcc.dg/pr47793.c: New test

OK.


Diego.