1 /* Check that the __builtin_strncmp function is inlined
2 when optimizing for speed. */
3 /* { dg-do compile } */
4 /* { dg-options "-O2" } */
5 /* { dg-final { scan-assembler-not "jmp" } } */
6 /* { dg-final { scan-assembler-times "cmp/str" 1 } } */
7
8 /* Test that cmp/str is not used for small lengths. */
9 int
10 test01 (const char *s1)
11 {
12 return __builtin_strncmp (s1, "abcde", 3);
13 }
14
15 /* Test that the cmp/str loop is used. */
16 int
17 test02 (const char *s1)
18 {
19 return __builtin_strncmp (s1, "abcdefghi", 8);
20 }
21
22 /* Test that no call is generated */
23 int
24 test03 (const char *s1, int n)
25 {
26 return __builtin_strncmp (s1, "abcde", n);
27 }
28
29
30