Stop only if there aren't any usable algorithms
[official-gcc.git] / gcc / testsuite / gcc.target / i386 / pr20204.c
blob3d1f015fd93b893e87fa8b68450bcf22a68ca984
1 /* { dg-do run } */
2 /* { dg-options "-O2" } */
4 extern int memcmp (const void *, const void *, __SIZE_TYPE__);
6 void *x (void *pdst, const void *psrc, unsigned int pn)
8 register void *return_dst = pdst;
9 register unsigned char *dst = pdst;
10 register unsigned const char *src = psrc;
11 register int n __asm__ ("ebx") = pn;
13 if (src < dst && dst < src + n)
15 src += n;
16 dst += n;
17 while (n--)
18 *--dst = *--src;
19 return return_dst;
22 while (n >= 16) n--;
24 return return_dst;
26 extern void abort ();
27 extern void exit (int);
28 char xx[30] = "abc";
29 int main (void)
31 char yy[30] = "aab";
33 if (x (xx + 1, xx, 2) != xx + 1 || memcmp (xx, yy, sizeof (yy)) != 0)
34 abort ();
35 exit (0);