Re: [PATCH v4] Run tests only if the machine supports the instruction set.
On Tue, Dec 20, 2016 at 11:57:52AM -0800, Mike Stump wrote: > On Dec 20, 2016, at 6:10 AM, Dominik Vogt wrote: > > Right, it gets called even more often than one would think, and > > even with empty torture_current_options. The attached new patch > > (v3) removes -Ox options and superflous whitespace and caches that > > between calls if it's not empty. There's another, permanent cache > > for calls without any flags. With proper ordering of the torture > > options, the test program is built only a couple of times. > > Seems fine to me, but most other cases use the postfix _hw. Any > reason not use use _hw (and not _runable) on these? If not, > could you please use _hw instead. No specific reason other than lack of imagination. "s390_hw" is a bit too generic in my eyes -> the new names are: v4: * Renamed "s390_runnable" to "s390_useable_hw". * Renamed "z900_runnable" to "s390_z900_hw", Renamed "z10_runnable" to "s390_z10_hw", etc. Ciao Dominik ^_^ ^_^ -- Dominik Vogt IBM Germany gcc/ChangeLog-archlevel * config/s390/s390-c.c (s390_cpu_cpp_builtins_internal): Define __S390_ARCH_LEVEL__. gcc/testsuite/ChangeLog-setmem * gcc.target/s390/md/setmem_long-1.c: Use "s390_useable_hw". * gcc.target/s390/md/rXsbg_mode_sXl.c: Likewise. * gcc.target/s390/md/andc-splitter-1.c: Likewise. * gcc.target/s390/md/andc-splitter-2.c: Likewise. * lib/gcc-dg.exp (gcc-dg-runtest): Export torture_current_flags. * gcc.target/s390/s390.exp: Import torture_current_flags. (check_effective_target_s390_useable_hw): New. (check_effective_target_s390_z900_hw): New. (check_effective_target_s390_z990_hw): New. (check_effective_target_s390_z9_ec_hw): New. (check_effective_target_s390_z10_hw): New. (check_effective_target_s390_z196_hw): New. (check_effective_target_s390_zEC12_hw): New. (check_effective_target_s390_z13_hw): New. (check_effective_target_z10_instructions): Removed. (torture tests): Add optimization level without -march=. Reorder torture tests for good cache usage. >From 8ae8d6f48fbede4188a7e02c835fcf9d0b535da7 Mon Sep 17 00:00:00 2001 From: Dominik Vogt Date: Tue, 13 Dec 2016 10:21:08 +0100 Subject: [PATCH] S/390: Run md tests only if the machine supports the instruction set. --- gcc/config/s390/s390-c.c | 17 +++ gcc/testsuite/gcc.target/s390/md/andc-splitter-1.c | 19 +-- gcc/testsuite/gcc.target/s390/md/andc-splitter-2.c | 19 +-- gcc/testsuite/gcc.target/s390/md/rXsbg_mode_sXl.c | 4 +- gcc/testsuite/gcc.target/s390/md/setmem_long-1.c | 7 +- gcc/testsuite/gcc.target/s390/s390.exp | 170 ++--- gcc/testsuite/lib/gcc-dg.exp | 2 + 7 files changed, 198 insertions(+), 40 deletions(-) diff --git a/gcc/config/s390/s390-c.c b/gcc/config/s390/s390-c.c index fcf7477..e841365 100644 --- a/gcc/config/s390/s390-c.c +++ b/gcc/config/s390/s390-c.c @@ -320,6 +320,8 @@ s390_cpu_cpp_builtins_internal (cpp_reader *pfile, { s390_def_or_undef_macro (pfile, MASK_OPT_HTM, old_opts, opts, "__HTM__", "__HTM__"); + s390_def_or_undef_macro (pfile, MASK_OPT_VX, old_opts, opts, + "__S390_VX__", "__S390_VX__"); s390_def_or_undef_macro (pfile, MASK_ZVECTOR, old_opts, opts, "__VEC__=10301", "__VEC__"); s390_def_or_undef_macro (pfile, MASK_ZVECTOR, old_opts, opts, @@ -328,6 +330,21 @@ s390_cpu_cpp_builtins_internal (cpp_reader *pfile, s390_def_or_undef_macro (pfile, MASK_ZVECTOR, old_opts, opts, "__bool=__attribute__((s390_vector_bool)) unsigned", "__bool"); + { +char macro_def[64]; +int arch_level; +gcc_assert (s390_arch != PROCESSOR_NATIVE); +arch_level = (int)s390_arch + 3; +if (s390_arch >= PROCESSOR_2094_Z9_EC) + /* Z9_EC has the same level as Z9_109. */ + arch_level--; +/* Review when a new arch is added and increase the value. */ +char dummy[23 - 2 * PROCESSOR_max] __attribute__((unused)); +sprintf (macro_def, "__S390_ARCH_LEVEL__=%d", arch_level); +cpp_undef (pfile, "__S390_ARCH_LEVEL__"); +cpp_define (pfile, macro_def); + } + if (!flag_iso) { s390_def_or_undef_macro (pfile, MASK_ZVECTOR, old_opts, opts, diff --git a/gcc/testsuite/gcc.target/s390/md/andc-splitter-1.c b/gcc/testsuite/gcc.target/s390/md/andc-splitter-1.c index ed78921..3f0677c 100644 --- a/gcc/testsuite/gcc.target/s390/md/andc-splitter-1.c +++ b/gcc/testsuite/gcc.target/s390/md/andc-splitter-1.c @@ -1,7 +1,8 @@ /* Machine description pattern tests. */ -/* { dg-do run { target { lp64 } } } */ +/* { dg-do compile { target { lp64 } } } */ /* { dg-options "-mzarch -save-temps -dP" } */ +/* { dg-do run { target { lp64 && s390_useable_hw } } } */ /* Skip test if -O0 is present on the command line:
Re: [PATCH v4] Run tests only if the machine supports the instruction set.
On Tue, Dec 20, 2016 at 10:26:13PM +0100, Dominik Vogt wrote: > On Tue, Dec 20, 2016 at 11:57:52AM -0800, Mike Stump wrote: > > On Dec 20, 2016, at 6:10 AM, Dominik Vogt wrote: > > > Right, it gets called even more often than one would think, and > > > even with empty torture_current_options. The attached new patch > > > (v3) removes -Ox options and superflous whitespace and caches that > > > between calls if it's not empty. There's another, permanent cache > > > for calls without any flags. With proper ordering of the torture > > > options, the test program is built only a couple of times. > > > > Seems fine to me, but most other cases use the postfix _hw. Any > > reason not use use _hw (and not _runable) on these? If not, > > could you please use _hw instead. > > No specific reason other than lack of imagination. "s390_hw" is a > bit too generic in my eyes -> the new names are: > > v4: > > * Renamed "s390_runnable" to "s390_useable_hw". > * Renamed "z900_runnable" to "s390_z900_hw", > Renamed "z10_runnable" to "s390_z10_hw", > etc. Grepping for _hw in target-supports.exp reveals that usually the effective target predicates are called _hw or _hw_available, __hw only if it is too ambiguous (e.g. alpha_max_hw or ppc_float128_hw_available). So I think z900_hw, z10_hw etc. is good enough (as long as it does not clash with some other target isa name), s390_usable_hw or s390_hw_available is fine. Jakub
Re: [PATCH v4] Run tests only if the machine supports the instruction set.
On Tue, Dec 20, 2016 at 10:32:26PM +0100, Jakub Jelinek wrote: > On Tue, Dec 20, 2016 at 10:26:13PM +0100, Dominik Vogt wrote: > > On Tue, Dec 20, 2016 at 11:57:52AM -0800, Mike Stump wrote: > > > On Dec 20, 2016, at 6:10 AM, Dominik Vogt wrote: > > > > Right, it gets called even more often than one would think, and > > > > even with empty torture_current_options. The attached new patch > > > > (v3) removes -Ox options and superflous whitespace and caches that > > > > between calls if it's not empty. There's another, permanent cache > > > > for calls without any flags. With proper ordering of the torture > > > > options, the test program is built only a couple of times. > > > > > > Seems fine to me, but most other cases use the postfix _hw. Any > > > reason not use use _hw (and not _runable) on these? If not, > > > could you please use _hw instead. > > > > No specific reason other than lack of imagination. "s390_hw" is a > > bit too generic in my eyes -> the new names are: > > > > v4: > > > > * Renamed "s390_runnable" to "s390_useable_hw". > > * Renamed "z900_runnable" to "s390_z900_hw", > > Renamed "z10_runnable" to "s390_z10_hw", > > etc. > > Grepping for _hw in target-supports.exp reveals that usually the > effective target predicates are called _hw or _hw_available, > __hw only if it is too ambiguous (e.g. alpha_max_hw or > ppc_float128_hw_available). So I think z900_hw, z10_hw etc. is good > enough (as long as it does not clash with some other target isa name), > s390_usable_hw or s390_hw_available is fine. Okay. We usually prefix everyting with "s390_" on S/390, so I'd say we don't make an exception here - even if there are no potential naming collisions. Ciao Dominik ^_^ ^_^ -- Dominik Vogt IBM Germany
Re: [PATCH v4] Run tests only if the machine supports the instruction set.
> gcc/ChangeLog-archlevel > > * config/s390/s390-c.c (s390_cpu_cpp_builtins_internal): Define > __S390_ARCH_LEVEL__. > gcc/testsuite/ChangeLog-setmem > > * gcc.target/s390/md/setmem_long-1.c: Use "s390_useable_hw". > * gcc.target/s390/md/rXsbg_mode_sXl.c: Likewise. > * gcc.target/s390/md/andc-splitter-1.c: Likewise. > * gcc.target/s390/md/andc-splitter-2.c: Likewise. > * lib/gcc-dg.exp (gcc-dg-runtest): Export torture_current_flags. > * gcc.target/s390/s390.exp: Import torture_current_flags. > (check_effective_target_s390_useable_hw): New. > (check_effective_target_s390_z900_hw): New. > (check_effective_target_s390_z990_hw): New. > (check_effective_target_s390_z9_ec_hw): New. > (check_effective_target_s390_z10_hw): New. > (check_effective_target_s390_z196_hw): New. > (check_effective_target_s390_zEC12_hw): New. > (check_effective_target_s390_z13_hw): New. > (check_effective_target_z10_instructions): Removed. > (torture tests): Add optimization level without -march=. > Reorder torture tests for good cache usage. Applied. Thanks! -Andreas-