From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:60002) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZyaZM-0005Qa-QZ for qemu-devel@nongnu.org; Tue, 17 Nov 2015 02:20:52 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZyaZH-0000nS-UH for qemu-devel@nongnu.org; Tue, 17 Nov 2015 02:20:48 -0500 Received: from mail-wm0-x22b.google.com ([2a00:1450:400c:c09::22b]:38465) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZyaZH-0000nO-Np for qemu-devel@nongnu.org; Tue, 17 Nov 2015 02:20:43 -0500 Received: by wmec201 with SMTP id c201so12201935wme.1 for ; Mon, 16 Nov 2015 23:20:42 -0800 (PST) Sender: Richard Henderson References: <1447731653-4861-1-git-send-email-mreitz@redhat.com> From: Richard Henderson Message-ID: <564AD53A.1070009@twiddle.net> Date: Tue, 17 Nov 2015 08:20:26 +0100 MIME-Version: 1.0 In-Reply-To: <1447731653-4861-1-git-send-email-mreitz@redhat.com> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH] target-i386: Fix mulx for identical target List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Max Reitz , qemu-devel@nongnu.org Cc: Paolo Bonzini , Eduardo Habkost , Toni Nedialkov On 11/17/2015 04:40 AM, Max Reitz wrote: > - tcg_gen_mulu2_i64(cpu_regs[s->vex_v], cpu_regs[reg], > - cpu_T[0], cpu_regs[R_EDX]); > + tcg_gen_op3_i64(INDEX_op_mul_i64, cpu_regs[s->vex_v], > + cpu_T[0], cpu_regs[R_EDX]); > + if (TCG_TARGET_HAS_muluh_i64) { > + tcg_gen_op3_i64(INDEX_op_muluh_i64, cpu_regs[reg], > + cpu_T[0], cpu_regs[R_EDX]); > + } else { > + gen_helper_muluh_i64(cpu_regs[reg], > + cpu_T[0], cpu_regs[R_EDX]); > + } This is not the correct fix. I do see the operand write order present in the pseudo-code of the intel manual. So that part of the diagnosis is fine. But the correct solution is to put the outputs of tcg_gen_mulu2 into temporaries (cpu_T[0] and cpu_T[1]) and then afterward write back the results into the architectual registers in the correct order. r~