]> git.ipfire.org Git - thirdparty/valgrind.git/commitdiff
amd64: implement PCMPxSTRx case 0x41. This is generated by recent MSVCs. n-i-bz.
authorJulian Seward <jseward@acm.org>
Tue, 6 Feb 2018 14:19:24 +0000 (15:19 +0100)
committerJulian Seward <jseward@acm.org>
Tue, 6 Feb 2018 14:19:24 +0000 (15:19 +0100)
VEX/priv/guest_amd64_toIR.c
VEX/priv/guest_generic_x87.c
none/tests/amd64/pcmpstr64w.c
none/tests/amd64/pcmpstr64w.stdout.exp

index 9073e1d36e35e4a1b5f21cb86efecdbf171903cc..d00f45331c32a9c234c324f00c593eb201552277 100644 (file)
@@ -18811,7 +18811,7 @@ static Long dis_PCMPxSTRx ( const VexAbiInfo* vbi, Prefix pfx,
                  case 0x13:
       case 0x19: case 0x1B:
       case 0x39: case 0x3B:
-                            case 0x45:
+      case 0x41:            case 0x45:
                  case 0x4B:
          break;
       default:
index d1979efcc938791e65a483f3229dad8dd0e1c8e5..28c58b9ba69032ce7d0aca07853e5b071f0f019f 100644 (file)
@@ -1052,10 +1052,14 @@ Bool compute_PCMPxSTRx_wide ( /*OUT*/V128* resV,
       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 0x19: case 0x1B:
-                            case 0x39: case 0x3B:
-                 case 0x45:            case 0x4B:
+      //    1,9        3,B        5,D        7,F
+      case 0x01: case 0x03:
+      case 0x09: case 0x0B: case 0x0D:
+                 case 0x13:
+      case 0x19: case 0x1B:
+      case 0x39: case 0x3B:
+      case 0x41:            case 0x45:
+                 case 0x4B:
          break;
       default:
          return False;
index 6a1adad8cd9e99e33d5999aa05dfa21cdd14fc5f..f58781388aa57028ab1108512b5cc9c7491e4ccf 100644 (file)
@@ -208,10 +208,14 @@ Bool pcmpXstrX_WRK_wide ( /*OUT*/V128* resV,
       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 0x19: case 0x1B:
-                            case 0x39: case 0x3B:
-                 case 0x45:            case 0x4B:
+         //    1,9        3,B        5,D        7,F
+         case 0x01: case 0x03:
+         case 0x09: case 0x0B: case 0x0D:
+                    case 0x13:
+         case 0x19: case 0x1B:
+         case 0x39: case 0x3B:
+         case 0x41:            case 0x45:
+                    case 0x4B:
          break;
       default:
          return False;
@@ -1346,6 +1350,85 @@ void istri_19 ( void )
 
 
 
+//////////////////////////////////////////////////////////
+//                                                      //
+//                       ISTRI_41                       //
+//                                                      //
+//////////////////////////////////////////////////////////
+
+UInt h_pcmpistri_41 ( 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 $0x41,  %%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_41 ( V128* argLU, V128* argRU )
+{
+   V128 resV;
+   UInt resOSZACP, resECX;
+   Bool ok
+      = pcmpXstrX_WRK_wide( &resV, &resOSZACP, argLU, argRU,
+                           zmask_from_V128(argLU),
+                           zmask_from_V128(argRU),
+                           0x41, False/*!isSTRM*/
+        );
+   assert(ok);
+   resECX = resV.uInt[0];
+   return (resOSZACP << 16) | resECX;
+}
+
+void istri_41 ( void )
+{
+   char* wot = "41";
+   UInt(*h)(V128*,V128*) = h_pcmpistri_41;
+   UInt(*s)(V128*,V128*) = s_pcmpistri_41;
+
+   try_istri(wot,h,s, "aaaabbbbccccdddd", "000000000000bbcc");
+   try_istri(wot,h,s, "aaaabbbbccccdddd", "000000000000ccbb");
+   try_istri(wot,h,s, "baaabbbbccccdddd", "000000000000ccbb");
+   try_istri(wot,h,s, "baaabbbbccccdddc", "000000000000ccbb");
+
+   try_istri(wot,h,s, "bbbbbbbbbbbbbbbb", "000000000000ccbb");
+   try_istri(wot,h,s, "bbbbbbbb00bbbbbb", "000000000000ccbb");
+   try_istri(wot,h,s, "bbbbbbbbbbbb00bb", "000000000000ccbb");
+   try_istri(wot,h,s, "bbbbbbbbbbbbbb00", "000000000000ccbb");
+   try_istri(wot,h,s, "0000000000000000", "000000000000ccbb");
+
+   try_istri(wot,h,s, "0000000000000000", "0000000000000000");
+
+   try_istri(wot,h,s, "bbbbbbbbbbbbbbbb", "000000000000ccbb");
+   try_istri(wot,h,s, "bbbbbbbbbbbbbbbb", "00000000000000bb");
+   try_istri(wot,h,s, "bb44bb44bb44bb44", "000000006622ccbb");
+
+   try_istri(wot,h,s, "bb44bb44bb44bb44", "000000000022ccbb");
+   try_istri(wot,h,s, "bb44bb44bb44bb44", "000000000000ccbb");
+   try_istri(wot,h,s, "bb44bb44bb44bb44", "00000000000000bb");
+
+   try_istri(wot,h,s, "0011223344556677", "0000997755442211");
+   try_istri(wot,h,s, "1122334455667711", "0000997755442211");
+
+   try_istri(wot,h,s, "0011223344556677", "0000aa8866553322");
+   try_istri(wot,h,s, "1122334455667711", "0000aa8866553322");
+}
+
+
+
 //////////////////////////////////////////////////////////
 //                                                      //
 //                         main                         //
@@ -1365,5 +1448,6 @@ int main ( void )
    istri_01();
    istri_39();
    istri_19();
+   istri_41();
    return 0;
 }
index c18184c442e20c36ad57cc78a8dd2121236bc8ca..c1b27bd289073ae647f6a2f4f23ffe1d6d2137de 100644 (file)
@@ -288,3 +288,23 @@ istri 19  8000000000000000 aaaaaaaa00aaaaaa -> 08c10000 08c10000
 istri 19  0000000000000001 aaaaaaaa00aaaaaa -> 08c10000 08c10000 
 istri 19  0000000000000000 aaaaaaaaaaaaaaaa -> 08410000 08410000 
 istri 19  aaaaaaaaaaaaaaaa 0000000000000000 -> 08810000 08810000 
+istri 41  aaaabbbbccccdddd 000000000000bbcc -> 00810005 00810005 
+istri 41  aaaabbbbccccdddd 000000000000ccbb -> 00810005 00810005 
+istri 41  baaabbbbccccdddd 000000000000ccbb -> 00810005 00810005 
+istri 41  baaabbbbccccdddc 000000000000ccbb -> 00810005 00810005 
+istri 41  bbbbbbbbbbbbbbbb 000000000000ccbb -> 08810007 08810007 
+istri 41  bbbbbbbb00bbbbbb 000000000000ccbb -> 08c10002 08c10002 
+istri 41  bbbbbbbbbbbb00bb 000000000000ccbb -> 08c10000 08c10000 
+istri 41  bbbbbbbbbbbbbb00 000000000000ccbb -> 00c00008 00c00008 
+istri 41  0000000000000000 000000000000ccbb -> 00c00008 00c00008 
+istri 41  0000000000000000 0000000000000000 -> 00c00008 00c00008 
+istri 41  bbbbbbbbbbbbbbbb 000000000000ccbb -> 08810007 08810007 
+istri 41  bbbbbbbbbbbbbbbb 00000000000000bb -> 08810007 08810007 
+istri 41  bb44bb44bb44bb44 000000006622ccbb -> 00810007 00810007 
+istri 41  bb44bb44bb44bb44 000000000022ccbb -> 00810007 00810007 
+istri 41  bb44bb44bb44bb44 000000000000ccbb -> 00810007 00810007 
+istri 41  bb44bb44bb44bb44 00000000000000bb -> 00810007 00810007 
+istri 41  0011223344556677 0000997755442211 -> 08c10006 08c10006 
+istri 41  1122334455667711 0000997755442211 -> 08810007 08810007 
+istri 41  0011223344556677 0000aa8866553322 -> 00c10005 00c10005 
+istri 41  1122334455667711 0000aa8866553322 -> 00810006 00810006