From patchwork Sun Oct 22 23:28:12 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 737038 Delivered-To: patch@linaro.org Received: by 2002:adf:dd81:0:b0:32d:baff:b0ca with SMTP id x1csp1282721wrl; Sun, 22 Oct 2023 16:33:24 -0700 (PDT) X-Google-Smtp-Source: AGHT+IG+toT0tc2ApCNvOGmXqZnJwfzWF1HM+CHt5O5zIAvKpo+v3ROYShqUhZV0Q/SmpwDiA/o+ X-Received: by 2002:a05:6214:23c9:b0:66d:2064:c7ee with SMTP id hr9-20020a05621423c900b0066d2064c7eemr10741256qvb.20.1698017604401; Sun, 22 Oct 2023 16:33:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698017604; cv=none; d=google.com; s=arc-20160816; b=urXYV3Pdu494Cx8A5klBXjpNk9LMnpfSgGxNl4jFWbn1xvt5X+43LKjcAj+MR1vrgu jwUPnoouMD7uALhP8kc7U3z4NNa9JDGre1aSED5DZ9dj3eD+VeAOCnkqLbWC0/y1ExgT eWqJ7brAlEszfJmSDjfrgGzeFFPTH4+lEuHkCtbOcryFS5ZbMAxLm4+Koj643Isxrsmo sUevvMhmL1ljRT0DuUKpuCGVpBuxZkhATQ2Yf8V4iZuPiPF8oz2HSAyv4fhk07cUK2C5 1VfD9sHa8yKIVTCm63f55mxvksSHzea1SXcmISUl62powxVi4H3TCX+MYM4lMstdABRU mCYA== 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=TYrED6TOMxGX0VC4GtjviASLbYyJe19+7/tKWjN44KQ=; b=cqT8s0XMIH3xezYL5dOC+rVLwuakV1WTKTqbT7L2xmBs92OTO4DXnXY/MaQsmaw7wH wzqKBoewpk2yIpFLv+uhx1x/ftvv5ozRtjVVHevE8DISnLi3tXIfYRYLIMe0hkP5Mj0q GHXXTbpGdoT2tCxVLQzevu96p/eRF34DwvtggY4k7lkM9kpEOt4kgu7IpzYXk+llNVrj pKuavwewEt676W4//b0YsjePxyt7cCrCqvGBsCWFVprisptlqZPnkm4JBzkAAknDF6sl etUJqQ4IX5mSoB22d9nINGgObug33dBCKv3HuF6GcUzMkNWNJg/PuGEThc9/x7Thi9ZN OpgA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=l5i87dq8; 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 o3-20020ac85a43000000b0041cbf262514si4782720qta.19.2023.10.22.16.33.24 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sun, 22 Oct 2023 16:33:24 -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=l5i87dq8; 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 1quhtP-00079m-EG; Sun, 22 Oct 2023 19:29:59 -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 1quhtI-00077N-SB for qemu-devel@nongnu.org; Sun, 22 Oct 2023 19:29:52 -0400 Received: from mail-il1-x130.google.com ([2607:f8b0:4864:20::130]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1quhtD-0006jQ-EG for qemu-devel@nongnu.org; Sun, 22 Oct 2023 19:29:51 -0400 Received: by mail-il1-x130.google.com with SMTP id e9e14a558f8ab-3514bf96fd2so10123685ab.0 for ; Sun, 22 Oct 2023 16:29:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1698017386; x=1698622186; 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=l5i87dq85mYrE3TcLC3x442/KyoppR9lcGyoee6UyKWEajLLazj7j48l1HaoKc2Pxt hKEv9K4Ik7NUXD7FRYX/mjpXiWzfPY3WXSCcccLX09BQX8Htpyo6ASrGZ+X5sznjQ85h U0Ez4UzMme9JyKswfb/QlC9inQKEvzkpijXiwskQxAR6jpFHwd2fquJ0bt/E1Ilj0szF 1/UiK1jjO1w41XBZvr8xitXHQHZItKcwIecCt5DEp8FdHjUxKmROfrvOpBODcRLx+yGo q1OzrP/Im0LnG0v5/93Pdu6CV4g1JVMlW/ZRilFxf6qrZTtStZ6WPrJb/6wbrp1uiCHH ORkw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1698017386; x=1698622186; 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=hub2EI+nYkyn/2ir8hjRSyZ0MNMI6MdNBHaR7WSTlr5zt0zXMFqItSCXA1i8AIvA8D +cV6TaUF5DF+ZsMX69jxxgvas544VI8UwOFXxlfb71i2qvepuQdMSTnDRA5SR+U1hA52 hsQmBPnzK93xXHetsHCqZU0rmArpCAuCPwvgxjyLlVh1RC35YVKexX+MV3XYhPiBD1j6 4E9ycIuQiId1HK7X0VKG/IMfW2ic3UVLQ0udipbtCTJEd1TqS+AOG9uqcRmJzEGhZzfR qXjkG5PUx0EeDCqfjOiynYXgmnZJ+BKrv0XG0xsACeaDwBRjxi4OkzlB3alCNUDwqZrW SEGw== X-Gm-Message-State: AOJu0YzcxEScrcpIxkYPqW/ZDgbDHzlMRelaPpUA36aBgB+0660zO1zO UisHOQwt+ODs4oS9Xd9wZltx+n6y6dcwxLRfEcg= X-Received: by 2002:a92:cc43:0:b0:357:61d7:200f with SMTP id t3-20020a92cc43000000b0035761d7200fmr8394875ilq.12.1698017386156; Sun, 22 Oct 2023 16:29:46 -0700 (PDT) Received: from stoup.. ([71.212.149.95]) by smtp.gmail.com with ESMTPSA id k26-20020a63ba1a000000b005b25a04cf8bsm4023772pgf.12.2023.10.22.16.29.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 22 Oct 2023 16:29:45 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: mark.cave-ayland@ilande.co.uk Subject: [PATCH v5 14/94] target/sparc: Move BPr to decodetree Date: Sun, 22 Oct 2023 16:28:12 -0700 Message-Id: <20231022232932.80507-15-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231022232932.80507-1-richard.henderson@linaro.org> References: <20231022232932.80507-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::130; envelope-from=richard.henderson@linaro.org; helo=mail-il1-x130.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);