]> git.ipfire.org Git - thirdparty/valgrind.git/commitdiff
Implement PHMINPOSUW (SSE 4.1). Fixes #287301.
authorJulian Seward <jseward@acm.org>
Thu, 16 Feb 2012 22:02:14 +0000 (22:02 +0000)
committerJulian Seward <jseward@acm.org>
Thu, 16 Feb 2012 22:02:14 +0000 (22:02 +0000)
(Laurent Birtz, seerdecker@yahoo.com.au)

git-svn-id: svn://svn.valgrind.org/vex/trunk@2256

VEX/priv/guest_amd64_defs.h
VEX/priv/guest_amd64_helpers.c
VEX/priv/guest_amd64_toIR.c

index 94d55de7c0cfb11883e469b3c40168f290a6cd51..30ffd6b910702c95cd151e5ac8a71144727cfaa1 100644 (file)
@@ -141,6 +141,8 @@ extern ULong amd64g_calculate_mmx_psadbw   ( ULong, ULong );
 extern ULong amd64g_calculate_mmx_pmovmskb ( ULong );
 extern ULong amd64g_calculate_sse_pmovmskb ( ULong w64hi, ULong w64lo );
 
+extern ULong amd64g_calculate_sse_phminposuw ( ULong sLo, ULong sHi );
+
 extern ULong amd64g_calc_crc32b ( ULong crcIn, ULong b );
 extern ULong amd64g_calc_crc32w ( ULong crcIn, ULong w );
 extern ULong amd64g_calc_crc32l ( ULong crcIn, ULong l );
index 86fa6b2412fbd200283a4368f5da31d2b50f8682..8eb496134d1340f105fb5b7bf8e5c028a64ee201 100644 (file)
@@ -2840,6 +2840,22 @@ ULong amd64g_calculate_sse_pmovmskb ( ULong w64hi, ULong w64lo )
    return ((rHi8 & 0xFF) << 8) | (rLo8 & 0xFF);
 }
 
+/* CALLED FROM GENERATED CODE: CLEAN HELPER */
+ULong amd64g_calculate_sse_phminposuw ( ULong sLo, ULong sHi )
+{
+   UShort t, min;
+   UInt   idx;
+   t = sel16x4_0(sLo); if (True)    { min = t; idx = 0; }
+   t = sel16x4_1(sLo); if (t < min) { min = t; idx = 1; }
+   t = sel16x4_2(sLo); if (t < min) { min = t; idx = 2; }
+   t = sel16x4_3(sLo); if (t < min) { min = t; idx = 3; }
+   t = sel16x4_0(sHi); if (t < min) { min = t; idx = 4; }
+   t = sel16x4_1(sHi); if (t < min) { min = t; idx = 5; }
+   t = sel16x4_2(sHi); if (t < min) { min = t; idx = 6; }
+   t = sel16x4_3(sHi); if (t < min) { min = t; idx = 7; }
+   return ((ULong)(idx << 16)) | ((ULong)min);
+}
+
 /* CALLED FROM GENERATED CODE: CLEAN HELPER */
 ULong amd64g_calc_crc32b ( ULong crcIn, ULong b )
 {
index a8ba1d4e58bd01760fc8d01e3293214d93d01c3a..af452ebe9d8be923ea19c1b53b5058bbb48f02cb 100644 (file)
@@ -15017,6 +15017,42 @@ Long dis_ESC_0F38__SSE4 ( Bool* decode_OK,
       }
       break;
 
+   case 0x41:
+      /* 66 0F 38 41 /r = PHMINPOSUW xmm1, xmm2/m128
+         Packed Horizontal Word Minimum from xmm2/m128 to xmm1 */
+      if (have66noF2noF3(pfx) && sz == 2) {
+         IRTemp sV  = newTemp(Ity_V128);
+         IRTemp sHi = newTemp(Ity_I64);
+         IRTemp sLo = newTemp(Ity_I64);
+         IRTemp dLo = newTemp(Ity_I64);
+         modrm = getUChar(delta);
+         if (epartIsReg(modrm)) {
+            assign( sV, getXMMReg(eregOfRexRM(pfx,modrm)) );
+            delta += 1;
+            DIP("phminposuw %s,%s\n", nameXMMReg(eregOfRexRM(pfx,modrm)),
+                                      nameXMMReg(gregOfRexRM(pfx,modrm)));
+         } else {
+            addr = disAMode ( &alen, vbi, pfx, delta, dis_buf, 0 );
+            gen_SEGV_if_not_16_aligned(addr);
+            assign( sV, loadLE(Ity_V128, mkexpr(addr)) );
+            delta += alen;
+            DIP("phminposuw %s,%s\n", dis_buf,
+                                      nameXMMReg(gregOfRexRM(pfx,modrm)));
+         }
+         assign( sHi, unop(Iop_V128HIto64, mkexpr(sV)) );
+         assign( sLo, unop(Iop_V128to64,   mkexpr(sV)) );
+         assign( dLo, mkIRExprCCall(
+                         Ity_I64, 0/*regparms*/,
+                         "amd64g_calculate_sse_phminposuw", 
+                         &amd64g_calculate_sse_phminposuw,
+                         mkIRExprVec_2( mkexpr(sLo), mkexpr(sHi) )
+                      ));
+         putXMMReg(gregOfRexRM(pfx,modrm), unop(Iop_64UtoV128, mkexpr(dLo)));
+
+         goto decode_success;
+      } 
+      break;
+
    case 0xDC:
    case 0xDD:
    case 0xDE: