diff options
-rw-r--r-- | gcc/config/aarch64/aarch64-sve-builtins.cc | 2 | ||||
-rw-r--r-- | gcc/gimple-fold.c | 2 | ||||
-rw-r--r-- | gcc/testsuite/g++.dg/vect/pr95401.cc | 13 | ||||
-rw-r--r-- | gcc/testsuite/g++.dg/vect/pr95401a.cc | 13 | ||||
-rw-r--r-- | gcc/tree-vect-stmts.c | 14 |
5 files changed, 36 insertions, 8 deletions
diff --git a/gcc/config/aarch64/aarch64-sve-builtins.cc b/gcc/config/aarch64/aarch64-sve-builtins.cc index 681b79c..6270b51 100644 --- a/gcc/config/aarch64/aarch64-sve-builtins.cc +++ b/gcc/config/aarch64/aarch64-sve-builtins.cc @@ -2580,7 +2580,7 @@ gimple_folder::fold_contiguous_base (gimple_seq &stmts, tree vectype) tree gimple_folder::load_store_cookie (tree type) { - return build_int_cst (build_pointer_type (type), TYPE_ALIGN_UNIT (type)); + return build_int_cst (build_pointer_type (type), TYPE_ALIGN (type)); } /* Fold the call to a call to INSTANCE, with the same arguments. */ diff --git a/gcc/gimple-fold.c b/gcc/gimple-fold.c index ec8da78..fe46d98 100644 --- a/gcc/gimple-fold.c +++ b/gcc/gimple-fold.c @@ -5201,7 +5201,7 @@ gimple_fold_mask_load_store_mem_ref (gcall *call, tree vectype) if (!tree_fits_uhwi_p (alias_align) || !integer_all_onesp (mask)) return NULL_TREE; - unsigned HOST_WIDE_INT align = tree_to_uhwi (alias_align) * BITS_PER_UNIT; + unsigned HOST_WIDE_INT align = tree_to_uhwi (alias_align); if (TYPE_ALIGN (vectype) != align) vectype = build_aligned_type (vectype, align); tree offset = build_zero_cst (TREE_TYPE (alias_align)); diff --git a/gcc/testsuite/g++.dg/vect/pr95401.cc b/gcc/testsuite/g++.dg/vect/pr95401.cc new file mode 100644 index 0000000..6a56dab --- /dev/null +++ b/gcc/testsuite/g++.dg/vect/pr95401.cc @@ -0,0 +1,13 @@ +// { dg-additional-options "-mavx2 -O3" { target avx2_runtime } } +// { dg-additional-sources pr95401a.cc } + +extern int var_9; +extern unsigned var_14; +extern int arr_16[]; +#include <algorithm> +void test() { + for (short a = 0; a < (short)var_9; a += 12140) + for (short b = 0; b < 8; b++) + if (std::max(var_14, 1U)) + arr_16[a + b] = 0; +} diff --git a/gcc/testsuite/g++.dg/vect/pr95401a.cc b/gcc/testsuite/g++.dg/vect/pr95401a.cc new file mode 100644 index 0000000..71b054c --- /dev/null +++ b/gcc/testsuite/g++.dg/vect/pr95401a.cc @@ -0,0 +1,13 @@ +// { dg-do compile } + +#include "../../gcc.dg/vect/tree-vect.h" + +int var_9 = 1693986256, var_14; +int arr_16[11]; +void test(); +int main() +{ + check_vect(); + test(); + return 0; +} diff --git a/gcc/tree-vect-stmts.c b/gcc/tree-vect-stmts.c index 54fb68b..014f1af 100644 --- a/gcc/tree-vect-stmts.c +++ b/gcc/tree-vect-stmts.c @@ -7964,7 +7964,7 @@ vectorizable_store (vec_info *vinfo, /* Emit: MASK_STORE_LANES (DATAREF_PTR, ALIAS_PTR, VEC_MASK, VEC_ARRAY). */ - unsigned int align = TYPE_ALIGN_UNIT (TREE_TYPE (vectype)); + unsigned int align = TYPE_ALIGN (TREE_TYPE (vectype)); tree alias_ptr = build_int_cst (ref_type, align); call = gimple_build_call_internal (IFN_MASK_STORE_LANES, 4, dataref_ptr, alias_ptr, @@ -8079,7 +8079,7 @@ vectorizable_store (vec_info *vinfo, if (final_mask) { align = least_bit_hwi (misalign | align); - tree ptr = build_int_cst (ref_type, align); + tree ptr = build_int_cst (ref_type, align * BITS_PER_UNIT); gcall *call = gimple_build_call_internal (IFN_MASK_STORE, 4, dataref_ptr, ptr, @@ -8094,7 +8094,7 @@ vectorizable_store (vec_info *vinfo, = vect_get_loop_len (loop_vinfo, loop_lens, vec_num * ncopies, vec_num * j + i); align = least_bit_hwi (misalign | align); - tree ptr = build_int_cst (ref_type, align); + tree ptr = build_int_cst (ref_type, align * BITS_PER_UNIT); machine_mode vmode = TYPE_MODE (vectype); opt_machine_mode new_ovmode = get_len_load_store_mode (vmode, false); @@ -9246,7 +9246,7 @@ vectorizable_load (vec_info *vinfo, /* Emit: VEC_ARRAY = MASK_LOAD_LANES (DATAREF_PTR, ALIAS_PTR, VEC_MASK). */ - unsigned int align = TYPE_ALIGN_UNIT (TREE_TYPE (vectype)); + unsigned int align = TYPE_ALIGN (TREE_TYPE (vectype)); tree alias_ptr = build_int_cst (ref_type, align); call = gimple_build_call_internal (IFN_MASK_LOAD_LANES, 3, dataref_ptr, alias_ptr, @@ -9347,7 +9347,8 @@ vectorizable_load (vec_info *vinfo, if (final_mask) { align = least_bit_hwi (misalign | align); - tree ptr = build_int_cst (ref_type, align); + tree ptr = build_int_cst (ref_type, + align * BITS_PER_UNIT); gcall *call = gimple_build_call_internal (IFN_MASK_LOAD, 3, dataref_ptr, ptr, @@ -9363,7 +9364,8 @@ vectorizable_load (vec_info *vinfo, vec_num * ncopies, vec_num * j + i); align = least_bit_hwi (misalign | align); - tree ptr = build_int_cst (ref_type, align); + tree ptr = build_int_cst (ref_type, + align * BITS_PER_UNIT); gcall *call = gimple_build_call_internal (IFN_LEN_LOAD, 3, dataref_ptr, ptr, |