]> git.ipfire.org Git - thirdparty/valgrind.git/commitdiff
mips64: add test cases for Cavium BBIT032 and BBIT132
authorPetar Jovanovic <mips32r2@gmail.com>
Wed, 26 Nov 2014 23:50:31 +0000 (23:50 +0000)
committerPetar Jovanovic <mips32r2@gmail.com>
Wed, 26 Nov 2014 23:50:31 +0000 (23:50 +0000)
This is a follow up to VEX r3028. This change adds two test cases
for Cavium instructions BBIT032 and BBIT132.

Issue tracked in BZ #339288.

Patch by Maran Pakkirisamy.

git-svn-id: svn://svn.valgrind.org/valgrind/trunk@14792

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

index 3281886b7a4eb1e52f954a62916c828556c5a2b6..b1966b9111364f21e372a675a038b04e7e27ff3e 100644 (file)
@@ -33,6 +33,44 @@ int main()
    printf("TEST bbit0: %s\n", t1 == 0x08 ? "PASS" : "FAIL");
    printf("TEST bbit1: %s\n", t2 == 0xF7 ? "PASS" : "FAIL");
 
+   long int lt1 = 0;
+   long int lt2 = 0;
+   long int lt3 = 0xff00000000;
+   long int lt4 = 0x100000000;
+   /* Take 0x100000000 and loop until 35th bit is set
+      by incrementing 0x100000000 at a time. */
+   __asm__ volatile(
+      ".set noreorder"           "\n\t"
+      "move $t0, $zero"          "\n\t"
+      "move $t1, %1"             "\n\t"
+      "label4:"                  "\n\t"
+      "dadd $t0, $t0, $t1"       "\n\t"
+      "bbit032 $t0, 0x3, label4" "\n\t"
+      "nop"                      "\n\t"
+      "move %0, $t0"             "\n\t"
+      ".set reorder"             "\n\t"
+      : "=r" (lt1)
+      : "r" (lt4)
+      : "t0", "t1");
+   /* Take 0xff00000000 and loop until 35th bit is cleared
+      by decrementing 0x100000000 at a time. */
+   __asm__ volatile(
+      ".set noreorder"           "\n\t"
+      "move $t0, %1"             "\n\t"
+      "move $t1, %2"             "\n\t"
+      "label3:"                  "\n\t"
+      "dadd $t0, $t0, $t1"       "\n\t"
+      "bbit132 $t0, 0x3, label3" "\n\t"
+      "nop"                      "\n\t"
+      "move %0, $t0"             "\n\t"
+      ".set reorder"             "\n\t"
+      : "=r" (lt2)
+      : "r" (lt3), "r" (-lt4)
+      : "t0", "t1");
+
+   printf("TEST bbit032: %s\n", lt1 == 0x0800000000 ? "PASS" : "FAIL");
+   printf("TEST bbit132: %s\n", lt2 == 0xF700000000 ? "PASS" : "FAIL");
+
 #endif
    return 0;
 }
index 71e197107ae5a4f10382303b755354db57aa27d8..d04102fbea6a894f6e5d1254e39539ab5848055f 100644 (file)
@@ -1,2 +1,4 @@
 TEST bbit0: PASS
 TEST bbit1: PASS
+TEST bbit032: PASS
+TEST bbit132: PASS