public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH] testsuite: effective_target_march_option: support checking for -march=*
@ 2020-01-18 12:54 Hans-Peter Nilsson
  2020-01-19 10:46 ` Mike Stump
  0 siblings, 1 reply; 2+ messages in thread
From: Hans-Peter Nilsson @ 2020-01-18 12:54 UTC (permalink / raw)
  To: gcc-patches

testsuite:
	* lib/target-supports.exp (effective_target_march_option): New.

I see no (other) way to, depending on the absence of an option,
add an option for a specific target.  Specifically, I don't see
how to do this with dg-skip-if and its friends.

For gcc.dg/torture/pr26515.c and cris-elf, you get an error for
supplying multiple (different) -march=... options (and that
error is desirable), like testing cris-elf with
RUNTESTFLAGS=--target_board=cris-sim/arch=v8, where otherwise
-march=v10 and -march=v8 will both be given, and the test would
fail.

See example last.

Ok to commit the below?

---
 gcc/testsuite/lib/target-supports.exp | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/gcc/testsuite/lib/target-supports.exp b/gcc/testsuite/lib/target-supports.exp
index 629b454..565cb62 100644
--- a/gcc/testsuite/lib/target-supports.exp
+++ b/gcc/testsuite/lib/target-supports.exp
@@ -2463,6 +2463,10 @@ proc check_effective_target_ti_c64xp { } {
     }]
 }
 
+# Check if a -march=... option is given, as part of (earlier) options.
+proc check_effective_target_march_option { } {
+    return [check-flags [list "" { *-*-* } { "-march=*" } { "" } ]]
+}
 
 proc check_alpha_max_hw_available { } {
     return [check_runtime alpha_max_hw_available {
-- 
2.11.0

Example usage (one of several similar, which will be committed
together with the above, if approved):

diff --git a/gcc/testsuite/gcc.dg/torture/pr26515.c b/gcc/testsuite/gcc.dg/torture/pr26515.c
index a051e2e..ff765ba 100644
--- a/gcc/testsuite/gcc.dg/torture/pr26515.c
+++ b/gcc/testsuite/gcc.dg/torture/pr26515.c
@@ -1,4 +1,4 @@
-/* { dg-options "-march=v10" { target cris*-*-* } } */
+/* { dg-options "-march=v10" { target { cris*-*-* && { ! march_option } } } } */
 struct i
 {
   long long i_size;

brgds, H-P

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] testsuite: effective_target_march_option: support checking for -march=*
  2020-01-18 12:54 [PATCH] testsuite: effective_target_march_option: support checking for -march=* Hans-Peter Nilsson
@ 2020-01-19 10:46 ` Mike Stump
  0 siblings, 0 replies; 2+ messages in thread
From: Mike Stump @ 2020-01-19 10:46 UTC (permalink / raw)
  To: Hans-Peter Nilsson; +Cc: gcc-patches


> On Jan 18, 2020, at 4:35 AM, Hans-Peter Nilsson <hp@axis.com> wrote:
> 
> testsuite:
> 	* lib/target-supports.exp (effective_target_march_option): New.
> 
> I see no (other) way to, depending on the absence of an option,
> add an option for a specific target.  Specifically, I don't see
> how to do this with dg-skip-if and its friends.
> 
> For gcc.dg/torture/pr26515.c and cris-elf, you get an error for
> supplying multiple (different) -march=... options (and that
> error is desirable), like testing cris-elf with
> RUNTESTFLAGS=--target_board=cris-sim/arch=v8, where otherwise
> -march=v10 and -march=v8 will both be given, and the test would
> fail.
> 
> Ok to commit the below?

Ok.  [ If the arm folks want to chime in with any great ideas... ]

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2020-01-19  2:17 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-01-18 12:54 [PATCH] testsuite: effective_target_march_option: support checking for -march=* Hans-Peter Nilsson
2020-01-19 10:46 ` Mike Stump

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).