nvptx: Add '__builtin_alloca(0)' test cases [PR65181]
Documenting the status quo. This specific behavior relates to a 1994 change
(Subversion r7229, Git commit 15fc002672
).
That one, however, isn't to blame here: we'd otherwise of course run into
nvptx' 'sorry, unimplemented: target cannot support alloca'.
PR target/65181
gcc/testsuite/
* gcc.target/nvptx/__builtin_alloca_0-1-O0.c: New.
* gcc.target/nvptx/__builtin_alloca_0-1-O1.c: Likewise.
This commit is contained in:
parent
36eee5a74e
commit
678c3f06fc
2 changed files with 70 additions and 0 deletions
37
gcc/testsuite/gcc.target/nvptx/__builtin_alloca_0-1-O0.c
Normal file
37
gcc/testsuite/gcc.target/nvptx/__builtin_alloca_0-1-O0.c
Normal file
|
@ -0,0 +1,37 @@
|
|||
/* Document what we run into for '__builtin_alloca(0)'. */
|
||||
|
||||
/* { dg-do compile }
|
||||
TODO We can't 'assemble' this -- it's invalid PTX code. */
|
||||
/* { dg-options {-O0 -mno-soft-stack} } */
|
||||
/* { dg-additional-options -save-temps } */
|
||||
/* { dg-final { check-function-bodies {** } {} } } */
|
||||
|
||||
void sink(void *);
|
||||
|
||||
void f(void)
|
||||
{
|
||||
sink(__builtin_alloca(0));
|
||||
}
|
||||
/*
|
||||
** f:
|
||||
** .visible .func f
|
||||
** {
|
||||
** \.reg\.u64 (%r[0-9]+);
|
||||
** \.reg\.u64 (%r[0-9]+);
|
||||
** mov\.u64 \1, %stack;
|
||||
** mov\.u64 \2, \1;
|
||||
** {
|
||||
** \.param\.u64 %out_arg1;
|
||||
** st\.param\.u64 \[%out_arg1\], \2;
|
||||
** call sink, \(%out_arg1\);
|
||||
** }
|
||||
** ret;
|
||||
*/
|
||||
|
||||
/* '%stack' is 'VIRTUAL_STACK_DYNAMIC_REGNUM', 'virtual_stack_dynamic_rtx'.
|
||||
For '__builtin_alloca (0)', we get to
|
||||
'gcc/explow.cc:allocate_dynamic_stack_space', where 'addr' gets set to
|
||||
'virtual_stack_dynamic_rtx', 'size == const0_rtx', therefore 'return addr;',
|
||||
which gets us '%stack' -- undefined (TODO).
|
||||
|
||||
{ dg-final { scan-assembler-not {%stack} { xfail *-*-* } } } */
|
33
gcc/testsuite/gcc.target/nvptx/__builtin_alloca_0-1-O1.c
Normal file
33
gcc/testsuite/gcc.target/nvptx/__builtin_alloca_0-1-O1.c
Normal file
|
@ -0,0 +1,33 @@
|
|||
/* Document what we run into for '__builtin_alloca(0)'. */
|
||||
|
||||
/* { dg-do compile }
|
||||
TODO We can't 'assemble' this -- it's invalid PTX code. */
|
||||
/* { dg-options {-O1 -mno-soft-stack} } */
|
||||
/* { dg-additional-options -save-temps } */
|
||||
/* { dg-final { check-function-bodies {** } {} } } */
|
||||
|
||||
void sink(void *);
|
||||
|
||||
void f(void)
|
||||
{
|
||||
sink(__builtin_alloca(0));
|
||||
}
|
||||
/*
|
||||
** f:
|
||||
** .visible .func f
|
||||
** {
|
||||
** {
|
||||
** \.param\.u64 %out_arg1;
|
||||
** st\.param\.u64 \[%out_arg1\], %stack;
|
||||
** call sink, \(%out_arg1\);
|
||||
** }
|
||||
** ret;
|
||||
*/
|
||||
|
||||
/* '%stack' is 'VIRTUAL_STACK_DYNAMIC_REGNUM', 'virtual_stack_dynamic_rtx'.
|
||||
For '__builtin_alloca (0)', we get to
|
||||
'gcc/explow.cc:allocate_dynamic_stack_space', where 'addr' gets set to
|
||||
'virtual_stack_dynamic_rtx', 'size == const0_rtx', therefore 'return addr;',
|
||||
which gets us '%stack' -- undefined (TODO).
|
||||
|
||||
{ dg-final { scan-assembler-not {%stack} { xfail *-*-* } } } */
|
Loading…
Add table
Reference in a new issue