]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
nvptx: Clarify that the PTX "native" stack pointer is handled implicitly at function...
authorThomas Schwinge <tschwinge@baylibre.com>
Tue, 10 Dec 2024 10:11:26 +0000 (11:11 +0100)
committerThomas Schwinge <tschwinge@baylibre.com>
Wed, 8 Jan 2025 22:05:12 +0000 (23:05 +0100)
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'.

gcc/config/nvptx/nvptx.h
gcc/config/nvptx/nvptx.md

index 013ebada960f33c83a99baf952722bcc28541303..985f9bc69ceb94bb344cacc45c17bb47abd9be36 100644 (file)
 #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
index 56cd25e77e45e8dbe324bb1fb2c0b94455450646..b300f2e596c55b4bfc6ae1b453de2ab68dc4e050 100644 (file)
   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;
 })