https://gcc.gnu.org/g:db3bd6317cb39336d722c85933c89aad259228e3
commit db3bd6317cb39336d722c85933c89aad259228e3 Author: Thomas Schwinge <[email protected]> Date: Fri Dec 13 11:40:01 2024 +0100 nvptx: Add '__builtin_frame_address(0)' test case Documenting the status quo. gcc/testsuite/ * gcc.target/nvptx/__builtin_frame_address_0-1.c: New. (cherry picked from commit 86175a64f167e3b1701132fa1684d76230054c36) Diff: --- gcc/testsuite/ChangeLog.omp | 5 +++ .../gcc.target/nvptx/__builtin_frame_address_0-1.c | 36 ++++++++++++++++++++++ 2 files changed, 41 insertions(+) diff --git a/gcc/testsuite/ChangeLog.omp b/gcc/testsuite/ChangeLog.omp index bc3dfa8d0805..7fb5e6c5bc06 100644 --- a/gcc/testsuite/ChangeLog.omp +++ b/gcc/testsuite/ChangeLog.omp @@ -3,6 +3,11 @@ Backported from trunk: 2025-01-10 Thomas Schwinge <[email protected]> + * gcc.target/nvptx/__builtin_frame_address_0-1.c: New. + + Backported from trunk: + 2025-01-10 Thomas Schwinge <[email protected]> + * gcc.target/nvptx/__builtin_stack_address-1.c: New. Backported from trunk: 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 index 000000000000..35817769d31f --- /dev/null +++ b/gcc/testsuite/gcc.target/nvptx/__builtin_frame_address_0-1.c @@ -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. */
