aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--target/i386/ops_sse.h8
1 files changed, 6 insertions, 2 deletions
diff --git a/target/i386/ops_sse.h b/target/i386/ops_sse.h
index 05b170125a..9f1b35194c 100644
--- a/target/i386/ops_sse.h
+++ b/target/i386/ops_sse.h
@@ -2040,10 +2040,14 @@ static inline unsigned pcmpxstrx(CPUX86State *env, Reg *d, Reg *s,
}
break;
case 3:
- for (j = valids; j >= 0; j--) {
+ if (validd == -1) {
+ res = (2 << upper) - 1;
+ break;
+ }
+ for (j = valids - validd; j >= 0; j--) {
res <<= 1;
v = 1;
- for (i = MIN(valids - j, validd); i >= 0; i--) {
+ for (i = validd; i >= 0; i--) {
v &= (pcmp_val(s, ctrl, i + j) == pcmp_val(d, ctrl, i));
}
res |= v;