From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:47408) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VohSs-0003BG-CS for qemu-devel@nongnu.org; Thu, 05 Dec 2013 17:32:15 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VohSn-0003ce-DZ for qemu-devel@nongnu.org; Thu, 05 Dec 2013 17:32:10 -0500 Received: from mail-pb0-f49.google.com ([209.85.160.49]:40526) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VohSn-0003cW-78 for qemu-devel@nongnu.org; Thu, 05 Dec 2013 17:32:05 -0500 Received: by mail-pb0-f49.google.com with SMTP id jt11so26770423pbb.36 for ; Thu, 05 Dec 2013 14:32:03 -0800 (PST) MIME-Version: 1.0 In-Reply-To: <52A0FD9D.4000104@twiddle.net> References: <1386280289-27636-1-git-send-email-peter.maydell@linaro.org> <1386280289-27636-2-git-send-email-peter.maydell@linaro.org> <52A0FD9D.4000104@twiddle.net> From: Peter Maydell Date: Thu, 5 Dec 2013 22:31:42 +0000 Message-ID: Content-Type: text/plain; charset=UTF-8 Subject: Re: [Qemu-devel] [PATCH 01/13] target-arm: A64: add support for conditional select List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Richard Henderson Cc: Patch Tracking , Michael Matz , QEMU Developers , Claudio Fontana , Dirk Mueller , Will Newton , Laurent Desnogues , =?UTF-8?B?QWxleCBCZW5uw6ll?= , "kvmarm@lists.cs.columbia.edu" , Christoffer Dall On 5 December 2013 22:26, Richard Henderson wrote: > On 12/06/2013 10:51 AM, Peter Maydell wrote: >> + if (cond >= 0x0e) { /* condition "always" */ >> + tcg_src = read_cpu_reg(s, rn, sf); >> + tcg_gen_mov_i64(tcg_rd, tcg_src); > > I wonder if it's worth adding that 0x0[ef] case to the generic condition > processing rather than keep replicating it everywhere. > >> + } else { >> + /* OPTME: we could use movcond here, at the cost of duplicating >> + * a lot of the arm_gen_test_cc() logic. >> + */ > > Honestly, arm_gen_test_cc should get refactored to a real test (as opposed to > branch) sooner rather than later. By "sooner rather than later" do you mean "as part of this patch series" ? > Longer term it's probably worth recognizing the special case of Rm==31 && > Rn==31 && else_inc as setcond as opposed to movcond. > >> + arm_gen_test_cc(cond, label_match); >> + /* nomatch: */ >> + tcg_src = read_cpu_reg(s, rm, sf); >> + tcg_gen_mov_i64(tcg_rd, tcg_src); >> + if (else_inv) { >> + tcg_gen_not_i64(tcg_rd, tcg_rd); >> + } >> + if (else_inc) { >> + tcg_gen_addi_i64(tcg_rd, tcg_rd, 1); >> + } > > I think better as > > if (else_inv && else_inc) { > tcg_gen_neg_i64(tcg_rd, tcg_src); > } else if (else_inv) { > tcg_gen_not_i64(tcg_rd, tcg_src); > } else if (else_inc) { > tcg_gen_addi_i64(tcg_rd, tcg_src, 1); > } else { > tcg_gen_mov_i64(tcg_rd, tcg_src); > } > >> + if (!sf) { >> + tcg_gen_ext32u_i64(tcg_rd, tcg_rd); >> + } > > I do wonder about the usefulness of passing SF (as opposed to hardcoding 1) to > read_cpu_reg to begin, since the ext32u that it generates is redundant with the > one here at the end, and likely cannot be optimized away. Mmm. I did think that was a little unfortunate but didn't think of the idea of just passing 1 to read_cpu_reg() for some reason. -- PMM