[nvptx] Add support for CUDA 9
authorCesar Philippidis <cesar@codesourcery.com>
Fri, 19 Jan 2018 14:21:08 +0000 (06:21 -0800)
committerCesar Philippidis <cesar@gcc.gnu.org>
Fri, 19 Jan 2018 14:21:08 +0000 (06:21 -0800)
PR target/83790

gcc/
* config/nvptx/nvptx.c (output_init_frag): Don't use generic address
spaces for function labels.

gcc/testsuite/
* gcc.target/nvptx/indirect_call.c: New test.

From-SVN: r256891

gcc/ChangeLog
gcc/config/nvptx/nvptx.c
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.target/nvptx/indirect_call.c [new file with mode: 0644]

index de7445670732e4b26d374bb81c7ffff8a0d8862e..7aa2919f0cf5dc5a7fcddf96ec206d4257867afb 100644 (file)
@@ -1,3 +1,9 @@
+2018-01-19  Cesar Philippidis  <cesar@codesourcery.com>
+
+       PR target/83790
+       * config/nvptx/nvptx.c (output_init_frag): Don't use generic address
+       spaces for function labels.
+
 2018-01-19  Martin Liska  <mliska@suse.cz>
 
        * predict.def (PRED_LOOP_EXIT): Change from 85 to 89.
index 86fc13f4fc05d1fc9f4a03fc3cfc179ac1b9e6d6..4cb87c8ad072c663d763d93f8fef88308dfdfb1a 100644 (file)
@@ -1899,9 +1899,15 @@ output_init_frag (rtx sym)
   
   if (sym)
     {
-      fprintf (asm_out_file, "generic(");
+      bool function = (SYMBOL_REF_DECL (sym)
+                      && (TREE_CODE (SYMBOL_REF_DECL (sym)) == FUNCTION_DECL));
+      if (!function)
+       fprintf (asm_out_file, "generic(");
       output_address (VOIDmode, sym);
-      fprintf (asm_out_file, val ? ") + " : ")");
+      if (!function)
+       fprintf (asm_out_file, ")");
+      if (val)
+       fprintf (asm_out_file, " + ");
     }
 
   if (!sym || val)
index 4618754bc855375e50ae5a47265e035ffb57bbac..f4462485475444273f2b4103cbdfb6fa985aadfd 100644 (file)
@@ -1,3 +1,8 @@
+2018-01-19  Cesar Philippidis  <cesar@codesourcery.com>
+
+       PR target/83790
+       * gcc.target/nvptx/indirect_call.c: New test.
+
 2018-01-19  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>
 
        * g++.dg/torture/pr83619.C: Remove dg-message.
diff --git a/gcc/testsuite/gcc.target/nvptx/indirect_call.c b/gcc/testsuite/gcc.target/nvptx/indirect_call.c
new file mode 100644 (file)
index 0000000..39992a7
--- /dev/null
@@ -0,0 +1,19 @@
+/* { dg-options "-O2 -msoft-stack" } */
+/* { dg-do run } */
+
+int
+f1 (int a)
+{
+  return a + 1;
+}
+  
+int (*f2)(int) = f1;
+
+int
+main ()
+{
+  if (f2 (100) != 101)
+    __builtin_abort();
+
+  return 0;
+}