aboutsummaryrefslogtreecommitdiff
path: root/gcc/tree-vect-data-refs.c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/tree-vect-data-refs.c')
-rw-r--r--gcc/tree-vect-data-refs.c62
1 files changed, 35 insertions, 27 deletions
diff --git a/gcc/tree-vect-data-refs.c b/gcc/tree-vect-data-refs.c
index 070c707..0b3b968 100644
--- a/gcc/tree-vect-data-refs.c
+++ b/gcc/tree-vect-data-refs.c
@@ -4547,7 +4547,8 @@ vect_grouped_store_supported (tree vectype, unsigned HOST_WIDE_INT count)
if (VECTOR_MODE_P (mode))
{
unsigned int i, nelt = GET_MODE_NUNITS (mode);
- unsigned char *sel = XALLOCAVEC (unsigned char, nelt);
+ auto_vec_perm_indices sel (nelt);
+ sel.quick_grow (nelt);
if (count == 3)
{
@@ -4568,7 +4569,7 @@ vect_grouped_store_supported (tree vectype, unsigned HOST_WIDE_INT count)
if (3 * i + nelt2 < nelt)
sel[3 * i + nelt2] = 0;
}
- if (!can_vec_perm_p (mode, false, sel))
+ if (!can_vec_perm_p (mode, false, &sel))
{
if (dump_enabled_p ())
dump_printf (MSG_MISSED_OPTIMIZATION,
@@ -4585,7 +4586,7 @@ vect_grouped_store_supported (tree vectype, unsigned HOST_WIDE_INT count)
if (3 * i + nelt2 < nelt)
sel[3 * i + nelt2] = nelt + j2++;
}
- if (!can_vec_perm_p (mode, false, sel))
+ if (!can_vec_perm_p (mode, false, &sel))
{
if (dump_enabled_p ())
dump_printf (MSG_MISSED_OPTIMIZATION,
@@ -4605,13 +4606,13 @@ vect_grouped_store_supported (tree vectype, unsigned HOST_WIDE_INT count)
sel[i * 2] = i;
sel[i * 2 + 1] = i + nelt;
}
- if (can_vec_perm_p (mode, false, sel))
- {
- for (i = 0; i < nelt; i++)
- sel[i] += nelt / 2;
- if (can_vec_perm_p (mode, false, sel))
- return true;
- }
+ if (can_vec_perm_p (mode, false, &sel))
+ {
+ for (i = 0; i < nelt; i++)
+ sel[i] += nelt / 2;
+ if (can_vec_perm_p (mode, false, &sel))
+ return true;
+ }
}
}
@@ -4710,7 +4711,9 @@ vect_permute_store_chain (vec<tree> dr_chain,
tree perm3_mask_low, perm3_mask_high;
unsigned int i, n, log_length = exact_log2 (length);
unsigned int j, nelt = TYPE_VECTOR_SUBPARTS (vectype);
- unsigned char *sel = XALLOCAVEC (unsigned char, nelt);
+
+ auto_vec_perm_indices sel (nelt);
+ sel.quick_grow (nelt);
result_chain->quick_grow (length);
memcpy (result_chain->address (), dr_chain.address (),
@@ -5132,7 +5135,8 @@ vect_grouped_load_supported (tree vectype, bool single_element_p,
if (VECTOR_MODE_P (mode))
{
unsigned int i, j, nelt = GET_MODE_NUNITS (mode);
- unsigned char *sel = XALLOCAVEC (unsigned char, nelt);
+ auto_vec_perm_indices sel (nelt);
+ sel.quick_grow (nelt);
if (count == 3)
{
@@ -5144,7 +5148,7 @@ vect_grouped_load_supported (tree vectype, bool single_element_p,
sel[i] = 3 * i + k;
else
sel[i] = 0;
- if (!can_vec_perm_p (mode, false, sel))
+ if (!can_vec_perm_p (mode, false, &sel))
{
if (dump_enabled_p ())
dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location,
@@ -5157,7 +5161,7 @@ vect_grouped_load_supported (tree vectype, bool single_element_p,
sel[i] = i;
else
sel[i] = nelt + ((nelt + k) % 3) + 3 * (j++);
- if (!can_vec_perm_p (mode, false, sel))
+ if (!can_vec_perm_p (mode, false, &sel))
{
if (dump_enabled_p ())
dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location,
@@ -5174,11 +5178,11 @@ vect_grouped_load_supported (tree vectype, bool single_element_p,
gcc_assert (pow2p_hwi (count));
for (i = 0; i < nelt; i++)
sel[i] = i * 2;
- if (can_vec_perm_p (mode, false, sel))
+ if (can_vec_perm_p (mode, false, &sel))
{
for (i = 0; i < nelt; i++)
sel[i] = i * 2 + 1;
- if (can_vec_perm_p (mode, false, sel))
+ if (can_vec_perm_p (mode, false, &sel))
return true;
}
}
@@ -5292,7 +5296,9 @@ vect_permute_load_chain (vec<tree> dr_chain,
tree vectype = STMT_VINFO_VECTYPE (vinfo_for_stmt (stmt));
unsigned int i, j, log_length = exact_log2 (length);
unsigned nelt = TYPE_VECTOR_SUBPARTS (vectype);
- unsigned char *sel = XALLOCAVEC (unsigned char, nelt);
+
+ auto_vec_perm_indices sel (nelt);
+ sel.quick_grow (nelt);
result_chain->quick_grow (length);
memcpy (result_chain->address (), dr_chain.address (),
@@ -5486,10 +5492,12 @@ vect_shift_permute_load_chain (vec<tree> dr_chain,
tree vectype = STMT_VINFO_VECTYPE (vinfo_for_stmt (stmt));
unsigned int i;
unsigned nelt = TYPE_VECTOR_SUBPARTS (vectype);
- unsigned char *sel = XALLOCAVEC (unsigned char, nelt);
stmt_vec_info stmt_info = vinfo_for_stmt (stmt);
loop_vec_info loop_vinfo = STMT_VINFO_LOOP_VINFO (stmt_info);
+ auto_vec_perm_indices sel (nelt);
+ sel.quick_grow (nelt);
+
result_chain->quick_grow (length);
memcpy (result_chain->address (), dr_chain.address (),
length * sizeof (tree));
@@ -5501,7 +5509,7 @@ vect_shift_permute_load_chain (vec<tree> dr_chain,
sel[i] = i * 2;
for (i = 0; i < nelt / 2; ++i)
sel[nelt / 2 + i] = i * 2 + 1;
- if (!can_vec_perm_p (TYPE_MODE (vectype), false, sel))
+ if (!can_vec_perm_p (TYPE_MODE (vectype), false, &sel))
{
if (dump_enabled_p ())
dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location,
@@ -5515,7 +5523,7 @@ vect_shift_permute_load_chain (vec<tree> dr_chain,
sel[i] = i * 2 + 1;
for (i = 0; i < nelt / 2; ++i)
sel[nelt / 2 + i] = i * 2;
- if (!can_vec_perm_p (TYPE_MODE (vectype), false, sel))
+ if (!can_vec_perm_p (TYPE_MODE (vectype), false, &sel))
{
if (dump_enabled_p ())
dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location,
@@ -5529,7 +5537,7 @@ vect_shift_permute_load_chain (vec<tree> dr_chain,
For vector length 8 it is {4 5 6 7 8 9 10 11}. */
for (i = 0; i < nelt; i++)
sel[i] = nelt / 2 + i;
- if (!can_vec_perm_p (TYPE_MODE (vectype), false, sel))
+ if (!can_vec_perm_p (TYPE_MODE (vectype), false, &sel))
{
if (dump_enabled_p ())
dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location,
@@ -5544,7 +5552,7 @@ vect_shift_permute_load_chain (vec<tree> dr_chain,
sel[i] = i;
for (i = nelt / 2; i < nelt; i++)
sel[i] = nelt + i;
- if (!can_vec_perm_p (TYPE_MODE (vectype), false, sel))
+ if (!can_vec_perm_p (TYPE_MODE (vectype), false, &sel))
{
if (dump_enabled_p ())
dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location,
@@ -5607,7 +5615,7 @@ vect_shift_permute_load_chain (vec<tree> dr_chain,
sel[i] = 3 * k + (l % 3);
k++;
}
- if (!can_vec_perm_p (TYPE_MODE (vectype), false, sel))
+ if (!can_vec_perm_p (TYPE_MODE (vectype), false, &sel))
{
if (dump_enabled_p ())
dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location,
@@ -5621,7 +5629,7 @@ vect_shift_permute_load_chain (vec<tree> dr_chain,
For vector length 8 it is {6 7 8 9 10 11 12 13}. */
for (i = 0; i < nelt; i++)
sel[i] = 2 * (nelt / 3) + (nelt % 3) + i;
- if (!can_vec_perm_p (TYPE_MODE (vectype), false, sel))
+ if (!can_vec_perm_p (TYPE_MODE (vectype), false, &sel))
{
if (dump_enabled_p ())
dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location,
@@ -5634,7 +5642,7 @@ vect_shift_permute_load_chain (vec<tree> dr_chain,
For vector length 8 it is {5 6 7 8 9 10 11 12}. */
for (i = 0; i < nelt; i++)
sel[i] = 2 * (nelt / 3) + 1 + i;
- if (!can_vec_perm_p (TYPE_MODE (vectype), false, sel))
+ if (!can_vec_perm_p (TYPE_MODE (vectype), false, &sel))
{
if (dump_enabled_p ())
dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location,
@@ -5647,7 +5655,7 @@ vect_shift_permute_load_chain (vec<tree> dr_chain,
For vector length 8 it is {3 4 5 6 7 8 9 10}. */
for (i = 0; i < nelt; i++)
sel[i] = (nelt / 3) + (nelt % 3) / 2 + i;
- if (!can_vec_perm_p (TYPE_MODE (vectype), false, sel))
+ if (!can_vec_perm_p (TYPE_MODE (vectype), false, &sel))
{
if (dump_enabled_p ())
dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location,
@@ -5660,7 +5668,7 @@ vect_shift_permute_load_chain (vec<tree> dr_chain,
For vector length 8 it is {5 6 7 8 9 10 11 12}. */
for (i = 0; i < nelt; i++)
sel[i] = 2 * (nelt / 3) + (nelt % 3) / 2 + i;
- if (!can_vec_perm_p (TYPE_MODE (vectype), false, sel))
+ if (!can_vec_perm_p (TYPE_MODE (vectype), false, &sel))
{
if (dump_enabled_p ())
dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location,