1 /* Copyright (C) 2001 Free Software Foundation.
3 Ensure that short builtin memcmp are optimized and perform correctly.
4 On architectures with a cmpstrsi instruction, this test doesn't determine
5 which optimization is being performed, but it does check for correctness.
7 Written by Roger Sayle, 12/02/2001. */
9 extern void abort (void);
10 typedef __SIZE_TYPE__ size_t;
11 extern int memcmp (const void *, const void *, size_t);
12 extern char *strcpy (char *, const char *);
21 if ( memcmp (str, str+2, 0) != 0 )
23 if ( memcmp (str+1, str+3, 0) != 0 )
26 if ( memcmp (str+1, str+3, 1) != 0 )
28 if ( memcmp (str, str+2, 1) >= 0 )
30 if ( memcmp (str+2, str, 1) <= 0 )
37 /* When optimizing, all the above cases should be transformed into
38 something else. So any remaining calls to the original function
40 __attribute__ ((noinline))
42 memcmp (const void *p1, const void *p2, size_t len)