1 /* Functional tests for the "target" attribute and pragma. */
2
3 /* { dg-do compile } */
4 /* { dg-require-effective-target target_attribute } */
5 /* { dg-options "-O3 -march=z13 -mstack-guard=0 -mstack-size=512" } */
6
7 extern char *bar(int x);
8
da(int x)9 void da(int x)
10 {
11 bar(x);
12 bar(x + 1);
13 /* { dg-final { scan-assembler-times "\ttmll\t%r15,256" 2 { target { lp64 } } } } */
14 /* { dg-final { scan-assembler-times "\ttml\t%r15,384" 2 { target { ! lp64 } } } } */
15 }
16
17 #pragma GCC target("stack-size=1024,stack-guard=0")
p1(int x)18 void p1(int x)
19 {
20 bar(x);
21 bar(x + 1);
22 /* { dg-final { scan-assembler-times "\ttmll\t%r15,768" 1 { target { lp64 } } } } */
23 /* { dg-final { scan-assembler-times "\ttml\t%r15,896" 1 { target { ! lp64 } } } } */
24 }
25 #pragma GCC reset_options
26
27 #pragma GCC target("stack-size=2048,stack-guard=0")
p0(int x)28 void p0(int x)
29 {
30 bar(x);
31 bar(x + 1);
32 /* { dg-final { scan-assembler-times "\ttmll\t%r15,1792" 1 { target { lp64 } } } } */
33 /* { dg-final { scan-assembler-times "\ttml\t%r15,1920" 1 { target { ! lp64 } } } } */
34 }
35 #pragma GCC reset_options
36
37 __attribute__ ((target("stack-size=4096,stack-guard=0")))
a1(int x)38 void a1(int x)
39 {
40 bar(x);
41 bar(x + 1);
42 /* { dg-final { scan-assembler-times "\ttmll\t%r15,3840" 1 { target { lp64 } } } } */
43 /* { dg-final { scan-assembler-times "\ttml\t%r15,3968" 1 { target { ! lp64 } } } } */
44 }
45
46 __attribute__ ((target("stack-size=8192,stack-guard=0")))
a0(int x)47 void a0(int x)
48 {
49 bar(x);
50 bar(x + 1);
51 /* { dg-final { scan-assembler-times "\ttmll\t%r15,7936" 1 { target { lp64 } } } } */
52 /* { dg-final { scan-assembler-times "\ttml\t%r15,8064" 1 { target { ! lp64 } } } } */
53 }
54
d(int x)55 void d(int x)
56 {
57 bar(x);
58 bar(x + 1);
59 }
60