Blame SOURCES/valgrind-3.11.0-rexw-cvtps2pd.patch

2601b6
diff --git a/VEX/priv/guest_amd64_toIR.c b/VEX/priv/guest_amd64_toIR.c
2601b6
index 98596d2..06552e8 100644
2601b6
--- a/VEX/priv/guest_amd64_toIR.c
2601b6
+++ b/VEX/priv/guest_amd64_toIR.c
2601b6
@@ -13396,7 +13396,8 @@ Long dis_ESC_0F__SSE2 ( Bool* decode_OK,
2601b6
    case 0x5A:
2601b6
       /* 0F 5A = CVTPS2PD -- convert 2 x F32 in low half mem/xmm to 2 x
2601b6
          F64 in xmm(G). */
2601b6
-      if (haveNo66noF2noF3(pfx) && sz == 4) {
2601b6
+      if (haveNo66noF2noF3(pfx)
2601b6
+          && (sz == 4 || /* ignore redundant REX.W */ sz == 8)) {
2601b6
          delta = dis_CVTPS2PD_128( vbi, pfx, delta, False/*!isAvx*/ );
2601b6
          goto decode_success;
2601b6
       }
2601b6
diff --git a/none/tests/amd64/redundantRexW.c b/none/tests/amd64/redundantRexW.c
2601b6
index e189267..0a50c3b 100644
2601b6
--- a/none/tests/amd64/redundantRexW.c
2601b6
+++ b/none/tests/amd64/redundantRexW.c
2601b6
@@ -596,6 +596,23 @@ int main ( void )
2601b6
      after_test( "rex.WB subsd  -0x8(%r13),%xmm1", regs, mem );
2601b6
    }
2601b6
 
2601b6
+   /* cvtps2pd mem, reg   48 0f 5a 07     rex.W cvtps2pd  (%rdi),%xmm0 */
2601b6
+   {
2601b6
+     before_test( regs, mem );
2601b6
+     __asm__ __volatile__(
2601b6
+         "movq %0, %%r14\n"
2601b6
+       "\tmovq %1, %%r15\n"
2601b6
+       LOAD_XMMREGS_from_r14
2601b6
+       "\tmovq %%r15, %%rdi\n"
2601b6
+       "\t.byte 0x48,0x0f,0x5a,0x07\n"
2601b6
+       SAVE_XMMREGS_to_r14
2601b6
+          : /*out*/ : /*in*/ "r"(regs), "r"( -0 + (char*)&mem->dqw[2] )
2601b6
+                    : /*trash*/ "r14","r15","memory", XMMREGS,
2601b6
+                                "rdi"
2601b6
+     );
2601b6
+     after_test( "rex.W cvtps2pd  (%rdi),%xmm0", regs, mem );
2601b6
+   }
2601b6
+
2601b6
    free(regs);
2601b6
    free(mem);
2601b6
    return 0;
2601b6
diff --git a/none/tests/amd64/redundantRexW.stdout.exp b/none/tests/amd64/redundantRexW.stdout.exp
2601b6
index dd1697a..94b255a 100644
2601b6
--- a/none/tests/amd64/redundantRexW.stdout.exp
2601b6
+++ b/none/tests/amd64/redundantRexW.stdout.exp
2601b6
@@ -648,3 +648,29 @@ after "rex.WB subsd  -0x8(%r13),%xmm1" (xmms in order [15..0]) {
2601b6
   %xmm15 ................................
2601b6
 }
2601b6
 
2601b6
+after "rex.W cvtps2pd  (%rdi),%xmm0" (dqws in order [15 .. 0]) {
2601b6
+  [0]    ................................
2601b6
+  [1]    ................................
2601b6
+  [2]    ................................
2601b6
+  [3]    ................................
2601b6
+  [4]    ................................
2601b6
+}
2601b6
+after "rex.W cvtps2pd  (%rdi),%xmm0" (xmms in order [15..0]) {
2601b6
+  %xmm 0 113a1c7d5554535213bd9cffd4535251
2601b6
+  %xmm 1 ................................
2601b6
+  %xmm 2 ................................
2601b6
+  %xmm 3 ................................
2601b6
+  %xmm 4 ................................
2601b6
+  %xmm 5 ................................
2601b6
+  %xmm 6 ................................
2601b6
+  %xmm 7 ................................
2601b6
+  %xmm 8 ................................
2601b6
+  %xmm 9 ................................
2601b6
+  %xmm10 ................................
2601b6
+  %xmm11 ................................
2601b6
+  %xmm12 ................................
2601b6
+  %xmm13 ................................
2601b6
+  %xmm14 ................................
2601b6
+  %xmm15 ................................
2601b6
+}
2601b6
+