Home | History | Annotate | Download | only in mips32
      1 #include <stdio.h>
      2 
      3 #define TESTINST1(RSval, RD) \
      4 { \
      5    unsigned int out = 0; \
      6    __asm__ volatile( \
      7       "move $" #RD ", %1\n\t" \
      8       "b end"#RSval"\n\t" \
      9       "nop\n\t" \
     10       "addi $" #RD ", $" #RD", 5\n\t" \
     11       "end"#RSval":\n\t" \
     12       "addi $" #RD ", $" #RD", 1\n\t" \
     13       "move %0, $" #RD "\n\t" \
     14       : "=&r" (out) \
     15       : "r" (RSval) \
     16       : #RD, "cc", "memory" \
     17         ); \
     18         printf("B :: %d, RSval: %d\n", \
     19         out, RSval); \
     20 }
     21 
     22 #define TESTINST2(RSval, RD) \
     23 { \
     24    unsigned int out = 0; \
     25    __asm__ volatile( \
     26       "move $" #RD ", %1\n\t" \
     27       "b end12"#RSval"\n\t" \
     28       "addi $" #RD ", $" #RD", 3\n\t" \
     29       "addi $" #RD ", $" #RD", 5\n\t" \
     30       "end12"#RSval":\n\t" \
     31       "addi $" #RD ", $" #RD", 3\n\t" \
     32       "move %0, $" #RD "\n\t" \
     33       : "=&r" (out) \
     34       : "r" (RSval) \
     35       : #RD, "cc", "memory" \
     36         ); \
     37         printf("B :: %d, RSval: %d\n", \
     38         out, RSval); \
     39 }
     40 
     41 #define TESTINST3(RSval, RD) \
     42 { \
     43    unsigned int out = 0; \
     44    __asm__ volatile( \
     45       "move $" #RD ", %1\n\t" \
     46       "bal end21"#RSval"\n\t" \
     47       "nop\n\t" \
     48       "addi $" #RD ", $" #RD", 5\n\t" \
     49       "b r_end"#RSval"\n\t" \
     50       "nop\n\t" \
     51       "end21"#RSval":\n\t" \
     52       "addi $" #RD ", $" #RD", 1\n\t" \
     53       "jr $ra\n\t"  \
     54       "r_end"#RSval":\n\t" \
     55       "move %0, $" #RD "\n\t" \
     56       : "=&r" (out) \
     57       : "r" (RSval) \
     58       : #RD, "cc", "memory" \
     59         ); \
     60         printf("B BAL JR :: %d, RSval: %d\n", \
     61         out, RSval); \
     62 }
     63 
     64 #define TESTINST3j(RSval, RD) \
     65 { \
     66    unsigned int out = 0; \
     67    __asm__ volatile( \
     68       "move $" #RD ", %1\n\t" \
     69       "la $t0, end31"#RSval"\n\t" \
     70       "jal $t0\n\t" \
     71       "nop\n\t" \
     72       "addi $" #RD ", $" #RD", 5\n\t" \
     73       "la $t0, r_end11"#RSval"\n\t" \
     74       "j $t0\n\t" \
     75       "nop\n\t" \
     76       "end31"#RSval":\n\t" \
     77       "addi $" #RD ", $" #RD", 1\n\t" \
     78       "jr $ra\n\t"  \
     79       "r_end11"#RSval":\n\t" \
     80       "move %0, $" #RD "\n\t" \
     81       : "=&r" (out) \
     82       : "r" (RSval) \
     83       : #RD, "t0", "cc", "memory" \
     84         ); \
     85         printf("J JAL JR :: %d, RSval: %d\n", \
     86         out, RSval); \
     87 }
     88 
     89 #define TESTINST3ja(RSval, RD) \
     90 { \
     91    unsigned int out = 0; \
     92    __asm__ volatile( \
     93       "move $" #RD ", %1\n\t" \
     94       "la $t0, end41"#RSval"\n\t" \
     95       "jalr $t1, $t0\n\t" \
     96       "nop\n\t" \
     97       "addi $" #RD ", $" #RD", 5\n\t" \
     98       "la $t0, r_end21"#RSval"\n\t" \
     99       "j $t0\n\t" \
    100       "nop\n\t" \
    101       "end41"#RSval":\n\t" \
    102       "addi $" #RD ", $" #RD", 1\n\t" \
    103       "jr $t1\n\t"  \
    104       "r_end21"#RSval":\n\t" \
    105       "move %0, $" #RD "\n\t" \
    106       : "=&r" (out) \
    107       : "r" (RSval) \
    108       : #RD, "t0", "t1", "cc", "memory" \
    109         ); \
    110         printf("J JALR JR :: %d, RSval: %d\n", \
    111         out, RSval); \
    112 }
    113 
    114 #define TESTINST4(instruction, RDval, RSval, RTval, RD, RS, RT) \
    115 { \
    116    unsigned int out = 0; \
    117    __asm__ volatile( \
    118       "move $" #RS ", %1\n\t" \
    119       "move $" #RT ", %2\n\t" \
    120       "move $" #RD ", %3\n\t" \
    121       instruction" $" #RS ", $" #RT ", end"instruction#RDval"\n\t" \
    122       "nop\n\t" \
    123       "addi $" #RD ", $" #RD", 5\n\t" \
    124       "end"instruction#RDval":\n\t" \
    125       "addi $" #RD ", $" #RD", 1\n\t" \
    126       "move %0, $" #RD "\n\t" \
    127       : "=&r" (out) \
    128       : "r" (RSval), "r" (RTval), "r" (RDval) \
    129       : #RD, #RS, #RT, "cc", "memory" \
    130         ); \
    131         printf(instruction" :: %d, RSval: %d, RTval: %d\n", \
    132         out, RSval, RTval); \
    133 }
    134 
    135 #define TESTINST5(instruction, RDval, RSval, RD, RS) \
    136 { \
    137    unsigned int out = 0; \
    138    __asm__ volatile( \
    139       "move $" #RS ", %1\n\t" \
    140       "move $" #RD ", %2\n\t" \
    141       instruction" $" #RS ", end"instruction#RDval"\n\t" \
    142       "nop\n\t" \
    143       "addi $" #RD ", $" #RD", 5\n\t" \
    144       "end"instruction#RDval":\n\t" \
    145       "addi $" #RD ", $" #RD", 1\n\t" \
    146       "move %0, $" #RD "\n\t" \
    147       : "=&r" (out) \
    148       : "r" (RSval), "r" (RDval) \
    149       : #RD, #RS, "cc", "memory" \
    150         ); \
    151         printf(instruction" :: %d, RSval: %d\n", \
    152         out, RSval); \
    153 }
    154 
    155 #define TESTINST6(instruction, RDval, RSval, RD, RS) \
    156 { \
    157    unsigned int out = 0; \
    158    __asm__ volatile( \
    159       "move $" #RD ", %2\n\t" \
    160       "move $" #RS ", %1\n\t" \
    161       instruction" $" #RS ", end21"instruction#RDval"\n\t" \
    162       "nop\n\t" \
    163       "addi $" #RD ", $" #RD", 5\n\t" \
    164       "b r_end"instruction#RDval"\n\t" \
    165       "nop\n\t" \
    166       "end21"instruction#RDval":\n\t" \
    167       "addi $" #RD ", $" #RD", 1\n\t" \
    168       "jr $ra\n\t"  \
    169       "r_end"instruction#RDval":\n\t" \
    170       "move %0, $" #RD "\n\t" \
    171       : "=&r" (out) \
    172       : "r" (RSval), "r" (RDval) \
    173       : #RD, #RS, "cc", "memory" \
    174         ); \
    175         printf(instruction" :: %d, RSval: %d\n", \
    176         out, RSval); \
    177 }
    178 
    179 #define TESTINST4l(instruction, RDval, RSval, RTval, RD, RS, RT) \
    180 { \
    181    unsigned int out = 0; \
    182    __asm__ volatile( \
    183       "move $" #RS ", %1\n\t" \
    184       "move $" #RT ", %2\n\t" \
    185       "move $" #RD ", %3\n\t" \
    186       instruction" $" #RS ", $" #RT ", end"instruction#RDval"\n\t" \
    187       "addi $" #RD ", $" #RD", 3\n\t" \
    188       "addi $" #RD ", $" #RD", 5\n\t" \
    189       "end"instruction#RDval":\n\t" \
    190       "addi $" #RD ", $" #RD", 1\n\t" \
    191       "move %0, $" #RD "\n\t" \
    192       : "=&r" (out) \
    193       : "r" (RSval), "r" (RTval), "r" (RDval) \
    194       : #RD, #RS, #RT, "cc", "memory" \
    195         ); \
    196         printf(instruction" :: %d, RSval: %d, RTval: %d\n", \
    197         out, RSval, RTval); \
    198 }
    199 
    200 #define TESTINST5l(instruction, RDval, RSval, RD, RS) \
    201 { \
    202    unsigned int out = 0; \
    203    __asm__ volatile( \
    204       "move $" #RS ", %1\n\t" \
    205       "move $" #RD ", %2\n\t" \
    206       instruction" $" #RS ", end"instruction#RDval"\n\t" \
    207       "addi $" #RD ", $" #RD", 3\n\t" \
    208       "addi $" #RD ", $" #RD", 5\n\t" \
    209       "end"instruction#RDval":\n\t" \
    210       "addi $" #RD ", $" #RD", 1\n\t" \
    211       "move %0, $" #RD "\n\t" \
    212       : "=&r" (out) \
    213       : "r" (RSval), "r" (RDval) \
    214       : #RD, #RS, "cc", "memory" \
    215         ); \
    216         printf(instruction" :: %d, RSval: %d\n", \
    217         out, RSval); \
    218 }
    219 
    220 #define TESTINST6l(instruction, RDval, RSval, RD, RS) \
    221 { \
    222    unsigned int out = 0; \
    223    __asm__ volatile( \
    224       "move $" #RD ", %2\n\t" \
    225       "move $" #RS ", %1\n\t" \
    226       instruction" $" #RS ", end21"instruction#RDval"\n\t" \
    227       "addi $" #RD ", $" #RD", 3\n\t" \
    228       "addi $" #RD ", $" #RD", 5\n\t" \
    229       "b r_end"instruction#RDval"\n\t" \
    230       "nop\n\t" \
    231       "end21"instruction#RDval":\n\t" \
    232       "addi $" #RD ", $" #RD", 1\n\t" \
    233       "jr $ra\n\t"  \
    234       "r_end"instruction#RDval":\n\t" \
    235       "move %0, $" #RD "\n\t" \
    236       : "=&r" (out) \
    237       : "r" (RSval), "r" (RDval) \
    238       : #RD, #RS, "cc", "memory" \
    239         ); \
    240         printf(instruction" :: %d, RSval: %d\n", \
    241         out, RSval); \
    242 }
    243 
    244 int main()
    245 {
    246    printf("b \n");
    247    TESTINST1(0, v0);
    248    TESTINST1(1, v1);
    249    TESTINST1(2, a0);
    250    TESTINST1(3, a1);
    251    TESTINST1(4, a2);
    252    TESTINST1(5, a3);
    253    TESTINST1(6, t0);
    254    TESTINST1(7, t1);
    255    TESTINST1(8, t2);
    256    TESTINST1(9, t3);
    257    TESTINST1(10, t4);
    258    TESTINST1(11, t5);
    259    TESTINST1(12, t6);
    260    TESTINST1(13, t7);
    261    TESTINST1(14, s0);
    262    TESTINST1(15, s1);
    263    TESTINST1(16, s2);
    264    TESTINST1(17, s3);
    265    TESTINST1(18, s4);
    266    TESTINST1(19, s5);
    267    TESTINST1(20, s6);
    268    TESTINST1(21, s7);
    269    TESTINST1(22, t8);
    270    TESTINST1(23, t9);
    271 
    272    printf("b \n");
    273    TESTINST2(0, v0);
    274    TESTINST2(1, v1);
    275    TESTINST2(2, a0);
    276    TESTINST2(3, a1);
    277    TESTINST2(4, a2);
    278    TESTINST2(5, a3);
    279    TESTINST2(6, t0);
    280    TESTINST2(7, t1);
    281    TESTINST2(8, t2);
    282    TESTINST2(9, t3);
    283    TESTINST2(10, t4);
    284    TESTINST2(11, t5);
    285    TESTINST2(12, t6);
    286    TESTINST2(13, t7);
    287    TESTINST2(14, s0);
    288    TESTINST2(15, s1);
    289    TESTINST2(16, s2);
    290    TESTINST2(17, s3);
    291    TESTINST2(18, s4);
    292    TESTINST2(19, s5);
    293    TESTINST2(20, s6);
    294    TESTINST2(21, s7);
    295    TESTINST2(22, t8);
    296    TESTINST2(23, t9);
    297 
    298    printf("b, bal, jr \n");
    299    TESTINST3(0, v0);
    300    TESTINST3(1, v1);
    301    TESTINST3(2, a0);
    302    TESTINST3(3, a1);
    303    TESTINST3(4, a2);
    304    TESTINST3(5, a3);
    305    TESTINST3(6, t0);
    306    TESTINST3(7, t1);
    307    TESTINST3(8, t2);
    308    TESTINST3(9, t3);
    309    TESTINST3(10, t4);
    310    TESTINST3(11, t5);
    311    TESTINST3(12, t6);
    312    TESTINST3(13, t7);
    313    TESTINST3(14, s0);
    314    TESTINST3(15, s1);
    315    TESTINST3(16, s2);
    316    TESTINST3(17, s3);
    317    TESTINST3(18, s4);
    318    TESTINST3(19, s5);
    319    TESTINST3(20, s6);
    320    TESTINST3(21, s7);
    321    TESTINST3(22, t8);
    322    TESTINST3(23, t9);
    323 
    324    printf("beq\n");
    325    TESTINST4("beq", 0, 0, 1, v0, v1, a0);
    326    TESTINST4("beq", 1, 1, 1, v1, a0, a1);
    327    TESTINST4("beq", 2, 0xffffffff, 0xffffffff, a0, a1, a2);
    328    TESTINST4("beq", 3, 0xffffffff, 0xfffffffe, a1, a2, a3);
    329    TESTINST4("beq", 4, 0xfffffffe, 0xffffffff, a2, t0, t1);
    330    TESTINST4("beq", 5, 0xffffffff, 0xffffffff, a3, t0, t1);
    331    TESTINST4("beq", 6, 0x5, 0x5, t0, t1, t2);
    332    TESTINST4("beq", 7, -3, -4, t1, t2, t3);
    333    TESTINST4("beq", 8, 125, 125, t2, t3, t4);
    334    TESTINST4("beq", 9, 0x80000000, 0x80000000, t3, t4, t5);
    335    TESTINST4("beq", 10, 0xffffffff, 0x80000000, t4, t5, t6);
    336    TESTINST4("beq", 11, 0x256, 0x256, t5, t6, t7);
    337    TESTINST4("beq", 12, 0x55, 0x55, t6, t7, s0);
    338    TESTINST4("beq", 13, 0xfff, 0xdd, s0, s1, s2);
    339    TESTINST4("beq", 14, -1, 0x5, v0, t9, t8);
    340    TESTINST4("beq", 15, -1, -1, t9, t8, a3);
    341 
    342    printf("bne\n");
    343    TESTINST4("bne", 0, 0, 1, v0, v1, a0);
    344    TESTINST4("bne", 1, 1, 1, v1, a0, a1);
    345    TESTINST4("bne", 2, 0xffffffff, 0xffffffff, a0, a1, a2);
    346    TESTINST4("bne", 3, 0xffffffff, 0xfffffffe, a1, a2, a3);
    347    TESTINST4("bne", 4, 0xfffffffe, 0xffffffff, a2, t0, t1);
    348    TESTINST4("bne", 5, 0xffffffff, 0xffffffff, a3, t0, t1);
    349    TESTINST4("bne", 6, 0x5, 0x5, t0, t1, t2);
    350    TESTINST4("bne", 7, -3, -4, t1, t2, t3);
    351    TESTINST4("bne", 8, 125, 125, t2, t3, t4);
    352    TESTINST4("bne", 9, 0x80000000, 0x80000000, t3, t4, t5);
    353    TESTINST4("bne", 10, 0xffffffff, 0x80000000, t4, t5, t6);
    354    TESTINST4("bne", 11, 0x256, 0x256, t5, t6, t7);
    355    TESTINST4("bne", 12, 0x55, 0x55, t6, t7, s0);
    356    TESTINST4("bne", 13, 0xfff, 0xdd, s0, s1, s2);
    357    TESTINST4("bne", 14, -1, 0x5, v0, t9, t8);
    358    TESTINST4("bne", 15, -1, -1, t9, t8, a3);
    359 
    360    printf("BEQZ\n");
    361    TESTINST5("beqz", 0, 0, v0, v1);
    362    TESTINST5("beqz", 1, 1, v1, a0);
    363    TESTINST5("beqz", 2, 0xffffffff, a0, a1);
    364    TESTINST5("beqz", 3, 0xffffffff, a1, a2);
    365    TESTINST5("beqz", 4, 0xfffffffe, a2, t0);
    366    TESTINST5("beqz", 5, 0xffffffff, a3, t0);
    367    TESTINST5("beqz", 6, 0x5, t0, t1);
    368    TESTINST5("beqz", 7, -3, t1, t2);
    369    TESTINST5("beqz", 8, 125, t2, t3);
    370    TESTINST5("beqz", 9, 0x80000000, t3, t4);
    371    TESTINST5("beqz", 10, 0xffffffff, t4, t5);
    372    TESTINST5("beqz", 11, 0x256, t5, t6);
    373    TESTINST5("beqz", 12, 0x55, t6, t7);
    374    TESTINST5("beqz", 13, 0xfff, s0, s1);
    375    TESTINST5("beqz", 14, -1, v0, t9);
    376    TESTINST5("beqz", 15, -1, t9, t8);
    377 
    378    printf("BGEZ\n");
    379    TESTINST5("bgez", 0, 0, v0, v1);
    380    TESTINST5("bgez", 1, 1, v1, a0);
    381    TESTINST5("bgez", 2, 0xffffffff, a0, a1);
    382    TESTINST5("bgez", 3, 0xffffffff, a1, a2);
    383    TESTINST5("bgez", 4, 0xfffffffe, a2, t0);
    384    TESTINST5("bgez", 5, 0xffffffff, a3, t0);
    385    TESTINST5("bgez", 6, 0x5, t0, t1);
    386    TESTINST5("bgez", 7, -3, t1, t2);
    387    TESTINST5("bgez", 8, 125, t2, t3);
    388    TESTINST5("bgez", 9, 0x80000000, t3, t4);
    389    TESTINST5("bgez", 10, 0xffffffff, t4, t5);
    390    TESTINST5("bgez", 11, 0x256, t5, t6);
    391    TESTINST5("bgez", 12, 0x55, t6, t7);
    392    TESTINST5("bgez", 13, 0xfff, s0, s1);
    393    TESTINST5("bgez", 14, -1, v0, t9);
    394    TESTINST5("bgez", 15, -1, t9, t8);
    395 
    396    printf("BGTZ\n");
    397    TESTINST5("bgtz", 0, 0, v0, v1);
    398    TESTINST5("bgtz", 1, 1, v1, a0);
    399    TESTINST5("bgtz", 2, 0xffffffff, a0, a1);
    400    TESTINST5("bgtz", 3, 0xffffffff, a1, a2);
    401    TESTINST5("bgtz", 4, 0xfffffffe, a2, t0);
    402    TESTINST5("bgtz", 5, 0xffffffff, a3, t0);
    403    TESTINST5("bgtz", 6, 0x5, t0, t1);
    404    TESTINST5("bgtz", 7, -3, t1, t2);
    405    TESTINST5("bgtz", 8, 125, t2, t3);
    406    TESTINST5("bgtz", 9, 0x80000000, t3, t4);
    407    TESTINST5("bgtz", 10, 0xffffffff, t4, t5);
    408    TESTINST5("bgtz", 11, 0x256, t5, t6);
    409    TESTINST5("bgtz", 12, 0x55, t6, t7);
    410    TESTINST5("bgtz", 13, 0xfff, s0, s1);
    411    TESTINST5("bgtz", 14, -1, v0, t9);
    412    TESTINST5("bgtz", 15, -1, t9, t8);
    413 
    414    printf("BLEZ\n");
    415    TESTINST5("blez", 0, 0, v0, v1);
    416    TESTINST5("blez", 1, 1, v1, a0);
    417    TESTINST5("blez", 2, 0xffffffff, a0, a1);
    418    TESTINST5("blez", 3, 0xffffffff, a1, a2);
    419    TESTINST5("blez", 4, 0xfffffffe, a2, t0);
    420    TESTINST5("blez", 5, 0xffffffff, a3, t0);
    421    TESTINST5("blez", 6, 0x5, t0, t1);
    422    TESTINST5("blez", 7, -3, t1, t2);
    423    TESTINST5("blez", 8, 125, t2, t3);
    424    TESTINST5("blez", 9, 0x80000000, t3, t4);
    425    TESTINST5("blez", 10, 0xffffffff, t4, t5);
    426    TESTINST5("blez", 11, 0x256, t5, t6);
    427    TESTINST5("blez", 12, 0x55, t6, t7);
    428    TESTINST5("blez", 13, 0xfff, s0, s1);
    429    TESTINST5("blez", 14, -1, v0, t9);
    430    TESTINST5("blez", 15, -1, t9, t8);
    431 
    432    printf("BLTZ\n");
    433    TESTINST5("bltz", 0, 0, v0, v1);
    434    TESTINST5("bltz", 1, 1, v1, a0);
    435    TESTINST5("bltz", 2, 0xffffffff, a0, a1);
    436    TESTINST5("bltz", 3, 0xffffffff, a1, a2);
    437    TESTINST5("bltz", 4, 0xfffffffe, a2, t0);
    438    TESTINST5("bltz", 5, 0xffffffff, a3, t0);
    439    TESTINST5("bltz", 6, 0x5, t0, t1);
    440    TESTINST5("bltz", 7, -3, t1, t2);
    441    TESTINST5("bltz", 8, 125, t2, t3);
    442    TESTINST5("bltz", 9, 0x80000000, t3, t4);
    443    TESTINST5("bltz", 10, 0xffffffff, t4, t5);
    444    TESTINST5("bltz", 11, 0x256, t5, t6);
    445    TESTINST5("bltz", 12, 0x55, t6, t7);
    446    TESTINST5("bltz", 13, 0xfff, s0, s1);
    447    TESTINST5("bltz", 14, -1, v0, t9);
    448    TESTINST5("bltz", 15, -1, t9, t8);
    449 
    450    printf("BGEZAL\n");
    451    TESTINST6("bgezal", 0, 0, v0, v1);
    452    TESTINST6("bgezal", 1, 1, v1, a0);
    453    TESTINST6("bgezal", 2, 0xffffffff, a0, a1);
    454    TESTINST6("bgezal", 3, 0xffffffff, a1, a2);
    455    TESTINST6("bgezal", 4, 0xfffffffe, a2, t0);
    456    TESTINST6("bgezal", 5, 0xffffffff, a3, t0);
    457    TESTINST6("bgezal", 6, 0x5, t0, t1);
    458    TESTINST6("bgezal", 7, -3, t1, t2);
    459    TESTINST6("bgezal", 8, 125, t2, t3);
    460    TESTINST6("bgezal", 9, 0x80000000, t3, t4);
    461    TESTINST6("bgezal", 10, 0xffffffff, t4, t5);
    462    TESTINST6("bgezal", 11, 0x256, t5, t6);
    463    TESTINST6("bgezal", 12, 0x55, t6, t7);
    464    TESTINST6("bgezal", 13, 0xfff, s0, s1);
    465    TESTINST6("bgezal", 14, -1, v0, t9);
    466    TESTINST6("bgezal", 15, -1, t9, t8);
    467 
    468    printf("BLTZAL\n");
    469    TESTINST6("bltzal", 0, 0, v0, v1);
    470    TESTINST6("bltzal", 1, 1, v1, a0);
    471    TESTINST6("bltzal", 2, 0xffffffff, a0, a1);
    472    TESTINST6("bltzal", 3, 0xffffffff, a1, a2);
    473    TESTINST6("bltzal", 4, 0xfffffffe, a2, t0);
    474    TESTINST6("bltzal", 5, 0xffffffff, a3, t0);
    475    TESTINST6("bltzal", 6, 0x5, t0, t1);
    476    TESTINST6("bltzal", 7, -3, t1, t2);
    477    TESTINST6("bltzal", 8, 125, t2, t3);
    478    TESTINST6("bltzal", 9, 0x80000000, t3, t4);
    479    TESTINST6("bltzal", 10, 0xffffffff, t4, t5);
    480    TESTINST6("bltzal", 11, 0x256, t5, t6);
    481    TESTINST6("bltzal", 12, 0x55, t6, t7);
    482    TESTINST6("bltzal", 13, 0xfff, s0, s1);
    483    TESTINST6("bltzal", 14, -1, v0, t9);
    484    TESTINST6("bltzal", 15, -1, t9, t8);
    485 
    486    printf("BNEZ\n");
    487    TESTINST5("bnez", 0, 0, v0, v1);
    488    TESTINST5("bnez", 1, 1, v1, a0);
    489    TESTINST5("bnez", 2, 0xffffffff, a0, a1);
    490    TESTINST5("bnez", 3, 0xffffffff, a1, a2);
    491    TESTINST5("bnez", 4, 0xfffffffe, a2, t0);
    492    TESTINST5("bnez", 5, 0xffffffff, a3, t0);
    493    TESTINST5("bnez", 6, 0x5, t0, t1);
    494    TESTINST5("bnez", 7, -3, t1, t2);
    495    TESTINST5("bnez", 8, 125, t2, t3);
    496    TESTINST5("bnez", 9, 0x80000000, t3, t4);
    497    TESTINST5("bnez", 10, 0xffffffff, t4, t5);
    498    TESTINST5("bnez", 11, 0x256, t5, t6);
    499    TESTINST5("bnez", 12, 0x55, t6, t7);
    500    TESTINST5("bnez", 13, 0xfff, s0, s1);
    501    TESTINST5("bnez", 14, -1, v0, t9);
    502    TESTINST5("bnez", 15, -1, t9, t8);
    503 
    504    printf("beql\n");
    505    TESTINST4l("beql", 0, 0, 1, v0, v1, a0);
    506    TESTINST4l("beql", 1, 1, 1, v1, a0, a1);
    507    TESTINST4l("beql", 2, 0xffffffff, 0xffffffff, a0, a1, a2);
    508    TESTINST4l("beql", 3, 0xffffffff, 0xfffffffe, a1, a2, a3);
    509    TESTINST4l("beql", 4, 0xfffffffe, 0xffffffff, a2, t0, t1);
    510    TESTINST4l("beql", 5, 0xffffffff, 0xffffffff, a3, t0, t1);
    511    TESTINST4l("beql", 6, 0x5, 0x5, t0, t1, t2);
    512    TESTINST4l("beql", 7, -3, -4, t1, t2, t3);
    513    TESTINST4l("beql", 8, 125, 125, t2, t3, t4);
    514    TESTINST4l("beql", 9, 0x80000000, 0x80000000, t3, t4, t5);
    515    TESTINST4l("beql", 10, 0xffffffff, 0x80000000, t4, t5, t6);
    516    TESTINST4l("beql", 11, 0x256, 0x256, t5, t6, t7);
    517    TESTINST4l("beql", 12, 0x55, 0x55, t6, t7, s0);
    518    TESTINST4l("beql", 13, 0xfff, 0xdd, s0, s1, s2);
    519    TESTINST4l("beql", 14, -1, 0x5, v0, t9, t8);
    520    TESTINST4l("beql", 15, -1, -1, t9, t8, a3);
    521 
    522    printf("BGEZALL\n");
    523    TESTINST5l("bgezall", 0, 0, v0, v1);
    524    TESTINST5l("bgezall", 1, 1, v1, a0);
    525    TESTINST5l("bgezall", 2, 0xffffffff, a0, a1);
    526    TESTINST5l("bgezall", 3, 0xffffffff, a1, a2);
    527    TESTINST5l("bgezall", 4, 0xfffffffe, a2, t0);
    528    TESTINST5l("bgezall", 5, 0xffffffff, a3, t0);
    529    TESTINST5l("bgezall", 6, 0x5, t0, t1);
    530    TESTINST5l("bgezall", 7, -3, t1, t2);
    531    TESTINST5l("bgezall", 8, 125, t2, t3);
    532    TESTINST5l("bgezall", 9, 0x80000000, t3, t4);
    533    TESTINST5l("bgezall", 10, 0xffffffff, t4, t5);
    534    TESTINST5l("bgezall", 11, 0x256, t5, t6);
    535    TESTINST5l("bgezall", 12, 0x55, t6, t7);
    536    TESTINST5l("bgezall", 13, 0xfff, s0, s1);
    537    TESTINST5l("bgezall", 14, -1, v0, t9);
    538    TESTINST5l("bgezall", 15, -1, t9, t8);
    539 
    540    printf("BGEZL\n");
    541    TESTINST5l("bgezl", 0, 0, v0, v1);
    542    TESTINST5l("bgezl", 1, 1, v1, a0);
    543    TESTINST5l("bgezl", 2, 0xffffffff, a0, a1);
    544    TESTINST5l("bgezl", 3, 0xffffffff, a1, a2);
    545    TESTINST5l("bgezl", 4, 0xfffffffe, a2, t0);
    546    TESTINST5l("bgezl", 5, 0xffffffff, a3, t0);
    547    TESTINST5l("bgezl", 6, 0x5, t0, t1);
    548    TESTINST5l("bgezl", 7, -3, t1, t2);
    549    TESTINST5l("bgezl", 8, 125, t2, t3);
    550    TESTINST5l("bgezl", 9, 0x80000000, t3, t4);
    551    TESTINST5l("bgezl", 10, 0xffffffff, t4, t5);
    552    TESTINST5l("bgezl", 11, 0x256, t5, t6);
    553    TESTINST5l("bgezl", 12, 0x55, t6, t7);
    554    TESTINST5l("bgezl", 13, 0xfff, s0, s1);
    555    TESTINST5l("bgezl", 14, -1, v0, t9);
    556    TESTINST5l("bgezl", 15, -1, t9, t8);
    557 
    558    printf("BGTZL\n");
    559    TESTINST5l("bgtzl", 0, 0, v0, v1);
    560    TESTINST5l("bgtzl", 1, 1, v1, a0);
    561    TESTINST5l("bgtzl", 2, 0xffffffff, a0, a1);
    562    TESTINST5l("bgtzl", 3, 0xffffffff, a1, a2);
    563    TESTINST5l("bgtzl", 4, 0xfffffffe, a2, t0);
    564    TESTINST5l("bgtzl", 5, 0xffffffff, a3, t0);
    565    TESTINST5l("bgtzl", 6, 0x5, t0, t1);
    566    TESTINST5l("bgtzl", 7, -3, t1, t2);
    567    TESTINST5l("bgtzl", 8, 125, t2, t3);
    568    TESTINST5l("bgtzl", 9, 0x80000000, t3, t4);
    569    TESTINST5l("bgtzl", 10, 0xffffffff, t4, t5);
    570    TESTINST5l("bgtzl", 11, 0x256, t5, t6);
    571    TESTINST5l("bgtzl", 12, 0x55, t6, t7);
    572    TESTINST5l("bgtzl", 13, 0xfff, s0, s1);
    573    TESTINST5l("bgtzl", 14, -1, v0, t9);
    574    TESTINST5l("bgtzl", 15, -1, t9, t8);
    575 
    576    printf("BLEZL\n");
    577    TESTINST5l("blezl", 0, 0, v0, v1);
    578    TESTINST5l("blezl", 1, 1, v1, a0);
    579    TESTINST5l("blezl", 2, 0xffffffff, a0, a1);
    580    TESTINST5l("blezl", 3, 0xffffffff, a1, a2);
    581    TESTINST5l("blezl", 4, 0xfffffffe, a2, t0);
    582    TESTINST5l("blezl", 5, 0xffffffff, a3, t0);
    583    TESTINST5l("blezl", 6, 0x5, t0, t1);
    584    TESTINST5l("blezl", 7, -3, t1, t2);
    585    TESTINST5l("blezl", 8, 125, t2, t3);
    586    TESTINST5l("blezl", 9, 0x80000000, t3, t4);
    587    TESTINST5l("blezl", 10, 0xffffffff, t4, t5);
    588    TESTINST5l("blezl", 11, 0x256, t5, t6);
    589    TESTINST5l("blezl", 12, 0x55, t6, t7);
    590    TESTINST5l("blezl", 13, 0xfff, s0, s1);
    591    TESTINST5l("blezl", 14, -1, v0, t9);
    592    TESTINST5l("blezl", 15, -1, t9, t8);
    593 
    594    printf("BGEZALL\n");
    595    TESTINST6l("bgezall", 0, 0, v0, v1);
    596    TESTINST6l("bgezall", 1, 1, v1, a0);
    597    TESTINST6l("bgezall", 2, 0xffffffff, a0, a1);
    598    TESTINST6l("bgezall", 3, 0xffffffff, a1, a2);
    599    TESTINST6l("bgezall", 4, 0xfffffffe, a2, t0);
    600    TESTINST6l("bgezall", 5, 0xffffffff, a3, t0);
    601    TESTINST6l("bgezall", 6, 0x5, t0, t1);
    602    TESTINST6l("bgezall", 7, -3, t1, t2);
    603    TESTINST6l("bgezall", 8, 125, t2, t3);
    604    TESTINST6l("bgezall", 9, 0x80000000, t3, t4);
    605    TESTINST6l("bgezall", 10, 0xffffffff, t4, t5);
    606    TESTINST6l("bgezall", 11, 0x256, t5, t6);
    607    TESTINST6l("bgezall", 12, 0x55, t6, t7);
    608    TESTINST6l("bgezall", 13, 0xfff, s0, s1);
    609    TESTINST6l("bgezall", 14, -1, v0, t9);
    610    TESTINST6l("bgezall", 15, -1, t9, t8);
    611 
    612    printf("BLTZL\n");
    613    TESTINST5l("bltzl", 0, 0, v0, v1);
    614    TESTINST5l("bltzl", 1, 1, v1, a0);
    615    TESTINST5l("bltzl", 2, 0xffffffff, a0, a1);
    616    TESTINST5l("bltzl", 3, 0xffffffff, a1, a2);
    617    TESTINST5l("bltzl", 4, 0xfffffffe, a2, t0);
    618    TESTINST5l("bltzl", 5, 0xffffffff, a3, t0);
    619    TESTINST5l("bltzl", 6, 0x5, t0, t1);
    620    TESTINST5l("bltzl", 7, -3, t1, t2);
    621    TESTINST5l("bltzl", 8, 125, t2, t3);
    622    TESTINST5l("bltzl", 9, 0x80000000, t3, t4);
    623    TESTINST5l("bltzl", 10, 0xffffffff, t4, t5);
    624    TESTINST5l("bltzl", 11, 0x256, t5, t6);
    625    TESTINST5l("bltzl", 12, 0x55, t6, t7);
    626    TESTINST5l("bltzl", 13, 0xfff, s0, s1);
    627    TESTINST5l("bltzl", 14, -1, v0, t9);
    628    TESTINST5l("bltzl", 15, -1, t9, t8);
    629 
    630    printf("BNEL\n");
    631    TESTINST4l("bnel", 0, 0, 1, v0, v1, a0);
    632    TESTINST4l("bnel", 1, 1, 1, v1, a0, a1);
    633    TESTINST4l("bnel", 2, 0xffffffff, 0xffffffff, a0, a1, a2);
    634    TESTINST4l("bnel", 3, 0xffffffff, 0xfffffffe, a1, a2, a3);
    635    TESTINST4l("bnel", 4, 0xfffffffe, 0xffffffff, a2, t0, t1);
    636    TESTINST4l("bnel", 5, 0xffffffff, 0xffffffff, a3, t0, t1);
    637    TESTINST4l("bnel", 6, 0x5, 0x5, t0, t1, t2);
    638    TESTINST4l("bnel", 7, -3, -4, t1, t2, t3);
    639    TESTINST4l("bnel", 8, 125, 125, t2, t3, t4);
    640    TESTINST4l("bnel", 9, 0x80000000, 0x80000000, t3, t4, t5);
    641    TESTINST4l("bnel", 10, 0xffffffff, 0x80000000, t4, t5, t6);
    642    TESTINST4l("bnel", 11, 0x256, 0x256, t5, t6, t7);
    643    TESTINST4l("bnel", 12, 0x55, 0x55, t6, t7, s0);
    644    TESTINST4l("bnel", 13, 0xfff, 0xdd, s0, s1, s2);
    645    TESTINST4l("bnel", 14, -1, 0x5, v0, t9, t8);
    646    TESTINST4l("bnel", 15, -1, -1, t9, t8, a3);
    647 
    648    printf("j, jal, jr \n");
    649    TESTINST3j(0, v0);
    650    TESTINST3j(1, v1);
    651    TESTINST3j(2, a0);
    652    TESTINST3j(3, a1);
    653    TESTINST3j(4, a2);
    654    TESTINST3j(5, a3);
    655    TESTINST3j(6, a0);
    656    TESTINST3j(7, t1);
    657    TESTINST3j(8, t2);
    658    TESTINST3j(9, t3);
    659    TESTINST3j(10, t4);
    660    TESTINST3j(11, t5);
    661    TESTINST3j(12, t6);
    662    TESTINST3j(13, t7);
    663    TESTINST3j(14, s0);
    664    TESTINST3j(15, s1);
    665    TESTINST3j(16, s2);
    666    TESTINST3j(17, s3);
    667    TESTINST3j(18, s4);
    668    TESTINST3j(19, s5);
    669    TESTINST3j(20, s6);
    670    TESTINST3j(21, s7);
    671    TESTINST3j(22, t8);
    672    TESTINST3j(23, t9);
    673 
    674    printf("j, jalr, jr \n");
    675    TESTINST3ja(0, v0);
    676    TESTINST3ja(1, v1);
    677    TESTINST3ja(2, a0);
    678    TESTINST3ja(3, a1);
    679    TESTINST3ja(4, a2);
    680    TESTINST3ja(5, a3);
    681    TESTINST3ja(6, a0);
    682    TESTINST3ja(7, a3);
    683    TESTINST3ja(8, t2);
    684    TESTINST3ja(9, t3);
    685    TESTINST3ja(10, t4);
    686    TESTINST3ja(11, t5);
    687    TESTINST3ja(12, t6);
    688    TESTINST3ja(13, t7);
    689    TESTINST3ja(14, s0);
    690    TESTINST3ja(15, s1);
    691    TESTINST3ja(16, s2);
    692    TESTINST3ja(17, s3);
    693    TESTINST3ja(18, s4);
    694    TESTINST3ja(19, s5);
    695    TESTINST3ja(20, s6);
    696    TESTINST3ja(21, s7);
    697    TESTINST3ja(22, t8);
    698    TESTINST3ja(23, t9);
    699 
    700    return 0;
    701 }
    702