From 8bd5530bfa136663f1fa79e9a1d3932b5adf15bd Mon Sep 17 00:00:00 2001 From: liuhongt Date: Mon, 31 Aug 2020 10:54:13 +0800 Subject: [PATCH] Adjust testcase. gcc/testsuite/ChangeLog: PR target/96246 PR target/96855 PR target/96856 PR target/96857 * g++.target/i386/avx512bw-pr96246-2.C: Add runtime check for AVX512BW. * g++.target/i386/avx512vl-pr96246-2.C: Add runtime check for AVX512BW and AVX512VL * g++.target/i386/avx512f-helper.h: New header. * gcc.target/i386/pr92658-avx512f.c: Add -mprefer-vector-width=512 to avoid impact of different default mtune which gcc is built with. * gcc.target/i386/avx512bw-pr95488-1.c: Ditto. * gcc.target/i386/pr92645-4.c: Add -mno-avx512f to avoid impact of different default march which gcc is built with. --- .../g++.target/i386/avx512bw-pr96246-2.C | 9 +++++--- .../g++.target/i386/avx512f-helper.h | 1 + .../g++.target/i386/avx512vl-pr96246-2.C | 21 +++++++++++++------ .../gcc.target/i386/avx512bw-pr95488-1.c | 2 +- gcc/testsuite/gcc.target/i386/pr92645-4.c | 2 +- .../gcc.target/i386/pr92658-avx512f.c | 2 +- 6 files changed, 25 insertions(+), 12 deletions(-) create mode 100644 gcc/testsuite/g++.target/i386/avx512f-helper.h diff --git a/gcc/testsuite/g++.target/i386/avx512bw-pr96246-2.C b/gcc/testsuite/g++.target/i386/avx512bw-pr96246-2.C index b96b7c7c932..30a1b959573 100644 --- a/gcc/testsuite/g++.target/i386/avx512bw-pr96246-2.C +++ b/gcc/testsuite/g++.target/i386/avx512bw-pr96246-2.C @@ -3,6 +3,10 @@ /* { dg-require-effective-target avx512bw } */ /* { dg-options "-O2 -std=c++14 -mavx512bw" } */ +#define AVX512BW + +#include "avx512f-helper.h" + #include "avx512bw-pr96246-1.C" #define RUNTIME_TEST(vtype, num) \ @@ -24,8 +28,8 @@ } \ while (0) -int -main (void) +void +test_512 (void) { RUNTIME_TEST (v64qi, 64); RUNTIME_TEST (v32hi, 32); @@ -33,5 +37,4 @@ main (void) RUNTIME_TEST (v8di, 8); RUNTIME_TEST (v16sf, 16); RUNTIME_TEST (v8df, 8); - return 0; } diff --git a/gcc/testsuite/g++.target/i386/avx512f-helper.h b/gcc/testsuite/g++.target/i386/avx512f-helper.h new file mode 100644 index 00000000000..09b6bcbf77a --- /dev/null +++ b/gcc/testsuite/g++.target/i386/avx512f-helper.h @@ -0,0 +1 @@ +#include "../../gcc.target/i386/avx512f-helper.h" diff --git a/gcc/testsuite/g++.target/i386/avx512vl-pr96246-2.C b/gcc/testsuite/g++.target/i386/avx512vl-pr96246-2.C index 9a16f0d2c9e..db9dce2caef 100644 --- a/gcc/testsuite/g++.target/i386/avx512vl-pr96246-2.C +++ b/gcc/testsuite/g++.target/i386/avx512vl-pr96246-2.C @@ -4,6 +4,11 @@ /* { dg-require-effective-target avx512vl } */ /* { dg-options "-O2 -std=c++14 -mavx512bw -mavx512vl" } */ +#define AVX512VL +#define AVX512BW + +#include "avx512f-helper.h" + #include "avx512vl-pr96246-1.C" #define RUNTIME_TEST(vtype, num) \ @@ -25,17 +30,21 @@ } \ while (0) -int -main (void) +void +test_256 (void) { - RUNTIME_TEST (v16qi, 16); RUNTIME_TEST (v32qi, 32); RUNTIME_TEST (v16hi, 16); - RUNTIME_TEST (v4si, 4); RUNTIME_TEST (v8si, 8); - RUNTIME_TEST (v4sf, 4); RUNTIME_TEST (v8sf, 8); RUNTIME_TEST (v4di, 4); RUNTIME_TEST (v4df, 4); - return 0; +} + +void +test_128 (void) +{ + RUNTIME_TEST (v16qi, 16); + RUNTIME_TEST (v4si, 4); + RUNTIME_TEST (v4sf, 4); } diff --git a/gcc/testsuite/gcc.target/i386/avx512bw-pr95488-1.c b/gcc/testsuite/gcc.target/i386/avx512bw-pr95488-1.c index 594e511868d..e6e0ac2fd82 100644 --- a/gcc/testsuite/gcc.target/i386/avx512bw-pr95488-1.c +++ b/gcc/testsuite/gcc.target/i386/avx512bw-pr95488-1.c @@ -1,6 +1,6 @@ /* PR target/95488 */ /* { dg-do compile } */ -/* { dg-options "-O2 -mavx512bw" } */ +/* { dg-options "-O2 -mavx512bw -mprefer-vector-width=512" } */ /* { dg-final { scan-assembler-times "vpmovzxbw" 4 } } */ /* { dg-final { scan-assembler-times "vpmullw\[^\n\]*zmm" 2 } } */ /* { dg-final { scan-assembler-times "vpmovwb" 2 } } */ diff --git a/gcc/testsuite/gcc.target/i386/pr92645-4.c b/gcc/testsuite/gcc.target/i386/pr92645-4.c index 5d459040846..28a3f9a3527 100644 --- a/gcc/testsuite/gcc.target/i386/pr92645-4.c +++ b/gcc/testsuite/gcc.target/i386/pr92645-4.c @@ -1,5 +1,5 @@ /* { dg-do compile } */ -/* { dg-options "-O2 -mavx2 -fdump-tree-optimized -Wno-psabi" } */ +/* { dg-options "-O2 -mavx2 -fdump-tree-optimized -Wno-psabi -mno-avx512f" } */ typedef unsigned int u32v4 __attribute__((vector_size(16))); typedef unsigned short u16v16 __attribute__((vector_size(32))); diff --git a/gcc/testsuite/gcc.target/i386/pr92658-avx512f.c b/gcc/testsuite/gcc.target/i386/pr92658-avx512f.c index 2ba29074a81..e9ee3d24232 100644 --- a/gcc/testsuite/gcc.target/i386/pr92658-avx512f.c +++ b/gcc/testsuite/gcc.target/i386/pr92658-avx512f.c @@ -1,6 +1,6 @@ /* PR target/92658 */ /* { dg-do compile } */ -/* { dg-options "-O2 -ftree-vectorize -mavx512f" } */ +/* { dg-options "-O2 -ftree-vectorize -mavx512f -mprefer-vector-width=512" } */ typedef unsigned char v8qi __attribute__((vector_size (8))); typedef unsigned char v16qi __attribute__((vector_size (16))); -- 2.30.2