From: Cesar Philippidis Date: Fri, 19 Jan 2018 14:21:08 +0000 (-0800) Subject: [nvptx] Add support for CUDA 9 X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=6c7c47081ac481c28f31c30e8845d0337556e8a2;p=gcc.git [nvptx] Add support for CUDA 9 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 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index de744567073..7aa2919f0cf 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2018-01-19 Cesar Philippidis + + PR target/83790 + * config/nvptx/nvptx.c (output_init_frag): Don't use generic address + spaces for function labels. + 2018-01-19 Martin Liska * predict.def (PRED_LOOP_EXIT): Change from 85 to 89. diff --git a/gcc/config/nvptx/nvptx.c b/gcc/config/nvptx/nvptx.c index 86fc13f4fc0..4cb87c8ad07 100644 --- a/gcc/config/nvptx/nvptx.c +++ b/gcc/config/nvptx/nvptx.c @@ -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) diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 4618754bc85..f4462485475 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2018-01-19 Cesar Philippidis + + PR target/83790 + * gcc.target/nvptx/indirect_call.c: New test. + 2018-01-19 Rainer Orth * 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 index 00000000000..39992a7137b --- /dev/null +++ b/gcc/testsuite/gcc.target/nvptx/indirect_call.c @@ -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; +}