]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
nvptx: Add '__builtin_frame_address(0)' test case
authorThomas Schwinge <tschwinge@baylibre.com>
Fri, 13 Dec 2024 10:40:01 +0000 (11:40 +0100)
committerThomas Schwinge <tschwinge@baylibre.com>
Fri, 10 Jan 2025 10:45:35 +0000 (11:45 +0100)
Documenting the status quo.

gcc/testsuite/
* gcc.target/nvptx/__builtin_frame_address_0-1.c: New.

gcc/testsuite/gcc.target/nvptx/__builtin_frame_address_0-1.c [new file with mode: 0644]

diff --git a/gcc/testsuite/gcc.target/nvptx/__builtin_frame_address_0-1.c b/gcc/testsuite/gcc.target/nvptx/__builtin_frame_address_0-1.c
new file mode 100644 (file)
index 0000000..3581776
--- /dev/null
@@ -0,0 +1,36 @@
+/* Document what we do for '__builtin_frame_address(0)'.  */
+
+/* { dg-do compile }
+   TODO We can't 'assemble' this -- it's invalid PTX code.  */
+/* { dg-options -O3 } */
+/* { dg-additional-options -save-temps } */
+/* { dg-final { check-function-bodies {** } {} } } */
+
+void sink(void *);
+
+void f(void)
+{
+  void *p;
+  p = __builtin_frame_address(0);
+  sink(p);
+}
+/*
+** f:
+** \.visible \.func f
+** {
+**     {
+**             \.param\.u64 %out_arg1;
+**             st\.param\.u64 \[%out_arg1\], %frame;
+**             call sink, \(%out_arg1\);
+**     }
+**     ret;
+*/
+
+/* The concept of a '%frame' pointer doesn't apply like this for
+   '-mno-soft-stack': PTX "native" stacks (TODO), and for '-msoft-stack' in
+   this form also constitutes invalid PTX code (TODO).
+
+   { dg-final { scan-assembler-not {%frame} { xfail *-*-* } } } */
+
+/* As this is an internal-use built-in function, we don't bother with
+   emitting proper error diagnostics.  */