===================================================================
@@ -9709,12 +9709,21 @@ rs6000_return_in_memory (const_tree type
NULL, NULL))
return false;
+ /* TRUE if TYPE is a UPC pointer-to-shared type
+ and its underlying representation is an aggregate. */
+ bool upc_struct_pts_p = (POINTER_TYPE_P (type)
+ && SHARED_TYPE_P (TREE_TYPE (type)))
+ && AGGREGATE_TYPE_P (upc_pts_rep_type_node);
+ /* If TYPE is a UPC struct PTS type, handle it as an aggregate type. */
+ bool aggregate_p = AGGREGATE_TYPE_P (type)
+ || upc_struct_pts_p;
+
/* The ELFv2 ABI returns aggregates up to 16B in registers */
- if (DEFAULT_ABI == ABI_ELFv2 && AGGREGATE_TYPE_P (type)
+ if (DEFAULT_ABI == ABI_ELFv2 && aggregate_p
&& (unsigned HOST_WIDE_INT) int_size_in_bytes (type) <= 16)
return false;
- if (AGGREGATE_TYPE_P (type)
+ if (aggregate_p
&& (aix_struct_return
|| (unsigned HOST_WIDE_INT) int_size_in_bytes (type) > 8))
return true;
@@ -10040,6 +10049,18 @@ rs6000_function_arg_boundary (machine_mo
|| DEFAULT_ABI == ABI_ELFv2)
&& type && TYPE_ALIGN (type) > 64)
{
+
+ /* If the underlying UPC pointer-to-shared representation
+ is an aggregate, and TYPE is either a pointer-to-shared
+ or the PTS representation type, then return 16-byte
+ alignment and skip the ABI warning. */
+ if (upc_pts_rep_type_node
+ && AGGREGATE_TYPE_P (upc_pts_rep_type_node)
+ && ((POINTER_TYPE_P (type)
+ && SHARED_TYPE_P (TREE_TYPE (type)))
+ || (TYPE_MAIN_VARIANT (type) == upc_pts_rep_type_node)))
+ return 128;
+
/* "Aggregate" means any AGGREGATE_TYPE except for single-element
or homogeneous float/vector aggregates here. We already handled
vector aggregates above, but still need to check for float here. */
@@ -11320,7 +11341,16 @@ rs6000_pass_by_reference (cumulative_arg
return 1;
}
- if (DEFAULT_ABI == ABI_V4 && AGGREGATE_TYPE_P (type))
+ /* TRUE if TYPE is a UPC pointer-to-shared type
+ and its underlying representation is an aggregate. */
+ bool upc_struct_pts_p = (POINTER_TYPE_P (type)
+ && SHARED_TYPE_P (TREE_TYPE (type)))
+ && AGGREGATE_TYPE_P (upc_pts_rep_type_node);
+ /* If TYPE is a UPC struct PTS type, handle it as an aggregate type. */
+ bool aggregate_p = AGGREGATE_TYPE_P (type)
+ || upc_struct_pts_p;
+
+ if (DEFAULT_ABI == ABI_V4 && aggregate_p)
{
if (TARGET_DEBUG_ARG)
fprintf (stderr, "function_arg_pass_by_reference: V4 aggregate\n");
@@ -33682,7 +33712,8 @@ rs6000_function_value (const_tree valtyp
if ((INTEGRAL_TYPE_P (valtype)
&& GET_MODE_BITSIZE (mode) < (TARGET_32BIT ? 32 : 64))
- || POINTER_TYPE_P (valtype))
+ || (POINTER_TYPE_P (valtype)
+ && !SHARED_TYPE_P (TREE_TYPE (valtype))))
mode = TARGET_32BIT ? SImode : DImode;
if (DECIMAL_FLOAT_MODE_P (mode) && TARGET_HARD_FLOAT && TARGET_FPRS)