4.4/4.5 PATCH: PR middle-end/45678: [4.4/4.5/4.6 Regression] crash on vector code with -m32 -msse
H.J. Lu
hjl.tools@gmail.com
Tue Sep 21 13:51:00 GMT 2010
On Tue, Sep 21, 2010 at 2:49 AM, Jakub Jelinek <jakub@redhat.com> wrote:
> On Mon, Sep 20, 2010 at 04:45:07PM -0700, H.J. Lu wrote:
>> Here is the patch for 4.4/4.5. fold_builtin_memory_op is very different
>> in 4.4/4.5. Simple backport doesn't work. Does this patch make
>> any senses?
>
> Your builtins.c part doesn't make sense. The code already handles
> the alignment, see the
> srctype = build_qualified_type (desttype, 0);
> if (src_align < (int) TYPE_ALIGN (srctype))
> {
> if (AGGREGATE_TYPE_P (srctype)
> || SLOW_UNALIGNED_ACCESS (TYPE_MODE (srctype), src_align))
> return NULL_TREE;
>
> srctype = build_variant_type_copy (srctype);
> TYPE_ALIGN (srctype) = src_align;
> TYPE_USER_ALIGN (srctype) = 1;
> TYPE_PACKED (srctype) = 1;
> }
> hunk and similar hunk for dsttype. The difference is just that
> 4.6 creates a valid unaligned MEM_REF while 4.5 creates a valid unaligned
> VCE. As you can see above, in 4.5 and earlier it was using a packed type
> properly no matter whether target was STRICT_ALIGNMENT or not.
> The problem is during expansion that the VCE isn't expanded properly.
>
> So, IMHO we need something like this (so far untested; 4.5 version):
>
> 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.
>
> Backport from mainline
> 2010-09-20 Jakub Jelinek <jakub@redhat.com>
>
> PR middle-end/45678
> * cfgexpand.c (expand_one_stack_var_at): Limit alignment to
> crtl->max_used_stack_slot_alignment.
>
With your patch, gcc 4.5 generates:
xorps %xmm0, %xmm0
movlps (%esp), %xmm0
movhps 8(%esp), %xmm0
on gcc.dg/torture/pr45678-2.c. Where does xorps come from?
--
H.J.
More information about the Gcc-patches
mailing list