From 834032457972caee7d4ae113c2201080178a229e Mon Sep 17 00:00:00 2001 From: Bernd Edlinger Date: Thu, 15 Aug 2019 11:37:21 +0000 Subject: [PATCH] function.c (assign_parm_setup_reg): Handle misaligned stack arguments. 2019-08-15 Bernd Edlinger * function.c (assign_parm_setup_reg): Handle misaligned stack arguments. From-SVN: r274531 --- gcc/ChangeLog | 4 ++++ gcc/function.c | 19 ++++++++++++++++++- 2 files changed, 22 insertions(+), 1 deletion(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 49aabbeb08e..2aa7a8cba19 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,7 @@ +2019-08-15 Bernd Edlinger + + * function.c (assign_parm_setup_reg): Handle misaligned stack arguments. + 2019-08-15 Martin Liska * tree-ssa-dce.c (propagate_necessity): We can't reach now diff --git a/gcc/function.c b/gcc/function.c index 8274975ce33..e368f7c013e 100644 --- a/gcc/function.c +++ b/gcc/function.c @@ -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); -- 2.30.2