Debian Codegraph @

gcc/testsuite/gcc.target/s390/target-attribute/pr82012.c

raw
1 /* Different target attributes in general prevent inlining. However,
2 we make an exception for soft-float callers if the callee doesn't
3 actually use HW floating point. This is currently required for
4 compiling libitm. */
5
6 /* { dg-options "-Wno-attributes" } */
7
8 double g = 1.0;
9
10 /* Inlining ok here. foo1 doesn't use FP. */
11
12 int __attribute__ ((always_inline)) foo1 (int a)
13 {
14 return 0;
15 }
16
17 int __attribute__ ((target ("soft-float"))) test1 (int a)
18 {
19 return foo1 (a);
20 }
21
22 /* Inlining ok here. FP store doesn't need HW FP. */
23
24 int __attribute__ ((always_inline)) foo2 (int a)
25 {
26 g = 2.0;
27 return 0;
28 }
29
30 int __attribute__ ((target ("soft-float"))) test2 (int a)
31 {
32 return foo2 (a);
33 }
34
35 /* Inlining needs to be rejected. foo3 performs HW FP operation. */
36
37 int __attribute__ ((always_inline)) foo3 (int a) /* { dg-error "inlining failed in call to 'always_inline'" } */
38 {
39 g = (double) a / 2.0;
40 return 0;
41 }
42
43 int __attribute__ ((target ("soft-float"))) test3 (int a)
44 {
45 return foo3 (a);
46 }