Message ID | Y26XubanUrWdwJZF@e124511.cambridge.arm.com |
---|---|
State | New |
Headers | show |
Series | middle-end: Popcount and clz/ctz idiom recognition improvements | expand |
On Fri, Nov 11, 2022 at 7:48 PM Andrew Carlotti via Gcc-patches <gcc-patches@gcc.gnu.org> wrote: > > The upcoming c[lt]z idiom recognition patch eliminates the need for a > brute force computation of the iteration count of these loops. The test > is intended to verify that ivcanon can determine the loop count when the > condition is given by a chain of constant computations. > > We replace the constant operations with a more complicated chain that should > resist future idiom recognition. OK. > gcc/testsuite/ChangeLog: > > * gcc.dg/pr77975.c: Make tests more robust. > > > -- > > > diff --git a/gcc/testsuite/gcc.dg/pr77975.c b/gcc/testsuite/gcc.dg/pr77975.c > index 148cebdded964da7fce148abdf2a430c55650513..a187ce2b50c2821841e71b5b6cb243a37a66fb57 100644 > --- a/gcc/testsuite/gcc.dg/pr77975.c > +++ b/gcc/testsuite/gcc.dg/pr77975.c > @@ -7,10 +7,11 @@ > unsigned int > foo (unsigned int *b) > { > - unsigned int a = 3; > + unsigned int a = 8; > while (a) > { > - a >>= 1; > + a += 5; > + a &= 44; > *b += a; > } > return a; > @@ -21,10 +22,11 @@ foo (unsigned int *b) > unsigned int > bar (unsigned int *b) > { > - unsigned int a = 7; > + unsigned int a = 3; > while (a) > { > - a >>= 1; > + a += 5; > + a &= 44; > *b += a; > } > return a;
diff --git a/gcc/testsuite/gcc.dg/pr77975.c b/gcc/testsuite/gcc.dg/pr77975.c index 148cebdded964da7fce148abdf2a430c55650513..a187ce2b50c2821841e71b5b6cb243a37a66fb57 100644 --- a/gcc/testsuite/gcc.dg/pr77975.c +++ b/gcc/testsuite/gcc.dg/pr77975.c @@ -7,10 +7,11 @@ unsigned int foo (unsigned int *b) { - unsigned int a = 3; + unsigned int a = 8; while (a) { - a >>= 1; + a += 5; + a &= 44; *b += a; } return a; @@ -21,10 +22,11 @@ foo (unsigned int *b) unsigned int bar (unsigned int *b) { - unsigned int a = 7; + unsigned int a = 3; while (a) { - a >>= 1; + a += 5; + a &= 44; *b += a; } return a;