comparison test/asm-powerpc.c @ 880:5313ed059cee

no tabs in source
author Shinji KONO <kono@ie.u-ryukyu.ac.jp>
date Thu, 03 Apr 2014 10:43:01 +0900
parents f1d71563a46a
children
comparison
equal deleted inserted replaced
879:528595192871 880:5313ed059cee
99 __asm__("rlwimi %0,%2,8,8,15" : "=&r" (result) : "0" (result), "r" (value)); 99 __asm__("rlwimi %0,%2,8,8,15" : "=&r" (result) : "0" (result), "r" (value));
100 __asm__("rlwimi %0,%2,24,0,7" : "=&r" (result) : "0" (result), "r" (value)); 100 __asm__("rlwimi %0,%2,24,0,7" : "=&r" (result) : "0" (result), "r" (value));
101 101
102 102
103 __asm__ __volatile__( 103 __asm__ __volatile__(
104 "1: lwarx %0,0,%3 \n add %0,%2,%0\n" 104 "1: lwarx %0,0,%3 \n add %0,%2,%0\n"
105 105
106 106
107 " stwcx. %0,0,%3 \n bne- 1b" 107 " stwcx. %0,0,%3 \n bne- 1b"
108 108
109 : "=&r" (t), "=m" (v->counter) 109 : "=&r" (t), "=m" (v->counter)
110 : "r" (a), "r" (&v->counter), "m" (v->counter) 110 : "r" (a), "r" (&v->counter), "m" (v->counter)
111 : "cc"); 111 : "cc");
112 112
113 113
114 __asm__ __volatile__( 114 __asm__ __volatile__(
115 "1: lwarx %0,0,%2 \n add %0,%1,%0\n" 115 "1: lwarx %0,0,%2 \n add %0,%1,%0\n"
116 116
117 117
118 " stwcx. %0,0,%2 \n bne- 1b" 118 " stwcx. %0,0,%2 \n bne- 1b"
119 119
120 120
121 : "=&r" (t) 121 : "=&r" (t)
122 : "r" (a), "r" (&v->counter) 122 : "r" (a), "r" (&v->counter)
123 : "cc", "memory"); 123 : "cc", "memory");
124 124
125 125
126 126
127 127
128 __asm__ __volatile__( 128 __asm__ __volatile__(
129 "1: lwarx %0,0,%3 \n subf %0,%2,%0\n" 129 "1: lwarx %0,0,%3 \n subf %0,%2,%0\n"
130 130
131 131
132 " stwcx. %0,0,%3 \n bne- 1b" 132 " stwcx. %0,0,%3 \n bne- 1b"
133 133
134 : "=&r" (t), "=m" (v->counter) 134 : "=&r" (t), "=m" (v->counter)
135 : "r" (a), "r" (&v->counter), "m" (v->counter) 135 : "r" (a), "r" (&v->counter), "m" (v->counter)
136 : "cc"); 136 : "cc");
137 137
138 138
139 __asm__ __volatile__( 139 __asm__ __volatile__(
140 "1: lwarx %0,0,%2 \n subf %0,%1,%0\n" 140 "1: lwarx %0,0,%2 \n subf %0,%1,%0\n"
141 141
142 142
143 " stwcx. %0,0,%2 \n bne- 1b" 143 " stwcx. %0,0,%2 \n bne- 1b"
144 144
145 145
146 : "=&r" (t) 146 : "=&r" (t)
147 : "r" (a), "r" (&v->counter) 147 : "r" (a), "r" (&v->counter)
148 : "cc", "memory"); 148 : "cc", "memory");
149 149
150 150
151 151
152 __asm__ __volatile__( 152 __asm__ __volatile__(
153 "1: lwarx %0,0,%2 \n addic %0,%0,1\n" 153 "1: lwarx %0,0,%2 \n addic %0,%0,1\n"
154 154
155 155
156 " stwcx. %0,0,%2 \n bne- 1b" 156 " stwcx. %0,0,%2 \n bne- 1b"
157 157
158 : "=&r" (t), "=m" (v->counter) 158 : "=&r" (t), "=m" (v->counter)
159 : "r" (&v->counter), "m" (v->counter) 159 : "r" (&v->counter), "m" (v->counter)
160 : "cc"); 160 : "cc");
161 161
162 162
163 __asm__ __volatile__( 163 __asm__ __volatile__(
164 "1: lwarx %0,0,%1 \n addic %0,%0,1\n" 164 "1: lwarx %0,0,%1 \n addic %0,%0,1\n"
165 165
166 166
167 " stwcx. %0,0,%1 \n bne- 1b" 167 " stwcx. %0,0,%1 \n bne- 1b"
168 168
169 169
170 : "=&r" (t) 170 : "=&r" (t)
171 : "r" (&v->counter) 171 : "r" (&v->counter)
172 : "cc", "memory"); 172 : "cc", "memory");
173 173
174 174
175 175
176 __asm__ __volatile__( 176 __asm__ __volatile__(
177 "1: lwarx %0,0,%2 \n addic %0,%0,-1\n" 177 "1: lwarx %0,0,%2 \n addic %0,%0,-1\n"
178 178
179 " stwcx. %0,0,%2\n bne- 1b" 179 " stwcx. %0,0,%2\n bne- 1b"
180 180
181 181
182 : "=&r" (t), "=m" (v->counter) 182 : "=&r" (t), "=m" (v->counter)
183 : "r" (&v->counter), "m" (v->counter) 183 : "r" (&v->counter), "m" (v->counter)
184 : "cc"); 184 : "cc");
185 185
186 186
187 __asm__ __volatile__( 187 __asm__ __volatile__(
188 "1: lwarx %0,0,%1 \n addic %0,%0,-1\n" 188 "1: lwarx %0,0,%1 \n addic %0,%0,-1\n"
189 189
190 190
191 " stwcx. %0,0,%1\n bne- 1b" 191 " stwcx. %0,0,%1\n bne- 1b"
192 192
193 193
194 : "=&r" (t) 194 : "=&r" (t)
195 : "r" (&v->counter) 195 : "r" (&v->counter)
196 : "cc", "memory"); 196 : "cc", "memory");
197 197
198 198
199 __asm__ __volatile__( 199 __asm__ __volatile__(
200 "1: lwarx %0,0,%1 \n addic. %0,%0,-1\n blt- 2f\n" 200 "1: lwarx %0,0,%1 \n addic. %0,%0,-1\n blt- 2f\n"
201 201
202 202
203 203
204 " stwcx. %0,0,%1\n bne- 1b" 204 " stwcx. %0,0,%1\n bne- 1b"
205 205
206 206
207 "\n2:" : "=&r" (t) 207 "\n2:" : "=&r" (t)
208 208
209 : "r" (&v->counter) 209 : "r" (&v->counter)
210 : "cc", "memory"); 210 : "cc", "memory");
211 211
212 212
213 __asm__ __volatile__("\n1: lwarx %0,0,%3 \n or %0,%0,%2 \n" 213 __asm__ __volatile__("\n1: lwarx %0,0,%3 \n or %0,%0,%2 \n"
214 214
215 215
216 216
217 " stwcx. %0,0,%3 \n bne- 1b" 217 " stwcx. %0,0,%3 \n bne- 1b"
218 218
219 : "=&r" (old), "=m" (*p) 219 : "=&r" (old), "=m" (*p)
220 : "r" (mask), "r" (p), "m" (*p) 220 : "r" (mask), "r" (p), "m" (*p)
221 : "cc" ); 221 : "cc" );
222 222
223 223
224 __asm__ __volatile__("\n1: lwarx %0,0,%3 \n andc %0,%0,%2 \n" 224 __asm__ __volatile__("\n1: lwarx %0,0,%3 \n andc %0,%0,%2 \n"
225 225
226 226
227 227
228 " stwcx. %0,0,%3 \n bne- 1b" 228 " stwcx. %0,0,%3 \n bne- 1b"
229 229
230 : "=&r" (old), "=m" (*p) 230 : "=&r" (old), "=m" (*p)
231 : "r" (mask), "r" (p), "m" (*p) 231 : "r" (mask), "r" (p), "m" (*p)
232 : "cc"); 232 : "cc");
233 233
234 234
235 235
236 __asm__ __volatile__("\n1: lwarx %0,0,%3 \n xor %0,%0,%2 \n" 236 __asm__ __volatile__("\n1: lwarx %0,0,%3 \n xor %0,%0,%2 \n"
237 237
238 238
239 239
240 " stwcx. %0,0,%3 \n bne- 1b" 240 " stwcx. %0,0,%3 \n bne- 1b"
241 241
242 : "=&r" (old), "=m" (*p) 242 : "=&r" (old), "=m" (*p)
243 : "r" (mask), "r" (p), "m" (*p) 243 : "r" (mask), "r" (p), "m" (*p)
244 : "cc"); 244 : "cc");
245 245
246 246
247 247
248 248
249 __asm__ __volatile__( "\n1: lwarx %0,0,%4 \n or %1,%0,%3 \n" 249 __asm__ __volatile__( "\n1: lwarx %0,0,%4 \n or %1,%0,%3 \n"
250 250
251 251
252 252
253 " stwcx. %1,0,%4 \n bne 1b" 253 " stwcx. %1,0,%4 \n bne 1b"
254 254
255 255
256 : "=&r" (old), "=&r" (t), "=m" (*p) 256 : "=&r" (old), "=&r" (t), "=m" (*p)
257 : "r" (mask), "r" (p), "m" (*p) 257 : "r" (mask), "r" (p), "m" (*p)
258 : "cc", "memory"); 258 : "cc", "memory");
259 259
260 260
261 261
262 262
263 __asm__ __volatile__( "\n1: lwarx %0,0,%4 \n andc %1,%0,%3 \n" 263 __asm__ __volatile__( "\n1: lwarx %0,0,%4 \n andc %1,%0,%3 \n"
264 264
265 265
266 266
267 " stwcx. %1,0,%4 \n bne 1b" 267 " stwcx. %1,0,%4 \n bne 1b"
268 268
269 269
270 : "=&r" (old), "=&r" (t), "=m" (*p) 270 : "=&r" (old), "=&r" (t), "=m" (*p)
271 : "r" (mask), "r" (p), "m" (*p) 271 : "r" (mask), "r" (p), "m" (*p)
272 : "cc", "memory"); 272 : "cc", "memory");
273 273
274 274
275 __asm__ __volatile__( "\n1: lwarx %0,0,%4 \n xor %1,%0,%3 \n" 275 __asm__ __volatile__( "\n1: lwarx %0,0,%4 \n xor %1,%0,%3 \n"
276 276
277 277
278 278
279 " stwcx. %1,0,%4 \n bne 1b" 279 " stwcx. %1,0,%4 \n bne 1b"
280 280
281 281
282 : "=&r" (old), "=&r" (t), "=m" (*p) 282 : "=&r" (old), "=&r" (t), "=m" (*p)
283 : "r" (mask), "r" (p), "m" (*p) 283 : "r" (mask), "r" (p), "m" (*p)
284 : "cc", "memory"); 284 : "cc", "memory");
307 307
308 msr = ({ asm volatile("mfmsr %0" : "=r" (rval)); rval;}); 308 msr = ({ asm volatile("mfmsr %0" : "=r" (rval)); rval;});
309 asm volatile("mtmsr %0" : : "r" (msr & ~(1<<15))); 309 asm volatile("mtmsr %0" : : "r" (msr & ~(1<<15)));
310 __asm__ __volatile__("": : :"memory"); 310 __asm__ __volatile__("": : :"memory");
311 311
312 __asm__ __volatile__ ("\n1: lwarx %0,0,%2 \n" 312 __asm__ __volatile__ ("\n1: lwarx %0,0,%2 \n"
313 313
314 314
315 " stwcx. %3,0,%2 \n bne- 1b" 315 " stwcx. %3,0,%2 \n bne- 1b"
316 316
317 : "=&r" (prev), "=m" (*(volatile unsigned long *)p) 317 : "=&r" (prev), "=m" (*(volatile unsigned long *)p)
318 : "r" (p), "r" (val), "m" (*(volatile unsigned long *)p) 318 : "r" (p), "r" (val), "m" (*(volatile unsigned long *)p)
319 : "cc", "memory"); 319 : "cc", "memory");
320 320
321 __asm__ __volatile__ ("\n1: lwarx %0,0,%2 \n cmpw 0,%0,%3 \n bne 2f \n" 321 __asm__ __volatile__ ("\n1: lwarx %0,0,%2 \n cmpw 0,%0,%3 \n bne 2f \n"
322 322
323 323
324 324
325 325
326 " stwcx. %4,0,%2 \n bne- 1b\n" 326 " stwcx. %4,0,%2 \n bne- 1b\n"
327 327
328 328
329 329
330 330
331 "2:" 331 "2:"
333 : "r" (p), "r" (old1), "r" (new), "m" (*p) 333 : "r" (p), "r" (old1), "r" (new), "m" (*p)
334 : "cc", "memory"); 334 : "cc", "memory");
335 335
336 336
337 __asm__ __volatile__( 337 __asm__ __volatile__(
338 "2: mftb %0\n" 338 "2: mftb %0\n"
339 "3:\n" 339 "3:\n"
340 ".section __ftr_fixup,\"a\"\n" 340 ".section __ftr_fixup,\"a\"\n"
341 " .long %1\n" 341 " .long %1\n"
342 " .long 0\n" 342 " .long 0\n"
343 " .long 2b\n" 343 " .long 2b\n"
344 " .long 3b\n" 344 " .long 3b\n"
345 ".text" 345 ".text"
346 : "=r" (ret) : "i" (0x00000100)); 346 : "=r" (ret) : "i" (0x00000100));
347 __asm__ __volatile__("": : :"memory"); 347 __asm__ __volatile__("": : :"memory");
348 asm ("cntlzw %0,%1" : "=r" (lz) : "r" (size)); 348 asm ("cntlzw %0,%1" : "=r" (lz) : "r" (size));
349 349
350 350
351 351
352 do { asm volatile("mtmsr %0" : : "r" (flags)); do { } while (0); } while (0); 352 do { asm volatile("mtmsr %0" : : "r" (flags)); do { } while (0); } while (0);
353 353
354 do { __asm__ __volatile__( 354 do { __asm__ __volatile__(
355 "1: twnei %0,0\n" 355 "1: twnei %0,0\n"
356 ".section __bug_table,\"a\"\n\t" 356 ".section __bug_table,\"a\"\n\t"
357 " .long 1b,%1,%2,%3\n" ".text" : : 357 " .long 1b,%1,%2,%3\n" ".text" : :
358 "r" (!((dentry->d_count) 358 "r" (!((dentry->d_count)
359 ->counter)), 359 ->counter)),
360 "i" (273), 360 "i" (273),
361 "i" ("../../include/linux/dcache.h"), 361 "i" ("../../include/linux/dcache.h"),
362 "i" ((__func__))); } while (0); 362 "i" ((__func__))); } while (0);
363 __asm__ __volatile__("1: lwarx %0,0,%3\n andc %1,%0,%4\n or %1,%1,%5\n" 363 __asm__ __volatile__("1: lwarx %0,0,%3\n andc %1,%0,%4\n or %1,%1,%5\n"
364 364
365 365
366 366
367 367
368 " stwcx. %1,0,%3\n bne- 1b" 368 " stwcx. %1,0,%3\n bne- 1b"
369 369
370 : "=&r" (old1), "=&r" (tmp), "=m" (*p) 370 : "=&r" (old1), "=&r" (tmp), "=m" (*p)
371 : "r" ((unsigned long)(p+1) - 4), "r" (clr), "r" (set), "m" (*p) 371 : "r" ((unsigned long)(p+1) - 4), "r" (clr), "r" (set), "m" (*p)
372 : "cc" ); 372 : "cc" );
373 373
374 if (({ do { __asm__ __volatile__( "1: twnei %0,0\n" ".section __bug_table,\"a\"\n\t" " .long 1b,%1,%2,%3\n" ".text" : : "r" (((&(page)->count)->counter) == 0), "i" (284), "i" ("../../include/linux/mm.h"), "i" ((__func__))); } while (0); (atomic_dec_return((&(page)->count)) == 0); })) 374 if (({ do { __asm__ __volatile__( "1: twnei %0,0\n" ".section __bug_table,\"a\"\n\t" " .long 1b,%1,%2,%3\n" ".text" : : "r" (((&(page)->count)->counter) == 0), "i" (284), "i" ("../../include/linux/mm.h"), "i" ((__func__))); } while (0); (atomic_dec_return((&(page)->count)) == 0); }))
375 return 0; 375 return 0;
376 376
377 do { __asm__ __volatile__( "1: twnei %0,0\n" ".section __bug_table,\"a\"\n\t" " .long 1b,%1,%2,%3\n" ".text" : : "r" (offset + size > (1UL << 12)), "i" (59), "i" ("../../include/linux/highmem.h"), "i" ((__func__))); } while (0); 377 do { __asm__ __volatile__( "1: twnei %0,0\n" ".section __bug_table,\"a\"\n\t" " .long 1b,%1,%2,%3\n" ".text" : : "r" (offset + size > (1UL << 12)), "i" (59), "i" ("../../include/linux/highmem.h"), "i" ((__func__))); } while (0);
378 378
379 asm volatile("mtmsr %0" : : "r" (flags)); 379 asm volatile("mtmsr %0" : : "r" (flags));
380 380
381 asm volatile("mtmsr %0" : : "r" (flags)); 381 asm volatile("mtmsr %0" : : "r" (flags));
382 382
383 if (((({ asm volatile("mfmsr %0" : "=r" (rval)); rval;}) & (1<<15)) == 0)) 383 if (((({ asm volatile("mfmsr %0" : "=r" (rval)); rval;}) & (1<<15)) == 0))
384 return 0; 384 return 0;
385 385
386 __asm__ __volatile__("": : :"memory"); 386 __asm__ __volatile__("": : :"memory");
387 387
388 388
389 do { __asm__ __volatile__( "1: twnei %0,0\n" ".section __bug_table,\"a\"\n\t" " .long 1b,%1,%2,%3\n" ".text" : : "r" ((v->counter) == 1), "i" (333 + 0x1000000), "i" ("../../include/net/sock.h"), "i" ((__func__))); } while (0); 389 do { __asm__ __volatile__( "1: twnei %0,0\n" ".section __bug_table,\"a\"\n\t" " .long 1b,%1,%2,%3\n" ".text" : : "r" ((v->counter) == 1), "i" (333 + 0x1000000), "i" ("../../include/net/sock.h"), "i" ((__func__))); } while (0);
390 390
391 do { __asm__ __volatile__( "1: twnei %0,0\n" ".section __bug_table,\"a\"\n\t" " .long 1b,%1,%2,%3\n" ".text" : : "r" (sk_owner != ((void *)0)), "i" (476), "i" ("../../include/net/sock.h"), "i" ((__func__))); } while (0); 391 do { __asm__ __volatile__( "1: twnei %0,0\n" ".section __bug_table,\"a\"\n\t" " .long 1b,%1,%2,%3\n" ".text" : : "r" (sk_owner != ((void *)0)), "i" (476), "i" ("../../include/net/sock.h"), "i" ((__func__))); } while (0);
392 392
393 do { __asm__ __volatile__( "1: twnei %0,0\n" ".section __bug_table,\"a\"\n\t" " .long 1b,%1,%2,%3\n" ".text" : : "r" (sizeof(struct page) > (24 * sizeof(long))), "i" (523), "i" ("../../include/net/sock.h"), "i" ((__func__))); } while (0); 393 do { __asm__ __volatile__( "1: twnei %0,0\n" ".section __bug_table,\"a\"\n\t" " .long 1b,%1,%2,%3\n" ".text" : : "r" (sizeof(struct page) > (24 * sizeof(long))), "i" (523), "i" ("../../include/net/sock.h"), "i" ((__func__))); } while (0);
394 394
395 395
396 396
397 __asm__("rlwinm %0,%1,16,0,31" : "=r" (tmp) : "r" (sum)); 397 __asm__("rlwinm %0,%1,16,0,31" : "=r" (tmp) : "r" (sum));
398 398
399 __asm__("\n addc %0,%0,%1 \n adde %0,%0,%2 \n adde %0,%0,%3 \n addze %0,%0 \n " 399 __asm__("\n addc %0,%0,%1 \n adde %0,%0,%2 \n adde %0,%0,%3 \n addze %0,%0 \n "
400 400
401 401
402 402
403 403
404 404
405 : "=r" (sum) 405 : "=r" (sum)
406 : "r" (daddr), "r"(saddr), "r"((proto<<16)+len), "0"(sum)); 406 : "r" (daddr), "r"(saddr), "r"((proto<<16)+len), "0"(sum));
407 407
408 408
409 do { __asm__ __volatile__( "1: twnei %0,0\n" ".section __bug_table,\"a\"\n\t" " .long 1b,%1,%2,%3\n" ".text" : : "r" ((tmp) != 0x00000001), "i" (231), "i" ("../../include/linux/crypto.h"), "i" ((__func__))); } while (0); 409 do { __asm__ __volatile__( "1: twnei %0,0\n" ".section __bug_table,\"a\"\n\t" " .long 1b,%1,%2,%3\n" ".text" : : "r" ((tmp) != 0x00000001), "i" (231), "i" ("../../include/linux/crypto.h"), "i" ((__func__))); } while (0);
410 410
411 411
412 } 412 }