This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH][testsuite] Add check_effective_target_autoincdec


Hi Wilco,

> Richard Earnshaw wrote:
>> Except that I think this would be better done as an 'effective target'
>> test; something like
>>
>> dg-require-effective-target autoincdec
>
> Right I figured out how to do this - not trivial as it needs a secret flag
> in the
> glob call - if anyone knows a better way of doing this I'd like to know!
>
>
> Add check_effective_target_autoincdec that returns true if a target
> runs the auto_inc_dec optimization pass.
>
> OK for commit?
>
> ChangeLog:
> 2017-08-08  Wilco Dijkstra  <wdijkstr@arm.com>
>
> gcc/testsuite/
>
> 	* gcc.dg/pr46932.c: Use effective_target autoincdec.
> 	* lib/target-supports.exp: Add check_effective_target_autoincdec.
> --
>
> diff --git a/gcc/testsuite/gcc.dg/pr46932.c b/gcc/testsuite/gcc.dg/pr46932.c
> index 4eb1a99e1bd9403f8b1c5d0d71ef731ad4a65128..2b39990d036035d22e226b98351a4900a5dbb309 100644
> --- a/gcc/testsuite/gcc.dg/pr46932.c
> +++ b/gcc/testsuite/gcc.dg/pr46932.c
> @@ -1,7 +1,5 @@
>  /* { dg-options "-O2 -fdump-rtl-auto_inc_dec" } */
> -
> -/* Build on targets which have pre increment.  */
> -/* { dg-do compile { target aarch64*-*-* arm*-*-* rs6000-*-* powerpc*-*-* arc*-*-* m32r-*-* tic6x-*-* } } */
> +/* { dg-require-effective-target autoincdec } */
>  
>  /* Check that accesses based on the frame pointer do not
>     use auto increment.  */
> diff --git a/gcc/testsuite/lib/target-supports.exp b/gcc/testsuite/lib/target-supports.exp
> index 5a6562794b2bdd5f370fc5b26d6887777f02779a..5219fbf4671e83a6fa7affdab926115e8a23f9cb 100644
> --- a/gcc/testsuite/lib/target-supports.exp
> +++ b/gcc/testsuite/lib/target-supports.exp
> @@ -8482,3 +8482,18 @@ proc check_effective_target_arm_coproc4_ok { } {
>      return [check_cached_effective_target arm_coproc4_ok \
>  		check_effective_target_arm_coproc4_ok_nocache]
>  }
> +
> +# Return 1 if the target supports the auto_inc_dec optimization pass.
> +proc check_effective_target_autoincdec { } {
> +    if { ![check_no_compiler_messages auto_incdec assembly { void f () { }
> +	 } "-O2 -fdump-rtl-auto_inc_dec" ] } {
> +      return 0
> +    }
> +
> +    set dumpfile [glob -nocomplain "auto_incdec[pid].c.\[0-9\]\[0-9\]\[0-9\]r.auto_inc_dec"]
> +    if { [file exists $dumpfile ] } {
> +	file delete $dumpfile
> +	return 1
> +    }
> +    return 0
> +}

the new keyword needs documenting in sourcebuild.texi (often forgotten ;-)

	Rainer

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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]