Debian Codegraph @

gcc/testsuite/gcc.target/nvptx/__builtin_alloca_0-1-O0.c

raw
1 /* Document what we run into for '__builtin_alloca(0)'. */
2
3 /* { dg-do compile }
4 TODO We can't 'assemble' this -- it's invalid PTX code. */
5 /* { dg-options {-O0 -mno-soft-stack} } */
6 /* { dg-additional-options -save-temps } */
7 /* { dg-final { check-function-bodies {** } {} } } */
8
9 /* See 'gcc.c-torture/execute/pr36321.c', '-O0'. */
10
11 void sink(void *);
12
13 void f(void)
14 {
15 sink(__builtin_alloca(0));
16 }
17 /*
18 ** f:
19 ** .visible .func f
20 ** {
21 ** \.reg\.u64 (%r[0-9]+);
22 ** \.reg\.u64 (%r[0-9]+);
23 ** mov\.u64 \1, %stack;
24 ** mov\.u64 \2, \1;
25 ** {
26 ** \.param\.u64 %out_arg1;
27 ** st\.param\.u64 \[%out_arg1\], \2;
28 ** call sink, \(%out_arg1\);
29 ** }
30 ** ret;
31 */
32
33 /* '%stack' is 'VIRTUAL_STACK_DYNAMIC_REGNUM', 'virtual_stack_dynamic_rtx'.
34 For '__builtin_alloca (0)', we get to
35 'gcc/explow.cc:allocate_dynamic_stack_space', where 'addr' gets set to
36 'virtual_stack_dynamic_rtx', 'size == const0_rtx', therefore 'return addr;',
37 which gets us '%stack' -- undefined (TODO).
38
39 { dg-final { scan-assembler-not {%stack} { xfail *-*-* } } } */