]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
vect: Fix SVE mask_gather_load/store_store tests
authorRichard Sandiford <richard.sandiford@arm.com>
Tue, 30 Nov 2021 09:52:28 +0000 (09:52 +0000)
committerRichard Sandiford <richard.sandiford@arm.com>
Tue, 30 Nov 2021 09:52:28 +0000 (09:52 +0000)
If-conversion now applies rewrite_to_defined_overflow to the
address calculation in an IFN_MASK_LOAD.  This means that we
end up with:

    cast_base = (uintptr_t) base;
    uncast_sum = cast_base + offset;
    sum = (orig_type *) uncast_sum;

If the target supports IFN_MASK_GATHER_LOAD with pointer-sized
offsets for the given vectype, we wouldn't look through the sum
cast and so would needlessly vectorise the uncast_sum addition.

This showed up as several failures in gcc.target/aarch64/sve.

gcc/
* tree-vect-data-refs.c (vect_check_gather_scatter): Continue
processing conversions if the current offset is a pointer.

gcc/tree-vect-data-refs.c

index f1d7f01a9ceb23746a8d18584813194ed0eb8746..888ad72f3a90b6e13ed4ac15f376ec12de5f7c56 100644 (file)
@@ -4139,6 +4139,7 @@ vect_check_gather_scatter (stmt_vec_info stmt_info, loop_vec_info loop_vinfo,
          /* Don't include the conversion if the target is happy with
             the current offset type.  */
          if (use_ifn_p
+             && !POINTER_TYPE_P (TREE_TYPE (off))
              && vect_gather_scatter_fn_p (loop_vinfo, DR_IS_READ (dr),
                                           masked_p, vectype, memory_type,
                                           TREE_TYPE (off), scale, &ifn,