https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102767

--- Comment #7 from Kewen Lin <linkw at gcc dot gnu.org> ---
(In reply to Segher Boessenkool from comment #6)
> (In reply to Richard Earnshaw from comment #5)
> > We have the type 
> > <vector_type 0x7ffff758c9d8
> >     type <integer_type 0x7ffff7517bd0 public unsigned TI
> >         size <integer_cst 0x7ffff7514ee8 constant 128>
> >         unit-size <integer_cst 0x7ffff7514f00 constant 16>
> > and movmisalign pattern is enabled for this.
> > 
> > but the vectorization cost doesn't handle the case of elements=1, which is
> > the case when mode is TImode.
> > 
> > So I think this is an inconsistency in the rs6000 backend - either add
> > costing support for single elements or disable the movmisalign code in this
> > case.
> 
> But TImode is a scalar type, not a vector type, so it should hit one of the
> early-outs at the top of rs6000_builtin_vectorization_cost?

for rs6000, the scalar type is uint128_t, the vectorized type is vector(1)
uint128_t

 <vector_type 0x7ffff51b5dd8
    type <integer_type 0x7ffff51b0bd0 public unsigned TI
        size <integer_cst 0x7ffff5180ee8 constant 128>
        unit-size <integer_cst 0x7ffff5180f00 constant 16>
        align:128 warn_if_not_align:0 symtab:0 alias-set 13 canonical-type
0x7ffff51b0bd0 precision:128 min <integer_cst 0x7
ffff51811d0 0> max <integer_cst 0x7ffff51f1130
0xffffffffffffffffffffffffffffffff>>
    unsigned V1TI size <integer_cst 0x7ffff5180ee8 128> unit-size <integer_cst
0x7ffff5180f00 16>
    align:128 warn_if_not_align:0 symtab:0 alias-set -1 canonical-type
0x7ffff51b5dd8 nunits:1>

We have the movmisalign support for V1TI

#define HAVE_movmisalignv4si (VECTOR_MEM_VSX_P (V4SImode) &&
TARGET_ALLOW_MOVMISALIGN)
#define HAVE_movmisalignv4sf (VECTOR_MEM_VSX_P (V4SFmode) &&
TARGET_ALLOW_MOVMISALIGN)
#define HAVE_movmisalignv2di (VECTOR_MEM_VSX_P (V2DImode) &&
TARGET_ALLOW_MOVMISALIGN)
#define HAVE_movmisalignv2df (VECTOR_MEM_VSX_P (V2DFmode) &&
TARGET_ALLOW_MOVMISALIGN)
#define HAVE_movmisalignv1ti (VECTOR_MEM_VSX_P (V1TImode) &&
TARGET_ALLOW_MOVMISALIGN)

The misalign in the failure is 8, it makes the hook
rs6000_builtin_support_vector_misalignment return true. The loop vectorization
fails to vectorize for V1TI due to the resulted vectorization factor is 1. But
for this failure it's BB slp, it looks allowable to query the cost with V1TI. I
think Richard E. is right, it's a rs6000 specific issue.

Reply via email to