From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:41239) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Zyeeg-0001m5-Jl for qemu-devel@nongnu.org; Tue, 17 Nov 2015 06:42:35 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Zyeed-0000nu-Ec for qemu-devel@nongnu.org; Tue, 17 Nov 2015 06:42:34 -0500 Received: from mail-wm0-x234.google.com ([2a00:1450:400c:c09::234]:34393) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Zyeed-0000nh-8H for qemu-devel@nongnu.org; Tue, 17 Nov 2015 06:42:31 -0500 Received: by wmvv187 with SMTP id v187so222787081wmv.1 for ; Tue, 17 Nov 2015 03:42:30 -0800 (PST) Sender: Richard Henderson From: Richard Henderson Date: Tue, 17 Nov 2015 12:41:47 +0100 Message-Id: <1447760507-26104-1-git-send-email-rth@twiddle.net> Subject: [Qemu-devel] [PATCH] target-i386: Fix mulx for identical target regs List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: pbonzini@redhat.com, ehabkost@redhat.com The Intel specification clearly indicates that the low part of the result is written first and the high part of the result is written second; thus if ModRM:reg and VEX.vvvv are identical, the final result should be the high part of the result. At present, TCG may either produce incorrect results or crash with --enable-checking. Reported-by: Toni Nedialkov Reported-by: Max Reitz Signed-off-by: Richard Henderson --- target-i386/translate.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/target-i386/translate.c b/target-i386/translate.c index fbe4f80..a3dd167 100644 --- a/target-i386/translate.c +++ b/target-i386/translate.c @@ -3848,8 +3848,10 @@ static void gen_sse(CPUX86State *env, DisasContext *s, int b, break; #ifdef TARGET_X86_64 case MO_64: - tcg_gen_mulu2_i64(cpu_regs[s->vex_v], cpu_regs[reg], + tcg_gen_mulu2_i64(cpu_T[0], cpu_T[1], cpu_T[0], cpu_regs[R_EDX]); + tcg_gen_mov_i64(cpu_regs[s->vex_v], cpu_T[0]); + tcg_gen_mov_i64(cpu_regs[reg], cpu_T[1]); break; #endif } -- 2.4.3