1
Description: upstream patch, modified to fit version 3.7.0
2
Emulation of PCMPxSTRx mode 0x0C was wrong
3
for searching an empty needle in an empty haystack.
4
Applied-Upstream: 3.8.0
6
Author: Josef Weidendorfer <Josef.Weidendorfer@gmx.de>
7
Bug-Ubuntu: https://bugs.launchpad.net/ubuntu/+source/valgrind/+bug/1027977
8
Bug: https://bugs.kde.org/show_bug.cgi?id=303963
10
diff --git a/VEX/priv/guest_generic_x87.c b/VEX/priv/guest_generic_x87.c
11
index a10f869..ae627f6 100644
12
--- a/VEX/priv/guest_generic_x87.c
13
+++ b/VEX/priv/guest_generic_x87.c
14
@@ -815,9 +815,6 @@ Bool compute_PCMPxSTRx ( /*OUT*/V128* resV,
15
UInt validL = ~(zmaskL | -zmaskL); // not(left(zmaskL))
16
UInt validR = ~(zmaskR | -zmaskR); // not(left(zmaskR))
17
for (hi = 0; hi < 16; hi++) {
18
- if ((validL & (1 << hi)) == 0)
19
- // run off the end of the haystack
22
for (ni = 0; ni < 16; ni++) {
23
if ((validR & (1 << ni)) == 0) break;
24
@@ -826,6 +826,9 @@ Bool compute_PCMPxSTRx ( /*OUT*/V128* resV,
25
if (argL[i] != argR[ni]) { m = 0; break; }
28
+ if ((validL & (1 << hi)) == 0)
29
+ // run off the end of the haystack
33
// boolRes is "pre-invalidated"