1 /* { dg-do compile } */
2 /* { dg-options "-O2" } */
3 /* { dg-final { scan-assembler-not "memcmp" } } */
4 /* { dg-final { scan-assembler "1752394086" } } */
5
6 /* This should turn into four compare/jump pairs with -m32, within the
7 limit of what the tuning considers acceptable for -O2. */
cmp(char * p,char * q)8 int cmp (char *p, char *q)
9 {
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;
15 }
16 /* Since we have fast unaligned access, we should make a single
17 constant comparison. The constant becomes 1752394086. */
cmp2(char * p)18 int cmp2 (char *p)
19 {
20 if (__builtin_memcmp (p, "fish", 4) != 0)
21 return 1;
22 return 0;
23 }
24