aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNathan Sidwell <nathan@acm.org>2016-05-26 15:19:04 +0000
committerNathan Sidwell <nathan@acm.org>2016-05-26 15:19:04 +0000
commitec73ad53838ea7fa7cad02838f76f921071eb785 (patch)
tree72ac44a4792ab30da1e05b4a44d7748e0647ac6d
parentf1baa89b28f81e2a43774fe22a57e121c5454d10 (diff)
* config/nvptx/nvptx.c (nvptx_function_arg_boundary): New.
(TARGET_FUNCTION_ARG_BOUNDARY): Override. testsuite/ * gcc.target/nvptx/abi-vararg-3.c: New. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gomp-4_0-branch@236776 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r--gcc/ChangeLog.gomp5
-rw-r--r--gcc/config/nvptx/nvptx.c13
-rw-r--r--gcc/testsuite/ChangeLog.gomp4
-rw-r--r--gcc/testsuite/gcc.target/nvptx/abi-vararg-3.c13
4 files changed, 35 insertions, 0 deletions
diff --git a/gcc/ChangeLog.gomp b/gcc/ChangeLog.gomp
index 87e9d3b52ed..5a2b71175b0 100644
--- a/gcc/ChangeLog.gomp
+++ b/gcc/ChangeLog.gomp
@@ -1,3 +1,8 @@
+2016-05-26 Nathan Sidwell <nathan@acm.org>
+
+ * config/nvptx/nvptx.c (nvptx_function_arg_boundary): New.
+ (TARGET_FUNCTION_ARG_BOUNDARY): Override.
+
2016-05-23 Cesar Philippidis <cesar@codesourcery.com>
Backport trunk r236523:
diff --git a/gcc/config/nvptx/nvptx.c b/gcc/config/nvptx/nvptx.c
index 364ebece33f..6d787b049cc 100644
--- a/gcc/config/nvptx/nvptx.c
+++ b/gcc/config/nvptx/nvptx.c
@@ -461,6 +461,17 @@ nvptx_function_arg_advance (cumulative_args_t cum_v,
cum->count++;
}
+/* Implement TARGET_FUNCTION_ARG_BOUNDARY.
+
+ For nvptx This is only used for varadic args. The type has already
+ been promoted and/or converted to invisible reference. */
+
+static unsigned
+nvptx_function_arg_boundary (machine_mode mode, const_tree ARG_UNUSED (type))
+{
+ return GET_MODE_ALIGNMENT (mode);
+}
+
/* Handle the TARGET_STRICT_ARGUMENT_NAMING target hook.
For nvptx, we know how to handle functions declared as stdarg: by
@@ -4851,6 +4862,8 @@ nvptx_goacc_reduction (gcall *call)
#define TARGET_FUNCTION_INCOMING_ARG nvptx_function_incoming_arg
#undef TARGET_FUNCTION_ARG_ADVANCE
#define TARGET_FUNCTION_ARG_ADVANCE nvptx_function_arg_advance
+#undef TARGET_FUNCTION_ARG_BOUNDARY
+#define TARGET_FUNCTION_ARG_BOUNDARY nvptx_function_arg_boundary
#undef TARGET_PASS_BY_REFERENCE
#define TARGET_PASS_BY_REFERENCE nvptx_pass_by_reference
#undef TARGET_FUNCTION_VALUE_REGNO_P
diff --git a/gcc/testsuite/ChangeLog.gomp b/gcc/testsuite/ChangeLog.gomp
index c3b9a8d2d4e..955d88f1df2 100644
--- a/gcc/testsuite/ChangeLog.gomp
+++ b/gcc/testsuite/ChangeLog.gomp
@@ -1,3 +1,7 @@
+2016-05-26 Nathan Sidwell <nathan@acm.org>
+
+ * gcc.target/nvptx/abi-vararg-3.c: New.
+
2016-05-23 Cesar Philippidis <cesar@codesourcery.com>
Backport trunk r236523:
diff --git a/gcc/testsuite/gcc.target/nvptx/abi-vararg-3.c b/gcc/testsuite/gcc.target/nvptx/abi-vararg-3.c
new file mode 100644
index 00000000000..24fd684527d
--- /dev/null
+++ b/gcc/testsuite/gcc.target/nvptx/abi-vararg-3.c
@@ -0,0 +1,13 @@
+/* { dg-do compile } */
+/* { dg-additional-options "-Wno-pedantic -Wno-long-long" } */
+
+/* 64-bit var args should be aligned to 64 bits. */
+
+void Foo (const char *, ...);
+
+void Baz ()
+{
+ Foo ("", 0, 1ll);
+}
+
+/* { dg-final { scan-assembler "st.u64\t\\\[%stack\\+8\\\]," } } */