aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.target/s390/target-attribute/tattr-17.c
blob: 2e0fcf77ffdb86bddb3dd670ffcca59ecbecde0a (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
35
36
37
38
39
40
41
42
/* Functional tests for the "target" attribute and pragma.  */

/* { dg-do compile { target { lp64 } } } */
/* { dg-require-effective-target dfp } */
/* { dg-require-effective-target target_attribute } */
/* { dg-options "-march=z13 -std=gnu99 -mno-hard-dfp" } */

#pragma GCC target("hard-dfp")
_Decimal64 p1(_Decimal64 f, _Decimal64 g)
{
  return f * g;
  /* { dg-final { scan-assembler-times "\tmdtr\t" 1 } } */
}
#pragma GCC reset_options

#pragma GCC target("no-hard-dfp")
	      _Decimal64 p0(_Decimal64 f, _Decimal64 g)
{
  return f / 2;
  /* { dg-final { scan-assembler-not "\tddtr\t" } } */
}
#pragma GCC reset_options

__attribute__ ((target("hard-dfp")))
_Decimal64 a1(_Decimal64 f, _Decimal64 g)
{
  /* { dg-final { scan-assembler-times "\tadtr\t" 1 } } */
  return f + g;
}

__attribute__ ((target("no-hard-dfp")))
_Decimal64 a0(_Decimal64 f, _Decimal64 g)
{
  return f - g;
  /* { dg-final { scan-assembler-not "\tsdtr\t" } } */
}

_Decimal64 d(_Decimal64 f, _Decimal64 g)
{
  return f - g;
  /* { dg-final { scan-assembler-not "\tsdtr\t" } } */
}