Imported Upstream version 4.8.1
[platform/upstream/gcc48.git] / gcc / testsuite / gcc.target / sh / pr54089-6.c
1 /* Check that the rotr and rotl instructions are generated.  */
2 /* { dg-do compile { target "sh*-*-*" } } */
3 /* { dg-options "-O1" } */
4 /* { dg-skip-if "" { "sh*-*-*" } { "-m5*" } { "" } }  */
5 /* { dg-final { scan-assembler-times "rotr" 2 } } */
6 /* { dg-final { scan-assembler-times "rotl" 2 } } */
7
8 int
9 test_00 (int a)
10 {
11   return (a << 1) | ((a >> 31) & 1);
12 }
13
14 int
15 test_01 (int a)
16 {
17   return (a << 1) | ((unsigned int)a >> 31);
18 }
19
20 int
21 test_02 (int a)
22 {
23   return ((unsigned int)a >> 1) | (a << 31);
24 }
25
26 int
27 test_03 (int a)
28 {
29   return ((a >> 1) & 0x7FFFFFFF) | (a << 31);
30 }