aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.target/powerpc/cmpb32-2.c
blob: 0713c44fcff2e9617d58c5c552640a1fd8fdf104 (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
/* { dg-do compile { target { powerpc*-*-* } } } */
/* Skip powerpc*-*-darwin* powerpc-*-eabi as dropped popcntb_ok.  */
/* { dg-skip-if "" { powerpc*-*-darwin* powerpc-*-eabi } } */
/* { dg-options "-mdejagnu-cpu=power5" } */

void abort ();

unsigned int
do_compare (unsigned int a, unsigned int b)
{
  return __builtin_cmpb (a, b);  /* { dg-error "'__builtin_p6_cmpb_32' requires the '-mcpu=power6' option" } */
}

void
expect (unsigned int pattern, unsigned int value)
{
  if (pattern != value)
    abort ();
}

int
main (int argc, char *argv[])
{
  expect (0xff000000, do_compare (0x12345678, 0x12000000));
  expect (0x00ffffff, do_compare (0x12345678, 0x00345678));
  expect (0x000000ff, do_compare (0x00000078, 0x12345678));
}