This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH,PTX] Add support for CUDA 9
- From: Thomas Schwinge <thomas at codesourcery dot com>
- To: <gcc-patches at gcc dot gnu dot org>
- Cc: Richard Biener <rguenther at suse dot de>, Tom de Vries <Tom_deVries at mentor dot com>, Cesar Philippidis <cesar at codesourcery dot com>
- Date: Fri, 2 Mar 2018 09:45:36 +0100
- Subject: Re: [PATCH,PTX] Add support for CUDA 9
- Authentication-results: sourceware.org; auth=none
- References: <002bf03f-baad-5809-6e9a-2fdffa0c1e2c@codesourcery.com> <b5538b37-d900-2fb1-b60e-bd1d76b247fe@mentor.com> <6fd03d69-e18f-fb3d-f7c3-f833c8ba5ff7@codesourcery.com> <eb73444a-3b12-8436-1569-9b36e1a70862@mentor.com> <87sh9mjzjb.fsf@euler.schwinge.homeip.net> <alpine.LSU.2.20.1802271512420.18265@zhemvz.fhfr.qr>
Hi!
On Tue, 27 Feb 2018 15:12:47 +0100, Richard Biener <rguenther@suse.de> wrote:
> On Tue, 27 Feb 2018, Thomas Schwinge wrote:
> > Given that several users have run into this, is this (trunk r256891) OK
> > to commit to open release branches, too.
>
> Sure.
Committed to gcc-7-branch in r258126:
commit f0888f115525785d8876d1718fcb0580996e2f30
Author: tschwinge <tschwinge@138bc75d-0d04-0410-961f-82ee72b054a4>
Date: Fri Mar 2 08:39:31 2018 +0000
[nvptx] Add support for CUDA 9
Backport trunk r256891:
gcc/
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.
gcc/testsuite/
2018-01-19 Cesar Philippidis <cesar@codesourcery.com>
PR target/83790
* gcc.target/nvptx/indirect_call.c: New test.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/gcc-7-branch@258126 138bc75d-0d04-0410-961f-82ee72b054a4
---
gcc/ChangeLog | 9 +++++++++
gcc/config/nvptx/nvptx.c | 10 ++++++++--
gcc/testsuite/ChangeLog | 8 ++++++++
gcc/testsuite/gcc.target/nvptx/indirect_call.c | 19 +++++++++++++++++++
4 files changed, 44 insertions(+), 2 deletions(-)
diff --git gcc/ChangeLog gcc/ChangeLog
index def6171..5390d49 100644
--- gcc/ChangeLog
+++ gcc/ChangeLog
@@ -1,3 +1,12 @@
+2017-03-02 Thomas Schwinge <thomas@codesourcery.com>
+
+ Backport from trunk r256891:
+ 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-02-26 Carl Love <cel@us.ibm.com>
Backport from mainline: commit 257747 on 2018-02-16.
diff --git gcc/config/nvptx/nvptx.c gcc/config/nvptx/nvptx.c
index e89b314..70a8f0d 100644
--- gcc/config/nvptx/nvptx.c
+++ gcc/config/nvptx/nvptx.c
@@ -1875,9 +1875,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 gcc/testsuite/ChangeLog gcc/testsuite/ChangeLog
index 359cbac..2d94cd1 100644
--- gcc/testsuite/ChangeLog
+++ gcc/testsuite/ChangeLog
@@ -1,3 +1,11 @@
+2017-03-02 Thomas Schwinge <thomas@codesourcery.com>
+
+ Backport from trunk r256891:
+ 2018-01-19 Cesar Philippidis <cesar@codesourcery.com>
+
+ PR target/83790
+ * gcc.target/nvptx/indirect_call.c: New test.
+
2017-03-01 Thomas Preud'homme <thomas.preudhomme@arm.com>
Backport from mainline
diff --git gcc/testsuite/gcc.target/nvptx/indirect_call.c gcc/testsuite/gcc.target/nvptx/indirect_call.c
new file mode 100644
index 0000000..39992a7
--- /dev/null
+++ 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;
+}
Committed to gcc-6-branch in r258127:
commit 5eec276cf6e2721ba60e187edeb00af5f6b7565f
Author: tschwinge <tschwinge@138bc75d-0d04-0410-961f-82ee72b054a4>
Date: Fri Mar 2 08:40:04 2018 +0000
[nvptx] Add support for CUDA 9
Backport trunk r256891:
gcc/
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.
gcc/testsuite/
2018-01-19 Cesar Philippidis <cesar@codesourcery.com>
PR target/83790
* gcc.target/nvptx/indirect_call.c: New test.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/gcc-6-branch@258127 138bc75d-0d04-0410-961f-82ee72b054a4
---
gcc/ChangeLog | 9 +++++++++
gcc/config/nvptx/nvptx.c | 10 ++++++++--
gcc/testsuite/ChangeLog | 8 ++++++++
gcc/testsuite/gcc.target/nvptx/indirect_call.c | 19 +++++++++++++++++++
4 files changed, 44 insertions(+), 2 deletions(-)
diff --git gcc/ChangeLog gcc/ChangeLog
index cebcf85..23296f2 100644
--- gcc/ChangeLog
+++ gcc/ChangeLog
@@ -1,3 +1,12 @@
+2017-03-02 Thomas Schwinge <thomas@codesourcery.com>
+
+ Backport from trunk r256891:
+ 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-02-21 Sudakshina Das <sudi.das@arm.com>
Backport from trunk
diff --git gcc/config/nvptx/nvptx.c gcc/config/nvptx/nvptx.c
index 2262005..16e80421 100644
--- gcc/config/nvptx/nvptx.c
+++ gcc/config/nvptx/nvptx.c
@@ -1483,9 +1483,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 gcc/testsuite/ChangeLog gcc/testsuite/ChangeLog
index b1abb94..e2c0b7a 100644
--- gcc/testsuite/ChangeLog
+++ gcc/testsuite/ChangeLog
@@ -1,3 +1,11 @@
+2017-03-02 Thomas Schwinge <thomas@codesourcery.com>
+
+ Backport from trunk r256891:
+ 2018-01-19 Cesar Philippidis <cesar@codesourcery.com>
+
+ PR target/83790
+ * gcc.target/nvptx/indirect_call.c: New test.
+
2018-02-28 Alan Modra <amodra@gmail.com>
* lib/prune.exp (prune_gcc_output): Match lower case "in function"
diff --git gcc/testsuite/gcc.target/nvptx/indirect_call.c gcc/testsuite/gcc.target/nvptx/indirect_call.c
new file mode 100644
index 0000000..5ac939e
--- /dev/null
+++ gcc/testsuite/gcc.target/nvptx/indirect_call.c
@@ -0,0 +1,19 @@
+/* { dg-options "-O2" } */
+/* { dg-do run } */
+
+int
+f1 (int a)
+{
+ return a + 1;
+}
+
+int (*f2)(int) = f1;
+
+int
+main ()
+{
+ if (f2 (100) != 101)
+ __builtin_abort();
+
+ return 0;
+}
Grüße
Thomas