Add test cases for PCMPxSTRx cases 0x0E, 0x34, 0x14, and reformat some
of the associated switch statements.  Pertains to #326469, #327639,
#328878 respectively.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13986 a5019735-40e9-0310-863c-91ae7b9d1cf9
diff --git a/none/tests/amd64/pcmpstr64.c b/none/tests/amd64/pcmpstr64.c
index d28c611..5b273eb 100644
--- a/none/tests/amd64/pcmpstr64.c
+++ b/none/tests/amd64/pcmpstr64.c
@@ -203,10 +203,10 @@
       even if they would probably work.  Life is too short to have
       unvalidated cases in the code base. */
    switch (imm8) {
-      case 0x00:
-      case 0x02: case 0x08: case 0x0C: case 0x12: case 0x1A:
-      case 0x38: case 0x3A: case 0x44: case 0x46: case 0x4A:
-      case 0x30: case 0x40:
+      case 0x00: case 0x02: case 0x08: case 0x0A: case 0x0C: case 0x0E:
+      case 0x12: case 0x14: case 0x1A:
+      case 0x30: case 0x34: case 0x38: case 0x3A:
+      case 0x40: case 0x44: case 0x46: case 0x4A:
          break;
       default:
          return False;
@@ -1546,6 +1546,258 @@
 
 //////////////////////////////////////////////////////////
 //                                                      //
+//                       ISTRI_0E                       //
+//                                                      //
+//////////////////////////////////////////////////////////
+
+__attribute__((noinline))
+UInt h_pcmpistri_0E ( V128* argL, V128* argR )
+{
+   V128 block[2];
+   memcpy(&block[0], argL, sizeof(V128));
+   memcpy(&block[1], argR, sizeof(V128));
+   ULong res = 0, flags = 0;
+   __asm__ __volatile__(
+      "movdqu    0(%2),  %%xmm2"            "\n\t"
+      "movdqu    16(%2), %%xmm11"           "\n\t"
+      "pcmpistri $0x0E,  %%xmm2, %%xmm11"   "\n\t"
+      "pushfq"                              "\n\t"
+      "popq      %%rdx"                     "\n\t"
+      "movq      %%rcx,  %0"                "\n\t"
+      "movq      %%rdx,  %1"                "\n\t"
+      : /*out*/ "=r"(res), "=r"(flags) : "r"/*in*/(&block[0])
+      : "rcx","rdx","xmm0","xmm2","xmm11","cc","memory"
+   );
+   return ((flags & 0x8D5) << 16) | (res & 0xFFFF);
+}
+
+UInt s_pcmpistri_0E ( V128* argLU, V128* argRU )
+{
+   V128 resV;
+   UInt resOSZACP, resECX;
+   Bool ok
+      = pcmpXstrX_WRK( &resV, &resOSZACP, argLU, argRU,
+                       zmask_from_V128(argLU),
+                       zmask_from_V128(argRU),
+                       0x0E, False/*!isSTRM*/
+        );
+   assert(ok);
+   resECX = resV.uInt[0];
+   return (resOSZACP << 16) | resECX;
+}
+
+void istri_0E ( void )
+{
+   char* wot = "0E";
+   UInt(*h)(V128*,V128*) = h_pcmpistri_0E;
+   UInt(*s)(V128*,V128*) = s_pcmpistri_0E;
+   
+   try_istri(wot,h,s, "111111111abcde11", "00000000000abcde"); 
+
+   try_istri(wot,h,s, "111111111abcde11", "0000abcde00abcde"); 
+
+   try_istri(wot,h,s, "1111111111abcde1", "00000000000abcde"); 
+   try_istri(wot,h,s, "11111111111abcde", "00000000000abcde"); 
+   try_istri(wot,h,s, "111111111111abcd", "00000000000abcde"); 
+
+   try_istri(wot,h,s, "111abcde1abcde11", "00000000000abcde"); 
+
+   try_istri(wot,h,s, "11abcde11abcde11", "00000000000abcde"); 
+   try_istri(wot,h,s, "1abcde111abcde11", "00000000000abcde"); 
+   try_istri(wot,h,s, "abcde1111abcde11", "00000000000abcde"); 
+   try_istri(wot,h,s, "bcde11111abcde11", "00000000000abcde"); 
+   try_istri(wot,h,s, "cde111111abcde11", "00000000000abcde"); 
+
+   try_istri(wot,h,s, "01abcde11abcde11", "00000000000abcde"); 
+   try_istri(wot,h,s, "00abcde11abcde11", "00000000000abcde"); 
+   try_istri(wot,h,s, "000bcde11abcde11", "00000000000abcde"); 
+
+   try_istri(wot,h,s, "00abcde10abcde11", "00000000000abcde"); 
+   try_istri(wot,h,s, "00abcde100bcde11", "00000000000abcde"); 
+
+   try_istri(wot,h,s, "1111111111111234", "0000000000000000"); 
+   try_istri(wot,h,s, "1111111111111234", "0000000000000001"); 
+   try_istri(wot,h,s, "1111111111111234", "0000000000000011"); 
+
+   try_istri(wot,h,s, "1111111111111234", "1111111111111234"); 
+   try_istri(wot,h,s, "a111111111111111", "000000000000000a"); 
+   try_istri(wot,h,s, "b111111111111111", "000000000000000a"); 
+
+   try_istri(wot,h,s, "b111111111111111", "0000000000000000");
+   try_istri(wot,h,s, "0000000000000000", "0000000000000000");
+   try_istri(wot,h,s, "123456789abcdef1", "0000000000000000");
+   try_istri(wot,h,s, "0000000000000000", "123456789abcdef1");
+}
+
+
+//////////////////////////////////////////////////////////
+//                                                      //
+//                       ISTRI_34                       //
+//                                                      //
+//////////////////////////////////////////////////////////
+
+UInt h_pcmpistri_34 ( V128* argL, V128* argR )
+{
+   V128 block[2];
+   memcpy(&block[0], argL, sizeof(V128));
+   memcpy(&block[1], argR, sizeof(V128));
+   ULong res, flags;
+   __asm__ __volatile__(
+      "subq      $1024,  %%rsp"             "\n\t"
+      "movdqu    0(%2),  %%xmm2"            "\n\t"
+      "movdqu    16(%2), %%xmm11"           "\n\t"
+      "pcmpistri $0x34,  %%xmm2, %%xmm11"   "\n\t"
+      "pushfq"                              "\n\t"
+      "popq      %%rdx"                     "\n\t"
+      "movq      %%rcx,  %0"                "\n\t"
+      "movq      %%rdx,  %1"                "\n\t"
+      "addq      $1024,  %%rsp"             "\n\t"
+      : /*out*/ "=r"(res), "=r"(flags) : "r"/*in*/(&block[0])
+      : "rcx","rdx","xmm0","xmm2","xmm11","cc","memory"
+   );
+   return ((flags & 0x8D5) << 16) | (res & 0xFFFF);
+}
+
+UInt s_pcmpistri_34 ( V128* argLU, V128* argRU )
+{
+   V128 resV;
+   UInt resOSZACP, resECX;
+   Bool ok
+      = pcmpXstrX_WRK( &resV, &resOSZACP, argLU, argRU,
+                       zmask_from_V128(argLU),
+                       zmask_from_V128(argRU),
+                       0x34, False/*!isSTRM*/
+        );
+   assert(ok);
+   resECX = resV.uInt[0];
+   return (resOSZACP << 16) | resECX;
+}
+
+void istri_34 ( void )
+{
+   char* wot = "34";
+   UInt(*h)(V128*,V128*) = h_pcmpistri_34;
+   UInt(*s)(V128*,V128*) = s_pcmpistri_34;
+
+   try_istri(wot,h,s, "aaaabbbbccccdddd", "00000000000000bc"); 
+   try_istri(wot,h,s, "aaaabbbbccccdddd", "00000000000000cb"); 
+   try_istri(wot,h,s, "baaabbbbccccdddd", "00000000000000cb"); 
+   try_istri(wot,h,s, "baaabbbbccccdddc", "00000000000000cb"); 
+
+   try_istri(wot,h,s, "bbbbbbbbbbbbbbbb", "00000000000000cb"); 
+   try_istri(wot,h,s, "bbbbbbbb0bbbbbbb", "00000000000000cb"); 
+   try_istri(wot,h,s, "bbbbbbbbbbbbbb0b", "00000000000000cb"); 
+   try_istri(wot,h,s, "bbbbbbbbbbbbbbb0", "00000000000000cb"); 
+   try_istri(wot,h,s, "0000000000000000", "00000000000000cb"); 
+
+   try_istri(wot,h,s, "0000000000000000", "0000000000000000"); 
+
+   try_istri(wot,h,s, "bbbbbbbbbbbbbbbb", "00000000000000cb"); 
+   try_istri(wot,h,s, "bbbbbbbbbbbbbbbb", "000000000000000b"); 
+   try_istri(wot,h,s, "b4b4b4b4b4b4b4b4", "00000000000062cb"); 
+
+   try_istri(wot,h,s, "b4b4b4b4b4b4b4b4", "00000000000002cb"); 
+   try_istri(wot,h,s, "b4b4b4b4b4b4b4b4", "00000000000000cb"); 
+   try_istri(wot,h,s, "b4b4b4b4b4b4b4b4", "000000000000000b");
+
+   try_istri(wot,h,s, "0123456789abcdef", "000000fecb975421");
+   try_istri(wot,h,s, "123456789abcdef1", "000000fecb975421");
+
+   try_istri(wot,h,s, "0123456789abcdef", "00000000dca86532");
+   try_istri(wot,h,s, "123456789abcdef1", "00000000dca86532");
+
+   try_istri(wot,h,s, "163887ec041a9b72", "fcd75adb9b3e895a");
+   try_istri(wot,h,s, "fc937cbfbf53f8e2", "0d136bcb024d3fb7");
+   try_istri(wot,h,s, "2ca34182c29a82ab", "302ebd646775ab54");
+   try_istri(wot,h,s, "3f2987608c11be6f", "a9ecb661f8e0a8cb");
+}
+
+
+//////////////////////////////////////////////////////////
+//                                                      //
+//                       ISTRI_14                       //
+//                                                      //
+//////////////////////////////////////////////////////////
+
+UInt h_pcmpistri_14 ( V128* argL, V128* argR )
+{
+   V128 block[2];
+   memcpy(&block[0], argL, sizeof(V128));
+   memcpy(&block[1], argR, sizeof(V128));
+   ULong res, flags;
+   __asm__ __volatile__(
+      "subq      $1024,  %%rsp"             "\n\t"
+      "movdqu    0(%2),  %%xmm2"            "\n\t"
+      "movdqu    16(%2), %%xmm11"           "\n\t"
+      "pcmpistri $0x14,  %%xmm2, %%xmm11"   "\n\t"
+      "pushfq"                              "\n\t"
+      "popq      %%rdx"                     "\n\t"
+      "movq      %%rcx,  %0"                "\n\t"
+      "movq      %%rdx,  %1"                "\n\t"
+      "addq      $1024,  %%rsp"             "\n\t"
+      : /*out*/ "=r"(res), "=r"(flags) : "r"/*in*/(&block[0])
+      : "rcx","rdx","xmm0","xmm2","xmm11","cc","memory"
+   );
+   return ((flags & 0x8D5) << 16) | (res & 0xFFFF);
+}
+
+UInt s_pcmpistri_14 ( V128* argLU, V128* argRU )
+{
+   V128 resV;
+   UInt resOSZACP, resECX;
+   Bool ok
+      = pcmpXstrX_WRK( &resV, &resOSZACP, argLU, argRU,
+                       zmask_from_V128(argLU),
+                       zmask_from_V128(argRU),
+                       0x14, False/*!isSTRM*/
+        );
+   assert(ok);
+   resECX = resV.uInt[0];
+   return (resOSZACP << 16) | resECX;
+}
+
+void istri_14 ( void )
+{
+   char* wot = "14";
+   UInt(*h)(V128*,V128*) = h_pcmpistri_14;
+   UInt(*s)(V128*,V128*) = s_pcmpistri_14;
+
+   try_istri(wot,h,s, "aaaabbbbccccdddd", "00000000000000bc"); 
+   try_istri(wot,h,s, "aaaabbbbccccdddd", "00000000000000cb"); 
+   try_istri(wot,h,s, "baaabbbbccccdddd", "00000000000000cb"); 
+   try_istri(wot,h,s, "baaabbbbccccdddc", "00000000000000cb"); 
+
+   try_istri(wot,h,s, "bbbbbbbbbbbbbbbb", "00000000000000cb"); 
+   try_istri(wot,h,s, "bbbbbbbb0bbbbbbb", "00000000000000cb"); 
+   try_istri(wot,h,s, "bbbbbbbbbbbbbb0b", "00000000000000cb"); 
+   try_istri(wot,h,s, "bbbbbbbbbbbbbbb0", "00000000000000cb"); 
+   try_istri(wot,h,s, "0000000000000000", "00000000000000cb"); 
+
+   try_istri(wot,h,s, "0000000000000000", "0000000000000000"); 
+
+   try_istri(wot,h,s, "bbbbbbbbbbbbbbbb", "00000000000000cb"); 
+   try_istri(wot,h,s, "bbbbbbbbbbbbbbbb", "000000000000000b"); 
+   try_istri(wot,h,s, "b4b4b4b4b4b4b4b4", "00000000000062cb"); 
+
+   try_istri(wot,h,s, "b4b4b4b4b4b4b4b4", "00000000000002cb"); 
+   try_istri(wot,h,s, "b4b4b4b4b4b4b4b4", "00000000000000cb"); 
+   try_istri(wot,h,s, "b4b4b4b4b4b4b4b4", "000000000000000b");
+
+   try_istri(wot,h,s, "0123456789abcdef", "000000fecb975421");
+   try_istri(wot,h,s, "123456789abcdef1", "000000fecb975421");
+
+   try_istri(wot,h,s, "0123456789abcdef", "00000000dca86532");
+   try_istri(wot,h,s, "123456789abcdef1", "00000000dca86532");
+
+   try_istri(wot,h,s, "163887ec041a9b72", "fcd75adb9b3e895a");
+   try_istri(wot,h,s, "fc937cbfbf53f8e2", "0d136bcb024d3fb7");
+   try_istri(wot,h,s, "2ca34182c29a82ab", "302ebd646775ab54");
+   try_istri(wot,h,s, "3f2987608c11be6f", "a9ecb661f8e0a8cb");
+}
+
+
+//////////////////////////////////////////////////////////
+//                                                      //
 //                         main                         //
 //                                                      //
 //////////////////////////////////////////////////////////
@@ -1565,5 +1817,8 @@
    istri_46();
    istri_30();
    istri_40();
+   istri_0E();
+   istri_14();
+   istri_34();
    return 0;
 }
diff --git a/none/tests/amd64/pcmpstr64.stdout.exp b/none/tests/amd64/pcmpstr64.stdout.exp
index 58acb7f..594f620 100644
--- a/none/tests/amd64/pcmpstr64.stdout.exp
+++ b/none/tests/amd64/pcmpstr64.stdout.exp
@@ -332,3 +332,77 @@
 istri 40  0000abcdabcdabcd 00000000000baba0 -> 00c00010 00c00010 
 istri 40  0ddc0ffeebadf00d 00000000cafebabe -> 00c00010 00c00010 
 istri 40  0ddc0ffeebadfeed 00000000cafebabe -> 00c1000a 00c1000a 
+istri 0E  111111111abcde11 00000000000abcde -> 00810002 00810002 
+istri 0E  111111111abcde11 0000abcde00abcde -> 00810002 00810002 
+istri 0E  1111111111abcde1 00000000000abcde -> 00810001 00810001 
+istri 0E  11111111111abcde 00000000000abcde -> 08810000 08810000 
+istri 0E  111111111111abcd 00000000000abcde -> 00800010 00800010 
+istri 0E  111abcde1abcde11 00000000000abcde -> 00810002 00810002 
+istri 0E  11abcde11abcde11 00000000000abcde -> 00810002 00810002 
+istri 0E  1abcde111abcde11 00000000000abcde -> 00810002 00810002 
+istri 0E  abcde1111abcde11 00000000000abcde -> 00810002 00810002 
+istri 0E  bcde11111abcde11 00000000000abcde -> 00810002 00810002 
+istri 0E  cde111111abcde11 00000000000abcde -> 00810002 00810002 
+istri 0E  01abcde11abcde11 00000000000abcde -> 00c10002 00c10002 
+istri 0E  00abcde11abcde11 00000000000abcde -> 00c10002 00c10002 
+istri 0E  000bcde11abcde11 00000000000abcde -> 00c10002 00c10002 
+istri 0E  00abcde10abcde11 00000000000abcde -> 00c10002 00c10002 
+istri 0E  00abcde100bcde11 00000000000abcde -> 00c00010 00c00010 
+istri 0E  1111111111111234 0000000000000000 -> 08810000 08810000 
+istri 0E  1111111111111234 0000000000000001 -> 00810003 00810003 
+istri 0E  1111111111111234 0000000000000011 -> 00810003 00810003 
+istri 0E  1111111111111234 1111111111111234 -> 08010000 08010000 
+istri 0E  a111111111111111 000000000000000a -> 0081000f 0081000f 
+istri 0E  b111111111111111 000000000000000a -> 00800010 00800010 
+istri 0E  b111111111111111 0000000000000000 -> 08810000 08810000 
+istri 0E  0000000000000000 0000000000000000 -> 08c10000 08c10000 
+istri 0E  123456789abcdef1 0000000000000000 -> 08810000 08810000 
+istri 0E  0000000000000000 123456789abcdef1 -> 00400010 00400010 
+istri 14  aaaabbbbccccdddd 00000000000000bc -> 08810000 08810000 
+istri 14  aaaabbbbccccdddd 00000000000000cb -> 08810000 08810000 
+istri 14  baaabbbbccccdddd 00000000000000cb -> 08810000 08810000 
+istri 14  baaabbbbccccdddc 00000000000000cb -> 00810001 00810001 
+istri 14  bbbbbbbbbbbbbbbb 00000000000000cb -> 00800010 00800010 
+istri 14  bbbbbbbb0bbbbbbb 00000000000000cb -> 00c10007 00c10007 
+istri 14  bbbbbbbbbbbbbb0b 00000000000000cb -> 00c10001 00c10001 
+istri 14  bbbbbbbbbbbbbbb0 00000000000000cb -> 08c10000 08c10000 
+istri 14  0000000000000000 00000000000000cb -> 08c10000 08c10000 
+istri 14  0000000000000000 0000000000000000 -> 08c10000 08c10000 
+istri 14  bbbbbbbbbbbbbbbb 00000000000000cb -> 00800010 00800010 
+istri 14  bbbbbbbbbbbbbbbb 000000000000000b -> 08810000 08810000 
+istri 14  b4b4b4b4b4b4b4b4 00000000000062cb -> 00800010 00800010 
+istri 14  b4b4b4b4b4b4b4b4 00000000000002cb -> 08810000 08810000 
+istri 14  b4b4b4b4b4b4b4b4 00000000000000cb -> 08810000 08810000 
+istri 14  b4b4b4b4b4b4b4b4 000000000000000b -> 08810000 08810000 
+istri 14  0123456789abcdef 000000fecb975421 -> 00c10002 00c10002 
+istri 14  123456789abcdef1 000000fecb975421 -> 00810003 00810003 
+istri 14  0123456789abcdef 00000000dca86532 -> 08c10000 08c10000 
+istri 14  123456789abcdef1 00000000dca86532 -> 08810000 08810000 
+istri 14  163887ec041a9b72 fcd75adb9b3e895a -> 08410000 08410000 
+istri 14  fc937cbfbf53f8e2 0d136bcb024d3fb7 -> 08810000 08810000 
+istri 14  2ca34182c29a82ab 302ebd646775ab54 -> 08810000 08810000 
+istri 14  3f2987608c11be6f a9ecb661f8e0a8cb -> 08c10000 08c10000 
+istri 34  aaaabbbbccccdddd 00000000000000bc -> 08810000 08810000 
+istri 34  aaaabbbbccccdddd 00000000000000cb -> 08810000 08810000 
+istri 34  baaabbbbccccdddd 00000000000000cb -> 08810000 08810000 
+istri 34  baaabbbbccccdddc 00000000000000cb -> 00810001 00810001 
+istri 34  bbbbbbbbbbbbbbbb 00000000000000cb -> 00800010 00800010 
+istri 34  bbbbbbbb0bbbbbbb 00000000000000cb -> 00c00010 00c00010 
+istri 34  bbbbbbbbbbbbbb0b 00000000000000cb -> 00c00010 00c00010 
+istri 34  bbbbbbbbbbbbbbb0 00000000000000cb -> 00c00010 00c00010 
+istri 34  0000000000000000 00000000000000cb -> 00c00010 00c00010 
+istri 34  0000000000000000 0000000000000000 -> 00c00010 00c00010 
+istri 34  bbbbbbbbbbbbbbbb 00000000000000cb -> 00800010 00800010 
+istri 34  bbbbbbbbbbbbbbbb 000000000000000b -> 08810000 08810000 
+istri 34  b4b4b4b4b4b4b4b4 00000000000062cb -> 00800010 00800010 
+istri 34  b4b4b4b4b4b4b4b4 00000000000002cb -> 08810000 08810000 
+istri 34  b4b4b4b4b4b4b4b4 00000000000000cb -> 08810000 08810000 
+istri 34  b4b4b4b4b4b4b4b4 000000000000000b -> 08810000 08810000 
+istri 34  0123456789abcdef 000000fecb975421 -> 00c10002 00c10002 
+istri 34  123456789abcdef1 000000fecb975421 -> 00810003 00810003 
+istri 34  0123456789abcdef 00000000dca86532 -> 08c10000 08c10000 
+istri 34  123456789abcdef1 00000000dca86532 -> 08810000 08810000 
+istri 34  163887ec041a9b72 fcd75adb9b3e895a -> 08410000 08410000 
+istri 34  fc937cbfbf53f8e2 0d136bcb024d3fb7 -> 08810000 08810000 
+istri 34  2ca34182c29a82ab 302ebd646775ab54 -> 08810000 08810000 
+istri 34  3f2987608c11be6f a9ecb661f8e0a8cb -> 08c10000 08c10000 
diff --git a/none/tests/amd64/pcmpstr64w.c b/none/tests/amd64/pcmpstr64w.c
index 7c08b25..858cfd8 100644
--- a/none/tests/amd64/pcmpstr64w.c
+++ b/none/tests/amd64/pcmpstr64w.c
@@ -208,9 +208,10 @@
       even if they would probably work.  Life is too short to have
       unvalidated cases in the code base. */
    switch (imm8) {
-      case 0x01:
-      case 0x03: case 0x09: case 0x0B: case 0x0D: case 0x13:
-      case 0x1B: case 0x39: case 0x3B: case 0x45: case 0x4B:
+      case 0x01: case 0x03: case 0x09: case 0x0B: case 0x0D:
+      case 0x13:            case 0x1B:
+                            case 0x39: case 0x3B:
+                 case 0x45:            case 0x4B:
          break;
       default:
          return False;