From: Petar Jovanovic Date: Sat, 28 Mar 2015 00:59:32 +0000 (+0000) Subject: mips64: extend the test with new cases for Cavium SEQI and SNEI X-Git-Tag: svn/VALGRIND_3_11_0~549 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=768a928b2bee265a02987bbf012bdb88eb0f8179;p=thirdparty%2Fvalgrind.git mips64: extend the test with new cases for Cavium SEQI and SNEI Extend the test to introduce cases for SEQI and SNEI when immediate is equal to the content of the GPR rs. Minor code style changes added. Patch by Maran Pakkirisamy. Related issue - BZ #341997. git-svn-id: svn://svn.valgrind.org/valgrind/trunk@15043 --- diff --git a/none/tests/mips64/cvm_ins.c b/none/tests/mips64/cvm_ins.c index 39c75c57ae..fee6f901b4 100644 --- a/none/tests/mips64/cvm_ins.c +++ b/none/tests/mips64/cvm_ins.c @@ -98,7 +98,7 @@ const int reg_val[256] = { 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( \ @@ -127,35 +127,35 @@ int main() 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; @@ -163,14 +163,18 @@ int main() 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; @@ -178,15 +182,19 @@ int main() 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; diff --git a/none/tests/mips64/cvm_ins.stdout.exp b/none/tests/mips64/cvm_ins.stdout.exp index 582101bc03..4d6fd41d99 100644 --- a/none/tests/mips64/cvm_ins.stdout.exp +++ b/none/tests/mips64/cvm_ins.stdout.exp @@ -254,6 +254,7 @@ cins32 $t1, $t2, 2 , 9 :: rt 0x42400000000 rs 0x89b8fd09, p 0x00000002, lenm1 0x 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 @@ -4606,6 +4607,7 @@ sne $t1, $t2 ,$t3 :: rd 0x1 rs 0xbcb4666d, rt 0x89b8fd09 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