From patchwork Sun Oct 22 23:28: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: 737060 Delivered-To: patch@linaro.org Received: by 2002:adf:dd81:0:b0:32d:baff:b0ca with SMTP id x1csp1283166wrl; Sun, 22 Oct 2023 16:35:20 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGFZXSwvyNu3ooM0cB8iqzsVvsWFpbuu6QeWQxGiURKaLxShC/MEfXf2o+JjIUM9t/CONLC X-Received: by 2002:a05:620a:618c:b0:775:8040:ede6 with SMTP id or12-20020a05620a618c00b007758040ede6mr7510663qkn.21.1698017719997; Sun, 22 Oct 2023 16:35:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698017719; cv=none; d=google.com; s=arc-20160816; b=WJ91rGcOPrYvB+lWLeF3Mvql4fBKBFLDkDEvPyKTeoBkPs7ckIDc5zBaqttAVxKq02 Nw1+DapO2gCEzZEa1AqNN+bICWWax53vpKYbzRsLO9CkHHngGLrG49BlLN1ylLCpD6+Y FwLaBKbLskAcMdo7nXM4ms0xR9lmKQ44TTuWy6EEM7NLbseY3OZf/TE2j16N755ENXgB 4D53k9btrmbKbe+fvvWfX2GWEe3lHgOV7YztBq8AdOmAQiz1/cvwDIhBrUGwOLK1R35X bcutJdW0BGfyyyJsq/huRwWhfrI4x2Hcfw6vZLeno5RkLXA+oGsGQYJpRJ68G0o0Dlnb 6J9w== 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=TYrED6TOMxGX0VC4GtjviASLbYyJe19+7/tKWjN44KQ=; b=islgHLxw7tyDrbKCfwWAkUxa09vbvDroGsZam48YLHzGQyObjJputlv/XF4aUuXUUi pMSH8gHQJyx4D8bOOP43buKPKmD0yugAK3TpWOQZyZrSAV01s6LYvKjK3T+Y1PistDks x/R20fNcLZBrKEVIhA3Ox6dz6y8O/ttJ242rwfO6As3hsE5iF/832PnbG415cBZBu8KJ xpU1omuHrUTvrkAaZFJ2E2dC02V6i/Xk0VsjrsnXLqFm8b9lFqW5mknRCZQIu31D3Cxs e651w//I8eiq+vu3T68wEaBZrWLurRDm4dA4sejObUVfEvfcoqdR7ehQDM5n2SbmN7qh RdxQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=sds4AYVK; 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 d30-20020a05620a205e00b007777f01f8e7si4884741qka.575.2023.10.22.16.35.19 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sun, 22 Oct 2023 16:35:19 -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=sds4AYVK; 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 1quhtZ-0007IO-Ut; Sun, 22 Oct 2023 19:30:09 -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 1quhtN-00078o-1B for qemu-devel@nongnu.org; Sun, 22 Oct 2023 19:29:57 -0400 Received: from mail-oi1-x22f.google.com ([2607:f8b0:4864:20::22f]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1quhtJ-0006lz-Mq for qemu-devel@nongnu.org; Sun, 22 Oct 2023 19:29:55 -0400 Received: by mail-oi1-x22f.google.com with SMTP id 5614622812f47-3b3ec45d6e9so1877112b6e.0 for ; Sun, 22 Oct 2023 16:29:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1698017391; x=1698622191; 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=sds4AYVK5Z2J2nUTlGHX2YUKDQ9SL9/WggThp3+pP5UF+XZkU9p9qBLR5q9FINafIt tDXikUnWH21EjN6RjUHzNuIlTBvFnKO7mIVwaSpxhYn2RF1sIl0LuYXXoIsGJYC8iOi8 JIJksAPUxGYD1qnP7HHLmSvpKB3QByjO8cOq6FNp2tpsQRIPYsvYNdfMRIG0FZ3FEQlj yBWDBgKD1+kaPo2+952TfIQpDyfXHjL8agkZNsFynpjvFdx6DGKU4nmgZCZRbh6P7YkR HXEE9vYFNLnPBwt3ZmPGzRqOFkg6CFxv/n5DReqdkWibNR9PtzmFygR9hWlApie6rxUS QdXA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1698017391; x=1698622191; 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=GTDY/kgq+8DDyu3lqH8wTfeq2jQDHxaf0hLazU35t8kxTnQ1q3OAU6OVrcfs0bnDkz PMWQtR2YDayzFYDszLyVNWztt9+Ze3ts82YJmz+vj9BekopaTO9xOt3Qe1VomhCCELkz NdCuUHCbFp3H4fZAGsax+KEOyP+nJHBLQ/+8jQcNANRM0qxz0bpxrq9gaKfDn5wMTVo7 Jl3n6hTerx2fs5YGVzFg3MfpJvpZfvQUfBXciDuJ01KpasfK1tlPm+UOYudr35sCeZ9n BjYmQI7GeZ8hHVmcSonRlx7x4tPVkRKzReWWiauNCqvJR0criDBqabSxH1c6zchGcBMl 4GUQ== X-Gm-Message-State: AOJu0Yz8WL7OTMFaNTuahQz7eOSDSNu2sBbTkfggywcpVMWyGhvqSrVA WjQySiJeiVvGZu7TBOOFltwPxJva/ktspfG6F0U= X-Received: by 2002:a05:6808:2a6f:b0:3a7:330d:93da with SMTP id fu15-20020a0568082a6f00b003a7330d93damr8192085oib.19.1698017391319; Sun, 22 Oct 2023 16:29:51 -0700 (PDT) Received: from stoup.. ([71.212.149.95]) by smtp.gmail.com with ESMTPSA id k26-20020a63ba1a000000b005b25a04cf8bsm4023772pgf.12.2023.10.22.16.29.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 22 Oct 2023 16:29:50 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: mark.cave-ayland@ilande.co.uk Subject: [PATCH v5 20/94] target/sparc: Move SETHI to decodetree Date: Sun, 22 Oct 2023 16:28:18 -0700 Message-Id: <20231022232932.80507-21-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::22f; envelope-from=richard.henderson@linaro.org; helo=mail-oi1-x22f.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 */