Patchwork [02/10] target-i386: SSE4.2: fix pcmpgtq instruction

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

Comments

Aurelien Jarno - March 26, 2013, 7:01 p.m.
The "Intel 64 and IA-32 Architectures Software Developer's Manual" (at
least recent versions) clearly says that the comparison is signed.

Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
---
 target-i386/ops_sse.h |    3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
Richard Henderson - March 27, 2013, 8:03 p.m.
On 03/26/2013 12:01 PM, Aurelien Jarno wrote:
> The "Intel 64 and IA-32 Architectures Software Developer's Manual" (at
> least recent versions) clearly says that the comparison is signed.
> 
> Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
> ---
>  target-i386/ops_sse.h |    3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)

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


r~

Patch

diff --git a/target-i386/ops_sse.h b/target-i386/ops_sse.h
index cad9d75..0136df9 100644
--- a/target-i386/ops_sse.h
+++ b/target-i386/ops_sse.h
@@ -1933,8 +1933,7 @@  void glue(helper_mpsadbw, SUFFIX)(CPUX86State *env, Reg *d, Reg *s,
 }
 
 /* SSE4.2 op helpers */
-/* it's unclear whether signed or unsigned */
-#define FCMPGTQ(d, s) (d > s ? -1 : 0)
+#define FCMPGTQ(d, s) ((int64_t)d > (int64_t)s ? -1 : 0)
 SSE_HELPER_Q(helper_pcmpgtq, FCMPGTQ)
 
 static inline int pcmp_elen(CPUX86State *env, int reg, uint32_t ctrl)