]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
Fix handling of floating-point homogeneous aggregates.
authorJohn David Anglin <danglin@gcc.gnu.org>
Fri, 21 Feb 2020 23:34:09 +0000 (23:34 +0000)
committerJohn David Anglin <danglin@gcc.gnu.org>
Fri, 21 Feb 2020 23:34:09 +0000 (23:34 +0000)
2020-02-21  John David Anglin  <danglin@gcc.gnu.org>

* gcc/config/pa/pa.c (pa_function_value): Fix check for word and
double-word size when handling aggregate return values.
* gcc/config/pa/som.h (ASM_DECLARE_FUNCTION_NAME): Fix to indicate
that homogeneous SFmode and DFmode aggregates are passed and returned
in general registers.

gcc/ChangeLog
gcc/config/pa/pa.c
gcc/config/pa/som.h

index a9042799a97da050d5cad37934b99cda7338a56f..2a5d572005fb7b53be071b1ec57b482c61155b7a 100644 (file)
@@ -1,3 +1,11 @@
+2020-02-21  John David Anglin  <danglin@gcc.gnu.org>
+
+       * gcc/config/pa/pa.c (pa_function_value): Fix check for word and
+       double-word size when handling aggregate return values.
+       * gcc/config/pa/som.h (ASM_DECLARE_FUNCTION_NAME): Fix to indicate
+       that homogeneous SFmode and DFmode aggregates are passed and returned
+       in general registers.
+
 2020-02-20  Uroš Bizjak  <ubizjak@gmail.com>
 
        PR target/93828
index 3546846956eaecd2bab006050139d38c92eeb5e9..84a8cae22e4c57d1b52d554119afb41fdcf6f4ea 100644 (file)
@@ -9343,7 +9343,7 @@ pa_function_value (const_tree valtype,
       HOST_WIDE_INT valsize = int_size_in_bytes (valtype);
 
       /* Handle aggregates that fit exactly in a word or double word.  */
-      if ((valsize & (UNITS_PER_WORD - 1)) == 0)
+      if (valsize == UNITS_PER_WORD || valsize == 2 * UNITS_PER_WORD)
        return gen_rtx_REG (TYPE_MODE (valtype), 28);
 
       if (TARGET_64BIT)
index adefc99a1e377396e13ceaee93e96bc4c26b7ce0..3ef543428ff86b313a2ecaf8f80a9e659bb5639b 100644 (file)
@@ -98,8 +98,8 @@ do {                                                          \
 
 \f
 #define ASM_DECLARE_FUNCTION_NAME(FILE, NAME, DECL) \
-    do { tree fntype = TREE_TYPE (TREE_TYPE (DECL));                   \
-        tree tree_type = TREE_TYPE (DECL);                             \
+    do { tree tree_type = TREE_TYPE (DECL);                            \
+        tree fntype = TREE_TYPE (tree_type);                           \
         tree parm;                                                     \
         int i;                                                         \
         if (TREE_PUBLIC (DECL) || TARGET_GAS)                          \
@@ -121,9 +121,11 @@ do {                                                               \
               {                                                        \
                 tree type = DECL_ARG_TYPE (parm);                      \
                 machine_mode mode = TYPE_MODE (type);                  \
-                if (mode == SFmode && ! TARGET_SOFT_FLOAT)             \
+                if (!AGGREGATE_TYPE_P (type)                           \
+                    && mode == SFmode && ! TARGET_SOFT_FLOAT)          \
                   fprintf (FILE, ",ARGW%d=FR", i++);                   \
-                else if (mode == DFmode && ! TARGET_SOFT_FLOAT)        \
+                else if (!AGGREGATE_TYPE_P (type)                      \
+                         && mode == DFmode && ! TARGET_SOFT_FLOAT)     \
                   {                                                    \
                     if (i <= 2)                                        \
                       {                                                \
@@ -158,9 +160,13 @@ do {                                                               \
                 for (; i < 4; i++)                                     \
                   fprintf (FILE, ",ARGW%d=GR", i);                     \
               }                                                        \
-            if (TYPE_MODE (fntype) == DFmode && ! TARGET_SOFT_FLOAT)   \
+            if (!AGGREGATE_TYPE_P (fntype)                             \
+                && TYPE_MODE (fntype) == DFmode                        \
+                && ! TARGET_SOFT_FLOAT)                                \
               fputs (DFMODE_RETURN_STRING, FILE);                      \
-            else if (TYPE_MODE (fntype) == SFmode && ! TARGET_SOFT_FLOAT) \
+            else if (!AGGREGATE_TYPE_P (fntype)                        \
+                     && TYPE_MODE (fntype) == SFmode                   \
+                     && ! TARGET_SOFT_FLOAT)                           \
               fputs (SFMODE_RETURN_STRING, FILE);                      \
             else if (fntype != void_type_node)                         \
               fputs (",RTNVAL=GR", FILE);                              \