Patchwork [06/10] target-i386: SSE4.2: fix pcmpXstrX instructions in "Equal each" mode

login
register
mail settings
Submitter Aurelien Jarno
Date March 26, 2013, 7:01 p.m.
Message ID <1364324502-9124-7-git-send-email-aurelien@aurel32.net>
Download mbox | patch
Permalink /patch/231519/
State New
Headers show

Comments

Aurelien Jarno - March 26, 2013, 7:01 p.m.
pcmpXstrX instructions in "Equal each" mode force both invalid element
pair to true. It means (upper - MAX(valids, validd)) bits should be set
to 1, not (upper - MAX(valids, validd) + 1).

Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
---
 target-i386/ops_sse.h |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
Richard Henderson - March 27, 2013, 8:15 p.m.
On 03/26/2013 12:01 PM, Aurelien Jarno wrote:
> pcmpXstrX instructions in "Equal each" mode force both invalid element
> pair to true. It means (upper - MAX(valids, validd)) bits should be set
> to 1, not (upper - MAX(valids, validd) + 1).
> 
> Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
> ---
>  target-i386/ops_sse.h |    2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

Reviewed-by: Richard Henderson <rth@twiddle.net>


r~

Patch

diff --git a/target-i386/ops_sse.h b/target-i386/ops_sse.h
index 51c5fc9..2fc5fdd 100644
--- a/target-i386/ops_sse.h
+++ b/target-i386/ops_sse.h
@@ -2025,7 +2025,7 @@  static inline unsigned pcmpxstrx(CPUX86State *env, Reg *d, Reg *s,
         }
         break;
     case 2:
-        res = (2 << (upper - MAX(valids, validd))) - 1;
+        res = (1 << (upper - MAX(valids, validd))) - 1;
         res <<= MAX(valids, validd) - MIN(valids, validd);
         for (i = MIN(valids, validd); i >= 0; i--) {
             res <<= 1;