From patchwork Sun Oct 22 23:28:45 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 737232 Delivered-To: patch@linaro.org Received: by 2002:adf:dd81:0:b0:32d:baff:b0ca with SMTP id x1csp1284889wrl; Sun, 22 Oct 2023 16:42:31 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFhbcH2Mz8j7VG+G6rIkLY6BO4kgl0RK0qEVjyYWMCt2CvIVvSwsxWAoZ4BblNkAzABLHsn X-Received: by 2002:a05:620a:4144:b0:773:f6b6:4085 with SMTP id k4-20020a05620a414400b00773f6b64085mr7505499qko.54.1698018151310; Sun, 22 Oct 2023 16:42:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698018151; cv=none; d=google.com; s=arc-20160816; b=nnJ5QObeMOQVZvNQyc5w9Yj1RhjmEmgShf3W2rFq6C+cfEpOH1DpsOOtOfAdHeEdAZ 1skvLV+dp+fL0UPxGHiT9mQBtNE1ylY8ZY2zkD8KhvTzI/X/bSf796XqRP9YR6WM2DMq EHR5TRbqvvWn5kEkFyqwQGJRPG8xK9nsZ+C2XaSsHhjnrvTp8QVLo4uAzm1dmPsCg38g ppgP5JPh3iq5EF0gFDB1iCCNqBNIDpbRj2kUq+hZNtyn1/OtqR4xV0yJdWYDA3FheDno mHhLGiEee9E65HBM5im37nqqOuR0XmvSOqzAfwhgzOvEVhjWKIiqWBr3PIb3CGL03Uve 8Zsg== 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=7ivu4KAoY2zfSTKzuq0lQ619NCyVi925GYe78+HLDiA=; fh=TYrED6TOMxGX0VC4GtjviASLbYyJe19+7/tKWjN44KQ=; b=nV/rvdoKJ1zwC1QS+Oolk8uP7IIhG/ErOQcCduGuziTAolb0ibHhQJ+4vDcJgVz/05 1laW0YNHcbQVKU8AQFxPDSynuR82nkek55NJj1vVvtA271pWvFmBnVGxaKUC+Z5EMCjS 8ghQwnnJxrsn3Frqhv8YmO+TuHuTIWcysiEH4A3lVNKhRoNZX5uKScRBMY2QsL8F6byF b3HEsObzHHGknCLdMhIgQUa24JZndIDrSYW8N4+hgY8ll2LfmMCoEaTUvtkyBs3NQIqG COpYthRiayaeS6ecCH3M+iNg4KLe7v/VjhJsQNzAKzObPeKiZ22+8OFVyBAtpWEzCsc4 YfVw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=kjVBuodv; 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 a8-20020a05620a102800b00773fb21ee2bsi4538301qkk.105.2023.10.22.16.42.31 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sun, 22 Oct 2023 16:42:31 -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=kjVBuodv; 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 1quhwn-0005Hc-Hl; Sun, 22 Oct 2023 19:33:29 -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 1quhwh-0004ZE-Fx for qemu-devel@nongnu.org; Sun, 22 Oct 2023 19:33:23 -0400 Received: from mail-pf1-x433.google.com ([2607:f8b0:4864:20::433]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1quhwa-0007Uz-Bk for qemu-devel@nongnu.org; Sun, 22 Oct 2023 19:33:23 -0400 Received: by mail-pf1-x433.google.com with SMTP id d2e1a72fcca58-6b1e46ca282so2735263b3a.2 for ; Sun, 22 Oct 2023 16:33:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1698017594; x=1698622394; 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=7ivu4KAoY2zfSTKzuq0lQ619NCyVi925GYe78+HLDiA=; b=kjVBuodv/xnTZlrlRlDQp/GXTHMl5olWgUw/Ey3Y50U9fByIogXZBb7tbOuBLSflQB MVe5Sh5NDkOmBULsQfEH7bOl4QCrCKcMy+a+Fv81xV7/M6OS03f+ponDzA6nkJvBDVrV rdaDLrEQ50ac4Cnr8MaFhJlrK8vtTMc2g/Mpd/oookhvtgynlZ4L/LAsHaghU0ulzBPe YT3jzqqZA5VofyAmFGVQoFForDsAfPP2RuemkA+cZPACWnKSYayFIud+QkPfh+gVEnh9 KS2kQaj2b1BaZnHPq5pud+MdTuUXQQJgBcGrlWFleI+KHBitPhPLzdar0lQnSCnCkv9C KKxw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1698017594; x=1698622394; 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=7ivu4KAoY2zfSTKzuq0lQ619NCyVi925GYe78+HLDiA=; b=il0Os0izHJTlmj9c7B1GrKM3HJTlJkUvW46pJSWR8A8ua6oyw3F7JwDdgpfw6sdvdJ X+or09rzNnRPOk5EcMPAJV/2JyyhPLqMAgNh5rzi503FRUe3j0ih8RzMdM7zPpSw9XmC r2QYrP3W/3wop2+XxXwm5a+uWSv3Qd0QevqXcKp4E0FSInnAA+vJnDyRS47ERA21I+Sc mpSLZsvi0YkoQBXEo6IoOToXI2YZTcvGaMIhvw4jMQtmffYjZuZjdllu+D7njWdzew9I gWfCf6f88WFVpGV7Y9EbTniTW4veB2iNgGWaKisU/zHFAY8BwQHxCDY3cxtPupBI13h0 qe1w== X-Gm-Message-State: AOJu0YyrS83Q0aiLHcy9OYqvZNQrmmOpCfabsJPM6OWVarx+p9007DPO Nc3W7ALl/c2/d882Dp8pr1NoDZx4O8pw6Ju2aBw= X-Received: by 2002:a05:6a00:1991:b0:6be:4e6e:2a85 with SMTP id d17-20020a056a00199100b006be4e6e2a85mr8884986pfl.30.1698017594442; Sun, 22 Oct 2023 16:33:14 -0700 (PDT) Received: from stoup.. ([71.212.149.95]) by smtp.gmail.com with ESMTPSA id fe12-20020a056a002f0c00b0066a4e561beesm5182855pfb.173.2023.10.22.16.33.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 22 Oct 2023 16:33:14 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: mark.cave-ayland@ilande.co.uk Subject: [PATCH v5 47/94] target/sparc: Move DONE, RETRY to decodetree Date: Sun, 22 Oct 2023 16:28:45 -0700 Message-Id: <20231022232932.80507-48-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::433; envelope-from=richard.henderson@linaro.org; helo=mail-pf1-x433.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 | 88 ++++++++++++--------------------------- 2 files changed, 29 insertions(+), 62 deletions(-) diff --git a/target/sparc/insns.decode b/target/sparc/insns.decode index aa90b5c5bb..137b7eb3c6 100644 --- a/target/sparc/insns.decode +++ b/target/sparc/insns.decode @@ -228,6 +228,9 @@ NOP 10 00000 111011 ----- 1 ------------- # FLUSH reg+imm SAVE 10 ..... 111100 ..... . ............. @r_r_ri RESTORE 10 ..... 111101 ..... . ............. @r_r_ri +DONE 10 00000 111110 00000 0 0000000000000 +RETRY 10 00001 111110 00000 0 0000000000000 + NCP 10 ----- 110110 ----- --------- ----- # v8 CPop1 NCP 10 ----- 110111 ----- --------- ----- # v8 CPop2 diff --git a/target/sparc/translate.c b/target/sparc/translate.c index e90be8b959..7fc4d8945a 100644 --- a/target/sparc/translate.c +++ b/target/sparc/translate.c @@ -43,10 +43,12 @@ # define gen_helper_wrpsr(E, S) qemu_build_not_reached() #else # define gen_helper_clear_softint(E, S) qemu_build_not_reached() +# define gen_helper_done(E) qemu_build_not_reached() # define gen_helper_flushw(E) qemu_build_not_reached() # define gen_helper_rdccr(D, E) qemu_build_not_reached() # define gen_helper_rdcwp(D, E) qemu_build_not_reached() # define gen_helper_restored(E) qemu_build_not_reached() +# define gen_helper_retry(E) qemu_build_not_reached() # define gen_helper_saved(E) qemu_build_not_reached() # define gen_helper_sdivx(D, E, A, B) qemu_build_not_reached() # define gen_helper_set_softint(E, S) qemu_build_not_reached() @@ -4477,6 +4479,25 @@ static bool do_restore(DisasContext *dc, int rd, TCGv src) TRANS(RESTORE, ALL, do_add_special, a, do_restore) +static bool do_done_retry(DisasContext *dc, bool done) +{ + if (!supervisor(dc)) { + return raise_priv(dc); + } + dc->npc = DYNAMIC_PC; + dc->pc = DYNAMIC_PC; + translator_io_start(&dc->base); + if (done) { + gen_helper_done(tcg_env); + } else { + gen_helper_retry(tcg_env); + } + return true; +} + +TRANS(DONE, 64, do_done_retry, true) +TRANS(RETRY, 64, do_done_retry, false) + #define CHECK_IU_FEATURE(dc, FEATURE) \ if (!((dc)->def->features & CPU_FEATURE_ ## FEATURE)) \ goto illegal_insn; @@ -4488,7 +4509,8 @@ TRANS(RESTORE, ALL, do_add_special, a, do_restore) static void disas_sparc_legacy(DisasContext *dc, unsigned int insn) { unsigned int opc, rs1, rs2, rd; - TCGv cpu_src1, cpu_src2; + TCGv cpu_src1; + TCGv cpu_src2 __attribute__((unused)); TCGv_i32 cpu_src1_32, cpu_src2_32, cpu_dst_32; TCGv_i64 cpu_src1_64, cpu_src2_64, cpu_dst_64; target_long simm; @@ -4503,9 +4525,8 @@ static void disas_sparc_legacy(DisasContext *dc, unsigned int insn) g_assert_not_reached(); /* in decodetree */ case 2: /* FPU & Logical Operations */ { - unsigned int xop __attribute__((unused)) = GET_FIELD(insn, 7, 12); + unsigned int xop = GET_FIELD(insn, 7, 12); TCGv cpu_dst __attribute__((unused)) = tcg_temp_new(); - TCGv cpu_tmp0 __attribute__((unused)); if (xop == 0x34) { /* FPU Operations */ if (gen_trap_ifnofpu(dc)) { @@ -4825,8 +4846,6 @@ static void disas_sparc_legacy(DisasContext *dc, unsigned int insn) default: goto illegal_insn; } - } else if (xop < 0x36) { - goto illegal_insn; /* in decodetree */ } else if (xop == 0x36) { #ifdef TARGET_SPARC64 /* VIS */ @@ -5268,65 +5287,10 @@ static void disas_sparc_legacy(DisasContext *dc, unsigned int insn) default: goto illegal_insn; } -#else - g_assert_not_reached(); /* in decodetree */ #endif - } else if (xop == 0x37) { - /* V8 CPop2, V9 impdep2 */ - goto illegal_insn; /* in decodetree */ } else { - cpu_src1 = get_src1(dc, insn); - cpu_tmp0 = tcg_temp_new(); - if (IS_IMM) { /* immediate */ - simm = GET_FIELDs(insn, 19, 31); - tcg_gen_addi_tl(cpu_tmp0, cpu_src1, simm); - } else { /* register */ - rs2 = GET_FIELD(insn, 27, 31); - if (rs2) { - cpu_src2 = gen_load_gpr(dc, rs2); - tcg_gen_add_tl(cpu_tmp0, cpu_src1, cpu_src2); - } else { - tcg_gen_mov_tl(cpu_tmp0, cpu_src1); - } - } - switch (xop) { - case 0x38: /* jmpl */ - case 0x39: /* rett, V9 return */ - case 0x3b: /* flush */ - case 0x3c: /* save */ - case 0x3d: /* restore */ - g_assert_not_reached(); /* in decode tree */ -#if !defined(CONFIG_USER_ONLY) && defined(TARGET_SPARC64) - case 0x3e: /* V9 done/retry */ - { - switch (rd) { - case 0: - if (!supervisor(dc)) - goto priv_insn; - dc->npc = DYNAMIC_PC; - dc->pc = DYNAMIC_PC; - translator_io_start(&dc->base); - gen_helper_done(tcg_env); - goto jmp_insn; - case 1: - if (!supervisor(dc)) - goto priv_insn; - dc->npc = DYNAMIC_PC; - dc->pc = DYNAMIC_PC; - translator_io_start(&dc->base); - gen_helper_retry(tcg_env); - goto jmp_insn; - default: - goto illegal_insn; - } - } - break; -#endif - default: - goto illegal_insn; - } + goto illegal_insn; /* in decodetree */ } - break; } break; case 3: /* load/store instructions */ @@ -5723,7 +5687,7 @@ static void disas_sparc_legacy(DisasContext *dc, unsigned int insn) illegal_insn: gen_exception(dc, TT_ILL_INSN); return; -#if !defined(CONFIG_USER_ONLY) +#if !defined(CONFIG_USER_ONLY) && !defined(TARGET_SPARC64) priv_insn: gen_exception(dc, TT_PRIV_INSN); return;