aboutsummaryrefslogtreecommitdiffstats
path: root/gcc-4.9/gcc/testsuite/gcc.target/powerpc/bcd-1.c
blob: c7496c2357990e6e2a8055fb194076afb2308584 (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*-*-linux* } } } */
/* { dg-skip-if "" { powerpc*-*-darwin* } { "*" } { "" } } */
/* { dg-skip-if "" { powerpc*-*-*spe* } { "*" } { "" } } */
/* { dg-require-effective-target powerpc_vsx_ok } */
/* { 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);
}