2018-02-09 Sebastian Perta <sebastian.perta@renesas.com>
[official-gcc.git] / gcc / testsuite / gcc.target / sh / pr67675.c
blobe6c5d0d9b9f8752f546269dc825eb8066b134018
1 /* Check that run time alignment tests are generated only for inputs of
2 unknown alignment. */
3 /* { dg-do compile } */
4 /* { dg-options "-O2" } */
5 /* { dg-final { scan-assembler-not "jmp|bsr|jsr" } } */
6 /* { dg-final { scan-assembler-times {tst #3,r0} 6 } } */
7 /* { dg-final { scan-assembler-times {or r[0-9],r[0-9]} 1 } } */
9 int
10 test_00 (const char* x, const char* y)
12 /* 1x or reg,reg, 1x tst #3,r0 */
13 return __builtin_strcmp (x, y);
16 int
17 test_01 (const char* x, const char* y)
19 /* 1x tst #3,r0 */
20 return __builtin_strcmp (__builtin_assume_aligned (x, 4), y);
23 int
24 test_02 (const char* x, const char* y)
26 /* 1x tst #3,r0 */
27 return __builtin_strcmp (x, __builtin_assume_aligned (y, 4));
30 int
31 test_03 (const char* x, const char* y)
33 return __builtin_strcmp (__builtin_assume_aligned (x, 4),
34 __builtin_assume_aligned (y, 4));
37 int
38 test_04 (const char* x, const char* y)
40 /* 1x tst #3,r0 */
41 return __builtin_strcmp (x, "1234567");
44 int
45 test_05 (const char* x, const char* y)
47 /* 1x tst #3,r0 */
48 return __builtin_strcmp ("1234567", y);
51 int
52 test_06 (const char* s1)
54 /* 1x tst #3,r0 */
55 return __builtin_strncmp (s1, "abcdabcd", 8);
58 int
59 test_07 (const char* s1)
61 return __builtin_strncmp (__builtin_assume_aligned (s1, 4), "abcdabcd", 8);