Hi!

On 2015-08-21T15:31:06-0400, Nathan Sidwell <nat...@acm.org> wrote:
> 1) alloca.  PTX defines but doesn't implement support. and if one passes 
> types 
> suitable for a 64-bit ABI ptxas emits errors.  This patch gives a clear error 
> at 
> compilation time, rather than an obscure failure later.

> --- config/nvptx/nvptx.md     (revision 227059)
> +++ config/nvptx/nvptx.md     (working copy)
> @@ -1241,6 +1241,12 @@
>     (match_operand 1 "nvptx_register_operand")]
>    ""
>  {
> +  /* The ptx documentation specifies an alloca intrinsic (for 32 bit
> +     only)  but notes it is not implemented.  The assembler emits a
> +     confused error message.  Issue a blunt one now instead.  */
> +  sorry ("target cannot support alloca.");
> +  emit_insn (gen_nop ());
> +  DONE;

Pushed to trunk branch commit aae1db742a1766365c0c7023be55ebef67b70bf4
"nvptx: Add 'sorry, unimplemented: target cannot support alloca' test cases 
[PR65181]",
see attached.


Grüße
 Thomas


>From aae1db742a1766365c0c7023be55ebef67b70bf4 Mon Sep 17 00:00:00 2001
From: Thomas Schwinge <tschwi...@baylibre.com>
Date: Wed, 11 Dec 2024 15:22:06 +0100
Subject: [PATCH] nvptx: Add 'sorry, unimplemented: target cannot support
 alloca' test cases [PR65181]

Documenting the status quo.

	PR target/65181
	gcc/testsuite/
	* gcc.target/nvptx/alloca-1.c: New.
	* gcc.target/nvptx/vla-1.c: Likewise.
---
 gcc/testsuite/gcc.target/nvptx/alloca-1.c | 10 ++++++++++
 gcc/testsuite/gcc.target/nvptx/vla-1.c    | 11 +++++++++++
 2 files changed, 21 insertions(+)
 create mode 100644 gcc/testsuite/gcc.target/nvptx/alloca-1.c
 create mode 100644 gcc/testsuite/gcc.target/nvptx/vla-1.c

diff --git a/gcc/testsuite/gcc.target/nvptx/alloca-1.c b/gcc/testsuite/gcc.target/nvptx/alloca-1.c
new file mode 100644
index 000000000000..0aa6f107b526
--- /dev/null
+++ b/gcc/testsuite/gcc.target/nvptx/alloca-1.c
@@ -0,0 +1,10 @@
+/* { dg-do compile } */
+/* { dg-options -mno-soft-stack } */
+
+void sink(void *);
+
+void f(void)
+{
+  sink(__builtin_alloca(123));
+  /* { dg-message {sorry, unimplemented: target cannot support alloca} {} { target *-*-* } .-1 } */
+}
diff --git a/gcc/testsuite/gcc.target/nvptx/vla-1.c b/gcc/testsuite/gcc.target/nvptx/vla-1.c
new file mode 100644
index 000000000000..5baf95cecfcc
--- /dev/null
+++ b/gcc/testsuite/gcc.target/nvptx/vla-1.c
@@ -0,0 +1,11 @@
+/* { dg-do compile } */
+/* { dg-options -mno-soft-stack } */
+
+void sink(void *);
+
+void f(int s)
+{
+  char a[s];
+  /* { dg-message {sorry, unimplemented: target cannot support alloca} {} { target *-*-* } .-1 } */
+  sink(a);
+}
-- 
2.34.1

Reply via email to