function.c (assign_parm_setup_reg): Handle misaligned stack arguments.
authorBernd Edlinger <bernd.edlinger@hotmail.de>
Thu, 15 Aug 2019 11:37:21 +0000 (11:37 +0000)
committerBernd Edlinger <edlinger@gcc.gnu.org>
Thu, 15 Aug 2019 11:37:21 +0000 (11:37 +0000)
2019-08-15  Bernd Edlinger  <bernd.edlinger@hotmail.de>

        * function.c (assign_parm_setup_reg): Handle misaligned stack arguments.

From-SVN: r274531

gcc/ChangeLog
gcc/function.c

index 49aabbeb08e0f9ccaffccfe0fddd866b5a0b2f89..2aa7a8cba19984bcef550cc5ece3b623edaeb073 100644 (file)
@@ -1,3 +1,7 @@
+2019-08-15  Bernd Edlinger  <bernd.edlinger@hotmail.de>
+
+       * function.c (assign_parm_setup_reg): Handle misaligned stack arguments.
+
 2019-08-15  Martin Liska  <mliska@suse.cz>
 
        * tree-ssa-dce.c (propagate_necessity): We can't reach now
index 8274975ce33b43bcae3779eed623547279740145..e368f7c013ea143408f391deaaef473a73f34446 100644 (file)
@@ -3127,6 +3127,7 @@ assign_parm_setup_reg (struct assign_parm_data_all *all, tree parm,
   int unsignedp = TYPE_UNSIGNED (TREE_TYPE (parm));
   bool did_conversion = false;
   bool need_conversion, moved;
+  enum insn_code icode;
   rtx rtl;
 
   /* Store the parm in a pseudoregister during the function, but we may
@@ -3188,7 +3189,6 @@ assign_parm_setup_reg (struct assign_parm_data_all *all, tree parm,
         conversion.  We verify that this insn does not clobber any
         hard registers.  */
 
-      enum insn_code icode;
       rtx op0, op1;
 
       icode = can_extend_p (promoted_nominal_mode, data->passed_mode,
@@ -3291,6 +3291,23 @@ assign_parm_setup_reg (struct assign_parm_data_all *all, tree parm,
 
       did_conversion = true;
     }
+  else if (MEM_P (data->entry_parm)
+          && GET_MODE_ALIGNMENT (promoted_nominal_mode)
+             > MEM_ALIGN (data->entry_parm)
+          && (((icode = optab_handler (movmisalign_optab,
+                                       promoted_nominal_mode))
+               != CODE_FOR_nothing)
+              || targetm.slow_unaligned_access (promoted_nominal_mode,
+                                                MEM_ALIGN (data->entry_parm))))
+    {
+      if (icode != CODE_FOR_nothing)
+       emit_insn (GEN_FCN (icode) (parmreg, validated_mem));
+      else
+       rtl = parmreg = extract_bit_field (validated_mem,
+                       GET_MODE_BITSIZE (promoted_nominal_mode), 0,
+                       unsignedp, parmreg,
+                       promoted_nominal_mode, VOIDmode, false, NULL);
+    }
   else
     emit_move_insn (parmreg, validated_mem);