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.
8 Additional tests by Roger Sayle after PR 3508, 12/26/2001. */
10 extern void abort (void);
11 typedef __SIZE_TYPE__
size_t;
12 extern int memcmp (const void *, const void *, size_t);
13 extern char *strcpy (char *, const char *);
14 extern void link_error (void);
23 if ( memcmp (str
, str
+2, 0) != 0 )
25 if ( memcmp (str
+1, str
+3, 0) != 0 )
28 if ( memcmp (str
+1, str
+3, 1) != 0 )
30 if ( memcmp (str
, str
+2, 1) >= 0 )
32 if ( memcmp (str
+2, str
, 1) <= 0 )
35 if (memcmp ("abcd", "efgh", 4) >= 0)
37 if (memcmp ("abcd", "abcd", 4) != 0)
39 if (memcmp ("efgh", "abcd", 4) <= 0)