Debian Codegraph @

gcc/testsuite/g++.target/aarch64/sme/exceptions_1.C

raw
1 // { dg-options "-O -fno-optimize-sibling-calls" }
2 // { dg-final { check-function-bodies "**" "" } }
3
4 void callee_inout() __arm_inout("za");
5 void callee_in() noexcept __arm_in("za");
6 void callee_out() noexcept __arm_out("za");
7 void callee_normal();
8
9 /*
10 ** _Z5test1v:
11 ** ...
12 ** bl __arm_tpidr2_save
13 ** ...
14 ** bl __cxa_begin_catch
15 ** bl __cxa_end_catch
16 ** mov w0, #?2
17 ** ...
18 */
19 __arm_new("za") int
20 test1 ()
21 {
22 try
23 {
24 callee_inout();
25 return 1;
26 }
27 catch (...)
28 {
29 return 2;
30 }
31 }
32
33 /*
34 ** _Z5test2v:
35 ** ...
36 ** bl __arm_tpidr2_save
37 ** ...
38 ** bl __cxa_begin_catch
39 ** smstart za
40 ** bl _Z10callee_outv
41 ** bl _Z9callee_inv
42 ** smstop za
43 ** bl __cxa_end_catch
44 ** mov w0, #?2
45 ** ...
46 */
47 __arm_new("za") int
48 test2 ()
49 {
50 try
51 {
52 callee_inout();
53 return 1;
54 }
55 catch (...)
56 {
57 callee_out();
58 callee_in();
59 return 2;
60 }
61 }
62
63 /*
64 ** _Z5test3v:
65 ** ...
66 ** bl __arm_tpidr2_save
67 ** ...
68 ** smstop za
69 ** ...
70 ** bl _Z13callee_normalv
71 ** ...
72 ** bl __cxa_begin_catch
73 ** smstart za
74 ** bl _Z10callee_outv
75 ** bl _Z9callee_inv
76 ** smstop za
77 ** bl __cxa_end_catch
78 ** mov w0, #?2
79 ** ...
80 */
81 __arm_new("za") int
82 test3 ()
83 {
84 try
85 {
86 callee_normal();
87 return 1;
88 }
89 catch (...)
90 {
91 callee_out();
92 callee_in();
93 return 2;
94 }
95 }
96
97 __arm_new("za") int
98 test4 ()
99 {
100 try
101 {
102 // No lazy save set up because this is a shared-ZA function.
103 callee_inout();
104 return 1;
105 }
106 catch (...)
107 {
108 callee_inout();
109 return 2;
110 }
111 }
112 // { dg-final { scan-assembler {_Z5test4v:(?:(?!msr\ttpidr2_el0, x[0-9]+).)*\tret} } }
113
114 /*
115 ** _Z5test5v:
116 ** ...
117 ** bl __arm_tpidr2_save
118 ** ...
119 ** smstart za
120 ** ...
121 ** bl _Z12callee_inoutv
122 ** add (x[0-9]+), [^\n]+
123 ** msr tpidr2_el0, \1
124 ** bl _Z13callee_normalv
125 ** msr tpidr2_el0, xzr
126 ** smstop za
127 ** ...
128 ** bl __cxa_begin_catch
129 ** ...
130 ** mrs x[0-9]+, tpidr2_el0
131 ** ...
132 ** smstart za
133 ** ...
134 ** bl __arm_tpidr2_restore
135 ** msr tpidr2_el0, xzr
136 ** bl _Z12callee_inoutv
137 ** smstop za
138 ** bl __cxa_end_catch
139 ** mov w0, #?2
140 ** ...
141 */
142 __arm_new("za") int
143 test5 ()
144 {
145 try
146 {
147 callee_inout();
148 callee_normal();
149 return 1;
150 }
151 catch (...)
152 {
153 callee_inout();
154 return 2;
155 }
156 }
157
158 /*
159 ** _Z5test6v:
160 ** ...
161 ** msr tpidr2_el0, x[0-9]+
162 ** bl _Z13callee_normalv
163 ** msr tpidr2_el0, xzr
164 ** ...
165 ** bl __cxa_begin_catch
166 ** bl __cxa_end_catch
167 ** ...
168 ** mrs x[0-9]+, tpidr2_el0
169 ** ...
170 ** smstart za
171 ** ...
172 ** bl __arm_tpidr2_restore
173 ** msr tpidr2_el0, xzr
174 ** ...
175 */
176 int
177 test6 () __arm_inout("za")
178 {
179 try
180 {
181 callee_normal();
182 callee_out();
183 return 1;
184 }
185 catch (...)
186 {
187 return 2;
188 }
189 }