summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorienkovich <ienkovich@138bc75d-0d04-0410-961f-82ee72b054a4>2014-11-11 16:07:52 +0000
committerienkovich <ienkovich@138bc75d-0d04-0410-961f-82ee72b054a4>2014-11-11 16:07:52 +0000
commit2cc1223eb024907b55bc090795e1dbe2663ceda1 (patch)
treefc6f48ec764fd8425cd1989602c9dbcb0df8b02d
parent8b7de9a7c7cec8bdff5c3938b54b0464689ee4c9 (diff)
downloadgcc-2cc1223eb024907b55bc090795e1dbe2663ceda1.tar.gz
gcc/
* tree-vect-data-refs.c (vect_shift_permute_load_chain): Extend shift permutations on power of 2 cases. gcc/testsuites/ * gcc.target/i386/pr52252-atom-1.c: New. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@217359 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r--gcc/ChangeLog5
-rw-r--r--gcc/testsuite/ChangeLog4
-rw-r--r--gcc/testsuite/gcc.target/i386/pr52252-atom-1.c22
-rw-r--r--gcc/tree-vect-data-refs.c64
4 files changed, 67 insertions, 28 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 432a9fefcf5..6baafa066eb 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,8 @@
+2014-11-11 Evgeny Stupachenko <evstupac@gmail.com>
+
+ * tree-vect-data-refs.c (vect_shift_permute_load_chain): Extend shift
+ permutations on power of 2 cases.
+
2014-11-11 Kyrylo Tkachov <kyrylo.tkachov@arm.com>
* config/aarch64/aarch64.h (MACHMODE): Remove 'enum' keyword.
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index c3f633a985a..3ffd69ae1fc 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,7 @@
+2014-11-11 Evgeny Stupachenko <evstupac@gmail.com>
+
+ * gcc.target/i386/pr52252-atom-1.c: New.
+
2014-11-11 Martin Liska <mliska@suse.cz>
PR ipa/63622
diff --git a/gcc/testsuite/gcc.target/i386/pr52252-atom-1.c b/gcc/testsuite/gcc.target/i386/pr52252-atom-1.c
new file mode 100644
index 00000000000..1fbd258ac72
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pr52252-atom-1.c
@@ -0,0 +1,22 @@
+/* { dg-do compile } */
+/* { dg-require-effective-target ssse3 } */
+/* { dg-options "-O2 -ftree-vectorize -mssse3 -mtune=slm" } */
+#define byte unsigned char
+
+void
+pair_mul_sum(byte *in, byte *out, int size)
+{
+ int j;
+ for(j = 0; j < size; j++)
+ {
+ byte a = in[0];
+ byte b = in[1];
+ byte c = in[2];
+ byte d = in[3];
+ out[0] = (byte)(a * b) + (byte)(b * c) + (byte)(c * d) + (byte)(d * a);
+ in += 4;
+ out += 1;
+ }
+}
+
+/* { dg-final { scan-assembler "palignr" } } */
diff --git a/gcc/tree-vect-data-refs.c b/gcc/tree-vect-data-refs.c
index c49b47c7cc4..d07885fd143 100644
--- a/gcc/tree-vect-data-refs.c
+++ b/gcc/tree-vect-data-refs.c
@@ -5371,8 +5371,9 @@ vect_shift_permute_load_chain (vec<tree> dr_chain,
memcpy (result_chain->address (), dr_chain.address (),
length * sizeof (tree));
- if (length == 2 && LOOP_VINFO_VECT_FACTOR (loop_vinfo) > 4)
+ if (exact_log2 (length) != -1 && LOOP_VINFO_VECT_FACTOR (loop_vinfo) > 4)
{
+ unsigned int j, log_length = exact_log2 (length);
for (i = 0; i < nelt / 2; ++i)
sel[i] = i * 2;
for (i = 0; i < nelt / 2; ++i)
@@ -5433,37 +5434,44 @@ vect_shift_permute_load_chain (vec<tree> dr_chain,
select_mask = vect_gen_perm_mask (vectype, sel);
gcc_assert (select_mask != NULL);
- first_vect = dr_chain[0];
- second_vect = dr_chain[1];
-
- data_ref = make_temp_ssa_name (vectype, NULL, "vect_shuffle2");
- perm_stmt = gimple_build_assign_with_ops (VEC_PERM_EXPR, data_ref,
- first_vect, first_vect,
- perm2_mask1);
- vect_finish_stmt_generation (stmt, perm_stmt, gsi);
- vect[0] = data_ref;
+ for (i = 0; i < log_length; i++)
+ {
+ for (j = 0; j < length; j += 2)
+ {
+ first_vect = dr_chain[j];
+ second_vect = dr_chain[j + 1];
- data_ref = make_temp_ssa_name (vectype, NULL, "vect_shuffle2");
- perm_stmt = gimple_build_assign_with_ops (VEC_PERM_EXPR, data_ref,
- second_vect, second_vect,
- perm2_mask2);
- vect_finish_stmt_generation (stmt, perm_stmt, gsi);
- vect[1] = data_ref;
+ data_ref = make_temp_ssa_name (vectype, NULL, "vect_shuffle2");
+ perm_stmt = gimple_build_assign_with_ops (VEC_PERM_EXPR, data_ref,
+ first_vect, first_vect,
+ perm2_mask1);
+ vect_finish_stmt_generation (stmt, perm_stmt, gsi);
+ vect[0] = data_ref;
- data_ref = make_temp_ssa_name (vectype, NULL, "vect_shift");
- perm_stmt = gimple_build_assign_with_ops (VEC_PERM_EXPR, data_ref,
- vect[0], vect[1],
- shift1_mask);
- vect_finish_stmt_generation (stmt, perm_stmt, gsi);
- (*result_chain)[1] = data_ref;
+ data_ref = make_temp_ssa_name (vectype, NULL, "vect_shuffle2");
+ perm_stmt = gimple_build_assign_with_ops (VEC_PERM_EXPR, data_ref,
+ second_vect, second_vect,
+ perm2_mask2);
+ vect_finish_stmt_generation (stmt, perm_stmt, gsi);
+ vect[1] = data_ref;
- data_ref = make_temp_ssa_name (vectype, NULL, "vect_select");
- perm_stmt = gimple_build_assign_with_ops (VEC_PERM_EXPR, data_ref,
- vect[0], vect[1],
- select_mask);
- vect_finish_stmt_generation (stmt, perm_stmt, gsi);
- (*result_chain)[0] = data_ref;
+ data_ref = make_temp_ssa_name (vectype, NULL, "vect_shift");
+ perm_stmt = gimple_build_assign_with_ops (VEC_PERM_EXPR, data_ref,
+ vect[0], vect[1],
+ shift1_mask);
+ vect_finish_stmt_generation (stmt, perm_stmt, gsi);
+ (*result_chain)[j/2 + length/2] = data_ref;
+ data_ref = make_temp_ssa_name (vectype, NULL, "vect_select");
+ perm_stmt = gimple_build_assign_with_ops (VEC_PERM_EXPR, data_ref,
+ vect[0], vect[1],
+ select_mask);
+ vect_finish_stmt_generation (stmt, perm_stmt, gsi);
+ (*result_chain)[j/2] = data_ref;
+ }
+ memcpy (dr_chain.address (), result_chain->address (),
+ length * sizeof (tree));
+ }
return true;
}
if (length == 3 && LOOP_VINFO_VECT_FACTOR (loop_vinfo) > 2)