multiple_target.c (create_dispatcher_calls): Add target check on ifunc.
authorEvgeny Stupachenko <evstupac@gmail.com>
Tue, 3 Nov 2015 12:02:53 +0000 (12:02 +0000)
committerIlya Verbin <iverbin@gcc.gnu.org>
Tue, 3 Nov 2015 12:02:53 +0000 (12:02 +0000)
2015-11-03  Evgeny Stupachenko  <evstupac@gmail.com>

gcc/
* multiple_target.c (create_dispatcher_calls): Add target check
on ifunc.
(create_target_clone): Change assembler name for versioned declarations.
gcc/testsuite/
* g++.dg/ext/mvc4.C: Add dg-require-ifunc condition.
* gcc.target/i386/mvc5.c: Ditto.
* gcc.target/i386/mvc7.c: Add dg-require-ifunc condition and checks on
resolver.

From-SVN: r229706

gcc/ChangeLog
gcc/multiple_target.c
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/ext/mvc4.C
gcc/testsuite/gcc.target/i386/mvc5.c
gcc/testsuite/gcc.target/i386/mvc7.c

index 947b9a7c8f75881a9915dcccdae4f4a4478beaec..97a1101d3866ac217583e399be1e2753fb6000a9 100644 (file)
@@ -1,3 +1,9 @@
+2015-11-03  Evgeny Stupachenko  <evstupac@gmail.com>
+
+       * multiple_target.c (create_dispatcher_calls): Add target check
+       on ifunc.
+       (create_target_clone): Change assembler name for versioned declarations.
+
 2015-11-03  Thomas Schwinge  <thomas@codesourcery.com>
            Chung-Lin Tang  <cltang@codesourcery.com>
 
index 54618d8ed86abea6f25155e8a6ce8f13626f2e9c..8cca281b044de7f6481c19b9d4b871acd157c164 100644 (file)
@@ -61,12 +61,20 @@ create_dispatcher_calls (struct cgraph_node *node)
          || !DECL_FUNCTION_VERSIONED (decl))
        continue;
 
+      if (!targetm.has_ifunc_p ())
+       {
+         error_at (gimple_location (call),
+                   "the call requires ifunc, which is not"
+                   " supported by this target");
+         break;
+       }
       e_next = e->next_caller;
       idecl = targetm.get_function_versions_dispatcher (decl);
       if (!idecl)
        {
          error_at (gimple_location (call),
                    "default target_clones attribute was not set");
+         break;
        }
       inode = cgraph_node::get (idecl);
       gcc_assert (inode);
@@ -215,6 +223,10 @@ create_target_clone (cgraph_node *node, bool definition, char *name)
     {
       tree new_decl = copy_node (node->decl);
       new_node = cgraph_node::get_create (new_decl);
+      /* Generate a new name for the new version.  */
+      symtab->change_decl_assembler_name (new_node->decl,
+                                         clone_function_name (node->decl,
+                                                              name));
     }
   return new_node;
 }
index c1ac2b002e57caf4ce901eca9d155887acaec18c..8b9bf4c6ef74d829c1993ee13e68dd861e159be8 100644 (file)
@@ -1,3 +1,10 @@
+2015-11-03  Evgeny Stupachenko  <evstupac@gmail.com>
+
+       * g++.dg/ext/mvc4.C: Add dg-require-ifunc condition.
+       * gcc.target/i386/mvc5.c: Ditto.
+       * gcc.target/i386/mvc7.c: Add dg-require-ifunc condition and checks on
+       resolver.
+
 2015-11-03  Thomas Schwinge  <thomas@codesourcery.com>
 
        * c-c++-common/goacc-gomp/nesting-fail-1.c: Move "atomic" tests
index 98e350259d7c11d56a5eb3ac110f53dbba335230..6e18e5604763878121c6f30f799eaf5d75252bb2 100644 (file)
@@ -1,4 +1,5 @@
 /* { dg-do compile { target i?86-*-* x86_64-*-* } } */
+/* { dg-require-ifunc "" } */
 /* { dg-options "-mavx" } */
 
 #include <immintrin.h>
index 0b1981d4ad6a3948fd0d3b6418f259f47fe0f9ae..8fea04c792bf39189ab6e4bd5f1387368c31a3a6 100644 (file)
@@ -1,4 +1,5 @@
 /* { dg-do compile } */
+/* { dg-require-ifunc "" } */
 /* { dg-options "-fno-inline" } */
 /* { dg-final { scan-assembler-times "foo.ifunc" 6 } } */
 
index efc4b69aa4936377bf63ada59aa3f55b655bb804..9a9d7a3da3098ee4c575dab9bc74f36b97f0b27c 100644 (file)
@@ -1,4 +1,8 @@
 /* { dg-do compile } */
+/* { dg-require-ifunc "" } */
+/* { dg-final { scan-assembler "foo.resolver" } } */
+/* { dg-final { scan-assembler "avx" } } */
+/* { dg-final { scan-assembler "slm" } } */
 /* { dg-final { scan-assembler-times "foo.ifunc" 4 } } */
 
 __attribute__((target_clones("avx","default","arch=slm","arch=core-avx2")))