From patchwork Thu Oct 26 00:14:06 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 738199 Delivered-To: patch@linaro.org Received: by 2002:adf:f842:0:b0:32d:baff:b0ca with SMTP id d2csp553556wrq; Wed, 25 Oct 2023 17:21:35 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFsRs/n72Ur7bG4x1CZGVs7Vhv23wLR/2ZMKwiefBB5KKOEXPGMmqGZvUobL8ao0pTjshpj X-Received: by 2002:a05:651c:152:b0:2b9:ecab:d924 with SMTP id c18-20020a05651c015200b002b9ecabd924mr12863941ljd.18.1698279695281; Wed, 25 Oct 2023 17:21:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698279695; cv=none; d=google.com; s=arc-20160816; b=G4SGoYt+ME/29cI8UijYIJNt+D5aWyHKh1PPuoTUm0ecbIqE6dV5Fl8d5Y+1CA74kx JwRmUyyC1lgI1TGo2YNFwyt9AZEKcH/WOXicqRMK4powKo//nlpKR5zsLX3+nFLV4cWi of2xFj0XRFjGKVkDZ3MZ82wZ06oAEFPkSPLUEIM7IX6K6EoRDPHjUmQerQfUZV8Lcxdc iFcU0+mbQ/mb/uB1DjPdz1HxurM1Ntq/S8M90DsvSftfvdHu2+PRatqGIA8HSUUgBjBU 75mf7yYVvcSHHpXL8SIgMpc5ae2IG4dbol2kntMcBw+KDQt8Asq/fxVAS+Iv1lTns7EN ptcA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=CKN37OBBkB+L9M8Uud4wSltlqA9gDCBy4N29LWBC2UM=; fh=rYI8DiHAAFX3O5g969KmOAQ7d45Sb8OxQX1+DywGDk4=; b=Y/bs3QfSDTQPf/17o5Rp3OcT3WV8yStpX1yQQidcqykg0LFSshnak6uw63+MQ9xH5p p6QqY6ZS1Ffv/yxoDeijDgK5Fawl9ip5Z7b4Oxpzc83aFyLIHVPc8D6TqSZQcLrFjsR0 Gxuzv6TcJlgLgA/2X/XMP49xT2vGa/rLuGSPVDG999yw1goCfD5id+AZrppxY5IM6e6O r9GtlI5QSzDP6BKIB03zctizRghdEZNHh0ZmCTwI8M2YR6p/xaikMY2Fk6zPXK1kwz3h JGTAlCApzkgKVepDUelQ8zkw2w9BsR9a7BwQwjbMIMeaYfNovOtrkXzukQwN/GLWshSE MugQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=gb8OB9vd; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id u9-20020a05600c19c900b00405407aa08dsi816298wmq.0.2023.10.25.17.21.34 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 25 Oct 2023 17:21:35 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=gb8OB9vd; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qvo2w-0007Ho-Je; Wed, 25 Oct 2023 20:16:22 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qvo2p-000743-P0 for qemu-devel@nongnu.org; Wed, 25 Oct 2023 20:16:15 -0400 Received: from mail-pl1-x634.google.com ([2607:f8b0:4864:20::634]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qvo2i-0004sS-Lg for qemu-devel@nongnu.org; Wed, 25 Oct 2023 20:16:15 -0400 Received: by mail-pl1-x634.google.com with SMTP id d9443c01a7336-1c9c5a1b87bso2037525ad.3 for ; Wed, 25 Oct 2023 17:16:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1698279366; x=1698884166; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=CKN37OBBkB+L9M8Uud4wSltlqA9gDCBy4N29LWBC2UM=; b=gb8OB9vd+OqAgyJ52POzt2CgjmEixh99F2rpkWmZwzl2RCesMU5yeNslCz4aRj+TYv TMbQAYEG7Yn8PxYrcyxCgokWVRtAJBb8E3r1lLDNG3ceM/tfZgZRSfvvFWAa8wLpiMgR rPNo00voahOsKWBebfWKV6let9l/Or8kfJJOaXwuygIdmyd3AtKCNGIY553YZ2/l83hm fioYQNPhkjaNyH7E1BulAObj0VZVCTXua0guX+zCZFJLoFMDzSC+fExM6yfYmJBBqiYc G+oPHmWMWe0O9DKLod+zA2l1NGsKNpZW6Bur25Q2FvHcUDY4jK3RamhZXSEhxfI9jDew 22mQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1698279366; x=1698884166; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=CKN37OBBkB+L9M8Uud4wSltlqA9gDCBy4N29LWBC2UM=; b=mfdwOcoghu8ApA5qRjnBPYTFaJezLSWjThBVvtLycwgfnHXlVpRcPHBUybGPAgjt7y E3tphL1fEFnIsd3pn4+Z5HejzRKWIjh9r3d+ITSjASXTOyD1RTHk1v3xh00yO/Ne3t5l HvZg1C1LiKSjpp3p30OmeY5dVJ8eVsptloqzyvmgPmQ3H1BZpnbW8J+w4lXBBDMPeAhf PTQJGfmy3x8epHRz4dM03vZ5zLQ5yyQL/QZLk1CfV0LO58Px6ut8Ku/bYWTJ840yzMax 83VshH810nV64W8APQjecmgACXp1WP1h6d2VO5DtRYq3KjEwipBzdTbxyw6ldpm2FFi+ 6U9w== X-Gm-Message-State: AOJu0YwpI+nFYUvyOGtpM8Ki8LddflZ34+HHKdKWrVEZr0AVuLtKd1+5 nN2YKrwORaszIVqfCl/43SwWqqopp6EPBOwlwX8= X-Received: by 2002:a17:902:eccb:b0:1c9:ba18:785c with SMTP id a11-20020a170902eccb00b001c9ba18785cmr17910028plh.25.1698279366306; Wed, 25 Oct 2023 17:16:06 -0700 (PDT) Received: from stoup.. ([71.212.149.95]) by smtp.gmail.com with ESMTPSA id ij23-20020a170902ab5700b001c582de968dsm10038433plb.72.2023.10.25.17.16.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 25 Oct 2023 17:16:05 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: Mark Cave-Ayland Subject: [PULL 14/94] target/sparc: Move BPr to decodetree Date: Wed, 25 Oct 2023 17:14:06 -0700 Message-Id: <20231026001542.1141412-28-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231026001542.1141412-1-richard.henderson@linaro.org> References: <20231026001542.1141412-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::634; envelope-from=richard.henderson@linaro.org; helo=mail-pl1-x634.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org Tested-by: Mark Cave-Ayland Acked-by: Mark Cave-Ayland Signed-off-by: Richard Henderson --- target/sparc/insns.decode | 3 ++ target/sparc/translate.c | 63 ++++++++++++++------------------------- 2 files changed, 25 insertions(+), 41 deletions(-) diff --git a/target/sparc/insns.decode b/target/sparc/insns.decode index 15cd975f4e..838f4cdb1d 100644 --- a/target/sparc/insns.decode +++ b/target/sparc/insns.decode @@ -7,4 +7,7 @@ BPcc 00 a:1 cond:4 001 cc:1 0 - i:s19 &bcc Bicc 00 a:1 cond:4 010 i:s22 &bcc cc=0 +%d16 20:s2 0:14 +BPr 00 a:1 0 cond:3 011 .. - rs1:5 .............. i=%d16 + CALL 01 i:s30 diff --git a/target/sparc/translate.c b/target/sparc/translate.c index 92ea6bab6b..2d08c81821 100644 --- a/target/sparc/translate.c +++ b/target/sparc/translate.c @@ -1336,14 +1336,13 @@ static void gen_fcond(TCGv r_dst, unsigned int cc, unsigned int cond) } } -#ifdef TARGET_SPARC64 // Inverted logic -static const int gen_tcg_cond_reg[8] = { - -1, +static const TCGCond gen_tcg_cond_reg[8] = { + TCG_COND_NEVER, /* reserved */ TCG_COND_NE, TCG_COND_GT, TCG_COND_GE, - -1, + TCG_COND_NEVER, /* reserved */ TCG_COND_EQ, TCG_COND_LE, TCG_COND_LT, @@ -1357,16 +1356,6 @@ static void gen_compare_reg(DisasCompare *cmp, int cond, TCGv r_src) cmp->c2 = tcg_constant_tl(0); } -static void gen_cond_reg(TCGv r_dst, int cond, TCGv r_src) -{ - DisasCompare cmp; - gen_compare_reg(&cmp, cond, r_src); - - /* The interface is to return a boolean in r_dst. */ - tcg_gen_setcond_tl(cmp.cond, r_dst, cmp.c1, cmp.c2); -} -#endif - static void do_fbranch(DisasContext *dc, int32_t offset, uint32_t insn, int cc) { unsigned int cond = GET_FIELD(insn, 3, 6), a = (insn & (1 << 29)); @@ -1406,24 +1395,6 @@ static void do_fbranch(DisasContext *dc, int32_t offset, uint32_t insn, int cc) } #ifdef TARGET_SPARC64 -static void do_branch_reg(DisasContext *dc, int32_t offset, uint32_t insn, - TCGv r_reg) -{ - unsigned int cond = GET_FIELD_SP(insn, 25, 27), a = (insn & (1 << 29)); - target_ulong target = dc->pc + offset; - - if (unlikely(AM_CHECK(dc))) { - target &= 0xffffffffULL; - } - flush_cond(dc); - gen_cond_reg(cpu_cond, cond, r_reg); - if (a) { - gen_branch_a(dc, target); - } else { - gen_branch_n(dc, target); - } -} - static void gen_op_fcmps(int fccno, TCGv_i32 r_rs1, TCGv_i32 r_rs2) { switch (fccno) { @@ -3063,6 +3034,24 @@ static bool do_bpcc(DisasContext *dc, arg_bcc *a) TRANS(Bicc, ALL, do_bpcc, a) TRANS(BPcc, 64, do_bpcc, a) +static bool trans_BPr(DisasContext *dc, arg_BPr *a) +{ + target_long target = address_mask_i(dc, dc->pc + a->i * 4); + DisasCompare cmp; + + if (!avail_64(dc)) { + return false; + } + if (gen_tcg_cond_reg[a->cond] == TCG_COND_NEVER) { + return false; + } + + flush_cond(dc); + gen_compare_reg(&cmp, a->cond, gen_load_gpr(dc, a->rs1)); + tcg_gen_setcond_tl(cmp.cond, cpu_cond, cmp.c1, cmp.c2); + return advance_jump_cond(dc, a->a, target); +} + static bool trans_CALL(DisasContext *dc, arg_CALL *a) { target_long target = address_mask_i(dc, dc->pc + a->i * 4); @@ -3102,15 +3091,7 @@ static void disas_sparc_legacy(DisasContext *dc, unsigned int insn) case 0x1: /* V9 BPcc */ g_assert_not_reached(); /* in decodetree */ case 0x3: /* V9 BPr */ - { - target = GET_FIELD_SP(insn, 0, 13) | - (GET_FIELD_SP(insn, 20, 21) << 14); - target = sign_extend(target, 16); - target <<= 2; - cpu_src1 = get_src1(dc, insn); - do_branch_reg(dc, target, insn, cpu_src1); - goto jmp_insn; - } + g_assert_not_reached(); /* in decodetree */ case 0x5: /* V9 FBPcc */ { int cc = GET_FIELD_SP(insn, 20, 21);