diff mbox

Strength reduction part 3 of 4: candidates with unknown strides

Message ID CAMe9rOrEx8vh7Rk1Oepz_bCUXp0ywopF=FQJz9JjQ=BY8yMJNw@mail.gmail.com
State New
Headers show

Commit Message

H.J. Lu Aug. 8, 2012, 10:25 p.m. UTC
On Wed, Aug 1, 2012 at 10:36 AM, William J. Schmidt
<wschmidt@linux.vnet.ibm.com> wrote:
> Greetings,
>
> Thanks for the review of part 2!  Here's another chunk of the SLSR code
> (I feel I owe you a few beers at this point).  This performs analysis
> and replacement on groups of related candidates having an SSA name
> (rather than a constant) for a stride.
>
> This leaves only the conditional increment (CAND_PHI) case, which will
> be handled in the last patch of the series.
>
> Bootstrapped and tested on powerpc64-unknown-linux-gnu with no new
> regressions.  Ok for trunk?
>
> Thanks,
> Bill
>
>
> gcc:
>
> 2012-08-01  Bill Schmidt  <wschmidt@linux.ibm.com>
>
>         * gimple-ssa-strength-reduction.c (struct incr_info_d): New struct.
>         (incr_vec): New static var.
>         (incr_vec_len): Likewise.
>         (address_arithmetic_p): Likewise.
>         (stmt_cost): Remove dead assignment.
>         (dump_incr_vec): New function.
>         (cand_abs_increment): Likewise.
>         (lazy_create_slsr_reg): Likewise.
>         (incr_vec_index): Likewise.
>         (count_candidates): Likewise.
>         (record_increment): Likewise.
>         (record_increments): Likewise.
>         (unreplaced_cand_in_tree): Likewise.
>         (optimize_cands_for_speed_p): Likewise.
>         (lowest_cost_path): Likewise.
>         (total_savings): Likewise.
>         (analyze_increments): Likewise.
>         (ncd_for_two_cands): Likewise.
>         (nearest_common_dominator_for_cands): Likewise.
>         (profitable_increment_p): Likewise.
>         (insert_initializers): Likewise.
>         (introduce_cast_before_cand): Likewise.
>         (replace_rhs_if_not_dup): Likewise.
>         (replace_one_candidate): Likewise.
>         (replace_profitable_candidates): Likewise.
>         (analyze_candidates_and_replace): Handle candidates with SSA-name
>         strides.
>
> gcc/testsuite:
>
> 2012-08-01  Bill Schmidt  <wschmidt@linux.ibm.com>
>
>         * gcc.dg/tree-ssa/slsr-5.c: New.
>         * gcc.dg/tree-ssa/slsr-6.c: New.
>         * gcc.dg/tree-ssa/slsr-7.c: New.
>         * gcc.dg/tree-ssa/slsr-8.c: New.
>         * gcc.dg/tree-ssa/slsr-9.c: New.
>         * gcc.dg/tree-ssa/slsr-10.c: New.
>         * gcc.dg/tree-ssa/slsr-11.c: New.
>         * gcc.dg/tree-ssa/slsr-12.c: New.
>         * gcc.dg/tree-ssa/slsr-13.c: New.
>         * gcc.dg/tree-ssa/slsr-14.c: New.
>         * gcc.dg/tree-ssa/slsr-15.c: New.
>         * gcc.dg/tree-ssa/slsr-16.c: New.
>         * gcc.dg/tree-ssa/slsr-17.c: New.
>         * gcc.dg/tree-ssa/slsr-18.c: New.
>         * gcc.dg/tree-ssa/slsr-19.c: New.
>         * gcc.dg/tree-ssa/slsr-20.c: New.
>         * gcc.dg/tree-ssa/slsr-21.c: New.
>         * gcc.dg/tree-ssa/slsr-22.c: New.
>         * gcc.dg/tree-ssa/slsr-23.c: New.
>         * gcc.dg/tree-ssa/slsr-24.c: New.
>         * gcc.dg/tree-ssa/slsr-25.c: New.
>         * gcc.dg/tree-ssa/slsr-26.c: New.
>         * gcc.dg/tree-ssa/slsr-30.c: New.
>         * gcc.dg/tree-ssa/slsr-31.c: New.
>
>

Comments

Andrew Pinski Aug. 8, 2012, 10:27 p.m. UTC | #1
On Wed, Aug 8, 2012 at 3:25 PM, H.J. Lu <hjl.tools@gmail.com> wrote:
> On Wed, Aug 1, 2012 at 10:36 AM, William J. Schmidt
> <wschmidt@linux.vnet.ibm.com> wrote:
>> Greetings,
>>
>> Thanks for the review of part 2!  Here's another chunk of the SLSR code
>> (I feel I owe you a few beers at this point).  This performs analysis
>> and replacement on groups of related candidates having an SSA name
>> (rather than a constant) for a stride.
>>
>> This leaves only the conditional increment (CAND_PHI) case, which will
>> be handled in the last patch of the series.
>>
>> Bootstrapped and tested on powerpc64-unknown-linux-gnu with no new
>> regressions.  Ok for trunk?
>>
>> Thanks,
>> Bill
>>
>>
>> gcc:
>>
>> 2012-08-01  Bill Schmidt  <wschmidt@linux.ibm.com>
>>
>>         * gimple-ssa-strength-reduction.c (struct incr_info_d): New struct.
>>         (incr_vec): New static var.
>>         (incr_vec_len): Likewise.
>>         (address_arithmetic_p): Likewise.
>>         (stmt_cost): Remove dead assignment.
>>         (dump_incr_vec): New function.
>>         (cand_abs_increment): Likewise.
>>         (lazy_create_slsr_reg): Likewise.
>>         (incr_vec_index): Likewise.
>>         (count_candidates): Likewise.
>>         (record_increment): Likewise.
>>         (record_increments): Likewise.
>>         (unreplaced_cand_in_tree): Likewise.
>>         (optimize_cands_for_speed_p): Likewise.
>>         (lowest_cost_path): Likewise.
>>         (total_savings): Likewise.
>>         (analyze_increments): Likewise.
>>         (ncd_for_two_cands): Likewise.
>>         (nearest_common_dominator_for_cands): Likewise.
>>         (profitable_increment_p): Likewise.
>>         (insert_initializers): Likewise.
>>         (introduce_cast_before_cand): Likewise.
>>         (replace_rhs_if_not_dup): Likewise.
>>         (replace_one_candidate): Likewise.
>>         (replace_profitable_candidates): Likewise.
>>         (analyze_candidates_and_replace): Handle candidates with SSA-name
>>         strides.
>>
>> gcc/testsuite:
>>
>> 2012-08-01  Bill Schmidt  <wschmidt@linux.ibm.com>
>>
>>         * gcc.dg/tree-ssa/slsr-5.c: New.
>>         * gcc.dg/tree-ssa/slsr-6.c: New.
>>         * gcc.dg/tree-ssa/slsr-7.c: New.
>>         * gcc.dg/tree-ssa/slsr-8.c: New.
>>         * gcc.dg/tree-ssa/slsr-9.c: New.
>>         * gcc.dg/tree-ssa/slsr-10.c: New.
>>         * gcc.dg/tree-ssa/slsr-11.c: New.
>>         * gcc.dg/tree-ssa/slsr-12.c: New.
>>         * gcc.dg/tree-ssa/slsr-13.c: New.
>>         * gcc.dg/tree-ssa/slsr-14.c: New.
>>         * gcc.dg/tree-ssa/slsr-15.c: New.
>>         * gcc.dg/tree-ssa/slsr-16.c: New.
>>         * gcc.dg/tree-ssa/slsr-17.c: New.
>>         * gcc.dg/tree-ssa/slsr-18.c: New.
>>         * gcc.dg/tree-ssa/slsr-19.c: New.
>>         * gcc.dg/tree-ssa/slsr-20.c: New.
>>         * gcc.dg/tree-ssa/slsr-21.c: New.
>>         * gcc.dg/tree-ssa/slsr-22.c: New.
>>         * gcc.dg/tree-ssa/slsr-23.c: New.
>>         * gcc.dg/tree-ssa/slsr-24.c: New.
>>         * gcc.dg/tree-ssa/slsr-25.c: New.
>>         * gcc.dg/tree-ssa/slsr-26.c: New.
>>         * gcc.dg/tree-ssa/slsr-30.c: New.
>>         * gcc.dg/tree-ssa/slsr-31.c: New.
>>
>>
> ======================================
>> --- gcc/testsuite/gcc.dg/tree-ssa/slsr-30.c     (revision 0)
>> +++ gcc/testsuite/gcc.dg/tree-ssa/slsr-30.c     (revision 0)
>> @@ -0,0 +1,25 @@
>> +/* Verify straight-line strength reduction fails for simple integer addition
>> +   with casts thrown in when -fwrapv is used.  */
>> +
>> +/* { dg-do compile } */
>> +/* { dg-options "-O3 -fdump-tree-dom2 -fwrapv" } */
>> +/* { dg-skip-if "" { ilp32 } { "-m32" } { "" } } */
>> +
>
> This doesn't work on x32 nor Linux/ia32 since -m32
> may not be needed for ILP32.  This patch works for
> me.  OK to install?

This also does not work for mips64 where the options are either
-mabi=32 or -mabi=n32 for ILP32.

HJL's patch looks correct.

Thanks,
Andrew

>
> Thanks.
>
>
> --
> H.J.
> ---
>        * gcc.dg/tree-ssa/slsr-30.c: Require non-ilp32.  Remove
>        dg-skip-if.
>
> diff --git a/gcc/testsuite/gcc.dg/tree-ssa/slsr-30.c b/gcc/testsuite/gcc.dg/tree
> -ssa/slsr-30.c
> index fbd6897..7921f43 100644
> --- a/gcc/testsuite/gcc.dg/tree-ssa/slsr-30.c
> +++ b/gcc/testsuite/gcc.dg/tree-ssa/slsr-30.c
> @@ -1,9 +1,8 @@
>  /* Verify straight-line strength reduction fails for simple integer addition
>     with casts thrown in when -fwrapv is used.  */
>
> -/* { dg-do compile } */
> +/* { dg-do compile { target { ! { ilp32 } } } } */
>  /* { dg-options "-O3 -fdump-tree-dom2 -fwrapv" } */
> -/* { dg-skip-if "" { ilp32 } { "-m32" } { "" } } */
>
>  long
>  f (int s, long c)
Mike Stump Aug. 8, 2012, 10:32 p.m. UTC | #2
On Aug 8, 2012, at 3:25 PM, H.J. Lu wrote:
> This doesn't work on x32 nor Linux/ia32 since -m32
> may not be needed for ILP32.  This patch works for
> me.  OK to install?

Ok.
Janis Johnson Aug. 8, 2012, 10:35 p.m. UTC | #3
On 08/08/2012 03:27 PM, Andrew Pinski wrote:
> On Wed, Aug 8, 2012 at 3:25 PM, H.J. Lu <hjl.tools@gmail.com> wrote:
>> On Wed, Aug 1, 2012 at 10:36 AM, William J. Schmidt
>> <wschmidt@linux.vnet.ibm.com> wrote:
>>> Greetings,
>>>
>>> Thanks for the review of part 2!  Here's another chunk of the SLSR code
>>> (I feel I owe you a few beers at this point).  This performs analysis
>>> and replacement on groups of related candidates having an SSA name
>>> (rather than a constant) for a stride.
>>>
>>> This leaves only the conditional increment (CAND_PHI) case, which will
>>> be handled in the last patch of the series.
>>>
>>> Bootstrapped and tested on powerpc64-unknown-linux-gnu with no new
>>> regressions.  Ok for trunk?
>>>
>>> Thanks,
>>> Bill
>>>
>>>
>>> gcc:
>>>
>>> 2012-08-01  Bill Schmidt  <wschmidt@linux.ibm.com>
>>>
>>>         * gimple-ssa-strength-reduction.c (struct incr_info_d): New struct.
>>>         (incr_vec): New static var.
>>>         (incr_vec_len): Likewise.
>>>         (address_arithmetic_p): Likewise.
>>>         (stmt_cost): Remove dead assignment.
>>>         (dump_incr_vec): New function.
>>>         (cand_abs_increment): Likewise.
>>>         (lazy_create_slsr_reg): Likewise.
>>>         (incr_vec_index): Likewise.
>>>         (count_candidates): Likewise.
>>>         (record_increment): Likewise.
>>>         (record_increments): Likewise.
>>>         (unreplaced_cand_in_tree): Likewise.
>>>         (optimize_cands_for_speed_p): Likewise.
>>>         (lowest_cost_path): Likewise.
>>>         (total_savings): Likewise.
>>>         (analyze_increments): Likewise.
>>>         (ncd_for_two_cands): Likewise.
>>>         (nearest_common_dominator_for_cands): Likewise.
>>>         (profitable_increment_p): Likewise.
>>>         (insert_initializers): Likewise.
>>>         (introduce_cast_before_cand): Likewise.
>>>         (replace_rhs_if_not_dup): Likewise.
>>>         (replace_one_candidate): Likewise.
>>>         (replace_profitable_candidates): Likewise.
>>>         (analyze_candidates_and_replace): Handle candidates with SSA-name
>>>         strides.
>>>
>>> gcc/testsuite:
>>>
>>> 2012-08-01  Bill Schmidt  <wschmidt@linux.ibm.com>
>>>
>>>         * gcc.dg/tree-ssa/slsr-5.c: New.
>>>         * gcc.dg/tree-ssa/slsr-6.c: New.
>>>         * gcc.dg/tree-ssa/slsr-7.c: New.
>>>         * gcc.dg/tree-ssa/slsr-8.c: New.
>>>         * gcc.dg/tree-ssa/slsr-9.c: New.
>>>         * gcc.dg/tree-ssa/slsr-10.c: New.
>>>         * gcc.dg/tree-ssa/slsr-11.c: New.
>>>         * gcc.dg/tree-ssa/slsr-12.c: New.
>>>         * gcc.dg/tree-ssa/slsr-13.c: New.
>>>         * gcc.dg/tree-ssa/slsr-14.c: New.
>>>         * gcc.dg/tree-ssa/slsr-15.c: New.
>>>         * gcc.dg/tree-ssa/slsr-16.c: New.
>>>         * gcc.dg/tree-ssa/slsr-17.c: New.
>>>         * gcc.dg/tree-ssa/slsr-18.c: New.
>>>         * gcc.dg/tree-ssa/slsr-19.c: New.
>>>         * gcc.dg/tree-ssa/slsr-20.c: New.
>>>         * gcc.dg/tree-ssa/slsr-21.c: New.
>>>         * gcc.dg/tree-ssa/slsr-22.c: New.
>>>         * gcc.dg/tree-ssa/slsr-23.c: New.
>>>         * gcc.dg/tree-ssa/slsr-24.c: New.
>>>         * gcc.dg/tree-ssa/slsr-25.c: New.
>>>         * gcc.dg/tree-ssa/slsr-26.c: New.
>>>         * gcc.dg/tree-ssa/slsr-30.c: New.
>>>         * gcc.dg/tree-ssa/slsr-31.c: New.
>>>
>>>
>> ======================================
>>> --- gcc/testsuite/gcc.dg/tree-ssa/slsr-30.c     (revision 0)
>>> +++ gcc/testsuite/gcc.dg/tree-ssa/slsr-30.c     (revision 0)
>>> @@ -0,0 +1,25 @@
>>> +/* Verify straight-line strength reduction fails for simple integer addition
>>> +   with casts thrown in when -fwrapv is used.  */
>>> +
>>> +/* { dg-do compile } */
>>> +/* { dg-options "-O3 -fdump-tree-dom2 -fwrapv" } */
>>> +/* { dg-skip-if "" { ilp32 } { "-m32" } { "" } } */
>>> +
>>
>> This doesn't work on x32 nor Linux/ia32 since -m32
>> may not be needed for ILP32.  This patch works for
>> me.  OK to install?
> 
> This also does not work for mips64 where the options are either
> -mabi=32 or -mabi=n32 for ILP32.
> 
> HJL's patch looks correct.
> 
> Thanks,
> Andrew

There are GCC targets with 16-bit integers.  What's the actual
set of targets on which this test is meant to run?  There's a list
of effective-target names based on data type sizes in
<http://gcc.gnu.org/onlinedocs/gccint/Effective_002dTarget-Keywords.html#Effective_002dTarget-Keywords>.

Janis

>>
>> Thanks.
>>
>>
>> --
>> H.J.
>> ---
>>        * gcc.dg/tree-ssa/slsr-30.c: Require non-ilp32.  Remove
>>        dg-skip-if.
>>
>> diff --git a/gcc/testsuite/gcc.dg/tree-ssa/slsr-30.c b/gcc/testsuite/gcc.dg/tree
>> -ssa/slsr-30.c
>> index fbd6897..7921f43 100644
>> --- a/gcc/testsuite/gcc.dg/tree-ssa/slsr-30.c
>> +++ b/gcc/testsuite/gcc.dg/tree-ssa/slsr-30.c
>> @@ -1,9 +1,8 @@
>>  /* Verify straight-line strength reduction fails for simple integer addition
>>     with casts thrown in when -fwrapv is used.  */
>>
>> -/* { dg-do compile } */
>> +/* { dg-do compile { target { ! { ilp32 } } } } */
>>  /* { dg-options "-O3 -fdump-tree-dom2 -fwrapv" } */
>> -/* { dg-skip-if "" { ilp32 } { "-m32" } { "" } } */
>>
>>  long
>>  f (int s, long c)
>
Bill Schmidt Aug. 9, 2012, 1:41 a.m. UTC | #4
On Wed, 2012-08-08 at 15:35 -0700, Janis Johnson wrote:
> On 08/08/2012 03:27 PM, Andrew Pinski wrote:
> > On Wed, Aug 8, 2012 at 3:25 PM, H.J. Lu <hjl.tools@gmail.com> wrote:
> >> On Wed, Aug 1, 2012 at 10:36 AM, William J. Schmidt
> >> <wschmidt@linux.vnet.ibm.com> wrote:
> >>> Greetings,
> >>>
> >>> Thanks for the review of part 2!  Here's another chunk of the SLSR code
> >>> (I feel I owe you a few beers at this point).  This performs analysis
> >>> and replacement on groups of related candidates having an SSA name
> >>> (rather than a constant) for a stride.
> >>>
> >>> This leaves only the conditional increment (CAND_PHI) case, which will
> >>> be handled in the last patch of the series.
> >>>
> >>> Bootstrapped and tested on powerpc64-unknown-linux-gnu with no new
> >>> regressions.  Ok for trunk?
> >>>
> >>> Thanks,
> >>> Bill
> >>>
> >>>
> >>> gcc:
> >>>
> >>> 2012-08-01  Bill Schmidt  <wschmidt@linux.ibm.com>
> >>>
> >>>         * gimple-ssa-strength-reduction.c (struct incr_info_d): New struct.
> >>>         (incr_vec): New static var.
> >>>         (incr_vec_len): Likewise.
> >>>         (address_arithmetic_p): Likewise.
> >>>         (stmt_cost): Remove dead assignment.
> >>>         (dump_incr_vec): New function.
> >>>         (cand_abs_increment): Likewise.
> >>>         (lazy_create_slsr_reg): Likewise.
> >>>         (incr_vec_index): Likewise.
> >>>         (count_candidates): Likewise.
> >>>         (record_increment): Likewise.
> >>>         (record_increments): Likewise.
> >>>         (unreplaced_cand_in_tree): Likewise.
> >>>         (optimize_cands_for_speed_p): Likewise.
> >>>         (lowest_cost_path): Likewise.
> >>>         (total_savings): Likewise.
> >>>         (analyze_increments): Likewise.
> >>>         (ncd_for_two_cands): Likewise.
> >>>         (nearest_common_dominator_for_cands): Likewise.
> >>>         (profitable_increment_p): Likewise.
> >>>         (insert_initializers): Likewise.
> >>>         (introduce_cast_before_cand): Likewise.
> >>>         (replace_rhs_if_not_dup): Likewise.
> >>>         (replace_one_candidate): Likewise.
> >>>         (replace_profitable_candidates): Likewise.
> >>>         (analyze_candidates_and_replace): Handle candidates with SSA-name
> >>>         strides.
> >>>
> >>> gcc/testsuite:
> >>>
> >>> 2012-08-01  Bill Schmidt  <wschmidt@linux.ibm.com>
> >>>
> >>>         * gcc.dg/tree-ssa/slsr-5.c: New.
> >>>         * gcc.dg/tree-ssa/slsr-6.c: New.
> >>>         * gcc.dg/tree-ssa/slsr-7.c: New.
> >>>         * gcc.dg/tree-ssa/slsr-8.c: New.
> >>>         * gcc.dg/tree-ssa/slsr-9.c: New.
> >>>         * gcc.dg/tree-ssa/slsr-10.c: New.
> >>>         * gcc.dg/tree-ssa/slsr-11.c: New.
> >>>         * gcc.dg/tree-ssa/slsr-12.c: New.
> >>>         * gcc.dg/tree-ssa/slsr-13.c: New.
> >>>         * gcc.dg/tree-ssa/slsr-14.c: New.
> >>>         * gcc.dg/tree-ssa/slsr-15.c: New.
> >>>         * gcc.dg/tree-ssa/slsr-16.c: New.
> >>>         * gcc.dg/tree-ssa/slsr-17.c: New.
> >>>         * gcc.dg/tree-ssa/slsr-18.c: New.
> >>>         * gcc.dg/tree-ssa/slsr-19.c: New.
> >>>         * gcc.dg/tree-ssa/slsr-20.c: New.
> >>>         * gcc.dg/tree-ssa/slsr-21.c: New.
> >>>         * gcc.dg/tree-ssa/slsr-22.c: New.
> >>>         * gcc.dg/tree-ssa/slsr-23.c: New.
> >>>         * gcc.dg/tree-ssa/slsr-24.c: New.
> >>>         * gcc.dg/tree-ssa/slsr-25.c: New.
> >>>         * gcc.dg/tree-ssa/slsr-26.c: New.
> >>>         * gcc.dg/tree-ssa/slsr-30.c: New.
> >>>         * gcc.dg/tree-ssa/slsr-31.c: New.
> >>>
> >>>
> >> ======================================
> >>> --- gcc/testsuite/gcc.dg/tree-ssa/slsr-30.c     (revision 0)
> >>> +++ gcc/testsuite/gcc.dg/tree-ssa/slsr-30.c     (revision 0)
> >>> @@ -0,0 +1,25 @@
> >>> +/* Verify straight-line strength reduction fails for simple integer addition
> >>> +   with casts thrown in when -fwrapv is used.  */
> >>> +
> >>> +/* { dg-do compile } */
> >>> +/* { dg-options "-O3 -fdump-tree-dom2 -fwrapv" } */
> >>> +/* { dg-skip-if "" { ilp32 } { "-m32" } { "" } } */
> >>> +
> >>
> >> This doesn't work on x32 nor Linux/ia32 since -m32
> >> may not be needed for ILP32.  This patch works for
> >> me.  OK to install?
> > 
> > This also does not work for mips64 where the options are either
> > -mabi=32 or -mabi=n32 for ILP32.
> > 
> > HJL's patch looks correct.
> > 
> > Thanks,
> > Andrew
> 
> There are GCC targets with 16-bit integers.  What's the actual
> set of targets on which this test is meant to run?  There's a list
> of effective-target names based on data type sizes in
> <http://gcc.gnu.org/onlinedocs/gccint/Effective_002dTarget-Keywords.html#Effective_002dTarget-Keywords>.

Yes, sorry.  The test really is only valid when int and long have
different sizes.  So according to that link we should skip ilp32 and
llp64 at a minimum.  It isn't clear what we should do for int16 since
the size of long isn't specified, so I suppose we should skip that as
well.  So, perhaps modify HJ's patch to have

/* { dg-do compile { target { ! { ilp32 llp64 int16 } } } } */

?

Thanks,
Bill

> 
> Janis
> 
> >>
> >> Thanks.
> >>
> >>
> >> --
> >> H.J.
> >> ---
> >>        * gcc.dg/tree-ssa/slsr-30.c: Require non-ilp32.  Remove
> >>        dg-skip-if.
> >>
> >> diff --git a/gcc/testsuite/gcc.dg/tree-ssa/slsr-30.c b/gcc/testsuite/gcc.dg/tree
> >> -ssa/slsr-30.c
> >> index fbd6897..7921f43 100644
> >> --- a/gcc/testsuite/gcc.dg/tree-ssa/slsr-30.c
> >> +++ b/gcc/testsuite/gcc.dg/tree-ssa/slsr-30.c
> >> @@ -1,9 +1,8 @@
> >>  /* Verify straight-line strength reduction fails for simple integer addition
> >>     with casts thrown in when -fwrapv is used.  */
> >>
> >> -/* { dg-do compile } */
> >> +/* { dg-do compile { target { ! { ilp32 } } } } */
> >>  /* { dg-options "-O3 -fdump-tree-dom2 -fwrapv" } */
> >> -/* { dg-skip-if "" { ilp32 } { "-m32" } { "" } } */
> >>
> >>  long
> >>  f (int s, long c)
> > 
>
Janis Johnson Aug. 9, 2012, 2:22 a.m. UTC | #5
On 08/08/2012 06:41 PM, William J. Schmidt wrote:
> On Wed, 2012-08-08 at 15:35 -0700, Janis Johnson wrote:
>> On 08/08/2012 03:27 PM, Andrew Pinski wrote:
>>> On Wed, Aug 8, 2012 at 3:25 PM, H.J. Lu <hjl.tools@gmail.com> wrote:
>>>> On Wed, Aug 1, 2012 at 10:36 AM, William J. Schmidt
>>>> <wschmidt@linux.vnet.ibm.com> wrote:

>>>>> +/* { dg-do compile } */
>>>>> +/* { dg-options "-O3 -fdump-tree-dom2 -fwrapv" } */
>>>>> +/* { dg-skip-if "" { ilp32 } { "-m32" } { "" } } */
>>>>> +
>>>>
>>>> This doesn't work on x32 nor Linux/ia32 since -m32
>>>> may not be needed for ILP32.  This patch works for
>>>> me.  OK to install?
>>>
>>> This also does not work for mips64 where the options are either
>>> -mabi=32 or -mabi=n32 for ILP32.
>>>
>>> HJL's patch looks correct.
>>>
>>> Thanks,
>>> Andrew
>>
>> There are GCC targets with 16-bit integers.  What's the actual
>> set of targets on which this test is meant to run?  There's a list
>> of effective-target names based on data type sizes in
>> <http://gcc.gnu.org/onlinedocs/gccint/Effective_002dTarget-Keywords.html#Effective_002dTarget-Keywords>.
> 
> Yes, sorry.  The test really is only valid when int and long have
> different sizes.  So according to that link we should skip ilp32 and
> llp64 at a minimum.  It isn't clear what we should do for int16 since
> the size of long isn't specified, so I suppose we should skip that as
> well.  So, perhaps modify HJ's patch to have
> 
> /* { dg-do compile { target { ! { ilp32 llp64 int16 } } } } */
> 
> ?
> 
> Thanks,
> Bill

That's confusing.  Perhaps what you really need is a new effective
target for "sizeof(int) != sizeof(long)".

Janis
Richard Biener Aug. 9, 2012, 8:04 a.m. UTC | #6
On Wed, 8 Aug 2012, H.J. Lu wrote:

> On Wed, Aug 1, 2012 at 10:36 AM, William J. Schmidt
> <wschmidt@linux.vnet.ibm.com> wrote:
> > Greetings,
> >
> > Thanks for the review of part 2!  Here's another chunk of the SLSR code
> > (I feel I owe you a few beers at this point).  This performs analysis
> > and replacement on groups of related candidates having an SSA name
> > (rather than a constant) for a stride.
> >
> > This leaves only the conditional increment (CAND_PHI) case, which will
> > be handled in the last patch of the series.
> >
> > Bootstrapped and tested on powerpc64-unknown-linux-gnu with no new
> > regressions.  Ok for trunk?
> >
> > Thanks,
> > Bill
> >
> >
> > gcc:
> >
> > 2012-08-01  Bill Schmidt  <wschmidt@linux.ibm.com>
> >
> >         * gimple-ssa-strength-reduction.c (struct incr_info_d): New struct.
> >         (incr_vec): New static var.
> >         (incr_vec_len): Likewise.
> >         (address_arithmetic_p): Likewise.
> >         (stmt_cost): Remove dead assignment.
> >         (dump_incr_vec): New function.
> >         (cand_abs_increment): Likewise.
> >         (lazy_create_slsr_reg): Likewise.
> >         (incr_vec_index): Likewise.
> >         (count_candidates): Likewise.
> >         (record_increment): Likewise.
> >         (record_increments): Likewise.
> >         (unreplaced_cand_in_tree): Likewise.
> >         (optimize_cands_for_speed_p): Likewise.
> >         (lowest_cost_path): Likewise.
> >         (total_savings): Likewise.
> >         (analyze_increments): Likewise.
> >         (ncd_for_two_cands): Likewise.
> >         (nearest_common_dominator_for_cands): Likewise.
> >         (profitable_increment_p): Likewise.
> >         (insert_initializers): Likewise.
> >         (introduce_cast_before_cand): Likewise.
> >         (replace_rhs_if_not_dup): Likewise.
> >         (replace_one_candidate): Likewise.
> >         (replace_profitable_candidates): Likewise.
> >         (analyze_candidates_and_replace): Handle candidates with SSA-name
> >         strides.
> >
> > gcc/testsuite:
> >
> > 2012-08-01  Bill Schmidt  <wschmidt@linux.ibm.com>
> >
> >         * gcc.dg/tree-ssa/slsr-5.c: New.
> >         * gcc.dg/tree-ssa/slsr-6.c: New.
> >         * gcc.dg/tree-ssa/slsr-7.c: New.
> >         * gcc.dg/tree-ssa/slsr-8.c: New.
> >         * gcc.dg/tree-ssa/slsr-9.c: New.
> >         * gcc.dg/tree-ssa/slsr-10.c: New.
> >         * gcc.dg/tree-ssa/slsr-11.c: New.
> >         * gcc.dg/tree-ssa/slsr-12.c: New.
> >         * gcc.dg/tree-ssa/slsr-13.c: New.
> >         * gcc.dg/tree-ssa/slsr-14.c: New.
> >         * gcc.dg/tree-ssa/slsr-15.c: New.
> >         * gcc.dg/tree-ssa/slsr-16.c: New.
> >         * gcc.dg/tree-ssa/slsr-17.c: New.
> >         * gcc.dg/tree-ssa/slsr-18.c: New.
> >         * gcc.dg/tree-ssa/slsr-19.c: New.
> >         * gcc.dg/tree-ssa/slsr-20.c: New.
> >         * gcc.dg/tree-ssa/slsr-21.c: New.
> >         * gcc.dg/tree-ssa/slsr-22.c: New.
> >         * gcc.dg/tree-ssa/slsr-23.c: New.
> >         * gcc.dg/tree-ssa/slsr-24.c: New.
> >         * gcc.dg/tree-ssa/slsr-25.c: New.
> >         * gcc.dg/tree-ssa/slsr-26.c: New.
> >         * gcc.dg/tree-ssa/slsr-30.c: New.
> >         * gcc.dg/tree-ssa/slsr-31.c: New.
> >
> >
> ======================================
> > --- gcc/testsuite/gcc.dg/tree-ssa/slsr-30.c     (revision 0)
> > +++ gcc/testsuite/gcc.dg/tree-ssa/slsr-30.c     (revision 0)
> > @@ -0,0 +1,25 @@
> > +/* Verify straight-line strength reduction fails for simple integer addition
> > +   with casts thrown in when -fwrapv is used.  */
> > +
> > +/* { dg-do compile } */
> > +/* { dg-options "-O3 -fdump-tree-dom2 -fwrapv" } */
> > +/* { dg-skip-if "" { ilp32 } { "-m32" } { "" } } */
> > +
> 
> This doesn't work on x32 nor Linux/ia32 since -m32
> may not be needed for ILP32.  This patch works for
> me.  OK to install?

Ok.

Thanks,
Richard.
Bill Schmidt Aug. 9, 2012, 12:26 p.m. UTC | #7
On Wed, 2012-08-08 at 19:22 -0700, Janis Johnson wrote:
> On 08/08/2012 06:41 PM, William J. Schmidt wrote:
> > On Wed, 2012-08-08 at 15:35 -0700, Janis Johnson wrote:
> >> On 08/08/2012 03:27 PM, Andrew Pinski wrote:
> >>> On Wed, Aug 8, 2012 at 3:25 PM, H.J. Lu <hjl.tools@gmail.com> wrote:
> >>>> On Wed, Aug 1, 2012 at 10:36 AM, William J. Schmidt
> >>>> <wschmidt@linux.vnet.ibm.com> wrote:
> 
> >>>>> +/* { dg-do compile } */
> >>>>> +/* { dg-options "-O3 -fdump-tree-dom2 -fwrapv" } */
> >>>>> +/* { dg-skip-if "" { ilp32 } { "-m32" } { "" } } */
> >>>>> +
> >>>>
> >>>> This doesn't work on x32 nor Linux/ia32 since -m32
> >>>> may not be needed for ILP32.  This patch works for
> >>>> me.  OK to install?
> >>>
> >>> This also does not work for mips64 where the options are either
> >>> -mabi=32 or -mabi=n32 for ILP32.
> >>>
> >>> HJL's patch looks correct.
> >>>
> >>> Thanks,
> >>> Andrew
> >>
> >> There are GCC targets with 16-bit integers.  What's the actual
> >> set of targets on which this test is meant to run?  There's a list
> >> of effective-target names based on data type sizes in
> >> <http://gcc.gnu.org/onlinedocs/gccint/Effective_002dTarget-Keywords.html#Effective_002dTarget-Keywords>.
> > 
> > Yes, sorry.  The test really is only valid when int and long have
> > different sizes.  So according to that link we should skip ilp32 and
> > llp64 at a minimum.  It isn't clear what we should do for int16 since
> > the size of long isn't specified, so I suppose we should skip that as
> > well.  So, perhaps modify HJ's patch to have
> > 
> > /* { dg-do compile { target { ! { ilp32 llp64 int16 } } } } */
> > 
> > ?
> > 
> > Thanks,
> > Bill
> 
> That's confusing.  Perhaps what you really need is a new effective
> target for "sizeof(int) != sizeof(long)".

Good idea.  I'll work up a patch when I get a moment.

Thanks,
Bill

> 
> Janis
>
diff mbox

Patch

======================================
> --- gcc/testsuite/gcc.dg/tree-ssa/slsr-30.c     (revision 0)
> +++ gcc/testsuite/gcc.dg/tree-ssa/slsr-30.c     (revision 0)
> @@ -0,0 +1,25 @@
> +/* Verify straight-line strength reduction fails for simple integer addition
> +   with casts thrown in when -fwrapv is used.  */
> +
> +/* { dg-do compile } */
> +/* { dg-options "-O3 -fdump-tree-dom2 -fwrapv" } */
> +/* { dg-skip-if "" { ilp32 } { "-m32" } { "" } } */
> +

This doesn't work on x32 nor Linux/ia32 since -m32
may not be needed for ILP32.  This patch works for
me.  OK to install?

Thanks.


-- 
H.J.
---
       * gcc.dg/tree-ssa/slsr-30.c: Require non-ilp32.  Remove
       dg-skip-if.

diff --git a/gcc/testsuite/gcc.dg/tree-ssa/slsr-30.c b/gcc/testsuite/gcc.dg/tree
-ssa/slsr-30.c
index fbd6897..7921f43 100644
--- a/gcc/testsuite/gcc.dg/tree-ssa/slsr-30.c
+++ b/gcc/testsuite/gcc.dg/tree-ssa/slsr-30.c
@@ -1,9 +1,8 @@ 
 /* Verify straight-line strength reduction fails for simple integer addition
    with casts thrown in when -fwrapv is used.  */

-/* { dg-do compile } */
+/* { dg-do compile { target { ! { ilp32 } } } } */
 /* { dg-options "-O3 -fdump-tree-dom2 -fwrapv" } */
-/* { dg-skip-if "" { ilp32 } { "-m32" } { "" } } */

 long
 f (int s, long c)