]> git.ipfire.org Git - thirdparty/valgrind.git/commitdiff
mips64: extend the test with new cases for Cavium SEQI and SNEI
authorPetar Jovanovic <mips32r2@gmail.com>
Sat, 28 Mar 2015 00:59:32 +0000 (00:59 +0000)
committerPetar Jovanovic <mips32r2@gmail.com>
Sat, 28 Mar 2015 00:59:32 +0000 (00:59 +0000)
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

none/tests/mips64/cvm_ins.c
none/tests/mips64/cvm_ins.stdout.exp

index 39c75c57ae083b7c1e76aa95883a78fc7ecb44e8..fee6f901b47578003c6b4c613a1d13a613e236da 100644 (file)
@@ -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;
index 582101bc036afb59eb74ee7456253ad2f011466b..4d6fd41d99aa302711af5a183697b5411fabb956 100644 (file)
@@ -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