summaryrefslogtreecommitdiffstats
path: root/gcc/expr.c
diff options
context:
space:
mode:
authorrguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4>2012-01-24 09:17:01 +0000
committerrguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4>2012-01-24 09:17:01 +0000
commit7f29521414fe03f8734b02daa229890d0bf3f07d (patch)
tree438895843443c1acc2e945d7b7c332cad7bdd785 /gcc/expr.c
parent202e709769152b052689c9bec9b8767d324864ae (diff)
downloadppe42-gcc-7f29521414fe03f8734b02daa229890d0bf3f07d.tar.gz
ppe42-gcc-7f29521414fe03f8734b02daa229890d0bf3f07d.zip
2012-01-24 Richard Guenther <rguenther@suse.de>
Forward-port to trunk 2010-09-21 Jakub Jelinek <jakub@redhat.com> PR middle-end/45678 * expr.c (expand_expr_real_1) <case VIEW_CONVERT_EXPR>: If op0 isn't sufficiently aligned and there is movmisalignM insn for mode, use it to load op0 into a temporary register. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@183470 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/expr.c')
-rw-r--r--gcc/expr.c22
1 files changed, 22 insertions, 0 deletions
diff --git a/gcc/expr.c b/gcc/expr.c
index fb93346eb99..e181ee3ef0d 100644
--- a/gcc/expr.c
+++ b/gcc/expr.c
@@ -10044,10 +10044,32 @@ expand_expr_real_1 (tree exp, rtx target, enum machine_mode tmode,
results. */
if (MEM_P (op0))
{
+ enum insn_code icode;
+
op0 = copy_rtx (op0);
if (TYPE_ALIGN_OK (type))
set_mem_align (op0, MAX (MEM_ALIGN (op0), TYPE_ALIGN (type)));
+ else if (mode != BLKmode
+ && MEM_ALIGN (op0) < GET_MODE_ALIGNMENT (mode)
+ /* If the target does have special handling for unaligned
+ loads of mode then use them. */
+ && ((icode = optab_handler (movmisalign_optab, mode))
+ != CODE_FOR_nothing))
+ {
+ rtx reg, insn;
+
+ op0 = adjust_address (op0, mode, 0);
+ /* We've already validated the memory, and we're creating a
+ new pseudo destination. The predicates really can't
+ fail. */
+ reg = gen_reg_rtx (mode);
+
+ /* Nor can the insn generator. */
+ insn = GEN_FCN (icode) (reg, op0);
+ emit_insn (insn);
+ return reg;
+ }
else if (STRICT_ALIGNMENT
&& mode != BLKmode
&& MEM_ALIGN (op0) < GET_MODE_ALIGNMENT (mode))
OpenPOWER on IntegriCloud