summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.target/cris/peep2-xsrand2.c
blob: 5d6ca788d73a4151e336157c912b557ee154f244 (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
/* { dg-do compile } */
/* { dg-final { scan-assembler "and.w -137," } } */
/* { dg-final { scan-assembler "and.b -64," } } */
/* { dg-final { scan-assembler "and.w -139," } } */
/* { dg-final { scan-assembler "and.b -63," } } */
/* { dg-final { scan-assembler-not "and.d" } } */
/* { dg-options "-O2" } */

/* PR target/17984.  Test-case based on
   testsuite/gcc.dg/cris-peep2-xsrand.c.  */

unsigned int
andwlsr (unsigned int x)
{
  return (x >> 16) & 0xff77;
}

unsigned int
andblsr (unsigned int x)
{
  return (x >> 24) & 0xc0;
}

int
andwasr (int x)
{
  return (x >> 16) & 0xff75;
}

int
andbasr (int x)
{
  return (x >> 24) & 0xc1;
}