From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:34295) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VPf28-0001i8-4x for qemu-devel@nongnu.org; Fri, 27 Sep 2013 16:53:12 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VPf1y-0001Y1-QH for qemu-devel@nongnu.org; Fri, 27 Sep 2013 16:53:04 -0400 Received: from mail-ye0-x236.google.com ([2607:f8b0:4002:c04::236]:44135) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VPf1y-0001Xv-LM for qemu-devel@nongnu.org; Fri, 27 Sep 2013 16:52:54 -0400 Received: by mail-ye0-f182.google.com with SMTP id l10so1033419yen.41 for ; Fri, 27 Sep 2013 13:52:54 -0700 (PDT) Sender: Richard Henderson Message-ID: <5245F022.3090300@twiddle.net> Date: Fri, 27 Sep 2013 13:52:50 -0700 From: Richard Henderson MIME-Version: 1.0 References: <1380242934-20953-1-git-send-email-agraf@suse.de> <1380242934-20953-44-git-send-email-agraf@suse.de> In-Reply-To: <1380242934-20953-44-git-send-email-agraf@suse.de> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH 43/60] AArch64: Add cinc instruction emulation List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Alexander Graf Cc: Peter Maydell , Michael Matz , qemu-devel@nongnu.org, C Fontana , Dirk Mueller , Laurent Desnogues , Christoffer Dall On 09/26/2013 05:48 PM, Alexander Graf wrote: > +uint64_t HELPER(cinc)(uint32_t pstate, uint32_t insn, uint64_t n, uint64_t m) > +{ > + bool else_inc = get_bits(insn, 10, 1); > + int cond = get_bits(insn, 12, 4); > + bool else_inv = get_bits(insn, 30, 1); > + bool is_32bit = !get_bits(insn, 31, 1); > + uint64_t r; > + > + if (helper_cond(pstate, cond)) { > + r = n; > + goto out; > + } > + > + r = m; > + if (else_inv) { > + r = ~r; > + } > + if (else_inc) { > + r++; > + } > + > +out: > + if (is_32bit) { > + r = (uint32_t)r; > + } > + > + return r; > +} Better to properly decode this during translate. And it's easy to do everything you need via setcond and movcond. r~