1 /* Test strcmp builtin expansion for compilation and proper execution. */
3 /* { dg-options "-O2" } */
4 /* { dg-require-effective-target ptr32plus } */
10 #define RUN_TEST(SZ, ALIGN) test_strcmp_ ## SZ ## _ ## ALIGN ()
12 #define DEF_TEST(SZ, ALIGN) \
13 static void test_strcmp_ ## SZ ## _ ## ALIGN (void) { \
14 char one[3 * (SZ > 10 ? SZ : 10)]; \
15 char two[3 * (SZ > 10 ? SZ : 10)]; \
16 char three[8192] __attribute__ ((aligned (4096))); \
17 char four[8192] __attribute__ ((aligned (4096))); \
19 memset(one,0,sizeof(one)); \
20 memset(two,0,sizeof(two)); \
21 memset(three,0,sizeof(three)); \
22 memset(four,0,sizeof(four)); \
23 for (i = 0 ; i < SZ ; i++) \
26 char *a = one + (i & 1) * ALIGN; \
27 char *b = two + (i & 1) * ALIGN; \
34 if (!((r1 = strcmp (b, a)) > 0)) \
36 if (!((r1 = strcmp (a, b)) < 0)) \
39 if (!((r1 = strcmp (a, b)) == 0)) \
41 for(j = i; j < SZ ; j++) \
46 if (!((r1 = strcmp (b, a)) > 0)) \
48 if (!((r1 = strcmp (a, b)) < 0)) \
50 for(j = 0; j < i ; j++) \
58 if ((r1 = strcmp (b, a)) != 0) \
61 a = three + 4096 - (SZ / 2 + (i & 1) * ALIGN); \
62 b = four + 4096 - (SZ / 2 + (i & 1) * ALIGN); \
69 if (!((r1 = strcmp(b, a)) > 0)) \
71 if (!((r1 = strcmp(a, b)) < 0)) \
74 if (!((r1 = strcmp(a, b)) == 0)) \
361 main(int argc
, char **argv
)