[COMMITTED] function.c (assign_parm_setup_reg): Handle misaligned stack arguments
diff mbox series

Message ID AM6PR10MB256656B230EA2B01C32C902EE4AC0@AM6PR10MB2566.EURPRD10.PROD.OUTLOOK.COM
State New
Headers show
Series
  • [COMMITTED] function.c (assign_parm_setup_reg): Handle misaligned stack arguments
Related show

Commit Message

Bernd Edlinger Aug. 15, 2019, 11:43 a.m. UTC
Hi!

This is another approved part from my patch "Fix not 8-byte aligned ldrd/strd on ARMv5 (PR 89544)"
committed as "obvious".

$ svn diff -r274530:274531 -x -p


Thanks
Bernd.

Patch
diff mbox series

Index: gcc/ChangeLog
===================================================================
--- gcc/ChangeLog	(Revision 274530)
+++ gcc/ChangeLog	(Revision 274531)
@@ -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: gcc/function.c
===================================================================
--- gcc/function.c	(Revision 274530)
+++ gcc/function.c	(Revision 274531)
@@ -3127,6 +3127,7 @@  assign_parm_setup_reg (struct assign_parm_data_all
   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
 	 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
 
       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);