printf("%s :: rd 0x%lx rs 0x%x, rt 0x%x\n", \
instruction, out, RSVal, RTval); \
}
-#define TESTINST3(instruction, RSVal, RT, RS,imm) \
+#define TESTINST3(instruction, RSVal, RT, RS, imm) \
{ \
unsigned long out; \
__asm__ volatile( \
switch(op) {
case EXTS: { /* To extract and sign-extend a bit field that starts
from the lower 32 bits of a register. */
- for(i = 0; i <= 255; i+=4)
+ for (i = 0; i <= 255; i+=4)
TESTINST1("exts $t1, $t2, 1, 7", reg_val[i], t1, t2, 1, 7);
break;
}
case EXTS32: { /* To extract and sign-extend a bit field that starts
from the upper 32 bits of a register. */
- for(i = 0; i <= 255; i+=4)
+ for (i = 0; i <= 255; i+=4)
TESTINST1("exts32 $t1, $t2, 1 , 7", reg_val[i], t1, t2, 1, 7);
break;
}
case CINS:{ /* To insert a bit field that starts in the lower 32 bits
of a register. */
- for(i = 0; i <= 255; i+=4)
+ for (i = 0; i <= 255; i+=4)
TESTINST1("cins $t1, $t2, 2 , 9", reg_val[i], t1, t2, 2, 9);
break;
}
case CINS32: { /* To insert a bit field that starts in the upper
32 bits of a register. */
- for(i =0; i <= 255; i+=4)
+ for (i =0; i <= 255; i+=4)
TESTINST1("cins32 $t1, $t2, 2 , 9", reg_val[i], t1, t2, 2, 9);
break;
}
case SEQ: { /* To record the result of an equals comparison. */
- for(i = 0; i <= 255; i+=4)
- for(j = 0; j <= 255; j+=4)
+ for (i = 0; i <= 255; i+=4)
+ for (j = 0; j <= 255; j+=4)
TESTINST2("seq $t1, $t2 ,$t3 ", reg_val[i], reg_val[j],
t1, t2, t3);
break;
case SEQI: { /* To record the result of an equals comparison
with a constant. */
- for(i = 0; i <= 255; i+=4)
+ /* First, make sure at least one testcase has source value (rs)
+ that equals the immediate value to validate the true case. */
+ const int immvalue = 9;
+ TESTINST3("seqi $t1, $t2 ,9 ", immvalue, t1, t2, immvalue);
+ for (i = 0; i <= 255; i+=4)
TESTINST3("seqi $t1, $t2 ,9 ", reg_val[i], t1, t2, 9);
break;
}
case SNE: { /* To record the result of a not equals comparison. */
- for(i = 0; i <= 255; i+=4)
- for(j = 0; j<= 255; j+=4)
+ for (i = 0; i <= 255; i+=4)
+ for (j = 0; j<= 255; j+=4)
TESTINST2("sne $t1, $t2 ,$t3 ", reg_val[i], reg_val[j],
t1, t2, t3);
break;
case SNEI: { /* To record the result of a not equals comparison
with a constant. */
- for(i = 0; i <= 255; i+=1)
+ /* First, make sure at least one testcase has source value (rs)
+ that equals the immediate value to validate the false case. */
+ const int immvalue = 9;
+ TESTINST3("snei $t1, $t2 ,9 ", immvalue, t1, t2, immvalue);
+ for (i = 0; i <= 255; i+=1)
TESTINST3("snei $t1, $t2 ,9 ", reg_val[i], t1, t2, 9);
break;
}
case DMUL: { /* To multiply 64-bit signed integers and
write the result to a GPR. */
- for(i = 0; i <= 255; i+=4)
- for(j = 0; j <= 255; j+=8)
+ for (i = 0; i <= 255; i+=4)
+ for (j = 0; j <= 255; j+=8)
TESTINST2("dmul $t1, $t2 ,$t3 ", reg_val[i], reg_val[j],
t1, t2, t3);
break;
cins32 $t1, $t2, 2 , 9 :: rt 0xf5400000000 rs 0x9abc8bd5, p 0x00000002, lenm1 0x00000009
cins32 $t1, $t2, 2 , 9 :: rt 0x2c400000000 rs 0xafb010b1, p 0x00000002, lenm1 0x00000009
cins32 $t1, $t2, 2 , 9 :: rt 0x9b400000000 rs 0xbcb4666d, p 0x00000002, lenm1 0x00000009
+snei $t1, $t2 ,9 :: rt 0x0 rs 0x9,imm 0x00000009
snei $t1, $t2 ,9 :: rt 0x1 rs 0x0,imm 0x00000009
snei $t1, $t2 ,9 :: rt 0x1 rs 0x4c11db7,imm 0x00000009
snei $t1, $t2 ,9 :: rt 0x1 rs 0x9823b6e,imm 0x00000009
sne $t1, $t2 ,$t3 :: rd 0x1 rs 0xbcb4666d, rt 0x9abc8bd5
sne $t1, $t2 ,$t3 :: rd 0x1 rs 0xbcb4666d, rt 0xafb010b1
sne $t1, $t2 ,$t3 :: rd 0x0 rs 0xbcb4666d, rt 0xbcb4666d
+seqi $t1, $t2 ,9 :: rt 0x1 rs 0x9,imm 0x00000009
seqi $t1, $t2 ,9 :: rt 0x0 rs 0x0,imm 0x00000009
seqi $t1, $t2 ,9 :: rt 0x0 rs 0x130476dc,imm 0x00000009
seqi $t1, $t2 ,9 :: rt 0x0 rs 0x2608edb8,imm 0x00000009