From aa16689ea76811f6dbd44bcc8ae4b5a6611e18b5 Mon Sep 17 00:00:00 2001 From: Jakub Jelinek Date: Thu, 14 Nov 2019 09:15:31 +0100 Subject: [PATCH] i386-options.c (ix86_omp_device_kind_arch_isa): Don't change sse4.2 to sse4_2 and sse4.1 to sse4.1. * config/i386/i386-options.c (ix86_omp_device_kind_arch_isa): Don't change sse4.2 to sse4_2 and sse4.1 to sse4.1. * config/i386/t-omp-device (omp-device-properties-i386): Likewise. * c-c++-common/gomp/declare-variant-11.c: Add "sse4.2" and "sse4.1" test. From-SVN: r278205 --- gcc/ChangeLog | 4 ++++ gcc/config/i386/i386-options.c | 10 ++-------- gcc/config/i386/t-omp-device | 2 +- gcc/testsuite/ChangeLog | 3 +++ gcc/testsuite/c-c++-common/gomp/declare-variant-11.c | 2 +- 5 files changed, 11 insertions(+), 10 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 7da3e6df487..4a23dfc2ac2 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,5 +1,9 @@ 2019-11-14 Jakub Jelinek + * config/i386/i386-options.c (ix86_omp_device_kind_arch_isa): Don't + change sse4.2 to sse4_2 and sse4.1 to sse4.1. + * config/i386/t-omp-device (omp-device-properties-i386): Likewise. + * omp-general.c (omp_context_name_list_prop): New function. (omp_context_selector_matches): Use it. Return 0 if it returns NULL. diff --git a/gcc/config/i386/i386-options.c b/gcc/config/i386/i386-options.c index b082228ebf2..7470013437f 100644 --- a/gcc/config/i386/i386-options.c +++ b/gcc/config/i386/i386-options.c @@ -316,19 +316,13 @@ ix86_omp_device_kind_arch_isa (enum omp_device_kind_arch_isa trait, HOST_WIDE_INT mask = i ? ix86_isa_flags2 : ix86_isa_flags; for (size_t n = 0; n < nopts; n++) { - const char *option = opts[n].option + 2; - /* -msse4.2 and -msse4.1 options contain dot, which is not valid - in identifiers. Use underscore instead, and handle sse4 - as an alias to sse4_2. */ + /* Handle sse4 as an alias to sse4.2. */ if (opts[n].mask == OPTION_MASK_ISA_SSE4_2) { - option = "sse4_2"; if (strcmp (name, "sse4") == 0) return (mask & opts[n].mask) != 0 ? 1 : -1; } - else if (opts[n].mask == OPTION_MASK_ISA_SSE4_1) - option = "sse4_1"; - if (strcmp (name, option) == 0) + if (strcmp (name, opts[n].option + 2) == 0) return (mask & opts[n].mask) != 0 ? 1 : -1; } } diff --git a/gcc/config/i386/t-omp-device b/gcc/config/i386/t-omp-device index 26de162b54b..037ae5e112d 100644 --- a/gcc/config/i386/t-omp-device +++ b/gcc/config/i386/t-omp-device @@ -3,4 +3,4 @@ omp-device-properties-i386: $(srcdir)/config/i386/i386-options.c echo arch: x86 x86_64 i386 i486 i586 i686 ia32 >> $@ echo isa: sse4 `sed -n '/^static struct ix86_target_opts isa2\?_opts\[\] =/,/^};/p' \ $(srcdir)/config/i386/i386-options.c | \ - sed -n 's/",.*$$//;s/\./_/;s/^ { "-m//p'` >> $@ + sed -n 's/",.*$$//;s/^ { "-m//p'` >> $@ diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index b94cac2b50b..19aaa423bfc 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,5 +1,8 @@ 2019-11-14 Jakub Jelinek + * c-c++-common/gomp/declare-variant-11.c: Add "sse4.2" and "sse4.1" + test. + * c-c++-common/gomp/declare-variant-2.c: Add test for non-integral score and for negative score. * c-c++-common/gomp/declare-variant-3.c: Add test for zero score. diff --git a/gcc/testsuite/c-c++-common/gomp/declare-variant-11.c b/gcc/testsuite/c-c++-common/gomp/declare-variant-11.c index 9589948a0f7..50a3132869c 100644 --- a/gcc/testsuite/c-c++-common/gomp/declare-variant-11.c +++ b/gcc/testsuite/c-c++-common/gomp/declare-variant-11.c @@ -14,7 +14,7 @@ void f05 (void); void f06 (void); void f07 (void); void f08 (void); -#pragma omp declare variant (f07) match (device={isa(sse4,sse3,"avx")}) +#pragma omp declare variant (f07) match (device={isa(sse4,"sse4.1","sse4.2",sse3,"avx")}) #pragma omp declare variant (f08) match (device={isa("avx",sse3)}) void f09 (void); void f10 (void); -- 2.30.2