From patchwork Fri Oct 13 21:27:55 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 733282 Delivered-To: patch@linaro.org Received: by 2002:a5d:54d1:0:b0:31d:da82:a3b4 with SMTP id x17csp1678812wrv; Fri, 13 Oct 2023 14:33:13 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEov1jvbxWf3RAhZos79fgkwMd0d9mo4noMG0xS3aacq57uMV0VxQMmVbIkED942Wy4Qeg9 X-Received: by 2002:a05:620a:22f5:b0:774:1adc:c572 with SMTP id p21-20020a05620a22f500b007741adcc572mr26065543qki.74.1697232792895; Fri, 13 Oct 2023 14:33:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697232792; cv=none; d=google.com; s=arc-20160816; b=NgKycd2SSBF9VOrLpamgP53sPzy830UeF5aZXy/w5wd1aKnI6OZLebu4WQ0D7n4g1+ fFfDPpepn4ZRlDvtoC4ETQtgYCVcwRVxPm7JbJeybr5fFjDqgirFepws2lgqBBvOsRn5 18NQKI3ADtVWH4kwxUgIHsnPe47ck12prYx3qu/UrSY4Mh1VR/kYfT5mR7VIBAjQtbrE +IPOZoVQ+NRQ2yD+J7aPdu/QXu0qmVIYRzwA0bZv9n3h8OLdWX8VklDM2UPuFmm2hwmX BOwOhay84NoueN8/uNH9wjWB4/vA5X3L3hbzecOffVw+ASHvQOUe1SOG1pUp00t6h0IH d1+A== 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=x+Po0tdVkDRqVAnCRFhdgPPaFsI/xFw6qDs18ZteNnU=; fh=OY/jf0qYEhT53LcIJp8d/e39mN3vEzshkseI36O8N8s=; b=YjcjGk3p24xJwA5csx/JOuaxB0DqFc0XIuM2aKJDkeJjybH9c8no/9EXQaor9lFvH3 Wg+qHj/Bjqbu+jPo+6XRMs2y3i2g0yF1C8CQ4Y9836Q8MIcut005oQdzf5buh/3/oSgI xkIpBFxDWFuo9VFIyiPLNDypGtsjo3FFWc0NlLiMr609sW48gflj+LcCDZl+wxNEIzX0 UhbFqpH2NmlWo4pS8svm75Ya0h7lBuvTvQ/AIngfRkiu2Qtu/SFGnv/RaTBOPXjVmu/v IZI7A6i8g+LhwleIGviXxDeQ8vYTshHdE2ZDoIGTFS0YA/gjlXxtf5Wc4ATn7ikx/5Sl aGGw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Pp4URL4W; 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 s16-20020a05620a081000b007759a30f473si1831911qks.60.2023.10.13.14.33.12 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 13 Oct 2023 14:33:12 -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=Pp4URL4W; 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 1qrPin-0006OP-3W; Fri, 13 Oct 2023 17:29:25 -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 1qrPil-0006NI-5m for qemu-devel@nongnu.org; Fri, 13 Oct 2023 17:29:23 -0400 Received: from mail-pj1-x1034.google.com ([2607:f8b0:4864:20::1034]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qrPij-0000Ws-FZ for qemu-devel@nongnu.org; Fri, 13 Oct 2023 17:29:22 -0400 Received: by mail-pj1-x1034.google.com with SMTP id 98e67ed59e1d1-27d329a704bso1016455a91.0 for ; Fri, 13 Oct 2023 14:29:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1697232560; x=1697837360; 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=x+Po0tdVkDRqVAnCRFhdgPPaFsI/xFw6qDs18ZteNnU=; b=Pp4URL4WY8ggKdX/n8+rKDImxxhDvdSW5B1POmNsWLrfR8379d+OR+JE43/GA26EJO VXBq3WraXjxVTXLs/q206Hc7LkCVsecCG/gspHd+uo36W/EXADkD1ZJ0NouDPT3n91Zl WJg2ml3JI8E6wplgnhglzPqYkSbbicGfQ7psoH359Fsb0ZRuRcsz6WL1e1kse+eXMKR9 7Ejpi3cdW0LIqNfYylSENp0KcSZW19cG2HjhDvPNQ8KbGduADQ6p9G0nXda0A4ZEpEYS LEGuwGOovVjEk/xifRo7gQFZWEySyT92URxFnk+hmuqyPWogwlUD+iEl1m25bZt90PMW Vb0g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697232560; x=1697837360; 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=x+Po0tdVkDRqVAnCRFhdgPPaFsI/xFw6qDs18ZteNnU=; b=GGUfTgNh3p+xiv2Ti37/w8P0/mBqMVuiBMYlflsK9G7QQLQwSqiiBOKWrM2Ok0Ns0z S4NMvqYlcGPedhJMSBZA4YrfKYwungW6age8FAFNTn8IgLNt8z7CshcNmZyx3SyUNsk+ mOF7jQfBxxorfIiPLsz1Fos/1A30BfqMW+aGmyz3A3AdJbnlPacxXCAI4gZ6745HW6zr jf6a539ozN7MKLe0r7J8+8lc5erpWE6X/lZcgeglDJBzoF7fiHY9nfre4emf/7WxYvBE EhrpQmFOBAkcO6FsBE/bF9UK+NAzMsLXq0JsFgXhQHm7Qpv/Fbr4nbmZBnfQUJpLtA7r U/GQ== X-Gm-Message-State: AOJu0Yx0fNXWvv0iOWbEcHzEhAgrCCywEXRt5NzBkktf8LMaJqtLD2J+ 5s0DIpPbVkyYIVSwyDXpZM6grv6tWUJlGncGDLM= X-Received: by 2002:a17:90a:194:b0:27d:1d52:98e8 with SMTP id 20-20020a17090a019400b0027d1d5298e8mr6108907pjc.21.1697232560211; Fri, 13 Oct 2023 14:29:20 -0700 (PDT) Received: from stoup.. ([71.212.149.95]) by smtp.gmail.com with ESMTPSA id b185-20020a6334c2000000b0058988954686sm70753pga.90.2023.10.13.14.29.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 13 Oct 2023 14:29:19 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: mark.cave-ayland@ilande.co.uk, atar4qemu@gmail.com Subject: [PATCH 34/85] target/sparc: Move POPC to decodetree Date: Fri, 13 Oct 2023 14:27:55 -0700 Message-Id: <20231013212846.165724-35-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231013212846.165724-1-richard.henderson@linaro.org> References: <20231013212846.165724-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::1034; envelope-from=richard.henderson@linaro.org; helo=mail-pj1-x1034.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 Signed-off-by: Richard Henderson --- target/sparc/insns.decode | 1 + target/sparc/translate.c | 54 +++++---------------------------------- 2 files changed, 8 insertions(+), 47 deletions(-) diff --git a/target/sparc/insns.decode b/target/sparc/insns.decode index 1f6dfa210f..7ec1518b54 100644 --- a/target/sparc/insns.decode +++ b/target/sparc/insns.decode @@ -192,6 +192,7 @@ TSUBcc 10 ..... 100001 ..... . ............. @r_r_ri TADDccTV 10 ..... 100010 ..... . ............. @r_r_ri TSUBccTV 10 ..... 100011 ..... . ............. @r_r_ri MULScc 10 ..... 100100 ..... . ............. @r_r_ri +POPC 10 rd:5 101110 00000 imm:1 rs2_or_imm:s13 &r_r_ri rs1=0 &shiftr rd rs1 rs2 x:bool @shiftr .. rd:5 ...... rs1:5 . x:1 ....... rs2:5 &shiftr diff --git a/target/sparc/translate.c b/target/sparc/translate.c index 81a2518498..caa2eff626 100644 --- a/target/sparc/translate.c +++ b/target/sparc/translate.c @@ -665,6 +665,11 @@ static void gen_op_tsubcctv(TCGv dst, TCGv src1, TCGv src2) gen_helper_tsubcctv(dst, tcg_env, src1, src2); } +static void gen_op_popc(TCGv dst, TCGv src1, TCGv src2) +{ + tcg_gen_ctpop_tl(dst, src2); +} + // 1 static void gen_op_eval_ba(TCGv dst) { @@ -2629,19 +2634,6 @@ static TCGv get_src1(DisasContext *dc, unsigned int insn) return gen_load_gpr(dc, rs1); } -static TCGv get_src2(DisasContext *dc, unsigned int insn) -{ - if (IS_IMM) { /* immediate */ - target_long simm = GET_FIELDs(insn, 19, 31); - TCGv t = tcg_temp_new(); - tcg_gen_movi_tl(t, simm); - return t; - } else { /* register */ - unsigned int rs2 = GET_FIELD(insn, 27, 31); - return gen_load_gpr(dc, rs2); - } -} - #ifdef TARGET_SPARC64 static void gen_fmovs(DisasContext *dc, DisasCompare *cmp, int rd, int rs) { @@ -4188,6 +4180,7 @@ TRANS(UDIVX, 64, do_arith, a, gen_op_udivx, NULL) TRANS(SDIVX, 64, do_arith, a, gen_op_sdivx, NULL) TRANS(UDIV, ALL, do_arith, a, gen_op_udiv, NULL) TRANS(SDIV, ALL, do_arith, a, gen_op_sdiv, NULL) +TRANS(POPC, 64, do_arith, a, gen_op_popc, NULL) TRANS(ADDcc, ALL, do_cc_arith, a, CC_OP_ADD, gen_op_add_cc, NULL) TRANS(ANDcc, ALL, do_cc_arith, a, CC_OP_LOGIC, tcg_gen_and_tl, tcg_gen_andi_tl) @@ -4744,40 +4737,7 @@ static void disas_sparc_legacy(DisasContext *dc, unsigned int insn) goto illegal_insn; } } else if (xop < 0x36) { - if (xop < 0x20) { - goto illegal_insn; - } else { - cpu_src1 = get_src1(dc, insn); - cpu_src2 = get_src2(dc, insn); - switch (xop) { - case 0x20: /* taddcc */ - case 0x21: /* tsubcc */ - case 0x22: /* taddcctv */ - case 0x23: /* tsubcctv */ - case 0x24: /* mulscc */ - case 0x25: /* sll */ - case 0x26: /* srl */ - case 0x27: /* sra */ - goto illegal_insn; /* in decodetree */ - case 0x30: - goto illegal_insn; /* WRASR in decodetree */ - case 0x32: - goto illegal_insn; /* WRPR in decodetree */ - case 0x33: /* wrtbr, UA2005 wrhpr */ - goto illegal_insn; /* WRTBR, WRHPR in decodetree */ -#ifdef TARGET_SPARC64 - case 0x2c: /* V9 movcc */ - case 0x2f: /* V9 movr */ - goto illegal_insn; /* in decodetree */ - case 0x2e: /* V9 popc */ - tcg_gen_ctpop_tl(cpu_dst, cpu_src2); - gen_store_gpr(dc, rd, cpu_dst); - break; -#endif - default: - goto illegal_insn; - } - } + goto illegal_insn; /* in decodetree */ } else if (xop == 0x36) { /* UltraSparc shutdown, VIS, V8 CPop1 */ #ifdef TARGET_SPARC64 int opf = GET_FIELD_SP(insn, 5, 13);