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