4 typedef unsigned long long int ULong
;
6 /* ------------------------ SRADI ------------------------ */
8 #define INSN_SRADI(nnn) \
9 void do_sradi_##nnn ( ULong arg, /*OUT*/ULong* res, /*OUT*/ULong* xer ) \
14 __asm__ __volatile__( \
15 "sradi %0,%2, " #nnn "\n\t" \
17 : /*out*/ "=b"(resW), "=b"(xerW) \
90 static void* all_sradi
[64]
158 /* ------------------------ SRAWI ------------------------ */
160 #define INSN_SRAWI(nnn) \
161 void do_srawi_##nnn ( ULong arg, /*OUT*/ULong* res, /*OUT*/ULong* xer ) \
166 __asm__ __volatile__( \
167 "srawi %0,%2, " #nnn "\n\t" \
169 : /*out*/ "=b"(resW), "=b"(xerW) \
210 static void* all_srawi
[32]
246 /* ------------------------ SRAD ------------------------ */
248 void do_srad ( ULong arg1
, ULong arg2
,
249 /*OUT*/ULong
* res
, /*OUT*/ULong
* xer
)
255 __asm__
__volatile__(
258 : /*out*/ "=b"(resW
), "=b"(xerW
)
259 : /*in*/ "b"(arg1W
), "b"(arg2W
)
267 /* ------------------------ SRAW ------------------------ */
269 void do_sraw ( ULong arg1
, ULong arg2
,
270 /*OUT*/ULong
* res
, /*OUT*/ULong
* xer
)
276 __asm__
__volatile__(
279 : /*out*/ "=b"(resW
), "=b"(xerW
)
280 : /*in*/ "b"(arg1W
), "b"(arg2W
)
287 /* ------------------------ SRD ------------------------ */
289 void do_srd ( ULong arg1
, ULong arg2
,
290 /*OUT*/ULong
* res
, /*OUT*/ULong
* xer
)
296 __asm__
__volatile__(
299 : /*out*/ "=b"(resW
), "=b"(xerW
)
300 : /*in*/ "b"(arg1W
), "b"(arg2W
)
308 /* ------------------------ SRW ------------------------ */
310 void do_srw ( ULong arg1
, ULong arg2
,
311 /*OUT*/ULong
* res
, /*OUT*/ULong
* xer
)
317 __asm__
__volatile__(
320 : /*out*/ "=b"(resW
), "=b"(xerW
)
321 : /*in*/ "b"(arg1W
), "b"(arg2W
)
329 /* ------------------------ SLD ------------------------ */
331 void do_sld ( ULong arg1
, ULong arg2
,
332 /*OUT*/ULong
* res
, /*OUT*/ULong
* xer
)
338 __asm__
__volatile__(
341 : /*out*/ "=b"(resW
), "=b"(xerW
)
342 : /*in*/ "b"(arg1W
), "b"(arg2W
)
350 /* ------------------------ SLW ------------------------ */
352 void do_slw ( ULong arg1
, ULong arg2
,
353 /*OUT*/ULong
* res
, /*OUT*/ULong
* xer
)
359 __asm__
__volatile__(
362 : /*out*/ "=b"(resW
), "=b"(xerW
)
363 : /*in*/ "b"(arg1W
), "b"(arg2W
)
371 /* ------------------------ ------------------------ */
372 /* ------------------------ ------------------------ */
373 /* ------------------------ ------------------------ */
377 ULong args64
[N_ARGS64
] = {
378 0x0000000000000000ULL
,
380 0x0000000000000001ULL
,
381 0x0000000031415927ULL
,
382 0x000000007FFFFFFFULL
,
383 0x0000000080000000ULL
,
384 0x00000000FFFFFFFFULL
,
386 0x0000000100000000ULL
,
387 0x3141592700000000ULL
,
388 0x7FFFFFFF00000000ULL
,
389 0x8000000000000000ULL
,
390 0xFFFFFFFF00000000ULL
,
392 0x7FFFFFFF00000001ULL
,
393 0x7FFFFFFF31415927ULL
,
394 0x7FFFFFFF7FFFFFFFULL
,
395 0x7FFFFFFF80000000ULL
,
396 0x7FFFFFFFFFFFFFFFULL
,
398 0x000000017FFFFFFFULL
,
399 0x314159277FFFFFFFULL
,
400 0x7FFFFFFF7FFFFFFFULL
,
401 0x800000007FFFFFFFULL
,
402 0xFFFFFFFF7FFFFFFFULL
,
404 0x8000000000000001ULL
,
405 0x8000000031415927ULL
,
406 0x800000007FFFFFFFULL
,
407 0x8000000080000000ULL
,
408 0x80000000FFFFFFFFULL
,
410 0x0000000180000000ULL
,
411 0x3141592780000000ULL
,
412 0x7FFFFFFF80000000ULL
,
413 0x8000000080000000ULL
,
414 0xFFFFFFFF80000000ULL
,
416 0xFFFFFFFF00000001ULL
,
417 0xFFFFFFFF31415927ULL
,
418 0xFFFFFFFF7FFFFFFFULL
,
419 0xFFFFFFFF80000000ULL
,
420 0xFFFFFFFFFFFFFFFFULL
,
422 0x00000001FFFFFFFFULL
,
423 0x31415927FFFFFFFFULL
,
424 0x7FFFFFFFFFFFFFFFULL
,
425 0x80000000FFFFFFFFULL
,
426 0xFFFFFFFFFFFFFFFFULL
429 void do_unary ( char* name
, void** fns
, int n_fns
)
433 void(*fn
)(ULong
,ULong
*,ULong
*);
434 for (i
= 0; i
< n_fns
; i
++) { /* shift */
435 for (j
= 0; j
< N_ARGS64
; j
++) { /* arg */
439 fn( arg
, &res
, &xer
);
440 printf("%5s(0x%016llx, %2d) = 0x%016llx, %d\n",
441 name
, arg
, (int)i
, res
, (int)((xer
>> 29 & 1)));
446 void do_binary ( char* name
, void* fnV
)
449 ULong arg1
, arg2
, res
, xer
;
450 void(*fn
)(ULong
,ULong
,ULong
*,ULong
*);
451 for (i
= 0; i
< 64+10; i
++) { /* shift */
452 for (j
= 0; j
< N_ARGS64
; j
++) { /* arg */
457 fn( arg1
, arg2
, &res
, &xer
);
458 printf("%5s(0x%016llx, %2d) = 0x%016llx, %d\n",
459 name
, arg1
, (int)arg2
, res
, (int)((xer
>> 29 & 1)));
466 do_unary("sradi", all_sradi
, 64);
467 do_unary("srawi", all_srawi
, 32);
468 do_binary("srad", do_srad
);
469 do_binary("sraw", do_sraw
);
470 do_binary("srd", do_srd
);
471 do_binary("srw", do_srw
);
472 do_binary("sld", do_sld
);
473 do_binary("slw", do_slw
);