Message ID | DB6PR0801MB205321CF1DA500099ED131A1838B0@DB6PR0801MB2053.eurprd08.prod.outlook.com |
---|---|
State | New |
Headers | show |
On 09/08/17 12:37, Wilco Dijkstra wrote: > 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? > LGTM. Please give Mike 24 hours to respond, before committing. R. > 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 > +} >
On Aug 9, 2017, at 5:50 AM, Richard Earnshaw (lists) <Richard.Earnshaw@arm.com> wrote: > > On 09/08/17 12:37, Wilco Dijkstra wrote: >> 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? >> > > LGTM. Please give Mike 24 hours to respond, before committing. Ok. I'm happy for things like this to just go in on port or front-end review alone. It's a pretty standard sort of change, dare say, kinda trivial.
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
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 +}