aboutsummaryrefslogtreecommitdiffstats
path: root/gcc-4.9/gcc/testsuite/gcc.target/sh/strlen.c
blob: 115baba99cd3efd6e0383c2af6a34e60230470f3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
/* Check that the __builtin_strlen function is inlined with cmp/str
   when optimizing for speed.  */
/* { dg-do compile }  */
/* { dg-options "-O2" } */
/* { dg-skip-if "" { "sh*-*-*" } { "-m5*" } { "" } } */
/* { dg-final { scan-assembler-not "jmp" } } */
/* { dg-final { scan-assembler-times "cmp/str" 2 } } */
/* { dg-final { scan-assembler-times "tst\t#3" 1 } } */

test00 (const char *s1)
{
  return __builtin_strlen (s1);
}

/* Check that no test for alignment is needed.  */
test03(const char *s1)
{
  return __builtin_strlen (__builtin_assume_aligned (s1, 4));
}