Received: from eggs.gnu.org ([208.118.235.92]:38903) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UKZ8D-0004tu-JQ for qemu-devel@nongnu.org; Tue, 26 Mar 2013 15:02:04 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UKZ8A-0005rs-JA for qemu-devel@nongnu.org; Tue, 26 Mar 2013 15:02:01 -0400 Received: from hall.aurel32.net ([2001:470:1f15:c4f::1]:49213) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UKZ8A-0005oA-Ab for qemu-devel@nongnu.org; Tue, 26 Mar 2013 15:01:58 -0400 From: Aurelien Jarno Date: Tue, 26 Mar 2013 20:01:35 +0100 Message-Id: <1364324502-9124-4-git-send-email-aurelien@aurel32.net> In-Reply-To: <1364324502-9124-1-git-send-email-aurelien@aurel32.net> References: <1364324502-9124-1-git-send-email-aurelien@aurel32.net> Subject: [Qemu-devel] [PATCH 03/10] target-i386: SSE4.2: fix pcmpXstri instructions List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Aurelien Jarno ffs1 returns the first bit set to one starting counting from the most significant bit. pcmpXstri returns the most significant bit set to one, starting counting from the least significant bit. Signed-off-by: Aurelien Jarno --- target-i386/ops_sse.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/target-i386/ops_sse.h b/target-i386/ops_sse.h index 0136df9..0667c87 100644 --- a/target-i386/ops_sse.h +++ b/target-i386/ops_sse.h @@ -2099,7 +2099,7 @@ void glue(helper_pcmpestri, SUFFIX)(CPUX86State *env, Reg *d, Reg *s, pcmp_elen(env, R_EAX, ctrl)); if (res) { - env->regs[R_ECX] = ((ctrl & (1 << 6)) ? rffs1 : ffs1)(res) - 1; + env->regs[R_ECX] = (ctrl & (1 << 6)) ? rffs1(res) - 1 : 32 - ffs1(res); } else { env->regs[R_ECX] = 16 >> (ctrl & (1 << 0)); } @@ -2137,7 +2137,7 @@ void glue(helper_pcmpistri, SUFFIX)(CPUX86State *env, Reg *d, Reg *s, pcmp_ilen(d, ctrl)); if (res) { - env->regs[R_ECX] = ((ctrl & (1 << 6)) ? rffs1 : ffs1)(res) - 1; + env->regs[R_ECX] = (ctrl & (1 << 6)) ? rffs1(res) - 1 : 32 - ffs1(res); } else { env->regs[R_ECX] = 16 >> (ctrl & (1 << 0)); } -- 1.7.10.4