nvptx: Add '__builtin_stack_save()', '__builtin_stack_restore()' test case [PR65181]

Documenting the status quo.

	PR target/65181
	gcc/testsuite/
	* gcc.target/nvptx/__builtin_stack_save___builtin_stack_restore-1.c:
	Add.
This commit is contained in:
Thomas Schwinge 2024-12-13 13:54:10 +01:00
parent 678c3f06fc
commit 2116e8d227

View file

@ -0,0 +1,32 @@
/* Document what we do for '__builtin_stack_save()', '__builtin_stack_restore()'. */
/* { dg-do compile }
TODO We can't 'assemble' this -- it's invalid PTX code. */
/* { dg-options {-O3 -mno-soft-stack} } */
/* { dg-additional-options -save-temps } */
/* { dg-final { check-function-bodies {** } {} } } */
void *p;
void f(void)
{
p = __builtin_stack_save();
asm volatile ("" : : : "memory");
__builtin_stack_restore(p);
asm volatile ("" : : : "memory");
}
/*
** f:
** \.visible \.func f
** {
** st\.global\.u64 \[p\], %stack;
** ret;
*/
/* The concept of a '%stack' pointer doesn't apply like this for
'-mno-soft-stack': PTX "native" stacks (TODO).
{ dg-final { scan-assembler-not {%stack} { xfail *-*-* } } } */
/* As these are an internal-use built-in function, we don't bother with
emitting proper error diagnostics. */