Debian Codegraph @

gcc/testsuite/gcc.target/sh/strlen.c

raw
1 /* Check that the __builtin_strlen function is inlined with cmp/str
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" 2 } } */
7 /* { dg-final { scan-assembler-times "tst\t#3" 1 } } */
8
9 int
10 test00 (const char *s1)
11 {
12 return __builtin_strlen (s1);
13 }
14
15 /* Check that no test for alignment is needed. */
16 int
17 test03 (const char *s1)
18 {
19 return __builtin_strlen (__builtin_assume_aligned (s1, 4));
20 }