From patchwork Thu Oct 26 00:14:47 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 738231 Delivered-To: patch@linaro.org Received: by 2002:adf:f842:0:b0:32d:baff:b0ca with SMTP id d2csp555373wrq; Wed, 25 Oct 2023 17:27:07 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEZ+uWLIiK1caU8i7D0BHedfexvEk4IiGBrrvAeSBIJEhbpuNfW55BQH3QcQTpC3Q+/+6Ba X-Received: by 2002:a17:907:1c0b:b0:9be:45b3:1c3c with SMTP id nc11-20020a1709071c0b00b009be45b31c3cmr15046087ejc.64.1698280026985; Wed, 25 Oct 2023 17:27:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698280026; cv=none; d=google.com; s=arc-20160816; b=z4FmbloXnjS8573sYtJGvQTRpN+Di1gUZe6kZvTecIGKdjcys1B5Y24lSM7YGnOBKG CautEASTkM7Kh8LsWZxMHN/hK+srozrY46LzeHzfUyIbx0gDBOckU1s8A798S3GQ9TwG cD2auNFZRhgCfV9MBW5o1PrpCb5mg526PJM1YcVSR0/njBSA5pfs5iQbMkfW6LyhMGpv gPZcoVP1penG2TqK3QCLF5YsOIJPHC1PvG9hxnhguFitZ74yOTZCeCHqpOuDpPWSEfCT joaUgaZ0sG1NYP/YdEQO8SXfgm+XvT636z1y2UFweaEHao+2GsDA6j6/EoEjD9C7YOVw Gzmw== 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=8tOhWbytnEkVCtnvtdU0qc/aSyodbka2sUWdoaMkej8=; fh=rYI8DiHAAFX3O5g969KmOAQ7d45Sb8OxQX1+DywGDk4=; b=NZg5wG8GLExWCPEa9mtB02XAo/V2y61SoCSQNfn0A26sXk5mnI/XGf/pVneqenaBYN OFfu499crQCwj4z9nkgcrNc5K7Dh11x8pnJeNpckZYZYsJQrETLU83UENC0DyAKqmDw8 MRNi7Fs5W1FSiU/5Bey/C9TNwXh5UB4SymAOW7RBYRJq4Ur11hIQHfPYvBOVQbxjk+x+ kEc6/kR8A+R089x0DKpt/khfRA80oEwBOtR5NtZ1QZhP28vsV+hUxght0pl0jDsEfwHt bB+HmUP+M35Bd5zxsH7XDkMparU/PQ4fNyxGzW9CwVRYYpA9V1U1rm3UJSN/ndmR9mp2 8oYA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=N+3oggYk; 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 my12-20020a1709065a4c00b009c76096cb97si5841297ejc.133.2023.10.25.17.27.06 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 25 Oct 2023 17:27:06 -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=N+3oggYk; 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 1qvo6o-0002GX-HA; Wed, 25 Oct 2023 20:20: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 1qvo6I-0001GG-GR for qemu-devel@nongnu.org; Wed, 25 Oct 2023 20:19:50 -0400 Received: from mail-pl1-x630.google.com ([2607:f8b0:4864:20::630]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qvo6A-0006lF-7F for qemu-devel@nongnu.org; Wed, 25 Oct 2023 20:19:50 -0400 Received: by mail-pl1-x630.google.com with SMTP id d9443c01a7336-1c9bca1d96cso2187975ad.3 for ; Wed, 25 Oct 2023 17:19:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1698279580; x=1698884380; 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=8tOhWbytnEkVCtnvtdU0qc/aSyodbka2sUWdoaMkej8=; b=N+3oggYkzPVVA2F2TNgSeX3CtAiU17KstwO34PBLAJ5cxh3DNLa32Jv7hXXFBwWgbo SsX4euR8l9UMTn6ATVBanFRr5Yys90MYY42Q4x+Gwk6cPMD9mZkVga56zwHLPyvCeKK7 Sk6D7L4i0m1B5ayZJxMnCgCOo5N3LCUOuUS8jMUElORijhnpdbs5Y2N+wyxD0mhvRS3h hvH7euu3Z2bV1uI2c1MloYMzfvpNkneZPAGkKPwHUIwSBQd4N8ayk8i9321wZ7kTRhC3 dEhHRmpm2XTo9Vj9iU8b7U8fiE0NBHVLS/89klk0N7T+zcvrT68xltgjgCcY8Si/heIw oAaA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1698279580; x=1698884380; 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=8tOhWbytnEkVCtnvtdU0qc/aSyodbka2sUWdoaMkej8=; b=JI0/pCO0olozaWv4KwPhSGL+H01xZprqfCEHm3wpcJ7u1Z2s6x6CbSpRR5OZtmlD5B DgiAFmDglRMWW6+vB6sSWlpWBkx2LMANfEmWTakWrAhKGZ9yxkiILXPzeZQpbQXW+FP4 M3z9cGjwTDfpTw17ZSQ9NMvUQlE0TmTfU8o+NTaRIGjX1YZA3r63eXf9PdvWhoU1oL+b dWIy2KtLV16kVXsbk2rouYABvG0pUlAjQLskJK7az2F4LB5fIueDqYOhQZcmoDYy9va9 XIxmjpHmbYtludzCWxD0//JkaVNDmcp5+Uvp79RnQxbxbvSeYFkcJBMuvNPuJ7hMwDYY c6oA== X-Gm-Message-State: AOJu0YwEHw5ueJi7eCu/zvtDXRrOikLpuYObv3JeaakIekVRTW/3k/9T aoOuoTj5fedbamDPnmDoj9oMZBuSEK8Cyu5YVF4= X-Received: by 2002:a17:902:f550:b0:1ca:8541:e1ea with SMTP id h16-20020a170902f55000b001ca8541e1eamr15875325plf.0.1698279580514; Wed, 25 Oct 2023 17:19:40 -0700 (PDT) Received: from stoup.. ([71.212.149.95]) by smtp.gmail.com with ESMTPSA id jh1-20020a170903328100b001c5fc291ef9sm9754655plb.209.2023.10.25.17.19.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 25 Oct 2023 17:19:40 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: Mark Cave-Ayland Subject: [PULL 39/94] target/sparc: Move UDIV, SDIV to decodetree Date: Wed, 25 Oct 2023 17:14:47 -0700 Message-Id: <20231026001542.1141412-69-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::630; envelope-from=richard.henderson@linaro.org; helo=mail-pl1-x630.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 | 2 ++ target/sparc/helper.c | 4 --- target/sparc/translate.c | 54 ++++++++++++++++++--------------------- 3 files changed, 27 insertions(+), 33 deletions(-) diff --git a/target/sparc/insns.decode b/target/sparc/insns.decode index dd0ed3a993..4415d03858 100644 --- a/target/sparc/insns.decode +++ b/target/sparc/insns.decode @@ -173,6 +173,8 @@ SMUL 10 ..... 0.1011 ..... . ............. @r_r_ri_cc 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 Tcc_r 10 0 cond:4 111010 rs1:5 0 cc:1 0000000 rs2:5 { diff --git a/target/sparc/helper.c b/target/sparc/helper.c index c4358bba84..e25fdaeedd 100644 --- a/target/sparc/helper.c +++ b/target/sparc/helper.c @@ -102,9 +102,7 @@ static target_ulong do_udiv(CPUSPARCState *env, target_ulong a, } if (cc) { - env->cc_dst = x0; env->cc_src2 = overflow; - env->cc_op = CC_OP_DIV; } return x0; } @@ -143,9 +141,7 @@ static target_ulong do_sdiv(CPUSPARCState *env, target_ulong a, } if (cc) { - env->cc_dst = x0; env->cc_src2 = overflow; - env->cc_op = CC_OP_DIV; } return x0; } diff --git a/target/sparc/translate.c b/target/sparc/translate.c index 826ba0441b..1ebaaa1114 100644 --- a/target/sparc/translate.c +++ b/target/sparc/translate.c @@ -710,6 +710,26 @@ static void gen_op_sdivx(TCGv dst, TCGv src1, TCGv src2) gen_helper_sdivx(dst, tcg_env, src1, src2); } +static void gen_op_udiv(TCGv dst, TCGv src1, TCGv src2) +{ + gen_helper_udiv(dst, tcg_env, src1, src2); +} + +static void gen_op_sdiv(TCGv dst, TCGv src1, TCGv src2) +{ + gen_helper_sdiv(dst, tcg_env, src1, src2); +} + +static void gen_op_udivcc(TCGv dst, TCGv src1, TCGv src2) +{ + gen_helper_udiv_cc(dst, tcg_env, src1, src2); +} + +static void gen_op_sdivcc(TCGv dst, TCGv src1, TCGv src2) +{ + gen_helper_sdiv_cc(dst, tcg_env, src1, src2); +} + // 1 static void gen_op_eval_ba(TCGv dst) { @@ -2919,6 +2939,7 @@ static void gen_faligndata(TCGv dst, TCGv gsr, TCGv s1, TCGv s2) #ifdef TARGET_SPARC64 # define avail_32(C) false # define avail_ASR17(C) false +# define avail_DIV(C) true # define avail_MUL(C) true # define avail_POWERDOWN(C) false # define avail_64(C) true @@ -2927,6 +2948,7 @@ static void gen_faligndata(TCGv dst, TCGv gsr, TCGv s1, TCGv s2) #else # define avail_32(C) true # define avail_ASR17(C) ((C)->def->features & CPU_FEATURE_ASR17) +# define avail_DIV(C) ((C)->def->features & CPU_FEATURE_DIV) # define avail_MUL(C) ((C)->def->features & CPU_FEATURE_MUL) # define avail_POWERDOWN(C) ((C)->def->features & CPU_FEATURE_POWERDOWN) # define avail_64(C) false @@ -4136,6 +4158,8 @@ TRANS(SMUL, MUL, do_logic, a, gen_op_smul, NULL) TRANS(UDIVX, 64, do_arith, a, -1, gen_op_udivx, NULL, NULL) TRANS(SDIVX, 64, do_arith, a, -1, gen_op_sdivx, NULL, NULL) +TRANS(UDIV, DIV, do_arith, a, CC_OP_DIV, gen_op_udiv, NULL, gen_op_udivcc) +TRANS(SDIV, DIV, do_arith, a, CC_OP_DIV, gen_op_sdiv, NULL, gen_op_sdivcc) static bool trans_OR(DisasContext *dc, arg_r_r_ri_cc *a) { @@ -4623,35 +4647,7 @@ static void disas_sparc_legacy(DisasContext *dc, unsigned int insn) #endif } else if (xop < 0x36) { if (xop < 0x20) { - cpu_src1 = get_src1(dc, insn); - cpu_src2 = get_src2(dc, insn); - switch (xop & ~0x10) { - case 0xe: /* udiv */ - CHECK_IU_FEATURE(dc, DIV); - if (xop & 0x10) { - gen_helper_udiv_cc(cpu_dst, tcg_env, cpu_src1, - cpu_src2); - dc->cc_op = CC_OP_DIV; - } else { - gen_helper_udiv(cpu_dst, tcg_env, cpu_src1, - cpu_src2); - } - break; - case 0xf: /* sdiv */ - CHECK_IU_FEATURE(dc, DIV); - if (xop & 0x10) { - gen_helper_sdiv_cc(cpu_dst, tcg_env, cpu_src1, - cpu_src2); - dc->cc_op = CC_OP_DIV; - } else { - gen_helper_sdiv(cpu_dst, tcg_env, cpu_src1, - cpu_src2); - } - break; - default: - goto illegal_insn; - } - gen_store_gpr(dc, rd, cpu_dst); + goto illegal_insn; } else { cpu_src1 = get_src1(dc, insn); cpu_src2 = get_src2(dc, insn);