From 55290635d10ea3d18b0a45aa2e6f59405b8c1f54 Mon Sep 17 00:00:00 2001 From: liuhongt Date: Tue, 18 Aug 2020 15:06:01 +0800 Subject: [PATCH] Adjust testcase. Rewriting testcase with cpp source file, then compare operator could be used directly for vector, this would avoid impact of vectorizer. gcc/testsuite/ChangeLog: PR target/96667 * gcc.target/i386/avx512bw-pr96246-1.c: Moved to... * g++.target/i386/avx512bw-pr96246-1.C: ...here. * gcc.target/i386/avx512bw-pr96246-2.c: Moved to... * g++.target/i386/avx512bw-pr96246-2.C: ...here. * gcc.target/i386/avx512vl-pr96246-1.c: Moved to... * g++.target/i386/avx512vl-pr96246-1.C: ...here. * gcc.target/i386/avx512vl-pr96246-2.c: Moved to... * g++.target/i386/avx512vl-pr96246-2.C: ...here. --- .../i386/avx512bw-pr96246-1.C} | 11 ++++------ .../i386/avx512bw-pr96246-2.C} | 20 +++++-------------- .../i386/avx512vl-pr96246-1.C} | 11 ++++------ .../i386/avx512vl-pr96246-2.C} | 20 +++++-------------- 4 files changed, 18 insertions(+), 44 deletions(-) rename gcc/testsuite/{gcc.target/i386/avx512bw-pr96246-1.c => g++.target/i386/avx512bw-pr96246-1.C} (68%) rename gcc/testsuite/{gcc.target/i386/avx512bw-pr96246-2.c => g++.target/i386/avx512bw-pr96246-2.C} (74%) rename gcc/testsuite/{gcc.target/i386/avx512vl-pr96246-1.c => g++.target/i386/avx512vl-pr96246-1.C} (73%) rename gcc/testsuite/{gcc.target/i386/avx512vl-pr96246-2.c => g++.target/i386/avx512vl-pr96246-2.C} (76%) diff --git a/gcc/testsuite/gcc.target/i386/avx512bw-pr96246-1.c b/gcc/testsuite/g++.target/i386/avx512bw-pr96246-1.C similarity index 68% rename from gcc/testsuite/gcc.target/i386/avx512bw-pr96246-1.c rename to gcc/testsuite/g++.target/i386/avx512bw-pr96246-1.C index 2bfcc840a91..eec844460f1 100644 --- a/gcc/testsuite/gcc.target/i386/avx512bw-pr96246-1.c +++ b/gcc/testsuite/g++.target/i386/avx512bw-pr96246-1.C @@ -1,8 +1,8 @@ /* PR target/96246 */ /* { dg-do compile } */ -/* { dg-options "-O2 -ftree-vectorize -mavx512bw" } */ -/* { dg-final { scan-assembler-times "vpblendm\[bwdq\]\[\t ]" 4 } } */ -/* { dg-final { scan-assembler-times "vblendmp\[sd\]\[\t ]" 2 } } */ +/* { dg-options "-O2 -std=c++14 -mavx512bw" } */ +/* { dg-final { scan-assembler-times "vpblendm\[bwdq\]\[\t \]" 4 } } */ +/* { dg-final { scan-assembler-times "vblendmp\[sd\]\[\t \]" 2 } } */ typedef char v64qi __attribute__((vector_size (64))); typedef short v32hi __attribute__((vector_size (64))); @@ -16,10 +16,7 @@ typedef double v8df __attribute__((vector_size (64))); __attribute__ ((noipa)) \ foo_##vtype (vtype a, vtype b, vtype c, vtype d) \ { \ - vtype e; \ - for (int i = 0; i != num; i++) \ - e[i] = a[i] > b[i] ? c[i] : d[i]; \ - return e; \ + return a > b ? c : d; \ } COMPILE_TEST (v64qi, 64); diff --git a/gcc/testsuite/gcc.target/i386/avx512bw-pr96246-2.c b/gcc/testsuite/g++.target/i386/avx512bw-pr96246-2.C similarity index 74% rename from gcc/testsuite/gcc.target/i386/avx512bw-pr96246-2.c rename to gcc/testsuite/g++.target/i386/avx512bw-pr96246-2.C index 422fcfe4ea8..b96b7c7c932 100644 --- a/gcc/testsuite/gcc.target/i386/avx512bw-pr96246-2.c +++ b/gcc/testsuite/g++.target/i386/avx512bw-pr96246-2.C @@ -1,19 +1,9 @@ /* PR target/96246 */ /* { dg-do run } */ /* { dg-require-effective-target avx512bw } */ -/* { dg-options "-Ofast -mavx512bw" } */ +/* { dg-options "-O2 -std=c++14 -mavx512bw" } */ -#ifndef CHECK -#define CHECK "avx512f-helper.h" -#endif - -#include CHECK - -#ifndef TEST -#define TEST avx512bw_test -#endif - -#include "avx512bw-pr96246-1.c" +#include "avx512bw-pr96246-1.C" #define RUNTIME_TEST(vtype, num) \ do \ @@ -34,9 +24,8 @@ } \ while (0) -static void -__attribute__ ((optimize (0))) -TEST (void) +int +main (void) { RUNTIME_TEST (v64qi, 64); RUNTIME_TEST (v32hi, 32); @@ -44,4 +33,5 @@ TEST (void) RUNTIME_TEST (v8di, 8); RUNTIME_TEST (v16sf, 16); RUNTIME_TEST (v8df, 8); + return 0; } diff --git a/gcc/testsuite/gcc.target/i386/avx512vl-pr96246-1.c b/gcc/testsuite/g++.target/i386/avx512vl-pr96246-1.C similarity index 73% rename from gcc/testsuite/gcc.target/i386/avx512vl-pr96246-1.c rename to gcc/testsuite/g++.target/i386/avx512vl-pr96246-1.C index 95357d6fc84..66eb9d25f1e 100644 --- a/gcc/testsuite/gcc.target/i386/avx512vl-pr96246-1.c +++ b/gcc/testsuite/g++.target/i386/avx512vl-pr96246-1.C @@ -1,8 +1,8 @@ /* PR target/96246 */ /* { dg-do compile } */ -/* { dg-options "-O2 -ftree-vectorize -mavx512bw -mavx512vl" } */ -/* { dg-final { scan-assembler-times "vpblendm\[bwdq\]\[\t ]" 6 } } */ -/* { dg-final { scan-assembler-times "vblendmp\[sd\]\[\t ]" 3 } } */ +/* { dg-options "-O2 -std=c++14 -mavx512bw -mavx512vl" } */ +/* { dg-final { scan-assembler-times "vpblendm\[bwdq\]\[\t \]" 6 } } */ +/* { dg-final { scan-assembler-times "vblendmp\[sd\]\[\t \]" 3 } } */ typedef char v16qi __attribute__ ((vector_size (16))); typedef char v32qi __attribute__ ((vector_size (32))); @@ -19,10 +19,7 @@ typedef double v4df __attribute__((vector_size (32))); __attribute__ ((noipa)) \ foo_##vtype (vtype a, vtype b, vtype c, vtype d) \ { \ - vtype e; \ - for (int i = 0; i != num; i++) \ - e[i] = a[i] > b[i] ? c[i] : d[i]; \ - return e; \ + return a > b ? c : d; \ } COMPILE_TEST (v16qi, 16); diff --git a/gcc/testsuite/gcc.target/i386/avx512vl-pr96246-2.c b/gcc/testsuite/g++.target/i386/avx512vl-pr96246-2.C similarity index 76% rename from gcc/testsuite/gcc.target/i386/avx512vl-pr96246-2.c rename to gcc/testsuite/g++.target/i386/avx512vl-pr96246-2.C index d219f7c15ad..9a16f0d2c9e 100644 --- a/gcc/testsuite/gcc.target/i386/avx512vl-pr96246-2.c +++ b/gcc/testsuite/g++.target/i386/avx512vl-pr96246-2.C @@ -2,19 +2,9 @@ /* { dg-do run } */ /* { dg-require-effective-target avx512bw } */ /* { dg-require-effective-target avx512vl } */ -/* { dg-options "-Ofast -mavx512bw -mavx512vl" } */ +/* { dg-options "-O2 -std=c++14 -mavx512bw -mavx512vl" } */ -#ifndef CHECK -#define CHECK "avx512f-helper.h" -#endif - -#include CHECK - -#ifndef TEST -#define TEST avx512bw_test -#endif - -#include "avx512vl-pr96246-1.c" +#include "avx512vl-pr96246-1.C" #define RUNTIME_TEST(vtype, num) \ do \ @@ -35,9 +25,8 @@ } \ while (0) -static void -__attribute__ ((optimize (0))) -TEST (void) +int +main (void) { RUNTIME_TEST (v16qi, 16); RUNTIME_TEST (v32qi, 32); @@ -48,4 +37,5 @@ TEST (void) RUNTIME_TEST (v8sf, 8); RUNTIME_TEST (v4di, 4); RUNTIME_TEST (v4df, 4); + return 0; } -- 2.30.2