From 5316dd1b63913e390fb2a5d7b335aeacd9da3001 Mon Sep 17 00:00:00 2001 From: Wilco Dijkstra Date: Mon, 14 Aug 2017 11:18:50 +0000 Subject: [PATCH] Add check_effective_target_autoincdec. Add check_effective_target_autoincdec that returns true if a target runs the auto_inc_dec optimization pass. gcc/ * doc/sourcebuild.texi (autoincdec): Add autoincdec description. gcc/testsuite/ PR middle-end/46932 * gcc.dg/pr46932.c: Use dg-require-effective-target autoincdec. * lib/target-supports.exp: Add check_effective_target_autoincdec. From-SVN: r251087 --- gcc/ChangeLog | 5 +++++ gcc/doc/sourcebuild.texi | 3 +++ gcc/testsuite/ChangeLog | 6 ++++++ gcc/testsuite/gcc.dg/pr46932.c | 4 +--- gcc/testsuite/lib/target-supports.exp | 15 +++++++++++++++ 5 files changed, 30 insertions(+), 3 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 5fe0a90a15c..19bb575bf8f 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,8 @@ +2017-08-14 Wilco Dijkstra + + PR middle-end/46932 + * doc/sourcebuild.texi (autoincdec): Add autoincdec description. + 2017-08-14 Georg-Johann Lay PR target/81754 diff --git a/gcc/doc/sourcebuild.texi b/gcc/doc/sourcebuild.texi index 85af8778167..e6313dc031e 100644 --- a/gcc/doc/sourcebuild.texi +++ b/gcc/doc/sourcebuild.texi @@ -1846,6 +1846,9 @@ PowerPC target supports executing VSX instructions (ISA 2.06). @c Please keep this table sorted alphabetically. @table @code +@item autoincdec +Target supports autoincrement/decrement addressing. + @item avx Target supports compiling @code{avx} instructions. diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index b6f6f1d01e9..8995806e289 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,9 @@ +2017-08-14 Wilco Dijkstra + + PR middle-end/46932 + * gcc.dg/pr46932.c: Use dg-require-effective-target autoincdec. + * lib/target-supports.exp: Add check_effective_target_autoincdec. + 2017-08-14 Szabolcs Nagy * gcc.target/aarch64/dbl_mov_immediate_1.c: Add diff --git a/gcc/testsuite/gcc.dg/pr46932.c b/gcc/testsuite/gcc.dg/pr46932.c index 4eb1a99e1bd..2b39990d036 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 5a6562794b2..5219fbf4671 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 +} -- 2.30.2