From patchwork Tue Oct 17 06:11:33 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 734262 Delivered-To: patch@linaro.org Received: by 2002:adf:f0cd:0:b0:32d:baff:b0ca with SMTP id x13csp322411wro; Mon, 16 Oct 2023 23:14:39 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFqiWa/sHeSeEg40YcRBEqBjjviyjElWLSkj8aRJg3RiOot1yze4ViKeT71JfCG3czrzV8Z X-Received: by 2002:ac8:58d5:0:b0:415:1752:1be5 with SMTP id u21-20020ac858d5000000b0041517521be5mr1484455qta.31.1697523279271; Mon, 16 Oct 2023 23:14:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697523279; cv=none; d=google.com; s=arc-20160816; b=Vt2c4tgH4IXDqL98YK2FjMnziIYdJmoNO+wyQahOna+DPs68HpL5mNEOEaQ7OGhZh0 DoL+Lqla6Sm984jQhQ8uMK/uwdxwi+r6SQaZQTakB4p7ZD8ooC6u6F6UAiNn8KRznK1Q dpL86yPAs57n/0Pt50cz4ATJf39L/kg9Bav7TIlhRbwqpCatRGI6YptyPxaxkGqZSDad czwo9Hjgd5ay8A3yZbp6de4cm7WMCSLxuPf4+kqhA9l/YjDtEbnIplPCV5WREgNE00K5 SdvVO9iX/Xio706y7MPUz0SuM4WSwa918iNlkoGVNnK0nojWER3kwEkyzOe1Y2qxD0LR /Uww== 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=6Ww/eIka2fIiuMHxW6vTYf2n2OXLN4aKw8vXIwfDBzM=; fh=TYrED6TOMxGX0VC4GtjviASLbYyJe19+7/tKWjN44KQ=; b=uTaIcSJaCQ3+8a3bmwW93BtcRONdn9t7OoXrxx3iMhXhoyzcIH9viEbsGYMX/fqEgF 4ky3McVQCAbEHHiQuNC/Nc+ByREeOTsOJ4W6TRxU7q8+z4SqydeC6RQg54rQ3oENAp2X n8xxvNE9jYtgp4avIgmaIpsl+icFpFUAoD9nbfa6yUWEhTQwS8/nWUqUj76rMOUo76AZ OZrMpRldq/Pfln0Ign7QWmaRDIOLdtZb+kvfTEVRxdcRwzUwbaGhJXcuwZpoaauEeYbz impXPEItzdQET83S2S4yiXflS7m3LKVDAdGvQbdofh97FWUddWaUGjm2HlvOSsMzqYl2 Bfeg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=f3ymxVJx; 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 j17-20020a05622a039100b004196484117esi660938qtx.73.2023.10.16.23.14.39 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 16 Oct 2023 23:14:39 -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=f3ymxVJx; 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 1qsdKF-0000Lm-3X; Tue, 17 Oct 2023 02:13:07 -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 1qsdKD-0000FV-7b for qemu-devel@nongnu.org; Tue, 17 Oct 2023 02:13:05 -0400 Received: from mail-pl1-x62e.google.com ([2607:f8b0:4864:20::62e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qsdKB-0003tC-IU for qemu-devel@nongnu.org; Tue, 17 Oct 2023 02:13:04 -0400 Received: by mail-pl1-x62e.google.com with SMTP id d9443c01a7336-1ca052ec63bso31300585ad.1 for ; Mon, 16 Oct 2023 23:13:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1697523182; x=1698127982; 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=6Ww/eIka2fIiuMHxW6vTYf2n2OXLN4aKw8vXIwfDBzM=; b=f3ymxVJxjLmyii4XZrNIBBQzUe9WEGFLmso1yT1Xzn3tUZ79dDVnanCXUJLTadJJYA SxkinAmAgX2EMn/Hzj4v7nE7dcILidXMIkp63VdT82JNVP1Ce9nzTYL7lPbn49G3hB2U wc0dl2CbwOElKNT8bBqEB9f9OkjhAn/8qKhpaI2nnBOaV6xsfUhtxwizKmSTe8Uf9jDm Uy+seZM1oLMmk4N+GIdF6/OCC0dxpqphbR3xYrqhkHjid5kkmOa5vxDMRdGPlGqtPWRP JORR6Ts6hu2sSRlFyD40XP7rWAWBKTy+/zZEbQg6gzyglsUNaTeGLtiTKyOc3mJQJDNj KGuw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697523182; x=1698127982; 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=6Ww/eIka2fIiuMHxW6vTYf2n2OXLN4aKw8vXIwfDBzM=; b=QMALcQhJKbWfsCJYcqqZ3gPfPqn6XAjcGsVvT3iQtXHaVlAyzbR6nx3BuEqw+/5Ddb YJ0YSS8rZYmdn7CuGjAF9EcrrwPFd7oO70Ia77GwWCOnm65rn2jstz1vEPwAr3REPnYv UPQkYxdUImFMEyBwwgoApQQ++2vKhSkIcB9CYIVedFsYRclgku5w5vaBa0xwgugldxIZ x3e/tgHgO8qJEJVA9RyoSYBT2v9++kzZFmavdxZaDjsfjW4jgkjwKGjs9QaueyfnMjnd 9IFGXpW4AGpIZtcEW4xRwyh2CQtTCRdWJbTDqhJJ/SSVZLfFOJOJf5UadggXG73HXxn/ ZZ+g== X-Gm-Message-State: AOJu0YzxBO/Dem7j4uGDWfyUEmp2IgZTipnZjKZ8H+b8PG7fJ2cnVlik drO32Xs7LWm9rhjPa+S61RXr5l0KeqbSGMr/JcQ= X-Received: by 2002:a17:902:e5c1:b0:1b9:e241:ad26 with SMTP id u1-20020a170902e5c100b001b9e241ad26mr1469930plf.9.1697523182048; Mon, 16 Oct 2023 23:13:02 -0700 (PDT) Received: from stoup.. ([71.212.149.95]) by smtp.gmail.com with ESMTPSA id jf4-20020a170903268400b001ca21e05c69sm629150plb.109.2023.10.16.23.13.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 16 Oct 2023 23:13:01 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: mark.cave-ayland@ilande.co.uk Subject: [PATCH v2 19/90] target/sparc: Move SETHI to decodetree Date: Mon, 16 Oct 2023 23:11:33 -0700 Message-Id: <20231017061244.681584-20-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231017061244.681584-1-richard.henderson@linaro.org> References: <20231017061244.681584-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::62e; envelope-from=richard.henderson@linaro.org; helo=mail-pl1-x62e.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 70bfbb41e9..b53127ecb7 100644 --- a/target/sparc/translate.c +++ b/target/sparc/translate.c @@ -2868,6 +2868,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) { @@ -3040,6 +3044,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; @@ -3060,41 +3073,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 */