summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.target/powerpc/ppc-and-1.c
blob: 3d4237ce980b42f85d578a7e03d8365a1d65e965 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
/* { dg-do compile { target { powerpc*-*-* && lp64 } } } */
/* { dg-options "-O2" } */

/* { dg-final { scan-assembler "rlwinm r?\[0-9\]+,r?\[0-9\]+,0,0,30"  } } */
/* { dg-final { scan-assembler "rlwinm r?\[0-9\]+,r?\[0-9\]+,0,29,30"  } } */
/* { dg-final { scan-assembler-not "rldicr" } } */

/* Origin:Pete Steinmetz <steinmtz@us.ibm.com> */

/* PR 16457 - use rlwinm insn.  */

char *foo1 (char *p, unsigned int x)
{
  return p - (x & ~1);
}

char *foo2 (char *p, unsigned int x)
{
  return p - (x & 6);
}