Patchwork [08/10] target-i386: SSE4.2: fix pcmpXstrX instructions with "Masked(-)" polarity

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

Comments

Aurelien Jarno - March 26, 2013, 7:01 p.m.
valids can equals to -1 if the reg/mem string is empty. Change the
expression to have an empty xor mask in that case.

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:20 p.m.
On 03/26/2013 12:01 PM, Aurelien Jarno wrote:
> valids can equals to -1 if the reg/mem string is empty. Change the
> expression to have an empty xor mask in that case.
> 
> 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 77ab410..a0bac07 100644
--- a/target-i386/ops_sse.h
+++ b/target-i386/ops_sse.h
@@ -2050,7 +2050,7 @@  static inline unsigned pcmpxstrx(CPUX86State *env, Reg *d, Reg *s,
         res ^= (2 << upper) - 1;
         break;
     case 3:
-        res ^= (2 << valids) - 1;
+        res ^= (1 << (valids + 1)) - 1;
         break;
     }