Commit 87b47251 by Andre Vieira Committed by Andre Vieira

[vect]Account for epilogue's peeling for gaps when checking if we have enough

niters for epilogue

gcc/ChangeLog:
2019-11-11  Andre Vieira  <andre.simoesdiasvieira@arm.com>

	* tree-vect-loop-manip.c (vect_do_peeling): Take epilogue gaps into
	account when checking if there are enough iterations to vectorize
	epilogue.

gcc/testsuite/ChangeLog:
2019-11-11  Andre Vieira  <andre.simoesdiasvieira@arm.com>

	* gcc.dg/vect/vect-reduc-epilogue-gaps.c: New test.

From-SVN: r278049
parent 3f246567
2019-11-11 Andre Vieira <andre.simoesdiasvieira@arm.com>
* tree-vect-loop-manip.c (vect_do_peeling): Take epilogue gaps into
account when checking if there are enough iterations to vectorize
epilogue.
2019-11-11 Tobias Burnus <tobias@codesourcery.com> 2019-11-11 Tobias Burnus <tobias@codesourcery.com>
Kwok Cheung Yeung <kcy@codesourcery.com> Kwok Cheung Yeung <kcy@codesourcery.com>
2019-11-11 Andre Vieira <andre.simoesdiasvieira@arm.com>
* gcc.dg/vect/vect-reduc-epilogue-gaps.c: New test.
2019-11-11 José Rui Faustino de Sousa <jrfsousa@gmail.com> 2019-11-11 José Rui Faustino de Sousa <jrfsousa@gmail.com>
PR fortran/92142 PR fortran/92142
......
/* { dg-options "-O3 -fno-vect-cost-model" } */
struct {
float real;
float img;
} g[11];
float __attribute__ ((noclone))
foo_11 (void)
{
float sum = 0.0;
for (int i = 0; i < 11; ++i)
sum += g[i].real;
return sum;
}
float __attribute__ ((noclone))
foo_10 (void)
{
float sum = 0.0;
for (int i = 0; i < 10; ++i)
sum += g[i].real;
return sum;
}
int main (void)
{
float check_10 = 0.0;
float check_11 = 0.0;
for (int i = 0; i < 11; ++i)
{
asm volatile ("" : : : "memory");
g[i].real = (float) i;
g[i].img = (float) -i;
if (i < 10)
check_10 += (float) i;
check_11 += (float) i;
}
if (foo_10 () != check_10)
__builtin_abort ();
if (foo_11 () != check_11)
__builtin_abort ();
return 0;
}
...@@ -2530,9 +2530,11 @@ vect_do_peeling (loop_vec_info loop_vinfo, tree niters, tree nitersm1, ...@@ -2530,9 +2530,11 @@ vect_do_peeling (loop_vec_info loop_vinfo, tree niters, tree nitersm1,
= eiters % lowest_vf + LOOP_VINFO_PEELING_FOR_GAPS (loop_vinfo); = eiters % lowest_vf + LOOP_VINFO_PEELING_FOR_GAPS (loop_vinfo);
unsigned int ratio; unsigned int ratio;
unsigned int epilogue_gaps
= LOOP_VINFO_PEELING_FOR_GAPS (epilogue_vinfo);
while (!(constant_multiple_p (loop_vinfo->vector_size, while (!(constant_multiple_p (loop_vinfo->vector_size,
epilogue_vinfo->vector_size, &ratio) epilogue_vinfo->vector_size, &ratio)
&& eiters >= lowest_vf / ratio)) && eiters >= lowest_vf / ratio + epilogue_gaps))
{ {
delete epilogue_vinfo; delete epilogue_vinfo;
epilogue_vinfo = NULL; epilogue_vinfo = NULL;
...@@ -2543,6 +2545,7 @@ vect_do_peeling (loop_vec_info loop_vinfo, tree niters, tree nitersm1, ...@@ -2543,6 +2545,7 @@ vect_do_peeling (loop_vec_info loop_vinfo, tree niters, tree nitersm1,
} }
epilogue_vinfo = loop_vinfo->epilogue_vinfos[0]; epilogue_vinfo = loop_vinfo->epilogue_vinfos[0];
loop_vinfo->epilogue_vinfos.ordered_remove (0); loop_vinfo->epilogue_vinfos.ordered_remove (0);
epilogue_gaps = LOOP_VINFO_PEELING_FOR_GAPS (epilogue_vinfo);
} }
} }
/* Prolog loop may be skipped. */ /* Prolog loop may be skipped. */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment