From: Jakub Jelinek Date: Fri, 3 Jan 2020 10:14:03 +0000 (+0100) Subject: re PR target/93089 (Force mprefer-vector-width=512 in 'e' simd clones) X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=1609beddb1bac416456743dff136b486f54a572c;p=gcc.git re PR target/93089 (Force mprefer-vector-width=512 in 'e' simd clones) PR target/93089 * config/i386/i386-options.c (ix86_simd_clone_adjust): If TARGET_PREFER_AVX128, use prefer-vector-width=256 for 'c' and 'd' simd clones. If TARGET_PREFER_AVX256, use prefer-vector-width=512 for 'e' simd clones. * gcc.target/i386/pr93089-2.c: New test. * gcc.target/i386/pr93089-3.c: New test. From-SVN: r279857 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index c1936a53bb3..8cbaa45d7b3 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,5 +1,11 @@ 2020-01-03 Jakub Jelinek + PR target/93089 + * config/i386/i386-options.c (ix86_simd_clone_adjust): If + TARGET_PREFER_AVX128, use prefer-vector-width=256 for 'c' and 'd' + simd clones. If TARGET_PREFER_AVX256, use prefer-vector-width=512 + for 'e' simd clones. + PR target/93089 * config/i386/i386.opt (x_prefer_vector_width_type): Remove TargetSave entry. diff --git a/gcc/config/i386/i386-options.c b/gcc/config/i386/i386-options.c index a4c66e4aebf..2acc9fb0cfe 100644 --- a/gcc/config/i386/i386-options.c +++ b/gcc/config/i386/i386-options.c @@ -2950,15 +2950,36 @@ ix86_simd_clone_adjust (struct cgraph_node *node) str = "sse2"; break; case 'c': - if (!TARGET_AVX) + if (TARGET_PREFER_AVX128) + { + if (!TARGET_AVX) + str = "avx,prefer-vector-width=256"; + else + str = "prefer-vector-width=256"; + } + else if (!TARGET_AVX) str = "avx"; break; case 'd': - if (!TARGET_AVX2) + if (TARGET_PREFER_AVX128) + { + if (!TARGET_AVX2) + str = "avx2,prefer-vector-width=256"; + else + str = "prefer-vector-width=256"; + } + else if (!TARGET_AVX2) str = "avx2"; break; case 'e': - if (!TARGET_AVX512F) + if (TARGET_PREFER_AVX256) + { + if (!TARGET_AVX512F) + str = "avx512f,prefer-vector-width=512"; + else + str = "prefer-vector-width=512"; + } + else if (!TARGET_AVX512F) str = "avx512f"; break; default: diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 48493605dc8..69f1fbdb8a9 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,5 +1,9 @@ 2020-01-03 Jakub Jelinek + PR target/93089 + * gcc.target/i386/pr93089-2.c: New test. + * gcc.target/i386/pr93089-3.c: New test. + PR target/93089 * gcc.target/i386/pr93089-1.c: New test. diff --git a/gcc/testsuite/gcc.target/i386/pr93089-2.c b/gcc/testsuite/gcc.target/i386/pr93089-2.c new file mode 100644 index 00000000000..c167dd60f91 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/pr93089-2.c @@ -0,0 +1,12 @@ +/* PR target/93089 */ +/* { dg-do compile } */ +/* { dg-options "-O2 -fopenmp-simd -mtune=znver1" } */ +/* { dg-final { scan-assembler "vmulps\[^\n\r]*zmm" } } */ +/* { dg-final { scan-assembler "vmulps\[^\n\r]*ymm" } } */ + +#pragma omp declare simd notinbranch +float +foo (float x, float y) +{ + return x * y; +} diff --git a/gcc/testsuite/gcc.target/i386/pr93089-3.c b/gcc/testsuite/gcc.target/i386/pr93089-3.c new file mode 100644 index 00000000000..02f1fae470e --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/pr93089-3.c @@ -0,0 +1,12 @@ +/* PR target/93089 */ +/* { dg-do compile } */ +/* { dg-options "-O2 -fopenmp-simd -mtune=skylake-avx512" } */ +/* { dg-final { scan-assembler "vmulps\[^\n\r]*zmm" } } */ +/* { dg-final { scan-assembler "vmulps\[^\n\r]*ymm" } } */ + +#pragma omp declare simd notinbranch +float +foo (float x, float y) +{ + return x * y; +}