summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.target/cris/peep2-xsrand.c
blob: df0e76886b47d89968d03cdf07badec067c31c97 (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
/* { dg-do compile } */
/* { dg-final { scan-assembler "and.w " } } */
/* { dg-final { scan-assembler "and.b " } } */
/* { dg-final { scan-assembler-not "and.d" } } */
/* { dg-options "-O2" } */

/* Test the "asrandb", "asrandw", "lsrandb" and "lsrandw" peephole2:s
   trivially.  */

unsigned int
andwlsr (unsigned int x)
{
  return (x >> 17) & 0x7ff;
}

unsigned int
andblsr (unsigned int x)
{
  return (x >> 25) & 0x5f;
}

int
andwasr (int x)
{
  return (x >> 17) & 0x7ff;
}

int
andbasr (int x)
{
  return (x >> 25) & 0x5f;
}