1 /* { dg-do compile { target { powerpc*-*-* && lp64 } } } */
2 /* { dg-require-effective-target powerpc_p9vector_ok } */
3 /* { dg-options "-mpower9-vector -mpower9-misc -O2" } */
4
5 /* Verify P9 atomic memory operations. */
6
7 #include <amo.h>
8 #include <stdint.h>
9
10 uint32_t
do_lw_add(uint32_t * mem,uint32_t value)11 do_lw_add (uint32_t *mem, uint32_t value)
12 {
13 return amo_lwat_add (mem, value);
14 }
15
16 int32_t
do_lw_sadd(int32_t * mem,int32_t value)17 do_lw_sadd (int32_t *mem, int32_t value)
18 {
19 return amo_lwat_sadd (mem, value);
20 }
21
22 uint32_t
do_lw_xor(uint32_t * mem,uint32_t value)23 do_lw_xor (uint32_t *mem, uint32_t value)
24 {
25 return amo_lwat_xor (mem, value);
26 }
27
28 uint32_t
do_lw_ior(uint32_t * mem,uint32_t value)29 do_lw_ior (uint32_t *mem, uint32_t value)
30 {
31 return amo_lwat_ior (mem, value);
32 }
33
34 uint32_t
do_lw_and(uint32_t * mem,uint32_t value)35 do_lw_and (uint32_t *mem, uint32_t value)
36 {
37 return amo_lwat_and (mem, value);
38 }
39
40 uint32_t
do_lw_umax(uint32_t * mem,uint32_t value)41 do_lw_umax (uint32_t *mem, uint32_t value)
42 {
43 return amo_lwat_umax (mem, value);
44 }
45
46 int32_t
do_lw_smax(int32_t * mem,int32_t value)47 do_lw_smax (int32_t *mem, int32_t value)
48 {
49 return amo_lwat_smax (mem, value);
50 }
51
52 uint32_t
do_lw_umin(uint32_t * mem,uint32_t value)53 do_lw_umin (uint32_t *mem, uint32_t value)
54 {
55 return amo_lwat_umin (mem, value);
56 }
57
58 int32_t
do_lw_smin(int32_t * mem,int32_t value)59 do_lw_smin (int32_t *mem, int32_t value)
60 {
61 return amo_lwat_smin (mem, value);
62 }
63
64 uint32_t
do_lw_swap(uint32_t * mem,uint32_t value)65 do_lw_swap (uint32_t *mem, uint32_t value)
66 {
67 return amo_lwat_swap (mem, value);
68 }
69
70 int32_t
do_lw_sswap(int32_t * mem,int32_t value)71 do_lw_sswap (int32_t *mem, int32_t value)
72 {
73 return amo_lwat_sswap (mem, value);
74 }
75
76 uint64_t
do_ld_add(uint64_t * mem,uint64_t value)77 do_ld_add (uint64_t *mem, uint64_t value)
78 {
79 return amo_ldat_add (mem, value);
80 }
81
82 int64_t
do_ld_sadd(int64_t * mem,int64_t value)83 do_ld_sadd (int64_t *mem, int64_t value)
84 {
85 return amo_ldat_sadd (mem, value);
86 }
87
88 uint64_t
do_ld_xor(uint64_t * mem,uint64_t value)89 do_ld_xor (uint64_t *mem, uint64_t value)
90 {
91 return amo_ldat_xor (mem, value);
92 }
93
94 uint64_t
do_ld_ior(uint64_t * mem,uint64_t value)95 do_ld_ior (uint64_t *mem, uint64_t value)
96 {
97 return amo_ldat_ior (mem, value);
98 }
99
100 uint64_t
do_ld_and(uint64_t * mem,uint64_t value)101 do_ld_and (uint64_t *mem, uint64_t value)
102 {
103 return amo_ldat_and (mem, value);
104 }
105
106 uint64_t
do_ld_umax(uint64_t * mem,uint64_t value)107 do_ld_umax (uint64_t *mem, uint64_t value)
108 {
109 return amo_ldat_umax (mem, value);
110 }
111
112 int64_t
do_ld_smax(int64_t * mem,int64_t value)113 do_ld_smax (int64_t *mem, int64_t value)
114 {
115 return amo_ldat_smax (mem, value);
116 }
117
118 uint64_t
do_ld_umin(uint64_t * mem,uint64_t value)119 do_ld_umin (uint64_t *mem, uint64_t value)
120 {
121 return amo_ldat_umin (mem, value);
122 }
123
124 int64_t
do_ld_smin(int64_t * mem,int64_t value)125 do_ld_smin (int64_t *mem, int64_t value)
126 {
127 return amo_ldat_smin (mem, value);
128 }
129
130 uint64_t
do_ld_swap(uint64_t * mem,uint64_t value)131 do_ld_swap (uint64_t *mem, uint64_t value)
132 {
133 return amo_ldat_swap (mem, value);
134 }
135
136 int64_t
do_ld_sswap(int64_t * mem,int64_t value)137 do_ld_sswap (int64_t *mem, int64_t value)
138 {
139 return amo_ldat_sswap (mem, value);
140 }
141
142 void
do_sw_add(uint32_t * mem,uint32_t value)143 do_sw_add (uint32_t *mem, uint32_t value)
144 {
145 amo_stwat_add (mem, value);
146 }
147
148 void
do_sw_sadd(int32_t * mem,int32_t value)149 do_sw_sadd (int32_t *mem, int32_t value)
150 {
151 amo_stwat_sadd (mem, value);
152 }
153
154 void
do_sw_xor(uint32_t * mem,uint32_t value)155 do_sw_xor (uint32_t *mem, uint32_t value)
156 {
157 amo_stwat_xor (mem, value);
158 }
159
160 void
do_sw_ior(uint32_t * mem,uint32_t value)161 do_sw_ior (uint32_t *mem, uint32_t value)
162 {
163 amo_stwat_ior (mem, value);
164 }
165
166 void
do_sw_and(uint32_t * mem,uint32_t value)167 do_sw_and (uint32_t *mem, uint32_t value)
168 {
169 amo_stwat_and (mem, value);
170 }
171
172 void
do_sw_umax(int32_t * mem,int32_t value)173 do_sw_umax (int32_t *mem, int32_t value)
174 {
175 amo_stwat_umax (mem, value);
176 }
177
178 void
do_sw_smax(int32_t * mem,int32_t value)179 do_sw_smax (int32_t *mem, int32_t value)
180 {
181 amo_stwat_smax (mem, value);
182 }
183
184 void
do_sw_umin(int32_t * mem,int32_t value)185 do_sw_umin (int32_t *mem, int32_t value)
186 {
187 amo_stwat_umin (mem, value);
188 }
189
190 void
do_sw_smin(int32_t * mem,int32_t value)191 do_sw_smin (int32_t *mem, int32_t value)
192 {
193 amo_stwat_smin (mem, value);
194 }
195
196 void
do_sd_add(uint64_t * mem,uint64_t value)197 do_sd_add (uint64_t *mem, uint64_t value)
198 {
199 amo_stdat_add (mem, value);
200 }
201
202 void
do_sd_sadd(int64_t * mem,int64_t value)203 do_sd_sadd (int64_t *mem, int64_t value)
204 {
205 amo_stdat_sadd (mem, value);
206 }
207
208 void
do_sd_xor(uint64_t * mem,uint64_t value)209 do_sd_xor (uint64_t *mem, uint64_t value)
210 {
211 amo_stdat_xor (mem, value);
212 }
213
214 void
do_sd_ior(uint64_t * mem,uint64_t value)215 do_sd_ior (uint64_t *mem, uint64_t value)
216 {
217 amo_stdat_ior (mem, value);
218 }
219
220 void
do_sd_and(uint64_t * mem,uint64_t value)221 do_sd_and (uint64_t *mem, uint64_t value)
222 {
223 amo_stdat_and (mem, value);
224 }
225
226 void
do_sd_umax(int64_t * mem,int64_t value)227 do_sd_umax (int64_t *mem, int64_t value)
228 {
229 amo_stdat_umax (mem, value);
230 }
231
232 void
do_sd_smax(int64_t * mem,int64_t value)233 do_sd_smax (int64_t *mem, int64_t value)
234 {
235 amo_stdat_smax (mem, value);
236 }
237
238 void
do_sd_umin(int64_t * mem,int64_t value)239 do_sd_umin (int64_t *mem, int64_t value)
240 {
241 amo_stdat_umin (mem, value);
242 }
243
244 void
do_sd_smin(int64_t * mem,int64_t value)245 do_sd_smin (int64_t *mem, int64_t value)
246 {
247 amo_stdat_smin (mem, value);
248 }
249
250 /* { dg-final { scan-assembler-times {\mldat\M} 11 } } */
251 /* { dg-final { scan-assembler-times {\mlwat\M} 11 } } */
252 /* { dg-final { scan-assembler-times {\mstdat\M} 9 } } */
253 /* { dg-final { scan-assembler-times {\mstwat\M} 9 } } */
254