From patchwork Fri Oct 13 21:27:35 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 733275 Delivered-To: patch@linaro.org Received: by 2002:a5d:54d1:0:b0:31d:da82:a3b4 with SMTP id x17csp1678525wrv; Fri, 13 Oct 2023 14:32:20 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFXlS3sxU4OcSgpx6eSnYctg3DO/RKCn8N6yTLH3b1haQ7JWuOjSyM2xmKvpQJYZUacdpiY X-Received: by 2002:a05:620a:25cd:b0:775:6650:bc54 with SMTP id y13-20020a05620a25cd00b007756650bc54mr31232336qko.28.1697232740055; Fri, 13 Oct 2023 14:32:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697232740; cv=none; d=google.com; s=arc-20160816; b=IWTgVYpItF7MZAioJ5SS0uMLMxBNxBzVumCUQOCoV5FtFEGf7TCjW9bvcbWdWU95lL XCARmcGGFQzVPlfMLnMf5Ryqtf8LJRVKKkmWzeuieFZjV2SaH3jutnHTd+EdYsUsOhmT HQXs7pDrYFrlthV716fFQx7fJMPyMibY7OynF3zUDXp1hF8KdoCrBztpuqQpDgqBQr8a brM9FZCWJMjRH3bK4utkmSbSyrxv8arA2omunsNY4t+v5vYEQlRuRfZuBrIGq2e4RNCU NekOKVlwfXRSoYyU1N1Qcfzp1AEVHIiscMzb8vKiNAEcJoeZP8vwengIlEhZE6clbrEu Azag== 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=c7TwK33eQMZo3s9feaizPS6nBLLo3Koe/HwD3VuT/NI=; fh=OY/jf0qYEhT53LcIJp8d/e39mN3vEzshkseI36O8N8s=; b=Vw84z01Jed6V5O+hgLVMGGJj73uyxah/SSY5iRM0FStfhJmR/OW+yUknzsHFOKrX2v 3Oz6wl2Cw5m+XRTxeMCl+0dkGRlJP0WOqAhILDGLLpfkmdu8NWIIaHXSy46tsyZd2reY zBJTnWYv0oXtB8I7t88J7td+FuTH4BPSbf0GKnxBRpGVma4La3xcY9aaDiZG4X9VVNBS gnwj/YpzdbDUb3u7VQCe53LcuMtGOrq8UajuT558yFVvoZIYeIWaBalvIlD/0aO7vGKq hwLdQ/jfNN4RZNuighg0Zd/gKDhGAaD9SrW54S2OnEiKF1aBxD9QVKMtC9NpK96kup4a aV7w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=m1cWOv+S; 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 w5-20020a05620a424500b00774184acfeesi1976233qko.297.2023.10.13.14.32.19 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 13 Oct 2023 14:32:20 -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=m1cWOv+S; 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 1qrPiT-0006FC-JT; Fri, 13 Oct 2023 17:29:05 -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 1qrPiS-0006EV-0H for qemu-devel@nongnu.org; Fri, 13 Oct 2023 17:29:04 -0400 Received: from mail-pf1-x429.google.com ([2607:f8b0:4864:20::429]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qrPiQ-0000Su-Bm for qemu-devel@nongnu.org; Fri, 13 Oct 2023 17:29:03 -0400 Received: by mail-pf1-x429.google.com with SMTP id d2e1a72fcca58-6934202b8bdso2092089b3a.1 for ; Fri, 13 Oct 2023 14:29:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1697232541; x=1697837341; 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=c7TwK33eQMZo3s9feaizPS6nBLLo3Koe/HwD3VuT/NI=; b=m1cWOv+S+6s4KTTkMENdEKqgBizikGAx8nnjmUxvil1iGYkEiEBxFegMllFW10t8eT ANVt1FPLCLiBYPR0Zxoyl/k86QSqFfLrCt5mmTWeLjr7Kc96rLjBVlHi5VfeC/hQnNje xUmWlX/p/Gjzpytrhq3+Qarz+ayluglLb7rzSf2J0/a0bKjvij7rcSitTshqFRdldFbC xmyY1BOFPTIE+TftZSmuNx1BpKXbL7to+KOGJpbp2lWCaRJfrEoOMymAVFt253fy1YPe /yAuzHCLSBcCUOP9OKAGhTeXpObmqbdxGo/lEO+ZWDPBQG2zDwhBy4EEc5QbnZvcRFom vIsg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697232541; x=1697837341; 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=c7TwK33eQMZo3s9feaizPS6nBLLo3Koe/HwD3VuT/NI=; b=tWA9mF9CBa0UCecxxioHjfx5rvugG93h+u3Z7T5eYxZd55q3+OJ21wi1I+gwTSyqgN meNfJ7UoukFt6TReD1eqqODhjxZqtiDu64f8/jvDS5FHRTcw63a4w8kMICNMlk2yGLAl 4MBzfs7d9RvcCkXdEWKqpmWsknzFpAeGhktl72glNOPrhimxm72DcBUE7MSSvqxMLnPT MXEeZ0ByltX8HIMc0tCYXx0U00zYt7CEwma4Y2bAC3DFQAK+RUoLlrBQERzRkcDjQksK g5s7W4j1B7QM0imdrw2OJdz8TExJ1fYduK9P1Fk3p1UZNCyNeGvrkpZkCtVDf0HLrPYi YGPg== X-Gm-Message-State: AOJu0Yy9K2Z2stu7XD3zRAvHMwhRrSLTFkZbn8kmwf3lXf7L+1xrdKt1 wlI4l/VRafYhTZ0y+40bMq4SPPFdlSuvuZU6cwM= X-Received: by 2002:a05:6a00:124f:b0:68a:3b39:a486 with SMTP id u15-20020a056a00124f00b0068a3b39a486mr32064019pfi.24.1697232540882; Fri, 13 Oct 2023 14:29:00 -0700 (PDT) Received: from stoup.. ([71.212.149.95]) by smtp.gmail.com with ESMTPSA id b185-20020a6334c2000000b0058988954686sm70753pga.90.2023.10.13.14.29.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 13 Oct 2023 14:29:00 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: mark.cave-ayland@ilande.co.uk, atar4qemu@gmail.com Subject: [PATCH 14/85] target/sparc: Move SETHI to decodetree Date: Fri, 13 Oct 2023 14:27:35 -0700 Message-Id: <20231013212846.165724-15-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::429; envelope-from=richard.henderson@linaro.org; helo=mail-pf1-x429.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 | 6 +++++ target/sparc/translate.c | 50 ++++++++++++--------------------------- 2 files changed, 21 insertions(+), 35 deletions(-) diff --git a/target/sparc/insns.decode b/target/sparc/insns.decode index 9ab3f2eb82..f6f5401b10 100644 --- a/target/sparc/insns.decode +++ b/target/sparc/insns.decode @@ -3,6 +3,10 @@ # Sparc instruction decode definitions. # Copyright (c) 2023 Richard Henderson +## +## Major Opcodes 00 and 01 -- branches, call, and sethi. +## + &bcc i a cond cc 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 @@ -14,4 +18,6 @@ BPr 00 a:1 0 cond:3 011 .. - rs1:5 .............. i=%d16 NCP 00 - ---- 111 ---------------------- # CBcc +SETHI 00 rd:5 100 i:22 + CALL 01 i:s30 diff --git a/target/sparc/translate.c b/target/sparc/translate.c index 5cea835b28..cc39a25275 100644 --- a/target/sparc/translate.c +++ b/target/sparc/translate.c @@ -2829,6 +2829,10 @@ static bool advance_pc(DisasContext *dc) return true; } +/* + * Major opcodes 00 and 01 -- branches, call, and sethi + */ + static bool advance_jump_uncond_never(DisasContext *dc, bool annul) { if (annul) { @@ -3001,6 +3005,15 @@ static bool trans_NCP(DisasContext *dc, arg_NCP *a) #endif } +static bool trans_SETHI(DisasContext *dc, arg_SETHI *a) +{ + /* Special-case %g0 because that's the canonical nop. */ + if (a->rd) { + gen_store_gpr(dc, a->rd, tcg_constant_tl((uint32_t)a->i << 10)); + } + return advance_pc(dc); +} + #define CHECK_IU_FEATURE(dc, FEATURE) \ if (!((dc)->def->features & CPU_FEATURE_ ## FEATURE)) \ goto illegal_insn; @@ -3021,41 +3034,8 @@ static void disas_sparc_legacy(DisasContext *dc, unsigned int insn) rd = GET_FIELD(insn, 2, 6); switch (opc) { - case 0: /* branches/sethi */ - { - unsigned int xop = GET_FIELD(insn, 7, 9); - switch (xop) { -#ifdef TARGET_SPARC64 - case 0x1: /* V9 BPcc */ - g_assert_not_reached(); /* in decodetree */ - case 0x3: /* V9 BPr */ - g_assert_not_reached(); /* in decodetree */ - case 0x5: /* V9 FBPcc */ - g_assert_not_reached(); /* in decodetree */ -#else - case 0x7: /* CBN+x */ - g_assert_not_reached(); /* in decodetree */ -#endif - case 0x2: /* BN+x */ - g_assert_not_reached(); /* in decodetree */ - case 0x6: /* FBN+x */ - g_assert_not_reached(); /* in decodetree */ - case 0x4: /* SETHI */ - /* Special-case %g0 because that's the canonical nop. */ - if (rd) { - uint32_t value = GET_FIELD(insn, 10, 31); - TCGv t = gen_dest_gpr(dc, rd); - tcg_gen_movi_tl(t, value << 10); - gen_store_gpr(dc, rd, t); - } - break; - case 0x0: /* UNIMPL */ - default: - goto illegal_insn; - } - break; - } - break; + case 0: + goto illegal_insn; /* in decodetree */ case 1: g_assert_not_reached(); /* in decodetree */ case 2: /* FPU & Logical Operations */