[PATCH][RFC] Allow vectorizing complex loops in tonto
Richard Guenther
rguenther@suse.de
Mon Aug 4 16:33:00 GMT 2008
This allows vectorizing the complex reduction loops in tonto by fixing
up the reduction patterns exposed by loop invariant motion (for the
actual tonto source it needs the alias improvements). The vectorizer
is otherwise confused by the SSA_NAME copies.
Of course adding yet another two cleanup passes doesn't look too
appealing, but trying to fix the vectorizer recognition code made
me think better to not mess with it. (In the end it would be nice
to be able to run the SSA cleanups only for selected names as a
TODO ...)
I'll test and benchmark this somehow... so, this is FYI and may
fix another testcase you have.
Thanks,
Richard.
2008-08-04 Richard Guenther <rguenther@suse.de>
* passes.c (init_optimization_passes): Add copy-prop and dce
before vectorization.
* gcc.dg/vect/fast-math-vect-complex-5.c: New testcase.
Index: gcc/passes.c
===================================================================
*** gcc/passes.c (revision 138611)
--- gcc/passes.c (working copy)
*************** init_optimization_passes (void)
*** 663,668 ****
--- 663,670 ----
NEXT_PASS (pass_linear_transform);
NEXT_PASS (pass_iv_canon);
NEXT_PASS (pass_if_conversion);
+ NEXT_PASS (pass_copy_prop);
+ NEXT_PASS (pass_dce_loop);
NEXT_PASS (pass_vectorize);
{
struct opt_pass **p = &pass_vectorize.pass.sub;
Index: gcc/testsuite/gcc.dg/vect/fast-math-vect-complex-5.c
===================================================================
*** gcc/testsuite/gcc.dg/vect/fast-math-vect-complex-5.c (revision 0)
--- gcc/testsuite/gcc.dg/vect/fast-math-vect-complex-5.c (revision 0)
***************
*** 0 ****
--- 1,18 ----
+ /* { dg-do compile } */
+ /* { dg-require-effective-target vect_double } */
+
+ #define NUM 64
+ _Complex double ad[NUM], bd[NUM], cd[NUM];
+
+ void testd(void)
+ {
+ int i;
+ int j;
+
+ for (i = 0; i < NUM; i++)
+ for (j = 0; j < NUM; j++)
+ cd[i] = cd[i] + ad[j] * bd[j];
+ }
+
+ /* { dg-final { scan-tree-dump "vectorized 1 loops" "vect" } } */
+ /* { dg-final { cleanup-tree-dump "vect" } } */
More information about the Gcc-patches
mailing list