From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:58227) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WS6rc-0004qK-1V for qemu-devel@nongnu.org; Mon, 24 Mar 2014 11:32:40 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WS6rR-0000or-R1 for qemu-devel@nongnu.org; Mon, 24 Mar 2014 11:32:35 -0400 Received: from lhrrgout.huawei.com ([194.213.3.17]:60170) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WS6rR-0000ol-JO for qemu-devel@nongnu.org; Mon, 24 Mar 2014 11:32:25 -0400 Message-ID: <53304FD9.5040503@huawei.com> Date: Mon, 24 Mar 2014 16:31:37 +0100 From: Claudio Fontana MIME-Version: 1.0 References: <1394851732-25692-1-git-send-email-rth@twiddle.net> <1394851732-25692-10-git-send-email-rth@twiddle.net> In-Reply-To: <1394851732-25692-10-git-send-email-rth@twiddle.net> Content-Type: text/plain; charset="ISO-8859-1" Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH 09/26] tcg-aarch64: Create tcg_out_brcond List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Richard Henderson , qemu-devel@nongnu.org Cc: peter.maydell@linaro.org, claudio.fontana@gmail.com On 15.03.2014 03:48, Richard Henderson wrote: > Rearrange code to put the compare and branch in the same place. > > Signed-off-by: Richard Henderson > --- > tcg/aarch64/tcg-target.c | 34 ++++++++++++++-------------------- > 1 file changed, 14 insertions(+), 20 deletions(-) > > diff --git a/tcg/aarch64/tcg-target.c b/tcg/aarch64/tcg-target.c > index 6d8b666..44d53aa 100644 > --- a/tcg/aarch64/tcg-target.c > +++ b/tcg/aarch64/tcg-target.c > @@ -862,18 +862,6 @@ static inline void tcg_out_goto_cond_noaddr(TCGContext *s, TCGCond c) > tcg_out_insn(s, 3202, B_C, c, old); > } > > -static inline void tcg_out_goto_cond(TCGContext *s, TCGCond c, intptr_t target) > -{ > - intptr_t offset = (target - (intptr_t)s->code_ptr) / 4; > - > - if (offset < -0x40000 || offset >= 0x40000) { > - /* out of 19bit range */ > - tcg_abort(); > - } > - > - tcg_out_insn(s, 3202, B_C, c, offset); > -} > - > static inline void tcg_out_callr(TCGContext *s, TCGReg reg) > { > tcg_out_insn(s, 3207, BLR, reg); > @@ -917,17 +905,24 @@ static inline void tcg_out_goto_label(TCGContext *s, int label_index) > } > } > > -static inline void tcg_out_goto_label_cond(TCGContext *s, > - TCGCond c, int label_index) > +static void tcg_out_brcond(TCGContext *s, TCGMemOp ext, TCGCond c, TCGArg a, > + TCGArg b, bool b_const, int label) > { > - TCGLabel *l = &s->labels[label_index]; > + TCGLabel *l = &s->labels[label]; > + intptr_t offset; > + > + tcg_out_cmp(s, ext, a, b, b_const); > > if (!l->has_value) { > - tcg_out_reloc(s, s->code_ptr, R_AARCH64_CONDBR19, label_index, 0); > - tcg_out_goto_cond_noaddr(s, c); > + tcg_out_reloc(s, s->code_ptr, R_AARCH64_CONDBR19, label, 0); > + offset = tcg_in32(s) >> 5; > } else { > - tcg_out_goto_cond(s, c, l->u.value); > + offset = l->u.value - (uintptr_t)s->code_ptr; > + offset >>= 2; > + assert(offset >= -0x40000 && offset < 0x40000); > } > + > + tcg_out_insn(s, 3202, B_C, c, offset); > } > > static inline void tcg_out_rev(TCGContext *s, TCGType ext, > @@ -1568,8 +1563,7 @@ static void tcg_out_op(TCGContext *s, TCGOpcode opc, > a1 = (int32_t)a1; > /* FALLTHRU */ > case INDEX_op_brcond_i64: > - tcg_out_cmp(s, ext, a0, a1, const_args[1]); > - tcg_out_goto_label_cond(s, a2, args[3]); > + tcg_out_brcond(s, ext, a2, a0, a1, const_args[1], args[3]); > break; > > case INDEX_op_setcond_i32: > Reviewed-by: Claudio Fontana