summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.target/i386/shift_mask.c
blob: 29c84bd1dffe741bf7bcc30c31d416d348d4c710 (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
/* { dg-do compile } */
/* { dg-options "-O2" } */

int test_sal (int a, int c)
{
  return a << (c & 0x1f);
}

int test_sar (int a, int c)
{
  return a >> (c & 0x1f);
}

unsigned int test_shr (unsigned int a, int c)
{
  return a >> (c & 0x1f);
}

unsigned int test_rol (unsigned int a, int c)
{
  int z = c & 0x1f;
  return (a << z) | (a >> (32 - z));
}

unsigned int test_ror (unsigned int a, int c)
{
  int z = c & 0x1f;
  return (a >> z) | (a << (32 - z));
}

/* { dg-final { scan-assembler-not "and" } } */