2016-12-21 Vladimir Makarov <vmakarov@redhat.com>
[official-gcc.git] / gcc / testsuite / gcc.target / i386 / pr52171.c
blob50cc520b60c62719624ff701b2801cf49589c180
1 /* { dg-do compile } */
2 /* { dg-options "-O2" } */
3 /* { dg-final { scan-assembler-not "memcmp" } } */
4 /* { dg-final { scan-assembler "1752394086" } } */
6 /* This should turn into four compare/jump pairs with -m32, within the
7 limit of what the tuning considers acceptable for -O2. */
8 int cmp (char *p, char *q)
10 char *pa = __builtin_assume_aligned (p, 4);
11 char *qa = __builtin_assume_aligned (q, 4);
12 if (__builtin_memcmp (pa, qa, 16) != 0)
13 return 1;
14 return 0;
16 /* Since we have fast unaligned access, we should make a single
17 constant comparison. The constant becomes 1752394086. */
18 int cmp2 (char *p)
20 if (__builtin_memcmp (p, "fish", 4) != 0)
21 return 1;
22 return 0;