[committed] amdgcn: Pass vector parameters in memory

Message ID 28751de5-1e10-2e2f-88b3-60fa39f3f419@codesourcery.com
State New
Headers show
Series
  • [committed] amdgcn: Pass vector parameters in memory
Related show

Commit Message

Andrew Stubbs June 22, 2020, 10:17 a.m.
This patch ensures that programs using vector extensions to pass vectors 
to functions pass the vectors in memory.

Even though we could technically do this in registers, the ABI would 
have to be reworked to do so, and there's no call for that yet (maybe if 
we want vector libgcc/libm).

This change doesn't have any observable affect on the testsuite, just 
yet, but when I add smaller vector sizes (still a work-in-progress) then 
the testcase failures become apparent.

Andrew

Patch

amdgcn: Pass vector parameters in memory

gcc/ChangeLog:

	* config/gcn/gcn.c (gcn_function_arg): Disallow vector arguments.
	(gcn_return_in_memory): Return vectors in memory.

diff --git a/gcc/config/gcn/gcn.c b/gcc/config/gcn/gcn.c
index b6ff0bbc2af..5693b75b672 100644
--- a/gcc/config/gcn/gcn.c
+++ b/gcc/config/gcn/gcn.c
@@ -2291,6 +2291,10 @@  gcn_function_arg (cumulative_args_t cum_v, const function_arg_info &arg)
       if (targetm.calls.must_pass_in_stack (arg))
 	return 0;
 
+      /* Vector parameters are not supported yet.  */
+      if (VECTOR_MODE_P (arg.mode))
+	return 0;
+
       int reg_num = FIRST_PARM_REG + cum->num;
       int num_regs = num_arg_regs (arg);
       if (num_regs > 0)
@@ -2478,6 +2482,10 @@  gcn_return_in_memory (const_tree type, const_tree ARG_UNUSED (fntype))
   if (AGGREGATE_TYPE_P (type))
     return true;
 
+  /* Vector return values are not supported yet.  */
+  if (VECTOR_TYPE_P (type))
+    return true;
+
   if (mode == BLKmode)
     return true;