From patchwork Thu Oct 26 00:14:18 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 738196 Delivered-To: patch@linaro.org Received: by 2002:adf:f842:0:b0:32d:baff:b0ca with SMTP id d2csp552963wrq; Wed, 25 Oct 2023 17:19:52 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEd7CziaA7qCJDGNq14/hwYumuHSnhjnBBAY/EbcQkFWF8Hg/Lwx7mHmxRQ9ikNuc+q5adH X-Received: by 2002:a05:600c:224b:b0:408:3975:e225 with SMTP id a11-20020a05600c224b00b004083975e225mr12308884wmm.40.1698279592201; Wed, 25 Oct 2023 17:19:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698279592; cv=none; d=google.com; s=arc-20160816; b=gcbzmQ0ulqdZcNaJ/tqMHTxMQ5wAJqI9yyPg+cdZruC3eOvNyOBot/vhBr/+PrLGaB FiuZzyUSVPolo8Q5E/cscckPVz5+I/nDkOttPMI4+W67SwNOQnluCIu5shMcqhUS6jYN X8nRT68NBeH0cfLB1mQ4kEYF3ifEz+JLojnonucE79/FQ+W3xokRMdDLPFcHufKkXT98 LIC7w+v68yoeCHPYxyzRITze/Ml8/eo4oXdL7mO1qrouc4FC1YRDt5jm95px23/PKsLn C0pOIxG+6t+B4Fi9/PaNHnk9hBf3kHt93tIjBiGjKVM9LkAq9/o8JIjmPpo21Dz8cQ6E Kx1A== 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=5V/MzDPCPtSl5p/d34/PgkVJsUATuXtmCOJbzl0yEFY=; fh=rYI8DiHAAFX3O5g969KmOAQ7d45Sb8OxQX1+DywGDk4=; b=AkE6H/ToMWI2Apv34/bfYhZBYSn0DH25WWmJMUMc3SemK/w8mn+ItelnaSGs+3f3i5 Q5wP7zXLM9YIFqO0YU4M8iG0bznHn6IjF0x26gn2S+4jpHgSPazFT6zmwxNHqaF8k+oI UfY1pFyKeO5YEK/UZTLb9mLPFZqLl37E1JfW2kDF0/jkGyKlhHhdi9g/L3kS4Vus6O10 Xx7wBSyIMbpRMexsPtax33+VQGJAZnzYR5e7fso1OwNW1yzlQVg4EPGq0he5LyyGLfgr uZwNHd+YX2m+Dg0oE9NbF/8Xut5WNltBwGbj66j0xHNsZkxzXqXxvvHByc0ND+SeuM6U bR4g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="ReP/tdTa"; 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 q11-20020a056000136b00b0032ddbecb14dsi8294468wrz.751.2023.10.25.17.19.52 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 25 Oct 2023 17:19:52 -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="ReP/tdTa"; 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 1qvo2z-0007Lb-2Z; Wed, 25 Oct 2023 20:16: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 1qvo2v-0007Gh-I5 for qemu-devel@nongnu.org; Wed, 25 Oct 2023 20:16:21 -0400 Received: from mail-pf1-x42f.google.com ([2607:f8b0:4864:20::42f]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qvo2r-0004w5-JR for qemu-devel@nongnu.org; Wed, 25 Oct 2023 20:16:21 -0400 Received: by mail-pf1-x42f.google.com with SMTP id d2e1a72fcca58-6be1bc5aa1cso294899b3a.3 for ; Wed, 25 Oct 2023 17:16:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1698279376; x=1698884176; 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=5V/MzDPCPtSl5p/d34/PgkVJsUATuXtmCOJbzl0yEFY=; b=ReP/tdTawWVX0Oj/2MovUjQSPcYasaBEXdYuTy8+wJ8A1GgsUtPoCP5QQ3uX6qxjoG jFbCSy72mZeBCN18p/q1K2uq+fcXlQHtdM2IEBRQxQIR5fiX9S4ALpTjzfHDHbB5P2gt BN7Uls2FsxD8fSmp+rWpMkIjb99qpVwUzfvgH9kwwZKUGIXn7B0US7ADezTuEIrRXYHT WllX3l0TNsOUKEhkqzNdFeWZ5ekFYRm9AT0v84/VrdmaXKd1Q/PtTzwYyCc4kMpp3+dT TtrcouAdLS0LvyXyN6cyH4m9JnHPQk6PsC4neS5Y7PdO1tE/z6FD2bpvVt9O90SrqlWz 4CCA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1698279376; x=1698884176; 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=5V/MzDPCPtSl5p/d34/PgkVJsUATuXtmCOJbzl0yEFY=; b=n10ByJeTNWi/FoFBfMveGyu+sat0+dqujaD+yPeVdhCryGRID6iqC97knhgWejEdTF tjaDXTJlF5VP3PRhjkPpcWGNm7C9i0I0xwzvJ15MgeoHci4VQLL7ZLR/5YuutUc3gTir OLnCGe2SI1dqfgu/eudurVR4kbe2uVXFq+d47NPPkBtXsB86egHfSaGOOMfVkcR0bs0M lOSOmDJSPXCW8g/O6XRt87y8cKZ7yfEP5wMZIzMKgsJ6Jkk1X9wdSdCu+dqZDEex8B1n folv9fQEwut/SkTGri9K/cXzlEsAkGsQPAxiKVheGsn9YVodaQdM4lARtvk1L2fGqkMq jc6A== X-Gm-Message-State: AOJu0YxQb03o8S1rFgUvEsZzMtGXFEgtItHz7SbgLzqkuC3Y+bbHeemN +7i8tQp9b70h5ezfWTNc0lfF0edWgPJWB7kHs/4= X-Received: by 2002:a17:902:f550:b0:1ca:7086:60f7 with SMTP id h16-20020a170902f55000b001ca708660f7mr18868027plf.28.1698279376220; Wed, 25 Oct 2023 17:16:16 -0700 (PDT) Received: from stoup.. ([71.212.149.95]) by smtp.gmail.com with ESMTPSA id ij23-20020a170902ab5700b001c582de968dsm10038433plb.72.2023.10.25.17.16.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 25 Oct 2023 17:16:15 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: Mark Cave-Ayland Subject: [PULL 20/94] target/sparc: Move SETHI to decodetree Date: Wed, 25 Oct 2023 17:14:18 -0700 Message-Id: <20231026001542.1141412-40-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::42f; envelope-from=richard.henderson@linaro.org; helo=mail-pf1-x42f.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 | 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 d12f2b4b87..cdd929282a 100644 --- a/target/sparc/translate.c +++ b/target/sparc/translate.c @@ -2873,6 +2873,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) { @@ -3029,6 +3033,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; @@ -3049,41 +3062,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 */