aboutsummaryrefslogtreecommitdiffstats
path: root/gcc-4.9/gcc/testsuite/gcc.target/sh/pr54089-6.c
blob: 577690dd8329957bddbdf232b3443e61b7dce4c5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
/* Check that the rotr and rotl instructions are generated.  */
/* { dg-do compile }  */
/* { dg-options "-O1" } */
/* { dg-skip-if "" { "sh*-*-*" } { "-m5*" } { "" } }  */
/* { dg-final { scan-assembler-times "rotr" 2 } } */
/* { dg-final { scan-assembler-times "rotl" 3 } } */

int
test_00 (int a)
{
  return (a << 1) | ((a >> 31) & 1);
}

int
test_01 (int a)
{
  return (a << 1) | ((unsigned int)a >> 31);
}

int
test_02 (int a)
{
  return ((unsigned int)a >> 1) | (a << 31);
}

int
test_03 (int a)
{
  return ((a >> 1) & 0x7FFFFFFF) | (a << 31);
}

int
test_04 (int a)
{
  return a + a + ((a >> 31) & 1);
}