summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg/vect/slp-perm-5.c
diff options
context:
space:
mode:
authorirar <irar@138bc75d-0d04-0410-961f-82ee72b054a4>2008-08-28 11:11:14 +0000
committerirar <irar@138bc75d-0d04-0410-961f-82ee72b054a4>2008-08-28 11:11:14 +0000
commita0515226f8073e566a0af2e005e40d850b6a81d8 (patch)
treee0ca36b1b58d3d02e70b7343f52d0af07126a5b3 /gcc/testsuite/gcc.dg/vect/slp-perm-5.c
parentadd2055dad476baa30b1969210de237cb0e159f8 (diff)
downloadgcc-a0515226f8073e566a0af2e005e40d850b6a81d8.tar.gz
* target.h (struct vectorize): Add new target builtin.
* tree-vectorizer.c (destroy_loop_vec_info): Call vect_free_slp_instance instead of vect_free_slp_node. * tree-vectorizer.h (enum slp_load_perm_type): New. (struct _slp_instance): Add new fields. (SLP_INSTANCE_LOAD_PERMUTATION): New. (SLP_INSTANCE_LOADS): New. (vect_free_slp_tree): Remove. (vect_free_slp_instance): Declare. (SLP_TREE_LOADS_PERM_TYPE, TARG_VEC_PERMUTE_COST): New. (vectorizable_load): Add argument. (vect_transform_slp_perm_load): New. * tree-vect-analyze.c (vect_analyze_operations): Add an argument to vectorizable_load. (vect_get_place_in_interleaving_chain): New function. (vect_free_slp_tree): Make static. (vect_free_slp_instance): New function. (vect_build_slp_tree): Add new arguments. Allow load permutations and collect the load location in the interleaving chain. (vect_supported_slp_permutation_p): New function. (vect_supported_load_permutation_p): Likewise. (vect_analyze_slp_instance): In case of loads permutation, call vect_supported_load_permutation_p to check that the permutation is supported. * target-def.h (TARGET_VECTORIZE_BUILTIN_VEC_PERM): New. * tree-vect-transform.c (vect_transform_stmt): Add new argument. (vect_create_mask_and_perm): New function. (vect_get_mask_element, vect_transform_slp_perm_load): Likewise. (vectorizable_load): Add an argument. Don't keep the created vectors statements in the node if permutation is required. Call vect_transform_slp_perm_load to generate the permutation. (vect_transform_stmt): Add new argument. Call vectorizable_load with additional argument. (vect_schedule_slp_instance): In case of loads permutation, allocate vectorized statements structure for all the related SLP nodes. Call vect_transform_stmt with addditional argument. (vect_transform_loop): Call vect_transform_stmt with correct arguments. * config/spu/spu.c (spu_builtin_vec_perm): New. (TARGET_VECTORIZE_BUILTIN_VEC_PERM): Redefine. * config/spu/spu.h (TARG_VEC_PERMUTE_COS): Define. * config/rs6000/rs6000.c (rs6000_builtin_vec_perm): New. (TARGET_VECTORIZE_BUILTIN_VEC_PERM): Redefine. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@139706 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/testsuite/gcc.dg/vect/slp-perm-5.c')
-rw-r--r--gcc/testsuite/gcc.dg/vect/slp-perm-5.c77
1 files changed, 77 insertions, 0 deletions
diff --git a/gcc/testsuite/gcc.dg/vect/slp-perm-5.c b/gcc/testsuite/gcc.dg/vect/slp-perm-5.c
new file mode 100644
index 00000000000..ca59a5e014b
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/vect/slp-perm-5.c
@@ -0,0 +1,77 @@
+/* { dg-require-effective-target vect_int } */
+
+#include <stdarg.h>
+#include <stdio.h>
+#include "tree-vect.h"
+
+#define M00 100
+#define M10 216
+#define M20 23
+#define M01 1322
+#define M11 13
+#define M21 27271
+#define M02 74
+#define M12 191
+#define M22 500
+
+#define K00 405
+#define K10 112
+#define K01 4322
+#define K11 135
+
+#define N 16
+
+void foo (int *__restrict__ pInput, int *__restrict__ pOutput,
+ int *__restrict__ pInput2, int *__restrict__ pOutput2)
+{
+ int i, a, b, c, d, e;
+
+ for (i = 0; i < N / 3; i++)
+ {
+ a = *pInput++;
+ b = *pInput++;
+ c = *pInput++;
+
+ d = *pInput2++;
+ e = *pInput2++;
+
+ *pOutput++ = M00 * a + M01 * b + M02 * c;
+ *pOutput++ = M10 * a + M11 * b + M12 * c;
+ *pOutput++ = M20 * a + M21 * b + M22 * c;
+
+ *pOutput2++ = K00 * d + K01 * e;
+ *pOutput2++ = K10 * d + K11 * e;
+ }
+}
+
+int main (int argc, const char* argv[])
+{
+ int input[N], output[N], i;
+ int check_results[N] = {1470, 395, 28271, 5958, 1655, 111653, 10446, 2915, 195035, 14934, 4175, 278417, 19422, 5435, 361799, 0};
+ int input2[N], output2[N];
+ int check_results2[N] = {4322, 135, 13776, 629, 23230, 1123, 32684, 1617, 42138, 2111, 0, 0, 0, 0, 0, 0};
+
+ for (i = 0; i < N; i++)
+ {
+ input[i] = i%256;
+ input2[i] = i%256;
+ output[i] = 0;
+ output2[i] = 0;
+ if (input[i] > 256)
+ abort ();
+ }
+
+ foo (input, output, input2, output2);
+
+ for (i = 0; i < N; i++)
+ if (output[i] != check_results[i] || output2[i] != check_results2[i])
+ abort ();
+
+ return 0;
+}
+
+/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" { target vect_perm } } } */
+/* { dg-final { scan-tree-dump-times "vectorizing stmts using SLP" 2 "vect" { target vect_perm } } } */
+/* { dg-final { cleanup-tree-dump "vect" } } */
+
+