1 #include <stdio.h> 2 #include "opcodes.h" 3 4 #define DO_RXSBG(insn, _r1, _r2, i3, i4, i5) \ 5 ({ \ 6 register unsigned long r1 asm ("1") = _r1; \ 7 register unsigned long r2 asm ("2") = _r2; \ 8 int cc; \ 9 asm volatile( insn(1,2, i3, i4, i5) \ 10 "ipm %1\n" \ 11 "srl %1,28\n" \ 12 : "+d" (r1), "=d" (cc) \ 13 : "d" (r1), "d" (r2) \ 14 : "cc"); \ 15 printf(#insn " r1(==%16.16lX),r2(==%16.16lX),0x" #i3 ",0x" #i4 ",0x" #i5 " = %16.16lX (cc=%d)\n", _r1, _r2, r1, cc); \ 16 }) 17 18 #define r1sweep(i, r2, i3, i4, i5) \ 19 ({ \ 20 DO_RXSBG(i, 000000000000000000ul, r2, i3, i4, i5); \ 21 DO_RXSBG(i, 0x0000ffffccccaaaaul, r2, i3, i4, i5); \ 22 DO_RXSBG(i, 0xfffffffffffffffful, r2, i3, i4, i5); \ 23 }) 24 25 #define r2sweep(i, i3, i4, i5) \ 26 ({ \ 27 r1sweep(i, 0x0000000000000000ul, i3, i4, i5); \ 28 r1sweep(i, 0x5555ccccffff0000ul, i3, i4, i5); \ 29 r1sweep(i, 0xfffffffffffffffful, i3, i4, i5); \ 30 }) 31 32 33 /* min/max z=0/1 and some random number in the middle */ 34 #define i3sweep(i, i4, i5) \ 35 ({ \ 36 r2sweep(i, 00, i4, i5); \ 37 r2sweep(i, 14, i4, i5); \ 38 r2sweep(i, 3f, i4, i5); \ 39 r2sweep(i, 80, i4, i5); \ 40 r2sweep(i, a1, i4, i5); \ 41 r2sweep(i, bf, i4, i5); \ 42 }) 43 44 /* min/max t=0/1 and some random number in the middle */ 45 #define i4sweep(i, i5) \ 46 ({ \ 47 i3sweep(i, 00, i5); \ 48 i3sweep(i, 2a, i5); \ 49 i3sweep(i, 3f, i5); \ 50 i3sweep(i, 80, i5); \ 51 i3sweep(i, 9e, i5); \ 52 i3sweep(i, bf, i5); \ 53 }) 54 55 /* min/max and other shifts */ 56 #define i5sweep(i) \ 57 ({ \ 58 i4sweep(i, 00); \ 59 i4sweep(i, 01); \ 60 i4sweep(i, 13); \ 61 i4sweep(i, 3e); \ 62 i4sweep(i, 3f); \ 63 }) 64 65 66 67 68 69 70 int main() 71 { 72 i5sweep(RISBG); 73 i5sweep(RNSBG); 74 i5sweep(ROSBG); 75 i5sweep(RXSBG); 76 77 return 0; 78 } 79