diff options
author | Thomas Schwinge <tschwinge@baylibre.com> | 2024-12-10 11:11:26 +0100 |
---|---|---|
committer | Thomas Schwinge <tschwinge@baylibre.com> | 2025-01-08 23:05:12 +0100 |
commit | dcbd260a1dff3f93ed1aa6fd962e92bae8933dc6 (patch) | |
tree | 14324765f07d6e51fd55c1c299be52b899872c5b | |
parent | 1823170805a3b36848d096dbdd28b479e16cf443 (diff) | |
download | gcc-dcbd260a1dff3f93ed1aa6fd962e92bae8933dc6.zip gcc-dcbd260a1dff3f93ed1aa6fd962e92bae8933dc6.tar.gz gcc-dcbd260a1dff3f93ed1aa6fd962e92bae8933dc6.tar.bz2 |
nvptx: Clarify that the PTX "native" stack pointer is handled implicitly at function level [PR65181]
PR target/65181
gcc/
* config/nvptx/nvptx.h (STACK_SAVEAREA_MODE): '#define'.
* config/nvptx/nvptx.md [!TARGET_SOFT_STACK]
(save_stack_function): 'define_expand'.
(restore_stack_function): Handle '!TARGET_SOFT_STACK'.
-rw-r--r-- | gcc/config/nvptx/nvptx.h | 7 | ||||
-rw-r--r-- | gcc/config/nvptx/nvptx.md | 13 |
2 files changed, 20 insertions, 0 deletions
diff --git a/gcc/config/nvptx/nvptx.h b/gcc/config/nvptx/nvptx.h index 013ebad..985f9bc 100644 --- a/gcc/config/nvptx/nvptx.h +++ b/gcc/config/nvptx/nvptx.h @@ -86,6 +86,13 @@ #define Pmode (TARGET_ABI64 ? DImode : SImode) #define STACK_SIZE_MODE Pmode +/* We always have to maintain the '-msoft-stack' pointer, but the PTX "native" + stack pointer is handled implicitly at function level. */ +#define STACK_SAVEAREA_MODE(LEVEL) \ + (TARGET_SOFT_STACK ? Pmode \ + : (LEVEL == SAVE_FUNCTION ? VOIDmode \ + : Pmode)) + #include "nvptx-gen.h" /* There are no 'TARGET_PTX_3_1' and smaller conditionals: our baseline is diff --git a/gcc/config/nvptx/nvptx.md b/gcc/config/nvptx/nvptx.md index 56cd25e..b300f2e 100644 --- a/gcc/config/nvptx/nvptx.md +++ b/gcc/config/nvptx/nvptx.md @@ -1716,11 +1716,24 @@ DONE; }) +(define_expand "save_stack_function" + [(match_operand 0 "register_operand" "") + (match_operand 1 "register_operand" "")] + "!TARGET_SOFT_STACK" +{ + /* See 'STACK_SAVEAREA_MODE'. */ + gcc_checking_assert (operands[0] == 0); + DONE; +}) + (define_expand "restore_stack_function" [(match_operand 0 "register_operand" "") (match_operand 1 "register_operand" "")] "" { + if (!TARGET_SOFT_STACK) + /* See 'STACK_SAVEAREA_MODE'. */ + gcc_checking_assert (operands[1] == 0); DONE; }) |