From patchwork Sun Oct 22 05:59:37 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 736988 Delivered-To: patch@linaro.org Received: by 2002:adf:dd81:0:b0:32d:baff:b0ca with SMTP id x1csp1006164wrl; Sat, 21 Oct 2023 23:14:05 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFdz/XrjT0Bc5pEnKZuvXHjDMhtNOySklxxHf+OU+GhIRGQ9dI+EkYFAyK/0OulBBGfDUBj X-Received: by 2002:a05:6214:242a:b0:658:71e1:5490 with SMTP id gy10-20020a056214242a00b0065871e15490mr8485625qvb.21.1697955244876; Sat, 21 Oct 2023 23:14:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697955244; cv=none; d=google.com; s=arc-20160816; b=k9dojguWbXlpFtCKMJD+66/LEFrlavtpay5pkE/fYmlv1FlJdTmaXk65vRl8MXv9HK reuBH5tSqHOcLrypZestMwmdT+uKJrwp/ikgdOTf4ZxoddD8wYadwjl3FPhN1y6B6aMj s4r2N5aOH1tAl21+36HbyGqwA6fDpQ/xPupFgQ0+12vNmpPkFV+/xaaEJR+3paowlf7R nXHosEuNFDpRlEFcMERjuQCNqBI2lq6GHZsbabf1kJK9hFxzeOiwz4RzfhcLjxQNnc+B bXxLgj5vMT6XuBjHpI+qM4BsA3UdD0k8cowZc1bavFIdSezqA5uOR45XdcU5dtOfw610 6YqA== 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=HXkD+rvdqzNALKCxEFa+poT9hkB/xVhRGYWjgXIaYq4=; fh=TYrED6TOMxGX0VC4GtjviASLbYyJe19+7/tKWjN44KQ=; b=OqX+7GneuAJQFjgUtBB+1j2hNSOpWRN3YflGPXRWqaRcu1H4RltCMGcB2bVs1I3oiR idYrQaHLAjeXV2HPjdM1FgzxacMsBU75z4PNjOLwRjtKxsE80qusoAxdoQ8X5eonapRS BgO5ZKortYHw7g/RkhdaahI7kUc6V0uNxpPL7L1erYPYDUg8RBBK7RRHWpakuDdzZwvY 1njV5cdZtaItjGwhZSM1wkh+63TZM+n4Lm/BNMgYV5DnghmpKdHpiFNtF0cDaWAqCQ9v oyLtatO+/m76ZxHMDiyCfdiLpQPMBgGoZOZhAob9toc51wUt4u0QariBztFCH7FtIgFt cMqQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=TGUKwl3o; 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 cs3-20020ad44c43000000b0065af2299bafsi3826806qvb.276.2023.10.21.23.14.04 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sat, 21 Oct 2023 23:14:04 -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=TGUKwl3o; 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 1quRX0-0001S5-Ld; Sun, 22 Oct 2023 02:01:46 -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 1quRWs-00012e-9D for qemu-devel@nongnu.org; Sun, 22 Oct 2023 02:01:38 -0400 Received: from mail-pf1-x436.google.com ([2607:f8b0:4864:20::436]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1quRWn-0001hy-Gm for qemu-devel@nongnu.org; Sun, 22 Oct 2023 02:01:38 -0400 Received: by mail-pf1-x436.google.com with SMTP id d2e1a72fcca58-6b20a48522fso1749191b3a.1 for ; Sat, 21 Oct 2023 23:01:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1697954492; x=1698559292; 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=HXkD+rvdqzNALKCxEFa+poT9hkB/xVhRGYWjgXIaYq4=; b=TGUKwl3oNRaaLI9crKrBfogw2s7Rob0Z3Vyq7udlk6E7/BytehU26A5Q1YxbvLVgqZ AbN39OKg2oPZvB+OI/FtFiCX8PzPdkkkomo5RRCVAdMBUZstA0Kifl5UVGVyrURhbPUM c2Vj6PcVlmskWQp0FGlKmtsYZnb1wJ1XUiv5dwyTlDcrZu4QrxXZ21pP58dbZxLGg/CF 3NTz2zIg/rYr+dWiylqbycWo/GnZeYkitenrKjqjC3xGG8CltT9FUvTBj6k5TDVnOQgc vqP9AidxmY+KzTW2pdvVIu+8dejBfWD+8W/oYwH0cSnPRTiAFshHfLSOnpSgJhExIRVC k3Cg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697954492; x=1698559292; 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=HXkD+rvdqzNALKCxEFa+poT9hkB/xVhRGYWjgXIaYq4=; b=RTfUWCkhmY9BxN+CZKvGGqSLWkWxnXSBzM8ReIU8VcCFl3NHM5KDCb+1D8uI9rSPhF jqEKLaw5kyaFne7zB4CqiKywA5vizRwqWuKVbzokNJ4Z9u0eFOAb7JNltY+AZebYUxm6 gb/MnIe/L+Fl7o+0sXNKoGn+15L+FT7AZSgxOSFEHL7zWWGKJBi3BF1MWCtrMvJ4vaMY 2FsqkVcysQ22ts624OHzwUQdtEGQlpA2Rbuou/GP4DyCz7LevNsLerYp4HMp18XU+U7o 25rE4GOUQYbYSEs3qC/7hIHgVv7i0d1PEXRZXCtPsvRLszMVENa/fZJMOmlezg+8nROo nS7g== X-Gm-Message-State: AOJu0YxVR0dMpA/mT4kLxN/BJqCiCypdPkyY989IHSr+9bfKzLbPOL24 qkkdmt/tBa8VxkeYV7DYzhRiJgpRm093gZUOWGo= X-Received: by 2002:a17:902:cec9:b0:1c9:b207:d412 with SMTP id d9-20020a170902cec900b001c9b207d412mr4342129plg.37.1697954492309; Sat, 21 Oct 2023 23:01:32 -0700 (PDT) Received: from stoup.. ([71.212.149.95]) by smtp.gmail.com with ESMTPSA id je17-20020a170903265100b001c728609574sm3999887plb.6.2023.10.21.23.01.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 21 Oct 2023 23:01:31 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: mark.cave-ayland@ilande.co.uk Subject: [PATCH v4 36/90] target/sparc: Move TADD, TSUB, MULS to decodetree Date: Sat, 21 Oct 2023 22:59:37 -0700 Message-Id: <20231022060031.490251-37-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231022060031.490251-1-richard.henderson@linaro.org> References: <20231022060031.490251-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::436; envelope-from=richard.henderson@linaro.org; helo=mail-pf1-x436.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, T_SPF_TEMPERROR=0.01 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 Signed-off-by: Richard Henderson --- target/sparc/insns.decode | 7 ++++++ target/sparc/helper.c | 4 ---- target/sparc/translate.c | 48 ++++++++++++++++++--------------------- 3 files changed, 29 insertions(+), 30 deletions(-) diff --git a/target/sparc/insns.decode b/target/sparc/insns.decode index 4415d03858..b35921aabb 100644 --- a/target/sparc/insns.decode +++ b/target/sparc/insns.decode @@ -32,6 +32,7 @@ CALL 01 i:s30 &r_r_ri_cc rd rs1 rs2_or_imm imm:bool cc:bool @r_r_ri_cc .. rd:5 . cc:1 .... rs1:5 imm:1 rs2_or_imm:s13 &r_r_ri_cc @r_r_ri_cc0 .. rd:5 ...... rs1:5 imm:1 rs2_or_imm:s13 &r_r_ri_cc cc=0 +@r_r_ri_cc1 .. rd:5 ...... rs1:5 imm:1 rs2_or_imm:s13 &r_r_ri_cc cc=1 { [ @@ -170,12 +171,18 @@ SUBC 10 ..... 0.1100 ..... . ............. @r_r_ri_cc MULX 10 ..... 001001 ..... . ............. @r_r_ri_cc0 UMUL 10 ..... 0.1010 ..... . ............. @r_r_ri_cc SMUL 10 ..... 0.1011 ..... . ............. @r_r_ri_cc +MULScc 10 ..... 100100 ..... . ............. @r_r_ri_cc1 UDIVX 10 ..... 001101 ..... . ............. @r_r_ri_cc0 SDIVX 10 ..... 101101 ..... . ............. @r_r_ri_cc0 UDIV 10 ..... 0.1110 ..... . ............. @r_r_ri_cc SDIV 10 ..... 0.1111 ..... . ............. @r_r_ri_cc +TADDcc 10 ..... 100000 ..... . ............. @r_r_ri_cc1 +TSUBcc 10 ..... 100001 ..... . ............. @r_r_ri_cc1 +TADDccTV 10 ..... 100010 ..... . ............. @r_r_ri_cc1 +TSUBccTV 10 ..... 100011 ..... . ............. @r_r_ri_cc1 + Tcc_r 10 0 cond:4 111010 rs1:5 0 cc:1 0000000 rs2:5 { # For v7, the entire simm13 field is present, but masked to 7 bits. diff --git a/target/sparc/helper.c b/target/sparc/helper.c index e25fdaeedd..2bcdc81d54 100644 --- a/target/sparc/helper.c +++ b/target/sparc/helper.c @@ -198,10 +198,8 @@ target_ulong helper_taddcctv(CPUSPARCState *env, target_ulong src1, } /* Only modify the CC after any exceptions have been generated. */ - env->cc_op = CC_OP_TADDTV; env->cc_src = src1; env->cc_src2 = src2; - env->cc_dst = dst; return dst; tag_overflow: @@ -226,10 +224,8 @@ target_ulong helper_tsubcctv(CPUSPARCState *env, target_ulong src1, } /* Only modify the CC after any exceptions have been generated. */ - env->cc_op = CC_OP_TSUBTV; env->cc_src = src1; env->cc_src2 = src2; - env->cc_dst = dst; return dst; tag_overflow: diff --git a/target/sparc/translate.c b/target/sparc/translate.c index efe62e3d59..179f991c5d 100644 --- a/target/sparc/translate.c +++ b/target/sparc/translate.c @@ -717,6 +717,16 @@ static void gen_op_sdivcc(TCGv dst, TCGv src1, TCGv src2) gen_helper_sdiv_cc(dst, tcg_env, src1, src2); } +static void gen_op_taddcctv(TCGv dst, TCGv src1, TCGv src2) +{ + gen_helper_taddcctv(dst, tcg_env, src1, src2); +} + +static void gen_op_tsubcctv(TCGv dst, TCGv src1, TCGv src2) +{ + gen_helper_tsubcctv(dst, tcg_env, src1, src2); +} + // 1 static void gen_op_eval_ba(TCGv dst) { @@ -4273,6 +4283,11 @@ TRANS(UDIV, DIV, do_arith, a, CC_OP_DIV, TRANS(SDIV, DIV, do_arith, a, CC_OP_DIV, a->cc ? gen_op_sdivcc : gen_op_sdiv, NULL) +TRANS(TADDcc, ALL, do_arith, a, CC_OP_TADD, gen_op_add_cc, NULL) +TRANS(TSUBcc, ALL, do_arith, a, CC_OP_TSUB, gen_op_sub_cc, NULL) +TRANS(TADDccTV, ALL, do_arith, a, CC_OP_TADDTV, gen_op_taddcctv, NULL) +TRANS(TSUBccTV, ALL, do_arith, a, CC_OP_TSUBTV, gen_op_tsubcctv, NULL) + static bool trans_OR(DisasContext *dc, arg_r_r_ri_cc *a) { /* OR with %g0 is the canonical alias for MOV. */ @@ -4370,6 +4385,12 @@ static bool trans_SUBC(DisasContext *dc, arg_r_r_ri_cc *a) return do_arith(dc, a, CC_OP_SUBX, func, NULL); } +static bool trans_MULScc(DisasContext *dc, arg_r_r_ri_cc *a) +{ + update_psr(dc); + return do_arith(dc, a, CC_OP_ADD, gen_op_mulscc, NULL); +} + #define CHECK_IU_FEATURE(dc, FEATURE) \ if (!((dc)->def->features & CPU_FEATURE_ ## FEATURE)) \ goto illegal_insn; @@ -4797,36 +4818,11 @@ static void disas_sparc_legacy(DisasContext *dc, unsigned int insn) cpu_src2 = get_src2(dc, insn); switch (xop) { case 0x20: /* taddcc */ - gen_op_add_cc(cpu_dst, cpu_src1, cpu_src2); - gen_store_gpr(dc, rd, cpu_dst); - tcg_gen_movi_i32(cpu_cc_op, CC_OP_TADD); - dc->cc_op = CC_OP_TADD; - break; case 0x21: /* tsubcc */ - gen_op_sub_cc(cpu_dst, cpu_src1, cpu_src2); - gen_store_gpr(dc, rd, cpu_dst); - tcg_gen_movi_i32(cpu_cc_op, CC_OP_TSUB); - dc->cc_op = CC_OP_TSUB; - break; case 0x22: /* taddcctv */ - gen_helper_taddcctv(cpu_dst, tcg_env, - cpu_src1, cpu_src2); - gen_store_gpr(dc, rd, cpu_dst); - dc->cc_op = CC_OP_TADDTV; - break; case 0x23: /* tsubcctv */ - gen_helper_tsubcctv(cpu_dst, tcg_env, - cpu_src1, cpu_src2); - gen_store_gpr(dc, rd, cpu_dst); - dc->cc_op = CC_OP_TSUBTV; - break; case 0x24: /* mulscc */ - update_psr(dc); - gen_op_mulscc(cpu_dst, cpu_src1, cpu_src2); - gen_store_gpr(dc, rd, cpu_dst); - tcg_gen_movi_i32(cpu_cc_op, CC_OP_ADD); - dc->cc_op = CC_OP_ADD; - break; + goto illegal_insn; /* in decodetree */ #ifndef TARGET_SPARC64 case 0x25: /* sll */ if (IS_IMM) { /* immediate */