]> git.ipfire.org Git - thirdparty/valgrind.git/commitdiff
Add PCMPEQQ SSE4.1 support for x86
authorMark Wielaard <mark@klomp.org>
Thu, 12 Mar 2026 00:22:32 +0000 (01:22 +0100)
committerMark Wielaard <mark@klomp.org>
Thu, 16 Apr 2026 18:36:53 +0000 (20:36 +0200)
Add handling of PCMPEQQ to VEX/priv/guest_x86_toIR.c based on the
guest_amd64_toIR.c implementation. Handle Iop_CmpEQ64x2 using
h_generic_calc_CmpEQ64x2 in VEX/priv/host_x86_isel.c.

Move test_PCMPEQQ from none/tests/amd64/sse4-64.c to
none/tests/sse4-common.h and add the same test to
none/tests/x86/sse4-x86.c with new PCMPEQQ output in stdout.exp.

https://bugs.kde.org/show_bug.cgi?id=517455

NEWS
VEX/priv/guest_x86_toIR.c
VEX/priv/host_x86_isel.c
none/tests/amd64/sse4-64.c
none/tests/sse4-common.h
none/tests/x86/sse4-x86.c
none/tests/x86/sse4-x86.stdout.exp

diff --git a/NEWS b/NEWS
index 71314b20c1d962abaa89a6238e7ca69ff9973c8c..26454708ae9b1d00959493062ddaac8fb1f23240 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -129,6 +129,7 @@ are not entered into bugzilla tend to get forgotten about or ignored.
 516289  illumos lsframe2 regtest fails
 516748  Incorrect use of SET_STATUS_Failure for syscall wrappers that return
         error codes rather than -1 on error
+517455  Add PCMPEQQ SSE4.1 support for x86
 517697  Implement CLRSSONSTACK and SETUJMPBUF handling on Solaris.
 517748  Add ability to redirect global functions to Darwin
 517840  Add PTEST SSE4.1 support for x86
index 95ff49af7b321c9dbcfdc05e60669f024d203d89..072bbd94adeaa09bae070426a2a44e88c8fbe8cd 100644 (file)
@@ -13242,6 +13242,14 @@ DisResult disInstr_X86_WRK (
      goto decode_success;
    }
 
+   /* 66 0F 38 29 = PCMPEQQ
+      64x2 equality comparison */
+   if (sz == 2 && insn[0] == 0x0F && insn[1] == 0x38 && insn[2] == 0x29) {
+      delta = dis_SSEint_E_to_G( sorb, delta+3, "pcmpeqq",
+                                 Iop_CmpEQ64x2, False);
+      goto decode_success;
+   }
+
    /* 66 0F 38 38 /r  - PMINSB xmm1, xmm2/m128
       66 0F 38 3C /r  - PMAXSB xmm1, xmm2/m128
       Minimum/Maximum of Packed Signed Byte Integers (XMM)
index 2dcc4426896e4d96cf3bc3e3dbc9ec72bf37d400..dfff1cec9866ac1e3f5af182a4fc5660fe927a11 100644 (file)
@@ -3861,6 +3861,9 @@ static HReg iselVecExpr_wrk ( ISelEnv* env, const IRExpr* e )
          return dst;
       }
 
+      case Iop_CmpEQ64x2:
+         fn = (HWord)h_generic_calc_CmpEQ64x2;
+         goto do_SseAssistedBinary;
       case Iop_NarrowBin32to16x8:
          fn = (HWord)h_generic_calc_NarrowBin32to16x8;
          goto do_SseAssistedBinary;
index bbd4a0ee14975943f79d345b08555161575cde4a..baf3a77bd4a525632797a00931043d6dbde1d030 100644 (file)
@@ -1005,26 +1005,6 @@ void test_PACKUSDW ( void )
 }
 
 
-void test_PCMPEQQ ( void )
-{
-   V128 src, dst;
-   Int i;
-   for (i = 0; i < 10; i++) {
-      randV128(&src);
-      randV128(&dst);
-      switch (i - 6) {
-         case 0: memset(&src[0], 0x55, 8);
-                 memset(&dst[0], 0x55, 8); break;
-         case 1: memset(&src[8], 0x55, 8);
-                 memset(&dst[8], 0x55, 8); break;
-         default:
-            break;
-      }
-      DO_mandr_r("pcmpeqq", src, dst);
-   }
-}
-
-
 void test_PEXTRB ( void )
 {
    V128 src;
index 1723567da4a2ae4922164fdfd4b505183c077418..c3848e410e6f2ac39ccf2635f16ed38d0fb80f4a 100644 (file)
@@ -857,4 +857,23 @@ static inline void test_BLENDVPS ( void )
    }
 }
 
+static inline void test_PCMPEQQ ( void )
+{
+   V128 src, dst;
+   Int i;
+   for (i = 0; i < 10; i++) {
+      randV128(&src);
+      randV128(&dst);
+      switch (i - 6) {
+         case 0: memset(&src[0], 0x55, 8);
+                 memset(&dst[0], 0x55, 8); break;
+         case 1: memset(&src[8], 0x55, 8);
+                 memset(&dst[8], 0x55, 8); break;
+         default:
+            break;
+      }
+      DO_mandr_r("pcmpeqq", src, dst);
+   }
+}
+
 #endif /* __SSE4_COMMON_H */
index 10cb58f3f071e358a925f65df03e71f1eb8b3003..414d0cec1dc8aedd849411da907e78680e14a456 100644 (file)
@@ -163,6 +163,7 @@ int main(void)
    test_BLENDVPD();
    test_BLENDVPS();
    test_PTEST();
+   test_PCMPEQQ();
 
    return 0;
 }
index 0dfa6bc4dd2625b71f39b6aeee0f691bd7d4b838..a26fc429f323a0d20c687843ad110fb5535703b4 100644 (file)
@@ -1222,3 +1222,23 @@ r   ptest fffffffffffffffefffffffffffffffe ffffffffffffffffffffffffffffffff -> f
 r   ptest fffffffffffffffefffffffffffffffe fffffffffffffffffffffffffffffffe -> flags 0000
 r   ptest fffffffffffffffefffffffffffffffe fffffffffffffffeffffffffffffffff -> flags 0000
 r   ptest fffffffffffffffefffffffffffffffe fffffffffffffffefffffffffffffffe -> flags 0001
+r    pcmpeqq 685c54d57186f6e2a353dba0ead5df70 f92e3cc13e4f1fc8f3fa1382738f705b 00000000000000000000000000000000
+m    pcmpeqq 685c54d57186f6e2a353dba0ead5df70 f92e3cc13e4f1fc8f3fa1382738f705b 00000000000000000000000000000000
+r    pcmpeqq 9c423a145875f5144ccc5e105c99661d cdd47e0b8597b02c38527c577ae28aed 00000000000000000000000000000000
+m    pcmpeqq 9c423a145875f5144ccc5e105c99661d cdd47e0b8597b02c38527c577ae28aed 00000000000000000000000000000000
+r    pcmpeqq e77b184466b967d624750ac67ebe825f 2533f6bc813a13365b808a28feded669 00000000000000000000000000000000
+m    pcmpeqq e77b184466b967d624750ac67ebe825f 2533f6bc813a13365b808a28feded669 00000000000000000000000000000000
+r    pcmpeqq a353e8d137de89d3071b5bad6b52ee61 5c979f40cdc58392364fbbe21b8d12fc 00000000000000000000000000000000
+m    pcmpeqq a353e8d137de89d3071b5bad6b52ee61 5c979f40cdc58392364fbbe21b8d12fc 00000000000000000000000000000000
+r    pcmpeqq 2d16a827667197b8d187cbb340606850 d04b750405c33deba68d8a6feefdf8d2 00000000000000000000000000000000
+m    pcmpeqq 2d16a827667197b8d187cbb340606850 d04b750405c33deba68d8a6feefdf8d2 00000000000000000000000000000000
+r    pcmpeqq e11053b38ffdcd305e88d8c318f5aa57 dc9d7472c7c07dee870474bd92394516 00000000000000000000000000000000
+m    pcmpeqq e11053b38ffdcd305e88d8c318f5aa57 dc9d7472c7c07dee870474bd92394516 00000000000000000000000000000000
+r    pcmpeqq 1b8ce6e04f0e66e85555555555555555 dbd798f8ac487f465555555555555555 0000000000000000ffffffffffffffff
+m    pcmpeqq 1b8ce6e04f0e66e85555555555555555 dbd798f8ac487f465555555555555555 0000000000000000ffffffffffffffff
+r    pcmpeqq 55555555555555553175b6b243e17860 55555555555555550ccf8549bf47029a ffffffffffffffff0000000000000000
+m    pcmpeqq 55555555555555553175b6b243e17860 55555555555555550ccf8549bf47029a ffffffffffffffff0000000000000000
+r    pcmpeqq 913db0cc02f1b3c72ff97f68cd517cb9 263641f8552cb7a768bca55e8030eb32 00000000000000000000000000000000
+m    pcmpeqq 913db0cc02f1b3c72ff97f68cd517cb9 263641f8552cb7a768bca55e8030eb32 00000000000000000000000000000000
+r    pcmpeqq 850ae0642ddae0466041d5d9cb7738db 2af3bd4b509e6608a513cfe482162be8 00000000000000000000000000000000
+m    pcmpeqq 850ae0642ddae0466041d5d9cb7738db 2af3bd4b509e6608a513cfe482162be8 00000000000000000000000000000000