summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.target/powerpc/bcd-1.c
blob: cb3b406ac25a9c4df759c8c9f1fe4f35efdc200a (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
/* { dg-do compile { target { powerpc*-*-linux* } } } */
/* { dg-skip-if "" { powerpc*-*-darwin* } } */
/* { dg-skip-if "" { powerpc*-*-*spe* } } */
/* { dg-require-effective-target powerpc_vsx_ok } */
/* { dg-skip-if "do not override -mcpu" { powerpc*-*-* } { "-mcpu=*" } { "-mcpu=power7" } } */
/* { dg-options "-mcpu=power7 -O2" } */
/* { dg-final { scan-assembler-times "cdtbcd " 1 } } */
/* { dg-final { scan-assembler-times "cbcdtd " 1 } } */
/* { dg-final { scan-assembler-times "addg6s " 1 } } */
/* { dg-final { scan-assembler-not    "bl __builtin" } } */

unsigned int
to_bcd (unsigned int a)
{
  return __builtin_cdtbcd (a);
}

unsigned int
from_bcd (unsigned int a)
{
  return __builtin_cbcdtd (a);
}

unsigned int
bcd_arith (unsigned int a, unsigned int b)
{
  return __builtin_addg6s (a, b);
}