From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:46583) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Vorq6-00069K-CX for qemu-devel@nongnu.org; Fri, 06 Dec 2013 04:36:55 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Vorq1-0006gH-Ay for qemu-devel@nongnu.org; Fri, 06 Dec 2013 04:36:50 -0500 Received: from static.88-198-71-155.clients.your-server.de ([88.198.71.155]:37809 helo=socrates.bennee.com) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Vorq1-0006gB-4N for qemu-devel@nongnu.org; Fri, 06 Dec 2013 04:36:45 -0500 References: <1386280289-27636-1-git-send-email-peter.maydell@linaro.org> <1386280289-27636-3-git-send-email-peter.maydell@linaro.org> <52A10093.3030708@twiddle.net> From: Alex =?utf-8?Q?Benn=C3=A9e?= In-reply-to: <52A10093.3030708@twiddle.net> Date: Fri, 06 Dec 2013 09:36:40 +0000 Message-ID: <87d2la9v87.fsf@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Subject: Re: [Qemu-devel] [PATCH 02/13] target-arm: A64: add support for logical (shifted register) List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Richard Henderson Cc: Peter Maydell , patches@linaro.org, Michael Matz , qemu-devel@nongnu.org, Claudio Fontana , Dirk Mueller , Will Newton , Laurent Desnogues , kvmarm@lists.cs.columbia.edu, Christoffer Dall rth@twiddle.net writes: > On 12/06/2013 10:51 AM, Peter Maydell wrote: >> + if (invert) { >> + tcg_gen_not_i64(tcg_rm, tcg_rm); >> + } >> + >> + tcg_rd = cpu_reg(s, rd); >> + tcg_rn = cpu_reg(s, rn); >> + >> + switch (opc) { >> + case 0: /* AND, BIC */ >> + case 3: /* ANDS, BICS */ >> + tcg_gen_and_i64(tcg_rd, tcg_rn, tcg_rm); >> + break; >> + case 1: /* ORR, ORN */ >> + tcg_gen_or_i64(tcg_rd, tcg_rn, tcg_rm); >> + break; >> + case 2: /* EOR, EON */ >> + tcg_gen_xor_i64(tcg_rd, tcg_rn, tcg_rm); >> + break; >> + default: >> + assert(FALSE); >> + break; >> + } > > While correct, surely better to work with tcg and select on opc:invert to > generate andc/orc/eqv? Shouldn't the TCG optimiser/back-end just be smart enough to figure it out? It seems clearer to express the tcg ops in terms of the front-end's meaning? > Also, isn't MOV (register) canonical for ORR (rn=31 && shift_amount=0), and MVN > (register) canonical for ORN (rn=31 && shift_amount=0), and both therefore also > worth a special case? I suspect I'm being overly cheeky to expect the optimiser to detect and optimise for that case as the ZR is a const ;-) Cheers, -- Alex Bennée QEMU/KVM Hacker for Linaro