From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:48773) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bQ7wu-000572-IY for qemu-devel@nongnu.org; Thu, 21 Jul 2016 02:59:13 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bQ7wq-0007iA-KZ for qemu-devel@nongnu.org; Thu, 21 Jul 2016 02:59:12 -0400 Sender: Richard Henderson References: <1468861517-2508-1-git-send-email-nikunj@linux.vnet.ibm.com> <1468861517-2508-12-git-send-email-nikunj@linux.vnet.ibm.com> <76ff3a65-4055-3c26-fef1-6c4ad6536326@twiddle.net> From: Richard Henderson Message-ID: Date: Thu, 21 Jul 2016 12:29:00 +0530 MIME-Version: 1.0 In-Reply-To: <76ff3a65-4055-3c26-fef1-6c4ad6536326@twiddle.net> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [RFC v1 11/13] target-ppc: add maddld instruction List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Nikunj A Dadhania , qemu-ppc@nongnu.org, david@gibson.dropbear.id.au Cc: qemu-devel@nongnu.org, aneesh.kumar@linux.vnet.ibm.com On 07/21/2016 12:24 PM, Richard Henderson wrote: > On 07/18/2016 10:35 PM, Nikunj A Dadhania wrote: >> +static void gen_maddld(DisasContext *ctx) >> +{ >> + TCGv_i64 lo = tcg_temp_new_i64(); >> + TCGv_i64 hi = tcg_temp_new_i64(); >> + TCGv_i64 t1 = tcg_temp_new_i64(); >> + TCGv_i64 t2 = tcg_temp_new_i64(); >> + TCGv_i64 zero = tcg_const_i64(0); >> + TCGv_i64 neg = tcg_const_i64(-1); >> + >> + if (Rc(ctx->opcode)) { >> + tcg_gen_muls2_i64(lo, hi, cpu_gpr[rA(ctx->opcode)], >> + cpu_gpr[rB(ctx->opcode)]); >> + tcg_gen_movi_i64(t2, -1); >> + tcg_gen_movcond_i64(TCG_COND_GE, t2, cpu_gpr[rC(ctx->opcode)], zero, >> zero, neg); >> + } >> + tcg_gen_mov_i64(t1, zero); >> + tcg_gen_add2_i64(cpu_gpr[rD(ctx->opcode)], t1, lo, hi, >> cpu_gpr[rC(ctx->opcode)], t2); >> + tcg_temp_free_i64(lo); >> + tcg_temp_free_i64(hi); >> + tcg_temp_free_i64(t1); >> + tcg_temp_free_i64(t2); >> + tcg_temp_free_i64(zero); >> + tcg_temp_free_i64(neg); >> +} > > None of this double-word arithmetic is required. > This produces a truncated 64-bit result; the high bits aren't used. > > Why the conditional on Rc? I see no special case for R0. Answering my own question, this is the low bit of the opcode, not rC. Anyway, the conditional is still pointless, because the lsb of the opcode is always set, unlike the high-part multiplies. r~