]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
Add 'gcc.target/nvptx/stack_frame-1.c'
authorThomas Schwinge <tschwinge@baylibre.com>
Wed, 26 Feb 2025 16:17:44 +0000 (17:17 +0100)
committerThomas Schwinge <tschwinge@baylibre.com>
Thu, 27 Feb 2025 20:48:15 +0000 (21:48 +0100)
gcc/testsuite/
* gcc.target/nvptx/stack_frame-1.c: New.

gcc/testsuite/gcc.target/nvptx/stack_frame-1.c [new file with mode: 0644]

diff --git a/gcc/testsuite/gcc.target/nvptx/stack_frame-1.c b/gcc/testsuite/gcc.target/nvptx/stack_frame-1.c
new file mode 100644 (file)
index 0000000..476d0ac
--- /dev/null
@@ -0,0 +1,34 @@
+/* GCC emits an unused stack frame.  */
+
+/* { dg-do assemble } */
+/* { dg-options {-O2 -mno-soft-stack} } */
+/* { dg-additional-options -save-temps } */
+/* { dg-final { check-function-bodies {** } {} } } */
+
+/* Greatly reduced from libgcc code, where this issue is visible for
+   '_divdi3.o:__divti3', '_divmoddi4.o:__divmodti4', '_moddi3.o:__modti3',
+   '_udivdi3.o:__udivti3', '_udivmoddi4.o:__udivmodti4',
+   '_umoddi3.o:__umodti3'.  */
+
+int f (int n)
+{
+  const union {
+    struct { long low, high; };
+    __int128 ll;
+  } ww = {{.low = n, .high = 0}};
+  return (int) ww.ll;
+}
+/*
+** f:
+** \.visible \.func \(\.param\.u32 %value_out\) f \(\.param\.u32 %in_ar0\)
+** {
+**     \.reg\.u32 %value;
+**     \.reg\.u32 %ar0;
+**     ld\.param\.u32 %ar0, \[%in_ar0\];
+**     \.local \.align 16 \.b8 %frame_ar\[16\];
+**     \.reg\.u64 %frame;
+**     cvta\.local\.u64 %frame, %frame_ar;
+**             mov\.u32        %value, %ar0;
+**     st\.param\.u32  \[%value_out\], %value;
+**     ret;
+*/