From patchwork Sun Oct 22 05:59:02 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 736944 Delivered-To: patch@linaro.org Received: by 2002:adf:dd81:0:b0:32d:baff:b0ca with SMTP id x1csp1004111wrl; Sat, 21 Oct 2023 23:05:36 -0700 (PDT) X-Google-Smtp-Source: AGHT+IE5tU/8BXtbJUiY+4ZLPBDgA2WWHHoKg71AdjLfOSN92577YwH+umNzfQClPBUSTFrzUlW7 X-Received: by 2002:a05:6214:19cf:b0:66d:9e62:7fc9 with SMTP id j15-20020a05621419cf00b0066d9e627fc9mr5565267qvc.24.1697954736449; Sat, 21 Oct 2023 23:05:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697954736; cv=none; d=google.com; s=arc-20160816; b=Ddil7Q6nfoA63kv0WRDZ39OYxU9oaMe1UQkchsk0iDjEThKUQLH6abGzqkSOEUfdca qB2onDGBp3eP0IdW6xaJt+gbNc8DwfWsksfBGjl1wedLiEz9SW/T+hP/wWCu2X7zQIcR dPGgDzdyfNVAqbMwvwoFGe1C3bcQSh7iDjFW3jBfFZKOUOO0SVib+oHjnqsN8FZPoSqG EJzYEZyhzuuMT70sO5zJ5WmsYu5PXF4n5Ky7nDkgEn41+gaW3LIZRvJc3s1jn7fDXoev dsbFqXoUUDNQQVDbDXTXZ6DpebSy3wDt0MQ607esHaFH8yAwGLL3akmjlX7ES8pNThDz qKqw== 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=CzYqIAe/hPtmLAqL3h5jbLKf5tJAkAbl6Tgcozc9Vko=; fh=tZJ625WOV7jgOfp8Y+f3bhkxwtNCMo5ecPunHzXn1rY=; b=P6CC5pUHPQK0Eg3DYgTeJEK800Mem4wMA3iEoB/x4Qffkk/gOtOn08Mr1Xptu6jeKA YvyOOQRoRmZjo4QWxukB6yXPONzgpbumEKs6h8lcJCuTZI+jis+5lUsMVWNPTI372DJy DLywxGCUPEZbDIoSoxu27JYnHpH/XUiLZpFMMMURCxWqYTIw6yK3yyB7wUfHCvEKfYVS 2kMdSTPrzSKExiRYexk8fn99P3U+CR6KzYMQac1TxS14G/w4GJGw2NgEi/ctJXt794md v8BQSZgywJASV9yK/Fj3ZQWqHIdEKJSEIYbGGVl06SC439mjEKLn1YYDGpbx2AL8Us74 hNdA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=lNIKAva6; 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 k19-20020ad44513000000b006561f4b120asi3877817qvu.52.2023.10.21.23.05.36 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sat, 21 Oct 2023 23:05:36 -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=lNIKAva6; 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 1quRVz-0000RI-Pz; Sun, 22 Oct 2023 02:00:43 -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 1quRVu-0000HZ-C7 for qemu-devel@nongnu.org; Sun, 22 Oct 2023 02:00:38 -0400 Received: from mail-pj1-x102a.google.com ([2607:f8b0:4864:20::102a]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1quRVs-0001Tk-20 for qemu-devel@nongnu.org; Sun, 22 Oct 2023 02:00:38 -0400 Received: by mail-pj1-x102a.google.com with SMTP id 98e67ed59e1d1-27d3ede72f6so1933983a91.1 for ; Sat, 21 Oct 2023 23:00:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1697954434; x=1698559234; 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=CzYqIAe/hPtmLAqL3h5jbLKf5tJAkAbl6Tgcozc9Vko=; b=lNIKAva6NiL/wpUSWNSFVUvZSO3R8SnrlhHsAo1eqzrMlqguLdVwciv3XR7QGzivrw Bceq00DtmqmZ6+6MiDqeg3inmsXK/sdb/fgi8YP1QCOKFfYdMm0vc0AoU3tIC1EF+4xj hSTxRdAVFtpMDvVLQpjhzC5MqO8D7c5/lme0FH+NeSsN2HqGIO+RiYSy8fjYpsxuDuzc 9gM7XmBUp7rIbrpGLUVbg+nhZYriWzYXJE9FQKQrD7PwaEfeZHkvsdYPZvp8IfxePZoI jZ688Dr5ZOIXzZR0oPoM7Wcr7yqhAzp06QRSH8BmOLas+SlKoA+rI3O+NhFImtB73xz1 mzFA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697954434; x=1698559234; 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=CzYqIAe/hPtmLAqL3h5jbLKf5tJAkAbl6Tgcozc9Vko=; b=RNHtWJ5y/by8M4HR2udSE20h30Somv8ALEX6poVO3I9SQegKfGv1b+DMmz88ziQPy9 YFW2yfuO4cT16duqMpstEp7b2vrJj8o+w2zbp3+/TqNvJ/GPnHOcAta2Fwa2yHdEgIgg iDz8lR+oCvFow4jlcpDx+yS32VF8RGFzrAupQ0vxjKmEYBj2fTmgMcVarAMB9dgseQAz 7YXdObNJvH7eNBYkUwou3R5Xd49jCpIt8UvYB+wL7my/aowTH15gZolq9di1vxJR/Yx4 AOq9sLGjUVtkiNQQljGPFP3/Lio3necUzkDAwL0Sombjm0O4iEnGnvkxVN7jCl+Xnxg+ Um/g== X-Gm-Message-State: AOJu0YzAmo8StKUqthWMRB+qfSivcnKJ4timbgX1/0Fy4m5XgAs+yjO0 GjGPyJ55ertZo8Kq4zTNdbp0ZcO9sL0hzydYx2U= X-Received: by 2002:a17:902:f0d5:b0:1ca:18a3:a49b with SMTP id v21-20020a170902f0d500b001ca18a3a49bmr5302287pla.37.1697954433978; Sat, 21 Oct 2023 23:00:33 -0700 (PDT) Received: from stoup.. ([71.212.149.95]) by smtp.gmail.com with ESMTPSA id je17-20020a170903265100b001c728609574sm3999887plb.6.2023.10.21.23.00.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 21 Oct 2023 23:00:33 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: mark.cave-ayland@ilande.co.uk, qemu-stable@nongnu.org Subject: [PATCH v4 01/90] target/sparc: Clear may_lookup for npc == DYNAMIC_PC Date: Sat, 21 Oct 2023 22:59:02 -0700 Message-Id: <20231022060031.490251-2-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231022060031.490251-1-richard.henderson@linaro.org> References: <20231022060031.490251-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::102a; envelope-from=richard.henderson@linaro.org; helo=mail-pj1-x102a.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=unavailable 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 With pairs of jmp+rett, pc == DYNAMIC_PC_LOOKUP and npc == DYNAMIC_PC. Make sure that we exit for interrupts. Cc: qemu-stable@nongnu.org Fixes: 633c42834c7 ("target/sparc: Introduce DYNAMIC_PC_LOOKUP") Tested-by: Mark Cave-Ayland Signed-off-by: Richard Henderson --- target/sparc/translate.c | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/target/sparc/translate.c b/target/sparc/translate.c index f92ff80ac8..8fabed28fd 100644 --- a/target/sparc/translate.c +++ b/target/sparc/translate.c @@ -5654,10 +5654,10 @@ static void sparc_tr_tb_stop(DisasContextBase *dcbase, CPUState *cs) break; } + may_lookup = true; if (dc->pc & 3) { switch (dc->pc) { case DYNAMIC_PC_LOOKUP: - may_lookup = true; break; case DYNAMIC_PC: may_lookup = false; @@ -5667,10 +5667,24 @@ static void sparc_tr_tb_stop(DisasContextBase *dcbase, CPUState *cs) } } else { tcg_gen_movi_tl(cpu_pc, dc->pc); - may_lookup = true; } - save_npc(dc); + if (dc->npc & 3) { + switch (dc->npc) { + case JUMP_PC: + gen_generic_branch(dc); + break; + case DYNAMIC_PC: + may_lookup = false; + break; + case DYNAMIC_PC_LOOKUP: + break; + default: + g_assert_not_reached(); + } + } else { + tcg_gen_movi_tl(cpu_npc, dc->npc); + } if (may_lookup) { tcg_gen_lookup_and_goto_ptr(); } else { From patchwork Sun Oct 22 05:59:03 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 736939 Delivered-To: patch@linaro.org Received: by 2002:adf:dd81:0:b0:32d:baff:b0ca with SMTP id x1csp1003964wrl; Sat, 21 Oct 2023 23:05:01 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGE7cLhExFS0kuRZV3C9eXc/ZQXnk/dhZ8XtSSagOT+YnI7WU/yVK4WI8VhPRt0F60kS6ia X-Received: by 2002:a05:620a:244d:b0:779:d049:8e11 with SMTP id h13-20020a05620a244d00b00779d0498e11mr1085887qkn.23.1697954701453; Sat, 21 Oct 2023 23:05:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697954701; cv=none; d=google.com; s=arc-20160816; b=YwmFCyJPp/PGpb1WX9p0e0m7ocuUMWAELIXe7OIIYlIAyANHi2No3NyGohHtOfhXdl fHVdu9dEr+PdfsvxXgddZRdaCbjUu8aQkCxXD/jMufmk25k2zr05uKKms8X0evNP8DBI +whExya6m4i7KLraxdSAAH6r2yUlfcBJWZaqYjp6t+FLOhPPW177H05cAourqLTJdDmI odHoomcJ7jCG6ARBbUuogZv3QzcPoXeP9mlNfbLNZKFPBYrcmQ2KetN64ZrjslDEduky x/dQKLOynaLwjdTpjW+2KYJmOzxbBa/sprclwSYpuE+WdcbP8ymdlXMuu3yUl+vCAA9B hV2Q== 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=jXlmVTgalHfsB9Nikgsdxk0ApYZwOaGhGlv+ImBLl8Q=; fh=TYrED6TOMxGX0VC4GtjviASLbYyJe19+7/tKWjN44KQ=; b=XYPUxu4LQ9QfPVmidz96cbVCmJo0Y4khUnFLETvKwOAx91lyyrEXd8KuOX5EZ4PuPo alDP8iiZUtPfnI/UsRxEEZfES7nruOvp+7yEXSANiAKANn69bZq2CrmI6uEpajyLm9he j4ghimump18itlTbrqT5nx68YNiVMJ/T4mfQySbiWqouFBa/7CdubfvROOojrSep3KtV WZF49n1IWHIi9mql5XBmr6H40WeWV0VPZlHx2yoeq4Pj9+T6LQyXYZQrKI2ZCFqmYFL6 YCDHixmVnrPV6Vd7JUVdYBBzSXDtjwQUN/WzkqL2LnqqLgQxiYpFfwKoyjhvLF1VG/cl 9cPw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Q8YYGmT0; 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 bi2-20020a05620a318200b007683f5f874csi3676276qkb.645.2023.10.21.23.05.01 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sat, 21 Oct 2023 23:05:01 -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=Q8YYGmT0; 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 1quRW0-0000TX-OJ; Sun, 22 Oct 2023 02:00:44 -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 1quRVu-0000Ha-OZ for qemu-devel@nongnu.org; Sun, 22 Oct 2023 02:00:38 -0400 Received: from mail-pl1-x62b.google.com ([2607:f8b0:4864:20::62b]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1quRVs-0001Tu-Ih for qemu-devel@nongnu.org; Sun, 22 Oct 2023 02:00:38 -0400 Received: by mail-pl1-x62b.google.com with SMTP id d9443c01a7336-1c5cd27b1acso18397615ad.2 for ; Sat, 21 Oct 2023 23:00:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1697954435; x=1698559235; 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=jXlmVTgalHfsB9Nikgsdxk0ApYZwOaGhGlv+ImBLl8Q=; b=Q8YYGmT0LwUbJdwaiYbuALtdBU3Bd4yxC6BoObfFW54wa8wkwyKFq/WsucwmDq3Jjm 2/+W5U7rJpiUyqyMolqJCMBVqe8E3O7jL3vPKLaBmmaGR8AeRdB0+/d+JIoAWFeYaqSm FSrkl/RQXI4q66itOPl0msa9yiB22Oug3W3s894CE3cfI20xjl2mLXmXh7zYcZylx5DE igKRI/gKuzAJkxvVAV/H7QjlnMGTQ7aFissYiwR33uQ9N6rtXiGPVWi58v3W3WxK0DsS U98DNlbk3S04D1bjV78rfQu4+KmgHpemJuU0H4vprEqZ7dQwQBRL+cfU3aJf2vVSkzq/ nNIw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697954435; x=1698559235; 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=jXlmVTgalHfsB9Nikgsdxk0ApYZwOaGhGlv+ImBLl8Q=; b=vVUiqeLTRC2XeFo1ZggjBuuF/J5nwsSq/qFuRP0gR/xNawpX62nxA4zn0ENJOy9fza swvj0uTqkHj257S7dcWcG0YJHZdOsXlR/XGuJgnG86MVu+ArdZMUAAFebd6CZx7us07k eiGfy+S3dUokXFKtMp2qvJLuOY819EDeVtmsLVR6FcH9oVT4Mats7QpDKBBj5bAxXu08 9LTY97gdzykmIqpA6ueHEyvwt5Pm1f5qraWs2qxpRx5e2wg5EV7+bG70KfdgOWL+Ibvs 7BXe9oHsnKFrvUdLndct7jyxcgqzQdY/lgiDCp5akxVZ9FPfYJeoa1wtcYEBYtYh8aOe o27Q== X-Gm-Message-State: AOJu0YxZDf7CZLfGbuopnFSwNTTad/qEaw5s+IeTFNN3dMtgt+hWr2Pj F0jGfTRSHDAvnvTLvVROxHZGkGHh3Ygz7F2vrTE= X-Received: by 2002:a17:902:efcc:b0:1ca:3093:77b with SMTP id ja12-20020a170902efcc00b001ca3093077bmr5117485plb.47.1697954434944; Sat, 21 Oct 2023 23:00:34 -0700 (PDT) Received: from stoup.. ([71.212.149.95]) by smtp.gmail.com with ESMTPSA id je17-20020a170903265100b001c728609574sm3999887plb.6.2023.10.21.23.00.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 21 Oct 2023 23:00:34 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: mark.cave-ayland@ilande.co.uk Subject: [PATCH v4 02/90] target/sparc: Implement check_align inline Date: Sat, 21 Oct 2023 22:59:03 -0700 Message-Id: <20231022060031.490251-3-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231022060031.490251-1-richard.henderson@linaro.org> References: <20231022060031.490251-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::62b; envelope-from=richard.henderson@linaro.org; helo=mail-pl1-x62b.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 Emit the exception at the end of the translation block, so that the non-exception case can fall through. Signed-off-by: Richard Henderson --- target/sparc/helper.h | 1 - target/sparc/ldst_helper.c | 7 ++-- target/sparc/translate.c | 68 +++++++++++++++++++++++++++++++++----- 3 files changed, 61 insertions(+), 15 deletions(-) diff --git a/target/sparc/helper.h b/target/sparc/helper.h index b8f1e78c75..b116ddcb29 100644 --- a/target/sparc/helper.h +++ b/target/sparc/helper.h @@ -24,7 +24,6 @@ DEF_HELPER_FLAGS_2(tick_set_count, TCG_CALL_NO_RWG, void, ptr, i64) DEF_HELPER_FLAGS_3(tick_get_count, TCG_CALL_NO_WG, i64, env, ptr, int) DEF_HELPER_FLAGS_2(tick_set_limit, TCG_CALL_NO_RWG, void, ptr, i64) #endif -DEF_HELPER_FLAGS_3(check_align, TCG_CALL_NO_WG, void, env, tl, i32) DEF_HELPER_1(debug, void, env) DEF_HELPER_1(save, void, env) DEF_HELPER_1(restore, void, env) diff --git a/target/sparc/ldst_helper.c b/target/sparc/ldst_helper.c index 78b03308ae..246de86c98 100644 --- a/target/sparc/ldst_helper.c +++ b/target/sparc/ldst_helper.c @@ -360,6 +360,7 @@ static inline void do_check_asi(CPUSPARCState *env, int asi, uintptr_t ra) #endif /* !CONFIG_USER_ONLY */ #endif +#if defined(TARGET_SPARC64) || !defined(CONFIG_USER_ONLY) static void do_check_align(CPUSPARCState *env, target_ulong addr, uint32_t align, uintptr_t ra) { @@ -367,11 +368,7 @@ static void do_check_align(CPUSPARCState *env, target_ulong addr, cpu_raise_exception_ra(env, TT_UNALIGNED, ra); } } - -void helper_check_align(CPUSPARCState *env, target_ulong addr, uint32_t align) -{ - do_check_align(env, addr, align, GETPC()); -} +#endif #if !defined(TARGET_SPARC64) && !defined(CONFIG_USER_ONLY) && \ defined(DEBUG_MXCC) diff --git a/target/sparc/translate.c b/target/sparc/translate.c index 8fabed28fd..8f6fd453e7 100644 --- a/target/sparc/translate.c +++ b/target/sparc/translate.c @@ -68,6 +68,15 @@ static TCGv cpu_wim; /* Floating point registers */ static TCGv_i64 cpu_fpr[TARGET_DPREGS]; +typedef struct DisasDelayException { + struct DisasDelayException *next; + TCGLabel *lab; + TCGv_i32 excp; + /* Saved state at parent insn. */ + target_ulong pc; + target_ulong npc; +} DisasDelayException; + typedef struct DisasContext { DisasContextBase base; target_ulong pc; /* current Program Counter: integer or DYNAMIC_PC */ @@ -89,6 +98,7 @@ typedef struct DisasContext { int fprs_dirty; int asi; #endif + DisasDelayException *delay_excp_list; } DisasContext; typedef struct { @@ -984,9 +994,38 @@ static void gen_exception(DisasContext *dc, int which) dc->base.is_jmp = DISAS_NORETURN; } -static void gen_check_align(TCGv addr, int mask) +static TCGLabel *delay_exceptionv(DisasContext *dc, TCGv_i32 excp) { - gen_helper_check_align(tcg_env, addr, tcg_constant_i32(mask)); + DisasDelayException *e = g_new0(DisasDelayException, 1); + + e->next = dc->delay_excp_list; + dc->delay_excp_list = e; + + e->lab = gen_new_label(); + e->excp = excp; + e->pc = dc->pc; + /* Caller must have used flush_cond before branch. */ + assert(e->npc != JUMP_PC); + e->npc = dc->npc; + + return e->lab; +} + +static TCGLabel *delay_exception(DisasContext *dc, int excp) +{ + return delay_exceptionv(dc, tcg_constant_i32(excp)); +} + +static void gen_check_align(DisasContext *dc, TCGv addr, int mask) +{ + TCGv t = tcg_temp_new(); + TCGLabel *lab; + + tcg_gen_andi_tl(t, addr, mask); + + flush_cond(dc); + lab = delay_exception(dc, TT_UNALIGNED); + tcg_gen_brcondi_tl(TCG_COND_NE, t, 0, lab); } static void gen_mov_pc_npc(DisasContext *dc) @@ -5019,9 +5058,9 @@ static void disas_sparc_insn(DisasContext * dc, unsigned int insn) tcg_gen_mov_tl(cpu_tmp0, cpu_src1); } } + gen_check_align(dc, cpu_tmp0, 3); gen_helper_restore(tcg_env); gen_mov_pc_npc(dc); - gen_check_align(cpu_tmp0, 3); tcg_gen_mov_tl(cpu_npc, cpu_tmp0); dc->npc = DYNAMIC_PC_LOOKUP; goto jmp_insn; @@ -5044,12 +5083,9 @@ static void disas_sparc_insn(DisasContext * dc, unsigned int insn) switch (xop) { case 0x38: /* jmpl */ { - TCGv t = gen_dest_gpr(dc, rd); - tcg_gen_movi_tl(t, dc->pc); - gen_store_gpr(dc, rd, t); - + gen_check_align(dc, cpu_tmp0, 3); + gen_store_gpr(dc, rd, tcg_constant_tl(dc->pc)); gen_mov_pc_npc(dc); - gen_check_align(cpu_tmp0, 3); gen_address_mask(dc, cpu_tmp0); tcg_gen_mov_tl(cpu_npc, cpu_tmp0); dc->npc = DYNAMIC_PC_LOOKUP; @@ -5060,8 +5096,8 @@ static void disas_sparc_insn(DisasContext * dc, unsigned int insn) { if (!supervisor(dc)) goto priv_insn; + gen_check_align(dc, cpu_tmp0, 3); gen_mov_pc_npc(dc); - gen_check_align(cpu_tmp0, 3); tcg_gen_mov_tl(cpu_npc, cpu_tmp0); dc->npc = DYNAMIC_PC; gen_helper_rett(tcg_env); @@ -5643,6 +5679,7 @@ static void sparc_tr_translate_insn(DisasContextBase *dcbase, CPUState *cs) static void sparc_tr_tb_stop(DisasContextBase *dcbase, CPUState *cs) { DisasContext *dc = container_of(dcbase, DisasContext, base); + DisasDelayException *e, *e_next; bool may_lookup; switch (dc->base.is_jmp) { @@ -5704,6 +5741,19 @@ static void sparc_tr_tb_stop(DisasContextBase *dcbase, CPUState *cs) default: g_assert_not_reached(); } + + for (e = dc->delay_excp_list; e ; e = e_next) { + gen_set_label(e->lab); + + tcg_gen_movi_tl(cpu_pc, e->pc); + if (e->npc % 4 == 0) { + tcg_gen_movi_tl(cpu_npc, e->npc); + } + gen_helper_raise_exception(tcg_env, e->excp); + + e_next = e->next; + g_free(e); + } } static void sparc_tr_disas_log(const DisasContextBase *dcbase, From patchwork Sun Oct 22 05:59:04 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 736955 Delivered-To: patch@linaro.org Received: by 2002:adf:dd81:0:b0:32d:baff:b0ca with SMTP id x1csp1005556wrl; Sat, 21 Oct 2023 23:11:18 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEIeA/1lxft6f/y8BViLVR1YJjInoRA7GB+X6qEqJiBPR9jsRAIKftAF7oy3TZgMW454l/7 X-Received: by 2002:a05:622a:19a3:b0:418:f63f:7fd with SMTP id u35-20020a05622a19a300b00418f63f07fdmr6969607qtc.6.1697955078275; Sat, 21 Oct 2023 23:11:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697955078; cv=none; d=google.com; s=arc-20160816; b=mkY62nz/SgwK1GHsnoE2LUP2V65KRO9DQZi3lL1UXVUtRMbb7v3CQJBh4ss+XB6nOW AG+67FqMUd97FakziUhKoc8lvnwWSG2X2rvWLFK50adXOu07kX8J6UvBZEr9zzbeZAgF BLheYYNiJCPnraIwsvV3CXACcksUIHLnuSXml0JFkbmDSicZ00vxasB4PlDpQ3uMRLFX BEX54PGtNh9w17EJd19c2yRrkt/bZd6GW4rQtFbsUMOcr2ROeG3UQzTT8as7506Eo+Bv wB7g4p0vibvECsfQtwOr6OlOvR0Ts6UYrp3qRJBVsgA0sNYiw9or564iexsT63kiMb1K yfXA== 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=/T5XaZy2rs7d2UUVgUOSmmRBHeDvLpxjj7qjWAVo54c=; fh=TYrED6TOMxGX0VC4GtjviASLbYyJe19+7/tKWjN44KQ=; b=tu0B8qmDDPhgZqfXAyQxoiiaSC6U4HVHmhSR2Syqjw4be7FsTbwN7KHAt3rZt2gq/i nLEh2fZVpj2jFfEkFSl+AZkhCgZA8NzMppVAR41BosdjgRoJM2K8Loa5e7DMLIA9lDok gAaxgiON4MI5TJqVGkTDg1Bbekh68p+AirfeNZlPnuF960huZk64wiAV/MjkuPL4fwVA EVF3EoLwxKNsyDTHcoNC+B4ERXdixtnObM4tuHq5XQDnWSlcId8ZYQ0B4onq18OASSXi TcCeAmvfNoSqFh9eOECIES9AKx/OJRxuxckLn6Zd82v0iOw5iEZL9/bQjkveKLEFcnJ7 roHw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=aWxtnsJN; 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 v9-20020a05622a144900b004181d34928esi3873876qtx.373.2023.10.21.23.11.18 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sat, 21 Oct 2023 23:11:18 -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=aWxtnsJN; 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 1quRW4-0000Vh-4v; Sun, 22 Oct 2023 02:00:48 -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 1quRVv-0000MK-ON for qemu-devel@nongnu.org; Sun, 22 Oct 2023 02:00:42 -0400 Received: from mail-pl1-x635.google.com ([2607:f8b0:4864:20::635]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1quRVt-0001U4-2k for qemu-devel@nongnu.org; Sun, 22 Oct 2023 02:00:39 -0400 Received: by mail-pl1-x635.google.com with SMTP id d9443c01a7336-1c9b95943beso18507655ad.1 for ; Sat, 21 Oct 2023 23:00:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1697954435; x=1698559235; 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=/T5XaZy2rs7d2UUVgUOSmmRBHeDvLpxjj7qjWAVo54c=; b=aWxtnsJNGLl5P9eBIYxTc1+1HL/SIO+lmc1N/glDouyJdWxKuV6QK2A0nvKzVx472S 2b/rgPZZvuMJk6X7vugujVUO15JyPnm+VsWIQy+PvaGlULV9gI/Gwt3A4WmCRtPLu5+5 NFUO4npIXjy1jy5QzoFOW7Fj5rcjSOxw7Kneu5MOgjZdMKPajYajyCQUgoZ0eptaFn1p 2BCwkAuyoUPgqSjMVxDWfra6GdhxJCPHfClFiUiykeexpD4OELrxiDcZ8YAyxgfG41gT 8eufhu1DPot18gi8fHZCZg7yjW6cHiGvqnjFUK/jCXdAnE4gOsFFtJC/XqF/YyaHLc2e kwtA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697954435; x=1698559235; 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=/T5XaZy2rs7d2UUVgUOSmmRBHeDvLpxjj7qjWAVo54c=; b=PEUaQY0DlEveHJAHFLuf/sTa9uqiIp2JhB8X+AJRUHjOO5XruIyZIjbHErzk0XBwuo 49gofqpOU677uoB02rEezOmhJxAgshH7s811LSHdEvtMfngI7BWf1pe6WBy+tERoGA9l UVzQeZCZ4KWqRXRQAehi7EYHc2EQMdTiMj91GtBIhFEDXMcTVtEfcTnX8kZto8YPhsSa rsclH9id1X8f+zYvBO6IrFmHZ1j56ncyp3Z4L50wNYgm5nI6dXxsjBtWX7E5zUEk3Twm xLQZp95Te6wd+ATy1FsPI3ENe00kYhfBBi0eyw1sznlWSbv5syqO7q5sYM5pr46wf/uZ 0G9w== X-Gm-Message-State: AOJu0Yw9rRSQz6XrhjMEOHFlJ+bDGmZ/VjxoE5Z1EUKeKfVZJH+AIhY9 jX/cYr4CiqSzkQZ/UunAVsKEyap6OcgdPwgIcCs= X-Received: by 2002:a17:903:2285:b0:1c9:b196:d294 with SMTP id b5-20020a170903228500b001c9b196d294mr6971960plh.20.1697954435652; Sat, 21 Oct 2023 23:00:35 -0700 (PDT) Received: from stoup.. ([71.212.149.95]) by smtp.gmail.com with ESMTPSA id je17-20020a170903265100b001c728609574sm3999887plb.6.2023.10.21.23.00.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 21 Oct 2023 23:00:35 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: mark.cave-ayland@ilande.co.uk Subject: [PATCH v4 03/90] target/sparc: Avoid helper_raise_exception in helper_st_asi Date: Sat, 21 Oct 2023 22:59:04 -0700 Message-Id: <20231022060031.490251-4-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231022060031.490251-1-richard.henderson@linaro.org> References: <20231022060031.490251-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::635; envelope-from=richard.henderson@linaro.org; helo=mail-pl1-x635.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 Always use cpu_raise_exception_ra with GETPC for unwind. Signed-off-by: Richard Henderson --- target/sparc/ldst_helper.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/target/sparc/ldst_helper.c b/target/sparc/ldst_helper.c index 246de86c98..09066d5487 100644 --- a/target/sparc/ldst_helper.c +++ b/target/sparc/ldst_helper.c @@ -1650,7 +1650,7 @@ void helper_st_asi(CPUSPARCState *env, target_ulong addr, target_ulong val, int idx = ((asi & 2) >> 1) | ((asi & 8) >> 2); env->dmmu.sun4v_tsb_pointers[idx] = val; } else { - helper_raise_exception(env, TT_ILL_INSN); + goto illegal_insn; } break; case 0x33: @@ -1662,7 +1662,7 @@ void helper_st_asi(CPUSPARCState *env, target_ulong addr, target_ulong val, */ env->dmmu.sun4v_ctx_config[(asi & 8) >> 3] = val; } else { - helper_raise_exception(env, TT_ILL_INSN); + goto illegal_insn; } break; case 0x35: @@ -1679,7 +1679,7 @@ void helper_st_asi(CPUSPARCState *env, target_ulong addr, target_ulong val, int idx = ((asi & 2) >> 1) | ((asi & 8) >> 2); env->immu.sun4v_tsb_pointers[idx] = val; } else { - helper_raise_exception(env, TT_ILL_INSN); + goto illegal_insn; } break; case 0x37: @@ -1691,7 +1691,7 @@ void helper_st_asi(CPUSPARCState *env, target_ulong addr, target_ulong val, */ env->immu.sun4v_ctx_config[(asi & 8) >> 3] = val; } else { - helper_raise_exception(env, TT_ILL_INSN); + goto illegal_insn; } break; case ASI_UPA_CONFIG: /* UPA config */ @@ -1920,6 +1920,8 @@ void helper_st_asi(CPUSPARCState *env, target_ulong addr, target_ulong val, default: sparc_raise_mmu_fault(cs, addr, true, false, 1, size, GETPC()); return; + illegal_insn: + cpu_raise_exception_ra(env, TT_ILL_INSN, GETPC()); } } #endif /* CONFIG_USER_ONLY */ From patchwork Sun Oct 22 05:59:05 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 736959 Delivered-To: patch@linaro.org Received: by 2002:adf:dd81:0:b0:32d:baff:b0ca with SMTP id x1csp1005624wrl; Sat, 21 Oct 2023 23:11:39 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGvWr1vHm62HN4zhP69noPWgck5dFzT6YEXYlIGpeCLCQdh04b//+VrffkCFB/qSmOm3Saj X-Received: by 2002:a05:622a:1b8e:b0:417:d6c7:ea69 with SMTP id bp14-20020a05622a1b8e00b00417d6c7ea69mr6879896qtb.7.1697955098736; Sat, 21 Oct 2023 23:11:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697955098; cv=none; d=google.com; s=arc-20160816; b=i6gFRG/jhgi2O6H+ITU0tnGceWKp2iY2+avJxQ6kyPObS4a7eCoKbk7+Y6+RuZRMyh NkrABzY4vZdD0siTZrYJVlTZIEIxle5ghzP2fK1zTX6pHmdex9KpEhw89uLa7NetE7H1 my72OoUb0tulMMWpLbyUi6W6+Lk+lfmZAn8uxdCJaK88QfomU1hWuxBZiFakhOFEEZyN EXTuIFzKr7NcyWnbHk4vbBbIgTjW2fmg6SZqJLHispQ+EXf2vtcY/4t4ibBL+sGPhsVy hPorskZugpZkO/kUJU9t5485EXloUUEjk6NfIEtaRAwr9huwAQm2/yzorMzDEkfkWcgu WuAg== 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=Xd5Svu0+B7OGG++QiM45a02WgNYRHjpbrT0y5ShkAgs=; fh=GkmytpQ/aBK+SnhsUxtqa1dYh9qnVue5D4c8ejqHfb0=; b=jOQzQguHRsojcrLrc/pU4oZ6Zgam7RhVGrtQ+UGxrfgq5AT6d2Shv3sR1K0AKZXZnl 9Thp77M91ZXv0GiaV2Dc+U+GgSe7DXNezzOgjToFP/LixjgdVEM26JpdOwAYGw0cmrWD LPoFIQ8GDNs9CCZG7I/7ZBjHN0GZBytQ0nH4qb70MdldiMFF5ErxdjwIP/vv0Royf51L JUXTeWUx1oe+G3yHn3pKTx9CV6f7pMMj7knM6cM4QTQ1xjccrqX3upIZpYYVTQjH8EFW xoff2DL75DDVjjiK+ibUcjhwKpzsUSfwqCR6CG0jLLPRHHPKJonWeOl9LcUtx0oAjPKp JLuQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=cd6jvtOq; 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 h20-20020a05622a171400b0041985083e84si3661259qtk.105.2023.10.21.23.11.38 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sat, 21 Oct 2023 23:11:38 -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=cd6jvtOq; 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 1quRW0-0000Te-PO; Sun, 22 Oct 2023 02:00:44 -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 1quRVy-0000NM-32 for qemu-devel@nongnu.org; Sun, 22 Oct 2023 02:00:42 -0400 Received: from mail-pg1-x533.google.com ([2607:f8b0:4864:20::533]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1quRVu-0001UR-2a for qemu-devel@nongnu.org; Sun, 22 Oct 2023 02:00:39 -0400 Received: by mail-pg1-x533.google.com with SMTP id 41be03b00d2f7-5859a7d6556so1729791a12.0 for ; Sat, 21 Oct 2023 23:00:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1697954436; x=1698559236; 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=Xd5Svu0+B7OGG++QiM45a02WgNYRHjpbrT0y5ShkAgs=; b=cd6jvtOq9pwgTqPmNqOzqIj6EO0/D41oaEtIzb6j1Q5+ww33cbs9Iy/4zambvCyk2A VnWdnLQqVGVGH8ro3FHTpNVGVjanoV79Mtbj6Oa1dLOPrfdlsa58mtN+kt1Vdnpej0VP 2uXASFYxvmfjbYblwmrj5oPcjQX8QQ2SroannGENomUYwoa9nXQruW8fx3E+Mtg7f+lQ LdzLWi9RgpQCZOXiMmOatfaTfUIZ5dYusVKbG3Fg+5Fnt9qYQeylhd1+66KdZe8gCi3d xvgBjZN5l16BG8kHlDilrLW2ip2Jl3lE2KMbFzKJrZZCZOgk9MGk/vxqRSQYyHYFHTTJ XOOQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697954436; x=1698559236; 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=Xd5Svu0+B7OGG++QiM45a02WgNYRHjpbrT0y5ShkAgs=; b=aihDWFq8FWYwxpP+JSeO7tgiSHJK+vtFOhGGT7WA83z3PkkA42KvutTLmrvdrLXsbx 9zTC2lS58aO1/JrrXJdTxTY+aNMeHL06LUXRYZ3KVqFb+UlGNT10ZGBr3QZE0bTvd21r 0Ow4wZSRo9aGxsP6ZGuy76lVLK9pPhvB7xv9ej0gXoXe7fqLCMzrgUiZPf+1sNNAobYQ 5VGgHIqwfRRYXagUPNHIckXWMcFTrEcRCddkm8oNdsgxRaQEcUyc701h5oza/e4f7Z+a 2HQTCcG0ZaFXRt8AVo5df/7cb68i1W+tT3dD84RUCrdpcwBlGJA0DIdC1q9t7Yr7VO8Z iSPA== X-Gm-Message-State: AOJu0YwNFtkaaEm0OAJf27JS16iFoujFi+JX6BdYNIv76Cje6TAcGYEh ZBikxHZ1Itd97oJI8DN1gOe+S3LD9wXJss/Eei8= X-Received: by 2002:a17:902:e0cb:b0:1c9:e85a:4296 with SMTP id e11-20020a170902e0cb00b001c9e85a4296mr5017259pla.6.1697954436531; Sat, 21 Oct 2023 23:00:36 -0700 (PDT) Received: from stoup.. ([71.212.149.95]) by smtp.gmail.com with ESMTPSA id je17-20020a170903265100b001c728609574sm3999887plb.6.2023.10.21.23.00.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 21 Oct 2023 23:00:36 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: mark.cave-ayland@ilande.co.uk, =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Subject: [PATCH v4 04/90] target/sparc: Set TCG_GUEST_DEFAULT_MO Date: Sat, 21 Oct 2023 22:59:05 -0700 Message-Id: <20231022060031.490251-5-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231022060031.490251-1-richard.henderson@linaro.org> References: <20231022060031.490251-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::533; envelope-from=richard.henderson@linaro.org; helo=mail-pg1-x533.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 Always use TSO, per the Oracle 2015 manual. This is slightly less restrictive than the TCG_MO_ALL default, and happens to match the i386 model, which will eliminate a few extra barriers on that host. Reviewed-by: Philippe Mathieu-Daudé Signed-off-by: Richard Henderson --- target/sparc/cpu.h | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/target/sparc/cpu.h b/target/sparc/cpu.h index b3a98f1d74..9fc5c401d2 100644 --- a/target/sparc/cpu.h +++ b/target/sparc/cpu.h @@ -6,6 +6,29 @@ #include "exec/cpu-defs.h" #include "qemu/cpu-float.h" +/* + * From Oracle SPARC Architecture 2015: + * + * Compatibility notes: The PSO memory model described in SPARC V8 and + * SPARC V9 compatibility architecture specifications was never implemented + * in a SPARC V9 implementation and is not included in the Oracle SPARC + * Architecture specification. + * + * The RMO memory model described in the SPARC V9 specification was + * implemented in some non-Sun SPARC V9 implementations, but is not + * directly supported in Oracle SPARC Architecture 2015 implementations. + * + * Therefore always use TSO in QEMU. + * + * D.5 Specification of Partial Store Order (PSO) + * ... [loads] are followed by an implied MEMBAR #LoadLoad | #LoadStore. + * + * D.6 Specification of Total Store Order (TSO) + * ... PSO with the additional requirement that all [stores] are followed + * by an implied MEMBAR #StoreStore. + */ +#define TCG_GUEST_DEFAULT_MO (TCG_MO_LD_LD | TCG_MO_LD_ST | TCG_MO_ST_ST) + #if !defined(TARGET_SPARC64) #define TARGET_DPREGS 16 #else From patchwork Sun Oct 22 05:59:06 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 736935 Delivered-To: patch@linaro.org Received: by 2002:adf:dd81:0:b0:32d:baff:b0ca with SMTP id x1csp1003869wrl; Sat, 21 Oct 2023 23:04:45 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEwkDvL0eKOKbK8sssla2QuGDbcvbcWUPPblKRKvrkl/NljlCDqjWySTcnk3vMREXcveTdA X-Received: by 2002:a05:6214:1d21:b0:66d:19b5:9a3 with SMTP id f1-20020a0562141d2100b0066d19b509a3mr8169111qvd.29.1697954685033; Sat, 21 Oct 2023 23:04:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697954685; cv=none; d=google.com; s=arc-20160816; b=x7JEcsZTQurJid4SO6gm4TATbVYudLODUr2MiRv06n9Cn4oKvjDdnVbI5TxWqaqiqL 9f5RaiQFAyiLdy3l/ltexvbw+XwN0XrqDcyIEwtX9ycXdba5BIhGvMtERxtkGrn5Pl9D CTbARTiC4NytI1nDa+3eW9c/NUGu0E0muspulDn+6FbnfYcFg3X/PvXM+DCve3x+jcty J0OWrBgjegk40iX8V3zKAEpyQO6Q5e5gcNSjIFTVI5g68OKZPS9GhXpeDCBrcHu2u0qq KTMRlEsNkOZhJtLZTFzKUQ/yvxEzCErqZVTg81PATZK1OlfqjodJM7PNV9lKVKqJKpI3 L0Cw== 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=jct63rFb48sV+5hvOO6V2h6GbxQHLHhpSIfreHhtJXo=; fh=TYrED6TOMxGX0VC4GtjviASLbYyJe19+7/tKWjN44KQ=; b=SdcY4YycbZGCthchXKkWSkciGxA8MnQ/RGyOStGIEfI+m1qLGiP2dwgR/TNbxlyozU FPm+aX+G0evP90OUkVe/esvsLsXECuvhEA8/APGMa3bAapnpk5A8U13f65Bl4x05QqW2 yJhKB7OlTfHTyockJN4z1e+LYvYs4ZpibKwku8/yYS1TIB2Gddsp3trXeyRjz1uf/8+A ggG6ao/eGUYoZYYQU6+Axss8pQIHd4Q0ZhU5Fc7MoU0ZpJZ1nHzBswOlThEXY5iJqC34 OhlBe+hSYGYfEefqy/972XyS3vLUZHa29iL+rzZVvH3xRkzEaZqqFboGfyVvuZiud4et tKVw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=AlYg2q8I; 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 ld6-20020a056214418600b0065ae2cc68f3si4014875qvb.387.2023.10.21.23.04.44 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sat, 21 Oct 2023 23:04:45 -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=AlYg2q8I; 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 1quRW3-0000Vb-In; Sun, 22 Oct 2023 02:00:47 -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 1quRVy-0000NL-32 for qemu-devel@nongnu.org; Sun, 22 Oct 2023 02:00:42 -0400 Received: from mail-oa1-x30.google.com ([2001:4860:4864:20::30]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1quRVu-0001Uc-Ro for qemu-devel@nongnu.org; Sun, 22 Oct 2023 02:00:40 -0400 Received: by mail-oa1-x30.google.com with SMTP id 586e51a60fabf-1e993765c1bso1704004fac.3 for ; Sat, 21 Oct 2023 23:00:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1697954437; x=1698559237; 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=jct63rFb48sV+5hvOO6V2h6GbxQHLHhpSIfreHhtJXo=; b=AlYg2q8I30aJZ/PSwhKyohGf+rU15DlOLc2vH78s/BIcKZGv1/MEhMV2p2MrpUgpst wGoJrldnNB37f5bx4O0OS9gFL/XWaGUlHh7FWZaqywPUo5Wg4sezhDVa7z2VPYcfPUg9 I09NHvaFdJq0M+6cYBFl1HV9pVhMUwVP01F5P06xBdJzZBvTm1aJOXA9koXKtwpajTKT MV1x++hvb+PxRuy5vsmhmILsHqxIpnL7HxU6THgsOzUBCPr8O0qrqQEzg0IQLZhQvCYj LEsfR+pX72cUQf3vb8cIHnRXzaP9o4w/OzoPc5L67DhXZVCmxBBMZS4kIWu4sDROok/F nHNg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697954437; x=1698559237; 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=jct63rFb48sV+5hvOO6V2h6GbxQHLHhpSIfreHhtJXo=; b=hiN4U+2N+sM6LvNq0Hgvfs6E6gwsKOb7QOXzV/QEiU0lIvDtD3MytUqUDUOHraV43l rUtVtDDNcvzeof9QcnLuriSPZ2byKNIZ8DG33Vy/7U9HaEHiaqXvq80taupwLPH5+rZh uIa88Suw3n//L92AfKomndyol07QKz6v8Htzaakm3vESBYuN6SIgNg6RRj0WD7dsmwaa rEYmhNCu2XAM5FVvk+DNLxT7FuUsTbROn38459CrDskUw3AWj1DcfW5tM/kQVXQ0QMKK V5dJ1B+73aY76K5OvupwC+fuJfaWjviqpbDJZBpGfYDxcbmFVpWwYFk85PnHr5VI5iVS Igjw== X-Gm-Message-State: AOJu0Yw7bxSO13wllQ7aqicBgLMnKL58QonvkWqq37cs4p//tD3SonxQ zLwbI3rXQJGz5wnMGL6K02ibVdgIAyOi5jl9fB8= X-Received: by 2002:a05:6871:b405:b0:1e9:8780:a0e with SMTP id br5-20020a056871b40500b001e987800a0emr5123477oac.28.1697954437329; Sat, 21 Oct 2023 23:00:37 -0700 (PDT) Received: from stoup.. ([71.212.149.95]) by smtp.gmail.com with ESMTPSA id je17-20020a170903265100b001c728609574sm3999887plb.6.2023.10.21.23.00.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 21 Oct 2023 23:00:36 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: mark.cave-ayland@ilande.co.uk Subject: [PATCH v4 05/90] configs: Enable MTTCG for sparc, sparc64 Date: Sat, 21 Oct 2023 22:59:06 -0700 Message-Id: <20231022060031.490251-6-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231022060031.490251-1-richard.henderson@linaro.org> References: <20231022060031.490251-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2001:4860:4864:20::30; envelope-from=richard.henderson@linaro.org; helo=mail-oa1-x30.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 This will be of small comfort to sparc64, because both sun4u and sun4v board models force max_cpus = 1. But it does enable actual smp for sparc32 sun4m. Signed-off-by: Richard Henderson --- configs/targets/sparc-softmmu.mak | 1 + configs/targets/sparc64-softmmu.mak | 1 + 2 files changed, 2 insertions(+) diff --git a/configs/targets/sparc-softmmu.mak b/configs/targets/sparc-softmmu.mak index 454eb35499..a5d9200382 100644 --- a/configs/targets/sparc-softmmu.mak +++ b/configs/targets/sparc-softmmu.mak @@ -1,2 +1,3 @@ TARGET_ARCH=sparc TARGET_BIG_ENDIAN=y +TARGET_SUPPORTS_MTTCG=y diff --git a/configs/targets/sparc64-softmmu.mak b/configs/targets/sparc64-softmmu.mak index d3f8a3b710..36ca64ec41 100644 --- a/configs/targets/sparc64-softmmu.mak +++ b/configs/targets/sparc64-softmmu.mak @@ -1,3 +1,4 @@ TARGET_ARCH=sparc64 TARGET_BASE_ARCH=sparc TARGET_BIG_ENDIAN=y +TARGET_SUPPORTS_MTTCG=y From patchwork Sun Oct 22 05:59:07 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 736948 Delivered-To: patch@linaro.org Received: by 2002:adf:dd81:0:b0:32d:baff:b0ca with SMTP id x1csp1004462wrl; Sat, 21 Oct 2023 23:06:59 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFEsXa/+KFPJdP/Qd707WT+3eQZGBqO1a80MGqYAYkzBYZcxR9U1WetK19LpbdH7NhmeXBW X-Received: by 2002:ad4:5de4:0:b0:66d:696b:db75 with SMTP id jn4-20020ad45de4000000b0066d696bdb75mr7524382qvb.32.1697954819311; Sat, 21 Oct 2023 23:06:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697954819; cv=none; d=google.com; s=arc-20160816; b=DRBCgOdYM5Q2SJmrPuBHgkUT1qvAwXmM2wwp8xsx0eK06WdDcMVqNnsEdQ+WFEE7Ca Fku8C8N2rE8AR+ZflH60juSxOUIlbgGDPFN/Mzo12W7Ge+TNcEgu8NGBc8/ULs5rvrN9 buiS/di3IPjW407GqZGL56gxd417pk2CknM/dIby0oii3LtTM4lDJKhE1z0X/lflQpsc f8aNzgO7mnc11UnXw7p6IMAJ+7HndKndyYktVKMk+pI9b99RJyEYyIQ83PEjmLX3t7YN NeNn2DNRbYop9Dc300Q3Tt6oj4Ktq5+4R361kYANN3x/6QcmjLLeJanzwJoYJDM+gequ GYwQ== 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=tQ1zFkOdaQ00+kG6T0oOcQWDrsqZkAPXDw5MzbWcocE=; fh=TYrED6TOMxGX0VC4GtjviASLbYyJe19+7/tKWjN44KQ=; b=bpcARjS1PLfNOI1DsyAx3ZKLdvJvvV+aXu2Hhn/MlPdYpZCsvaFtLrJHaJMB7Rk/j2 jnL638netDCmoOjzL4n1uAS8H/z8kEIivzL2KC5rDDzokzopNxeUgLjTbxAZ2nUDPYaL IEvsnsY4gPgmxqBWxv1pmZyEru7D9y6R1w2SrUJA078l0GEU+RNgmgQjnozDHyZsX9qN 6r3ZXuvSRi8e673sL/UYLLEz46PdUQMENWSo2wCscTDegEQMOyaTnBqmh0wOhMEEJ4mm TzpS0AM8zpt/tTh80i9O7Xf2vE56b1zA18qvsa4Fbm2sjpyrX16E3bCfwEAfPxbG37pS vTKw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=qW+39a1u; 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 pc19-20020a056214489300b0066cf6a75891si4063183qvb.601.2023.10.21.23.06.59 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sat, 21 Oct 2023 23:06:59 -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=qW+39a1u; 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 1quRW4-0000Vz-Br; Sun, 22 Oct 2023 02:00:48 -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 1quRVz-0000OX-1A for qemu-devel@nongnu.org; Sun, 22 Oct 2023 02:00:43 -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 1quRVv-0001Us-8A for qemu-devel@nongnu.org; Sun, 22 Oct 2023 02:00:42 -0400 Received: by mail-oi1-x22f.google.com with SMTP id 5614622812f47-3b3ec45d6e9so1515876b6e.0 for ; Sat, 21 Oct 2023 23:00:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1697954438; x=1698559238; 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=tQ1zFkOdaQ00+kG6T0oOcQWDrsqZkAPXDw5MzbWcocE=; b=qW+39a1ugRe+Xa9In7JE6U4kNvp2x1fOntzxXcGfFno1fQ4aR2qKtszcp2hIc89vn+ WoGEQTss4EcE9RPK/tYj03Q8TlerR1XBP656V5YC6IhkFVNiooPdEnvyBAXjOfd0wYJ6 Ralyj/Wq/D9NMgIXutGMfMwwOnxjiGt5XJuHxt6HqsI1biOifDHVE6SLWQrDe22Lnj9Z MEHUrukXxyhbMnd8bKTPquBJDPkn+3dAa5ykB43+6NljcQZkFU5oqsB4bvDKRSmNxnZA bBEV26UvdW92RgjC+j5raPb8CPC86GW7iOW0poNO9zkLxpbngmNoD2w5630Ov3x/rv04 XiZg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697954438; x=1698559238; 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=tQ1zFkOdaQ00+kG6T0oOcQWDrsqZkAPXDw5MzbWcocE=; b=Q7k0yvu55yeEyVoiDIiW5EKoWA9ripMCBtf8yBBzYPlZKipzyxWXAOP/zxyNfWroWp v+zs29VvMk6dyeBzeXpBRZ75C2yixyDiLrBAuabuK+cf+krq1AtIPE2Wexp/5GwSE22G bloATXRVCPv5c6ZDOC0hkDt98DclAHeGu3CBjYrmaBx67xQ3j+EPF95Wx/GK8pYtA1l5 DX5xrxkxunk6HZ6MhP0iXoFvhxek/5nTcntu35hh4JJsEnc2ABBqVKQB6Dqbq7LbrUuc Wwe9vt5fgQX0wfbaeW2lObn2mQXJNORrCkZpXAH2XeMf9yJWRPIDwsHWmv3Vohq4FEZ8 J0mQ== X-Gm-Message-State: AOJu0YzpvfW7XQNowLYTY4FFNZ9lpY0of287oA7nAVpDnBMdLfTTYSwb G96EKeLTPUjr42IyEjGpf3ACvZ7wL2KkNKQddwY= X-Received: by 2002:a05:6808:ecb:b0:3b2:ee79:c0fd with SMTP id q11-20020a0568080ecb00b003b2ee79c0fdmr7554968oiv.1.1697954438056; Sat, 21 Oct 2023 23:00:38 -0700 (PDT) Received: from stoup.. ([71.212.149.95]) by smtp.gmail.com with ESMTPSA id je17-20020a170903265100b001c728609574sm3999887plb.6.2023.10.21.23.00.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 21 Oct 2023 23:00:37 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: mark.cave-ayland@ilande.co.uk Subject: [PATCH v4 06/90] target/sparc: Define features via cpu-feature.h.inc Date: Sat, 21 Oct 2023 22:59:07 -0700 Message-Id: <20231022060031.490251-7-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231022060031.490251-1-richard.henderson@linaro.org> References: <20231022060031.490251-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 Manage feature bits automatically. Signed-off-by: Richard Henderson --- target/sparc/cpu.h | 32 +++++++++++++------------------- target/sparc/cpu-feature.h.inc | 19 +++++++++++++++++++ 2 files changed, 32 insertions(+), 19 deletions(-) create mode 100644 target/sparc/cpu-feature.h.inc diff --git a/target/sparc/cpu.h b/target/sparc/cpu.h index 9fc5c401d2..aaecbf0876 100644 --- a/target/sparc/cpu.h +++ b/target/sparc/cpu.h @@ -291,25 +291,19 @@ struct sparc_def_t { uint32_t maxtl; }; -#define CPU_FEATURE_FLOAT (1 << 0) -#define CPU_FEATURE_FLOAT128 (1 << 1) -#define CPU_FEATURE_SWAP (1 << 2) -#define CPU_FEATURE_MUL (1 << 3) -#define CPU_FEATURE_DIV (1 << 4) -#define CPU_FEATURE_FLUSH (1 << 5) -#define CPU_FEATURE_FSQRT (1 << 6) -#define CPU_FEATURE_FMUL (1 << 7) -#define CPU_FEATURE_VIS1 (1 << 8) -#define CPU_FEATURE_VIS2 (1 << 9) -#define CPU_FEATURE_FSMULD (1 << 10) -#define CPU_FEATURE_HYPV (1 << 11) -#define CPU_FEATURE_CMT (1 << 12) -#define CPU_FEATURE_GL (1 << 13) -#define CPU_FEATURE_TA0_SHUTDOWN (1 << 14) /* Shutdown on "ta 0x0" */ -#define CPU_FEATURE_ASR17 (1 << 15) -#define CPU_FEATURE_CACHE_CTRL (1 << 16) -#define CPU_FEATURE_POWERDOWN (1 << 17) -#define CPU_FEATURE_CASA (1 << 18) +#define FEATURE(X) CPU_FEATURE_BIT_##X, +enum { +#include "cpu-feature.h.inc" +}; + +#undef FEATURE +#define FEATURE(X) CPU_FEATURE_##X = 1u << CPU_FEATURE_BIT_##X, + +enum { +#include "cpu-feature.h.inc" +}; + +#undef FEATURE #ifndef TARGET_SPARC64 #define CPU_DEFAULT_FEATURES (CPU_FEATURE_FLOAT | CPU_FEATURE_SWAP | \ diff --git a/target/sparc/cpu-feature.h.inc b/target/sparc/cpu-feature.h.inc new file mode 100644 index 0000000000..d35fe90c92 --- /dev/null +++ b/target/sparc/cpu-feature.h.inc @@ -0,0 +1,19 @@ +FEATURE(FLOAT) +FEATURE(FLOAT128) +FEATURE(SWAP) +FEATURE(MUL) +FEATURE(DIV) +FEATURE(FLUSH) +FEATURE(FSQRT) +FEATURE(FMUL) +FEATURE(VIS1) +FEATURE(VIS2) +FEATURE(FSMULD) +FEATURE(HYPV) +FEATURE(CMT) +FEATURE(GL) +FEATURE(TA0_SHUTDOWN) /* Shutdown on "ta 0x0" */ +FEATURE(ASR17) +FEATURE(CACHE_CTRL) +FEATURE(POWERDOWN) +FEATURE(CASA) From patchwork Sun Oct 22 05:59:08 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 736927 Delivered-To: patch@linaro.org Received: by 2002:adf:dd81:0:b0:32d:baff:b0ca with SMTP id x1csp1003084wrl; Sat, 21 Oct 2023 23:01:56 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGatEki43Q/INSckytqwk68nhui4Sy9oIGdZJQ6dqtwCQusn2LpnehgrNarW/nzTEHZO6gh X-Received: by 2002:a05:620a:40cb:b0:777:73d3:1f55 with SMTP id g11-20020a05620a40cb00b0077773d31f55mr8650586qko.6.1697954516096; Sat, 21 Oct 2023 23:01:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697954516; cv=none; d=google.com; s=arc-20160816; b=ZbHotNvU2nJIXkW+Yzm1L/H+HiZ/AEP7oDgHDMd4CQMwvY+N7G8IIG336LeYq8GwuW gVpIFnZeIYfRAVeDHHRQ5S0EfTOzgKOnhS3kCV4jxZzQFEopBQFIu/n/U3KtXx9Lob/L vQo1M5nLyS5nNtkt6yDgShGu9HJJmO29MBaFY7qkvKNWJb3jVOQvbdVc4TFHJ0eP/97n uT3tmRkjLoLWqOxe6rma7Eqeu/CfOi7wA7AWXUa4QiphJ8ho38HyYTvQ5+bneCl2gtP4 oR8twmbSkvUjZR52bu1lRkl6dBr1Tp57V8xsWVK4FloMTee2HYRUCjhZGvY4BT6l9xLM 4fPg== 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=ZH3dMD/AA/crmsUs16Itr1WvEaqL+uLcI9qPlF9Ii5g=; fh=TYrED6TOMxGX0VC4GtjviASLbYyJe19+7/tKWjN44KQ=; b=ruXNrzgxTjrgLzRDh8h9Ur/m3AjHHdo76/l41m6rVYtum8mqeWmD6kzFQrMORgh+YU 7MXyJLC82PxJa+h5JitS/5CCRa6hwIyQupi9hMDKie8D1NsZTw6759HRFAbYOHA3QtQT BgFdsXXJ0/boLJBoeNo2UUk9iVqSWv2Fi1cdjNBRwssH6MF3lkitJOkIVYKfKG36aa/L 1qB6QZE/PcyBdTApa0resF9YH/etkR3alLxAlcXIDRsvQMcabOUdQOe3tS4cRDdI8DR8 odSkaswB3XQM0v+BG4oRfBTCc/Ckn1LFuAJajf6b9cKgXKNa4ayucRA0n63p7AHTeH7U wPEg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=STO0GjON; 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 n2-20020a05620a294200b00779d04f3836si568073qkp.599.2023.10.21.23.01.55 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sat, 21 Oct 2023 23:01:56 -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=STO0GjON; 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 1quRW2-0000VF-F3; Sun, 22 Oct 2023 02:00:46 -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 1quRW0-0000Sd-95 for qemu-devel@nongnu.org; Sun, 22 Oct 2023 02:00:44 -0400 Received: from mail-pl1-x633.google.com ([2607:f8b0:4864:20::633]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1quRVw-0001Vp-Kp for qemu-devel@nongnu.org; Sun, 22 Oct 2023 02:00:43 -0400 Received: by mail-pl1-x633.google.com with SMTP id d9443c01a7336-1c9e06f058bso23986855ad.0 for ; Sat, 21 Oct 2023 23:00:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1697954439; x=1698559239; 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=ZH3dMD/AA/crmsUs16Itr1WvEaqL+uLcI9qPlF9Ii5g=; b=STO0GjONFpggK/GNEXvf8X6Pk/T1KNYoRgP8/IsfTHiZDQnT3qSrniSF94bhIRiMR8 K5+TK3AdSf1X31VoHl2iCsZRvRLxcEpmXxF4UIt+xxPFZVInSBD9l1NZyt10zbQ6hVd0 V5571Xr3E9dQe3SIUfz848sHmDBHo2QSSKTQlrj1GgzA7WQYvTJWmpjg7kcywbxOWNxI f2N3q31a6aJFyyJoiAwY65IQewVAnv+cwJztM0iIqqWZp/iuRw9zrUY0WkTFyTQ7owwE jgXmE7QpbKHgUVOMHiecnGrpwZpVjwyD2df7L/ba5Fx4mvzL0dY4z0g51/2oAUbQrnlB ACTg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697954439; x=1698559239; 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=ZH3dMD/AA/crmsUs16Itr1WvEaqL+uLcI9qPlF9Ii5g=; b=U5sb5/MZW8/Um262a+VFFbwIaAOJCZ4ER9qvwC1fIyjEBj7Ikp7m9JeF53rrNJCTbR TIzLTqoAftVNRwMf65sgC5lmoPSgJ6i++HDBPWp9gIk9g2Q0FUzVKe7x5ozr3L0psbWW DtVU1TF67zA//OtiadRcoXdR6jr/iMvjOGc3TjvsMlATAbw7FVp4IIOnWy7lLN3css4D e0g+H0vm3/BCqvXvO7LVXlXawedE8cVmJ7Gew9CLbvyfU5GKWtnwlg6IHH2SAClkjVFL qSrJM6hHSke3rgRv3z1Xp/m8B5Y81WBGzePWrV4AYUG2JhA2tvVvJkxC5ML09mC7KDcQ 3yWw== X-Gm-Message-State: AOJu0Yy3gJOsia4gPUyxjOc7dv+SmdT18hczuVDv/8bMsOsGIPtuN/mr kX5gAFomt9ynnQO/THSympZnvvXdM1It5QYDn8I= X-Received: by 2002:a17:902:ec87:b0:1bd:e258:a256 with SMTP id x7-20020a170902ec8700b001bde258a256mr8474213plg.32.1697954439002; Sat, 21 Oct 2023 23:00:39 -0700 (PDT) Received: from stoup.. ([71.212.149.95]) by smtp.gmail.com with ESMTPSA id je17-20020a170903265100b001c728609574sm3999887plb.6.2023.10.21.23.00.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 21 Oct 2023 23:00:38 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: mark.cave-ayland@ilande.co.uk Subject: [PATCH v4 07/90] target/sparc: Use CPU_FEATURE_BIT_* for cpu properties Date: Sat, 21 Oct 2023 22:59:08 -0700 Message-Id: <20231022060031.490251-8-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231022060031.490251-1-richard.henderson@linaro.org> References: <20231022060031.490251-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::633; envelope-from=richard.henderson@linaro.org; helo=mail-pl1-x633.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 Use symbols not integer constants for the bit positions. Signed-off-by: Richard Henderson --- target/sparc/cpu.c | 42 ++++++++++++++++++++++++++++-------------- 1 file changed, 28 insertions(+), 14 deletions(-) diff --git a/target/sparc/cpu.c b/target/sparc/cpu.c index 8ba96ae225..e4d1c552e5 100644 --- a/target/sparc/cpu.c +++ b/target/sparc/cpu.c @@ -836,20 +836,34 @@ static PropertyInfo qdev_prop_nwindows = { }; static Property sparc_cpu_properties[] = { - DEFINE_PROP_BIT("float", SPARCCPU, env.def.features, 0, false), - DEFINE_PROP_BIT("float128", SPARCCPU, env.def.features, 1, false), - DEFINE_PROP_BIT("swap", SPARCCPU, env.def.features, 2, false), - DEFINE_PROP_BIT("mul", SPARCCPU, env.def.features, 3, false), - DEFINE_PROP_BIT("div", SPARCCPU, env.def.features, 4, false), - DEFINE_PROP_BIT("flush", SPARCCPU, env.def.features, 5, false), - DEFINE_PROP_BIT("fsqrt", SPARCCPU, env.def.features, 6, false), - DEFINE_PROP_BIT("fmul", SPARCCPU, env.def.features, 7, false), - DEFINE_PROP_BIT("vis1", SPARCCPU, env.def.features, 8, false), - DEFINE_PROP_BIT("vis2", SPARCCPU, env.def.features, 9, false), - DEFINE_PROP_BIT("fsmuld", SPARCCPU, env.def.features, 10, false), - DEFINE_PROP_BIT("hypv", SPARCCPU, env.def.features, 11, false), - DEFINE_PROP_BIT("cmt", SPARCCPU, env.def.features, 12, false), - DEFINE_PROP_BIT("gl", SPARCCPU, env.def.features, 13, false), + DEFINE_PROP_BIT("float", SPARCCPU, env.def.features, + CPU_FEATURE_BIT_FLOAT, false), + DEFINE_PROP_BIT("float128", SPARCCPU, env.def.features, + CPU_FEATURE_BIT_FLOAT128, false), + DEFINE_PROP_BIT("swap", SPARCCPU, env.def.features, + CPU_FEATURE_BIT_SWAP, false), + DEFINE_PROP_BIT("mul", SPARCCPU, env.def.features, + CPU_FEATURE_BIT_MUL, false), + DEFINE_PROP_BIT("div", SPARCCPU, env.def.features, + CPU_FEATURE_BIT_DIV, false), + DEFINE_PROP_BIT("flush", SPARCCPU, env.def.features, + CPU_FEATURE_BIT_FLUSH, false), + DEFINE_PROP_BIT("fsqrt", SPARCCPU, env.def.features, + CPU_FEATURE_BIT_FSQRT, false), + DEFINE_PROP_BIT("fmul", SPARCCPU, env.def.features, + CPU_FEATURE_BIT_FMUL, false), + DEFINE_PROP_BIT("vis1", SPARCCPU, env.def.features, + CPU_FEATURE_BIT_VIS1, false), + DEFINE_PROP_BIT("vis2", SPARCCPU, env.def.features, + CPU_FEATURE_BIT_VIS2, false), + DEFINE_PROP_BIT("fsmuld", SPARCCPU, env.def.features, + CPU_FEATURE_BIT_FSMULD, false), + DEFINE_PROP_BIT("hypv", SPARCCPU, env.def.features, + CPU_FEATURE_BIT_HYPV, false), + DEFINE_PROP_BIT("cmt", SPARCCPU, env.def.features, + CPU_FEATURE_BIT_CMT, false), + DEFINE_PROP_BIT("gl", SPARCCPU, env.def.features, + CPU_FEATURE_BIT_GL, false), DEFINE_PROP_UNSIGNED("iu-version", SPARCCPU, env.def.iu_version, 0, qdev_prop_uint64, target_ulong), DEFINE_PROP_UINT32("fpu-version", SPARCCPU, env.def.fpu_version, 0), From patchwork Sun Oct 22 05:59:09 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 737013 Delivered-To: patch@linaro.org Received: by 2002:adf:dd81:0:b0:32d:baff:b0ca with SMTP id x1csp1006775wrl; Sat, 21 Oct 2023 23:16:41 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGHNN2F0FEiwfMQhAlr1pBV9c/g28aQKcA2Rj0JPkfTFYzMKVnKQpMnuJ2x568luLbzS/e7 X-Received: by 2002:a05:622a:54a:b0:41e:1754:daa3 with SMTP id m10-20020a05622a054a00b0041e1754daa3mr1935232qtx.29.1697955401182; Sat, 21 Oct 2023 23:16:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697955401; cv=none; d=google.com; s=arc-20160816; b=bmeB9E79XQ+XVLsb7h/krpMYNVWMrv2s0l9rc0uAfGyAESVvibFEnAO7LJl4VuzngE jh8pvhTIhBpHlteMBvaEfe0YRQRbcTP06QlM4IVu+gUoMVpyz5HphX9IJIIk+kF59yeP WYzPepks7fKHfPkw+KoT2Yw/uWfGT6HmYgsI21eMIxOhE8+qMgJq4q8ffaEbZfntceTA J2uIlF6l46b2bIfY82vTf69wjBRziIOdz6HQ0d77yCkH0uQMAWb/2NE4FH8I8o+WRsCV 98B2ub7wqI3XcLCxNbMyU/3GJ9hKURhGE6ADOb7a0G+vpF/WRa1AqhujRudGhotgn6wW DJlA== 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=v+wpTJ/UmKvrUO2dhPZ2tX5kAAWYozv+5cgy4f/b128=; fh=TYrED6TOMxGX0VC4GtjviASLbYyJe19+7/tKWjN44KQ=; b=bcruFaCeO5po+mnLml5jdWbqjaKGYt61rAgLlqTfNw3KBAvpuRv6uIqEpcrBoInVDp oUcwBkMKmAy6dZOCHzcL2U+KzlfwMezNkdQl17569H0p7hw0EPcrHjYRMS3ecoqCF9hx qy0Rxv8TXEnf0XWFCC6jXydk+N8ncRzr/76SICoGvrHp3BHmiOv3azflFPiM6q9vH/Hw 7P+01seO+eckR3fCDuiLWehKia4OJ3kAnvXHIZ2I3K5V+l/JEGH1EgGEKvcUzmWIRx3b Ol0vsp7U+bF2LHsTv5+V3tJlktIJGeWN7dqmtul8WbnovCfo5GH/zyvAR08BykcZktll eb1A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=ZZ3CtSzu; 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 e12-20020ac84e4c000000b004181c16dfb8si3705201qtw.221.2023.10.21.23.16.41 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sat, 21 Oct 2023 23:16:41 -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=ZZ3CtSzu; 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 1quRW6-0000XF-5D; Sun, 22 Oct 2023 02:00:50 -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 1quRW0-0000TN-MD for qemu-devel@nongnu.org; Sun, 22 Oct 2023 02:00:44 -0400 Received: from mail-pj1-x102e.google.com ([2607:f8b0:4864:20::102e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1quRVy-0001WH-Km for qemu-devel@nongnu.org; Sun, 22 Oct 2023 02:00:44 -0400 Received: by mail-pj1-x102e.google.com with SMTP id 98e67ed59e1d1-27d3ede72f6so1934017a91.1 for ; Sat, 21 Oct 2023 23:00:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1697954440; x=1698559240; 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=v+wpTJ/UmKvrUO2dhPZ2tX5kAAWYozv+5cgy4f/b128=; b=ZZ3CtSzugZygVi3tbNBP5QvZsTrD5LxxpfaHP2RPdz1jATrkFjEWEC3fZM8+O6s05Z Bi3zLrE3NAqE2JCNnj6wzGQzcpYetZD5sfgnzLtRWF3fa7ukgTRhyPokPUnCIodBG/fQ 3dtSr6EH3a1mkEjaY0/Cn/uBVxZKh9MPF0dHpmT8Oe9EMSgi5922rwYEHMek+dYl55g7 oPOuEcDpl8N+4+bEgRq4VYqqtIOdGBIXqiIJ6hrGWlCiWWtWcmNYzU5wHkZ248l1Si0G IB+RBnIX350HY8aSZje3oN+fcX000iiYVhx0vp7en5w9cy+1YKm+IrTyTt3CyTDmrFNQ qfAQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697954440; x=1698559240; 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=v+wpTJ/UmKvrUO2dhPZ2tX5kAAWYozv+5cgy4f/b128=; b=D1HPQ+oOESJgUR3Q+jQDows4xE47CPTi6zZXM9MYLXDwv7uwf+9o3uXjlRwfilgAMn 7FKbZpI46xa2ZJbjNf2wYEN40MrPREMrFk2V3SA61qj18UQSL/CU8yAdSSD4FsCswAfw UBglAPBsLsXOY1gBR33dw7E1EHZv87Rg3SBs/qF4lbZT2XeJ40w/45s0Tk5c2i0NnFLX UkbY9fpp9izt2spOOZkj5xW8aO5cCx4zvLyZIVbmGLGkqcIdT9MoWg8zxGnHkyrKS9Vo Ai89H2aoX7TrwnVJYtjr7KdJYj+QSMIm3hweWL1ze7y0CfGU3WGm5wk8xkvOY20M9V9/ ZDJQ== X-Gm-Message-State: AOJu0YxqqyBcl12ut9mkthdVb0xIjSkC0B2TSF0BvZWM60vX1Y7Ll2rZ qyxV6RUZWEVE9zQM473rPDDNe908yDKRjQLUvzo= X-Received: by 2002:a17:903:23c8:b0:1c9:b2c1:139c with SMTP id o8-20020a17090323c800b001c9b2c1139cmr6210071plh.62.1697954439918; Sat, 21 Oct 2023 23:00:39 -0700 (PDT) Received: from stoup.. ([71.212.149.95]) by smtp.gmail.com with ESMTPSA id je17-20020a170903265100b001c728609574sm3999887plb.6.2023.10.21.23.00.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 21 Oct 2023 23:00:39 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: mark.cave-ayland@ilande.co.uk Subject: [PATCH v4 08/90] target/sparc: Remove sparcv7 cpu features Date: Sat, 21 Oct 2023 22:59:09 -0700 Message-Id: <20231022060031.490251-9-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231022060031.490251-1-richard.henderson@linaro.org> References: <20231022060031.490251-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::102e; envelope-from=richard.henderson@linaro.org; helo=mail-pj1-x102e.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 The oldest supported cpu is the microsparc 1; all other cpus use CPU_DEFAULT_FEATURES. Remove the features that must always be present for sparcv7: FLOAT, SWAP, FLUSH, FSQRT, FMUL. Signed-off-by: Richard Henderson --- linux-user/sparc/target_syscall.h | 6 +----- target/sparc/cpu.h | 21 +++++++-------------- target/sparc/cpu-feature.h.inc | 5 ----- target/sparc/cpu.c | 19 +++---------------- target/sparc/translate.c | 12 ------------ 5 files changed, 11 insertions(+), 52 deletions(-) diff --git a/linux-user/sparc/target_syscall.h b/linux-user/sparc/target_syscall.h index be77e44eb8..e421165357 100644 --- a/linux-user/sparc/target_syscall.h +++ b/linux-user/sparc/target_syscall.h @@ -50,11 +50,7 @@ static inline abi_ulong target_shmlba(CPUSPARCState *env) #ifdef TARGET_SPARC64 return MAX(TARGET_PAGE_SIZE, 16 * 1024); #else - if (!(env->def.features & CPU_FEATURE_FLUSH)) { - return 64 * 1024; - } else { - return 256 * 1024; - } + return 256 * 1024; #endif } diff --git a/target/sparc/cpu.h b/target/sparc/cpu.h index aaecbf0876..758a4e8aaa 100644 --- a/target/sparc/cpu.h +++ b/target/sparc/cpu.h @@ -306,17 +306,12 @@ enum { #undef FEATURE #ifndef TARGET_SPARC64 -#define CPU_DEFAULT_FEATURES (CPU_FEATURE_FLOAT | CPU_FEATURE_SWAP | \ - CPU_FEATURE_MUL | CPU_FEATURE_DIV | \ - CPU_FEATURE_FLUSH | CPU_FEATURE_FSQRT | \ - CPU_FEATURE_FMUL | CPU_FEATURE_FSMULD) +#define CPU_DEFAULT_FEATURES (CPU_FEATURE_MUL | CPU_FEATURE_DIV | \ + CPU_FEATURE_FSMULD) #else -#define CPU_DEFAULT_FEATURES (CPU_FEATURE_FLOAT | CPU_FEATURE_SWAP | \ - CPU_FEATURE_MUL | CPU_FEATURE_DIV | \ - CPU_FEATURE_FLUSH | CPU_FEATURE_FSQRT | \ - CPU_FEATURE_FMUL | CPU_FEATURE_VIS1 | \ - CPU_FEATURE_VIS2 | CPU_FEATURE_FSMULD | \ - CPU_FEATURE_CASA) +#define CPU_DEFAULT_FEATURES (CPU_FEATURE_MUL | CPU_FEATURE_DIV | \ + CPU_FEATURE_FSMULD | CPU_FEATURE_CASA | \ + CPU_FEATURE_VIS1 | CPU_FEATURE_VIS2) enum { mmu_us_12, // Ultrasparc < III (64 entry TLB) mmu_us_3, // Ultrasparc III (512 entry TLB) @@ -799,14 +794,12 @@ static inline void cpu_get_tb_cpu_state(CPUSPARCState *env, vaddr *pc, if (env->pstate & PS_AM) { flags |= TB_FLAG_AM_ENABLED; } - if ((env->def.features & CPU_FEATURE_FLOAT) - && (env->pstate & PS_PEF) - && (env->fprs & FPRS_FEF)) { + if ((env->pstate & PS_PEF) && (env->fprs & FPRS_FEF)) { flags |= TB_FLAG_FPU_ENABLED; } flags |= env->asi << TB_FLAG_ASI_SHIFT; #else - if ((env->def.features & CPU_FEATURE_FLOAT) && env->psref) { + if (env->psref) { flags |= TB_FLAG_FPU_ENABLED; } #endif diff --git a/target/sparc/cpu-feature.h.inc b/target/sparc/cpu-feature.h.inc index d35fe90c92..d800f18c4e 100644 --- a/target/sparc/cpu-feature.h.inc +++ b/target/sparc/cpu-feature.h.inc @@ -1,11 +1,6 @@ -FEATURE(FLOAT) FEATURE(FLOAT128) -FEATURE(SWAP) FEATURE(MUL) FEATURE(DIV) -FEATURE(FLUSH) -FEATURE(FSQRT) -FEATURE(FMUL) FEATURE(VIS1) FEATURE(VIS2) FEATURE(FSMULD) diff --git a/target/sparc/cpu.c b/target/sparc/cpu.c index e4d1c552e5..0a3882653c 100644 --- a/target/sparc/cpu.c +++ b/target/sparc/cpu.c @@ -403,9 +403,7 @@ static const sparc_def_t sparc_defs[] = { .mmu_sfsr_mask = 0x00016fff, .mmu_trcr_mask = 0x0000003f, .nwindows = 7, - .features = CPU_FEATURE_FLOAT | CPU_FEATURE_SWAP | CPU_FEATURE_MUL | - CPU_FEATURE_DIV | CPU_FEATURE_FLUSH | CPU_FEATURE_FSQRT | - CPU_FEATURE_FMUL, + .features = CPU_FEATURE_MUL | CPU_FEATURE_DIV, }, { .name = "TI MicroSparc II", @@ -757,9 +755,8 @@ static void sparc_cpu_realizefn(DeviceState *dev, Error **errp) CPUSPARCState *env = &cpu->env; #if defined(CONFIG_USER_ONLY) - if ((env->def.features & CPU_FEATURE_FLOAT)) { - env->def.features |= CPU_FEATURE_FLOAT128; - } + /* We are emulating the kernel, which will trap and emulate float128. */ + env->def.features |= CPU_FEATURE_FLOAT128; #endif env->version = env->def.iu_version; @@ -836,22 +833,12 @@ static PropertyInfo qdev_prop_nwindows = { }; static Property sparc_cpu_properties[] = { - DEFINE_PROP_BIT("float", SPARCCPU, env.def.features, - CPU_FEATURE_BIT_FLOAT, false), DEFINE_PROP_BIT("float128", SPARCCPU, env.def.features, CPU_FEATURE_BIT_FLOAT128, false), - DEFINE_PROP_BIT("swap", SPARCCPU, env.def.features, - CPU_FEATURE_BIT_SWAP, false), DEFINE_PROP_BIT("mul", SPARCCPU, env.def.features, CPU_FEATURE_BIT_MUL, false), DEFINE_PROP_BIT("div", SPARCCPU, env.def.features, CPU_FEATURE_BIT_DIV, false), - DEFINE_PROP_BIT("flush", SPARCCPU, env.def.features, - CPU_FEATURE_BIT_FLUSH, false), - DEFINE_PROP_BIT("fsqrt", SPARCCPU, env.def.features, - CPU_FEATURE_BIT_FSQRT, false), - DEFINE_PROP_BIT("fmul", SPARCCPU, env.def.features, - CPU_FEATURE_BIT_FMUL, false), DEFINE_PROP_BIT("vis1", SPARCCPU, env.def.features, CPU_FEATURE_BIT_VIS1, false), DEFINE_PROP_BIT("vis2", SPARCCPU, env.def.features, diff --git a/target/sparc/translate.c b/target/sparc/translate.c index 8f6fd453e7..cab9f13421 100644 --- a/target/sparc/translate.c +++ b/target/sparc/translate.c @@ -3527,11 +3527,9 @@ static void disas_sparc_insn(DisasContext * dc, unsigned int insn) gen_ne_fop_FF(dc, rd, rs2, gen_helper_fabss); break; case 0x29: /* fsqrts */ - CHECK_FPU_FEATURE(dc, FSQRT); gen_fop_FF(dc, rd, rs2, gen_helper_fsqrts); break; case 0x2a: /* fsqrtd */ - CHECK_FPU_FEATURE(dc, FSQRT); gen_fop_DD(dc, rd, rs2, gen_helper_fsqrtd); break; case 0x2b: /* fsqrtq */ @@ -3559,16 +3557,13 @@ static void disas_sparc_insn(DisasContext * dc, unsigned int insn) gen_fop_QQQ(dc, rd, rs1, rs2, gen_helper_fsubq); break; case 0x49: /* fmuls */ - CHECK_FPU_FEATURE(dc, FMUL); gen_fop_FFF(dc, rd, rs1, rs2, gen_helper_fmuls); break; case 0x4a: /* fmuld */ - CHECK_FPU_FEATURE(dc, FMUL); gen_fop_DDD(dc, rd, rs1, rs2, gen_helper_fmuld); break; case 0x4b: /* fmulq */ CHECK_FPU_FEATURE(dc, FLOAT128); - CHECK_FPU_FEATURE(dc, FMUL); gen_fop_QQQ(dc, rd, rs1, rs2, gen_helper_fmulq); break; case 0x4d: /* fdivs */ @@ -5105,8 +5100,6 @@ static void disas_sparc_insn(DisasContext * dc, unsigned int insn) goto jmp_insn; #endif case 0x3b: /* flush */ - if (!((dc)->def->features & CPU_FEATURE_FLUSH)) - goto unimp_flush; /* nop */ break; case 0x3c: /* save */ @@ -5224,7 +5217,6 @@ static void disas_sparc_insn(DisasContext * dc, unsigned int insn) break; case 0x0f: /* swap, swap register with memory. Also atomically */ - CHECK_IU_FEATURE(dc, SWAP); cpu_src1 = gen_load_gpr(dc, rd); gen_swap(dc, cpu_val, cpu_src1, cpu_addr, dc->mem_idx, MO_TEUL); @@ -5256,7 +5248,6 @@ static void disas_sparc_insn(DisasContext * dc, unsigned int insn) break; case 0x1f: /* swapa, swap reg with alt. memory. Also atomically */ - CHECK_IU_FEATURE(dc, SWAP); cpu_src1 = gen_load_gpr(dc, rd); gen_swap_asi(dc, cpu_val, cpu_src1, cpu_addr, insn); break; @@ -5578,9 +5569,6 @@ static void disas_sparc_insn(DisasContext * dc, unsigned int insn) illegal_insn: gen_exception(dc, TT_ILL_INSN); return; - unimp_flush: - gen_exception(dc, TT_UNIMP_FLUSH); - return; #if !defined(CONFIG_USER_ONLY) priv_insn: gen_exception(dc, TT_PRIV_INSN); From patchwork Sun Oct 22 05:59:10 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 736954 Delivered-To: patch@linaro.org Received: by 2002:adf:dd81:0:b0:32d:baff:b0ca with SMTP id x1csp1005481wrl; Sat, 21 Oct 2023 23:11:02 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFOiv0BxMZ95+NN4jMUUYU68gUogw2CswfHmUYdRE/Sa4oWYy7P1kN7oRYg3p5lOoG7sghz X-Received: by 2002:a05:620a:170f:b0:76f:1817:942b with SMTP id az15-20020a05620a170f00b0076f1817942bmr5978274qkb.28.1697955062734; Sat, 21 Oct 2023 23:11:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697955062; cv=none; d=google.com; s=arc-20160816; b=VISL1ZNi3+XZyp+U56QEACZCZPrYUiUqaXglrbjW5Fv0L9rZmHFj32AcBFQtvNatZo CNOPAQi6aRhfOhAGRkP7dqXdSUa5RCvNZvataxRTO0SLgZtKxthkEBMF3+Qpe49gcPmH CBUi5sK/BrQU6DXsK5h/tKNpxPvc4pxLpw6KXgq6dr1FzoTRR9yMUzjrziQZkZcJWvNp a/Ui0rAs1ME83xQAli9BmtUk+/U6AeA+6YdDzMjI9Lou54RkKX1D7FP5MAwDuejkI4gv mQuH/siJwJEBHAsTE0BcGHLik3kXkR9sJdAb+eDIF64fADIO0KMxiqqL2PlZoJ+qYHio 4sFw== 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=yCQ11G4CDtK3oW1LuqfPuIgRALcswxq9MCt2fHEKN58=; fh=TYrED6TOMxGX0VC4GtjviASLbYyJe19+7/tKWjN44KQ=; b=UsSMA+Xujq1tvYtYJlgiMPTlBRoACuewLCT44C6Jg469SfclZEWjAmdzbvniLyNyJR T4N9ANdRQfEcFRnUs9jAPyekyu+2unuyglR7YQQFWkGtFwUbNH/V6Bbmcj5kQYKc6C5T qWfexwwfjSTkvQzUCP+gnRE1IR/ZcNoHF2U1HBvDO5RNmZ04BnDBHnl6nNFlh5Ic4Cg3 U8S28a+q+oRHLESksrqLonY7NiMCZrugerbJ9OwrmfZCwxJw8oO09sRQiFkhaDKvg8zr 2AhfDGhdS/nzAMCVirYew2WOJg+wSD+D5r++bTf1BNlgrgu7iaH2DmRA0+6uPlDas6mM B2hA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=FylWDYYx; 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 h8-20020a05620a400800b00767b4fa5cd5si4058502qko.93.2023.10.21.23.11.02 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sat, 21 Oct 2023 23:11:02 -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=FylWDYYx; 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 1quRW4-0000Vp-BJ; Sun, 22 Oct 2023 02:00:48 -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 1quRW1-0000UP-Of for qemu-devel@nongnu.org; Sun, 22 Oct 2023 02:00:45 -0400 Received: from mail-pf1-x436.google.com ([2607:f8b0:4864:20::436]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1quRVy-0001WW-Mx for qemu-devel@nongnu.org; Sun, 22 Oct 2023 02:00:45 -0400 Received: by mail-pf1-x436.google.com with SMTP id d2e1a72fcca58-6b201a93c9cso1608262b3a.0 for ; Sat, 21 Oct 2023 23:00:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1697954441; x=1698559241; 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=yCQ11G4CDtK3oW1LuqfPuIgRALcswxq9MCt2fHEKN58=; b=FylWDYYxk4IhWTgqCAfMnZ8RCDtR9P+FuBeHto54JUsF7x5v9LoDqlgyY3RcStg3R/ N+cQVGnKyRkC0u8rv0NI3IaI+tFugeQgbZeIhQLS8/qHf7zB4Xt9XhrXRin4pmFg9YxY xX5elxVlASMThufuDhgn0NQgt6w4HIrp5aNDXqurmdcnjmVYCdXDenfA2VLZ1RbjDjwO XrVo1+ZCRHzT32HotTUM0nfNCH6/PsLmwguP0EMsA2FXawPg38a6o4m45PZYJ5kdlyf6 Tn1+jxAtvEg2lgMrQ6c6NNWGl9DGQSRSsB+z1Sj/QuYFTCh0Z2OO+84hBiWNZVCV5lmY v2MQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697954441; x=1698559241; 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=yCQ11G4CDtK3oW1LuqfPuIgRALcswxq9MCt2fHEKN58=; b=jNv8kEVBHAIOM9ZfiaEOu0rEb7xNjzW1fvSRPV3+hukedRU+nh27pp3z4ypmXWWsrj 7ZfwCvacO4BOku+Nc+vT7lrarhq3i5NW64zjL/lpAsgwGHcmxOQ+r/dFdKHVXR5iSlXO hrLyQ5w+Ru6QUAamUScHeQFBSDiMtiMfK9gwsj4xRMer2ySmL3Lq9iy6TPjyp14EK3jk AE73ajjhXxqk3DVla58nGRhCecilnpiLkyLycISSacDXjNb45LGkyCQpxsxum+dfM+ez G0YFYQeyb91La5/W7spV+RKKxALfZ83kMOVzFhgz0xCn184gV7syU69Ag323x/iEjRd0 66Rg== X-Gm-Message-State: AOJu0Yy0fD5h5DFqIjAK4TRYT6IgaJzEBxHhtEgS0EHzsJaTXK6aLkVN 8lZ8M08mwFHX8m0ae10V4O4n/X2yuBcjgn/SMM8= X-Received: by 2002:a17:902:f542:b0:1ca:1c89:9acf with SMTP id h2-20020a170902f54200b001ca1c899acfmr5199100plf.53.1697954440707; Sat, 21 Oct 2023 23:00:40 -0700 (PDT) Received: from stoup.. ([71.212.149.95]) by smtp.gmail.com with ESMTPSA id je17-20020a170903265100b001c728609574sm3999887plb.6.2023.10.21.23.00.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 21 Oct 2023 23:00:40 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: mark.cave-ayland@ilande.co.uk Subject: [PATCH v4 09/90] target/sparc: Add decodetree infrastructure Date: Sat, 21 Oct 2023 22:59:10 -0700 Message-Id: <20231022060031.490251-10-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231022060031.490251-1-richard.henderson@linaro.org> References: <20231022060031.490251-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::436; envelope-from=richard.henderson@linaro.org; helo=mail-pf1-x436.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 | 5 +++ target/sparc/translate.c | 69 ++++++++++++++++++++++++++------------- target/sparc/meson.build | 3 ++ 3 files changed, 55 insertions(+), 22 deletions(-) create mode 100644 target/sparc/insns.decode diff --git a/target/sparc/insns.decode b/target/sparc/insns.decode new file mode 100644 index 0000000000..5811a679db --- /dev/null +++ b/target/sparc/insns.decode @@ -0,0 +1,5 @@ +# SPDX-License-Identifier: LGPL-2.0+ +# +# Sparc instruction decode definitions. +# Copyright (c) 2023 Richard Henderson + diff --git a/target/sparc/translate.c b/target/sparc/translate.c index cab9f13421..080bc5f8a2 100644 --- a/target/sparc/translate.c +++ b/target/sparc/translate.c @@ -3003,6 +3003,47 @@ static void gen_faligndata(TCGv dst, TCGv gsr, TCGv s1, TCGv s2) } #endif +/* Include the auto-generated decoder. */ +#include "decode-insns.c.inc" + +#define TRANS(NAME, AVAIL, FUNC, ...) \ + static bool trans_##NAME(DisasContext *dc, arg_##NAME *a) \ + { return avail_##AVAIL(dc) && FUNC(dc, __VA_ARGS__); } + +#define avail_ALL(C) true +#ifdef TARGET_SPARC64 +# define avail_32(C) false +# define avail_64(C) true +#else +# define avail_32(C) true +# define avail_64(C) false +#endif + +/* Default case for non jump instructions. */ +static bool advance_pc(DisasContext *dc) +{ + if (dc->npc & 3) { + switch (dc->npc) { + case DYNAMIC_PC: + case DYNAMIC_PC_LOOKUP: + dc->pc = dc->npc; + gen_op_next_insn(); + break; + case JUMP_PC: + /* we can do a static jump */ + gen_branch2(dc, dc->jump_pc[0], dc->jump_pc[1], cpu_cond); + dc->base.is_jmp = DISAS_NORETURN; + break; + default: + g_assert_not_reached(); + } + } else { + dc->pc = dc->npc; + dc->npc = dc->npc + 4; + } + return true; +} + #define CHECK_IU_FEATURE(dc, FEATURE) \ if (!((dc)->def->features & CPU_FEATURE_ ## FEATURE)) \ goto illegal_insn; @@ -3011,7 +3052,7 @@ static void gen_faligndata(TCGv dst, TCGv gsr, TCGv s1, TCGv s2) goto nfpu_insn; /* before an instruction, dc->pc must be static */ -static void disas_sparc_insn(DisasContext * dc, unsigned int insn) +static void disas_sparc_legacy(DisasContext *dc, unsigned int insn) { unsigned int opc, rs1, rs2, rd; TCGv cpu_src1, cpu_src2; @@ -5544,26 +5585,7 @@ static void disas_sparc_insn(DisasContext * dc, unsigned int insn) } break; } - /* default case for non jump instructions */ - if (dc->npc & 3) { - switch (dc->npc) { - case DYNAMIC_PC: - case DYNAMIC_PC_LOOKUP: - dc->pc = dc->npc; - gen_op_next_insn(); - break; - case JUMP_PC: - /* we can do a static jump */ - gen_branch2(dc, dc->jump_pc[0], dc->jump_pc[1], cpu_cond); - dc->base.is_jmp = DISAS_NORETURN; - break; - default: - g_assert_not_reached(); - } - } else { - dc->pc = dc->npc; - dc->npc = dc->npc + 4; - } + advance_pc(dc); jmp_insn: return; illegal_insn: @@ -5654,7 +5676,10 @@ static void sparc_tr_translate_insn(DisasContextBase *dcbase, CPUState *cs) insn = translator_ldl(env, &dc->base, dc->pc); dc->base.pc_next += 4; - disas_sparc_insn(dc, insn); + + if (!decode(dc, insn)) { + disas_sparc_legacy(dc, insn); + } if (dc->base.is_jmp == DISAS_NORETURN) { return; diff --git a/target/sparc/meson.build b/target/sparc/meson.build index 48025cce76..c316773db6 100644 --- a/target/sparc/meson.build +++ b/target/sparc/meson.build @@ -1,4 +1,7 @@ +gen = decodetree.process('insns.decode') + sparc_ss = ss.source_set() +sparc_ss.add(gen) sparc_ss.add(files( 'cc_helper.c', 'cpu.c', From patchwork Sun Oct 22 05:59:11 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 736947 Delivered-To: patch@linaro.org Received: by 2002:adf:dd81:0:b0:32d:baff:b0ca with SMTP id x1csp1004453wrl; Sat, 21 Oct 2023 23:06:57 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGYRr5cC8oCBf1Zci5er9E7e0Fyva+D5p8BPddxG1ShU1W8Mx5hge28SSXdTtiGugizM0xg X-Received: by 2002:a05:620a:4256:b0:777:5e79:d280 with SMTP id w22-20020a05620a425600b007775e79d280mr6824352qko.53.1697954817525; Sat, 21 Oct 2023 23:06:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697954817; cv=none; d=google.com; s=arc-20160816; b=KH4Z2Zkjugq2yZhZO7O2qc+FtYRcncae8fR7msV4qUv3bKTX20oNAs5hZqYP5t6wEc 7WU+f3Cf4lh3EWq/vTkevvBKLOyPyWWqoNyh1ROfMibSQ93as9vveUSNIEh5BtZV0hxX czCCVaJaFmg1ZSf1PQmh+b5Dy8DV9KrRtePrZ2Akf75Y+G7lrCyIRAQ3kU/qB9o370s1 6vGM58qg7N4sa+giWhnL9KsVtyRW2Xona0kNxeWTEN/199bp1xg4ZYlOrftrBJSacXte TAMUuWkQsK0ouZkrv5+m981SLKSNWwnvFrh1JNL8U5m9ixaYzdEAIUDvQryDGMjQYzwW UijQ== 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=vNn7jVogYLYvnKzq1R44V4cOiOcSGXgz1/4pjUiWR3E=; fh=TYrED6TOMxGX0VC4GtjviASLbYyJe19+7/tKWjN44KQ=; b=PAwm4u+SKufgr/w6Z2OX+rSZSG5eUYV8t/OaI8w3+CinnRWc5Lv0DmQP8zCI09JAIS pfxGlSlSEchkKrh9ItGCezERG4w+8VxQCu9OTmOHsh+VNE+z9p6ymRpkR3TpXYXEb9FG m6ox3HixIPUw5/X8EmU28INSL2jPClf6ShJ709IJxHP2IAk/ebWEEhpyopHtqxSmJ9Dd Ac0xc4WHw7l9ZxJwqI8X/IiGt1pph9SStsMSNqzPwvACEDW0D83wXlzLWzCXmd/w5SdY 2tcJSM1VpgQcfcGqsghs1gglXbdBGY+TaRMnZgM/4bCxQhkWDZDd30ejtNV5L48mxlpx iUnA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="zpYh/Dy9"; 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 j18-20020a05620a411200b0077053731daesi3726349qko.261.2023.10.21.23.06.57 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sat, 21 Oct 2023 23:06:57 -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="zpYh/Dy9"; 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 1quRW3-0000VT-39; Sun, 22 Oct 2023 02:00:47 -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 1quRW1-0000UI-Kq for qemu-devel@nongnu.org; Sun, 22 Oct 2023 02:00:45 -0400 Received: from mail-pf1-x435.google.com ([2607:f8b0:4864:20::435]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1quRVz-0001Wh-7s for qemu-devel@nongnu.org; Sun, 22 Oct 2023 02:00:45 -0400 Received: by mail-pf1-x435.google.com with SMTP id d2e1a72fcca58-6be840283ceso1740394b3a.3 for ; Sat, 21 Oct 2023 23:00:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1697954441; x=1698559241; 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=vNn7jVogYLYvnKzq1R44V4cOiOcSGXgz1/4pjUiWR3E=; b=zpYh/Dy9C0U4Sjxld20/Pul5bf3vFbZvvJhjHBlxr7OnhxCmqQmXsgTorGzt3+d9/F 3VLlotZa6awYI2tulF3rSaEEvmPza4KOzX7eyRAy7j7jUM76g/1qYR8yaQd5/OR38xt8 rnJgYepIbo6Q8zsqIlnByYCPYnxwCrXeYNCDRS3/Cf4p1mJu3CVep8SoRhrUfeBfA90n Kl/f07CKITpdwTx+seKgdFuutWn/HhZPVZQnoLr2M5WoLMWVt4BYNEWwvss2BlQVQmTp 43jzuZ8JAYuvPJqf2MVdzU40cpctSTuc0AuE4t3HsQV2LKxSpAs4gfg19XASChjthkGb wyUQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697954441; x=1698559241; 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=vNn7jVogYLYvnKzq1R44V4cOiOcSGXgz1/4pjUiWR3E=; b=RucspMMg/bjDHPPnPMB4YkY8UAxwSrzBj9EY4kyApIdYRl7Cnflk/qAtLmA65krPON j3FBs95Exnl+h3hy5VSgcuIcM+yal6ldBre4gz6w7+1hHePD8qNo/to0SrlUl/RBarm7 R8EoTeiYwpBg12v4NApmnIzMIqSM0xmRimdLGu8iJp9fFQwHTLP4S4VT5vCLi5+khb5Y frZlB1ef96PnpybEpgrdvp/jY0+M+hKqWS6WrnEfIWYx5oJUBmIGM9iqCipKAUK6CtZZ z8+ZJmpMq5cdSlbUpf3pxdkdf5ikEB2lKlsTLAWFyApe1I2KhKXq+/mqrZPYOdb9t5D2 NjVQ== X-Gm-Message-State: AOJu0YwXNQxfyT2sqsvSpSEpmTmpVYkMlmzeOZBZR+TmY6+OMSVL3on+ sbZGjKB9TFGbsU+/2f6TWVDMTEUAYCmN99Zwg7Q= X-Received: by 2002:a05:6a21:a5aa:b0:14c:c393:6af with SMTP id gd42-20020a056a21a5aa00b0014cc39306afmr5267383pzc.0.1697954441527; Sat, 21 Oct 2023 23:00:41 -0700 (PDT) Received: from stoup.. ([71.212.149.95]) by smtp.gmail.com with ESMTPSA id je17-20020a170903265100b001c728609574sm3999887plb.6.2023.10.21.23.00.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 21 Oct 2023 23:00:41 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: mark.cave-ayland@ilande.co.uk Subject: [PATCH v4 10/90] target/sparc: Define AM_CHECK for sparc32 Date: Sat, 21 Oct 2023 22:59:11 -0700 Message-Id: <20231022060031.490251-11-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231022060031.490251-1-richard.henderson@linaro.org> References: <20231022060031.490251-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::435; envelope-from=richard.henderson@linaro.org; helo=mail-pf1-x435.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 Define as false, which allows some ifdef removal. Signed-off-by: Richard Henderson --- target/sparc/translate.c | 21 +++++++++------------ 1 file changed, 9 insertions(+), 12 deletions(-) diff --git a/target/sparc/translate.c b/target/sparc/translate.c index 080bc5f8a2..9eb2b7e52f 100644 --- a/target/sparc/translate.c +++ b/target/sparc/translate.c @@ -268,20 +268,21 @@ static void gen_move_Q(DisasContext *dc, unsigned int rd, unsigned int rs) #endif #endif -#ifdef TARGET_SPARC64 -#ifndef TARGET_ABI32 -#define AM_CHECK(dc) ((dc)->address_mask_32bit) +#if !defined(TARGET_SPARC64) +# define AM_CHECK(dc) false +#elif defined(TARGET_ABI32) +# define AM_CHECK(dc) true +#elif defined(CONFIG_USER_ONLY) +# define AM_CHECK(dc) false #else -#define AM_CHECK(dc) (1) -#endif +# define AM_CHECK(dc) ((dc)->address_mask_32bit) #endif static void gen_address_mask(DisasContext *dc, TCGv addr) { -#ifdef TARGET_SPARC64 - if (AM_CHECK(dc)) + if (AM_CHECK(dc)) { tcg_gen_andi_tl(addr, addr, 0xffffffffULL); -#endif + } } static TCGv gen_load_gpr(DisasContext *dc, int reg) @@ -1366,11 +1367,9 @@ static void do_branch(DisasContext *dc, int32_t offset, uint32_t insn, int cc) unsigned int cond = GET_FIELD(insn, 3, 6), a = (insn & (1 << 29)); target_ulong target = dc->pc + offset; -#ifdef TARGET_SPARC64 if (unlikely(AM_CHECK(dc))) { target &= 0xffffffffULL; } -#endif if (cond == 0x0) { /* unconditional not taken */ if (a) { @@ -1406,11 +1405,9 @@ static void do_fbranch(DisasContext *dc, int32_t offset, uint32_t insn, int cc) unsigned int cond = GET_FIELD(insn, 3, 6), a = (insn & (1 << 29)); target_ulong target = dc->pc + offset; -#ifdef TARGET_SPARC64 if (unlikely(AM_CHECK(dc))) { target &= 0xffffffffULL; } -#endif if (cond == 0x0) { /* unconditional not taken */ if (a) { From patchwork Sun Oct 22 05:59:12 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 736942 Delivered-To: patch@linaro.org Received: by 2002:adf:dd81:0:b0:32d:baff:b0ca with SMTP id x1csp1004090wrl; Sat, 21 Oct 2023 23:05:29 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHPnt9CLvMwrTP0Q6IhW0OlWfGHnR/Yr9ps1EgDIPNebcoyNxYsFdgLaUTOj/573b216ims X-Received: by 2002:a05:620a:24cb:b0:774:3147:4251 with SMTP id m11-20020a05620a24cb00b0077431474251mr7319111qkn.6.1697954729742; Sat, 21 Oct 2023 23:05:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697954729; cv=none; d=google.com; s=arc-20160816; b=RHz5H4JXwMmbjCkkPy7eloDw37TN15i7ThGj5y7fTK/qA5uUuGB7JwYDVCncATioYL 0ncU/KN7cJtV5AmQYxB1CZuNj8HJta3XzswRnGTFiNm+eyjQZpZhk2UOxPh8HHfoHnwI K9R6GBfv1Us8VVFHz/SqIKGdoHtvUg1zkSmNCIbup3ghptup9erdOEkh9IsSDpkZq2kd iDL8UlVagH8syn5lEfBvJJX2pZN/7j3hx4NDnri+lNYZubeUFeVUVNbZ6nuxPeDZmSMP 0zkDFg6h8yfJC/VGHZhQWMr1AJzihXicVPa72ujJQBmwiq2K4lfY3GG+9cxSTciQ9CcO 7HFA== 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=Kh4UR/x6NVS8OMj/epOA+pEm4qe7LB7jB8T5mbBYeEw=; fh=TYrED6TOMxGX0VC4GtjviASLbYyJe19+7/tKWjN44KQ=; b=UfnCk2+5iyedcqiC2vuGuytRERxMCI1ZqdLMXfwx2ltVMLznlGTAUQxob5MI3yiBqr qEub9KiDtHBiNlFkiL6MVm1gpv031Q0TXoN68Jud7vt+cWxqyqWVQceqBsdpEdLxikw5 +4kx9rZhX7ImFef56MURvx9yE8xvFTcI1WNjD9ip5ChfsHrHlbuiG9D8hyUkuOyuMQd+ iVF0veFT9cMn17/Xy5tiFQ+ah42CrRV9uN+uAZcLv9+9HBx5bALt5ZHd62KzZA5pPCK3 jtS0o7TlkQHqjeV0Lj8c+72fb04ZUm1n80me/LiuIR3CI5ukiR6171vmHoePaT5luGp6 t4XA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=TFHTqxyX; 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 f1-20020a05620a280100b007741e910951si4120993qkp.695.2023.10.21.23.05.29 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sat, 21 Oct 2023 23:05:29 -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=TFHTqxyX; 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 1quRW3-0000Vc-MF; Sun, 22 Oct 2023 02:00:47 -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 1quRW1-0000UQ-P7 for qemu-devel@nongnu.org; Sun, 22 Oct 2023 02:00:45 -0400 Received: from mail-pf1-x432.google.com ([2607:f8b0:4864:20::432]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1quRW0-0001Wy-00 for qemu-devel@nongnu.org; Sun, 22 Oct 2023 02:00:45 -0400 Received: by mail-pf1-x432.google.com with SMTP id d2e1a72fcca58-6bb4abb8100so1741093b3a.2 for ; Sat, 21 Oct 2023 23:00:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1697954442; x=1698559242; 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=Kh4UR/x6NVS8OMj/epOA+pEm4qe7LB7jB8T5mbBYeEw=; b=TFHTqxyXoBvkBd3cX23jmhkXeiLslFau7llcqZWqwTvsJcQLD7KhrGPVM/0Bs7Vren vT+I75F5f5Zs6Xt4Y2lAyeCN1oaPHxyVXR+G9xi5mOrtKfSFob1JYQ9pve++49gD8DL9 tpsDMGG/kVKhJQUe546tEoa/XWYvwKk3SLnMv/rQHG8B8YoTBXjI+0jtxyvJHqZNuCSR uI89KLvjULpMrNc/Fqh7nmTNwJs7ICaZIIkhorcf1C/36CLHiDIEd0iTOb60/MpiWcaa YmahZBL+w8D3cmWH77fwMPHPE9appLhPt7BlPG4IQAoCK3oE4VwCGnXsDvcSOHgizwHn OBig== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697954442; x=1698559242; 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=Kh4UR/x6NVS8OMj/epOA+pEm4qe7LB7jB8T5mbBYeEw=; b=IVFBHDEvxdHXtaVDJ+nf25Zsg7HsvO+v664wzjP4glmXjkX5byWZGULEfOTY2WTYDl gxI838Dc+qz3RcHmHzlNU9TaCrhnHi4lYk4lyMCNRaf5YJCuer1Zp+sq40L9Bax/CrIs TB2kGW/ED48L7Qhrhs51eWOmEIgKaLMXZQv437LoaD1dEcknoUjp4iCwxGAQL5IzXRDX 9IJgMhog3Ijs4bez1q9V/LhvGTqZWuQptDftIEGxT4ZAxQGKKmmrWfHR5vI1RWlPJaLX t5Z2W1sFjT9vMBSwaiZ+DQtGwnLObbsSVrC5/PG/GGva42wHngsGPFsUDFEBXgfWhnVn nXNQ== X-Gm-Message-State: AOJu0YzeyK6tevC1lhjJ5L2HLfrbHVWgjsHleHefroEPawflowFHPoYJ 72ZZaEnBlSq4Y7pMJpbJ40YrFp5hl181SHBS9ZI= X-Received: by 2002:a17:903:2310:b0:1c1:e7b2:27ad with SMTP id d16-20020a170903231000b001c1e7b227admr4860226plh.60.1697954442353; Sat, 21 Oct 2023 23:00:42 -0700 (PDT) Received: from stoup.. ([71.212.149.95]) by smtp.gmail.com with ESMTPSA id je17-20020a170903265100b001c728609574sm3999887plb.6.2023.10.21.23.00.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 21 Oct 2023 23:00:41 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: mark.cave-ayland@ilande.co.uk Subject: [PATCH v4 11/90] target/sparc: Move CALL to decodetree Date: Sat, 21 Oct 2023 22:59:12 -0700 Message-Id: <20231022060031.490251-12-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231022060031.490251-1-richard.henderson@linaro.org> References: <20231022060031.490251-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::432; envelope-from=richard.henderson@linaro.org; helo=mail-pf1-x432.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 | 1 + target/sparc/translate.c | 34 +++++++++++++++++----------------- 2 files changed, 18 insertions(+), 17 deletions(-) diff --git a/target/sparc/insns.decode b/target/sparc/insns.decode index 5811a679db..a5f5d2681e 100644 --- a/target/sparc/insns.decode +++ b/target/sparc/insns.decode @@ -3,3 +3,4 @@ # Sparc instruction decode definitions. # Copyright (c) 2023 Richard Henderson +CALL 01 i:s30 diff --git a/target/sparc/translate.c b/target/sparc/translate.c index 9eb2b7e52f..7ef4c6d4f7 100644 --- a/target/sparc/translate.c +++ b/target/sparc/translate.c @@ -285,6 +285,11 @@ static void gen_address_mask(DisasContext *dc, TCGv addr) } } +static target_ulong address_mask_i(DisasContext *dc, target_ulong addr) +{ + return AM_CHECK(dc) ? (uint32_t)addr : addr; +} + static TCGv gen_load_gpr(DisasContext *dc, int reg) { if (reg > 0) { @@ -3041,6 +3046,16 @@ static bool advance_pc(DisasContext *dc) return true; } +static bool trans_CALL(DisasContext *dc, arg_CALL *a) +{ + target_long target = address_mask_i(dc, dc->pc + a->i * 4); + + gen_store_gpr(dc, 15, tcg_constant_tl(dc->pc)); + gen_mov_pc_npc(dc); + dc->npc = target; + return true; +} + #define CHECK_IU_FEATURE(dc, FEATURE) \ if (!((dc)->def->features & CPU_FEATURE_ ## FEATURE)) \ goto illegal_insn; @@ -3146,23 +3161,8 @@ static void disas_sparc_legacy(DisasContext *dc, unsigned int insn) break; } break; - case 1: /*CALL*/ - { - target_long target = GET_FIELDs(insn, 2, 31) << 2; - TCGv o7 = gen_dest_gpr(dc, 15); - - tcg_gen_movi_tl(o7, dc->pc); - gen_store_gpr(dc, 15, o7); - target += dc->pc; - gen_mov_pc_npc(dc); -#ifdef TARGET_SPARC64 - if (unlikely(AM_CHECK(dc))) { - target &= 0xffffffffULL; - } -#endif - dc->npc = target; - } - goto jmp_insn; + case 1: + g_assert_not_reached(); /* in decodetree */ case 2: /* FPU & Logical Operations */ { unsigned int xop = GET_FIELD(insn, 7, 12); From patchwork Sun Oct 22 05:59:13 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 737005 Delivered-To: patch@linaro.org Received: by 2002:adf:dd81:0:b0:32d:baff:b0ca with SMTP id x1csp1006668wrl; Sat, 21 Oct 2023 23:16:10 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEsgXT7ZWlCl+ej4Je7tgqnX8bWvl2s6hYhlsPo+fnlt/CyXb5I/tY3xYfdfSeMOiGM8sYa X-Received: by 2002:a05:622a:1049:b0:41b:774b:b1a2 with SMTP id f9-20020a05622a104900b0041b774bb1a2mr5447756qte.22.1697955370326; Sat, 21 Oct 2023 23:16:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697955370; cv=none; d=google.com; s=arc-20160816; b=VLW/wL0VrXXtJfmK5EDy5JdTNSIKCdGObrSSa5//0vWICfHIyMaJ1tKFnSOZjxqGvq 3bDdIFssrPmEsYnBMkkjIH/jl8Z6moGiThsfoCEN/2vUx0mTnkugN4LjyCBQNhUMtbHe a8I/zC4O8YT3sB81UNcIfI6GiZFu2riwISjVF/cSsLDmKweXGaIF9hLiT9cOILeTi7io nmg+hOQkaGHk8YKwxJjjxqS9G3PXj9YvKbvCXoCQEW1XuUG7AxDJcC1xggeghOL8twxu voWLZ7P8WOS9VSLQvb2f/Hi0yXhqTNkAtqlfdn/dUCQgjzd8Vz42BojWbzVgZmw6eaH/ wOPw== 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=E3tYYl15SbYe+7PrLSwAYdfpLhjfdTC4pXipfF3UoTQ=; fh=TYrED6TOMxGX0VC4GtjviASLbYyJe19+7/tKWjN44KQ=; b=dZfmZX96oFRSsOu0LxlO/5F3J4SPfzyDOQ0IyL2AQCr0LU83lvofWizJQfVCTQL9tJ 6agGL5ORlzAYw9HFK+ZNta36ci+AiuKc7q/h9gtUfmcvzsV2owgRQWzNxYmSyGfsqrPc qv4NNv/EnfQwX2Y4o8JikbWdTtUCBLj7y2jBHCt2NEo6x/818wmGhO0iKRq1CT+jkRYP +ubfbtUhQiV4GiVuniAO2eZR7xttfkMAiOz2seHP5rfWZO/QihTC7k7xjPEgW5SzHsPM VwYBOAXmvBFuCnMXhkyvwAr9jiI1TBSHZWWRYg5qWh+nUaGcV57o1dvg1N3hIkzka2bc h6nQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=tayNMOAR; 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 v9-20020a05622a014900b004197ddb7c46si3601272qtw.764.2023.10.21.23.16.10 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sat, 21 Oct 2023 23:16:10 -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=tayNMOAR; 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 1quRW6-0000XE-4z; Sun, 22 Oct 2023 02:00:50 -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 1quRW2-0000VE-B1 for qemu-devel@nongnu.org; Sun, 22 Oct 2023 02:00:46 -0400 Received: from mail-pf1-x436.google.com ([2607:f8b0:4864:20::436]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1quRW0-0001XG-Fb for qemu-devel@nongnu.org; Sun, 22 Oct 2023 02:00:46 -0400 Received: by mail-pf1-x436.google.com with SMTP id d2e1a72fcca58-6b20577ef7bso1659267b3a.3 for ; Sat, 21 Oct 2023 23:00:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1697954443; x=1698559243; 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=E3tYYl15SbYe+7PrLSwAYdfpLhjfdTC4pXipfF3UoTQ=; b=tayNMOARnLnhRw1rCxCN4xg7WlU9IZ7eH/n9nPM43E+iT7kPUv85WjR6G03DXESis/ D2siW5FX5yCE57pDjbuif3WQlAD1Xd+KMtxILKCj1kwqGJgcPFs8qZewlXI9b19PHSB6 buZKKW07OfSPIfv7N26GKByJHCFw31ZDRpc73I75Qx9qUnK+GeT+SvQOO16OFSfppOkq SzosmLpcaI5Pk0qxT+Rod1KlHOgI3MdIBhPKUwLPuZEuXSURChp7xdNwZtom3JJglXEi OKRnHQkPTsgwMZ/LiScViI7f7QVHmsRtDcLSRKSrzzzb1N7Wsx1DhP6qTyj6keY5JYbO q0pQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697954443; x=1698559243; 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=E3tYYl15SbYe+7PrLSwAYdfpLhjfdTC4pXipfF3UoTQ=; b=CKdCPh8uz/EB4EaDrh4StBq0Uri1HN6xW3IVYT0BU/s3IZKG1RIkl2wiXso4TIj9s/ C0lXuLJKzM1qo/5v3WboQpIWR9d6pJSQeGHGTgb8H/AyEh/V32hYl7C3X21xchoxCqqb 5vyw418Q9YjrhCrbZMgvdWShxK38E6GeeI6YXLbQ4bMb7F3bHQejog/SazIT7Yo7zIKL fzy6pquRVjT/n5a8GJeGfRukUX0Z3cphFSv43NuScFfZWn5HqQuMuM8Kc9+xde5NG0bV NzWKc09A8C7VvHihys7Ii1lJtqNUGDod/FofkGw46A9rYME3SAt36TDI0Uwe1cETdbjD vnvQ== X-Gm-Message-State: AOJu0YxEy576NlGm35FN18vRrVWNgnqF3JkMDajrV23varYu469wy988 Bd9ciYwBnGkSjk/GE21F9sN8MqKOSebWxjf8S0k= X-Received: by 2002:a05:6a21:a5a1:b0:17d:53aa:d54d with SMTP id gd33-20020a056a21a5a100b0017d53aad54dmr2378448pzc.37.1697954443168; Sat, 21 Oct 2023 23:00:43 -0700 (PDT) Received: from stoup.. ([71.212.149.95]) by smtp.gmail.com with ESMTPSA id je17-20020a170903265100b001c728609574sm3999887plb.6.2023.10.21.23.00.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 21 Oct 2023 23:00:42 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: mark.cave-ayland@ilande.co.uk Subject: [PATCH v4 12/90] target/sparc: Move BPcc and Bicc to decodetree Date: Sat, 21 Oct 2023 22:59:13 -0700 Message-Id: <20231022060031.490251-13-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231022060031.490251-1-richard.henderson@linaro.org> References: <20231022060031.490251-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::436; envelope-from=richard.henderson@linaro.org; helo=mail-pf1-x436.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 | 4 ++ target/sparc/translate.c | 117 +++++++++++++++++++------------------- 2 files changed, 61 insertions(+), 60 deletions(-) diff --git a/target/sparc/insns.decode b/target/sparc/insns.decode index a5f5d2681e..15cd975f4e 100644 --- a/target/sparc/insns.decode +++ b/target/sparc/insns.decode @@ -3,4 +3,8 @@ # Sparc instruction decode definitions. # Copyright (c) 2023 Richard Henderson +&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 + CALL 01 i:s30 diff --git a/target/sparc/translate.c b/target/sparc/translate.c index 7ef4c6d4f7..92ea6bab6b 100644 --- a/target/sparc/translate.c +++ b/target/sparc/translate.c @@ -1367,44 +1367,6 @@ static void gen_cond_reg(TCGv r_dst, int cond, TCGv r_src) } #endif -static void do_branch(DisasContext *dc, int32_t offset, uint32_t insn, int cc) -{ - unsigned int cond = GET_FIELD(insn, 3, 6), a = (insn & (1 << 29)); - target_ulong target = dc->pc + offset; - - if (unlikely(AM_CHECK(dc))) { - target &= 0xffffffffULL; - } - if (cond == 0x0) { - /* unconditional not taken */ - if (a) { - dc->pc = dc->npc + 4; - dc->npc = dc->pc + 4; - } else { - dc->pc = dc->npc; - dc->npc = dc->pc + 4; - } - } else if (cond == 0x8) { - /* unconditional taken */ - if (a) { - dc->pc = target; - dc->npc = dc->pc + 4; - } else { - dc->pc = dc->npc; - dc->npc = target; - tcg_gen_mov_tl(cpu_pc, cpu_npc); - } - } else { - flush_cond(dc); - gen_cond(cpu_cond, cc, cond, dc); - if (a) { - gen_branch_a(dc, target); - } else { - gen_branch_n(dc, target); - } - } -} - static void do_fbranch(DisasContext *dc, int32_t offset, uint32_t insn, int cc) { unsigned int cond = GET_FIELD(insn, 3, 6), a = (insn & (1 << 29)); @@ -3046,6 +3008,61 @@ static bool advance_pc(DisasContext *dc) return true; } +static bool advance_jump_uncond_never(DisasContext *dc, bool annul) +{ + if (annul) { + dc->pc = dc->npc + 4; + dc->npc = dc->pc + 4; + } else { + dc->pc = dc->npc; + dc->npc = dc->pc + 4; + } + return true; +} + +static bool advance_jump_uncond_always(DisasContext *dc, bool annul, + target_ulong dest) +{ + if (annul) { + dc->pc = dest; + dc->npc = dest + 4; + } else { + dc->pc = dc->npc; + dc->npc = dest; + tcg_gen_mov_tl(cpu_pc, cpu_npc); + } + return true; +} + +static bool advance_jump_cond(DisasContext *dc, bool annul, target_ulong dest) +{ + if (annul) { + gen_branch_a(dc, dest); + } else { + gen_branch_n(dc, dest); + } + return true; +} + +static bool do_bpcc(DisasContext *dc, arg_bcc *a) +{ + target_long target = address_mask_i(dc, dc->pc + a->i * 4); + + switch (a->cond) { + case 0x0: + return advance_jump_uncond_never(dc, a->a); + case 0x8: + return advance_jump_uncond_always(dc, a->a, target); + default: + flush_cond(dc); + gen_cond(cpu_cond, a->cc, a->cond, dc); + return advance_jump_cond(dc, a->a, target); + } +} + +TRANS(Bicc, ALL, do_bpcc, a) +TRANS(BPcc, 64, do_bpcc, a) + static bool trans_CALL(DisasContext *dc, arg_CALL *a) { target_long target = address_mask_i(dc, dc->pc + a->i * 4); @@ -3083,21 +3100,7 @@ static void disas_sparc_legacy(DisasContext *dc, unsigned int insn) switch (xop) { #ifdef TARGET_SPARC64 case 0x1: /* V9 BPcc */ - { - int cc; - - target = GET_FIELD_SP(insn, 0, 18); - target = sign_extend(target, 19); - target <<= 2; - cc = GET_FIELD_SP(insn, 20, 21); - if (cc == 0) - do_branch(dc, target, insn, 0); - else if (cc == 2) - do_branch(dc, target, insn, 1); - else - goto illegal_insn; - goto jmp_insn; - } + g_assert_not_reached(); /* in decodetree */ case 0x3: /* V9 BPr */ { target = GET_FIELD_SP(insn, 0, 13) | @@ -3127,13 +3130,7 @@ static void disas_sparc_legacy(DisasContext *dc, unsigned int insn) } #endif case 0x2: /* BN+x */ - { - target = GET_FIELD(insn, 10, 31); - target = sign_extend(target, 22); - target <<= 2; - do_branch(dc, target, insn, 0); - goto jmp_insn; - } + g_assert_not_reached(); /* in decodetree */ case 0x6: /* FBN+x */ { if (gen_trap_ifnofpu(dc)) { From patchwork Sun Oct 22 05:59:14 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 736950 Delivered-To: patch@linaro.org Received: by 2002:adf:dd81:0:b0:32d:baff:b0ca with SMTP id x1csp1004500wrl; Sat, 21 Oct 2023 23:07:10 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHV3s1nMMht2dLXU9bAtwqo5ze211ObICbOUF2wZiaDbMPUUGRTMBwihUx+HTPC8OJU6vrx X-Received: by 2002:a05:6214:e6c:b0:66d:9d6:633a with SMTP id jz12-20020a0562140e6c00b0066d09d6633amr6823277qvb.33.1697954830697; Sat, 21 Oct 2023 23:07:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697954830; cv=none; d=google.com; s=arc-20160816; b=FQBWqfOouRd8q5eOdHBTGOS2iFE1Ls9REQMD+EkVvQTQsKa83DYqAF/QjOcFFNZBy4 9glwm99muP1uNIeFV4joawMQpCVWnbetr21Ge3MMZhlN9ndW6qzErt2QO90xd9EEg7xJ IQ5abhs7GQThEXm9CEFdTZ0xnXkl/Pn4eyzUrmfMW0gT/lnYD8+PdLaCqj0cij/GjhE8 QWcHEsIgsnXHYHkTURq5lb14td12p+bA/i9fBS+Ye2beFJBhEgKXM+E32qAVI/WhAG6k dhF7kxdSt5Z0Ir3BFe9RR7+2X2HsKAZkjT5mVTxNHgyhytjHEY6IOm/NSpmd6UF4K0Q2 +YaQ== 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=AJuNpMjdlDyXqaeom2c3v8J1CgmGjKoFqjHBWEKYq9c=; fh=TYrED6TOMxGX0VC4GtjviASLbYyJe19+7/tKWjN44KQ=; b=TH7gG47fMjQCeT/lmAr7SLcAjrMGiunQlnmNXFX8tytZneswXAZ9dEraJiRknlpqLq AKlmIBJgaKUrGzlD1xS/dYsxUgYESE7YhAW9Hud4DeELhOkkrBy3VkDuP/YRUv/qhHFN molRdEt1dr+FNO+SyS77RttRR78n2zvWucwywUtW5ZQq2GryERXtx7F3Sd4jPqY0VQII hd7QfrA/JaCT6ZmxlKdsUY9jRdV36vu3SZM+25niSL/MhuE7HaTuUfLlnQRnNtGg4b3f HY++IVQHOUNJMlCpIuI6wKhiKQWS5NLRE8y3QlMXp5nYg/GcgJbACmvcIT2mj0bCqoLq pcZQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=jpTeNVVQ; 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 dp20-20020a05621409d400b0065afd8e073asi3725351qvb.588.2023.10.21.23.07.10 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sat, 21 Oct 2023 23:07:10 -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=jpTeNVVQ; 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 1quRW5-0000X2-4r; Sun, 22 Oct 2023 02:00:49 -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 1quRW3-0000VS-1b for qemu-devel@nongnu.org; Sun, 22 Oct 2023 02:00:47 -0400 Received: from mail-pf1-x432.google.com ([2607:f8b0:4864:20::432]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1quRW1-0001XZ-BX for qemu-devel@nongnu.org; Sun, 22 Oct 2023 02:00:46 -0400 Received: by mail-pf1-x432.google.com with SMTP id d2e1a72fcca58-694ed847889so1793777b3a.2 for ; Sat, 21 Oct 2023 23:00:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1697954444; x=1698559244; 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=AJuNpMjdlDyXqaeom2c3v8J1CgmGjKoFqjHBWEKYq9c=; b=jpTeNVVQm2Kkl1UWaI7vwPWVvwbaKHS7UufazOxoGzG6MP/3p3g5CoXYRtgpVYlq9N b3nAFCVj4kg6T0iinHPIMihMOwRry3m7uVr8ueOn+BNmiBtTB05emscmEjV1D09X83zu gFHOgaKe13j1HMQs13KN6eNSmKpIpNPYgp0gVCBhofDsI8XuTPiKfhKYE8YLdAhI5cv2 1EV/YqMwmgW7alcPrJQph6f3W9oFJXHMIi/tzulzQG52Jcnf1aolWp4N7CNLW5GIj2vt ml2Fm+iPdebvVAdxl1L0sEl2/AdkmT0qnqaS8+h2Fz7bXuteXAhBqg1iAe1291+uiukO 2nsA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697954444; x=1698559244; 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=AJuNpMjdlDyXqaeom2c3v8J1CgmGjKoFqjHBWEKYq9c=; b=P8EcrY4VRBYd0P9BWZpkdcSJZ0LosJUOtMFQjUyQSzO5Q2ZxS3KFq1sorV2QpJgFJ7 EmJUqo+gBitq66j5JXyoqP67UMb8jL9eWt2LkYcAxb/Tl4Cgsx/jAqqvVDt4rJJbWZAC UmFNjJu1gW5tjswilY348J3ADSSmGS91mGyBUJi2IkLpOvLRytIFyh4pLXDQJyCNJGW3 m9JDZjdkMh4WbggM2hzYPJPpZ46CHOTr+z+bD7qskUaJA1bA4E3oLMymYzgY7yE7w4sZ canY28PdT1Cuxvt5YYA4FtK1+w400ajuP+uXvKiPGtqdZjYhSxnzbEsE8ni4WUKjIdd5 MI7Q== X-Gm-Message-State: AOJu0YwHy2GgJs9YPONv1f3y+tm5GjdvlJTYbvpbWzalnLB0qA65bfLr Drb6tZ3G21MAp5rt86qJp+FvONXZ/2wCZ38mEnE= X-Received: by 2002:a17:902:d4c6:b0:1ca:15ad:1c6 with SMTP id o6-20020a170902d4c600b001ca15ad01c6mr4671697plg.33.1697954443976; Sat, 21 Oct 2023 23:00:43 -0700 (PDT) Received: from stoup.. ([71.212.149.95]) by smtp.gmail.com with ESMTPSA id je17-20020a170903265100b001c728609574sm3999887plb.6.2023.10.21.23.00.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 21 Oct 2023 23:00:43 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: mark.cave-ayland@ilande.co.uk Subject: [PATCH v4 13/90] target/sparc: Move BPr to decodetree Date: Sat, 21 Oct 2023 22:59:14 -0700 Message-Id: <20231022060031.490251-14-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231022060031.490251-1-richard.henderson@linaro.org> References: <20231022060031.490251-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::432; envelope-from=richard.henderson@linaro.org; helo=mail-pf1-x432.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 | 3 ++ target/sparc/translate.c | 63 ++++++++++++++------------------------- 2 files changed, 25 insertions(+), 41 deletions(-) diff --git a/target/sparc/insns.decode b/target/sparc/insns.decode index 15cd975f4e..838f4cdb1d 100644 --- a/target/sparc/insns.decode +++ b/target/sparc/insns.decode @@ -7,4 +7,7 @@ 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 +%d16 20:s2 0:14 +BPr 00 a:1 0 cond:3 011 .. - rs1:5 .............. i=%d16 + CALL 01 i:s30 diff --git a/target/sparc/translate.c b/target/sparc/translate.c index 92ea6bab6b..2d08c81821 100644 --- a/target/sparc/translate.c +++ b/target/sparc/translate.c @@ -1336,14 +1336,13 @@ static void gen_fcond(TCGv r_dst, unsigned int cc, unsigned int cond) } } -#ifdef TARGET_SPARC64 // Inverted logic -static const int gen_tcg_cond_reg[8] = { - -1, +static const TCGCond gen_tcg_cond_reg[8] = { + TCG_COND_NEVER, /* reserved */ TCG_COND_NE, TCG_COND_GT, TCG_COND_GE, - -1, + TCG_COND_NEVER, /* reserved */ TCG_COND_EQ, TCG_COND_LE, TCG_COND_LT, @@ -1357,16 +1356,6 @@ static void gen_compare_reg(DisasCompare *cmp, int cond, TCGv r_src) cmp->c2 = tcg_constant_tl(0); } -static void gen_cond_reg(TCGv r_dst, int cond, TCGv r_src) -{ - DisasCompare cmp; - gen_compare_reg(&cmp, cond, r_src); - - /* The interface is to return a boolean in r_dst. */ - tcg_gen_setcond_tl(cmp.cond, r_dst, cmp.c1, cmp.c2); -} -#endif - static void do_fbranch(DisasContext *dc, int32_t offset, uint32_t insn, int cc) { unsigned int cond = GET_FIELD(insn, 3, 6), a = (insn & (1 << 29)); @@ -1406,24 +1395,6 @@ static void do_fbranch(DisasContext *dc, int32_t offset, uint32_t insn, int cc) } #ifdef TARGET_SPARC64 -static void do_branch_reg(DisasContext *dc, int32_t offset, uint32_t insn, - TCGv r_reg) -{ - unsigned int cond = GET_FIELD_SP(insn, 25, 27), a = (insn & (1 << 29)); - target_ulong target = dc->pc + offset; - - if (unlikely(AM_CHECK(dc))) { - target &= 0xffffffffULL; - } - flush_cond(dc); - gen_cond_reg(cpu_cond, cond, r_reg); - if (a) { - gen_branch_a(dc, target); - } else { - gen_branch_n(dc, target); - } -} - static void gen_op_fcmps(int fccno, TCGv_i32 r_rs1, TCGv_i32 r_rs2) { switch (fccno) { @@ -3063,6 +3034,24 @@ static bool do_bpcc(DisasContext *dc, arg_bcc *a) TRANS(Bicc, ALL, do_bpcc, a) TRANS(BPcc, 64, do_bpcc, a) +static bool trans_BPr(DisasContext *dc, arg_BPr *a) +{ + target_long target = address_mask_i(dc, dc->pc + a->i * 4); + DisasCompare cmp; + + if (!avail_64(dc)) { + return false; + } + if (gen_tcg_cond_reg[a->cond] == TCG_COND_NEVER) { + return false; + } + + flush_cond(dc); + gen_compare_reg(&cmp, a->cond, gen_load_gpr(dc, a->rs1)); + tcg_gen_setcond_tl(cmp.cond, cpu_cond, cmp.c1, cmp.c2); + return advance_jump_cond(dc, a->a, target); +} + static bool trans_CALL(DisasContext *dc, arg_CALL *a) { target_long target = address_mask_i(dc, dc->pc + a->i * 4); @@ -3102,15 +3091,7 @@ static void disas_sparc_legacy(DisasContext *dc, unsigned int insn) case 0x1: /* V9 BPcc */ g_assert_not_reached(); /* in decodetree */ case 0x3: /* V9 BPr */ - { - target = GET_FIELD_SP(insn, 0, 13) | - (GET_FIELD_SP(insn, 20, 21) << 14); - target = sign_extend(target, 16); - target <<= 2; - cpu_src1 = get_src1(dc, insn); - do_branch_reg(dc, target, insn, cpu_src1); - goto jmp_insn; - } + g_assert_not_reached(); /* in decodetree */ case 0x5: /* V9 FBPcc */ { int cc = GET_FIELD_SP(insn, 20, 21); From patchwork Sun Oct 22 05:59:15 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 736936 Delivered-To: patch@linaro.org Received: by 2002:adf:dd81:0:b0:32d:baff:b0ca with SMTP id x1csp1003957wrl; Sat, 21 Oct 2023 23:05:00 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHGjSqvjIVPf/gUcuMWHylme3sD3TloEc2IEMF6i5FNZDv3UQLkQXN21xaZLexfHI8ehDff X-Received: by 2002:a0c:f28b:0:b0:66d:9f9e:f84 with SMTP id k11-20020a0cf28b000000b0066d9f9e0f84mr4435732qvl.8.1697954700644; Sat, 21 Oct 2023 23:05:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697954700; cv=none; d=google.com; s=arc-20160816; b=ChYwlA86xseD1L+7KbU1CY6nfhn1jM+VVqPmvvNQk6znRs4kVjx+Xode4+RztT7EKW Oh2hknKopOHTQRnkaIzUlXL7HcTkwRmyvbWV/iGvKu/JuKQQRDjCw9eX9QCaghgyzqLs isSx8AJpcgysl7zln4tb7I1doCfvAmF10yTBQwPS/avVSVVQPSOsVYNCnkMpm2P1hXPT HynoMhOAd26Gm5rpCjOMOJU9T0C3LRzkAGjCks2cJ5CwN+O9Qma9pAApuiR5JQtbolyL pLV4wsPV+kfsm2Ckk4/KQu9vBz809u0vc0u2uBvyJbmzYDY8rqcDzZxLLPeruAJLFut/ NecQ== 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=z3VEIbvjRYgsDHOF+dDcgCX/rxnIBN6JS7kHe55iiGc=; fh=TYrED6TOMxGX0VC4GtjviASLbYyJe19+7/tKWjN44KQ=; b=dr7h/BXOsZ5MTfYY/0gZfJNfgZSQA8SeVTUD20G+a0H3NiH5JzyaGul5GdsdboftOp f2AJZbrwryGqzbz/2HcdzDG67Ths0MD4iDkz18XvCKiBaUBcNI6dX3rEL4dcS7hrEjSd b0nAr52wfSN6NKlLAQSPcAoEsOk1L+1GJTI1ZgDTAJfZwvgIM3m72MkAtU5JUBrOo4ag u9Pcq/6j27S2+lKkR/UjTKnNBg2Et4d6DVhBUwSlAJJCwgRbro2a31JUIUtdGzWee2l+ NJluRO9imXhsp5LNp7fIFfq/2HAb7IOTUAdRG7tpmsJipa7qYC3mVlYFJ5vXHRyEAyEI 4b1A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="OD/43E9c"; 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 mi11-20020a056214558b00b0066d1fcca1b7si3760276qvb.90.2023.10.21.23.05.00 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sat, 21 Oct 2023 23:05:00 -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="OD/43E9c"; 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 1quRW8-0000ZM-8P; Sun, 22 Oct 2023 02:00:52 -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 1quRW4-0000Vg-3f for qemu-devel@nongnu.org; Sun, 22 Oct 2023 02:00:48 -0400 Received: from mail-pj1-x1036.google.com ([2607:f8b0:4864:20::1036]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1quRW2-0001Xr-8j for qemu-devel@nongnu.org; Sun, 22 Oct 2023 02:00:47 -0400 Received: by mail-pj1-x1036.google.com with SMTP id 98e67ed59e1d1-27d1373f631so1750391a91.1 for ; Sat, 21 Oct 2023 23:00:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1697954445; x=1698559245; 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=z3VEIbvjRYgsDHOF+dDcgCX/rxnIBN6JS7kHe55iiGc=; b=OD/43E9c0xw7pYNkKYJwYaGoZPLnfIvPCHwa1QB41PybO/+hEt+5q4Hux7wo/ZwWI4 fbOLNfUej/Uad0uXBJeZPh5mDUbEIB+AlSkKTiqwgd7bV75txpm7NyArg/C0GPqeVXvP POezyRleBgA39ZELeHUHPIlLiRgH+AEwNaNShcz+U0hanJqs6dym6bQ0JQgsWJsUSB1E V/Vdn0/uFPfOSZaRF6DSgN1FKi4fuFAqD6xjE/tOzIwJDwg4gS+lnAy3sLpKJ01nCYLm jlgC4n7PaCBK+qf0sPfbyASQyB4WM5+bkGF2EMOI4plrqjJIKbO7E0rPgaVA8KXIqNbN NH5w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697954445; x=1698559245; 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=z3VEIbvjRYgsDHOF+dDcgCX/rxnIBN6JS7kHe55iiGc=; b=FbBy9qnWCpQohMeKEcM6Wd/lYZRC03bDQxGZ6gBbqm3yNAoHZw/VEyh7tiRE0Z0Kvk wYP8cTNxyPeLiDhdFarIUH9bi7LoAwtyLn5j8vgIjEEizC7oE3ye/1SfA72t1IxGRA85 W/wIBhY8STPaTiUojZlA9Ya3Q2qCH52dlVJuZofQjUotuzfITXNdbJ4WFc2N2OPhkLrj j7kJQCWODkfa7wFgwSGhMGl5fnOusO2Q1xx3xkEq14yK7h9ErA1UxEvpENcqEjVnj8kj 3Jgu16f0fC4iS7MALEGJ4nhJh1+oK5u6ZB0a2C/FesRSYDBIzr5k8Y453UVW0RTfL6eF qrCA== X-Gm-Message-State: AOJu0YwkJV6NX2JaW61LQJodOrnatGQpLxRS2SB1XgWI6O2rML2rr6F3 hSogLBZ5MAEOQp5SBEQrdOFQVSMLMglUG3nELTQ= X-Received: by 2002:a17:902:ecc4:b0:1c3:323f:f531 with SMTP id a4-20020a170902ecc400b001c3323ff531mr6171453plh.20.1697954444822; Sat, 21 Oct 2023 23:00:44 -0700 (PDT) Received: from stoup.. ([71.212.149.95]) by smtp.gmail.com with ESMTPSA id je17-20020a170903265100b001c728609574sm3999887plb.6.2023.10.21.23.00.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 21 Oct 2023 23:00:44 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: mark.cave-ayland@ilande.co.uk Subject: [PATCH v4 14/90] target/sparc: Move FBPfcc and FBfcc to decodetree Date: Sat, 21 Oct 2023 22:59:15 -0700 Message-Id: <20231022060031.490251-15-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231022060031.490251-1-richard.henderson@linaro.org> References: <20231022060031.490251-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::1036; envelope-from=richard.henderson@linaro.org; helo=mail-pj1-x1036.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 | 4 ++ target/sparc/translate.c | 102 +++++++++++++++----------------------- 2 files changed, 43 insertions(+), 63 deletions(-) diff --git a/target/sparc/insns.decode b/target/sparc/insns.decode index 838f4cdb1d..9ab3f2eb82 100644 --- a/target/sparc/insns.decode +++ b/target/sparc/insns.decode @@ -6,8 +6,12 @@ &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 +FBPfcc 00 a:1 cond:4 101 cc:2 - i:s19 &bcc +FBfcc 00 a:1 cond:4 110 i:s22 &bcc cc=0 %d16 20:s2 0:14 BPr 00 a:1 0 cond:3 011 .. - rs1:5 .............. i=%d16 +NCP 00 - ---- 111 ---------------------- # CBcc + CALL 01 i:s30 diff --git a/target/sparc/translate.c b/target/sparc/translate.c index 2d08c81821..69e85b1842 100644 --- a/target/sparc/translate.c +++ b/target/sparc/translate.c @@ -1356,44 +1356,6 @@ static void gen_compare_reg(DisasCompare *cmp, int cond, TCGv r_src) cmp->c2 = tcg_constant_tl(0); } -static void do_fbranch(DisasContext *dc, int32_t offset, uint32_t insn, int cc) -{ - unsigned int cond = GET_FIELD(insn, 3, 6), a = (insn & (1 << 29)); - target_ulong target = dc->pc + offset; - - if (unlikely(AM_CHECK(dc))) { - target &= 0xffffffffULL; - } - if (cond == 0x0) { - /* unconditional not taken */ - if (a) { - dc->pc = dc->npc + 4; - dc->npc = dc->pc + 4; - } else { - dc->pc = dc->npc; - dc->npc = dc->pc + 4; - } - } else if (cond == 0x8) { - /* unconditional taken */ - if (a) { - dc->pc = target; - dc->npc = dc->pc + 4; - } else { - dc->pc = dc->npc; - dc->npc = target; - tcg_gen_mov_tl(cpu_pc, cpu_npc); - } - } else { - flush_cond(dc); - gen_fcond(cpu_cond, cc, cond); - if (a) { - gen_branch_a(dc, target); - } else { - gen_branch_n(dc, target); - } - } -} - #ifdef TARGET_SPARC64 static void gen_op_fcmps(int fccno, TCGv_i32 r_rs1, TCGv_i32 r_rs2) { @@ -3034,6 +2996,28 @@ static bool do_bpcc(DisasContext *dc, arg_bcc *a) TRANS(Bicc, ALL, do_bpcc, a) TRANS(BPcc, 64, do_bpcc, a) +static bool do_fbpfcc(DisasContext *dc, arg_bcc *a) +{ + target_long target = address_mask_i(dc, dc->pc + a->i * 4); + + if (gen_trap_ifnofpu(dc)) { + return true; + } + switch (a->cond) { + case 0x0: + return advance_jump_uncond_never(dc, a->a); + case 0x8: + return advance_jump_uncond_always(dc, a->a, target); + default: + flush_cond(dc); + gen_fcond(cpu_cond, a->cc, a->cond); + return advance_jump_cond(dc, a->a, target); + } +} + +TRANS(FBPfcc, 64, do_fbpfcc, a) +TRANS(FBfcc, ALL, do_fbpfcc, a) + static bool trans_BPr(DisasContext *dc, arg_BPr *a) { target_long target = address_mask_i(dc, dc->pc + a->i * 4); @@ -3062,6 +3046,20 @@ static bool trans_CALL(DisasContext *dc, arg_CALL *a) return true; } +static bool trans_NCP(DisasContext *dc, arg_NCP *a) +{ + /* + * For sparc32, always generate the no-coprocessor exception. + * For sparc64, always generate illegal instruction. + */ +#ifdef TARGET_SPARC64 + return false; +#else + gen_exception(dc, TT_NCP_INSN); + return true; +#endif +} + #define CHECK_IU_FEATURE(dc, FEATURE) \ if (!((dc)->def->features & CPU_FEATURE_ ## FEATURE)) \ goto illegal_insn; @@ -3085,7 +3083,6 @@ static void disas_sparc_legacy(DisasContext *dc, unsigned int insn) case 0: /* branches/sethi */ { unsigned int xop = GET_FIELD(insn, 7, 9); - int32_t target; switch (xop) { #ifdef TARGET_SPARC64 case 0x1: /* V9 BPcc */ @@ -3093,36 +3090,15 @@ static void disas_sparc_legacy(DisasContext *dc, unsigned int insn) case 0x3: /* V9 BPr */ g_assert_not_reached(); /* in decodetree */ case 0x5: /* V9 FBPcc */ - { - int cc = GET_FIELD_SP(insn, 20, 21); - if (gen_trap_ifnofpu(dc)) { - goto jmp_insn; - } - target = GET_FIELD_SP(insn, 0, 18); - target = sign_extend(target, 19); - target <<= 2; - do_fbranch(dc, target, insn, cc); - goto jmp_insn; - } + g_assert_not_reached(); /* in decodetree */ #else case 0x7: /* CBN+x */ - { - goto ncp_insn; - } + g_assert_not_reached(); /* in decodetree */ #endif case 0x2: /* BN+x */ g_assert_not_reached(); /* in decodetree */ case 0x6: /* FBN+x */ - { - if (gen_trap_ifnofpu(dc)) { - goto jmp_insn; - } - target = GET_FIELD(insn, 10, 31); - target = sign_extend(target, 22); - target <<= 2; - do_fbranch(dc, target, insn, 0); - goto jmp_insn; - } + g_assert_not_reached(); /* in decodetree */ case 0x4: /* SETHI */ /* Special-case %g0 because that's the canonical nop. */ if (rd) { From patchwork Sun Oct 22 05:59:16 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 737009 Delivered-To: patch@linaro.org Received: by 2002:adf:dd81:0:b0:32d:baff:b0ca with SMTP id x1csp1006749wrl; Sat, 21 Oct 2023 23:16:35 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHSMDB/yS2pejXDaU/DExmnWBKfX3g8wZbI1cljUWxPE+oYMKDejWUuvCvudlkAn8v41mbx X-Received: by 2002:a05:6214:d46:b0:656:3fa4:6016 with SMTP id 6-20020a0562140d4600b006563fa46016mr8274391qvr.62.1697955395350; Sat, 21 Oct 2023 23:16:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697955395; cv=none; d=google.com; s=arc-20160816; b=PgpRCZ9WqZgVJCdLyW/ozLdSslHBY/WFeadBnFSirGdA2OlPLVe3FZqufijjKDwzmi jMv0JDriJ7wI/QyAV1qfDJoce+N2fa8fg0bPvXrfM8ivzqB9CsjIKax064uKuGExyWTb WN3VaGsutV1dvqzkdwdaDeVZ5swWAv/1j01HxPv8chAoZ/t1vftXFWZRK7W2g+ByO8Yw ybrgOZrl1IJ0Ji5N73MxKTi+KDFAt0LZqpwQWt5XFzoMq64SgaapTfpZSomEJzNDKrlk xE7euSdXSRIAgyHSuwAkAzPC951jA1Rj0kNPzQEyyZs6zQ8iWXhSsgDnusyeOlofHFGV eqKw== 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=wmDa64Gca20nDmrXVypVfD852JFXcmSGDjcXXZ4bM8M=; fh=GkmytpQ/aBK+SnhsUxtqa1dYh9qnVue5D4c8ejqHfb0=; b=YHsgNYlwjT/4u9adelHHuLkePX/nimTAlSnup10Dd7hrUlQOjisUbwgILoEwk86aJK l73VFjCYsboquMNXvsUSA5Rrmusyl7ZzCyWInvQX2Hd91LPDKu/iA2gcup0D2kCvzNo1 of/jso+WIj8vcsRrWPyWFk/bH3L6WnUch7Il9Pe1bcOx6tZa8FZBSHJ75NZWqphuZosr iRaVUIq9Pp0laaQw2rTdCcFS8WIEPk316Y5DR7PjOPofyx5OLdGYvsXZcRufpjBaA+Sa 3qapq3PhmxrxCO37ukl3baEc61688l9ZjLk9ebD2xugwx673Y7Ptm0fp/4o/Db1EciMN RyVA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=UQAarqwJ; 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 ff3-20020a0562140bc300b0066ceeacae81si3899913qvb.536.2023.10.21.23.16.35 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sat, 21 Oct 2023 23:16:35 -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=UQAarqwJ; 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 1quRW6-0000XB-2b; Sun, 22 Oct 2023 02:00:50 -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 1quRW4-0000WP-Mt for qemu-devel@nongnu.org; Sun, 22 Oct 2023 02:00:48 -0400 Received: from mail-pf1-x42a.google.com ([2607:f8b0:4864:20::42a]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1quRW3-0001YF-5W for qemu-devel@nongnu.org; Sun, 22 Oct 2023 02:00:48 -0400 Received: by mail-pf1-x42a.google.com with SMTP id d2e1a72fcca58-6b26a3163acso1592228b3a.2 for ; Sat, 21 Oct 2023 23:00:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1697954445; x=1698559245; 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=wmDa64Gca20nDmrXVypVfD852JFXcmSGDjcXXZ4bM8M=; b=UQAarqwJBEjeGheaKzZW8N8Rm5YbQuJ9j/gTLhAWsSO8trtf5bHqb2jxRDTAtAyfH2 6/eldwo9Iht0FZT/kWLvFgv2mJs6xR5ED48GCB+GUNqXGJ67TlccQQz4GcVvmt8Y55aj 8M59C5lGjVzBbBvVnrtegffLW2FD2l5qdBMsGfLJdQXHqCvgCbsDb7iI4Yb3aEk0T28c +PyEBAknsrwDMkifGP3iDHLJrEfE/XZ1x5u3UCLy+2B2S2BcLWgzALtia+eEgPSyL6gE +oG39ieaVRzx6byOPCdMZmWBkagxqEA9penfxuQSiVhLUuO1n9zTmqojwmNmDCZCAXCO c3Tg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697954445; x=1698559245; 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=wmDa64Gca20nDmrXVypVfD852JFXcmSGDjcXXZ4bM8M=; b=I+FVyFNqqkqXNcpUveONGcfQ+/NFWLS+5SnrVVGSVbC36w0+QzOCNmJEBgTPIPZjlX Kz+jyKTDD0P615V9A6k8AQlXVybzbHdPb2RdgGN/UCibx9rZVdqTp8mtFNVymH2h2UWT SErNwQdl2m0b7yxHiRS01NJuzFux77TTS8/Kj63ZWon4e4xlxkicSAbYrgNMsa1yJzNK K74EKQOSMJzjkZ2b0a49jcseNupHa59PmYyywxy5fYbEdw3KFDqPwDlXYSqqEUQNP2S2 n65Mm7G9jCO5DnRns3sexUUz3m37+BlrVhil+reGItUIEURZwKXzoAyz2bEl2v8lJEpB NPzg== X-Gm-Message-State: AOJu0Yx29M55KraZ9NDKwlM3tLAvShyQQwv4X+d6GbTtjDhShFemaLGG 4D4a+3J9p2uPnWffenaMKDCAWE/LTnj/oVabXOU= X-Received: by 2002:a17:902:e5c5:b0:1c4:56c8:27f8 with SMTP id u5-20020a170902e5c500b001c456c827f8mr3697257plf.68.1697954445623; Sat, 21 Oct 2023 23:00:45 -0700 (PDT) Received: from stoup.. ([71.212.149.95]) by smtp.gmail.com with ESMTPSA id je17-20020a170903265100b001c728609574sm3999887plb.6.2023.10.21.23.00.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 21 Oct 2023 23:00:45 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: mark.cave-ayland@ilande.co.uk, =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Subject: [PATCH v4 15/90] target/sparc: Merge gen_cond with only caller Date: Sat, 21 Oct 2023 22:59:16 -0700 Message-Id: <20231022060031.490251-16-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231022060031.490251-1-richard.henderson@linaro.org> References: <20231022060031.490251-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::42a; envelope-from=richard.henderson@linaro.org; helo=mail-pf1-x42a.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 Reviewed-by: Philippe Mathieu-Daudé Signed-off-by: Richard Henderson --- target/sparc/translate.c | 23 ++++++++--------------- 1 file changed, 8 insertions(+), 15 deletions(-) diff --git a/target/sparc/translate.c b/target/sparc/translate.c index 69e85b1842..2664db302d 100644 --- a/target/sparc/translate.c +++ b/target/sparc/translate.c @@ -1309,20 +1309,6 @@ static void gen_fcompare(DisasCompare *cmp, unsigned int cc, unsigned int cond) } } -static void gen_cond(TCGv r_dst, unsigned int cc, unsigned int cond, - DisasContext *dc) -{ - DisasCompare cmp; - gen_compare(&cmp, cc, cond, dc); - - /* The interface is to return a boolean in r_dst. */ - if (cmp.is_bool) { - tcg_gen_mov_tl(r_dst, cmp.c1); - } else { - tcg_gen_setcond_tl(cmp.cond, r_dst, cmp.c1, cmp.c2); - } -} - static void gen_fcond(TCGv r_dst, unsigned int cc, unsigned int cond) { DisasCompare cmp; @@ -2980,6 +2966,7 @@ static bool advance_jump_cond(DisasContext *dc, bool annul, target_ulong dest) static bool do_bpcc(DisasContext *dc, arg_bcc *a) { target_long target = address_mask_i(dc, dc->pc + a->i * 4); + DisasCompare cmp; switch (a->cond) { case 0x0: @@ -2988,7 +2975,13 @@ static bool do_bpcc(DisasContext *dc, arg_bcc *a) return advance_jump_uncond_always(dc, a->a, target); default: flush_cond(dc); - gen_cond(cpu_cond, a->cc, a->cond, dc); + + gen_compare(&cmp, a->cc, a->cond, dc); + if (cmp.is_bool) { + tcg_gen_mov_tl(cpu_cond, cmp.c1); + } else { + tcg_gen_setcond_tl(cmp.cond, cpu_cond, cmp.c1, cmp.c2); + } return advance_jump_cond(dc, a->a, target); } } From patchwork Sun Oct 22 05:59:17 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 736926 Delivered-To: patch@linaro.org Received: by 2002:adf:dd81:0:b0:32d:baff:b0ca with SMTP id x1csp1003075wrl; Sat, 21 Oct 2023 23:01:54 -0700 (PDT) X-Google-Smtp-Source: AGHT+IECH6C4Z5KrOEYxq96HYFnrs19kitecdMgI/vPiV/d0ZMc3FeoZhS8OxxuRaFOhnlZZa4OA X-Received: by 2002:ac8:59d1:0:b0:418:af7:e00a with SMTP id f17-20020ac859d1000000b004180af7e00amr7008915qtf.21.1697954514539; Sat, 21 Oct 2023 23:01:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697954514; cv=none; d=google.com; s=arc-20160816; b=GPijb6oE3/uVuDlARbMGlZOyQVdxQQtaba+cjJ1EzKUjul50aE8FeIZElWzwhcnAHV XasC7Uk6pksuNcMUlL5yCKKbzZrnJ2fSZx6F3sacqNqpHzk+uN30BRa45AsR69Pe+ykG KTgcQoex+QARWeW9mx01m3Z4ALaCTVFyZbq+2gHq2zPbzhsbCzsUWtAC1+5bT9aUHIxq z4i76RHkbd2//QPeWBNt5Eo5C6ADUFC6AJCX5A2CQLn+YckB81cpxVSg+kWPxEvENNI/ 8O1Sgm84fJ1Pmxuj7RYEbouP02inwbZyAtEj1iH5vc4lYCTJ1epIoueAZ12zEfs8h2bB 9BVA== 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=pRMTQptI2nfQXOSpXQo/O0ul1mHB/BhVdQiXtwwiUDw=; fh=GkmytpQ/aBK+SnhsUxtqa1dYh9qnVue5D4c8ejqHfb0=; b=IHr5WGt23s3y3b3c9N+iOxl8EUecsea4LpR2BB84SxwbLEMMwEGrnfudgcDfHmFwLm Xnq82Ny6UT6+iKUiZCem1yTRX9FMLX9OMOh9YObemsU95bXYn+X3lg05gJTUcar7+qhJ vxMTrXFRlM32mR1UeZwOhIqgKzMSrEx90jP2KwA57LAD4tqcaAitFC/c3rjEbKL5fk2h IjpQ6SaZiUnlcdQzKDiz36E1lcQOwpbMGi1kyvstLy/I+BSEz/Ap5dA9UIagh0cwGv28 C/ziA1J4d3N04rWNhSXjgsvH2btWg7+UUSM5BKsNC2QnhmHo/llhzmQI2Tl8GedUXNZb lIBQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=rAxGsRbi; 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 d16-20020a05622a101000b004197c401385si3681085qte.439.2023.10.21.23.01.54 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sat, 21 Oct 2023 23:01:54 -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=rAxGsRbi; 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 1quRW8-0000ZO-K6; Sun, 22 Oct 2023 02:00:52 -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 1quRW5-0000X8-V2 for qemu-devel@nongnu.org; Sun, 22 Oct 2023 02:00:49 -0400 Received: from mail-pl1-x62c.google.com ([2607:f8b0:4864:20::62c]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1quRW3-0001YR-Vm for qemu-devel@nongnu.org; Sun, 22 Oct 2023 02:00:49 -0400 Received: by mail-pl1-x62c.google.com with SMTP id d9443c01a7336-1c77449a6daso18343645ad.0 for ; Sat, 21 Oct 2023 23:00:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1697954446; x=1698559246; 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=pRMTQptI2nfQXOSpXQo/O0ul1mHB/BhVdQiXtwwiUDw=; b=rAxGsRbi/usu3mntgUTGFufiBC3kA3RzjmZw9cw91OmN1KPXmgZ3Cs1Zq5JiSfFXcT UGEeNGRh4kI3cNktWIuB4VdGqJNi1oFbbQQ2XFKeAcB35VzfzH7Wn73CEwmlQqBNh7XK ab8uRk1zFSCzyEIiiWJoiltpQXtC8tkT9xRDVh2id4HnAyLKohk1gacXY/sU6q/Cf+MR da/u34Bx6EX471nRm7OB27LXX0seJOQPxqb9zqYzlVH8rllgW2z1JHb9LfQfKmxsI1Lh W24z5Dwf7GNawX9WHLiBDn/jE+RwaIgA0eG9xtIRas9PCWIXh/7kjIIJ8Ds4pLSk1Wzh 1rXg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697954446; x=1698559246; 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=pRMTQptI2nfQXOSpXQo/O0ul1mHB/BhVdQiXtwwiUDw=; b=gxmKmNdo2S9Wb122jYQ6Cfwhs3E863ZYIM0M69ffZ3J/BFnMpKb80coQOeJzxkSUns VwDEdimR0ufbZSXAreavssCj78cuGigI1PpviZgRg7P9bELiyXEDesnIocB8POdKv0LS qGQAbBUZ3Ts19K4c6pmwHAepuhL8oQjY8y1IWSzBi0QFKUClvN4htnVYVAU5SmofWzgJ Ha2D+cNvZfKNIUElLUx5MxH/KC1iLwB3qvfRSUT8ugoAhVonaiJ3szBuNDRhK+VMXo2C lct8uthDd8A6F2rtt/f0hnN0NYOLa2NnjKBOGkpd0vsRAOZvuIiLkOEMF6Ko3hR6Rsdo TBtA== X-Gm-Message-State: AOJu0YztQYlv1oU6DPMp9yLZcVXHHIgOtuVjda8lcsC32IZMImyAUvB/ qo6w0ZcQrXPHYXFCCBY0Ln6m76JsI6MnbonvOV4= X-Received: by 2002:a17:903:30d2:b0:1ca:e491:f525 with SMTP id s18-20020a17090330d200b001cae491f525mr359172plc.31.1697954446398; Sat, 21 Oct 2023 23:00:46 -0700 (PDT) Received: from stoup.. ([71.212.149.95]) by smtp.gmail.com with ESMTPSA id je17-20020a170903265100b001c728609574sm3999887plb.6.2023.10.21.23.00.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 21 Oct 2023 23:00:46 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: mark.cave-ayland@ilande.co.uk, =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Subject: [PATCH v4 16/90] target/sparc: Merge gen_fcond with only caller Date: Sat, 21 Oct 2023 22:59:17 -0700 Message-Id: <20231022060031.490251-17-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231022060031.490251-1-richard.henderson@linaro.org> References: <20231022060031.490251-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::62c; envelope-from=richard.henderson@linaro.org; helo=mail-pl1-x62c.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 Reviewed-by: Philippe Mathieu-Daudé Signed-off-by: Richard Henderson --- target/sparc/translate.c | 22 ++++++++-------------- 1 file changed, 8 insertions(+), 14 deletions(-) diff --git a/target/sparc/translate.c b/target/sparc/translate.c index 2664db302d..b8d51d6d64 100644 --- a/target/sparc/translate.c +++ b/target/sparc/translate.c @@ -1309,19 +1309,6 @@ static void gen_fcompare(DisasCompare *cmp, unsigned int cc, unsigned int cond) } } -static void gen_fcond(TCGv r_dst, unsigned int cc, unsigned int cond) -{ - DisasCompare cmp; - gen_fcompare(&cmp, cc, cond); - - /* The interface is to return a boolean in r_dst. */ - if (cmp.is_bool) { - tcg_gen_mov_tl(r_dst, cmp.c1); - } else { - tcg_gen_setcond_tl(cmp.cond, r_dst, cmp.c1, cmp.c2); - } -} - // Inverted logic static const TCGCond gen_tcg_cond_reg[8] = { TCG_COND_NEVER, /* reserved */ @@ -2992,6 +2979,7 @@ TRANS(BPcc, 64, do_bpcc, a) static bool do_fbpfcc(DisasContext *dc, arg_bcc *a) { target_long target = address_mask_i(dc, dc->pc + a->i * 4); + DisasCompare cmp; if (gen_trap_ifnofpu(dc)) { return true; @@ -3003,7 +2991,13 @@ static bool do_fbpfcc(DisasContext *dc, arg_bcc *a) return advance_jump_uncond_always(dc, a->a, target); default: flush_cond(dc); - gen_fcond(cpu_cond, a->cc, a->cond); + + gen_fcompare(&cmp, a->cc, a->cond); + if (cmp.is_bool) { + tcg_gen_mov_tl(cpu_cond, cmp.c1); + } else { + tcg_gen_setcond_tl(cmp.cond, cpu_cond, cmp.c1, cmp.c2); + } return advance_jump_cond(dc, a->a, target); } } From patchwork Sun Oct 22 05:59: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: 736933 Delivered-To: patch@linaro.org Received: by 2002:adf:dd81:0:b0:32d:baff:b0ca with SMTP id x1csp1003587wrl; Sat, 21 Oct 2023 23:03:44 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFKqyGSSBhchg5KzWu2xtAuvoFlUpHJ5sFJZxydyLgeazUZZ5IzMJ/usb6XVo6oKzQklPQw X-Received: by 2002:a05:6358:3413:b0:142:fd2b:da2e with SMTP id h19-20020a056358341300b00142fd2bda2emr7088422rwd.31.1697954624101; Sat, 21 Oct 2023 23:03:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697954624; cv=none; d=google.com; s=arc-20160816; b=jseE7DyAfzYQj5bBYLElwKeDHQ+4AIDTcEDiretioa7k8nyjkjkah3JPE7cKWWTQfn Q2YW4VukdhsEgrNDD+nWqqx7N6PJ/A5pyAdM716OZzoC3euK22+mwkoKdcoTz1KuLxG3 yQ12PAjWIlpthKFTzbjwCoblqW5vgkMH4LPcvGnvfW6Zr4lkaCWToUD1tSSJToY9aqYY zt+YOUtJlBfNvohrIvlpAR74zb0jl7kE5QUO1khW3dVFtT0s4nRLtqrv27LXT+xL/gE9 2ZWbajk2A8v3IitZzGWVCk0wtYg6CosAUe9VIllRYxL613tMjIPWOQkVhwLJ10upH9C4 CLUQ== 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=0bRQOnevKS41xkhrVOREUbtHjCWnHr38sXTFU/ZrPKc=; fh=TYrED6TOMxGX0VC4GtjviASLbYyJe19+7/tKWjN44KQ=; b=gy1329hZcid+eK7yvF6tXqB64okSX9lzvH9zk3jUSXw9zR1oSN+UlG0lSUpZ5RtoaO BconjnOGz6j0HCQmaTuJs/IeX3OEvJh5NziHIs4GxU7i5aUEcFy81BDOQUfrEHNG+Vid JC9eDaLMoPN6Qxl9MNvMFfJw2oBbBh/7Fb+sZS01cz9iM4uo7b7qEVaidIWu5YThvExs 6ncPV9ehV17dOYMxwiQEs1HA+Ah760qFZuEChXUlT9ZSXgAVImYWxWe6lvIsrEnG99uH JhX//jN+ps01EPwOs9AVxsgjLyeUtmj9B4xO+u9nCjPm8w2OLq4WxPslXuH9gk0j389+ Su3w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="j8k/Gltn"; 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 v8-20020ac85788000000b00418079720b3si3841260qta.533.2023.10.21.23.03.43 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sat, 21 Oct 2023 23:03:44 -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="j8k/Gltn"; 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 1quRWS-0000fV-Kk; Sun, 22 Oct 2023 02:01:12 -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 1quRWA-0000Zs-RR for qemu-devel@nongnu.org; Sun, 22 Oct 2023 02:00:56 -0400 Received: from mail-pj1-x1034.google.com ([2607:f8b0:4864:20::1034]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1quRW5-0001Yg-2A for qemu-devel@nongnu.org; Sun, 22 Oct 2023 02:00:54 -0400 Received: by mail-pj1-x1034.google.com with SMTP id 98e67ed59e1d1-27d425a2dd0so1924618a91.2 for ; Sat, 21 Oct 2023 23:00:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1697954447; x=1698559247; 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=0bRQOnevKS41xkhrVOREUbtHjCWnHr38sXTFU/ZrPKc=; b=j8k/Gltnrx18Xh52I+JBx9eKFY+lRW7bs47IhTRNYbbs2NHkXRt1ESydxxMwhmZnOr Ldc0l2o2Kxfaz9F8RC6gWmN0Vm1eGDsFgfvsIdWFWQ4gSN7SNORva9hcdiHV8iwOvhf5 5WYc0H2kgz/JJqKnazl9TZgvGPhhUpYM83SVih7eaGbNF/wffjvdb5YiVXlbJB9rzl3F u419aKx4XlpduMdJNTzWyLHJcIVhBomXrT8It6jR5+5CFvbuOhTpVn4OQVKuCJfwRsry Sojfa+pZ8kw9JvK36PuGrBaGikACGUteJsVt4rFOhPi5ICFdeeDBSXyLUjtCY3Zo4uoC 5yDg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697954447; x=1698559247; 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=0bRQOnevKS41xkhrVOREUbtHjCWnHr38sXTFU/ZrPKc=; b=mC4L71ZDgzsykNwgKhBaJUrD0KsVitGwAstiU01JHF+tJohkau206Kvo2Uoyt59YIp LAq+rHDom+XRtVM3wvcWDL/I+P8qo1zOTCGlx9k7oF7dgkY4BHjK4Nq3tVWal0hScO+3 ie3MvWWwfn646aR0GOWC0Cpa1BYPX9UP9peQgbB+0PuYejKxFr2aTBYph/pgXUGsYaAp WgOw9ctg9kByiOuoQvHefFH+U3589CnXEx/nCIcn2saaJ7dDdZEoM1P6cq6imDeyX8gj YzD3hfGw8icKGfhvVRTnaGjBek1bV53Z2lIUNncuAikO7VEGERXopVJxsv038EvxZZAi avEQ== X-Gm-Message-State: AOJu0YzYaotnK2WdHB2dPcOYPpryXsR+gsrHqUyWS+Z5/84ZcY41Hw2t 3gbdc4lSbRDIa6m2m52u4ArcpjbZEafaD5TGRDc= X-Received: by 2002:a17:902:e5c3:b0:1c9:aac5:df1a with SMTP id u3-20020a170902e5c300b001c9aac5df1amr7403875plf.51.1697954447137; Sat, 21 Oct 2023 23:00:47 -0700 (PDT) Received: from stoup.. ([71.212.149.95]) by smtp.gmail.com with ESMTPSA id je17-20020a170903265100b001c728609574sm3999887plb.6.2023.10.21.23.00.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 21 Oct 2023 23:00:46 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: mark.cave-ayland@ilande.co.uk Subject: [PATCH v4 17/90] target/sparc: Merge gen_branch_[an] with only caller Date: Sat, 21 Oct 2023 22:59:18 -0700 Message-Id: <20231022060031.490251-18-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231022060031.490251-1-richard.henderson@linaro.org> References: <20231022060031.490251-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::1034; envelope-from=richard.henderson@linaro.org; helo=mail-pj1-x1034.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/translate.c | 73 +++++++++++++++++----------------------- 1 file changed, 30 insertions(+), 43 deletions(-) diff --git a/target/sparc/translate.c b/target/sparc/translate.c index b8d51d6d64..503598ed93 100644 --- a/target/sparc/translate.c +++ b/target/sparc/translate.c @@ -900,47 +900,6 @@ static void gen_branch2(DisasContext *dc, target_ulong pc1, gen_goto_tb(dc, 1, pc2, pc2 + 4); } -static void gen_branch_a(DisasContext *dc, target_ulong pc1) -{ - TCGLabel *l1 = gen_new_label(); - target_ulong npc = dc->npc; - - tcg_gen_brcondi_tl(TCG_COND_EQ, cpu_cond, 0, l1); - - gen_goto_tb(dc, 0, npc, pc1); - - gen_set_label(l1); - gen_goto_tb(dc, 1, npc + 4, npc + 8); - - dc->base.is_jmp = DISAS_NORETURN; -} - -static void gen_branch_n(DisasContext *dc, target_ulong pc1) -{ - target_ulong npc = dc->npc; - - if (npc & 3) { - switch (npc) { - case DYNAMIC_PC: - case DYNAMIC_PC_LOOKUP: - tcg_gen_mov_tl(cpu_pc, cpu_npc); - tcg_gen_addi_tl(cpu_npc, cpu_npc, 4); - tcg_gen_movcond_tl(TCG_COND_NE, cpu_npc, - cpu_cond, tcg_constant_tl(0), - tcg_constant_tl(pc1), cpu_npc); - dc->pc = npc; - break; - default: - g_assert_not_reached(); - } - } else { - dc->pc = npc; - dc->jump_pc[0] = pc1; - dc->jump_pc[1] = npc + 4; - dc->npc = JUMP_PC; - } -} - static void gen_generic_branch(DisasContext *dc) { TCGv npc0 = tcg_constant_tl(dc->jump_pc[0]); @@ -2942,10 +2901,38 @@ static bool advance_jump_uncond_always(DisasContext *dc, bool annul, static bool advance_jump_cond(DisasContext *dc, bool annul, target_ulong dest) { + target_ulong npc = dc->npc; + if (annul) { - gen_branch_a(dc, dest); + TCGLabel *l1 = gen_new_label(); + + tcg_gen_brcondi_tl(TCG_COND_EQ, cpu_cond, 0, l1); + gen_goto_tb(dc, 0, npc, dest); + gen_set_label(l1); + gen_goto_tb(dc, 1, npc + 4, npc + 8); + + dc->base.is_jmp = DISAS_NORETURN; } else { - gen_branch_n(dc, dest); + if (npc & 3) { + switch (npc) { + case DYNAMIC_PC: + case DYNAMIC_PC_LOOKUP: + tcg_gen_mov_tl(cpu_pc, cpu_npc); + tcg_gen_addi_tl(cpu_npc, cpu_npc, 4); + tcg_gen_movcond_tl(TCG_COND_NE, cpu_npc, + cpu_cond, tcg_constant_tl(0), + tcg_constant_tl(dest), cpu_npc); + dc->pc = npc; + break; + default: + g_assert_not_reached(); + } + } else { + dc->pc = npc; + dc->jump_pc[0] = dest; + dc->jump_pc[1] = npc + 4; + dc->npc = JUMP_PC; + } } return true; } From patchwork Sun Oct 22 05:59:19 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 736934 Delivered-To: patch@linaro.org Received: by 2002:adf:dd81:0:b0:32d:baff:b0ca with SMTP id x1csp1003734wrl; Sat, 21 Oct 2023 23:04:14 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFJReLYUef4j27Mvjm0jXZrafMMLoEmuyGU2jugwCJqm0ysM3qJ81aeOnML/TXMmnxQLTn7 X-Received: by 2002:ac8:5843:0:b0:41b:7738:a8cf with SMTP id h3-20020ac85843000000b0041b7738a8cfmr9004742qth.17.1697954654441; Sat, 21 Oct 2023 23:04:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697954654; cv=none; d=google.com; s=arc-20160816; b=hTb0N8AbmUGrPDbRDKaH8R5C1agVgLCp4rWoxSjtblsGYAwFRBjg/ybCQ9++NTODP9 Bpq0AGn0jlsbzSYjw6dLcoptKj7S4cYlgXrJbE/s6QYzq2fYtyambb7loJI7cBUcVuc7 Vw6rNhUobOsGj6a5ZfRcjbeI8j6DErgRLjmJWSGkdnM6CN1b+dxgmYjZCjnhf/sFP9Rm SrI+4cFR4+/uW3/SHXaRr0DFeHJNXHGTluy5fvoHxGaVC6Kb6jOU/jOvAxNRQqNIWaF4 LO+e+ZuSOydZHVrzzxEROfzWND5bKxY/V9CBi7KvAm93PUFD7LjGeIEAqcQ2f43cRZTw coQA== 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=Pe3uuotNEE/3RgpcgrZRfr0F8BaHUoNj59/qICwQLyk=; fh=TYrED6TOMxGX0VC4GtjviASLbYyJe19+7/tKWjN44KQ=; b=kAOP85LOpsJpCOGLew06+pNcWSuPjUESIziZ7CR8eKz5nmbSZfrBcltn96KUWWFsod XoT/gyScTae9K/SFZfl1YDjKV66tP7PjkMfkEf2AMCvS0z+5ItfV+EQ6OER/YOKOdyBI 8dv9PJxAZiNz1z0Xq3XmpXQ1LCn2YyMRDD8ijcDhZw17TF8hmMg9t5hohHFCGF7oUWUA f5KTw/kAJ0bIRGMohZilH7dcBLEgxZ5suuoUP91TV5ANN8pF01ji4DPQxWTDKcF0oTbz ylYzhbztIRjopz4gS8gAihim68K3NC7FbLv0PSGfpKB+PeConW6jX2cbhsnfWls+W1qR +lgA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=zm1Q7pHT; 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 j22-20020ac85c56000000b004199dd36307si3653533qtj.484.2023.10.21.23.04.14 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sat, 21 Oct 2023 23:04:14 -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=zm1Q7pHT; 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 1quRW7-0000ZD-UT; Sun, 22 Oct 2023 02:00:51 -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 1quRW6-0000Xr-MO for qemu-devel@nongnu.org; Sun, 22 Oct 2023 02:00:50 -0400 Received: from mail-oi1-x22b.google.com ([2607:f8b0:4864:20::22b]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1quRW5-0001Z0-1V for qemu-devel@nongnu.org; Sun, 22 Oct 2023 02:00:50 -0400 Received: by mail-oi1-x22b.google.com with SMTP id 5614622812f47-3b2ea7cc821so1666759b6e.1 for ; Sat, 21 Oct 2023 23:00:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1697954448; x=1698559248; 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=Pe3uuotNEE/3RgpcgrZRfr0F8BaHUoNj59/qICwQLyk=; b=zm1Q7pHT9rXmSo+W5bf99I1vq7NtEmq8gcKxd9JmyZef2yH4obToeTQ1tuJk44461r KGMc5RhgNV4bTOZPEHg+XhOvCRDlnqlkfcHUq5/FT/2O2lEH+TJ7z9hpBt3eOyH54/Rf PtD9uKPX3ZLQGtClMRU9E0AzGH1T4UASNTkT3LEx7naRtPvMSId6Iyf5BFr+4HQ+Y9Hy ELLcAxX4Xn4Q2W7twwUvwSx+Riymxx9JC/AAO5C5Ow3vZGwvTyQ6C1FC6quUD0sTzzou A49JZubfRAaAezmJT3dz7JzDIziWDfFPa49Ym8z7/bgpjYhaQC36vYb0QYDE7EltST2C K1ng== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697954448; x=1698559248; 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=Pe3uuotNEE/3RgpcgrZRfr0F8BaHUoNj59/qICwQLyk=; b=bR35FEov3/fpOtZ8Fs5ex+/sDwi07Nm6qVXvmYeawKhaCTKRhKFbGx+VLZd/vSkz/R nmV/yFzmz+Q6trqjF6fy91D2G0ew0Uo4FgxxkUmmM2TUoDp5lcNyps4njygDMcvKe0Hr feyiGUiIWaAo4mCoUhnG4a15VBjOCVuhsMiTGbJdc25fB6Qya0dXTCIVm+6HnLlOKbuZ 0iOr8fgKqVU1Y4OVGGH3mCYBaRDy2L4syXXXKu0jYeWP+qT1CGCFC8As5SOyFfi129nx sGKkwien8F91GvTHabx/KIn2MN7dtJKDIXFYGAqWOmk3SzabfWeTTkUb7rP/ZbFVe+3k c1Kw== X-Gm-Message-State: AOJu0Yxg2vO6eDHSYjoIVhtIVdE5NVf4lsKeC6yiJ4jcOOV0JU2CRWlN OMM+1+MS7FBnzmwxm1wBsbmFEIsomFfgOgJpzlQ= X-Received: by 2002:a05:6808:1990:b0:3a9:7634:23f9 with SMTP id bj16-20020a056808199000b003a9763423f9mr7066025oib.12.1697954447994; Sat, 21 Oct 2023 23:00:47 -0700 (PDT) Received: from stoup.. ([71.212.149.95]) by smtp.gmail.com with ESMTPSA id je17-20020a170903265100b001c728609574sm3999887plb.6.2023.10.21.23.00.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 21 Oct 2023 23:00:47 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: mark.cave-ayland@ilande.co.uk Subject: [PATCH v4 18/90] target/sparc: Pass DisasCompare to advance_jump_cond Date: Sat, 21 Oct 2023 22:59:19 -0700 Message-Id: <20231022060031.490251-19-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231022060031.490251-1-richard.henderson@linaro.org> References: <20231022060031.490251-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::22b; envelope-from=richard.henderson@linaro.org; helo=mail-oi1-x22b.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 Fold the condition into the branch or movcond when possible. Signed-off-by: Richard Henderson --- target/sparc/translate.c | 31 +++++++++++++------------------ 1 file changed, 13 insertions(+), 18 deletions(-) diff --git a/target/sparc/translate.c b/target/sparc/translate.c index 503598ed93..d12f2b4b87 100644 --- a/target/sparc/translate.c +++ b/target/sparc/translate.c @@ -2899,14 +2899,15 @@ static bool advance_jump_uncond_always(DisasContext *dc, bool annul, return true; } -static bool advance_jump_cond(DisasContext *dc, bool annul, target_ulong dest) +static bool advance_jump_cond(DisasContext *dc, DisasCompare *cmp, + bool annul, target_ulong dest) { target_ulong npc = dc->npc; if (annul) { TCGLabel *l1 = gen_new_label(); - tcg_gen_brcondi_tl(TCG_COND_EQ, cpu_cond, 0, l1); + tcg_gen_brcond_tl(tcg_invert_cond(cmp->cond), cmp->c1, cmp->c2, l1); gen_goto_tb(dc, 0, npc, dest); gen_set_label(l1); gen_goto_tb(dc, 1, npc + 4, npc + 8); @@ -2919,8 +2920,8 @@ static bool advance_jump_cond(DisasContext *dc, bool annul, target_ulong dest) case DYNAMIC_PC_LOOKUP: tcg_gen_mov_tl(cpu_pc, cpu_npc); tcg_gen_addi_tl(cpu_npc, cpu_npc, 4); - tcg_gen_movcond_tl(TCG_COND_NE, cpu_npc, - cpu_cond, tcg_constant_tl(0), + tcg_gen_movcond_tl(cmp->cond, cpu_npc, + cmp->c1, cmp->c2, tcg_constant_tl(dest), cpu_npc); dc->pc = npc; break; @@ -2932,6 +2933,11 @@ static bool advance_jump_cond(DisasContext *dc, bool annul, target_ulong dest) dc->jump_pc[0] = dest; dc->jump_pc[1] = npc + 4; dc->npc = JUMP_PC; + if (cmp->is_bool) { + tcg_gen_mov_tl(cpu_cond, cmp->c1); + } else { + tcg_gen_setcond_tl(cmp->cond, cpu_cond, cmp->c1, cmp->c2); + } } } return true; @@ -2951,12 +2957,7 @@ static bool do_bpcc(DisasContext *dc, arg_bcc *a) flush_cond(dc); gen_compare(&cmp, a->cc, a->cond, dc); - if (cmp.is_bool) { - tcg_gen_mov_tl(cpu_cond, cmp.c1); - } else { - tcg_gen_setcond_tl(cmp.cond, cpu_cond, cmp.c1, cmp.c2); - } - return advance_jump_cond(dc, a->a, target); + return advance_jump_cond(dc, &cmp, a->a, target); } } @@ -2980,12 +2981,7 @@ static bool do_fbpfcc(DisasContext *dc, arg_bcc *a) flush_cond(dc); gen_fcompare(&cmp, a->cc, a->cond); - if (cmp.is_bool) { - tcg_gen_mov_tl(cpu_cond, cmp.c1); - } else { - tcg_gen_setcond_tl(cmp.cond, cpu_cond, cmp.c1, cmp.c2); - } - return advance_jump_cond(dc, a->a, target); + return advance_jump_cond(dc, &cmp, a->a, target); } } @@ -3006,8 +3002,7 @@ static bool trans_BPr(DisasContext *dc, arg_BPr *a) flush_cond(dc); gen_compare_reg(&cmp, a->cond, gen_load_gpr(dc, a->rs1)); - tcg_gen_setcond_tl(cmp.cond, cpu_cond, cmp.c1, cmp.c2); - return advance_jump_cond(dc, a->a, target); + return advance_jump_cond(dc, &cmp, a->a, target); } static bool trans_CALL(DisasContext *dc, arg_CALL *a) From patchwork Sun Oct 22 05:59:20 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 736925 Delivered-To: patch@linaro.org Received: by 2002:adf:dd81:0:b0:32d:baff:b0ca with SMTP id x1csp1003008wrl; Sat, 21 Oct 2023 23:01:44 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEqdMzZNW+ScUzC4gl9Nr+xeqRsvUrY31IywyRjWPEF3u2ewXt3qqa7ftM/goRiQ/NCdIP4 X-Received: by 2002:ac8:5750:0:b0:41c:e460:83ef with SMTP id 16-20020ac85750000000b0041ce46083efmr4568060qtx.65.1697954503834; Sat, 21 Oct 2023 23:01:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697954503; cv=none; d=google.com; s=arc-20160816; b=W7lbRVkYcjwPqZmZQo4rKcduFA2FYzp/5E7wlkSJHGwmt8pt9jN2zcwXc4hsbqLl18 rQVMMJjkjpBQdYIfiVEH0RJLlArx84mTThj3trZ/6rK++PPY0YXeJRdkjQYDsHuIm7rd 0MZq2CtpR/oLK2if0Xqg8+gV+kXZeGexu3Fwl1dz7T+KpvDoC92zqHkx9cM+Khw+lNKB tRXokNEejiQgPXfN1R61AEUNwfyYCVXOThjR1Fmy/AxCIUuoCuLMPLlNEZI1sraTBlTQ 0iXEN4wU2EXmmtCswegtHa9m49DOlFExJXtNZypye7RirXyjfv1GNhl4U5VQjl5S7MN6 oS+Q== 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=lzvcZe31/ZJG4v0X6So+um8Fp3Qd2Uum0t8sUDXqISw=; fh=TYrED6TOMxGX0VC4GtjviASLbYyJe19+7/tKWjN44KQ=; b=d2xVcNuUdKoG7koEQ4CPTju19/dgveW34eU9oSp3s0G00m2V6LTeFKyGKob1lOnoOM hftswJKkc0E9uHkeoMmjoVMPllOyHxWccH6bwh3swvs7d65e0sNlF5Cce+PfTtjrEiQq rc/P5zR/HcO8gg2A8y7FOECoa3PFKE0LkMlUhQv1P+EMqi8O+pIgwI2eR67x1Vz4rgbV kjPSrSeAfFfyDG02DvSsZVGxaZvO/KCOEU1dSBLQEwD26wcfD8YyNSokGMHWMHk66asp TJExhvuYgANDHl8zd6IHXT88Em9ld2LAiCe0MrOvSzbRSlcdSTfi4rRC+zkoORYYM4Vr maCQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=RsUzBz2F; 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 n21-20020a05622a11d500b00403fbb9a8a5si3568271qtk.269.2023.10.21.23.01.43 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sat, 21 Oct 2023 23:01:43 -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=RsUzBz2F; 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 1quRW9-0000Zf-S4; Sun, 22 Oct 2023 02:00:55 -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 1quRW7-0000ZF-VB for qemu-devel@nongnu.org; Sun, 22 Oct 2023 02:00:51 -0400 Received: from mail-oi1-x22e.google.com ([2607:f8b0:4864:20::22e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1quRW6-0001ZI-AB for qemu-devel@nongnu.org; Sun, 22 Oct 2023 02:00:51 -0400 Received: by mail-oi1-x22e.google.com with SMTP id 5614622812f47-3b2ea7cca04so1666161b6e.2 for ; Sat, 21 Oct 2023 23:00:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1697954449; x=1698559249; 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=lzvcZe31/ZJG4v0X6So+um8Fp3Qd2Uum0t8sUDXqISw=; b=RsUzBz2Ff73UXvVsmHgKRhskMz0jtH86ikcLh4K2qG7TUEot931YrBEl7WuLmfoEt4 /LtfkBjnTchRRJe+b/QenMDJ20Qz80l+PFo0d9a+S0/qdO4vZznv+ugF+c38EPVJwUWD Q4VzkWGeH/opR4o0St+ADvdFsx+f32JHlqWsRGdsCG80YsZeWGgMhU14k57Z4poIKhl9 2KjxYg618Hc3YD3iYm1a1lrLwatYcxzkpZPvjd+VgbJkGE5od3i2xgI+c9M0QFyLYjPA 5e8vIabUR7NM5iPRZcH8Z4BIJx/810Mic33BADgOLTekf6mxB0kkZEi9RjmlPBZmoAvq X43w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697954449; x=1698559249; 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=lzvcZe31/ZJG4v0X6So+um8Fp3Qd2Uum0t8sUDXqISw=; b=XTbDgD/8qBBeFgF3IvqL6LtNfA/F/CdztP2KRPrGocExkAIUesMvyeEm2iM989VPJa vujQEcn/WZtG/59AjWyrgpOgaGoS8uIIA+kVDRnH0OuDNzKgfDvUsGc+jmMnGBMZAn7I zPBsyJjt2KPFuP42MrtuWQ6ngDc7yUjnL4ydG0UEBFue6FnfWgCrv9toIbqoKTPb2vQW m95qs4sHpfzRRLCgq919JSuBIkiCtZYP9LMKtOWjyOfbrtwHG9m7si8ribjT9wc9Q/49 Tl14bvWjYGetlJ/k2BOnIxpv/LdRP61Erh2K3oeAE1wEJo8duh3hNeGnR/BAFOD8Chx4 pH5w== X-Gm-Message-State: AOJu0YxazHzRQYkIOLf2qHuYtSCgJLO71eTGvXqlaZKUZHgmUkBvnAOb rLZJjBXuX4Mi5V9ysLlG+vkqus63/44ODZXHz4c= X-Received: by 2002:a05:6808:1818:b0:3b2:e60d:27f6 with SMTP id bh24-20020a056808181800b003b2e60d27f6mr7704571oib.29.1697954448958; Sat, 21 Oct 2023 23:00:48 -0700 (PDT) Received: from stoup.. ([71.212.149.95]) by smtp.gmail.com with ESMTPSA id je17-20020a170903265100b001c728609574sm3999887plb.6.2023.10.21.23.00.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 21 Oct 2023 23:00:48 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: mark.cave-ayland@ilande.co.uk Subject: [PATCH v4 19/90] target/sparc: Move SETHI to decodetree Date: Sat, 21 Oct 2023 22:59:20 -0700 Message-Id: <20231022060031.490251-20-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231022060031.490251-1-richard.henderson@linaro.org> References: <20231022060031.490251-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::22e; envelope-from=richard.henderson@linaro.org; helo=mail-oi1-x22e.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 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 */ From patchwork Sun Oct 22 05:59:21 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 736932 Delivered-To: patch@linaro.org Received: by 2002:adf:dd81:0:b0:32d:baff:b0ca with SMTP id x1csp1003558wrl; Sat, 21 Oct 2023 23:03:37 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGeg/uQBKW4sw0EA7IoGGZp8fJuIf0InFyfNNvcPrey66NtwTtJDhgxvXwYsRSQzDM2zaE+ X-Received: by 2002:ac8:5dce:0:b0:41b:a41e:3abe with SMTP id e14-20020ac85dce000000b0041ba41e3abemr7467355qtx.46.1697954616995; Sat, 21 Oct 2023 23:03:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697954616; cv=none; d=google.com; s=arc-20160816; b=gfeyg/Jqj3a0XSib+8tFyx2K51oLMu8YK2a7+r1ImOMcGAa2UOSLhnRgxdutIa88by 1o/WhMABnFCxfgoHSSf56ePF81PmahJyUpeeVkNFAVO0Kt94XnEueCBaQXs1SlY5/D7c fr7sUg7kQu8vPEF7lb5RY6SZUQhxpFoyuEjz94LY4NfxF6r+Vi9Gd9kF3jKOIfVlvUMO DWB9+yqHUKgoaVk09C9sDr0s+3vpoG8b3PHo0C04dexR19UqIlP7zldLoP2uDfsB63Pe APdZ4FGGRD5G9X0v2YQ2iuApy8ElC7XzQ0Z9xafXguSCbmCEC+vakRAVRjNWbDpuZJzk oUfA== 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=EbSPVPuDQiKGoqEnGbeajJk8ZUJL4rxZ/KqPb7KMDCI=; fh=TYrED6TOMxGX0VC4GtjviASLbYyJe19+7/tKWjN44KQ=; b=w2jshCCTuXO48bdQdTK2eU14Rqs92A6TyMBS0D7OE4j5FYYNWbehV8pYSZAqABB3DQ nTCtzNnV9F5zBAIOpVnq3Mct4gmpa8zUXFlAgE5vx1DJ3PnNXGOhfZFbMA6QOf7YUDBq W807HG4j38JewO7cuWoqADIcUwW54Wvi9MPui7KPDCYn614zJQEDiBJdBGQuV3xU5RvD yNN32lwucwy9sdObNUbO0/IhTb8k2vBvBDbz/xdNhoGYHsA8BdY8Zl80tGO+rtddfz7Z uTI07DG4UTnNBVS2+KsaPJWcPnPuJAIIrlgkZEqORBfrvf0H7giwSifUEQHW6/tSOmz2 pyRQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="O/JSJ1Xz"; 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 14-20020ac8574e000000b004199342839dsi3746750qtx.234.2023.10.21.23.03.36 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sat, 21 Oct 2023 23:03:36 -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="O/JSJ1Xz"; 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 1quRWM-0000cW-Ph; Sun, 22 Oct 2023 02:01:06 -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 1quRW9-0000Zo-Vx for qemu-devel@nongnu.org; Sun, 22 Oct 2023 02:00:55 -0400 Received: from mail-pf1-x42b.google.com ([2607:f8b0:4864:20::42b]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1quRW8-0001Za-2M for qemu-devel@nongnu.org; Sun, 22 Oct 2023 02:00:53 -0400 Received: by mail-pf1-x42b.google.com with SMTP id d2e1a72fcca58-6be0277c05bso1674874b3a.0 for ; Sat, 21 Oct 2023 23:00:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1697954450; x=1698559250; 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=EbSPVPuDQiKGoqEnGbeajJk8ZUJL4rxZ/KqPb7KMDCI=; b=O/JSJ1XzHIwP4qJPOTal/bQF1AUwtvGM/NASkvv9y76k+LbjqX5bjz9W4BMWbvl0fl 1kMg0jgf8WQQkB+5d6zk7qHs6c5xiGCypNQeX3kQxcd9nSeaTxSYAb9h8zE/JlXLr+ho 1Zoxg/SLoGM/oZjzeHiIkNgVyJi0SineDQhJd63VwtjEUghXWMQLIZ/GF6naGysLiSp2 XsSlL4UTkaeEt0MI8/wC+3hmAmZVeSZH6OIdjAGSjlQerk+jKMu9cCa3nuAO2Io5If7e CdgS26Ya6MktDmlnjgsR6zuM1nKXaazUq/ysSHfmVVrQAVOpgz8yax7RxWLaDFK5GA/R OOrg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697954450; x=1698559250; 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=EbSPVPuDQiKGoqEnGbeajJk8ZUJL4rxZ/KqPb7KMDCI=; b=fKedFL+lQSlwvPOR5g+Oc+LkSp1WxoWwRnBXOIU6NEViNXVBht90qght2uKdkTvUqQ CrrCGOWEvIO/nsGWwB4UKYhMvcQJ/ZcmaG41V4dj+yrl4yZkIYjb66SYnpCobgIinQfC 7BU+fUBoAMFuYg92oDEpJMRK88AC9zpS5t7BrQ8yFrlKEtkT3uQR3ZuR4ormlM9RuFJs 5UWlkPB2po1gowkS/4WQ+uK78jZN4tArQWhw8Qhm4bugNCuw7ELudkkiZRi8IVKiD72E 3UEV5lpfvnbn4e2bnaj3OStv1ArcQhobZOFkvaKEaZBnAJkJYFEXLTfol1EmaCofZK3I RYFA== X-Gm-Message-State: AOJu0YwdsKyRFC9VzjkP4940emunvFJZQR9hkSGZ00Hyq2OrULUfOF4F 44THfc4MqpWsIqNJZBKY01a7nI5cMvLwb0jVkCA= X-Received: by 2002:a17:903:1383:b0:1ca:4681:eb37 with SMTP id jx3-20020a170903138300b001ca4681eb37mr4539267plb.14.1697954449689; Sat, 21 Oct 2023 23:00:49 -0700 (PDT) Received: from stoup.. ([71.212.149.95]) by smtp.gmail.com with ESMTPSA id je17-20020a170903265100b001c728609574sm3999887plb.6.2023.10.21.23.00.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 21 Oct 2023 23:00:49 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: mark.cave-ayland@ilande.co.uk Subject: [PATCH v4 20/90] target/sparc: Move Tcc to decodetree Date: Sat, 21 Oct 2023 22:59:21 -0700 Message-Id: <20231022060031.490251-21-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231022060031.490251-1-richard.henderson@linaro.org> References: <20231022060031.490251-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::42b; envelope-from=richard.henderson@linaro.org; helo=mail-pf1-x42b.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 Use the new delay_exceptionv function in the implementation. Signed-off-by: Richard Henderson --- target/sparc/insns.decode | 13 ++++ target/sparc/translate.c | 155 +++++++++++++++++++------------------- 2 files changed, 89 insertions(+), 79 deletions(-) diff --git a/target/sparc/insns.decode b/target/sparc/insns.decode index f6f5401b10..0517f5591b 100644 --- a/target/sparc/insns.decode +++ b/target/sparc/insns.decode @@ -21,3 +21,16 @@ NCP 00 - ---- 111 ---------------------- # CBcc SETHI 00 rd:5 100 i:22 CALL 01 i:s30 + +Tcc_r 10 0 cond:4 111010 rs1:5 0 cc:1 0000000 rs2:5 +{ + # For v7, the entire simm13 field is present, but masked to 7 bits. + # For v8, [12:7] are reserved. However, a compatibility note for + # the Tcc insn in the v9 manual suggests that the v8 reserved field + # was ignored and did not produce traps. + Tcc_i_v7 10 0 cond:4 111010 rs1:5 1 ------ i:7 + + # For v9, bits [12:11] are cc1 and cc0 (and cc0 must be 0). + # Bits [10:8] are reserved and the OSA2011 manual says they must be 0. + Tcc_i_v9 10 0 cond:4 111010 rs1:5 1 cc:1 0 000 i:8 +} diff --git a/target/sparc/translate.c b/target/sparc/translate.c index cdd929282a..b927b212ca 100644 --- a/target/sparc/translate.c +++ b/target/sparc/translate.c @@ -3042,6 +3042,81 @@ static bool trans_SETHI(DisasContext *dc, arg_SETHI *a) return advance_pc(dc); } +static bool do_tcc(DisasContext *dc, int cond, int cc, + int rs1, bool imm, int rs2_or_imm) +{ + int mask = ((dc->def->features & CPU_FEATURE_HYPV) && supervisor(dc) + ? UA2005_HTRAP_MASK : V8_TRAP_MASK); + DisasCompare cmp; + TCGLabel *lab; + TCGv_i32 trap; + + /* Trap never. */ + if (cond == 0) { + return advance_pc(dc); + } + + /* + * Immediate traps are the most common case. Since this value is + * live across the branch, it really pays to evaluate the constant. + */ + if (rs1 == 0 && (imm || rs2_or_imm == 0)) { + trap = tcg_constant_i32((rs2_or_imm & mask) + TT_TRAP); + } else { + trap = tcg_temp_new_i32(); + tcg_gen_trunc_tl_i32(trap, gen_load_gpr(dc, rs1)); + if (imm) { + tcg_gen_addi_i32(trap, trap, rs2_or_imm); + } else { + TCGv_i32 t2 = tcg_temp_new_i32(); + tcg_gen_trunc_tl_i32(t2, gen_load_gpr(dc, rs2_or_imm)); + tcg_gen_add_i32(trap, trap, t2); + } + tcg_gen_andi_i32(trap, trap, mask); + tcg_gen_addi_i32(trap, trap, TT_TRAP); + } + + /* Trap always. */ + if (cond == 8) { + save_state(dc); + gen_helper_raise_exception(tcg_env, trap); + dc->base.is_jmp = DISAS_NORETURN; + return true; + } + + /* Conditional trap. */ + flush_cond(dc); + lab = delay_exceptionv(dc, trap); + gen_compare(&cmp, cc, cond, dc); + tcg_gen_brcond_tl(cmp.cond, cmp.c1, cmp.c2, lab); + + return advance_pc(dc); +} + +static bool trans_Tcc_r(DisasContext *dc, arg_Tcc_r *a) +{ + if (avail_32(dc) && a->cc) { + return false; + } + return do_tcc(dc, a->cond, a->cc, a->rs1, false, a->rs2); +} + +static bool trans_Tcc_i_v7(DisasContext *dc, arg_Tcc_i_v7 *a) +{ + if (avail_64(dc)) { + return false; + } + return do_tcc(dc, a->cond, 0, a->rs1, true, a->i); +} + +static bool trans_Tcc_i_v9(DisasContext *dc, arg_Tcc_i_v9 *a) +{ + if (avail_32(dc)) { + return false; + } + return do_tcc(dc, a->cond, a->cc, a->rs1, true, a->i); +} + #define CHECK_IU_FEATURE(dc, FEATURE) \ if (!((dc)->def->features & CPU_FEATURE_ ## FEATURE)) \ goto illegal_insn; @@ -3072,85 +3147,7 @@ static void disas_sparc_legacy(DisasContext *dc, unsigned int insn) TCGv cpu_dst = tcg_temp_new(); TCGv cpu_tmp0; - if (xop == 0x3a) { /* generate trap */ - int cond = GET_FIELD(insn, 3, 6); - TCGv_i32 trap; - TCGLabel *l1 = NULL; - int mask; - - if (cond == 0) { - /* Trap never. */ - break; - } - - save_state(dc); - - if (cond != 8) { - /* Conditional trap. */ - DisasCompare cmp; -#ifdef TARGET_SPARC64 - /* V9 icc/xcc */ - int cc = GET_FIELD_SP(insn, 11, 12); - if (cc == 0) { - gen_compare(&cmp, 0, cond, dc); - } else if (cc == 2) { - gen_compare(&cmp, 1, cond, dc); - } else { - goto illegal_insn; - } -#else - gen_compare(&cmp, 0, cond, dc); -#endif - l1 = gen_new_label(); - tcg_gen_brcond_tl(tcg_invert_cond(cmp.cond), - cmp.c1, cmp.c2, l1); - } - - mask = ((dc->def->features & CPU_FEATURE_HYPV) && supervisor(dc) - ? UA2005_HTRAP_MASK : V8_TRAP_MASK); - - /* Don't use the normal temporaries, as they may well have - gone out of scope with the branch above. While we're - doing that we might as well pre-truncate to 32-bit. */ - trap = tcg_temp_new_i32(); - - rs1 = GET_FIELD_SP(insn, 14, 18); - if (IS_IMM) { - rs2 = GET_FIELD_SP(insn, 0, 7); - if (rs1 == 0) { - tcg_gen_movi_i32(trap, (rs2 & mask) + TT_TRAP); - /* Signal that the trap value is fully constant. */ - mask = 0; - } else { - TCGv t1 = gen_load_gpr(dc, rs1); - tcg_gen_trunc_tl_i32(trap, t1); - tcg_gen_addi_i32(trap, trap, rs2); - } - } else { - TCGv t1, t2; - rs2 = GET_FIELD_SP(insn, 0, 4); - t1 = gen_load_gpr(dc, rs1); - t2 = gen_load_gpr(dc, rs2); - tcg_gen_add_tl(t1, t1, t2); - tcg_gen_trunc_tl_i32(trap, t1); - } - if (mask != 0) { - tcg_gen_andi_i32(trap, trap, mask); - tcg_gen_addi_i32(trap, trap, TT_TRAP); - } - - gen_helper_raise_exception(tcg_env, trap); - - if (cond == 8) { - /* An unconditional trap ends the TB. */ - dc->base.is_jmp = DISAS_NORETURN; - goto jmp_insn; - } else { - /* A conditional trap falls through to the next insn. */ - gen_set_label(l1); - break; - } - } else if (xop == 0x28) { + if (xop == 0x28) { rs1 = GET_FIELD(insn, 13, 17); switch(rs1) { case 0: /* rdy */ From patchwork Sun Oct 22 05:59:22 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 736998 Delivered-To: patch@linaro.org Received: by 2002:adf:dd81:0:b0:32d:baff:b0ca with SMTP id x1csp1006326wrl; Sat, 21 Oct 2023 23:14:42 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHanq0CyfnhfOaMRiJgy7qfg7zwnirBa91xweu47VRyZ+oCDgwbzWwTFO4qTfdnoiGa1sZl X-Received: by 2002:a05:620a:29d0:b0:774:2afe:97c4 with SMTP id s16-20020a05620a29d000b007742afe97c4mr12681159qkp.12.1697955282619; Sat, 21 Oct 2023 23:14:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697955282; cv=none; d=google.com; s=arc-20160816; b=OrOgjV4vHG1fG9LjLnAm6UpySd474a74MjzY420xya/Ike1BiaTHqzvh2vUxBaaCjP dY/g3QVQldQtA12+dMCqpOaOF2vaV4U9J/OtfU11mXIB+F8XGIDnewDzGDkByMNxhton Yyoe8m/0YxXWfXAu0RSpcrJ9omaFed39gsyChYryUCjSXuw66eUBiI7voZx21n3nekn3 zRs4b1FwK3tY/8Q0a1nMlY2Vls0DPtdOoFQVtWy8BRdcSFbt+RHz8K3r5f6rdO+1/wbY nrP5DdDrNLX2wg1lIkZ1kABdg78o2o7WprJ8ASBktGLy3N/dgYNFwS1qKfBKq/PVt9go Tvpw== 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=SYui5Z+hN2H9IbD7YKlzn0y1X8WgsYJTBZ/CqbykJKk=; fh=TYrED6TOMxGX0VC4GtjviASLbYyJe19+7/tKWjN44KQ=; b=dWEChxRjNrZeLkHePsFNjFAItHbORsUKyNVhFUw4aKwIsOxkvgsTMF1Ec3ENZG0xA+ Q19sPVGoG1oQeM4w8UHXXRjnjzPhfohpdK0MEFlD6nFoNKt/V3KouwPLuf1qCEnANIx6 FL7tC1ClPC1VzsOa7rleJPS9ctWMitvuJkZw0kAr6YyxG/B4FizMmQt3clCKjn3um0cr cfe5xMsSZJMzSVO7NNMQqBYxvihxNoKd5kFjkN5m4rwXFnrGT13nNO9tNlLE4e5G60Qt OHQ8Ze4/aBynp/PqGZy91kwmE6Qns1HRe/tExkUxBj3M8nk7wCMf+Vd39kcZw5iQd08l 2gnQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=QLBd12CS; 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 x10-20020a05620a448a00b00767156771d4si1369761qkp.513.2023.10.21.23.14.42 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sat, 21 Oct 2023 23:14:42 -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=QLBd12CS; 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 1quRWR-0000eV-1E; Sun, 22 Oct 2023 02:01:11 -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 1quRWC-0000Zz-0Q for qemu-devel@nongnu.org; Sun, 22 Oct 2023 02:00:56 -0400 Received: from mail-pg1-x534.google.com ([2607:f8b0:4864:20::534]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1quRW8-0001Zn-SB for qemu-devel@nongnu.org; Sun, 22 Oct 2023 02:00:55 -0400 Received: by mail-pg1-x534.google.com with SMTP id 41be03b00d2f7-577fff1cae6so1483519a12.1 for ; Sat, 21 Oct 2023 23:00:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1697954450; x=1698559250; 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=SYui5Z+hN2H9IbD7YKlzn0y1X8WgsYJTBZ/CqbykJKk=; b=QLBd12CSylqUtK6Z0SgMqKC9evfTrh+cvILQpqhiIL7VJp7Msx4SqH5y8rDnzTbv3+ cGojqq7sXqcuw8imZz9l2fLX4wO7mO/e1rgI6GECRmlM+OucL8QR6dBbq6SEvMK4Jjml HnOYWxPuSVqZOoyinsLKV3baASNqOdAHMjzSG6Ynx8xjmankmyy0znEx+M81JmMsVpLa ApVoWUI+0ljOZM5c4iMrCirYj17AQV7MVNi2U6SjKs900y1Bf2fD6hjzEOwa7ISxVdPq vFTL/m2CSuclpgxAkStVLALE+EmaJFIDCzUDoMzekahO+0K7YLpLVR/1YIL/HglRpNMQ QXjA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697954450; x=1698559250; 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=SYui5Z+hN2H9IbD7YKlzn0y1X8WgsYJTBZ/CqbykJKk=; b=q9LMd6/E5E6g2E+ZURlK3xZFWuIfF0hWIqGxa3pExCx77aDTF7hAlhOzvaTnBL4Yzp EbnvHWMRxf6bmbeXlIRKqfmyEpZBR1DqlXekY1XmPBL4S0dBm+ZrF4SSEWxzUYndnkcs //gPqJX08Hdr5Vjw2bpGIrDElkd9+wKRed42IyL2nT5BxBYnqGErnHek/GVMZnZtBZ1S HqBzRGrjJ4sMCDBvn3K6N6K9VIY1I1L+1sbUu8Ux4hnGH7h/TL5E/FoPJQ7TinRjWM1C PDpePtKMCThrVRnilmKttOhLIlQQinOUeUcJrFrwqYqjMy7d4pBylQJAMYe3ZDb+Eln8 iakA== X-Gm-Message-State: AOJu0Yz+RJe+FYj+an6ovC/WVpvnj8e69XUbuEY0jNI/OpxbL7i77aAZ gKieKdtcaFw9n5Q9jaQulUAEHV//rIVuJLgB9TE= X-Received: by 2002:a17:903:230b:b0:1ca:42b:f625 with SMTP id d11-20020a170903230b00b001ca042bf625mr8240443plh.3.1697954450427; Sat, 21 Oct 2023 23:00:50 -0700 (PDT) Received: from stoup.. ([71.212.149.95]) by smtp.gmail.com with ESMTPSA id je17-20020a170903265100b001c728609574sm3999887plb.6.2023.10.21.23.00.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 21 Oct 2023 23:00:50 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: mark.cave-ayland@ilande.co.uk Subject: [PATCH v4 21/90] target/sparc: Move RDASR, STBAR, MEMBAR to decodetree Date: Sat, 21 Oct 2023 22:59:22 -0700 Message-Id: <20231022060031.490251-22-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231022060031.490251-1-richard.henderson@linaro.org> References: <20231022060031.490251-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::534; envelope-from=richard.henderson@linaro.org; helo=mail-pg1-x534.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 | 22 +++ target/sparc/translate.c | 356 ++++++++++++++++++++++++-------------- 2 files changed, 249 insertions(+), 129 deletions(-) diff --git a/target/sparc/insns.decode b/target/sparc/insns.decode index 0517f5591b..1b084c5b97 100644 --- a/target/sparc/insns.decode +++ b/target/sparc/insns.decode @@ -22,6 +22,28 @@ SETHI 00 rd:5 100 i:22 CALL 01 i:s30 +{ + [ + STBAR 10 00000 101000 01111 0 0000000000000 + MEMBAR 10 00000 101000 01111 1 000000 cmask:3 mmask:4 + + RDCCR 10 rd:5 101000 00010 0 0000000000000 + RDASI 10 rd:5 101000 00011 0 0000000000000 + RDTICK 10 rd:5 101000 00100 0 0000000000000 + RDPC 10 rd:5 101000 00101 0 0000000000000 + RDFPRS 10 rd:5 101000 00110 0 0000000000000 + RDASR17 10 rd:5 101000 10001 0 0000000000000 + RDGSR 10 rd:5 101000 10011 0 0000000000000 + RDSOFTINT 10 rd:5 101000 10110 0 0000000000000 + RDTICK_CMPR 10 rd:5 101000 10111 0 0000000000000 + RDSTICK 10 rd:5 101000 11000 0 0000000000000 + RDSTICK_CMPR 10 rd:5 101000 11001 0 0000000000000 + RDSTRAND_STATUS 10 rd:5 101000 11010 0 0000000000000 + ] + # Before v8, all rs1 accepted; otherwise rs1==0. + RDY 10 rd:5 101000 rs1:5 0 0000000000000 +} + Tcc_r 10 0 cond:4 111010 rs1:5 0 cc:1 0000000 rs2:5 { # For v7, the entire simm13 field is present, but masked to 7 bits. diff --git a/target/sparc/translate.c b/target/sparc/translate.c index b927b212ca..81de714aa6 100644 --- a/target/sparc/translate.c +++ b/target/sparc/translate.c @@ -36,6 +36,10 @@ #include "exec/helper-info.c.inc" #undef HELPER_H +#ifndef TARGET_SPARC64 +#define gen_helper_rdccr(D, E) qemu_build_not_reached() +#endif + /* Dynamic PC, must exit to main loop. */ #define DYNAMIC_PC 1 /* Dynamic PC, one of two values according to jump_pc[T2]. */ @@ -2847,6 +2851,8 @@ static void gen_faligndata(TCGv dst, TCGv gsr, TCGv s1, TCGv s2) # define avail_32(C) true # define avail_64(C) false #endif +#define avail_ASR17(C) ((C)->def->features & CPU_FEATURE_ASR17) +#define avail_HYPV(C) ((C)->def->features & CPU_FEATURE_HYPV) /* Default case for non jump instructions. */ static bool advance_pc(DisasContext *dc) @@ -2947,6 +2953,12 @@ static bool advance_jump_cond(DisasContext *dc, DisasCompare *cmp, return true; } +static bool raise_priv(DisasContext *dc) +{ + gen_exception(dc, TT_PRIV_INSN); + return true; +} + static bool do_bpcc(DisasContext *dc, arg_bcc *a) { target_long target = address_mask_i(dc, dc->pc + a->i * 4); @@ -3117,6 +3129,211 @@ static bool trans_Tcc_i_v9(DisasContext *dc, arg_Tcc_i_v9 *a) return do_tcc(dc, a->cond, a->cc, a->rs1, true, a->i); } +static bool trans_STBAR(DisasContext *dc, arg_STBAR *a) +{ + tcg_gen_mb(TCG_MO_ST_ST | TCG_BAR_SC); + return advance_pc(dc); +} + +static bool trans_MEMBAR(DisasContext *dc, arg_MEMBAR *a) +{ + if (avail_32(dc)) { + return false; + } + if (a->mmask) { + /* Note TCG_MO_* was modeled on sparc64, so mmask matches. */ + tcg_gen_mb(a->mmask | TCG_BAR_SC); + } + if (a->cmask) { + /* For #Sync, etc, end the TB to recognize interrupts. */ + dc->base.is_jmp = DISAS_EXIT; + } + return advance_pc(dc); +} + +static bool do_rd_special(DisasContext *dc, bool priv, int rd, + TCGv (*func)(DisasContext *, TCGv)) +{ + if (!priv) { + return raise_priv(dc); + } + gen_store_gpr(dc, rd, func(dc, gen_dest_gpr(dc, rd))); + return advance_pc(dc); +} + +static TCGv do_rdy(DisasContext *dc, TCGv dst) +{ + return cpu_y; +} + +static bool trans_RDY(DisasContext *dc, arg_RDY *a) +{ + /* + * TODO: Need a feature bit for sparcv8. In the meantime, treat all + * 32-bit cpus like sparcv7, which ignores the rs1 field. + * This matches after all other ASR, so Leon3 Asr17 is handled first. + */ + if (avail_64(dc) && a->rs1 != 0) { + return false; + } + return do_rd_special(dc, true, a->rd, do_rdy); +} + +static TCGv do_rd_leon3_config(DisasContext *dc, TCGv dst) +{ + uint32_t val; + + /* + * TODO: There are many more fields to be filled, + * some of which are writable. + */ + val = dc->def->nwindows - 1; /* [4:0] NWIN */ + val |= 1 << 8; /* [8] V8 */ + + return tcg_constant_tl(val); +} + +TRANS(RDASR17, ASR17, do_rd_special, true, a->rd, do_rd_leon3_config) + +static TCGv do_rdccr(DisasContext *dc, TCGv dst) +{ + update_psr(dc); + gen_helper_rdccr(dst, tcg_env); + return dst; +} + +TRANS(RDCCR, 64, do_rd_special, true, a->rd, do_rdccr) + +static TCGv do_rdasi(DisasContext *dc, TCGv dst) +{ +#ifdef TARGET_SPARC64 + return tcg_constant_tl(dc->asi); +#else + qemu_build_not_reached(); +#endif +} + +TRANS(RDASI, 64, do_rd_special, true, a->rd, do_rdasi) + +static TCGv do_rdtick(DisasContext *dc, TCGv dst) +{ +#ifdef TARGET_SPARC64 + TCGv_ptr r_tickptr = tcg_temp_new_ptr(); + TCGv_i32 r_const = tcg_constant_i32(dc->mem_idx); + + tcg_gen_ld_ptr(r_tickptr, tcg_env, offsetof(CPUSPARCState, tick)); + if (translator_io_start(&dc->base)) { + dc->base.is_jmp = DISAS_EXIT; + } + gen_helper_tick_get_count(dst, tcg_env, r_tickptr, r_const); + return dst; +#else + qemu_build_not_reached(); +#endif +} + +/* TODO: non-priv access only allowed when enabled. */ +TRANS(RDTICK, 64, do_rd_special, true, a->rd, do_rdtick) + +static TCGv do_rdpc(DisasContext *dc, TCGv dst) +{ + return tcg_constant_tl(address_mask_i(dc, dc->pc)); +} + +TRANS(RDPC, 64, do_rd_special, true, a->rd, do_rdpc) + +static TCGv do_rdfprs(DisasContext *dc, TCGv dst) +{ +#ifdef TARGET_SPARC64 + tcg_gen_ext_i32_tl(dst, cpu_fprs); + return dst; +#else + qemu_build_not_reached(); +#endif +} + +TRANS(RDFPRS, 64, do_rd_special, true, a->rd, do_rdfprs) + +static TCGv do_rdgsr(DisasContext *dc, TCGv dst) +{ +#ifdef TARGET_SPARC64 + gen_trap_ifnofpu(dc); + return cpu_gsr; +#else + qemu_build_not_reached(); +#endif +} + +TRANS(RDGSR, 64, do_rd_special, true, a->rd, do_rdgsr) + +static TCGv do_rdsoftint(DisasContext *dc, TCGv dst) +{ +#ifdef TARGET_SPARC64 + tcg_gen_ld32s_tl(dst, tcg_env, offsetof(CPUSPARCState, softint)); + return dst; +#else + qemu_build_not_reached(); +#endif +} + +TRANS(RDSOFTINT, 64, do_rd_special, supervisor(dc), a->rd, do_rdsoftint) + +static TCGv do_rdtick_cmpr(DisasContext *dc, TCGv dst) +{ +#ifdef TARGET_SPARC64 + return cpu_tick_cmpr; +#else + qemu_build_not_reached(); +#endif +} + +/* TODO: non-priv access only allowed when enabled. */ +TRANS(RDTICK_CMPR, 64, do_rd_special, true, a->rd, do_rdtick_cmpr) + +static TCGv do_rdstick(DisasContext *dc, TCGv dst) +{ +#ifdef TARGET_SPARC64 + TCGv_ptr r_tickptr = tcg_temp_new_ptr(); + TCGv_i32 r_const = tcg_constant_i32(dc->mem_idx); + + tcg_gen_ld_ptr(r_tickptr, tcg_env, offsetof(CPUSPARCState, stick)); + if (translator_io_start(&dc->base)) { + dc->base.is_jmp = DISAS_EXIT; + } + gen_helper_tick_get_count(dst, tcg_env, r_tickptr, r_const); + return dst; +#else + qemu_build_not_reached(); +#endif +} + +/* TODO: non-priv access only allowed when enabled. */ +TRANS(RDSTICK, 64, do_rd_special, true, a->rd, do_rdstick) + +static TCGv do_rdstick_cmpr(DisasContext *dc, TCGv dst) +{ +#ifdef TARGET_SPARC64 + return cpu_stick_cmpr; +#else + qemu_build_not_reached(); +#endif +} + +/* TODO: supervisor access only allowed when enabled by hypervisor. */ +TRANS(RDSTICK_CMPR, 64, do_rd_special, supervisor(dc), a->rd, do_rdstick_cmpr) + +/* + * UltraSPARC-T1 Strand status. + * HYPV check maybe not enough, UA2005 & UA2007 describe + * this ASR as impl. dep + */ +static TCGv do_rdstrand_status(DisasContext *dc, TCGv dst) +{ + return tcg_constant_tl(1); +} + +TRANS(RDSTRAND_STATUS, HYPV, do_rd_special, true, a->rd, do_rdstrand_status) + #define CHECK_IU_FEATURE(dc, FEATURE) \ if (!((dc)->def->features & CPU_FEATURE_ ## FEATURE)) \ goto illegal_insn; @@ -3143,134 +3360,12 @@ static void disas_sparc_legacy(DisasContext *dc, unsigned int insn) g_assert_not_reached(); /* in decodetree */ case 2: /* FPU & Logical Operations */ { - unsigned int xop = GET_FIELD(insn, 7, 12); - TCGv cpu_dst = tcg_temp_new(); - TCGv cpu_tmp0; + unsigned int xop __attribute__((unused)) = GET_FIELD(insn, 7, 12); + TCGv cpu_dst __attribute__((unused)) = tcg_temp_new(); + TCGv cpu_tmp0 __attribute__((unused)); - if (xop == 0x28) { - rs1 = GET_FIELD(insn, 13, 17); - switch(rs1) { - case 0: /* rdy */ -#ifndef TARGET_SPARC64 - case 0x01 ... 0x0e: /* undefined in the SPARCv8 - manual, rdy on the microSPARC - II */ - case 0x0f: /* stbar in the SPARCv8 manual, - rdy on the microSPARC II */ - case 0x10 ... 0x1f: /* implementation-dependent in the - SPARCv8 manual, rdy on the - microSPARC II */ - /* Read Asr17 */ - if (rs1 == 0x11 && dc->def->features & CPU_FEATURE_ASR17) { - TCGv t = gen_dest_gpr(dc, rd); - /* Read Asr17 for a Leon3 monoprocessor */ - tcg_gen_movi_tl(t, (1 << 8) | (dc->def->nwindows - 1)); - gen_store_gpr(dc, rd, t); - break; - } -#endif - gen_store_gpr(dc, rd, cpu_y); - break; -#ifdef TARGET_SPARC64 - case 0x2: /* V9 rdccr */ - update_psr(dc); - gen_helper_rdccr(cpu_dst, tcg_env); - gen_store_gpr(dc, rd, cpu_dst); - break; - case 0x3: /* V9 rdasi */ - tcg_gen_movi_tl(cpu_dst, dc->asi); - gen_store_gpr(dc, rd, cpu_dst); - break; - case 0x4: /* V9 rdtick */ - { - TCGv_ptr r_tickptr; - TCGv_i32 r_const; - - r_tickptr = tcg_temp_new_ptr(); - r_const = tcg_constant_i32(dc->mem_idx); - tcg_gen_ld_ptr(r_tickptr, tcg_env, - offsetof(CPUSPARCState, tick)); - if (translator_io_start(&dc->base)) { - dc->base.is_jmp = DISAS_EXIT; - } - gen_helper_tick_get_count(cpu_dst, tcg_env, r_tickptr, - r_const); - gen_store_gpr(dc, rd, cpu_dst); - } - break; - case 0x5: /* V9 rdpc */ - { - TCGv t = gen_dest_gpr(dc, rd); - if (unlikely(AM_CHECK(dc))) { - tcg_gen_movi_tl(t, dc->pc & 0xffffffffULL); - } else { - tcg_gen_movi_tl(t, dc->pc); - } - gen_store_gpr(dc, rd, t); - } - break; - case 0x6: /* V9 rdfprs */ - tcg_gen_ext_i32_tl(cpu_dst, cpu_fprs); - gen_store_gpr(dc, rd, cpu_dst); - break; - case 0xf: /* V9 membar */ - break; /* no effect */ - case 0x13: /* Graphics Status */ - if (gen_trap_ifnofpu(dc)) { - goto jmp_insn; - } - gen_store_gpr(dc, rd, cpu_gsr); - break; - case 0x16: /* Softint */ - tcg_gen_ld32s_tl(cpu_dst, tcg_env, - offsetof(CPUSPARCState, softint)); - gen_store_gpr(dc, rd, cpu_dst); - break; - case 0x17: /* Tick compare */ - gen_store_gpr(dc, rd, cpu_tick_cmpr); - break; - case 0x18: /* System tick */ - { - TCGv_ptr r_tickptr; - TCGv_i32 r_const; - - r_tickptr = tcg_temp_new_ptr(); - r_const = tcg_constant_i32(dc->mem_idx); - tcg_gen_ld_ptr(r_tickptr, tcg_env, - offsetof(CPUSPARCState, stick)); - if (translator_io_start(&dc->base)) { - dc->base.is_jmp = DISAS_EXIT; - } - gen_helper_tick_get_count(cpu_dst, tcg_env, r_tickptr, - r_const); - gen_store_gpr(dc, rd, cpu_dst); - } - break; - case 0x19: /* System tick compare */ - gen_store_gpr(dc, rd, cpu_stick_cmpr); - break; - case 0x1a: /* UltraSPARC-T1 Strand status */ - /* XXX HYPV check maybe not enough, UA2005 & UA2007 describe - * this ASR as impl. dep - */ - CHECK_IU_FEATURE(dc, HYPV); - { - TCGv t = gen_dest_gpr(dc, rd); - tcg_gen_movi_tl(t, 1UL); - gen_store_gpr(dc, rd, t); - } - break; - case 0x10: /* Performance Control */ - case 0x11: /* Performance Instrumentation Counter */ - case 0x12: /* Dispatch Control */ - case 0x14: /* Softint set, WO */ - case 0x15: /* Softint clear, WO */ -#endif - default: - goto illegal_insn; - } #if !defined(CONFIG_USER_ONLY) - } else if (xop == 0x29) { /* rdpsr / UA2005 rdhpr */ + if (xop == 0x29) { /* rdpsr / UA2005 rdhpr */ #ifndef TARGET_SPARC64 if (!supervisor(dc)) { goto priv_insn; @@ -3308,7 +3403,8 @@ static void disas_sparc_legacy(DisasContext *dc, unsigned int insn) #endif gen_store_gpr(dc, rd, cpu_dst); break; - } else if (xop == 0x2a) { /* rdwim / V9 rdpr */ + } + if (xop == 0x2a) { /* rdwim / V9 rdpr */ if (!supervisor(dc)) { goto priv_insn; } @@ -3432,9 +3528,10 @@ static void disas_sparc_legacy(DisasContext *dc, unsigned int insn) #endif gen_store_gpr(dc, rd, cpu_tmp0); break; + } #endif #if defined(TARGET_SPARC64) || !defined(CONFIG_USER_ONLY) - } else if (xop == 0x2b) { /* rdtbr / V9 flushw */ + if (xop == 0x2b) { /* rdtbr / V9 flushw */ #ifdef TARGET_SPARC64 gen_helper_flushw(tcg_env); #else @@ -3443,8 +3540,9 @@ static void disas_sparc_legacy(DisasContext *dc, unsigned int insn) gen_store_gpr(dc, rd, cpu_tbr); #endif break; + } #endif - } else if (xop == 0x34) { /* FPU Operations */ + if (xop == 0x34) { /* FPU Operations */ if (gen_trap_ifnofpu(dc)) { goto jmp_insn; } From patchwork Sun Oct 22 05:59:23 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 736990 Delivered-To: patch@linaro.org Received: by 2002:adf:dd81:0:b0:32d:baff:b0ca with SMTP id x1csp1006170wrl; Sat, 21 Oct 2023 23:14:06 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGSpBaNA7SQoCp7rGJtBLCS49Iz/Q4JhMEWvF15vU6+SGEawfwMXPk5wNLu0w0g3GvsMfiS X-Received: by 2002:ad4:5a05:0:b0:66d:59a4:a2f3 with SMTP id ei5-20020ad45a05000000b0066d59a4a2f3mr10812827qvb.14.1697955245900; Sat, 21 Oct 2023 23:14:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697955245; cv=none; d=google.com; s=arc-20160816; b=EJu/ZXFHU/KOcW0rfdzzQ3zRJyPJ4cQ1QzOG1QD1H73SJwUHxE5awMuHdoctIi/orN 7f76pCdPDPBUViz3LRcgOwQX/TJ1ooVcmgqAVUfcdwyT5hr1cGUimOe1+P8N5fuuMHMD CsTff8jp6mv9l5FXKO7TYssBfZD7cncrriRLnHtknXcQezDBD/z8EUBXTGcEM8BMe7w0 FAMKBCjyhG0BoUVgCkRQgL78RwPWZSjZliGYHUPI00o0RGN1QocNSLVUvmjD2k8OqxnB MNzOgRjW1fJKeEChZdIhKPvWozS+tAmhYd4jLc+BS67oa+RoafKGULx3DTtnB3yJYJwy F+Nw== 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=qdMramiYwqBa4t1ThcN9BlHwMoxzWRlkGXH/FBRcYbw=; fh=TYrED6TOMxGX0VC4GtjviASLbYyJe19+7/tKWjN44KQ=; b=MZQstv3FW+uT1QiOdxhVpI30p2Z8Z9iY9gcgDMq+vpfsDA7RAMf4mTaDGC9dx10fnn 5fpnJGyJaDV3KgJ3qAnIerTGZlWZEA8Cuz+hQTXLxbD4L/UHXUlu8TQY3+X/gLK7hjgt Jj3KmDS22EQka6vkSeJwnL71LMgQGLiAwJlyVDL+PiYkQ/wgMZm+9z33xhbbc0dD6gqp Xf/HCmPhYXjCJtoKJjgbRaCOfg7MuiaSw0UtW3UcFs1iAJFgNP+mFpz9Fs/xzFCEOIKH QBMPO+P9IRZjOy5i1SNn5qy7XTWfDyVLJB9hoo0IaK5BXWW9fUO2kO5jakcdSFpjfA0i mD+g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="Swq/ofx6"; 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 p18-20020a05620a057200b00774173d6bb4si3569710qkp.190.2023.10.21.23.14.05 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sat, 21 Oct 2023 23:14:05 -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="Swq/ofx6"; 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 1quRWQ-0000eB-EM; Sun, 22 Oct 2023 02:01:10 -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 1quRWA-0000Zp-6d for qemu-devel@nongnu.org; Sun, 22 Oct 2023 02:00:56 -0400 Received: from mail-pl1-x62c.google.com ([2607:f8b0:4864:20::62c]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1quRW8-0001Zq-CF for qemu-devel@nongnu.org; Sun, 22 Oct 2023 02:00:53 -0400 Received: by mail-pl1-x62c.google.com with SMTP id d9443c01a7336-1ca74e77aecso23797035ad.1 for ; Sat, 21 Oct 2023 23:00:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1697954451; x=1698559251; 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=qdMramiYwqBa4t1ThcN9BlHwMoxzWRlkGXH/FBRcYbw=; b=Swq/ofx6EPuNND6QV9TI6olAfJN6L3bcxo8hx6e0a814ow4CAZH5WOl3n1nn6KSy8l DgmZDGBsLtwCFNIiLFgDFQHYw9OAmTN2lddxyhAHU8l6N6Cb4FIfTKFSrGGXXcrKstBI yed464rGmJ05tEFWRvNBhrzKto8fqI4akvUnPAfaAVME7RIrGEmL2lIL7/SVrxl5mI0F /Lj/CiJgp7SryItSAFsKJTh/JUVsQZXvj6R1yyT6Uwmmhik8GHgx6Orv6yajPre3IhAp /CKEVKLGU6VkCs2Xe7Hux7CiDl0f4umvXk0Stg9JMv+iLVxjxKUsQCq/8xbF3tECP68K H0sQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697954451; x=1698559251; 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=qdMramiYwqBa4t1ThcN9BlHwMoxzWRlkGXH/FBRcYbw=; b=e4EWCxxyutGPWZLtdIvJsdbyokcPZKySA3H2c191pYSTS+kEWn0/qNHg4Eg0UOyasj 18jLbB3eI3U8qbS3CVf+p7wFgwkAxEJTQ2i8TRmPW35cgy81DdkfWyPwT5Ww/2vrdIRM BXkV3BChbE+DeL94IF3JsY8Ojy3O/0fbzMhT/FQjJDRA6r/TWL/1M0PcyRN2I48lzgIU NoMc4RuHM/kPlKW94PkcAYVyeI2IoS13wIdU9/2R8zge/HUOxI4VK0j1LjxOVkMTJivJ kThL3V9G/h96d3L2X1zFaTaqHlhVNlqBQAdCN+U1zw/g9TquXELpaPhgih+XiNeewtjr V3sg== X-Gm-Message-State: AOJu0YyOF7TURc3f1RSi7b2NR4WzWFjYI0UNgsRbolH15ZNrzK7wMGWT vwn37yQrfC372YPui1hdpQ+nv7qjuIHifRR1O7M= X-Received: by 2002:a17:903:32c1:b0:1c7:5776:a30f with SMTP id i1-20020a17090332c100b001c75776a30fmr7696260plr.12.1697954451130; Sat, 21 Oct 2023 23:00:51 -0700 (PDT) Received: from stoup.. ([71.212.149.95]) by smtp.gmail.com with ESMTPSA id je17-20020a170903265100b001c728609574sm3999887plb.6.2023.10.21.23.00.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 21 Oct 2023 23:00:50 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: mark.cave-ayland@ilande.co.uk Subject: [PATCH v4 22/90] target/sparc: Move RDPSR, RDHPR to decodetree Date: Sat, 21 Oct 2023 22:59:23 -0700 Message-Id: <20231022060031.490251-23-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231022060031.490251-1-richard.henderson@linaro.org> References: <20231022060031.490251-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::62c; envelope-from=richard.henderson@linaro.org; helo=mail-pl1-x62c.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 Implement htstate in the obvious way. Signed-off-by: Richard Henderson --- target/sparc/insns.decode | 10 +++ target/sparc/translate.c | 133 ++++++++++++++++++++++++++------------ 2 files changed, 101 insertions(+), 42 deletions(-) diff --git a/target/sparc/insns.decode b/target/sparc/insns.decode index 1b084c5b97..a7d78eb6c6 100644 --- a/target/sparc/insns.decode +++ b/target/sparc/insns.decode @@ -44,6 +44,16 @@ CALL 01 i:s30 RDY 10 rd:5 101000 rs1:5 0 0000000000000 } +{ + RDPSR 10 rd:5 101001 00000 0 0000000000000 + RDHPR_hpstate 10 rd:5 101001 00000 0 0000000000000 +} +RDHPR_htstate 10 rd:5 101001 00001 0 0000000000000 +RDHPR_hintp 10 rd:5 101001 00011 0 0000000000000 +RDHPR_htba 10 rd:5 101001 00101 0 0000000000000 +RDHPR_hver 10 rd:5 101001 00110 0 0000000000000 +RDHPR_hstick_cmpr 10 rd:5 101001 11111 0 0000000000000 + Tcc_r 10 0 cond:4 111010 rs1:5 0 cc:1 0000000 rs2:5 { # For v7, the entire simm13 field is present, but masked to 7 bits. diff --git a/target/sparc/translate.c b/target/sparc/translate.c index 81de714aa6..ed68b792d4 100644 --- a/target/sparc/translate.c +++ b/target/sparc/translate.c @@ -36,7 +36,9 @@ #include "exec/helper-info.c.inc" #undef HELPER_H -#ifndef TARGET_SPARC64 +#ifdef TARGET_SPARC64 +#define gen_helper_rdpsr(D, E) qemu_build_not_reached() +#else #define gen_helper_rdccr(D, E) qemu_build_not_reached() #endif @@ -260,15 +262,14 @@ static void gen_move_Q(DisasContext *dc, unsigned int rd, unsigned int rs) /* moves */ #ifdef CONFIG_USER_ONLY #define supervisor(dc) 0 -#ifdef TARGET_SPARC64 #define hypervisor(dc) 0 -#endif #else #ifdef TARGET_SPARC64 #define hypervisor(dc) (dc->hypervisor) #define supervisor(dc) (dc->supervisor | dc->hypervisor) #else #define supervisor(dc) (dc->supervisor) +#define hypervisor(dc) 0 #endif #endif @@ -3334,6 +3335,93 @@ static TCGv do_rdstrand_status(DisasContext *dc, TCGv dst) TRANS(RDSTRAND_STATUS, HYPV, do_rd_special, true, a->rd, do_rdstrand_status) +static TCGv do_rdpsr(DisasContext *dc, TCGv dst) +{ + update_psr(dc); + gen_helper_rdpsr(dst, tcg_env); + return dst; +} + +TRANS(RDPSR, 32, do_rd_special, supervisor(dc), a->rd, do_rdpsr) + +static TCGv do_rdhpstate(DisasContext *dc, TCGv dst) +{ +#ifdef TARGET_SPARC64 + tcg_gen_ld_i64(dst, tcg_env, offsetof(CPUSPARCState, hpstate)); + return dst; +#else + qemu_build_not_reached(); +#endif +} + +TRANS(RDHPR_hpstate, HYPV, do_rd_special, hypervisor(dc), a->rd, do_rdhpstate) + +static TCGv do_rdhtstate(DisasContext *dc, TCGv dst) +{ +#ifdef TARGET_SPARC64 + TCGv_i32 tl = tcg_temp_new_i32(); + TCGv_ptr tp = tcg_temp_new_ptr(); + + tcg_gen_ld_i32(tl, tcg_env, offsetof(CPUSPARCState, tl)); + tcg_gen_andi_i32(tl, tl, MAXTL_MASK); + tcg_gen_shli_i32(tl, tl, 3); + tcg_gen_ext_i32_ptr(tp, tl); + tcg_gen_add_ptr(tp, tp, tcg_env); + + tcg_gen_ld_i64(dst, tp, offsetof(CPUSPARCState, htstate)); + return dst; +#else + qemu_build_not_reached(); +#endif +} + +TRANS(RDHPR_htstate, HYPV, do_rd_special, hypervisor(dc), a->rd, do_rdhtstate) + +static TCGv do_rdhintp(DisasContext *dc, TCGv dst) +{ +#ifdef TARGET_SPARC64 + return cpu_hintp; +#else + qemu_build_not_reached(); +#endif +} + +TRANS(RDHPR_hintp, HYPV, do_rd_special, hypervisor(dc), a->rd, do_rdhintp) + +static TCGv do_rdhtba(DisasContext *dc, TCGv dst) +{ +#ifdef TARGET_SPARC64 + return cpu_htba; +#else + qemu_build_not_reached(); +#endif +} + +TRANS(RDHPR_htba, HYPV, do_rd_special, hypervisor(dc), a->rd, do_rdhtba) + +static TCGv do_rdhver(DisasContext *dc, TCGv dst) +{ +#ifdef TARGET_SPARC64 + return cpu_hver; +#else + qemu_build_not_reached(); +#endif +} + +TRANS(RDHPR_hver, HYPV, do_rd_special, hypervisor(dc), a->rd, do_rdhver) + +static TCGv do_rdhstick_cmpr(DisasContext *dc, TCGv dst) +{ +#ifdef TARGET_SPARC64 + return cpu_hstick_cmpr; +#else + qemu_build_not_reached(); +#endif +} + +TRANS(RDHPR_hstick_cmpr, HYPV, do_rd_special, hypervisor(dc), a->rd, + do_rdhstick_cmpr) + #define CHECK_IU_FEATURE(dc, FEATURE) \ if (!((dc)->def->features & CPU_FEATURE_ ## FEATURE)) \ goto illegal_insn; @@ -3365,45 +3453,6 @@ static void disas_sparc_legacy(DisasContext *dc, unsigned int insn) TCGv cpu_tmp0 __attribute__((unused)); #if !defined(CONFIG_USER_ONLY) - if (xop == 0x29) { /* rdpsr / UA2005 rdhpr */ -#ifndef TARGET_SPARC64 - if (!supervisor(dc)) { - goto priv_insn; - } - update_psr(dc); - gen_helper_rdpsr(cpu_dst, tcg_env); -#else - CHECK_IU_FEATURE(dc, HYPV); - if (!hypervisor(dc)) - goto priv_insn; - rs1 = GET_FIELD(insn, 13, 17); - switch (rs1) { - case 0: // hpstate - tcg_gen_ld_i64(cpu_dst, tcg_env, - offsetof(CPUSPARCState, hpstate)); - break; - case 1: // htstate - // gen_op_rdhtstate(); - break; - case 3: // hintp - tcg_gen_mov_tl(cpu_dst, cpu_hintp); - break; - case 5: // htba - tcg_gen_mov_tl(cpu_dst, cpu_htba); - break; - case 6: // hver - tcg_gen_mov_tl(cpu_dst, cpu_hver); - break; - case 31: // hstick_cmpr - tcg_gen_mov_tl(cpu_dst, cpu_hstick_cmpr); - break; - default: - goto illegal_insn; - } -#endif - gen_store_gpr(dc, rd, cpu_dst); - break; - } if (xop == 0x2a) { /* rdwim / V9 rdpr */ if (!supervisor(dc)) { goto priv_insn; From patchwork Sun Oct 22 05:59:24 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 736930 Delivered-To: patch@linaro.org Received: by 2002:adf:dd81:0:b0:32d:baff:b0ca with SMTP id x1csp1003175wrl; Sat, 21 Oct 2023 23:02:14 -0700 (PDT) X-Google-Smtp-Source: AGHT+IG54FUNmv3wibek3vCsT7WF14L6bKuFdWbej6imfmaQpwImXKoC/SuSjd4JgVWlJOcTVrgV X-Received: by 2002:ad4:5bce:0:b0:66d:8196:c122 with SMTP id t14-20020ad45bce000000b0066d8196c122mr8363708qvt.3.1697954534664; Sat, 21 Oct 2023 23:02:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697954534; cv=none; d=google.com; s=arc-20160816; b=TKUIPROVRbEcyQqrT9w/HEj+iQwejeWz/GztjFiO4jRzne9ndeUsXpiyNgIjCg2XMQ FnBSOCA1cK+twkzBsf6lHKpbkwB9cWUaclRXe3ns+wA+7oV8j5rrZ3jsijQ52koh0fSx NxwuAf42YKvCE63Tha+r+K+H+F04M5qYVKqcHtljPEhBD9UH4CqhAtbc6reBwHc5VcgN JJRRR1u2jx7heFxwi7KkfnUw4mJwCQHeljJFHo2vQ0Aca9aJReYwdnGyWI+TdAduLtnE RyBMWiQpVAtVseVWiP4tgcHihTFOt3aDw0vJoVGlvidT9mJ6/RNVVtIp4RGgGJAPlx6R w75g== 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=ZO68GFhGEZvgfzG3ZJ7VKj6hE6zMHZa3xazZYlMA+aw=; fh=TYrED6TOMxGX0VC4GtjviASLbYyJe19+7/tKWjN44KQ=; b=gOo8vs34EOwi0ta2p+ALIFfzu3fOQIUDLFY4sTVCNBBSeELebI/IoE8PSSOOOZlvwM t58wvhWZl+pf3vpWXjKRcdbSDiKRutkqUyPHmhN3PR/W3Ubx2Txb8bFgl7DhgUCp8ILd ICEwpdzfAzOhuGC7DDfWZ/EbeoAGICE+hr6vy4ozWy0LqcenmgbWrVJ78whXP9OOYZuL QcpbBZzvRzmvTdYgUyGJjCuQdDbSUpRlTsYYbz0RFEzb92WPaG+S+VYwXqJzlzqy9lRL 8E3H3g4obN0LlxhJCa5okTGTw+fLIUjo/+NnhF/YSCMr66H1iRhgz139zk3G9Q04zm3f QDjw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=oxCnBghF; 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 nh19-20020a056214391300b0065b31197992si3815622qvb.49.2023.10.21.23.02.14 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sat, 21 Oct 2023 23:02:14 -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=oxCnBghF; 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 1quRWM-0000cV-PN; Sun, 22 Oct 2023 02:01:06 -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 1quRWC-0000a0-3U for qemu-devel@nongnu.org; Sun, 22 Oct 2023 02:00:56 -0400 Received: from mail-pl1-x62b.google.com ([2607:f8b0:4864:20::62b]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1quRW9-0001a2-8i for qemu-devel@nongnu.org; Sun, 22 Oct 2023 02:00:55 -0400 Received: by mail-pl1-x62b.google.com with SMTP id d9443c01a7336-1c9daca2b85so15899965ad.1 for ; Sat, 21 Oct 2023 23:00:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1697954452; x=1698559252; 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=ZO68GFhGEZvgfzG3ZJ7VKj6hE6zMHZa3xazZYlMA+aw=; b=oxCnBghFjdmxXJqNzW4KhflxTmxtdlz3UtsuYFqdX2/1hxktunf74CurILcPQqPWXm Pu8b/tvfdia7A8UZ3OSsI882IskS9FF4peOaMM9WSCRFrx5M8bai331iMyMMTKCvFiyE Xuhit63iB++dHLIShlrUDt3oQHig65OjAksMAYsn/l2Z5rzlLAjHmwEL/JFIi8pRLRvg tax9rt7UXjTLiv/cpeI26mBF5v7KmeBMmq4BPdp//GoU448Bx5VAxDLRHurDpNJNzJZL 1+lnbpRGHNbckauhH7CsEHpItc7IxpsRCaryNOHZ4StSEA6cfZ9RBfR4JxFNHh3/EzLO +ocg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697954452; x=1698559252; 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=ZO68GFhGEZvgfzG3ZJ7VKj6hE6zMHZa3xazZYlMA+aw=; b=mQoet7W1RzQVvjW7WTNrMZ3j+QbRkcvjDRCpyc1C/RpbRcCqG0dvnRailvj4Ih8eOU gflrg0/yFgT8moRQ6YC5qZFf2aihP/uS2/QV8GmRyLJcV8YEXW7TfG3/bR1hMdFhY7ys tOTKqLq6uftztbOa23Zb/wscMdVsoO9AJgkWaYP74DYuMKhRqpgYircpNRewxUIKiFWP gQbQX4Qm8LHKszAtejqw3f+0YyfcgEjCk+vOPI8dgVvdzq6EoyjDLsRKRMpQH1E6/9nY UEzdUM9y4foY6uLFK0gWIzv8oVl9uD869oYyytncJAa29lKBcQHcK9ZNQbrlgq8XxKjP ntbg== X-Gm-Message-State: AOJu0YxTeYpCAxa+3OmQhYSJQDeTxdG4G8NP+2XbQMSUkUlwRZOytNtX 3P+/gL+ogxqlSC7cln/AjQmjflsIRSUwsLR2nII= X-Received: by 2002:a17:902:ce88:b0:1bc:1e17:6d70 with SMTP id f8-20020a170902ce8800b001bc1e176d70mr8350345plg.24.1697954451966; Sat, 21 Oct 2023 23:00:51 -0700 (PDT) Received: from stoup.. ([71.212.149.95]) by smtp.gmail.com with ESMTPSA id je17-20020a170903265100b001c728609574sm3999887plb.6.2023.10.21.23.00.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 21 Oct 2023 23:00:51 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: mark.cave-ayland@ilande.co.uk Subject: [PATCH v4 23/90] target/sparc: Move RDWIM, RDPR to decodetree Date: Sat, 21 Oct 2023 22:59:24 -0700 Message-Id: <20231022060031.490251-24-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231022060031.490251-1-richard.henderson@linaro.org> References: <20231022060031.490251-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::62b; envelope-from=richard.henderson@linaro.org; helo=mail-pl1-x62b.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 | 22 +++ target/sparc/translate.c | 360 +++++++++++++++++++++++--------------- 2 files changed, 244 insertions(+), 138 deletions(-) diff --git a/target/sparc/insns.decode b/target/sparc/insns.decode index a7d78eb6c6..7d91a7bc83 100644 --- a/target/sparc/insns.decode +++ b/target/sparc/insns.decode @@ -54,6 +54,28 @@ RDHPR_htba 10 rd:5 101001 00101 0 0000000000000 RDHPR_hver 10 rd:5 101001 00110 0 0000000000000 RDHPR_hstick_cmpr 10 rd:5 101001 11111 0 0000000000000 +{ + RDWIM 10 rd:5 101010 00000 0 0000000000000 + RDPR_tpc 10 rd:5 101010 00000 0 0000000000000 +} +RDPR_tnpc 10 rd:5 101010 00001 0 0000000000000 +RDPR_tstate 10 rd:5 101010 00010 0 0000000000000 +RDPR_tt 10 rd:5 101010 00011 0 0000000000000 +RDPR_tick 10 rd:5 101010 00100 0 0000000000000 +RDPR_tba 10 rd:5 101010 00101 0 0000000000000 +RDPR_pstate 10 rd:5 101010 00110 0 0000000000000 +RDPR_tl 10 rd:5 101010 00111 0 0000000000000 +RDPR_pil 10 rd:5 101010 01000 0 0000000000000 +RDPR_cwp 10 rd:5 101010 01001 0 0000000000000 +RDPR_cansave 10 rd:5 101010 01010 0 0000000000000 +RDPR_canrestore 10 rd:5 101010 01011 0 0000000000000 +RDPR_cleanwin 10 rd:5 101010 01100 0 0000000000000 +RDPR_otherwin 10 rd:5 101010 01101 0 0000000000000 +RDPR_wstate 10 rd:5 101010 01110 0 0000000000000 +RDPR_gl 10 rd:5 101010 10000 0 0000000000000 +RDPR_strand_status 10 rd:5 101010 11010 0 0000000000000 +RDPR_ver 10 rd:5 101010 11111 0 0000000000000 + Tcc_r 10 0 cond:4 111010 rs1:5 0 cc:1 0000000 rs2:5 { # For v7, the entire simm13 field is present, but masked to 7 bits. diff --git a/target/sparc/translate.c b/target/sparc/translate.c index ed68b792d4..0dd963776c 100644 --- a/target/sparc/translate.c +++ b/target/sparc/translate.c @@ -40,6 +40,7 @@ #define gen_helper_rdpsr(D, E) qemu_build_not_reached() #else #define gen_helper_rdccr(D, E) qemu_build_not_reached() +#define gen_helper_rdcwp(D, E) qemu_build_not_reached() #endif /* Dynamic PC, must exit to main loop. */ @@ -59,9 +60,7 @@ static TCGv_i32 cpu_psr; static TCGv cpu_fsr, cpu_pc, cpu_npc; static TCGv cpu_regs[32]; static TCGv cpu_y; -#ifndef CONFIG_USER_ONLY static TCGv cpu_tbr; -#endif static TCGv cpu_cond; #ifdef TARGET_SPARC64 static TCGv_i32 cpu_xcc, cpu_fprs; @@ -2692,8 +2691,7 @@ static void gen_fmovq(DisasContext *dc, DisasCompare *cmp, int rd, int rs) gen_update_fprs_dirty(dc, qd); } -#ifndef CONFIG_USER_ONLY -static void gen_load_trap_state_at_tl(TCGv_ptr r_tsptr, TCGv_env tcg_env) +static void gen_load_trap_state_at_tl(TCGv_ptr r_tsptr) { TCGv_i32 r_tl = tcg_temp_new_i32(); @@ -2714,7 +2712,6 @@ static void gen_load_trap_state_at_tl(TCGv_ptr r_tsptr, TCGv_env tcg_env) tcg_gen_add_ptr(r_tsptr, r_tsptr, r_tl_tmp); } } -#endif static void gen_edge(DisasContext *dc, TCGv dst, TCGv s1, TCGv s2, int width, bool cc, bool left) @@ -2853,6 +2850,7 @@ static void gen_faligndata(TCGv dst, TCGv gsr, TCGv s1, TCGv s2) # define avail_64(C) false #endif #define avail_ASR17(C) ((C)->def->features & CPU_FEATURE_ASR17) +#define avail_GL(C) ((C)->def->features & CPU_FEATURE_GL) #define avail_HYPV(C) ((C)->def->features & CPU_FEATURE_HYPV) /* Default case for non jump instructions. */ @@ -3422,6 +3420,221 @@ static TCGv do_rdhstick_cmpr(DisasContext *dc, TCGv dst) TRANS(RDHPR_hstick_cmpr, HYPV, do_rd_special, hypervisor(dc), a->rd, do_rdhstick_cmpr) +static TCGv do_rdwim(DisasContext *dc, TCGv dst) +{ +#ifdef TARGET_SPARC64 + qemu_build_not_reached(); +#else + return cpu_wim; +#endif +} + +TRANS(RDWIM, 32, do_rd_special, supervisor(dc), a->rd, do_rdwim) + +static TCGv do_rdtpc(DisasContext *dc, TCGv dst) +{ +#ifdef TARGET_SPARC64 + TCGv_ptr r_tsptr = tcg_temp_new_ptr(); + + gen_load_trap_state_at_tl(r_tsptr); + tcg_gen_ld_tl(dst, r_tsptr, offsetof(trap_state, tpc)); + return dst; +#else + qemu_build_not_reached(); +#endif +} + +TRANS(RDPR_tpc, 64, do_rd_special, supervisor(dc), a->rd, do_rdtpc) + +static TCGv do_rdtnpc(DisasContext *dc, TCGv dst) +{ +#ifdef TARGET_SPARC64 + TCGv_ptr r_tsptr = tcg_temp_new_ptr(); + + gen_load_trap_state_at_tl(r_tsptr); + tcg_gen_ld_tl(dst, r_tsptr, offsetof(trap_state, tnpc)); + return dst; +#else + qemu_build_not_reached(); +#endif +} + +TRANS(RDPR_tnpc, 64, do_rd_special, supervisor(dc), a->rd, do_rdtnpc) + +static TCGv do_rdtstate(DisasContext *dc, TCGv dst) +{ +#ifdef TARGET_SPARC64 + TCGv_ptr r_tsptr = tcg_temp_new_ptr(); + + gen_load_trap_state_at_tl(r_tsptr); + tcg_gen_ld_tl(dst, r_tsptr, offsetof(trap_state, tstate)); + return dst; +#else + qemu_build_not_reached(); +#endif +} + +TRANS(RDPR_tstate, 64, do_rd_special, supervisor(dc), a->rd, do_rdtstate) + +static TCGv do_rdtt(DisasContext *dc, TCGv dst) +{ +#ifdef TARGET_SPARC64 + TCGv_ptr r_tsptr = tcg_temp_new_ptr(); + + gen_load_trap_state_at_tl(r_tsptr); + tcg_gen_ld32s_tl(dst, r_tsptr, offsetof(trap_state, tt)); + return dst; +#else + qemu_build_not_reached(); +#endif +} + +TRANS(RDPR_tt, 64, do_rd_special, supervisor(dc), a->rd, do_rdtt) +TRANS(RDPR_tick, 64, do_rd_special, supervisor(dc), a->rd, do_rdtick) + +static TCGv do_rdtba(DisasContext *dc, TCGv dst) +{ + return cpu_tbr; +} + +TRANS(RDPR_tba, 64, do_rd_special, supervisor(dc), a->rd, do_rdtba) + +static TCGv do_rdpstate(DisasContext *dc, TCGv dst) +{ +#ifdef TARGET_SPARC64 + tcg_gen_ld32s_tl(dst, tcg_env, offsetof(CPUSPARCState, pstate)); + return dst; +#else + qemu_build_not_reached(); +#endif +} + +TRANS(RDPR_pstate, 64, do_rd_special, supervisor(dc), a->rd, do_rdpstate) + +static TCGv do_rdtl(DisasContext *dc, TCGv dst) +{ +#ifdef TARGET_SPARC64 + tcg_gen_ld32s_tl(dst, tcg_env, offsetof(CPUSPARCState, tl)); + return dst; +#else + qemu_build_not_reached(); +#endif +} + +TRANS(RDPR_tl, 64, do_rd_special, supervisor(dc), a->rd, do_rdtl) + +static TCGv do_rdpil(DisasContext *dc, TCGv dst) +{ + tcg_gen_ld32s_tl(dst, tcg_env, offsetof(CPUSPARCState, psrpil)); + return dst; +} + +TRANS(RDPR_pil, 64, do_rd_special, supervisor(dc), a->rd, do_rdpil) + +static TCGv do_rdcwp(DisasContext *dc, TCGv dst) +{ + gen_helper_rdcwp(dst, tcg_env); + return dst; +} + +TRANS(RDPR_cwp, 64, do_rd_special, supervisor(dc), a->rd, do_rdcwp) + +static TCGv do_rdcansave(DisasContext *dc, TCGv dst) +{ +#ifdef TARGET_SPARC64 + tcg_gen_ld32s_tl(dst, tcg_env, offsetof(CPUSPARCState, cansave)); + return dst; +#else + qemu_build_not_reached(); +#endif +} + +TRANS(RDPR_cansave, 64, do_rd_special, supervisor(dc), a->rd, do_rdcansave) + +static TCGv do_rdcanrestore(DisasContext *dc, TCGv dst) +{ +#ifdef TARGET_SPARC64 + tcg_gen_ld32s_tl(dst, tcg_env, offsetof(CPUSPARCState, canrestore)); + return dst; +#else + qemu_build_not_reached(); +#endif +} + +TRANS(RDPR_canrestore, 64, do_rd_special, supervisor(dc), a->rd, + do_rdcanrestore) + +static TCGv do_rdcleanwin(DisasContext *dc, TCGv dst) +{ +#ifdef TARGET_SPARC64 + tcg_gen_ld32s_tl(dst, tcg_env, offsetof(CPUSPARCState, cleanwin)); + return dst; +#else + qemu_build_not_reached(); +#endif +} + +TRANS(RDPR_cleanwin, 64, do_rd_special, supervisor(dc), a->rd, do_rdcleanwin) + +static TCGv do_rdotherwin(DisasContext *dc, TCGv dst) +{ +#ifdef TARGET_SPARC64 + tcg_gen_ld32s_tl(dst, tcg_env, offsetof(CPUSPARCState, otherwin)); + return dst; +#else + qemu_build_not_reached(); +#endif +} + +TRANS(RDPR_otherwin, 64, do_rd_special, supervisor(dc), a->rd, do_rdotherwin) + +static TCGv do_rdwstate(DisasContext *dc, TCGv dst) +{ +#ifdef TARGET_SPARC64 + tcg_gen_ld32s_tl(dst, tcg_env, offsetof(CPUSPARCState, wstate)); + return dst; +#else + qemu_build_not_reached(); +#endif +} + +TRANS(RDPR_wstate, 64, do_rd_special, supervisor(dc), a->rd, do_rdwstate) + +static TCGv do_rdgl(DisasContext *dc, TCGv dst) +{ +#ifdef TARGET_SPARC64 + tcg_gen_ld32s_tl(dst, tcg_env, offsetof(CPUSPARCState, gl)); + return dst; +#else + g_assert_not_reached(); +#endif +} + +TRANS(RDPR_gl, GL, do_rd_special, supervisor(dc), a->rd, do_rdgl) + +/* UA2005 strand status */ +static TCGv do_rdssr(DisasContext *dc, TCGv dst) +{ +#ifdef TARGET_SPARC64 + return cpu_ssr; +#else + qemu_build_not_reached(); +#endif +} + +TRANS(RDPR_strand_status, HYPV, do_rd_special, hypervisor(dc), a->rd, do_rdssr) + +static TCGv do_rdver(DisasContext *dc, TCGv dst) +{ +#ifdef TARGET_SPARC64 + return cpu_ver; +#else + qemu_build_not_reached(); +#endif +} + +TRANS(RDPR_ver, 64, do_rd_special, supervisor(dc), a->rd, do_rdver) + #define CHECK_IU_FEATURE(dc, FEATURE) \ if (!((dc)->def->features & CPU_FEATURE_ ## FEATURE)) \ goto illegal_insn; @@ -3452,133 +3665,6 @@ static void disas_sparc_legacy(DisasContext *dc, unsigned int insn) TCGv cpu_dst __attribute__((unused)) = tcg_temp_new(); TCGv cpu_tmp0 __attribute__((unused)); -#if !defined(CONFIG_USER_ONLY) - if (xop == 0x2a) { /* rdwim / V9 rdpr */ - if (!supervisor(dc)) { - goto priv_insn; - } - cpu_tmp0 = tcg_temp_new(); -#ifdef TARGET_SPARC64 - rs1 = GET_FIELD(insn, 13, 17); - switch (rs1) { - case 0: // tpc - { - TCGv_ptr r_tsptr; - - r_tsptr = tcg_temp_new_ptr(); - gen_load_trap_state_at_tl(r_tsptr, tcg_env); - tcg_gen_ld_tl(cpu_tmp0, r_tsptr, - offsetof(trap_state, tpc)); - } - break; - case 1: // tnpc - { - TCGv_ptr r_tsptr; - - r_tsptr = tcg_temp_new_ptr(); - gen_load_trap_state_at_tl(r_tsptr, tcg_env); - tcg_gen_ld_tl(cpu_tmp0, r_tsptr, - offsetof(trap_state, tnpc)); - } - break; - case 2: // tstate - { - TCGv_ptr r_tsptr; - - r_tsptr = tcg_temp_new_ptr(); - gen_load_trap_state_at_tl(r_tsptr, tcg_env); - tcg_gen_ld_tl(cpu_tmp0, r_tsptr, - offsetof(trap_state, tstate)); - } - break; - case 3: // tt - { - TCGv_ptr r_tsptr = tcg_temp_new_ptr(); - - gen_load_trap_state_at_tl(r_tsptr, tcg_env); - tcg_gen_ld32s_tl(cpu_tmp0, r_tsptr, - offsetof(trap_state, tt)); - } - break; - case 4: // tick - { - TCGv_ptr r_tickptr; - TCGv_i32 r_const; - - r_tickptr = tcg_temp_new_ptr(); - r_const = tcg_constant_i32(dc->mem_idx); - tcg_gen_ld_ptr(r_tickptr, tcg_env, - offsetof(CPUSPARCState, tick)); - if (translator_io_start(&dc->base)) { - dc->base.is_jmp = DISAS_EXIT; - } - gen_helper_tick_get_count(cpu_tmp0, tcg_env, - r_tickptr, r_const); - } - break; - case 5: // tba - tcg_gen_mov_tl(cpu_tmp0, cpu_tbr); - break; - case 6: // pstate - tcg_gen_ld32s_tl(cpu_tmp0, tcg_env, - offsetof(CPUSPARCState, pstate)); - break; - case 7: // tl - tcg_gen_ld32s_tl(cpu_tmp0, tcg_env, - offsetof(CPUSPARCState, tl)); - break; - case 8: // pil - tcg_gen_ld32s_tl(cpu_tmp0, tcg_env, - offsetof(CPUSPARCState, psrpil)); - break; - case 9: // cwp - gen_helper_rdcwp(cpu_tmp0, tcg_env); - break; - case 10: // cansave - tcg_gen_ld32s_tl(cpu_tmp0, tcg_env, - offsetof(CPUSPARCState, cansave)); - break; - case 11: // canrestore - tcg_gen_ld32s_tl(cpu_tmp0, tcg_env, - offsetof(CPUSPARCState, canrestore)); - break; - case 12: // cleanwin - tcg_gen_ld32s_tl(cpu_tmp0, tcg_env, - offsetof(CPUSPARCState, cleanwin)); - break; - case 13: // otherwin - tcg_gen_ld32s_tl(cpu_tmp0, tcg_env, - offsetof(CPUSPARCState, otherwin)); - break; - case 14: // wstate - tcg_gen_ld32s_tl(cpu_tmp0, tcg_env, - offsetof(CPUSPARCState, wstate)); - break; - case 16: // UA2005 gl - CHECK_IU_FEATURE(dc, GL); - tcg_gen_ld32s_tl(cpu_tmp0, tcg_env, - offsetof(CPUSPARCState, gl)); - break; - case 26: // UA2005 strand status - CHECK_IU_FEATURE(dc, HYPV); - if (!hypervisor(dc)) - goto priv_insn; - tcg_gen_mov_tl(cpu_tmp0, cpu_ssr); - break; - case 31: // ver - tcg_gen_mov_tl(cpu_tmp0, cpu_ver); - break; - case 15: // fq - default: - goto illegal_insn; - } -#else - tcg_gen_ext_i32_tl(cpu_tmp0, cpu_wim); -#endif - gen_store_gpr(dc, rd, cpu_tmp0); - break; - } -#endif #if defined(TARGET_SPARC64) || !defined(CONFIG_USER_ONLY) if (xop == 0x2b) { /* rdtbr / V9 flushw */ #ifdef TARGET_SPARC64 @@ -4424,7 +4510,7 @@ static void disas_sparc_legacy(DisasContext *dc, unsigned int insn) TCGv_ptr r_tsptr; r_tsptr = tcg_temp_new_ptr(); - gen_load_trap_state_at_tl(r_tsptr, tcg_env); + gen_load_trap_state_at_tl(r_tsptr); tcg_gen_st_tl(cpu_tmp0, r_tsptr, offsetof(trap_state, tpc)); } @@ -4434,7 +4520,7 @@ static void disas_sparc_legacy(DisasContext *dc, unsigned int insn) TCGv_ptr r_tsptr; r_tsptr = tcg_temp_new_ptr(); - gen_load_trap_state_at_tl(r_tsptr, tcg_env); + gen_load_trap_state_at_tl(r_tsptr); tcg_gen_st_tl(cpu_tmp0, r_tsptr, offsetof(trap_state, tnpc)); } @@ -4444,7 +4530,7 @@ static void disas_sparc_legacy(DisasContext *dc, unsigned int insn) TCGv_ptr r_tsptr; r_tsptr = tcg_temp_new_ptr(); - gen_load_trap_state_at_tl(r_tsptr, tcg_env); + gen_load_trap_state_at_tl(r_tsptr); tcg_gen_st_tl(cpu_tmp0, r_tsptr, offsetof(trap_state, tstate)); @@ -4455,7 +4541,7 @@ static void disas_sparc_legacy(DisasContext *dc, unsigned int insn) TCGv_ptr r_tsptr; r_tsptr = tcg_temp_new_ptr(); - gen_load_trap_state_at_tl(r_tsptr, tcg_env); + gen_load_trap_state_at_tl(r_tsptr); tcg_gen_st32_tl(cpu_tmp0, r_tsptr, offsetof(trap_state, tt)); } @@ -5884,9 +5970,7 @@ void sparc_tcg_init(void) { &cpu_pc, offsetof(CPUSPARCState, pc), "pc" }, { &cpu_npc, offsetof(CPUSPARCState, npc), "npc" }, { &cpu_y, offsetof(CPUSPARCState, y), "y" }, -#ifndef CONFIG_USER_ONLY { &cpu_tbr, offsetof(CPUSPARCState, tbr), "tbr" }, -#endif }; unsigned int i; From patchwork Sun Oct 22 05:59:25 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 736982 Delivered-To: patch@linaro.org Received: by 2002:adf:dd81:0:b0:32d:baff:b0ca with SMTP id x1csp1006113wrl; Sat, 21 Oct 2023 23:13:52 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFOGs0xj+VmYtLpg7vU+ou+FGwFyHNzx8mUmeQR15ALfJ1fZ5eMYa+nm5HtOcpd3bDt2OzI X-Received: by 2002:a0c:b405:0:b0:65d:afc:3a69 with SMTP id u5-20020a0cb405000000b0065d0afc3a69mr6521482qve.6.1697955231962; Sat, 21 Oct 2023 23:13:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697955231; cv=none; d=google.com; s=arc-20160816; b=R2Aan48L8+tMOuAATHJYH8/ezU+KZLQd/Md0eHlqNsR4io9nIonFCTq+fSXa3d0Wvw Ea0EbAVWaR1lf7T3ngo6vNhBQs/SAOIx4Ysca3MZpoqOqv9sf37ZpRn36wiFczYAwqQj YpNOS7UlJtZ5roCoQBpKB/IcotpmX4/hVeMug0e9RLPbpytpwe1rPQirXSqEOGKnaFgZ bgP00rbGKi5aP9t4zj3qi3CfibjRfMYhzEPgVHi8CUw0upUrwr4ffAz1FDBCUs1IsYpX ReRO9l3Gq1nuKSFHzIaeCcHJKeeFvpiQtI7/zlWNp0DeppcVcqOinQmWWZZVsZlAc2Mb zniw== 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=asz40augiXcc49Y45ipmViblriY/2MT+gl4uuC0pd+Y=; fh=TYrED6TOMxGX0VC4GtjviASLbYyJe19+7/tKWjN44KQ=; b=owc0MIi90Q/21EY+lOkX6rqwZ5yRUSAihmhFc6n57oh/bjM4mn7Xp1+brEV5XTM67Z p5+GG+24gd5XB5lQpJAf8nAD4EczYxkMidW8IHQMm4MPTuW4hFq12X+D2OBUMwfByMZ3 pygwa3ctoxpnEe0/Y+gqsDq7Q+71MGvIFgEw42OKSd71TPLR0SDKeay/YFb77sUfqMhN swrIhmAhq3rVFS/aPL//hDctE0B5WWn5SVtNE4l7fklNf2NduueoOwGYrC+nFW9Nl0hF RoZZAoKq2xjarzOEjcTnZAoEmXsPOWW+TvFHLcRYHmfBermBCmHBgYyzVRtyrgiOQoI0 odKg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=lCo+p6eN; 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 oh8-20020a056214438800b0066d1385b824si3915418qvb.544.2023.10.21.23.13.51 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sat, 21 Oct 2023 23:13:51 -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=lCo+p6eN; 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 1quRWQ-0000e1-F1; Sun, 22 Oct 2023 02:01:10 -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 1quRWB-0000Zv-Ip for qemu-devel@nongnu.org; Sun, 22 Oct 2023 02:00:56 -0400 Received: from mail-il1-x12e.google.com ([2607:f8b0:4864:20::12e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1quRW9-0001aB-WF for qemu-devel@nongnu.org; Sun, 22 Oct 2023 02:00:55 -0400 Received: by mail-il1-x12e.google.com with SMTP id e9e14a558f8ab-357a69dde08so9869935ab.1 for ; Sat, 21 Oct 2023 23:00:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1697954453; x=1698559253; 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=asz40augiXcc49Y45ipmViblriY/2MT+gl4uuC0pd+Y=; b=lCo+p6eNnlwDZ+C2tG99Z1/FhGHv/lKGSynaGmqhoynVIeYEpEcaIo5jOeHOqH98Q0 CVjyPvBiPyi9TH7KfmACWDOyFbm4j/MZ35WHBj7MTypXWLPcPr0REWJ1NsicSW754nwi BB3X/fGYDFStBkMxPdoS5K/qLhs3XUl2D+HjP9r2/VPEE4SIXGblWt2EXwgFTMtegEap DkEx2RaqzK7loc7MNtKx36BBHgeT1+RYqrBSG4qjWriA81F9rPwDHCQ8ISnSQ1qDUItr pUjy/bJFOzk4nDbGz7Goa1SxVnVfnbb1Q+yL9QuMhaYYUfNjkGF9aB/WITz8pTJutsXL ROCQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697954453; x=1698559253; 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=asz40augiXcc49Y45ipmViblriY/2MT+gl4uuC0pd+Y=; b=kR5MUWz3ClrQ9S51U1FMDebsq0mr/6fpZJkwaTGdcuAH6avI43k80fmnJDjbdFeZoz xqU7XHTak1RD6deCfnwJMZmAZupWVuB2mxG5vidZkk5a2+ff/dwqvG8bvLOfMR8F5qjP x6BInz+es0Ix1eUFSkUvY9wWVMunQdRW1bJRIjdNzNZWiigOzQ9I9zaEmZKZIoF8Rkiz 2n5oeBwkyJJngAu1XUooS+LmskqoWgN7nSgagbQIlcI9rZKyitY+8Sd4sW3w6vsvzGUQ aTYrropI2eCiZmEZpPbdj3tD1yKPyQb30Xws4ppvgplNXMq/4gSwereAUsqilpNAhEwA fq/w== X-Gm-Message-State: AOJu0YzYDzJgmlYvrnHUhHAyQicmJWhUPf+OzDKbbVjqYKQiamFJUCdw MkVHhOQXsYS/xUNIOTWWD6n4j+UEk1BFrHyQbH8= X-Received: by 2002:a05:6e02:1ba2:b0:349:296c:9b8a with SMTP id n2-20020a056e021ba200b00349296c9b8amr7108021ili.2.1697954452871; Sat, 21 Oct 2023 23:00:52 -0700 (PDT) Received: from stoup.. ([71.212.149.95]) by smtp.gmail.com with ESMTPSA id je17-20020a170903265100b001c728609574sm3999887plb.6.2023.10.21.23.00.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 21 Oct 2023 23:00:52 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: mark.cave-ayland@ilande.co.uk Subject: [PATCH v4 24/90] target/sparc: Move RDTBR, FLUSHW to decodetree Date: Sat, 21 Oct 2023 22:59:25 -0700 Message-Id: <20231022060031.490251-25-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231022060031.490251-1-richard.henderson@linaro.org> References: <20231022060031.490251-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::12e; envelope-from=richard.henderson@linaro.org; helo=mail-il1-x12e.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 | 5 +++++ target/sparc/translate.c | 23 +++++++++++------------ 2 files changed, 16 insertions(+), 12 deletions(-) diff --git a/target/sparc/insns.decode b/target/sparc/insns.decode index 7d91a7bc83..0b6f4c9c38 100644 --- a/target/sparc/insns.decode +++ b/target/sparc/insns.decode @@ -76,6 +76,11 @@ RDPR_gl 10 rd:5 101010 10000 0 0000000000000 RDPR_strand_status 10 rd:5 101010 11010 0 0000000000000 RDPR_ver 10 rd:5 101010 11111 0 0000000000000 +{ + FLUSHW 10 00000 101011 00000 0 0000000000000 + RDTBR 10 rd:5 101011 00000 0 0000000000000 +} + Tcc_r 10 0 cond:4 111010 rs1:5 0 cc:1 0000000 rs2:5 { # For v7, the entire simm13 field is present, but masked to 7 bits. diff --git a/target/sparc/translate.c b/target/sparc/translate.c index 0dd963776c..83659ec5b3 100644 --- a/target/sparc/translate.c +++ b/target/sparc/translate.c @@ -3497,6 +3497,7 @@ static TCGv do_rdtba(DisasContext *dc, TCGv dst) return cpu_tbr; } +TRANS(RDTBR, 32, do_rd_special, supervisor(dc), a->rd, do_rdtba) TRANS(RDPR_tba, 64, do_rd_special, supervisor(dc), a->rd, do_rdtba) static TCGv do_rdpstate(DisasContext *dc, TCGv dst) @@ -3635,6 +3636,16 @@ static TCGv do_rdver(DisasContext *dc, TCGv dst) TRANS(RDPR_ver, 64, do_rd_special, supervisor(dc), a->rd, do_rdver) +static bool trans_FLUSHW(DisasContext *dc, arg_FLUSHW *a) +{ +#ifdef TARGET_SPARC64 + gen_helper_flushw(tcg_env); + return advance_pc(dc); +#else + return false; +#endif +} + #define CHECK_IU_FEATURE(dc, FEATURE) \ if (!((dc)->def->features & CPU_FEATURE_ ## FEATURE)) \ goto illegal_insn; @@ -3665,18 +3676,6 @@ static void disas_sparc_legacy(DisasContext *dc, unsigned int insn) TCGv cpu_dst __attribute__((unused)) = tcg_temp_new(); TCGv cpu_tmp0 __attribute__((unused)); -#if defined(TARGET_SPARC64) || !defined(CONFIG_USER_ONLY) - if (xop == 0x2b) { /* rdtbr / V9 flushw */ -#ifdef TARGET_SPARC64 - gen_helper_flushw(tcg_env); -#else - if (!supervisor(dc)) - goto priv_insn; - gen_store_gpr(dc, rd, cpu_tbr); -#endif - break; - } -#endif if (xop == 0x34) { /* FPU Operations */ if (gen_trap_ifnofpu(dc)) { goto jmp_insn; From patchwork Sun Oct 22 05:59:26 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 736971 Delivered-To: patch@linaro.org Received: by 2002:adf:dd81:0:b0:32d:baff:b0ca with SMTP id x1csp1005911wrl; Sat, 21 Oct 2023 23:13:04 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHgUjVHG/2lNHS20QjMdKHWa+kwIxz/aLmqhBZ11BxU/688exRRZlkh++Umi5xb/n33bcIh X-Received: by 2002:ad4:5b85:0:b0:66d:6458:d9f8 with SMTP id 5-20020ad45b85000000b0066d6458d9f8mr8348762qvp.54.1697955184407; Sat, 21 Oct 2023 23:13:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697955184; cv=none; d=google.com; s=arc-20160816; b=samiCGF+Xe2FwrVOM0kZRTplEz9lQngHIEeR0dSrVzowbCFFb4dqHef3z/jNAgY36G 3N0eeIoUyrdZt4os3QTlV2ykCn1/t7d2RuzQBcvVyLPpXL//kKHtwgqK8AyM3U5D72wc 8VeivedZOhrnmkkdLJZejlt0zFIt7spWaK1Af0NvoC+4k9wuA7XWQrQ2vpD2oJw3hBy4 5bwm2s3cMxAvkyr/kjGgH7E8vvVLpOT77GfJpYDOHBzdxOgV9KaxIFytz7tqm7D+ulG8 AZu5Xu/tSUNKMUGLT8PUB8zY7yt9upbJbSSRR2ZMWbZ5rCwHhwYh1pujFOGFjG3Vdc0R aNMw== 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=KFbStpHsCPM8dUO0Jv4AXBBkyO0rJOhcl7c8kZjHn4s=; fh=TYrED6TOMxGX0VC4GtjviASLbYyJe19+7/tKWjN44KQ=; b=mEmgo/3ojQmRCqf3MoMwJq65+yGoMz54wezVZWj7aFFO5/0d/ymiZ74lhOKOccUttx /cCnpS9l2vHirYiFgUIIMj9XMDjBo7P98wFfm70s/oHcUnO0ewWCX0lyf7RwimXAK0xZ 0NAGby+kjPa65tBrAR4KBVisEyqMPanJu/ldppEYOL5+6DwsHcAIfGq2Q1iZFefWdOz2 Hbh0XhQG4NrbbD+9fnEOWupLMIrUm7GR6EoQ96kPA8/tNrqqFcXk7xqkHfoHCrJbJzUp vEqrCt3CY0sFIvHgvMqg3IP9lcfUTz9SkCPUBd4PLWa6X21zpS5SbpSnjPE2TovTkaWL IgHg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=zDorqomt; 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 bl11-20020a05620a1a8b00b007740257b80esi1717946qkb.311.2023.10.21.23.13.04 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sat, 21 Oct 2023 23:13:04 -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=zDorqomt; 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 1quRWQ-0000e8-0B; Sun, 22 Oct 2023 02:01:10 -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 1quRWD-0000ap-EK for qemu-devel@nongnu.org; Sun, 22 Oct 2023 02:00:58 -0400 Received: from mail-oa1-x36.google.com ([2001:4860:4864:20::36]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1quRWB-0001aW-1r for qemu-devel@nongnu.org; Sun, 22 Oct 2023 02:00:57 -0400 Received: by mail-oa1-x36.google.com with SMTP id 586e51a60fabf-1e9fbb7d88eso1744900fac.3 for ; Sat, 21 Oct 2023 23:00:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1697954454; x=1698559254; 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=KFbStpHsCPM8dUO0Jv4AXBBkyO0rJOhcl7c8kZjHn4s=; b=zDorqomt7Ckg+8PPAZDVSio7143iVFpg85DDaoMq5la7IRcXoB45lEXOX7hnR3/sOi 8HOeUU4PMwoBxp1pQxPfeLOi3qlSAFqoJITjUQpHUHf2wobPTogMkmgeX9aMSqvc0XAC 69Ecy8DE60krWNIjPUOSBdRyCYxkdALSFohBCoJ25U8X0xiIeHlNoxiYf0rrxaD958Yq oOktzddm+C1r3I4kHoNvu0nlIQLU5rU6Aj6UHvaihNXXpgMhtRNkwXQfffxVFbrIgKM0 cNS6UutgXLxhIOa9mKHIt+bl6U/pTrd+fR+9HE5AS9x/iW+ULT73PD1ZF+6nQ8nT3LwK ShvA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697954454; x=1698559254; 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=KFbStpHsCPM8dUO0Jv4AXBBkyO0rJOhcl7c8kZjHn4s=; b=q56CYjHWUPwv0EVn3D4MsCUVMW8+R/Q1tBnR+s8yYTYcKug9cTNm4xH5kDfc14gcyq WDctXMFCJstBicgDlUFm2x2slc+d4gGI5uMZcQjGM0IEIsHcSJdS5pPLhEhVn1Ggs+FE 8NDD4tajQ2UxLagS1m1UxZzxPcGo+naF1S0vIdK6Mk/oO+9G/uMZhdslmL08EtXkhDM/ JBQpRLc4OrBbiMbRBY5w1o7mIjj5ZYmZ8BKhP6gOn0AakqH8yZEV3iJfW8cIK/IWLoU2 xwK90aqHaWfHnR4MhhWBf7u/RQWIfmzHJwp2PdJEIohbX3BPrLGE9nfb3O+5I4mwQU+i Mogw== X-Gm-Message-State: AOJu0YyPPr841kosAfIGQGu1Fzy9BwXUsoTLSLqbqRBJoeAaZqWXkYWc ZEwgurfkoCRc03OqojeiktXSJuJcKYyhif8UDeY= X-Received: by 2002:a05:6870:7a3:b0:1e9:90d2:f546 with SMTP id en35-20020a05687007a300b001e990d2f546mr6777300oab.37.1697954453651; Sat, 21 Oct 2023 23:00:53 -0700 (PDT) Received: from stoup.. ([71.212.149.95]) by smtp.gmail.com with ESMTPSA id je17-20020a170903265100b001c728609574sm3999887plb.6.2023.10.21.23.00.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 21 Oct 2023 23:00:53 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: mark.cave-ayland@ilande.co.uk Subject: [PATCH v4 25/90] target/sparc: Move WRASR to decodetree Date: Sat, 21 Oct 2023 22:59:26 -0700 Message-Id: <20231022060031.490251-26-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231022060031.490251-1-richard.henderson@linaro.org> References: <20231022060031.490251-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2001:4860:4864:20::36; envelope-from=richard.henderson@linaro.org; helo=mail-oa1-x36.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 | 31 ++++ target/sparc/translate.c | 353 +++++++++++++++++++++----------------- 2 files changed, 225 insertions(+), 159 deletions(-) diff --git a/target/sparc/insns.decode b/target/sparc/insns.decode index 0b6f4c9c38..118f0f1f17 100644 --- a/target/sparc/insns.decode +++ b/target/sparc/insns.decode @@ -22,6 +22,13 @@ SETHI 00 rd:5 100 i:22 CALL 01 i:s30 +## +## Major Opcode 10 -- integer, floating-point, vis, and system insns. +## + +&r_r_ri rd rs1 rs2_or_imm imm:bool +@n_r_ri .. ..... ...... rs1:5 imm:1 rs2_or_imm:s13 &r_r_ri rd=0 + { [ STBAR 10 00000 101000 01111 0 0000000000000 @@ -44,6 +51,30 @@ CALL 01 i:s30 RDY 10 rd:5 101000 rs1:5 0 0000000000000 } +{ + [ + WRY 10 00000 110000 ..... . ............. @n_r_ri + WRCCR 10 00010 110000 ..... . ............. @n_r_ri + WRASI 10 00011 110000 ..... . ............. @n_r_ri + WRFPRS 10 00110 110000 ..... . ............. @n_r_ri + { + WRGSR 10 10011 110000 ..... . ............. @n_r_ri + WRPOWERDOWN 10 10011 110000 ..... . ............. @n_r_ri + } + WRSOFTINT_SET 10 10100 110000 ..... . ............. @n_r_ri + WRSOFTINT_CLR 10 10101 110000 ..... . ............. @n_r_ri + WRSOFTINT 10 10110 110000 ..... . ............. @n_r_ri + WRTICK_CMPR 10 10111 110000 ..... . ............. @n_r_ri + WRSTICK 10 11000 110000 ..... . ............. @n_r_ri + WRSTICK_CMPR 10 11001 110000 ..... . ............. @n_r_ri + ] + # Before v8, rs1==0 was WRY, and the rest executed as nop. + [ + NOP_v7 10 ----- 110000 ----- 0 00000000 ----- + NOP_v7 10 ----- 110000 ----- 1 -------- ----- + ] +} + { RDPSR 10 rd:5 101001 00000 0 0000000000000 RDHPR_hpstate 10 rd:5 101001 00000 0 0000000000000 diff --git a/target/sparc/translate.c b/target/sparc/translate.c index 83659ec5b3..3afeb226fa 100644 --- a/target/sparc/translate.c +++ b/target/sparc/translate.c @@ -37,10 +37,15 @@ #undef HELPER_H #ifdef TARGET_SPARC64 -#define gen_helper_rdpsr(D, E) qemu_build_not_reached() +#define gen_helper_rdpsr(D, E) qemu_build_not_reached() +#define gen_helper_power_down(E) g_assert_not_reached() #else -#define gen_helper_rdccr(D, E) qemu_build_not_reached() -#define gen_helper_rdcwp(D, 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_wrccr(E, S) qemu_build_not_reached() +#define gen_helper_set_softint(E, S) qemu_build_not_reached() +#define gen_helper_clear_softint(E, S) qemu_build_not_reached() +#define gen_helper_write_softint(E, S) qemu_build_not_reached() #endif /* Dynamic PC, must exit to main loop. */ @@ -2852,6 +2857,7 @@ static void gen_faligndata(TCGv dst, TCGv gsr, TCGv s1, TCGv s2) #define avail_ASR17(C) ((C)->def->features & CPU_FEATURE_ASR17) #define avail_GL(C) ((C)->def->features & CPU_FEATURE_GL) #define avail_HYPV(C) ((C)->def->features & CPU_FEATURE_HYPV) +#define avail_POWERDOWN(C) ((C)->def->features & CPU_FEATURE_POWERDOWN) /* Default case for non jump instructions. */ static bool advance_pc(DisasContext *dc) @@ -3053,6 +3059,10 @@ static bool trans_SETHI(DisasContext *dc, arg_SETHI *a) return advance_pc(dc); } +/* + * Major Opcode 10 -- integer, floating-point, vis, and system insns. + */ + static bool do_tcc(DisasContext *dc, int cond, int cc, int rs1, bool imm, int rs2_or_imm) { @@ -3646,6 +3656,186 @@ static bool trans_FLUSHW(DisasContext *dc, arg_FLUSHW *a) #endif } +static bool do_wr_special(DisasContext *dc, arg_r_r_ri *a, bool priv, + void (*func)(DisasContext *, TCGv)) +{ + TCGv src; + + /* For simplicity, we under-decoded the rs2 form. */ + if (!a->imm && (a->rs2_or_imm & ~0x1f)) { + return false; + } + if (!priv) { + return raise_priv(dc); + } + + if (a->rs1 == 0 && (a->imm || a->rs2_or_imm == 0)) { + src = tcg_constant_tl(a->rs2_or_imm); + } else { + TCGv src1 = gen_load_gpr(dc, a->rs1); + if (a->rs2_or_imm == 0) { + src = src1; + } else { + src = tcg_temp_new(); + if (a->imm) { + tcg_gen_xori_tl(src, src1, a->rs2_or_imm); + } else { + tcg_gen_xor_tl(src, src1, gen_load_gpr(dc, a->rs2_or_imm)); + } + } + } + func(dc, src); + return advance_pc(dc); +} + +static void do_wry(DisasContext *dc, TCGv src) +{ + tcg_gen_ext32u_tl(cpu_y, src); +} + +TRANS(WRY, ALL, do_wr_special, a, true, do_wry) + +static void do_wrccr(DisasContext *dc, TCGv src) +{ + gen_helper_wrccr(tcg_env, src); +} + +TRANS(WRCCR, 64, do_wr_special, a, true, do_wrccr) + +static void do_wrasi(DisasContext *dc, TCGv src) +{ +#ifdef TARGET_SPARC64 + TCGv tmp = tcg_temp_new(); + tcg_gen_andi_tl(tmp, src, 0xff); + tcg_gen_st32_tl(tmp, tcg_env, offsetof(CPUSPARCState, asi)); + /* End TB to notice changed ASI. */ + dc->base.is_jmp = DISAS_EXIT; +#else + qemu_build_not_reached(); +#endif +} + +TRANS(WRASI, 64, do_wr_special, a, true, do_wrasi) + +static void do_wrfprs(DisasContext *dc, TCGv src) +{ +#ifdef TARGET_SPARC64 + tcg_gen_trunc_tl_i32(cpu_fprs, src); + dc->fprs_dirty = 0; + dc->base.is_jmp = DISAS_EXIT; +#else + qemu_build_not_reached(); +#endif +} + +TRANS(WRFPRS, 64, do_wr_special, a, true, do_wrfprs) + +static void do_wrgsr(DisasContext *dc, TCGv src) +{ +#ifdef TARGET_SPARC64 + gen_trap_ifnofpu(dc); + tcg_gen_mov_tl(cpu_gsr, src); +#else + qemu_build_not_reached(); +#endif +} + +TRANS(WRGSR, 64, do_wr_special, a, true, do_wrgsr) + +static void do_wrsoftint_set(DisasContext *dc, TCGv src) +{ + gen_helper_set_softint(tcg_env, src); +} + +TRANS(WRSOFTINT_SET, 64, do_wr_special, a, supervisor(dc), do_wrsoftint_set) + +static void do_wrsoftint_clr(DisasContext *dc, TCGv src) +{ + gen_helper_clear_softint(tcg_env, src); +} + +TRANS(WRSOFTINT_CLR, 64, do_wr_special, a, supervisor(dc), do_wrsoftint_clr) + +static void do_wrsoftint(DisasContext *dc, TCGv src) +{ + gen_helper_write_softint(tcg_env, src); +} + +TRANS(WRSOFTINT, 64, do_wr_special, a, supervisor(dc), do_wrsoftint) + +static void do_wrtick_cmpr(DisasContext *dc, TCGv src) +{ +#ifdef TARGET_SPARC64 + TCGv_ptr r_tickptr = tcg_temp_new_ptr(); + + tcg_gen_mov_tl(cpu_tick_cmpr, src); + tcg_gen_ld_ptr(r_tickptr, tcg_env, offsetof(CPUSPARCState, tick)); + translator_io_start(&dc->base); + gen_helper_tick_set_limit(r_tickptr, cpu_tick_cmpr); + /* End TB to handle timer interrupt */ + dc->base.is_jmp = DISAS_EXIT; +#else + qemu_build_not_reached(); +#endif +} + +TRANS(WRTICK_CMPR, 64, do_wr_special, a, supervisor(dc), do_wrtick_cmpr) + +static void do_wrstick(DisasContext *dc, TCGv src) +{ +#ifdef TARGET_SPARC64 + TCGv_ptr r_tickptr = tcg_temp_new_ptr(); + + tcg_gen_ld_ptr(r_tickptr, tcg_env, offsetof(CPUSPARCState, stick)); + translator_io_start(&dc->base); + gen_helper_tick_set_count(r_tickptr, src); + /* End TB to handle timer interrupt */ + dc->base.is_jmp = DISAS_EXIT; +#else + qemu_build_not_reached(); +#endif +} + +TRANS(WRSTICK, 64, do_wr_special, a, supervisor(dc), do_wrstick) + +static void do_wrstick_cmpr(DisasContext *dc, TCGv src) +{ +#ifdef TARGET_SPARC64 + TCGv_ptr r_tickptr = tcg_temp_new_ptr(); + + tcg_gen_mov_tl(cpu_stick_cmpr, src); + tcg_gen_ld_ptr(r_tickptr, tcg_env, offsetof(CPUSPARCState, stick)); + translator_io_start(&dc->base); + gen_helper_tick_set_limit(r_tickptr, cpu_stick_cmpr); + /* End TB to handle timer interrupt */ + dc->base.is_jmp = DISAS_EXIT; +#else + qemu_build_not_reached(); +#endif +} + +TRANS(WRSTICK_CMPR, 64, do_wr_special, a, supervisor(dc), do_wrstick_cmpr) + +static void do_wrpowerdown(DisasContext *dc, TCGv src) +{ + save_state(dc); + gen_helper_power_down(tcg_env); +} + +TRANS(WRPOWERDOWN, POWERDOWN, do_wr_special, a, supervisor(dc), do_wrpowerdown) + +static bool trans_NOP_v7(DisasContext *dc, arg_NOP_v7 *a) +{ + /* + * TODO: Need a feature bit for sparcv8. + * In the meantime, treat all 32-bit cpus like sparcv7. + */ + if (avail_32(dc)) { + return advance_pc(dc); + } + return false; +} + #define CHECK_IU_FEATURE(dc, FEATURE) \ if (!((dc)->def->features & CPU_FEATURE_ ## FEATURE)) \ goto illegal_insn; @@ -4306,162 +4496,7 @@ static void disas_sparc_legacy(DisasContext *dc, unsigned int insn) break; #endif case 0x30: - { - cpu_tmp0 = tcg_temp_new(); - switch(rd) { - case 0: /* wry */ - tcg_gen_xor_tl(cpu_tmp0, cpu_src1, cpu_src2); - tcg_gen_andi_tl(cpu_y, cpu_tmp0, 0xffffffff); - break; -#ifndef TARGET_SPARC64 - case 0x01 ... 0x0f: /* undefined in the - SPARCv8 manual, nop - on the microSPARC - II */ - case 0x10 ... 0x1f: /* implementation-dependent - in the SPARCv8 - manual, nop on the - microSPARC II */ - if ((rd == 0x13) && (dc->def->features & - CPU_FEATURE_POWERDOWN)) { - /* LEON3 power-down */ - save_state(dc); - gen_helper_power_down(tcg_env); - } - break; -#else - case 0x2: /* V9 wrccr */ - tcg_gen_xor_tl(cpu_tmp0, cpu_src1, cpu_src2); - gen_helper_wrccr(tcg_env, cpu_tmp0); - tcg_gen_movi_i32(cpu_cc_op, CC_OP_FLAGS); - dc->cc_op = CC_OP_FLAGS; - break; - case 0x3: /* V9 wrasi */ - tcg_gen_xor_tl(cpu_tmp0, cpu_src1, cpu_src2); - tcg_gen_andi_tl(cpu_tmp0, cpu_tmp0, 0xff); - tcg_gen_st32_tl(cpu_tmp0, tcg_env, - offsetof(CPUSPARCState, asi)); - /* - * End TB to notice changed ASI. - * TODO: Could notice src1 = %g0 and IS_IMM, - * update DisasContext and not exit the TB. - */ - save_state(dc); - gen_op_next_insn(); - tcg_gen_lookup_and_goto_ptr(); - dc->base.is_jmp = DISAS_NORETURN; - break; - case 0x6: /* V9 wrfprs */ - tcg_gen_xor_tl(cpu_tmp0, cpu_src1, cpu_src2); - tcg_gen_trunc_tl_i32(cpu_fprs, cpu_tmp0); - dc->fprs_dirty = 0; - save_state(dc); - gen_op_next_insn(); - tcg_gen_exit_tb(NULL, 0); - dc->base.is_jmp = DISAS_NORETURN; - break; - case 0xf: /* V9 sir, nop if user */ -#if !defined(CONFIG_USER_ONLY) - if (supervisor(dc)) { - ; // XXX - } -#endif - break; - case 0x13: /* Graphics Status */ - if (gen_trap_ifnofpu(dc)) { - goto jmp_insn; - } - tcg_gen_xor_tl(cpu_gsr, cpu_src1, cpu_src2); - break; - case 0x14: /* Softint set */ - if (!supervisor(dc)) - goto illegal_insn; - tcg_gen_xor_tl(cpu_tmp0, cpu_src1, cpu_src2); - gen_helper_set_softint(tcg_env, cpu_tmp0); - break; - case 0x15: /* Softint clear */ - if (!supervisor(dc)) - goto illegal_insn; - tcg_gen_xor_tl(cpu_tmp0, cpu_src1, cpu_src2); - gen_helper_clear_softint(tcg_env, cpu_tmp0); - break; - case 0x16: /* Softint write */ - if (!supervisor(dc)) - goto illegal_insn; - tcg_gen_xor_tl(cpu_tmp0, cpu_src1, cpu_src2); - gen_helper_write_softint(tcg_env, cpu_tmp0); - break; - case 0x17: /* Tick compare */ -#if !defined(CONFIG_USER_ONLY) - if (!supervisor(dc)) - goto illegal_insn; -#endif - { - TCGv_ptr r_tickptr; - - tcg_gen_xor_tl(cpu_tick_cmpr, cpu_src1, - cpu_src2); - r_tickptr = tcg_temp_new_ptr(); - tcg_gen_ld_ptr(r_tickptr, tcg_env, - offsetof(CPUSPARCState, tick)); - translator_io_start(&dc->base); - gen_helper_tick_set_limit(r_tickptr, - cpu_tick_cmpr); - /* End TB to handle timer interrupt */ - dc->base.is_jmp = DISAS_EXIT; - } - break; - case 0x18: /* System tick */ -#if !defined(CONFIG_USER_ONLY) - if (!supervisor(dc)) - goto illegal_insn; -#endif - { - TCGv_ptr r_tickptr; - - tcg_gen_xor_tl(cpu_tmp0, cpu_src1, - cpu_src2); - r_tickptr = tcg_temp_new_ptr(); - tcg_gen_ld_ptr(r_tickptr, tcg_env, - offsetof(CPUSPARCState, stick)); - translator_io_start(&dc->base); - gen_helper_tick_set_count(r_tickptr, - cpu_tmp0); - /* End TB to handle timer interrupt */ - dc->base.is_jmp = DISAS_EXIT; - } - break; - case 0x19: /* System tick compare */ -#if !defined(CONFIG_USER_ONLY) - if (!supervisor(dc)) - goto illegal_insn; -#endif - { - TCGv_ptr r_tickptr; - - tcg_gen_xor_tl(cpu_stick_cmpr, cpu_src1, - cpu_src2); - r_tickptr = tcg_temp_new_ptr(); - tcg_gen_ld_ptr(r_tickptr, tcg_env, - offsetof(CPUSPARCState, stick)); - translator_io_start(&dc->base); - gen_helper_tick_set_limit(r_tickptr, - cpu_stick_cmpr); - /* End TB to handle timer interrupt */ - dc->base.is_jmp = DISAS_EXIT; - } - break; - - case 0x10: /* Performance Control */ - case 0x11: /* Performance Instrumentation - Counter */ - case 0x12: /* Dispatch Control */ -#endif - default: - goto illegal_insn; - } - } - break; + goto illegal_insn; /* WRASR in decodetree */ #if !defined(CONFIG_USER_ONLY) case 0x31: /* wrpsr, V9 saved, restored */ { From patchwork Sun Oct 22 05:59:27 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 736928 Delivered-To: patch@linaro.org Received: by 2002:adf:dd81:0:b0:32d:baff:b0ca with SMTP id x1csp1003122wrl; Sat, 21 Oct 2023 23:02:03 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHACz9wxWa29HW5upLEn/feW8u4bjuFzCwNIb+eVkYvp1z7g8qjiMyCWx8aetgZE2z8Uldj X-Received: by 2002:a05:6214:c42:b0:66d:17b4:9510 with SMTP id r2-20020a0562140c4200b0066d17b49510mr8896120qvj.15.1697954523419; Sat, 21 Oct 2023 23:02:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697954523; cv=none; d=google.com; s=arc-20160816; b=wTOz7Ps949xpRY0hzBHFwYZkjfJPy/v5Vjl9+nFkO2wZ6OyXpws1+ZG1M8msKASeqs Q7B0nnd5338dFxs2Jq0106cJSyIL/Uo6vl2YNgpI+lkeiqb7u1UgTcOdk7bzeO27VtKq MI/oYkiNu76Dtzh7gqvhyM+rzkuHhqTy5TNKfx22bmZsqxKhlSRygwXtwkmByw5i5sCg 1Az7VPcW5GW7NEGg6zrOjJMq2CMEjtF19u08h+6MN8o5qfD6kqXn8I8luE7z61z6agzD n/SRjjjTu+D021ZnngZRdaY1gXN+39p0N1IzbdHhUziUKfho/AB+c9BWTHYoKCw+CTSM ThWg== 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=07llbLREsZP4vqpSC4QzyAuMwEAvOewkAvdq2XiLjng=; fh=TYrED6TOMxGX0VC4GtjviASLbYyJe19+7/tKWjN44KQ=; b=q7J+227cQCrylnjwAWRGFblayG1q3f11ONOFGmJiYU4e7rxl88IPUlwf9bZ9uYCAo/ aIVlsqRlhmRJHEp/OF42CrhOJgA8aT7CK+RjdhdT0nyw5WeqsYZUZedgzjjule+Q5jAi XdaQLXSocX845/fK/1Mtt0oFBio2btWPBtPtR7k/KRg7ES+9AQirrOtYU+ocEPaL4DO6 sUkPoXvAEfFS3Yu6Al/zeEl9WLaoSm0JIozI3Mh5k/V+YhIuAzED8wVej5RTDapRIFTo oEdXVq0nRCe050aPdBn+QHPYbTE5X/v+SgWI1z+hUA8Yr0vnr+Bwduo1FMtJ/e+NscLe Yi7A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="x/7DqeWx"; 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 di12-20020ad458ec000000b0066ac82c4487si3691824qvb.365.2023.10.21.23.02.03 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sat, 21 Oct 2023 23:02:03 -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="x/7DqeWx"; 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 1quRWW-0000lt-QG; Sun, 22 Oct 2023 02:01:16 -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 1quRWD-0000ao-8P for qemu-devel@nongnu.org; Sun, 22 Oct 2023 02:00:58 -0400 Received: from mail-ot1-x32c.google.com ([2607:f8b0:4864:20::32c]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1quRWB-0001am-Gh for qemu-devel@nongnu.org; Sun, 22 Oct 2023 02:00:56 -0400 Received: by mail-ot1-x32c.google.com with SMTP id 46e09a7af769-6ce2cf67be2so1596366a34.2 for ; Sat, 21 Oct 2023 23:00:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1697954454; x=1698559254; 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=07llbLREsZP4vqpSC4QzyAuMwEAvOewkAvdq2XiLjng=; b=x/7DqeWxBQBZwI9FcYV22dcr+NtcrvSsIz4UYxSsVoU1WbKsgoFIX8vhUyH+GSylN7 aRz3gvAe7pDbc6Nm6J9QX37TPqEJJU85smLCJfFceuZOH+yjTt3btJQh/dJyyLMlFoJf Xaor3CkW2xhcFtpDq3z17MHsFedL1FmQVefB9ajrzqKUdLdIid3jzNMuf80f0omBoJvd rcuHIZxuiBzboKoc9Z8h8AsvzAraRHMstKIiVQTwAMmb0pKGvxXSxpnjVb7bbGoeV/ab rJWHSDC7KI0/lx8sFJqrn+OhfeWBBzTD1Pgm90R78EypDlRjBL6Ns7HoOv+lFVZ3us0a H84w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697954454; x=1698559254; 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=07llbLREsZP4vqpSC4QzyAuMwEAvOewkAvdq2XiLjng=; b=jWcf7tXu0AUu8UR2fAI0T4TH++YQryQtOYRA9sQWDYZ9ANTYkTmVIM/sx4av0uTOwj FIwx3M5+G3N+/s6vaKTG+xpb+HQwZuLPgNElhaMskr342UrkZ0WLZTGlK/fCLCXc5LND 3Q/eVztRcSvWGrlRza/9YyQMtl+nIsXwWeCWSSrn/Nick4tUfnLz4CAkdEq/r0uXyFuU mreX5q17qVnWtX4+yhrIK6MLHfugU11DQH4NapNqjJ5sGaGmMl6rrQEJ7KqDELeY9jrF xg5pOxPM21GzAFBmk2tFvaww/obWNZ1agv+3OCPPrzDML6l1UoHxJrT4Ph08D26yH3HZ vRaA== X-Gm-Message-State: AOJu0YyHLCdaCzP8W2FPFkBg9ed4AVtxWgORfxevoOde0Ql/5waGewcY yfnjaV4Fekbs9KU4OEXTTP3sQIECv4sPZ1zRVMQ= X-Received: by 2002:a05:6870:8dc7:b0:1e9:95c8:e15e with SMTP id lq7-20020a0568708dc700b001e995c8e15emr8448913oab.14.1697954454419; Sat, 21 Oct 2023 23:00:54 -0700 (PDT) Received: from stoup.. ([71.212.149.95]) by smtp.gmail.com with ESMTPSA id je17-20020a170903265100b001c728609574sm3999887plb.6.2023.10.21.23.00.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 21 Oct 2023 23:00:54 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: mark.cave-ayland@ilande.co.uk Subject: [PATCH v4 26/90] target/sparc: Move WRPSR, SAVED, RESTORED to decodetree Date: Sat, 21 Oct 2023 22:59:27 -0700 Message-Id: <20231022060031.490251-27-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231022060031.490251-1-richard.henderson@linaro.org> References: <20231022060031.490251-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::32c; envelope-from=richard.henderson@linaro.org; helo=mail-ot1-x32c.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 | 10 +++++++ target/sparc/translate.c | 61 ++++++++++++++++++--------------------- 2 files changed, 38 insertions(+), 33 deletions(-) diff --git a/target/sparc/insns.decode b/target/sparc/insns.decode index 118f0f1f17..45cf47a32f 100644 --- a/target/sparc/insns.decode +++ b/target/sparc/insns.decode @@ -85,6 +85,16 @@ RDHPR_htba 10 rd:5 101001 00101 0 0000000000000 RDHPR_hver 10 rd:5 101001 00110 0 0000000000000 RDHPR_hstick_cmpr 10 rd:5 101001 11111 0 0000000000000 +{ + WRPSR 10 00000 110001 ..... . ............. @n_r_ri + SAVED 10 00000 110001 00000 0 0000000000000 +} +RESTORED 10 00001 110001 00000 0 0000000000000 +# UA2005 ALLCLEAN +# UA2005 OTHERW +# UA2005 NORMALW +# UA2005 INVALW + { RDWIM 10 rd:5 101010 00000 0 0000000000000 RDPR_tpc 10 rd:5 101010 00000 0 0000000000000 diff --git a/target/sparc/translate.c b/target/sparc/translate.c index 3afeb226fa..8d1af552f8 100644 --- a/target/sparc/translate.c +++ b/target/sparc/translate.c @@ -38,6 +38,7 @@ #ifdef TARGET_SPARC64 #define gen_helper_rdpsr(D, E) qemu_build_not_reached() +#define gen_helper_wrpsr(E, S) qemu_build_not_reached() #define gen_helper_power_down(E) g_assert_not_reached() #else #define gen_helper_rdccr(D, E) qemu_build_not_reached() @@ -46,6 +47,8 @@ #define gen_helper_set_softint(E, S) qemu_build_not_reached() #define gen_helper_clear_softint(E, S) qemu_build_not_reached() #define gen_helper_write_softint(E, S) qemu_build_not_reached() +#define gen_helper_saved ({ qemu_build_not_reached(); NULL; }) +#define gen_helper_restored ({ qemu_build_not_reached(); NULL; }) #endif /* Dynamic PC, must exit to main loop. */ @@ -3824,6 +3827,31 @@ static void do_wrpowerdown(DisasContext *dc, TCGv src) TRANS(WRPOWERDOWN, POWERDOWN, do_wr_special, a, supervisor(dc), do_wrpowerdown) +static void do_wrpsr(DisasContext *dc, TCGv src) +{ + gen_helper_wrpsr(tcg_env, src); + tcg_gen_movi_i32(cpu_cc_op, CC_OP_FLAGS); + dc->cc_op = CC_OP_FLAGS; + save_state(dc); + gen_op_next_insn(); + tcg_gen_exit_tb(NULL, 0); + dc->base.is_jmp = DISAS_NORETURN; +} + +TRANS(WRPSR, 32, do_wr_special, a, supervisor(dc), do_wrpsr) + +static bool do_saved_restored(DisasContext *dc, void (*func)(TCGv_env)) +{ + if (!supervisor(dc)) { + return raise_priv(dc); + } + func(tcg_env); + return advance_pc(dc); +} + +TRANS(SAVED, 64, do_saved_restored, gen_helper_saved) +TRANS(RESTORED, 64, do_saved_restored, gen_helper_restored) + static bool trans_NOP_v7(DisasContext *dc, arg_NOP_v7 *a) { /* @@ -4498,39 +4526,6 @@ static void disas_sparc_legacy(DisasContext *dc, unsigned int insn) case 0x30: goto illegal_insn; /* WRASR in decodetree */ #if !defined(CONFIG_USER_ONLY) - case 0x31: /* wrpsr, V9 saved, restored */ - { - if (!supervisor(dc)) - goto priv_insn; -#ifdef TARGET_SPARC64 - switch (rd) { - case 0: - gen_helper_saved(tcg_env); - break; - case 1: - gen_helper_restored(tcg_env); - break; - case 2: /* UA2005 allclean */ - case 3: /* UA2005 otherw */ - case 4: /* UA2005 normalw */ - case 5: /* UA2005 invalw */ - // XXX - default: - goto illegal_insn; - } -#else - cpu_tmp0 = tcg_temp_new(); - tcg_gen_xor_tl(cpu_tmp0, cpu_src1, cpu_src2); - gen_helper_wrpsr(tcg_env, cpu_tmp0); - tcg_gen_movi_i32(cpu_cc_op, CC_OP_FLAGS); - dc->cc_op = CC_OP_FLAGS; - save_state(dc); - gen_op_next_insn(); - tcg_gen_exit_tb(NULL, 0); - dc->base.is_jmp = DISAS_NORETURN; -#endif - } - break; case 0x32: /* wrwim, V9 wrpr */ { if (!supervisor(dc)) From patchwork Sun Oct 22 05:59:28 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 736929 Delivered-To: patch@linaro.org Received: by 2002:adf:dd81:0:b0:32d:baff:b0ca with SMTP id x1csp1003146wrl; Sat, 21 Oct 2023 23:02:08 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFtcvyUxm6n1EHOt4XtwrQSZYXUu3xfM4AHFkLqVknndUB1KE5N8+YtAJsoKUj10gOgMiEL X-Received: by 2002:a05:620a:40d6:b0:778:b559:4744 with SMTP id g22-20020a05620a40d600b00778b5594744mr3674339qko.58.1697954528012; Sat, 21 Oct 2023 23:02:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697954527; cv=none; d=google.com; s=arc-20160816; b=lhVaCDHA31HPlV+7h8gibPmeLrTVsRCqTkzaw9pTTX6qJt8/I5rq1choLokt6ohS+t LMpDVKXuJ1hgNqHVmEAZb0/3X6FeSPSMTQMCODhauoD8PhoGz7J7UvmlaR/2DnBA3s5m iC81hxkNrRmRb9GidiGKoULNx7R2uz7C4w4qquDBUPEJ4lgOvScQBA6giegKdGm1YV86 TFWydeAPa1WXQ+m4QG5ylsdlOkuZf+e8ylcP4SmNY8YZMAzOrgY72XNksaVnYTL2hHPB G6xMTunZIq1/evpq+1cWPxPCp2LOC4Gr+r2m707iwkankCH3ANAXM31o6lUQEU794QW1 CBDw== 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=VO6vWcKYJslbm9/yoJ+t3ZpT4RSCM4gjLz6Gp/K2cjk=; fh=TYrED6TOMxGX0VC4GtjviASLbYyJe19+7/tKWjN44KQ=; b=wF00f/aRIZ0OxR0snTu6++aovGwPdHT2Ncd629JO1u8pNKvLinJYSo4gLzXmeEqdv3 FA/EzkqblUGxTztHIB51CWysqXU2I8YhHSziD/I5wCTbMsisRSfR8GJVP9/2+1pV7qSP iBZfcsjL5UAQ8jMHw+W4+qFOgmB1Y3bLMoly5rHDHnoZ1ll03OKaYfgxbSddE+oWlbzz 0krtlLu6HI5pzcuB3YnHgJFItyCIAQ28xqjDH2j5Fs/z1kgH/UlOjxYr5haI6EwMytHz VqkGd6N3NH/Ax7PSTbuD0IRnXXdKjIAgqKI/V2GVucnBhR8+INwugRyaI+pmZDErEC2M NtWw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=RTbqnHkn; 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 w2-20020a05620a094200b0077419b27787si3709748qkw.177.2023.10.21.23.02.07 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sat, 21 Oct 2023 23:02:07 -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=RTbqnHkn; 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 1quRWZ-0000mj-AN; Sun, 22 Oct 2023 02:01:19 -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 1quRWE-0000ay-Rw for qemu-devel@nongnu.org; Sun, 22 Oct 2023 02:01:00 -0400 Received: from mail-pl1-x629.google.com ([2607:f8b0:4864:20::629]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1quRWC-0001b6-LC for qemu-devel@nongnu.org; Sun, 22 Oct 2023 02:00:58 -0400 Received: by mail-pl1-x629.google.com with SMTP id d9443c01a7336-1c9d3a21f7aso18144605ad.2 for ; Sat, 21 Oct 2023 23:00:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1697954455; x=1698559255; 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=VO6vWcKYJslbm9/yoJ+t3ZpT4RSCM4gjLz6Gp/K2cjk=; b=RTbqnHknc5/JeZYC492ayledlAkUk5brRfGaTDVJdfy1hqZmP27v7Bc8gHQV3desOI BWTEHhoAUpCkolGOCEWCH6vDyhvRbM397uX+ArxI5HB/ONaKKkhMZu2Fwo1VvOWcmGiH xoji3GE6z7IUZ60/C3lvZO7nHvnbT/yl5BwzHzEKdhf/zNDrP7BNX+UtYy6xI3W0U+w6 zF/lVl5x+fQkZB+FvTCl4/t9xBJkAaiFXf6MAF5/zjQXByTmU4TAM0V+wj5ps3MIWT4V 6mLfT63/cQd/dM0SlQswUBDjmhs+mFWBeTEoEUgSIrDNNMZDmR5Ib2XzhcAJMaVVZ/yA QYxg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697954455; x=1698559255; 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=VO6vWcKYJslbm9/yoJ+t3ZpT4RSCM4gjLz6Gp/K2cjk=; b=h9fAbi1madfSr4CMl6C6ZrsIbcXGdCaznM+BP/CpksgbZAXO0ubIuhxRmkVR1KD9AK eXvmBpl+qy/CLW34lism4SZeMFA74IihmnMRYduc5Tu60eCiQMTSoDAVK2wP+dBhcTpT YyZ5XHFV7U30S9ug3lG/fr+vPy1QKJ5fBnLFvzTbj36Qqr7xe9dkMBejue+dpU89rO6N sjfVDjljzRSNwaxGTSxTOMFLVIWRoZNKqIbkvckLxOP2u3Wl4K0sXF99DMW6R1AiyqUm IQz3/vj0G2Eo/PFtsZP2GSS50f7NMvwXaX9UfA32lO8X3m2HtOwlBh8mcE/OtAUFusn2 Uilg== X-Gm-Message-State: AOJu0YxXp96bW9s3UDeCYAq6uKq1O/d9IussXyPf9t/vIiOPMpnle3F7 lK5BASevvInIZ5qZ3PjiUmwE9WZZsseHIRnX2aE= X-Received: by 2002:a17:902:e0cb:b0:1c9:e85a:4296 with SMTP id e11-20020a170902e0cb00b001c9e85a4296mr5017699pla.6.1697954455166; Sat, 21 Oct 2023 23:00:55 -0700 (PDT) Received: from stoup.. ([71.212.149.95]) by smtp.gmail.com with ESMTPSA id je17-20020a170903265100b001c728609574sm3999887plb.6.2023.10.21.23.00.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 21 Oct 2023 23:00:54 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: mark.cave-ayland@ilande.co.uk Subject: [PATCH v4 27/90] target/sparc: Move WRWIM, WRPR to decodetree Date: Sat, 21 Oct 2023 22:59:28 -0700 Message-Id: <20231022060031.490251-28-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231022060031.490251-1-richard.henderson@linaro.org> References: <20231022060031.490251-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::629; envelope-from=richard.henderson@linaro.org; helo=mail-pl1-x629.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 | 21 +++ target/sparc/translate.c | 350 +++++++++++++++++++++++--------------- 2 files changed, 235 insertions(+), 136 deletions(-) diff --git a/target/sparc/insns.decode b/target/sparc/insns.decode index 45cf47a32f..f478999ee1 100644 --- a/target/sparc/insns.decode +++ b/target/sparc/insns.decode @@ -117,6 +117,27 @@ RDPR_gl 10 rd:5 101010 10000 0 0000000000000 RDPR_strand_status 10 rd:5 101010 11010 0 0000000000000 RDPR_ver 10 rd:5 101010 11111 0 0000000000000 +{ + WRWIM 10 00000 110010 ..... . ............. @n_r_ri + WRPR_tpc 10 00000 110010 ..... . ............. @n_r_ri +} +WRPR_tnpc 10 00001 110010 ..... . ............. @n_r_ri +WRPR_tstate 10 00010 110010 ..... . ............. @n_r_ri +WRPR_tt 10 00011 110010 ..... . ............. @n_r_ri +WRPR_tick 10 00100 110010 ..... . ............. @n_r_ri +WRPR_tba 10 00101 110010 ..... . ............. @n_r_ri +WRPR_pstate 10 00110 110010 ..... . ............. @n_r_ri +WRPR_tl 10 00111 110010 ..... . ............. @n_r_ri +WRPR_pil 10 01000 110010 ..... . ............. @n_r_ri +WRPR_cwp 10 01001 110010 ..... . ............. @n_r_ri +WRPR_cansave 10 01010 110010 ..... . ............. @n_r_ri +WRPR_canrestore 10 01011 110010 ..... . ............. @n_r_ri +WRPR_cleanwin 10 01100 110010 ..... . ............. @n_r_ri +WRPR_otherwin 10 01101 110010 ..... . ............. @n_r_ri +WRPR_wstate 10 01110 110010 ..... . ............. @n_r_ri +WRPR_gl 10 10000 110010 ..... . ............. @n_r_ri +WRPR_strand_status 10 11010 110010 ..... . ............. @n_r_ri + { FLUSHW 10 00000 101011 00000 0 0000000000000 RDTBR 10 rd:5 101011 00000 0 0000000000000 diff --git a/target/sparc/translate.c b/target/sparc/translate.c index 8d1af552f8..8735cf1845 100644 --- a/target/sparc/translate.c +++ b/target/sparc/translate.c @@ -44,6 +44,10 @@ #define gen_helper_rdccr(D, E) qemu_build_not_reached() #define gen_helper_rdcwp(D, E) qemu_build_not_reached() #define gen_helper_wrccr(E, S) qemu_build_not_reached() +#define gen_helper_wrcwp(E, S) qemu_build_not_reached() +#define gen_helper_wrgl(E, S) g_assert_not_reached() +#define gen_helper_wrpil(E, S) qemu_build_not_reached() +#define gen_helper_wrpstate(E, S) qemu_build_not_reached() #define gen_helper_set_softint(E, S) qemu_build_not_reached() #define gen_helper_clear_softint(E, S) qemu_build_not_reached() #define gen_helper_write_softint(E, S) qemu_build_not_reached() @@ -3840,6 +3844,214 @@ static void do_wrpsr(DisasContext *dc, TCGv src) TRANS(WRPSR, 32, do_wr_special, a, supervisor(dc), do_wrpsr) +static void do_wrwim(DisasContext *dc, TCGv src) +{ +#ifdef TARGET_SPARC64 + qemu_build_not_reached(); +#else + target_ulong mask = MAKE_64BIT_MASK(0, dc->def->nwindows); + tcg_gen_andi_tl(cpu_wim, src, mask); +#endif +} + +TRANS(WRWIM, 32, do_wr_special, a, supervisor(dc), do_wrwim) + +static void do_wrtpc(DisasContext *dc, TCGv src) +{ +#ifdef TARGET_SPARC64 + TCGv_ptr r_tsptr = tcg_temp_new_ptr(); + + gen_load_trap_state_at_tl(r_tsptr); + tcg_gen_st_tl(src, r_tsptr, offsetof(trap_state, tpc)); +#else + qemu_build_not_reached(); +#endif +} + +TRANS(WRPR_tpc, 64, do_wr_special, a, supervisor(dc), do_wrtpc) + +static void do_wrtnpc(DisasContext *dc, TCGv src) +{ +#ifdef TARGET_SPARC64 + TCGv_ptr r_tsptr = tcg_temp_new_ptr(); + + gen_load_trap_state_at_tl(r_tsptr); + tcg_gen_st_tl(src, r_tsptr, offsetof(trap_state, tnpc)); +#else + qemu_build_not_reached(); +#endif +} + +TRANS(WRPR_tnpc, 64, do_wr_special, a, supervisor(dc), do_wrtnpc) + +static void do_wrtstate(DisasContext *dc, TCGv src) +{ +#ifdef TARGET_SPARC64 + TCGv_ptr r_tsptr = tcg_temp_new_ptr(); + + gen_load_trap_state_at_tl(r_tsptr); + tcg_gen_st_tl(src, r_tsptr, offsetof(trap_state, tstate)); +#else + qemu_build_not_reached(); +#endif +} + +TRANS(WRPR_tstate, 64, do_wr_special, a, supervisor(dc), do_wrtstate) + +static void do_wrtt(DisasContext *dc, TCGv src) +{ +#ifdef TARGET_SPARC64 + TCGv_ptr r_tsptr = tcg_temp_new_ptr(); + + gen_load_trap_state_at_tl(r_tsptr); + tcg_gen_st32_tl(src, r_tsptr, offsetof(trap_state, tt)); +#else + qemu_build_not_reached(); +#endif +} + +TRANS(WRPR_tt, 64, do_wr_special, a, supervisor(dc), do_wrtt) + +static void do_wrtick(DisasContext *dc, TCGv src) +{ +#ifdef TARGET_SPARC64 + TCGv_ptr r_tickptr = tcg_temp_new_ptr(); + + tcg_gen_ld_ptr(r_tickptr, tcg_env, offsetof(CPUSPARCState, tick)); + translator_io_start(&dc->base); + gen_helper_tick_set_count(r_tickptr, src); + /* End TB to handle timer interrupt */ + dc->base.is_jmp = DISAS_EXIT; +#else + qemu_build_not_reached(); +#endif +} + +TRANS(WRPR_tick, 64, do_wr_special, a, supervisor(dc), do_wrtick) + +static void do_wrtba(DisasContext *dc, TCGv src) +{ + tcg_gen_mov_tl(cpu_tbr, src); +} + +TRANS(WRPR_tba, 64, do_wr_special, a, supervisor(dc), do_wrtba) + +static void do_wrpstate(DisasContext *dc, TCGv src) +{ + save_state(dc); + if (translator_io_start(&dc->base)) { + dc->base.is_jmp = DISAS_EXIT; + } + gen_helper_wrpstate(tcg_env, src); + dc->npc = DYNAMIC_PC; +} + +TRANS(WRPR_pstate, 64, do_wr_special, a, supervisor(dc), do_wrpstate) + +static void do_wrtl(DisasContext *dc, TCGv src) +{ +#ifdef TARGET_SPARC64 + save_state(dc); + tcg_gen_st32_tl(src, tcg_env, offsetof(CPUSPARCState, tl)); + dc->npc = DYNAMIC_PC; +#else + qemu_build_not_reached(); +#endif +} + +TRANS(WRPR_tl, 64, do_wr_special, a, supervisor(dc), do_wrtl) + +static void do_wrpil(DisasContext *dc, TCGv src) +{ + if (translator_io_start(&dc->base)) { + dc->base.is_jmp = DISAS_EXIT; + } + gen_helper_wrpil(tcg_env, src); +} + +TRANS(WRPR_pil, 64, do_wr_special, a, supervisor(dc), do_wrpil) + +static void do_wrcwp(DisasContext *dc, TCGv src) +{ + gen_helper_wrcwp(tcg_env, src); +} + +TRANS(WRPR_cwp, 64, do_wr_special, a, supervisor(dc), do_wrcwp) + +static void do_wrcansave(DisasContext *dc, TCGv src) +{ +#ifdef TARGET_SPARC64 + tcg_gen_st32_tl(src, tcg_env, offsetof(CPUSPARCState, cansave)); +#else + qemu_build_not_reached(); +#endif +} + +TRANS(WRPR_cansave, 64, do_wr_special, a, supervisor(dc), do_wrcansave) + +static void do_wrcanrestore(DisasContext *dc, TCGv src) +{ +#ifdef TARGET_SPARC64 + tcg_gen_st32_tl(src, tcg_env, offsetof(CPUSPARCState, canrestore)); +#else + qemu_build_not_reached(); +#endif +} + +TRANS(WRPR_canrestore, 64, do_wr_special, a, supervisor(dc), do_wrcanrestore) + +static void do_wrcleanwin(DisasContext *dc, TCGv src) +{ +#ifdef TARGET_SPARC64 + tcg_gen_st32_tl(src, tcg_env, offsetof(CPUSPARCState, cleanwin)); +#else + qemu_build_not_reached(); +#endif +} + +TRANS(WRPR_cleanwin, 64, do_wr_special, a, supervisor(dc), do_wrcleanwin) + +static void do_wrotherwin(DisasContext *dc, TCGv src) +{ +#ifdef TARGET_SPARC64 + tcg_gen_st32_tl(src, tcg_env, offsetof(CPUSPARCState, otherwin)); +#else + qemu_build_not_reached(); +#endif +} + +TRANS(WRPR_otherwin, 64, do_wr_special, a, supervisor(dc), do_wrotherwin) + +static void do_wrwstate(DisasContext *dc, TCGv src) +{ +#ifdef TARGET_SPARC64 + tcg_gen_st32_tl(src, tcg_env, offsetof(CPUSPARCState, wstate)); +#else + qemu_build_not_reached(); +#endif +} + +TRANS(WRPR_wstate, 64, do_wr_special, a, supervisor(dc), do_wrwstate) + +static void do_wrgl(DisasContext *dc, TCGv src) +{ + gen_helper_wrgl(tcg_env, src); +} + +TRANS(WRPR_gl, GL, do_wr_special, a, supervisor(dc), do_wrgl) + +/* UA2005 strand status */ +static void do_wrssr(DisasContext *dc, TCGv src) +{ +#ifdef TARGET_SPARC64 + tcg_gen_mov_tl(cpu_ssr, src); +#else + g_assert_not_reached(); +#endif +} + +TRANS(WRPR_strand_status, HYPV, do_wr_special, a, hypervisor(dc), do_wrssr) + static bool do_saved_restored(DisasContext *dc, void (*func)(TCGv_env)) { if (!supervisor(dc)) { @@ -4526,142 +4738,8 @@ static void disas_sparc_legacy(DisasContext *dc, unsigned int insn) case 0x30: goto illegal_insn; /* WRASR in decodetree */ #if !defined(CONFIG_USER_ONLY) - case 0x32: /* wrwim, V9 wrpr */ - { - if (!supervisor(dc)) - goto priv_insn; - cpu_tmp0 = tcg_temp_new(); - tcg_gen_xor_tl(cpu_tmp0, cpu_src1, cpu_src2); -#ifdef TARGET_SPARC64 - switch (rd) { - case 0: // tpc - { - TCGv_ptr r_tsptr; - - r_tsptr = tcg_temp_new_ptr(); - gen_load_trap_state_at_tl(r_tsptr); - tcg_gen_st_tl(cpu_tmp0, r_tsptr, - offsetof(trap_state, tpc)); - } - break; - case 1: // tnpc - { - TCGv_ptr r_tsptr; - - r_tsptr = tcg_temp_new_ptr(); - gen_load_trap_state_at_tl(r_tsptr); - tcg_gen_st_tl(cpu_tmp0, r_tsptr, - offsetof(trap_state, tnpc)); - } - break; - case 2: // tstate - { - TCGv_ptr r_tsptr; - - r_tsptr = tcg_temp_new_ptr(); - gen_load_trap_state_at_tl(r_tsptr); - tcg_gen_st_tl(cpu_tmp0, r_tsptr, - offsetof(trap_state, - tstate)); - } - break; - case 3: // tt - { - TCGv_ptr r_tsptr; - - r_tsptr = tcg_temp_new_ptr(); - gen_load_trap_state_at_tl(r_tsptr); - tcg_gen_st32_tl(cpu_tmp0, r_tsptr, - offsetof(trap_state, tt)); - } - break; - case 4: // tick - { - TCGv_ptr r_tickptr; - - r_tickptr = tcg_temp_new_ptr(); - tcg_gen_ld_ptr(r_tickptr, tcg_env, - offsetof(CPUSPARCState, tick)); - translator_io_start(&dc->base); - gen_helper_tick_set_count(r_tickptr, - cpu_tmp0); - /* End TB to handle timer interrupt */ - dc->base.is_jmp = DISAS_EXIT; - } - break; - case 5: // tba - tcg_gen_mov_tl(cpu_tbr, cpu_tmp0); - break; - case 6: // pstate - save_state(dc); - if (translator_io_start(&dc->base)) { - dc->base.is_jmp = DISAS_EXIT; - } - gen_helper_wrpstate(tcg_env, cpu_tmp0); - dc->npc = DYNAMIC_PC; - break; - case 7: // tl - save_state(dc); - tcg_gen_st32_tl(cpu_tmp0, tcg_env, - offsetof(CPUSPARCState, tl)); - dc->npc = DYNAMIC_PC; - break; - case 8: // pil - if (translator_io_start(&dc->base)) { - dc->base.is_jmp = DISAS_EXIT; - } - gen_helper_wrpil(tcg_env, cpu_tmp0); - break; - case 9: // cwp - gen_helper_wrcwp(tcg_env, cpu_tmp0); - break; - case 10: // cansave - tcg_gen_st32_tl(cpu_tmp0, tcg_env, - offsetof(CPUSPARCState, - cansave)); - break; - case 11: // canrestore - tcg_gen_st32_tl(cpu_tmp0, tcg_env, - offsetof(CPUSPARCState, - canrestore)); - break; - case 12: // cleanwin - tcg_gen_st32_tl(cpu_tmp0, tcg_env, - offsetof(CPUSPARCState, - cleanwin)); - break; - case 13: // otherwin - tcg_gen_st32_tl(cpu_tmp0, tcg_env, - offsetof(CPUSPARCState, - otherwin)); - break; - case 14: // wstate - tcg_gen_st32_tl(cpu_tmp0, tcg_env, - offsetof(CPUSPARCState, - wstate)); - break; - case 16: // UA2005 gl - CHECK_IU_FEATURE(dc, GL); - gen_helper_wrgl(tcg_env, cpu_tmp0); - break; - case 26: // UA2005 strand status - CHECK_IU_FEATURE(dc, HYPV); - if (!hypervisor(dc)) - goto priv_insn; - tcg_gen_mov_tl(cpu_ssr, cpu_tmp0); - break; - default: - goto illegal_insn; - } -#else - tcg_gen_trunc_tl_i32(cpu_wim, cpu_tmp0); - if (dc->def->nwindows != 32) { - tcg_gen_andi_tl(cpu_wim, cpu_wim, - (1 << dc->def->nwindows) - 1); - } -#endif - } - break; + case 0x32: + goto illegal_insn; /* WRPR in decodetree */ case 0x33: /* wrtbr, UA2005 wrhpr */ { #ifndef TARGET_SPARC64 From patchwork Sun Oct 22 05:59:29 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 736937 Delivered-To: patch@linaro.org Received: by 2002:adf:dd81:0:b0:32d:baff:b0ca with SMTP id x1csp1003956wrl; Sat, 21 Oct 2023 23:05:00 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEwIPreS8WEXNgqaejNt8QKFkDH/JjVgAM5DN349iUM/NJjPr49QCjAW9mW8msxF1nO2HDh X-Received: by 2002:a05:6214:20ea:b0:66d:15be:1c6b with SMTP id 10-20020a05621420ea00b0066d15be1c6bmr8221905qvk.65.1697954700457; Sat, 21 Oct 2023 23:05:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697954700; cv=none; d=google.com; s=arc-20160816; b=048SYfoL/UcyAaheEfHs2IKNWsuyM8VaAPv1n+JoGYLJU4RiaTMyX8FTix00Az1Yla pxtBOeO0BDIBwQ/ScpgOky2WeIz2T0NfP+QNvWuKl5dZduZ0qwVgcrXMTB4nLuMklPME 2aL5qh5C4SvSoVAIl6djsjtXATrqRs8pTKQLTUhTX3JOCc9w5xecmCgO/pWwhvSwKXaN QLcunhy/DI6Chv5eeRuKOfoXV+7rF2/I9oCso1I2b6kHYsOMZEbmUOY2ic56kfb9F47O FOfvUkmd8EPIJ1DOgIBR0OBbLVlrAqOzEXdKX6yYFQqmzfj9yZuBiejUFldW/SSzrUCV rThQ== 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=2mMYmKwJtPq/+64v43x89L2IhKcuVN5x2HBXcrC0/Jw=; fh=TYrED6TOMxGX0VC4GtjviASLbYyJe19+7/tKWjN44KQ=; b=sT5UU72R5ZUWodbnVV35tf3wkPz26SbMuE57fIvPx0yTOX5LMZ5+UTwssSzUApCDBF /L1ORi/i+u39lNasydMAGxJOCTGjTYdl81ye4qcw1Gik7l02UwUJOjXN5Dg869+AgTnK mDbTi3c7/2qh9XRiEy655WPWaKElgyMiXipottq7CN9ELgpw7siuJtBJdTUPE/LdOhV8 ouVMC+WtRzQOSWjyXdF54tfSRDpjymuftNk+VpGyNu5XsjNGR4xkEMhY74EAyoXCeTFo WKuvW5dgI5YitrMeej9mhDfZ32jkrJrkzw1fF4C5FHPFj7M3JpcEPJC+ACP1MLBIvXeE ZJXQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="Gs/9jXvc"; 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 jo15-20020a056214500f00b0065b13b5cbe9si4140327qvb.459.2023.10.21.23.05.00 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sat, 21 Oct 2023 23:05:00 -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="Gs/9jXvc"; 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 1quRWU-0000kf-8p; Sun, 22 Oct 2023 02:01:14 -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 1quRWF-0000b2-3R for qemu-devel@nongnu.org; Sun, 22 Oct 2023 02:01:00 -0400 Received: from mail-pf1-x436.google.com ([2607:f8b0:4864:20::436]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1quRWD-0001bN-Ax for qemu-devel@nongnu.org; Sun, 22 Oct 2023 02:00:58 -0400 Received: by mail-pf1-x436.google.com with SMTP id d2e1a72fcca58-6b20a48522fso1748960b3a.1 for ; Sat, 21 Oct 2023 23:00:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1697954456; x=1698559256; 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=2mMYmKwJtPq/+64v43x89L2IhKcuVN5x2HBXcrC0/Jw=; b=Gs/9jXvcz8wPlvfweLZBU/o6nfY/Dem51XDTri9wfNaQ+Sa2G788XJLiQyR6LSJv4m lyDNOTWYfSqHJYZJ5TgpgtXYoNE5DezP8fBMFwarZABAKrmAP539bFl9Zr+IFc/orVnv lua1mGZPKK17JJHIbt2pGeEDjGhhbqphBnlZ7xgnN4K0bAqsQd3YJWP6fEwg6dMWl3xV jy3QzNt6eBK5x19cqNL3bwGP37IduezAIDz2fOf72Jyh2Zmn+BZU/0oCpSeX79tj/miB yigyg2+BRbDfxopiON4UWitKvXaosoziDEvpRWfJLEfX77AO/gVvebCtOZdIVU20eEpf u8dA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697954456; x=1698559256; 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=2mMYmKwJtPq/+64v43x89L2IhKcuVN5x2HBXcrC0/Jw=; b=aX+P0BrokLTmn8ohDjMUslM9QawTC/nCd+Me/fBTaIrSI2KlNZT5ghhkZGciuZRWxH WaRFwdpcoYQ6iZm6Eupiix7LOMhVwBV598LPsPArD8xSrH1xqjSF3R0vcwexEQxQAU7T Oy0wDf6GTF6azKlzD2HJmp7BEfbWZ2kgLlgh1mmHs0ZPp0+aIZOT/+PdrLeKa/mMlB/i r/44qOILzsz4AoeUKBPZBiSyF0uX0vib/ku+ZtufGFQ71RT4a+lSzk2heVDxy6ph1SuQ ITJFsWzIeGMwlJCQsnD/ksrOiDTi7PDHmthDfB3tGuws+YWpAWvgjOKly5idhw5cisHh plgg== X-Gm-Message-State: AOJu0YwUhNuXnadz8rvqiYMJo9oWHWaGaUStJ2SlWFlM1qxBu6IhZ2lc 7GyN0zu7M3QNO+autS099LWVtj5a05uPIsT6Nzs= X-Received: by 2002:a05:6a20:4e1a:b0:15d:e8ce:145 with SMTP id gk26-20020a056a204e1a00b0015de8ce0145mr4064378pzb.21.1697954456050; Sat, 21 Oct 2023 23:00:56 -0700 (PDT) Received: from stoup.. ([71.212.149.95]) by smtp.gmail.com with ESMTPSA id je17-20020a170903265100b001c728609574sm3999887plb.6.2023.10.21.23.00.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 21 Oct 2023 23:00:55 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: mark.cave-ayland@ilande.co.uk Subject: [PATCH v4 28/90] target/sparc: Move WRTBR, WRHPR to decodetree Date: Sat, 21 Oct 2023 22:59:29 -0700 Message-Id: <20231022060031.490251-29-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231022060031.490251-1-richard.henderson@linaro.org> References: <20231022060031.490251-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::436; envelope-from=richard.henderson@linaro.org; helo=mail-pf1-x436.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 Implement htstate in the obvious way. Signed-off-by: Richard Henderson --- target/sparc/insns.decode | 9 +++ target/sparc/translate.c | 130 ++++++++++++++++++++++---------------- 2 files changed, 85 insertions(+), 54 deletions(-) diff --git a/target/sparc/insns.decode b/target/sparc/insns.decode index f478999ee1..eab737fdcc 100644 --- a/target/sparc/insns.decode +++ b/target/sparc/insns.decode @@ -143,6 +143,15 @@ WRPR_strand_status 10 11010 110010 ..... . ............. @n_r_ri RDTBR 10 rd:5 101011 00000 0 0000000000000 } +{ + WRTBR 10 00000 110011 ..... . ............. @n_r_ri + WRHPR_hpstate 10 00000 110011 ..... . ............. @n_r_ri +} +WRHPR_htstate 10 00001 110011 ..... . ............. @n_r_ri +WRHPR_hintp 10 00011 110011 ..... . ............. @n_r_ri +WRHPR_htba 10 00101 110011 ..... . ............. @n_r_ri +WRHPR_hstick_cmpr 10 11111 110011 ..... . ............. @n_r_ri + Tcc_r 10 0 cond:4 111010 rs1:5 0 cc:1 0000000 rs2:5 { # For v7, the entire simm13 field is present, but masked to 7 bits. diff --git a/target/sparc/translate.c b/target/sparc/translate.c index 8735cf1845..ea991bf1f8 100644 --- a/target/sparc/translate.c +++ b/target/sparc/translate.c @@ -4052,6 +4052,81 @@ static void do_wrssr(DisasContext *dc, TCGv src) TRANS(WRPR_strand_status, HYPV, do_wr_special, a, hypervisor(dc), do_wrssr) +TRANS(WRTBR, 32, do_wr_special, a, supervisor(dc), do_wrtba) + +static void do_wrhpstate(DisasContext *dc, TCGv src) +{ +#ifdef TARGET_SPARC64 + tcg_gen_st_i64(src, tcg_env, offsetof(CPUSPARCState, hpstate)); + dc->base.is_jmp = DISAS_EXIT; +#else + g_assert_not_reached(); +#endif +} + +TRANS(WRHPR_hpstate, HYPV, do_wr_special, a, hypervisor(dc), do_wrhpstate) + +static void do_wrhtstate(DisasContext *dc, TCGv src) +{ +#ifdef TARGET_SPARC64 + TCGv_i32 tl = tcg_temp_new_i32(); + TCGv_ptr tp = tcg_temp_new_ptr(); + + tcg_gen_ld_i32(tl, tcg_env, offsetof(CPUSPARCState, tl)); + tcg_gen_andi_i32(tl, tl, MAXTL_MASK); + tcg_gen_shli_i32(tl, tl, 3); + tcg_gen_ext_i32_ptr(tp, tl); + tcg_gen_add_ptr(tp, tp, tcg_env); + + tcg_gen_st_i64(src, tp, offsetof(CPUSPARCState, htstate)); +#else + qemu_build_not_reached(); +#endif +} + +TRANS(WRHPR_htstate, HYPV, do_wr_special, a, hypervisor(dc), do_wrhtstate) + +static void do_wrhintp(DisasContext *dc, TCGv src) +{ +#ifdef TARGET_SPARC64 + tcg_gen_mov_tl(cpu_hintp, src); +#else + g_assert_not_reached(); +#endif +} + +TRANS(WRHPR_hintp, HYPV, do_wr_special, a, hypervisor(dc), do_wrhintp) + +static void do_wrhtba(DisasContext *dc, TCGv src) +{ +#ifdef TARGET_SPARC64 + tcg_gen_mov_tl(cpu_htba, src); +#else + g_assert_not_reached(); +#endif +} + +TRANS(WRHPR_htba, HYPV, do_wr_special, a, hypervisor(dc), do_wrhtba) + +static void do_wrhstick_cmpr(DisasContext *dc, TCGv src) +{ +#ifdef TARGET_SPARC64 + TCGv_ptr r_tickptr = tcg_temp_new_ptr(); + + tcg_gen_mov_tl(cpu_hstick_cmpr, src); + tcg_gen_ld_ptr(r_tickptr, tcg_env, offsetof(CPUSPARCState, hstick)); + translator_io_start(&dc->base); + gen_helper_tick_set_limit(r_tickptr, cpu_hstick_cmpr); + /* End TB to handle timer interrupt */ + dc->base.is_jmp = DISAS_EXIT; +#else + g_assert_not_reached(); +#endif +} + +TRANS(WRHPR_hstick_cmpr, HYPV, do_wr_special, a, hypervisor(dc), + do_wrhstick_cmpr) + static bool do_saved_restored(DisasContext *dc, void (*func)(TCGv_env)) { if (!supervisor(dc)) { @@ -4737,63 +4812,10 @@ static void disas_sparc_legacy(DisasContext *dc, unsigned int insn) #endif case 0x30: goto illegal_insn; /* WRASR in decodetree */ -#if !defined(CONFIG_USER_ONLY) case 0x32: goto illegal_insn; /* WRPR in decodetree */ case 0x33: /* wrtbr, UA2005 wrhpr */ - { -#ifndef TARGET_SPARC64 - if (!supervisor(dc)) - goto priv_insn; - tcg_gen_xor_tl(cpu_tbr, cpu_src1, cpu_src2); -#else - CHECK_IU_FEATURE(dc, HYPV); - if (!hypervisor(dc)) - goto priv_insn; - cpu_tmp0 = tcg_temp_new(); - tcg_gen_xor_tl(cpu_tmp0, cpu_src1, cpu_src2); - switch (rd) { - case 0: // hpstate - tcg_gen_st_i64(cpu_tmp0, tcg_env, - offsetof(CPUSPARCState, - hpstate)); - save_state(dc); - gen_op_next_insn(); - tcg_gen_exit_tb(NULL, 0); - dc->base.is_jmp = DISAS_NORETURN; - break; - case 1: // htstate - // XXX gen_op_wrhtstate(); - break; - case 3: // hintp - tcg_gen_mov_tl(cpu_hintp, cpu_tmp0); - break; - case 5: // htba - tcg_gen_mov_tl(cpu_htba, cpu_tmp0); - break; - case 31: // hstick_cmpr - { - TCGv_ptr r_tickptr; - - tcg_gen_mov_tl(cpu_hstick_cmpr, cpu_tmp0); - r_tickptr = tcg_temp_new_ptr(); - tcg_gen_ld_ptr(r_tickptr, tcg_env, - offsetof(CPUSPARCState, hstick)); - translator_io_start(&dc->base); - gen_helper_tick_set_limit(r_tickptr, - cpu_hstick_cmpr); - /* End TB to handle timer interrupt */ - dc->base.is_jmp = DISAS_EXIT; - } - break; - case 6: // hver readonly - default: - goto illegal_insn; - } -#endif - } - break; -#endif + goto illegal_insn; /* WRTBR, WRHPR in decodetree */ #ifdef TARGET_SPARC64 case 0x2c: /* V9 movcc */ { From patchwork Sun Oct 22 05:59:30 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 736951 Delivered-To: patch@linaro.org Received: by 2002:adf:dd81:0:b0:32d:baff:b0ca with SMTP id x1csp1004502wrl; Sat, 21 Oct 2023 23:07:11 -0700 (PDT) X-Google-Smtp-Source: AGHT+IECx7/JK8xlh+kVFERa00eluSXBitExc36eyCB+Iu88AeYknNS4+AE7IYVaDbRpl/BvOBJT X-Received: by 2002:a05:620a:1328:b0:774:2113:743a with SMTP id p8-20020a05620a132800b007742113743amr6549072qkj.19.1697954831066; Sat, 21 Oct 2023 23:07:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697954831; cv=none; d=google.com; s=arc-20160816; b=xpQFX1GWsNMrI0qmJcA9Mf11mJmsxz19+TTGAkxFjdd9P2DCrWHw1Cd3v8STkVo7Wf DMlH77QCTH7cx4tQ76UFceAWSdy0LfvDpZZva8PHTqCrXL5txT2X7CYKYA8edrXNaxVN bhPfcvwLgQQXMbTNBEQMZWxXJ/cuFmiuQN+Z4ddDsyu6a79tnN3sBg5qtjDl0ZLPvPMZ DKuLiik7k2Fx1IDjU6BchmuzU+XQNOzugadUgfa7YySp1moP9OwAltvjbcq6U8EHZi0K eKJHW9QBiqoSmzjIv3d6JagptZ7uyAZGjWvEOepZvo9AlvqcbzQD1hX+vz3zAh4OM9ZK tvvw== 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=nU6gypuub1y/zjRqrVVCB9wTdncPmAOVb9ayhPvvYrM=; fh=TYrED6TOMxGX0VC4GtjviASLbYyJe19+7/tKWjN44KQ=; b=szHNbQulwo+5XP89RaZnidLwF+DXw3R6VA/D4kAMPisGrCAdq8YfkmxRoi6QrVrv2E CeCAhVZEg94HKaj1d+ATXdj1yqnQ3MvV0A4XAw3lxZyuJ4Y3OS0KTCH/ym0+Fcd8qTTE XeZCgGSxcsZZkIMFjs5CEP8CeoVAuKc3gcpyuZlkqC3Ogncuwm/tD/0QXL2QqOalUB9r NGe/rhr0pggyIZr0iGh8oZo6Q97gg11SxHM2d+6eVYJSz6gswKPFzHkHrGbtETdU5Ev6 kNs35hZHYdyZJi06nUDTMFzSI68KNOL20kX1/1xp9QKju40+yx/M8nwIrqcXSeZhaB3C xR/g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=u8y3RSv6; 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 f10-20020a05620a408a00b0076787a8a594si3747610qko.205.2023.10.21.23.07.10 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sat, 21 Oct 2023 23:07:11 -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=u8y3RSv6; 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 1quRWT-0000jR-IL; Sun, 22 Oct 2023 02:01:13 -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 1quRWG-0000b5-At for qemu-devel@nongnu.org; Sun, 22 Oct 2023 02:01:00 -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 1quRWE-0001bu-D7 for qemu-devel@nongnu.org; Sun, 22 Oct 2023 02:01:00 -0400 Received: by mail-pf1-x42f.google.com with SMTP id d2e1a72fcca58-6b6f4c118b7so1761082b3a.0 for ; Sat, 21 Oct 2023 23:00:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1697954457; x=1698559257; 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=nU6gypuub1y/zjRqrVVCB9wTdncPmAOVb9ayhPvvYrM=; b=u8y3RSv6W7qG93WW9Xi1D2vJ/I7C9GnSPrSezQl9tq1PALEPoLzI4bm03QBlJzXYWx txkiFXJO/TUFuUQAVlGH6sVkYbo+WgH3V1AUBfu6ZotdQ3kBHBmDbqNyoKivYL512PqF mL2bYkfyU7BoZWN0fJWgxUr7VVS15sLVzH21TFf/Ph0orHJ91iiIvBKV6p6SHYxS+ltS 7WBOXIyRUcy151+Oy7FFd+hDyCkRuM9bmHbpqm8m6hKYe8BDjmGd/g/PrCND2J3LKU2c bxJBdjUOsaluKyjgdgmWVWpC7JHgmaUfgDDO24ZRbGB4jcGwG59aHpB09Msi4OONInGY 3b8A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697954457; x=1698559257; 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=nU6gypuub1y/zjRqrVVCB9wTdncPmAOVb9ayhPvvYrM=; b=ZCSSz8zE3W+N2dqPEeeJA47PnDF7kOxze62mKLz9fe7NvFInphWfTRv5NJ23W+NJnh WVwev/D8ZLY8pSzF9BYuJhWW/rCe9uKIlWWTaAXhsE/lqNoFLvD/kw4tMGiU6g5xtOLE UaxIDyVKkONy2LgyTmEb4rrAQDiHL5G5xJY47zl3Q3+i0WSDRJjw344EwEoJK/CEMOMd 4g/qwfJnAcNzCtynp9wKIQk26EqdOeCH4EbGjkIhcgfQrZRniLIm/tH6cc9xeZ3YdhvJ 0Z1LcyyQT1+YiCoSeveewliDNIupxhA2Pnm+yDaslqUCOMNz4r5J8a5Yphs+ZJto+tj9 4Y3w== X-Gm-Message-State: AOJu0YyJHYAVm37T/TIKiU6FrOiAGc55sKxCVWST//p7M6tlWbeJtopt lsmzo8G+50iponpIdphUkuQTej2Cq/mIWRPpjXc= X-Received: by 2002:a05:6a21:7807:b0:159:e0b9:bd02 with SMTP id be7-20020a056a21780700b00159e0b9bd02mr4400407pzc.40.1697954457031; Sat, 21 Oct 2023 23:00:57 -0700 (PDT) Received: from stoup.. ([71.212.149.95]) by smtp.gmail.com with ESMTPSA id je17-20020a170903265100b001c728609574sm3999887plb.6.2023.10.21.23.00.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 21 Oct 2023 23:00:56 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: mark.cave-ayland@ilande.co.uk Subject: [PATCH v4 29/90] target/sparc: Move basic arithmetic to decodetree Date: Sat, 21 Oct 2023 22:59:30 -0700 Message-Id: <20231022060031.490251-30-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231022060031.490251-1-richard.henderson@linaro.org> References: <20231022060031.490251-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 Move ADD, AND, OR, XOR, SUB, ANDN, ORN, XORN. Signed-off-by: Richard Henderson --- target/sparc/insns.decode | 12 +++ target/sparc/translate.c | 178 ++++++++++++++++---------------------- 2 files changed, 87 insertions(+), 103 deletions(-) diff --git a/target/sparc/insns.decode b/target/sparc/insns.decode index eab737fdcc..3271c2997d 100644 --- a/target/sparc/insns.decode +++ b/target/sparc/insns.decode @@ -29,6 +29,9 @@ CALL 01 i:s30 &r_r_ri rd rs1 rs2_or_imm imm:bool @n_r_ri .. ..... ...... rs1:5 imm:1 rs2_or_imm:s13 &r_r_ri rd=0 +&r_r_ri_cc rd rs1 rs2_or_imm imm:bool cc:bool +@r_r_ri_cc .. rd:5 . cc:1 .... rs1:5 imm:1 rs2_or_imm:s13 &r_r_ri_cc + { [ STBAR 10 00000 101000 01111 0 0000000000000 @@ -152,6 +155,15 @@ WRHPR_hintp 10 00011 110011 ..... . ............. @n_r_ri WRHPR_htba 10 00101 110011 ..... . ............. @n_r_ri WRHPR_hstick_cmpr 10 11111 110011 ..... . ............. @n_r_ri +ADD 10 ..... 0.0000 ..... . ............. @r_r_ri_cc +AND 10 ..... 0.0001 ..... . ............. @r_r_ri_cc +OR 10 ..... 0.0010 ..... . ............. @r_r_ri_cc +XOR 10 ..... 0.0011 ..... . ............. @r_r_ri_cc +SUB 10 ..... 0.0100 ..... . ............. @r_r_ri_cc +ANDN 10 ..... 0.0101 ..... . ............. @r_r_ri_cc +ORN 10 ..... 0.0110 ..... . ............. @r_r_ri_cc +XORN 10 ..... 0.0111 ..... . ............. @r_r_ri_cc + Tcc_r 10 0 cond:4 111010 rs1:5 0 cc:1 0000000 rs2:5 { # For v7, the entire simm13 field is present, but masked to 7 bits. diff --git a/target/sparc/translate.c b/target/sparc/translate.c index ea991bf1f8..4bb545e9c5 100644 --- a/target/sparc/translate.c +++ b/target/sparc/translate.c @@ -4151,6 +4151,81 @@ static bool trans_NOP_v7(DisasContext *dc, arg_NOP_v7 *a) return false; } +static bool do_arith(DisasContext *dc, arg_r_r_ri_cc *a, int cc_op, + void (*func)(TCGv, TCGv, TCGv), + void (*funci)(TCGv, TCGv, target_long)) +{ + TCGv dst, src1; + + /* For simplicity, we under-decoded the rs2 form. */ + if (!a->imm && a->rs2_or_imm & ~0x1f) { + return false; + } + + if (a->cc) { + dst = cpu_cc_dst; + } else { + dst = gen_dest_gpr(dc, a->rd); + } + src1 = gen_load_gpr(dc, a->rs1); + + if (a->imm || a->rs2_or_imm == 0) { + if (funci) { + funci(dst, src1, a->rs2_or_imm); + } else { + func(dst, src1, tcg_constant_tl(a->rs2_or_imm)); + } + } else { + func(dst, src1, cpu_regs[a->rs2_or_imm]); + } + gen_store_gpr(dc, a->rd, dst); + + if (a->cc) { + tcg_gen_movi_i32(cpu_cc_op, cc_op); + dc->cc_op = cc_op; + } + return advance_pc(dc); +} + +TRANS(AND, ALL, do_arith, a, CC_OP_LOGIC, tcg_gen_and_tl, tcg_gen_andi_tl) +TRANS(XOR, ALL, do_arith, a, CC_OP_LOGIC, tcg_gen_xor_tl, tcg_gen_xori_tl) +TRANS(ANDN, ALL, do_arith, a, CC_OP_LOGIC, tcg_gen_andc_tl, NULL) +TRANS(ORN, ALL, do_arith, a, CC_OP_LOGIC, tcg_gen_orc_tl, NULL) +TRANS(XORN, ALL, do_arith, a, CC_OP_LOGIC, tcg_gen_eqv_tl, NULL) + +static bool trans_OR(DisasContext *dc, arg_r_r_ri_cc *a) +{ + /* OR with %g0 is the canonical alias for MOV. */ + if (!a->cc && a->rs1 == 0) { + if (a->imm || a->rs2_or_imm == 0) { + gen_store_gpr(dc, a->rd, tcg_constant_tl(a->rs2_or_imm)); + } else if (a->rs2_or_imm & ~0x1f) { + /* For simplicity, we under-decoded the rs2 form. */ + return false; + } else { + gen_store_gpr(dc, a->rd, cpu_regs[a->rs2_or_imm]); + } + return advance_pc(dc); + } + return do_arith(dc, a, CC_OP_LOGIC, tcg_gen_or_tl, tcg_gen_ori_tl); +} + +static bool trans_ADD(DisasContext *dc, arg_r_r_ri_cc *a) +{ + if (a->cc) { + return do_arith(dc, a, CC_OP_ADD, gen_op_add_cc, NULL); + } + return do_arith(dc, a, -1, tcg_gen_add_tl, tcg_gen_addi_tl); +} + +static bool trans_SUB(DisasContext *dc, arg_r_r_ri_cc *a) +{ + if (a->cc) { + return do_arith(dc, a, CC_OP_SUB, gen_op_sub_cc, NULL); + } + return do_arith(dc, a, -1, tcg_gen_sub_tl, tcg_gen_subi_tl); +} + #define CHECK_IU_FEATURE(dc, FEATURE) \ if (!((dc)->def->features & CPU_FEATURE_ ## FEATURE)) \ goto illegal_insn; @@ -4499,43 +4574,6 @@ static void disas_sparc_legacy(DisasContext *dc, unsigned int insn) default: goto illegal_insn; } - } else if (xop == 0x2) { - TCGv dst = gen_dest_gpr(dc, rd); - rs1 = GET_FIELD(insn, 13, 17); - if (rs1 == 0) { - /* clr/mov shortcut : or %g0, x, y -> mov x, y */ - if (IS_IMM) { /* immediate */ - simm = GET_FIELDs(insn, 19, 31); - tcg_gen_movi_tl(dst, simm); - gen_store_gpr(dc, rd, dst); - } else { /* register */ - rs2 = GET_FIELD(insn, 27, 31); - if (rs2 == 0) { - tcg_gen_movi_tl(dst, 0); - gen_store_gpr(dc, rd, dst); - } else { - cpu_src2 = gen_load_gpr(dc, rs2); - gen_store_gpr(dc, rd, cpu_src2); - } - } - } else { - cpu_src1 = get_src1(dc, insn); - if (IS_IMM) { /* immediate */ - simm = GET_FIELDs(insn, 19, 31); - tcg_gen_ori_tl(dst, cpu_src1, simm); - gen_store_gpr(dc, rd, dst); - } else { /* register */ - rs2 = GET_FIELD(insn, 27, 31); - if (rs2 == 0) { - /* mov shortcut: or x, %g0, y -> mov x, y */ - gen_store_gpr(dc, rd, cpu_src1); - } else { - cpu_src2 = gen_load_gpr(dc, rs2); - tcg_gen_or_tl(dst, cpu_src1, cpu_src2); - gen_store_gpr(dc, rd, dst); - } - } - } #ifdef TARGET_SPARC64 } else if (xop == 0x25) { /* sll, V9 sllx */ cpu_src1 = get_src1(dc, insn); @@ -4612,72 +4650,6 @@ static void disas_sparc_legacy(DisasContext *dc, unsigned int insn) cpu_src1 = get_src1(dc, insn); cpu_src2 = get_src2(dc, insn); switch (xop & ~0x10) { - case 0x0: /* add */ - if (xop & 0x10) { - gen_op_add_cc(cpu_dst, cpu_src1, cpu_src2); - tcg_gen_movi_i32(cpu_cc_op, CC_OP_ADD); - dc->cc_op = CC_OP_ADD; - } else { - tcg_gen_add_tl(cpu_dst, cpu_src1, cpu_src2); - } - break; - case 0x1: /* and */ - tcg_gen_and_tl(cpu_dst, cpu_src1, cpu_src2); - if (xop & 0x10) { - tcg_gen_mov_tl(cpu_cc_dst, cpu_dst); - tcg_gen_movi_i32(cpu_cc_op, CC_OP_LOGIC); - dc->cc_op = CC_OP_LOGIC; - } - break; - case 0x2: /* or */ - tcg_gen_or_tl(cpu_dst, cpu_src1, cpu_src2); - if (xop & 0x10) { - tcg_gen_mov_tl(cpu_cc_dst, cpu_dst); - tcg_gen_movi_i32(cpu_cc_op, CC_OP_LOGIC); - dc->cc_op = CC_OP_LOGIC; - } - break; - case 0x3: /* xor */ - tcg_gen_xor_tl(cpu_dst, cpu_src1, cpu_src2); - if (xop & 0x10) { - tcg_gen_mov_tl(cpu_cc_dst, cpu_dst); - tcg_gen_movi_i32(cpu_cc_op, CC_OP_LOGIC); - dc->cc_op = CC_OP_LOGIC; - } - break; - case 0x4: /* sub */ - if (xop & 0x10) { - gen_op_sub_cc(cpu_dst, cpu_src1, cpu_src2); - tcg_gen_movi_i32(cpu_cc_op, CC_OP_SUB); - dc->cc_op = CC_OP_SUB; - } else { - tcg_gen_sub_tl(cpu_dst, cpu_src1, cpu_src2); - } - break; - case 0x5: /* andn */ - tcg_gen_andc_tl(cpu_dst, cpu_src1, cpu_src2); - if (xop & 0x10) { - tcg_gen_mov_tl(cpu_cc_dst, cpu_dst); - tcg_gen_movi_i32(cpu_cc_op, CC_OP_LOGIC); - dc->cc_op = CC_OP_LOGIC; - } - break; - case 0x6: /* orn */ - tcg_gen_orc_tl(cpu_dst, cpu_src1, cpu_src2); - if (xop & 0x10) { - tcg_gen_mov_tl(cpu_cc_dst, cpu_dst); - tcg_gen_movi_i32(cpu_cc_op, CC_OP_LOGIC); - dc->cc_op = CC_OP_LOGIC; - } - break; - case 0x7: /* xorn */ - tcg_gen_eqv_tl(cpu_dst, cpu_src1, cpu_src2); - if (xop & 0x10) { - tcg_gen_mov_tl(cpu_cc_dst, cpu_dst); - tcg_gen_movi_i32(cpu_cc_op, CC_OP_LOGIC); - dc->cc_op = CC_OP_LOGIC; - } - break; case 0x8: /* addx, V9 addc */ gen_op_addx_int(dc, cpu_dst, cpu_src1, cpu_src2, (xop & 0x10)); From patchwork Sun Oct 22 05:59:31 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 736931 Delivered-To: patch@linaro.org Received: by 2002:adf:dd81:0:b0:32d:baff:b0ca with SMTP id x1csp1003230wrl; Sat, 21 Oct 2023 23:02:25 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEc2XWlWALXu6l+GpN4Hxi8S8n4Z4besSAzi5rYEfMr3pVboqg0tM8yCiljt/w1VrNI7eCH X-Received: by 2002:a05:6214:240d:b0:655:d9b1:7980 with SMTP id fv13-20020a056214240d00b00655d9b17980mr9410490qvb.62.1697954545590; Sat, 21 Oct 2023 23:02:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697954545; cv=none; d=google.com; s=arc-20160816; b=T0VRB5YBseR3mdagMvlvPtH85Fp+sVXK5eizcYaPqn7ogPeiwhY52IOfPIQzh0075h UJ/TquHKrhdYp5VRJpok6bpxkytkmyR3n2/QjpaCUCd4yoz3EWJnd9g7wpqsMfqNADXL VGYQLdSxTs0Ll5xWILoVmr3uvPt1bqk2mGYr1ZVs01/ztiwZixiqRboYfLq+aArNsUcQ 9oHDk0/hq9FfarEHkCHXwMGiPqtP/3ELt7uW4iADVr+tzaGW65Mph0yK++JBJ+YzPSh5 tv6XyrEd4aJhIfDOK3QHAaBmxU7G33d46UXXnkxIQSdINifjEi8z4DW/X7upGmxyiAP7 9MSA== 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=FfOR1gXeN1HnAitPqmUHhUxlxRgSaGKHSuKSbXE/YfQ=; fh=TYrED6TOMxGX0VC4GtjviASLbYyJe19+7/tKWjN44KQ=; b=0PPoFGl30JCLeZFsiu9k7QpwjTYQ7IJFupQrdckPKgdXV23cuqf1S5/XyEL1g8+1a6 eACwq5JSxkDLadl64zawLOTx9Lj5ryCr3l1mIBTCzbHL6t4iX/u/NSDTCR9VuupAdl2/ aWZf2OG5lMtuXIwXEuSLgzGAON+8GQo3ScPxwYW5KWUe9YF4eVbCfupwmd/rF3RcubR6 hP12e106ueCba+A1Y1mK7xG0mdhoLv2TRL3GX4G2fOZ1FQMKcm9jq/Gy0PuFqv2cGcXK c5Nk7YQKawu6849IjMvc+rPZGcicPgR8wEF6Z4DL//JQCNQUWe94FB39063T7k0RSaqJ pYEQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=qsRdnE7t; 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 ld10-20020a056214418a00b0066d1ca1cb7asi3873489qvb.405.2023.10.21.23.02.25 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sat, 21 Oct 2023 23:02:25 -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=qsRdnE7t; 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 1quRWS-0000he-KV; Sun, 22 Oct 2023 02:01:12 -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 1quRWH-0000bz-1P for qemu-devel@nongnu.org; Sun, 22 Oct 2023 02:01:02 -0400 Received: from mail-oi1-x22c.google.com ([2607:f8b0:4864:20::22c]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1quRWF-0001c0-6Z for qemu-devel@nongnu.org; Sun, 22 Oct 2023 02:01:00 -0400 Received: by mail-oi1-x22c.google.com with SMTP id 5614622812f47-3b2f5aed39cso1591971b6e.1 for ; Sat, 21 Oct 2023 23:00:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1697954458; x=1698559258; 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=FfOR1gXeN1HnAitPqmUHhUxlxRgSaGKHSuKSbXE/YfQ=; b=qsRdnE7tx3vsp18cmHxYin5UHu9p3r4sZVvOUSyZZ1YZqVz9UPeVSNlIQehid2bP1f y0jRVuWzpMfLb45+5I7BaHc16pfEqNOWX1fpTrnJMkQIumGxkVi7dbQlSny90+yDGdTn 10Pn3ak479s87zghhJkNjWHd3Zv7ep7mhjrF2/5tMFJ4pnYFXg8r0r4NVsJXWF8j+CVm oVpIfbFYTRmOsyEIgPBuWypN6WGCru5wchhe+ajaftPr5zZSGJsp2yRFoxYwHzyVJES3 mlo3VS623k+JcYTE2XI2fRt7/nEv08APGAVb7LSAVN+8i0DIyaYCFiMPszxY/4DO+5ls 9Weg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697954458; x=1698559258; 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=FfOR1gXeN1HnAitPqmUHhUxlxRgSaGKHSuKSbXE/YfQ=; b=UoJZPEI1+TWh5JRkmdcXHEJHzwfyR6UbhV1wVQSSz+2pR3JHMfLDGrvGzbYWjWUejL fOoMRiyyAC8N2IbWz0xuJCXh3mDNWpzp5W4V3USg+uQHbtWn9fdADXgeCinYdQe50ug2 Uu+68OHJ9Ruw5Pw+B+7qAjFylvJMMYLP9YB8+pHRdXvmCLNopUuYQjXgwHcYvkxQZIkg SJ/qx/awjDfCqjOgbWoJG9nLqpOERiQNbLncQKzUiaxqQPZI4VrfAMxkLxCoGYyVsxVy hwmYMPgdZM45/jnFWaBKTKSTpdzvzES1ZHeOm1P8iR9BnVQEM1RTVtcpg+xsQHrH6fHg 5TnA== X-Gm-Message-State: AOJu0YxOA0Q7POFiZLeAIICns6cmhKYEAk493+ULhrxPK4lnYsej1M3S cii7rY5RFwSFTF82eA7oiLqCCVSalfHPfdkd5D8= X-Received: by 2002:a05:6808:64d:b0:3a8:80ea:f0c6 with SMTP id z13-20020a056808064d00b003a880eaf0c6mr5873416oih.29.1697954457805; Sat, 21 Oct 2023 23:00:57 -0700 (PDT) Received: from stoup.. ([71.212.149.95]) by smtp.gmail.com with ESMTPSA id je17-20020a170903265100b001c728609574sm3999887plb.6.2023.10.21.23.00.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 21 Oct 2023 23:00:57 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: mark.cave-ayland@ilande.co.uk Subject: [PATCH v4 30/90] target/sparc: Move ADDC to decodetree Date: Sat, 21 Oct 2023 22:59:31 -0700 Message-Id: <20231022060031.490251-31-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231022060031.490251-1-richard.henderson@linaro.org> References: <20231022060031.490251-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::22c; envelope-from=richard.henderson@linaro.org; helo=mail-oi1-x22c.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 | 1 + target/sparc/translate.c | 162 ++++++++++++++++++++++++-------------- 2 files changed, 105 insertions(+), 58 deletions(-) diff --git a/target/sparc/insns.decode b/target/sparc/insns.decode index 3271c2997d..1cff18fa1f 100644 --- a/target/sparc/insns.decode +++ b/target/sparc/insns.decode @@ -163,6 +163,7 @@ SUB 10 ..... 0.0100 ..... . ............. @r_r_ri_cc ANDN 10 ..... 0.0101 ..... . ............. @r_r_ri_cc ORN 10 ..... 0.0110 ..... . ............. @r_r_ri_cc XORN 10 ..... 0.0111 ..... . ............. @r_r_ri_cc +ADDC 10 ..... 0.1000 ..... . ............. @r_r_ri_cc Tcc_r 10 0 cond:4 111010 rs1:5 0 cc:1 0000000 rs2:5 { diff --git a/target/sparc/translate.c b/target/sparc/translate.c index 4bb545e9c5..c87125a328 100644 --- a/target/sparc/translate.c +++ b/target/sparc/translate.c @@ -434,71 +434,89 @@ static TCGv_i32 gen_sub32_carry32(void) return carry_32; } -static void gen_op_addx_int(DisasContext *dc, TCGv dst, TCGv src1, - TCGv src2, int update_cc) +static void gen_op_addc_int(TCGv dst, TCGv src1, TCGv src2, + TCGv_i32 carry_32, bool update_cc) { - TCGv_i32 carry_32; - TCGv carry; + tcg_gen_add_tl(dst, src1, src2); - switch (dc->cc_op) { - case CC_OP_DIV: - case CC_OP_LOGIC: - /* Carry is known to be zero. Fall back to plain ADD. */ - if (update_cc) { - gen_op_add_cc(dst, src1, src2); - } else { - tcg_gen_add_tl(dst, src1, src2); - } - return; - - case CC_OP_ADD: - case CC_OP_TADD: - case CC_OP_TADDTV: - if (TARGET_LONG_BITS == 32) { - /* We can re-use the host's hardware carry generation by using - an ADD2 opcode. We discard the low part of the output. - Ideally we'd combine this operation with the add that - generated the carry in the first place. */ - carry = tcg_temp_new(); - tcg_gen_add2_tl(carry, dst, cpu_cc_src, src1, cpu_cc_src2, src2); - goto add_done; - } - carry_32 = gen_add32_carry32(); - break; - - case CC_OP_SUB: - case CC_OP_TSUB: - case CC_OP_TSUBTV: - carry_32 = gen_sub32_carry32(); - break; - - default: - /* We need external help to produce the carry. */ - carry_32 = tcg_temp_new_i32(); - gen_helper_compute_C_icc(carry_32, tcg_env); - break; - } - -#if TARGET_LONG_BITS == 64 - carry = tcg_temp_new(); - tcg_gen_extu_i32_i64(carry, carry_32); +#ifdef TARGET_SPARC64 + TCGv carry = tcg_temp_new(); + tcg_gen_extu_i32_tl(carry, carry_32); + tcg_gen_add_tl(dst, dst, carry); #else - carry = carry_32; + tcg_gen_add_i32(dst, dst, carry_32); #endif - tcg_gen_add_tl(dst, src1, src2); - tcg_gen_add_tl(dst, dst, carry); - - add_done: if (update_cc) { + tcg_debug_assert(dst == cpu_cc_dst); tcg_gen_mov_tl(cpu_cc_src, src1); tcg_gen_mov_tl(cpu_cc_src2, src2); - tcg_gen_mov_tl(cpu_cc_dst, dst); - tcg_gen_movi_i32(cpu_cc_op, CC_OP_ADDX); - dc->cc_op = CC_OP_ADDX; } } +static void gen_op_addc_int_add(TCGv dst, TCGv src1, TCGv src2, bool update_cc) +{ + TCGv discard; + + if (TARGET_LONG_BITS == 64) { + gen_op_addc_int(dst, src1, src2, gen_add32_carry32(), update_cc); + return; + } + + /* + * We can re-use the host's hardware carry generation by using + * an ADD2 opcode. We discard the low part of the output. + * Ideally we'd combine this operation with the add that + * generated the carry in the first place. + */ + discard = tcg_temp_new(); + tcg_gen_add2_tl(discard, dst, cpu_cc_src, src1, cpu_cc_src2, src2); + + if (update_cc) { + tcg_debug_assert(dst == cpu_cc_dst); + tcg_gen_mov_tl(cpu_cc_src, src1); + tcg_gen_mov_tl(cpu_cc_src2, src2); + } +} + +static void gen_op_addc_add(TCGv dst, TCGv src1, TCGv src2) +{ + gen_op_addc_int_add(dst, src1, src2, false); +} + +static void gen_op_addccc_add(TCGv dst, TCGv src1, TCGv src2) +{ + gen_op_addc_int_add(dst, src1, src2, true); +} + +static void gen_op_addc_sub(TCGv dst, TCGv src1, TCGv src2) +{ + gen_op_addc_int(dst, src1, src2, gen_sub32_carry32(), false); +} + +static void gen_op_addccc_sub(TCGv dst, TCGv src1, TCGv src2) +{ + gen_op_addc_int(dst, src1, src2, gen_sub32_carry32(), true); +} + +static void gen_op_addc_int_generic(TCGv dst, TCGv src1, TCGv src2, + bool update_cc) +{ + TCGv_i32 carry_32 = tcg_temp_new_i32(); + gen_helper_compute_C_icc(carry_32, tcg_env); + gen_op_addc_int(dst, src1, src2, carry_32, update_cc); +} + +static void gen_op_addc_generic(TCGv dst, TCGv src1, TCGv src2) +{ + gen_op_addc_int_generic(dst, src1, src2, false); +} + +static void gen_op_addccc_generic(TCGv dst, TCGv src1, TCGv src2) +{ + gen_op_addc_int_generic(dst, src1, src2, true); +} + static void gen_op_sub_cc(TCGv dst, TCGv src1, TCGv src2) { tcg_gen_mov_tl(cpu_cc_src, src1); @@ -4226,6 +4244,38 @@ static bool trans_SUB(DisasContext *dc, arg_r_r_ri_cc *a) return do_arith(dc, a, -1, tcg_gen_sub_tl, tcg_gen_subi_tl); } +static bool trans_ADDC(DisasContext *dc, arg_r_r_ri_cc *a) +{ + void (*func)(TCGv, TCGv, TCGv); + + switch (dc->cc_op) { + case CC_OP_DIV: + case CC_OP_LOGIC: + /* Carry is known to be zero. Fall back to plain ADD. */ + if (a->cc) { + return do_arith(dc, a, CC_OP_ADD, gen_op_add_cc, NULL); + } + return do_arith(dc, a, -1, tcg_gen_add_tl, tcg_gen_addi_tl); + + case CC_OP_ADD: + case CC_OP_TADD: + case CC_OP_TADDTV: + func = a->cc ? gen_op_addccc_add : gen_op_addc_add; + break; + + case CC_OP_SUB: + case CC_OP_TSUB: + case CC_OP_TSUBTV: + func = a->cc ? gen_op_addccc_sub : gen_op_addc_sub; + break; + + default: + func = a->cc ? gen_op_addccc_generic : gen_op_addc_generic; + break; + } + return do_arith(dc, a, CC_OP_ADDX, func, NULL); +} + #define CHECK_IU_FEATURE(dc, FEATURE) \ if (!((dc)->def->features & CPU_FEATURE_ ## FEATURE)) \ goto illegal_insn; @@ -4650,10 +4700,6 @@ static void disas_sparc_legacy(DisasContext *dc, unsigned int insn) cpu_src1 = get_src1(dc, insn); cpu_src2 = get_src2(dc, insn); switch (xop & ~0x10) { - case 0x8: /* addx, V9 addc */ - gen_op_addx_int(dc, cpu_dst, cpu_src1, cpu_src2, - (xop & 0x10)); - break; #ifdef TARGET_SPARC64 case 0x9: /* V9 mulx */ tcg_gen_mul_i64(cpu_dst, cpu_src1, cpu_src2); From patchwork Sun Oct 22 05:59:32 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 736941 Delivered-To: patch@linaro.org Received: by 2002:adf:dd81:0:b0:32d:baff:b0ca with SMTP id x1csp1004062wrl; Sat, 21 Oct 2023 23:05:21 -0700 (PDT) X-Google-Smtp-Source: AGHT+IF9sS2rFK0+WOMDTUMsPLQt1QZwl3y2CevXg/UlOLBXbvJFkjoB5cxs55Ady0ugSvHCf844 X-Received: by 2002:a05:620a:8793:b0:774:1c99:daf9 with SMTP id py19-20020a05620a879300b007741c99daf9mr5111422qkn.37.1697954721133; Sat, 21 Oct 2023 23:05:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697954721; cv=none; d=google.com; s=arc-20160816; b=0ta/mznnorIZUvWhtiFwYriMrDynjEhL9kOe+no9VGTkYEVVmCRv0IubhIks94sh1L jMb/H2tnHAbGdyiHT9pGPT2zZJ5ysrPYlb5Oe65M8RBRGW5AGXTfxyrVCxMQPof1YHKB r9k4dztEd0xpVJ3qR6ndomstmydeZadqnLauXoplT80RhtfCUaQ54O+UqQh2riAgs1Ab jyfwJNZaLQZ5f148rUIbnudvvpP6zMMjSyrjd+PhQu1jTC09hsiOloK29ER8VpFpg5lW J8kpTON848fvUbSzGXcEfT9JAqIYLlapEqOOFEikfa035q6s4RMacXlh/LrH5cRrtjGW KQRQ== 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=JohjTeLgxEEBwOOQtITWo4pQmKo+Yz9DXG7dwEjVRi8=; fh=TYrED6TOMxGX0VC4GtjviASLbYyJe19+7/tKWjN44KQ=; b=mtUjnJmPhQGt5Od/VeUSH/S9xJmrHvXcHLAraPjgXPUi5z0IEZmTezHP7eDmFAatR/ A4d245gvdHhUW2JBaEXYUL3/YYxQWa1JVRMehEaN/CYnZGajRDYjBwW4oAQGF7VOKRDB y7sGSBA7G3R/O7iAzjweGmJ65PrXVRSxIGulSsY891VR1sdBxtmbfCrlI9QkI5AKgyNW UDUcEHjParaRivj3foGKv7DOT86dv8X/vtpDq8DD/ySSsK2xQ+ReUP2ubukrTl6zNKoI toV4F4hagM0Nd4QGthPL1cAcoXZHZE3gMW5xW1Q3q+qg0YTb3t6dIcJiA1PjKCNbf7rv P+0w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=IQYq7JaO; 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 e25-20020a05620a12d900b0077431227b58si3522434qkl.27.2023.10.21.23.05.20 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sat, 21 Oct 2023 23:05:21 -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=IQYq7JaO; 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 1quRWZ-0000mk-Cz; Sun, 22 Oct 2023 02:01:19 -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 1quRWH-0000c0-IN for qemu-devel@nongnu.org; Sun, 22 Oct 2023 02:01:02 -0400 Received: from mail-pf1-x42a.google.com ([2607:f8b0:4864:20::42a]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1quRWF-0001cG-Q4 for qemu-devel@nongnu.org; Sun, 22 Oct 2023 02:01:01 -0400 Received: by mail-pf1-x42a.google.com with SMTP id d2e1a72fcca58-6b9af7d41d2so1809057b3a.0 for ; Sat, 21 Oct 2023 23:00:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1697954458; x=1698559258; 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=JohjTeLgxEEBwOOQtITWo4pQmKo+Yz9DXG7dwEjVRi8=; b=IQYq7JaOyyrrtOaHjJ+FzC3Bn7oUhLMPINYzxljxmHQuOgWa1pEB8ozkw/zw8Jv1VV SCEMN0z+TqfZOH1D0NST66XLCA2LiHKOklO7mtFzEEgaq7cX2xH7kVCExSwsTvXIMi6Q W/mkZXLAekagwaDwW21z8i+FSYSdlR6KetX+KeYKTm8k6wmhDR4b3V/sRtkRlIkuPAiu UPfu494F5iRTQOyGPS3Gl+xZ5DJyMoesthozifa6viYF6Uep1pzYR+DVAGnnFpFuzBIS hrEuqRjJ7no4M/98Wb8rNpJqS7DeXpWDbcZzmnc7BQ3xodhpJobBjEeaHGgVUDViqPLo xdzg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697954458; x=1698559258; 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=JohjTeLgxEEBwOOQtITWo4pQmKo+Yz9DXG7dwEjVRi8=; b=oel/oqbyRhqU+4F+fs8gomBab4dFMnsXFGuRU+W6Dhnezr+yMXW/vhoWAAUqnY8q/f n0zrIkjg4nEuja6Rn/qHCW1v3joGVrtd3g3tdKbJr6nZn70WZ8cWhR4eWvyysr1RlVlH 0zRdMeaK40Ep3bEMwj2ApNxr/+oLx7Xd5oK+pFSTZ8IfjdqQTQya+aAG7fVmWDR6VanX WygjZGFT8MQRnifBIYaxTdaZCPBpL/fBEgkesvS6UwHpl6WNgVzKRdR7HvVZoyfnrICP SWNI4CV3Kqa91ZZ4k5rYQmsM+h7nnfm7viH60KGbYOfy1ot/7GKJbsvGYXH6ohUlnsxx Ny3w== X-Gm-Message-State: AOJu0YxzzXVvzppv5fvLi9vWDKlSgP8su3wqmxrVNm6+X4QEta9cspdv 6F+OUNsqdp+xKrSa6kmCacoX6rggk58fpDylEA4= X-Received: by 2002:a17:902:c401:b0:1bc:5924:2da2 with SMTP id k1-20020a170902c40100b001bc59242da2mr6599964plk.56.1697954458592; Sat, 21 Oct 2023 23:00:58 -0700 (PDT) Received: from stoup.. ([71.212.149.95]) by smtp.gmail.com with ESMTPSA id je17-20020a170903265100b001c728609574sm3999887plb.6.2023.10.21.23.00.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 21 Oct 2023 23:00:58 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: mark.cave-ayland@ilande.co.uk Subject: [PATCH v4 31/90] target/sparc: Move MULX to decodetree Date: Sat, 21 Oct 2023 22:59:32 -0700 Message-Id: <20231022060031.490251-32-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231022060031.490251-1-richard.henderson@linaro.org> References: <20231022060031.490251-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::42a; envelope-from=richard.henderson@linaro.org; helo=mail-pf1-x42a.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 | 3 +++ target/sparc/translate.c | 6 +----- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/target/sparc/insns.decode b/target/sparc/insns.decode index 1cff18fa1f..1a04a8e229 100644 --- a/target/sparc/insns.decode +++ b/target/sparc/insns.decode @@ -31,6 +31,7 @@ CALL 01 i:s30 &r_r_ri_cc rd rs1 rs2_or_imm imm:bool cc:bool @r_r_ri_cc .. rd:5 . cc:1 .... rs1:5 imm:1 rs2_or_imm:s13 &r_r_ri_cc +@r_r_ri_cc0 .. rd:5 ...... rs1:5 imm:1 rs2_or_imm:s13 &r_r_ri_cc cc=0 { [ @@ -165,6 +166,8 @@ ORN 10 ..... 0.0110 ..... . ............. @r_r_ri_cc XORN 10 ..... 0.0111 ..... . ............. @r_r_ri_cc ADDC 10 ..... 0.1000 ..... . ............. @r_r_ri_cc +MULX 10 ..... 001001 ..... . ............. @r_r_ri_cc0 + Tcc_r 10 0 cond:4 111010 rs1:5 0 cc:1 0000000 rs2:5 { # For v7, the entire simm13 field is present, but masked to 7 bits. diff --git a/target/sparc/translate.c b/target/sparc/translate.c index c87125a328..be00bd00fc 100644 --- a/target/sparc/translate.c +++ b/target/sparc/translate.c @@ -4210,6 +4210,7 @@ TRANS(XOR, ALL, do_arith, a, CC_OP_LOGIC, tcg_gen_xor_tl, tcg_gen_xori_tl) TRANS(ANDN, ALL, do_arith, a, CC_OP_LOGIC, tcg_gen_andc_tl, NULL) TRANS(ORN, ALL, do_arith, a, CC_OP_LOGIC, tcg_gen_orc_tl, NULL) TRANS(XORN, ALL, do_arith, a, CC_OP_LOGIC, tcg_gen_eqv_tl, NULL) +TRANS(MULX, 64, do_arith, a, 0, tcg_gen_mul_tl, tcg_gen_muli_tl) static bool trans_OR(DisasContext *dc, arg_r_r_ri_cc *a) { @@ -4700,11 +4701,6 @@ static void disas_sparc_legacy(DisasContext *dc, unsigned int insn) cpu_src1 = get_src1(dc, insn); cpu_src2 = get_src2(dc, insn); switch (xop & ~0x10) { -#ifdef TARGET_SPARC64 - case 0x9: /* V9 mulx */ - tcg_gen_mul_i64(cpu_dst, cpu_src1, cpu_src2); - break; -#endif case 0xa: /* umul */ CHECK_IU_FEATURE(dc, MUL); gen_op_umul(cpu_dst, cpu_src1, cpu_src2); From patchwork Sun Oct 22 05:59: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: 736924 Delivered-To: patch@linaro.org Received: by 2002:adf:dd81:0:b0:32d:baff:b0ca with SMTP id x1csp1002999wrl; Sat, 21 Oct 2023 23:01:42 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFjvUMCcFnzXv55HFyHWkyrEnT4fWV4dZP1AymTUVq9v/CHw2gyFWSFQQ4cNmYb1s/53QfN X-Received: by 2002:a05:6358:27a4:b0:13a:a85b:a4dc with SMTP id l36-20020a05635827a400b0013aa85ba4dcmr7136846rwb.29.1697954502196; Sat, 21 Oct 2023 23:01:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697954502; cv=none; d=google.com; s=arc-20160816; b=V6LlpAo5J4+Aeyn7SKcqWmQh4KdjBSJENYcR9XdGgEhW3LVcsBvDtKZEgHZq5rfW/5 fa0bgppB3phMv9vyBlXZCPFgi3px9dcwSRMO4vwAL3l1zxcc3AUZvRXLwlvcQS20luuy 5+hpnNlxp3Z4TtbBhTo5LAk1rDdi5oHdvloHGQhxyRDNpPEdVXpH9P+8hSoHLXzfxq0x 17oZ8EjM23nk6GrWgWtw74RaPEm8T4u8lVJUATyw3vdvIOnoDTR6KwzINm1wg4URMLNT Zlq087zymHnY96gXNpBJJvFRF2uTDqQ8OnOFmZgOQx9OdLnW5Z5rq5WnMv+k2NwfH14z imqg== 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=loiG8IoonkY1ZKs18NLWsqcd2RIkcRcXOOGkEupcu0Y=; fh=TYrED6TOMxGX0VC4GtjviASLbYyJe19+7/tKWjN44KQ=; b=l+cQYgThP1hNG3KIbd1KzJ9Ch2bZzmJ1CU/jEyAthGQhjDxVFKGVBODeVQ1gnhtvNS PKpER7YetOlyjf9BLNnj9VJp7NAbrvoVffFb6Cw2/Z3pk/ax+5FQkTN2bJFTVpfE6UkN bopK40QUyFlMqO28emdx2wDesL3EjCSNTq3ufGFBjmQcQ/OgNPYpDP7qfYBzV55FUB3m zlXrbrjT16oni6bOQNzynEeYAYWXkMWTYpx34mTOZspqFUEADbVgWLakoF2KrCtF5sIu W+uK96vyEm4/RTrgyJ9B3bbxxaDbbTj1PNiAE0vtdb0c5cCA9zHAWCBTd9+qwLkkYHNw nFyQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=D6qMMm3j; 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 x8-20020a05620a448800b0076dbe1d6084si1394221qkp.675.2023.10.21.23.01.42 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sat, 21 Oct 2023 23:01:42 -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=D6qMMm3j; 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 1quRWS-0000fU-Ix; Sun, 22 Oct 2023 02:01:12 -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 1quRWI-0000c1-Bu for qemu-devel@nongnu.org; Sun, 22 Oct 2023 02:01:02 -0400 Received: from mail-pl1-x62f.google.com ([2607:f8b0:4864:20::62f]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1quRWG-0001cP-NA for qemu-devel@nongnu.org; Sun, 22 Oct 2023 02:01:02 -0400 Received: by mail-pl1-x62f.google.com with SMTP id d9443c01a7336-1c5cd27b1acso18398455ad.2 for ; Sat, 21 Oct 2023 23:01:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1697954459; x=1698559259; 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=loiG8IoonkY1ZKs18NLWsqcd2RIkcRcXOOGkEupcu0Y=; b=D6qMMm3jbV8s2IfbqBfKQ4vk4J8U2bDUFp7l2sIDeATeLzHQJ7LWSPrr0yFHleIkK6 QKFTAPac5PSWmf3nTbUtz7gzg9nlnln9W0LJIA8jcHAGgY3nx+6kr6U2rVi5caodsbcN qfhJ+KQbF7gx/mS+LZIjB0irA/bU0EOhcDDftVOLn8lh4SekkjYkRlmsYgvWtmqLHeee A4Xa9AZXFi58D+Ljhw5O+YNkDASXaKaeN3oc5bm5SZT0DmbcdkEkZJ1TKZ2zwwl3Ba6z gs2edkIYsxELJKLxCXZFFJfTVhP2IwPyz0dcGJ2fUBFhf/B6cxbqHsYX68Br3af2DjFa 6cdg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697954459; x=1698559259; 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=loiG8IoonkY1ZKs18NLWsqcd2RIkcRcXOOGkEupcu0Y=; b=CEM8V15lqsqVLT6D1djY86bbLyxb/kRQuoYDFv0H8y2mdfe1kgY0jHZtvxZkGz02Aq DD9K97h+KNeEuygfVon67jfFF5r5jafLy2CQo/6Ffp4mfSWhYjNCG1oMtiKqoFBQnedE db7A2Nmdcz5toxpXSrJaq+I0aCI0u5LSJ8OhWJ5ZK7f0kehakiWAz/8oMb6E+vXi109p ZCpgNT9aPdP8POGvafI/2n0GSGThqv6T+uRtbwzc4vlq+ydENom4Ys7IZkpR/YeCu3eK rJCQQktHmZmaWdm9bMUjQtLbT+O+6uEBKo9UyhfOPdRwCKzYkN20aappRl+W5q8a55Dm p0cw== X-Gm-Message-State: AOJu0YzEpFZtSeeZKP6zPMbnBX+469RCZyKuGl5W8Mmnpj/u9Ed5a/mu joaN1CfPBPSTWQqx+l4GyM7u4YDLD7pr/LGPzwM= X-Received: by 2002:a17:903:455:b0:1ca:3e64:2378 with SMTP id iw21-20020a170903045500b001ca3e642378mr5843439plb.4.1697954459312; Sat, 21 Oct 2023 23:00:59 -0700 (PDT) Received: from stoup.. ([71.212.149.95]) by smtp.gmail.com with ESMTPSA id je17-20020a170903265100b001c728609574sm3999887plb.6.2023.10.21.23.00.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 21 Oct 2023 23:00:58 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: mark.cave-ayland@ilande.co.uk Subject: [PATCH v4 32/90] target/sparc: Move UMUL, SMUL to decodetree Date: Sat, 21 Oct 2023 22:59:33 -0700 Message-Id: <20231022060031.490251-33-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231022060031.490251-1-richard.henderson@linaro.org> References: <20231022060031.490251-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::62f; envelope-from=richard.henderson@linaro.org; helo=mail-pl1-x62f.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 | 2 ++ target/sparc/translate.c | 21 +++------------------ 2 files changed, 5 insertions(+), 18 deletions(-) diff --git a/target/sparc/insns.decode b/target/sparc/insns.decode index 1a04a8e229..d6a7256e71 100644 --- a/target/sparc/insns.decode +++ b/target/sparc/insns.decode @@ -167,6 +167,8 @@ XORN 10 ..... 0.0111 ..... . ............. @r_r_ri_cc ADDC 10 ..... 0.1000 ..... . ............. @r_r_ri_cc MULX 10 ..... 001001 ..... . ............. @r_r_ri_cc0 +UMUL 10 ..... 0.1010 ..... . ............. @r_r_ri_cc +SMUL 10 ..... 0.1011 ..... . ............. @r_r_ri_cc Tcc_r 10 0 cond:4 111010 rs1:5 0 cc:1 0000000 rs2:5 { diff --git a/target/sparc/translate.c b/target/sparc/translate.c index be00bd00fc..d79e28ab7f 100644 --- a/target/sparc/translate.c +++ b/target/sparc/translate.c @@ -2882,6 +2882,7 @@ static void gen_faligndata(TCGv dst, TCGv gsr, TCGv s1, TCGv s2) #define avail_ASR17(C) ((C)->def->features & CPU_FEATURE_ASR17) #define avail_GL(C) ((C)->def->features & CPU_FEATURE_GL) #define avail_HYPV(C) ((C)->def->features & CPU_FEATURE_HYPV) +#define avail_MUL(C) ((C)->def->features & CPU_FEATURE_MUL) #define avail_POWERDOWN(C) ((C)->def->features & CPU_FEATURE_POWERDOWN) /* Default case for non jump instructions. */ @@ -4211,6 +4212,8 @@ TRANS(ANDN, ALL, do_arith, a, CC_OP_LOGIC, tcg_gen_andc_tl, NULL) TRANS(ORN, ALL, do_arith, a, CC_OP_LOGIC, tcg_gen_orc_tl, NULL) TRANS(XORN, ALL, do_arith, a, CC_OP_LOGIC, tcg_gen_eqv_tl, NULL) TRANS(MULX, 64, do_arith, a, 0, tcg_gen_mul_tl, tcg_gen_muli_tl) +TRANS(UMUL, MUL, do_arith, a, CC_OP_LOGIC, gen_op_umul, NULL) +TRANS(SMUL, MUL, do_arith, a, CC_OP_LOGIC, gen_op_smul, NULL) static bool trans_OR(DisasContext *dc, arg_r_r_ri_cc *a) { @@ -4701,24 +4704,6 @@ static void disas_sparc_legacy(DisasContext *dc, unsigned int insn) cpu_src1 = get_src1(dc, insn); cpu_src2 = get_src2(dc, insn); switch (xop & ~0x10) { - case 0xa: /* umul */ - CHECK_IU_FEATURE(dc, MUL); - gen_op_umul(cpu_dst, cpu_src1, cpu_src2); - if (xop & 0x10) { - tcg_gen_mov_tl(cpu_cc_dst, cpu_dst); - tcg_gen_movi_i32(cpu_cc_op, CC_OP_LOGIC); - dc->cc_op = CC_OP_LOGIC; - } - break; - case 0xb: /* smul */ - CHECK_IU_FEATURE(dc, MUL); - gen_op_smul(cpu_dst, cpu_src1, cpu_src2); - if (xop & 0x10) { - tcg_gen_mov_tl(cpu_cc_dst, cpu_dst); - tcg_gen_movi_i32(cpu_cc_op, CC_OP_LOGIC); - dc->cc_op = CC_OP_LOGIC; - } - break; case 0xc: /* subx, V9 subc */ gen_op_subx_int(dc, cpu_dst, cpu_src1, cpu_src2, (xop & 0x10)); From patchwork Sun Oct 22 05:59:34 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 737003 Delivered-To: patch@linaro.org Received: by 2002:adf:dd81:0:b0:32d:baff:b0ca with SMTP id x1csp1006416wrl; Sat, 21 Oct 2023 23:15:06 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHibMzetCjIkteNQTGukgCMgbMVU+Q8y4gJyib0YLhVJtCrDBioxzsuSOTZiup5U2Fkcx+U X-Received: by 2002:ac8:7f0b:0:b0:417:fe9c:6dce with SMTP id f11-20020ac87f0b000000b00417fe9c6dcemr8008543qtk.25.1697955305908; Sat, 21 Oct 2023 23:15:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697955305; cv=none; d=google.com; s=arc-20160816; b=DOmfdV7zZklRBq0giTKWxSzKo0zFWBW5NlMy5C4mlj9jFnoJTQOpVDwnz+MbF8m+UN L6RWLriyxysjTxry96j2CoUHrjf3ivtQAT1LoGGWoBGjTsZlhsREmTxbcCd8mVoE31+I 7hFQFoDq4XXsTIMxezlLm7AGA2Ybers0bXDohDmnet5QtiR+2MT9j0Egg3fXyPTaK071 8GKC+oBqQY3dr+kVHadG89s4dLeyzMk6aVaS22/FzRV3lGmOlmtJSookhZdzpRPmr5pd k9NSuJmxTXJOYFsttIZ/KkUk9RXSTZ4J0b75Do7aW9MT0ekY1jNvgvYBkrDUbbT3O2Fb sH1A== 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=W7WT3KgN8dsMjmh9I4YlPumtwnaUsA+5OvmhpgUYvm0=; fh=TYrED6TOMxGX0VC4GtjviASLbYyJe19+7/tKWjN44KQ=; b=Y3JGVa+Tjj/UX6AFh/aArlOnpZe4As/HLSr5K6o1BrYzUwTeWrwbOQHfDnBp+zm3E9 8Ph4oaID86M2OMWYPb58WCc47rFrFATt/noa0/KzVhaklaPs8e9v8r6yQ7nJCDbhlF+6 z6HAyKfNTCiAJh+2ATPc0s+YzY5uc6J9XtM8+5WkvTg4iFcpWGzDkzLnh7w+su0VOCl+ Ey3oW4ttXWT04nn6D36uT/Dta1FIpM244ZYEdrLz5A+3+A+Sn8LB6d/PsBxT1XG59V19 VXJDyraHvE7jaIbVSIdO1Ud0N47cQgta3U/XxPd7bAIAPxe/idtvNQt4TlhaPeTLNUFg Hzjw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=vOPZfMUh; 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 v15-20020a05620a0f0f00b0076ae74a264bsi4006564qkl.136.2023.10.21.23.15.05 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sat, 21 Oct 2023 23:15:05 -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=vOPZfMUh; 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 1quRX1-0001gV-Sw; Sun, 22 Oct 2023 02:01:48 -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 1quRWn-0000sk-Gz for qemu-devel@nongnu.org; Sun, 22 Oct 2023 02:01:33 -0400 Received: from mail-oi1-x22a.google.com ([2607:f8b0:4864:20::22a]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1quRWl-0001hZ-5v for qemu-devel@nongnu.org; Sun, 22 Oct 2023 02:01:33 -0400 Received: by mail-oi1-x22a.google.com with SMTP id 5614622812f47-3b3e13fc1f7so1676587b6e.0 for ; Sat, 21 Oct 2023 23:01:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1697954490; x=1698559290; 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=W7WT3KgN8dsMjmh9I4YlPumtwnaUsA+5OvmhpgUYvm0=; b=vOPZfMUhyhKR3daafIn1jgB9QCSBeUDow7uAo3seMS2RrsuzKqpwXwZrFsHSGALr91 seyNpdEoE9KiKFpea3sCzeTB6BljxGAdiJu5imCmtzKWJ+1MprJPMUXJcSJ32Fr5Rxay qHxouGEztt6pjWhDcpowsgFMWPIL0xrFsk92VpEqeR/CaQ9SMmcsV4QcjRNog5gDkwcF Rv/6MEuNOKd+hbCqpPOm4k4vX94ILtpkVeyWb1yX5mm0ne5KsTJRQ6r+ZTJl/mquEvV/ XICvcTz1psDSM/pC88SGouqW9QRy+6u8iQu2cGhZtUKfdVmB9D01iy6xR+3tTdnTfbfm CQNw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697954490; x=1698559290; 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=W7WT3KgN8dsMjmh9I4YlPumtwnaUsA+5OvmhpgUYvm0=; b=At7MmzzgMDch0Y+fa9iCsGLoSl0ZwTOTftnhiNStraBI0OEk7a2UUAGQ47N9gEHSAD FEy+oseWh9xo9eFU/uMeIACzbPSxMkNj7w5rCliE82il1C+YPTVJ5AMapHcEQ7V265yJ fyGjrH63acfiheOKn7K5ic/qBs/be4aIE8Dw5tXM1WYlaa9YfPo+xE7UUKI9ON0QmZ0+ soDy3oJtGUonV3rzDqadZbPWpf0TuCicvmGQO+2AhUVI6OItHkL8Ko7fLUarQkhQj8Xw xuCOGfrzkZEdzCNfKSUxd+lsKRybn/OtQsiOaHQKloaeHhkTyZBxGKiYJC2wFHht6rp0 oCLg== X-Gm-Message-State: AOJu0YwPq9baN5LGbHvocEqSJmVN0PMh+je/HWp3u+Q/z9MSXjD0DrJl jVydfHUQjZvGYO6oJhvUYBt/SnEw4q1yn7w5qVo= X-Received: by 2002:a05:6808:221d:b0:3ae:1446:d48b with SMTP id bd29-20020a056808221d00b003ae1446d48bmr8322511oib.3.1697954460056; Sat, 21 Oct 2023 23:01:00 -0700 (PDT) Received: from stoup.. ([71.212.149.95]) by smtp.gmail.com with ESMTPSA id je17-20020a170903265100b001c728609574sm3999887plb.6.2023.10.21.23.00.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 21 Oct 2023 23:00:59 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: mark.cave-ayland@ilande.co.uk Subject: [PATCH v4 33/90] target/sparc: Move SUBC to decodetree Date: Sat, 21 Oct 2023 22:59:34 -0700 Message-Id: <20231022060031.490251-34-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231022060031.490251-1-richard.henderson@linaro.org> References: <20231022060031.490251-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::22a; envelope-from=richard.henderson@linaro.org; helo=mail-oi1-x22a.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 | 1 + target/sparc/translate.c | 147 +++++++++++++++++++++++++------------- 2 files changed, 98 insertions(+), 50 deletions(-) diff --git a/target/sparc/insns.decode b/target/sparc/insns.decode index d6a7256e71..a188452d2e 100644 --- a/target/sparc/insns.decode +++ b/target/sparc/insns.decode @@ -165,6 +165,7 @@ ANDN 10 ..... 0.0101 ..... . ............. @r_r_ri_cc ORN 10 ..... 0.0110 ..... . ............. @r_r_ri_cc XORN 10 ..... 0.0111 ..... . ............. @r_r_ri_cc ADDC 10 ..... 0.1000 ..... . ............. @r_r_ri_cc +SUBC 10 ..... 0.1100 ..... . ............. @r_r_ri_cc MULX 10 ..... 001001 ..... . ............. @r_r_ri_cc0 UMUL 10 ..... 0.1010 ..... . ............. @r_r_ri_cc diff --git a/target/sparc/translate.c b/target/sparc/translate.c index d79e28ab7f..7e2a74a816 100644 --- a/target/sparc/translate.c +++ b/target/sparc/translate.c @@ -525,51 +525,11 @@ static void gen_op_sub_cc(TCGv dst, TCGv src1, TCGv src2) tcg_gen_mov_tl(dst, cpu_cc_dst); } -static void gen_op_subx_int(DisasContext *dc, TCGv dst, TCGv src1, - TCGv src2, int update_cc) +static void gen_op_subc_int(TCGv dst, TCGv src1, TCGv src2, + TCGv_i32 carry_32, bool update_cc) { - TCGv_i32 carry_32; TCGv carry; - switch (dc->cc_op) { - case CC_OP_DIV: - case CC_OP_LOGIC: - /* Carry is known to be zero. Fall back to plain SUB. */ - if (update_cc) { - gen_op_sub_cc(dst, src1, src2); - } else { - tcg_gen_sub_tl(dst, src1, src2); - } - return; - - case CC_OP_ADD: - case CC_OP_TADD: - case CC_OP_TADDTV: - carry_32 = gen_add32_carry32(); - break; - - case CC_OP_SUB: - case CC_OP_TSUB: - case CC_OP_TSUBTV: - if (TARGET_LONG_BITS == 32) { - /* We can re-use the host's hardware carry generation by using - a SUB2 opcode. We discard the low part of the output. - Ideally we'd combine this operation with the add that - generated the carry in the first place. */ - carry = tcg_temp_new(); - tcg_gen_sub2_tl(carry, dst, cpu_cc_src, src1, cpu_cc_src2, src2); - goto sub_done; - } - carry_32 = gen_sub32_carry32(); - break; - - default: - /* We need external help to produce the carry. */ - carry_32 = tcg_temp_new_i32(); - gen_helper_compute_C_icc(carry_32, tcg_env); - break; - } - #if TARGET_LONG_BITS == 64 carry = tcg_temp_new(); tcg_gen_extu_i32_i64(carry, carry_32); @@ -580,16 +540,75 @@ static void gen_op_subx_int(DisasContext *dc, TCGv dst, TCGv src1, tcg_gen_sub_tl(dst, src1, src2); tcg_gen_sub_tl(dst, dst, carry); - sub_done: if (update_cc) { + tcg_debug_assert(dst == cpu_cc_dst); tcg_gen_mov_tl(cpu_cc_src, src1); tcg_gen_mov_tl(cpu_cc_src2, src2); - tcg_gen_mov_tl(cpu_cc_dst, dst); - tcg_gen_movi_i32(cpu_cc_op, CC_OP_SUBX); - dc->cc_op = CC_OP_SUBX; } } +static void gen_op_subc_add(TCGv dst, TCGv src1, TCGv src2) +{ + gen_op_subc_int(dst, src1, src2, gen_add32_carry32(), false); +} + +static void gen_op_subccc_add(TCGv dst, TCGv src1, TCGv src2) +{ + gen_op_subc_int(dst, src1, src2, gen_sub32_carry32(), true); +} + +static void gen_op_subc_int_sub(TCGv dst, TCGv src1, TCGv src2, bool update_cc) +{ + TCGv discard; + + if (TARGET_LONG_BITS == 64) { + gen_op_subc_int(dst, src1, src2, gen_sub32_carry32(), update_cc); + return; + } + + /* + * We can re-use the host's hardware carry generation by using + * a SUB2 opcode. We discard the low part of the output. + */ + discard = tcg_temp_new(); + tcg_gen_sub2_tl(discard, dst, cpu_cc_src, src1, cpu_cc_src2, src2); + + if (update_cc) { + tcg_debug_assert(dst == cpu_cc_dst); + tcg_gen_mov_tl(cpu_cc_src, src1); + tcg_gen_mov_tl(cpu_cc_src2, src2); + } +} + +static void gen_op_subc_sub(TCGv dst, TCGv src1, TCGv src2) +{ + gen_op_subc_int_sub(dst, src1, src2, false); +} + +static void gen_op_subccc_sub(TCGv dst, TCGv src1, TCGv src2) +{ + gen_op_subc_int_sub(dst, src1, src2, true); +} + +static void gen_op_subc_int_generic(TCGv dst, TCGv src1, TCGv src2, + bool update_cc) +{ + TCGv_i32 carry_32 = tcg_temp_new_i32(); + + gen_helper_compute_C_icc(carry_32, tcg_env); + gen_op_subc_int(dst, src1, src2, carry_32, update_cc); +} + +static void gen_op_subc_generic(TCGv dst, TCGv src1, TCGv src2) +{ + gen_op_subc_int_generic(dst, src1, src2, false); +} + +static void gen_op_subccc_generic(TCGv dst, TCGv src1, TCGv src2) +{ + gen_op_subc_int_generic(dst, src1, src2, true); +} + static void gen_op_mulscc(TCGv dst, TCGv src1, TCGv src2) { TCGv r_temp, zero, t0; @@ -4280,6 +4299,38 @@ static bool trans_ADDC(DisasContext *dc, arg_r_r_ri_cc *a) return do_arith(dc, a, CC_OP_ADDX, func, NULL); } +static bool trans_SUBC(DisasContext *dc, arg_r_r_ri_cc *a) +{ + void (*func)(TCGv, TCGv, TCGv); + + switch (dc->cc_op) { + case CC_OP_DIV: + case CC_OP_LOGIC: + /* Carry is known to be zero. Fall back to plain SUB. */ + if (a->cc) { + return do_arith(dc, a, CC_OP_SUB, gen_op_sub_cc, NULL); + } + return do_arith(dc, a, -1, tcg_gen_sub_tl, tcg_gen_subi_tl); + + case CC_OP_ADD: + case CC_OP_TADD: + case CC_OP_TADDTV: + func = a->cc ? gen_op_subccc_add : gen_op_subc_add; + break; + + case CC_OP_SUB: + case CC_OP_TSUB: + case CC_OP_TSUBTV: + func = a->cc ? gen_op_subccc_sub : gen_op_subc_sub; + break; + + default: + func = a->cc ? gen_op_subccc_generic : gen_op_subc_generic; + break; + } + return do_arith(dc, a, CC_OP_SUBX, func, NULL); +} + #define CHECK_IU_FEATURE(dc, FEATURE) \ if (!((dc)->def->features & CPU_FEATURE_ ## FEATURE)) \ goto illegal_insn; @@ -4704,10 +4755,6 @@ static void disas_sparc_legacy(DisasContext *dc, unsigned int insn) cpu_src1 = get_src1(dc, insn); cpu_src2 = get_src2(dc, insn); switch (xop & ~0x10) { - case 0xc: /* subx, V9 subc */ - gen_op_subx_int(dc, cpu_dst, cpu_src1, cpu_src2, - (xop & 0x10)); - break; #ifdef TARGET_SPARC64 case 0xd: /* V9 udivx */ gen_helper_udivx(cpu_dst, tcg_env, cpu_src1, cpu_src2); From patchwork Sun Oct 22 05:59: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: 736996 Delivered-To: patch@linaro.org Received: by 2002:adf:dd81:0:b0:32d:baff:b0ca with SMTP id x1csp1006289wrl; Sat, 21 Oct 2023 23:14:36 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFgJGZgWoJBzVlZpwbkhyF5s/aM4+CfVT9T/BFVEU5ZUJzH0TAT7/BL5qydUxLxbtH7CTAb X-Received: by 2002:ac8:5d44:0:b0:41c:d8f6:54a1 with SMTP id g4-20020ac85d44000000b0041cd8f654a1mr8135385qtx.60.1697955276213; Sat, 21 Oct 2023 23:14:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697955276; cv=none; d=google.com; s=arc-20160816; b=CwsVxUzSkUlVoAGQkz8+JlEj5ZnjccAY9DqhH47btF8Fof6BlrD/tUZP66x/ci71E/ y4T9PVBrA1RkEFR/jQjVHCnBdwnI1Xg5JjlsgmATucpUlxUSzsBP+3JDnjL0112vmE4s C7hSSgew1DUMm76hdUh7+9Kqi3r3+NQJulrMbev9xgQ93rqOIonmE7IAIy2J/l74XijG cvSdOeKfAeb11yFVJRM7o9iUe1S5kpTQIsmUSt6itBXSMaWua4Ph4Y7hMtKMH0d3C3CF IHdaKygPrid5aoWWn+D7njl5yoAduzmmvjDEPBtgos0S5N1RvhrjTTGvTDaocCNIBLPl +x7Q== 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=SsR3F96YR7aN/izdjl7cahAVuudrq9GJhuWfBWDFflg=; fh=TYrED6TOMxGX0VC4GtjviASLbYyJe19+7/tKWjN44KQ=; b=jC7P+qV1QC0mzIWybBzdER9kQc+j/rMX7eBp+bJnE2heGfKG0aXF0hawQip5X7udg9 rZbRs9sHDWTy2NDbiTs+VFD/ws6kdALUwP9QzDX/1K2GTpQJ95f3QuzXfWIwtp051qmX +1EJVCQKE3u5yoLR+3g5CsjHwz2nHtaX86YcVCAIjY9zqU/EnZs9XmOM++9JF5NrPUmA h/Rwe4ba5VQreThl7EliwB38KKQrJavkGghl1tG7Z/w+LZgO0iZQ0rxEFfaNjBf0h6PM y/J7IHYFKVf/I+ITdRvll/F9miRSzl7RHsliHMBSpqvyleTYH0Z5KfbtGqHacrdapnbf FTcQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=KShtr8Fx; 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 3-20020ac85903000000b0040f854a0f5esi3566821qty.646.2023.10.21.23.14.36 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sat, 21 Oct 2023 23:14:36 -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=KShtr8Fx; 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 1quRWt-000165-22; Sun, 22 Oct 2023 02:01:39 -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 1quRWn-0000t0-Ng for qemu-devel@nongnu.org; Sun, 22 Oct 2023 02:01:33 -0400 Received: from mail-oi1-x22e.google.com ([2607:f8b0:4864:20::22e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1quRWl-0001hi-W6 for qemu-devel@nongnu.org; Sun, 22 Oct 2023 02:01:33 -0400 Received: by mail-oi1-x22e.google.com with SMTP id 5614622812f47-3b2ea7cca04so1666426b6e.2 for ; Sat, 21 Oct 2023 23:01:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1697954491; x=1698559291; 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=SsR3F96YR7aN/izdjl7cahAVuudrq9GJhuWfBWDFflg=; b=KShtr8Fx9sDwbtO40Cte6B9fCV5mXq+BjYLJXNJoW/O0qLYN9wHmKEOunScwaFiQuz HrMzW5C38nc9ssrm+S48uhiHvDndcOi+ikqASFBJJcxqKq0k4AF7Cmp7KhKn7uEa+Y0c RoQlAfI+E8trKFIORXeQ8p4biSGddzEAReWqtfyKAe/fy1H2aIGilTwzw6f8sSxGOiE+ JdhXsGnyfeGKb+WAJxCETpBpcIvGNodiIhXHFjTllHh2ebVvK32yU7V0XW9B26W522U+ 4LukVF6H9/k1rPLQQPNa7ji6xJ0RFxdJZkKBxgg6/DY+MjViNDcNl2X7Mmef5hiqHNQ0 WpjQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697954491; x=1698559291; 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=SsR3F96YR7aN/izdjl7cahAVuudrq9GJhuWfBWDFflg=; b=LkXwih432tnwhe7rYzRtfFSOpaJ0nMFl0zsIiha5UvBrH2czzR+sbZ8o5CNjnE2Qo3 3boRZ+QtEp+NLYq+rLQxaxXZSSn5ZZCg4vv+Ei0FFUS5+9ky1b66BfDJUGmR8vHeN7s+ IGiRfgdchOOXQP/QtbIu6nkgtOwgcCcibBzbIlqLhRyjXgKKdHTeqL33kH0wyRqYI4b0 fuEun5+WXn2hwsmdtUUeFyKyInUD2hLTt7yyBEz3I0Ba5CCiCfuco+OsDVYRXLPkSaop C2wRy1USiQgBE/MNSYIPtr9oc8Zw8sUPd7jXCisoJgppB5ne7iGd088oi9hVTopZ1s2R k9mw== X-Gm-Message-State: AOJu0YwQukKU9saVUy51mEyQoFZtMJrReEtWcUDrjVxX/rBx+yVUK8Bv bc0AEP4q1AI5YbAWp8cUOg54d0d+F8fxk9cbZxA= X-Received: by 2002:a54:400f:0:b0:3b2:dda3:aea7 with SMTP id x15-20020a54400f000000b003b2dda3aea7mr6143608oie.57.1697954490903; Sat, 21 Oct 2023 23:01:30 -0700 (PDT) Received: from stoup.. ([71.212.149.95]) by smtp.gmail.com with ESMTPSA id je17-20020a170903265100b001c728609574sm3999887plb.6.2023.10.21.23.01.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 21 Oct 2023 23:01:30 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: mark.cave-ayland@ilande.co.uk Subject: [PATCH v4 34/90] target/sparc: Move UDIVX, SDIVX to decodetree Date: Sat, 21 Oct 2023 22:59:35 -0700 Message-Id: <20231022060031.490251-35-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231022060031.490251-1-richard.henderson@linaro.org> References: <20231022060031.490251-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::22e; envelope-from=richard.henderson@linaro.org; helo=mail-oi1-x22e.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 | 3 +++ target/sparc/translate.c | 23 ++++++++++++++--------- 2 files changed, 17 insertions(+), 9 deletions(-) diff --git a/target/sparc/insns.decode b/target/sparc/insns.decode index a188452d2e..dd0ed3a993 100644 --- a/target/sparc/insns.decode +++ b/target/sparc/insns.decode @@ -171,6 +171,9 @@ MULX 10 ..... 001001 ..... . ............. @r_r_ri_cc0 UMUL 10 ..... 0.1010 ..... . ............. @r_r_ri_cc SMUL 10 ..... 0.1011 ..... . ............. @r_r_ri_cc +UDIVX 10 ..... 001101 ..... . ............. @r_r_ri_cc0 +SDIVX 10 ..... 101101 ..... . ............. @r_r_ri_cc0 + Tcc_r 10 0 cond:4 111010 rs1:5 0 cc:1 0000000 rs2:5 { # For v7, the entire simm13 field is present, but masked to 7 bits. diff --git a/target/sparc/translate.c b/target/sparc/translate.c index 7e2a74a816..6ea857d8ee 100644 --- a/target/sparc/translate.c +++ b/target/sparc/translate.c @@ -53,6 +53,8 @@ #define gen_helper_write_softint(E, S) qemu_build_not_reached() #define gen_helper_saved ({ qemu_build_not_reached(); NULL; }) #define gen_helper_restored ({ qemu_build_not_reached(); NULL; }) +#define gen_helper_udivx(D, E, A, B) qemu_build_not_reached() +#define gen_helper_sdivx(D, E, A, B) qemu_build_not_reached() #endif /* Dynamic PC, must exit to main loop. */ @@ -685,6 +687,16 @@ static void gen_op_smul(TCGv dst, TCGv src1, TCGv src2) gen_op_multiply(dst, src1, src2, 1); } +static void gen_op_udivx(TCGv dst, TCGv src1, TCGv src2) +{ + gen_helper_udivx(dst, tcg_env, src1, src2); +} + +static void gen_op_sdivx(TCGv dst, TCGv src1, TCGv src2) +{ + gen_helper_sdivx(dst, tcg_env, src1, src2); +} + // 1 static void gen_op_eval_ba(TCGv dst) { @@ -4233,6 +4245,8 @@ TRANS(XORN, ALL, do_arith, a, CC_OP_LOGIC, tcg_gen_eqv_tl, NULL) TRANS(MULX, 64, do_arith, a, 0, tcg_gen_mul_tl, tcg_gen_muli_tl) TRANS(UMUL, MUL, do_arith, a, CC_OP_LOGIC, gen_op_umul, NULL) TRANS(SMUL, MUL, do_arith, a, CC_OP_LOGIC, gen_op_smul, NULL) +TRANS(UDIVX, 64, do_arith, a, 0, gen_op_udivx, NULL) +TRANS(SDIVX, 64, do_arith, a, 0, gen_op_sdivx, NULL) static bool trans_OR(DisasContext *dc, arg_r_r_ri_cc *a) { @@ -4755,11 +4769,6 @@ static void disas_sparc_legacy(DisasContext *dc, unsigned int insn) cpu_src1 = get_src1(dc, insn); cpu_src2 = get_src2(dc, insn); switch (xop & ~0x10) { -#ifdef TARGET_SPARC64 - case 0xd: /* V9 udivx */ - gen_helper_udivx(cpu_dst, tcg_env, cpu_src1, cpu_src2); - break; -#endif case 0xe: /* udiv */ CHECK_IU_FEATURE(dc, DIV); if (xop & 0x10) { @@ -4897,10 +4906,6 @@ static void disas_sparc_legacy(DisasContext *dc, unsigned int insn) gen_store_gpr(dc, rd, dst); break; } - case 0x2d: /* V9 sdivx */ - gen_helper_sdivx(cpu_dst, tcg_env, cpu_src1, cpu_src2); - gen_store_gpr(dc, rd, cpu_dst); - break; case 0x2e: /* V9 popc */ tcg_gen_ctpop_tl(cpu_dst, cpu_src2); gen_store_gpr(dc, rd, cpu_dst); From patchwork Sun Oct 22 05:59:36 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 736978 Delivered-To: patch@linaro.org Received: by 2002:adf:dd81:0:b0:32d:baff:b0ca with SMTP id x1csp1006096wrl; Sat, 21 Oct 2023 23:13:47 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGzZiiTZHbo+GCPpIwPbHw3tyfWtSGxl6uKOqSj7b1b3jA6MWDr/g3B/MdJbvq/ZBViUNQJ X-Received: by 2002:a05:6214:76c:b0:66d:2785:a2b0 with SMTP id f12-20020a056214076c00b0066d2785a2b0mr6639605qvz.29.1697955227358; Sat, 21 Oct 2023 23:13:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697955227; cv=none; d=google.com; s=arc-20160816; b=bHQ/tmqEMSpk2el5uIKXwVFwtlhVNzqSCYWHYJ0WQFjQgp+bf86lS4gkf60KutgOrd 4z2KkiBcg17jnt9Y3pl4Sq0jCVtSHBRcUdjKBMyO5Mqkil0qdb0CbQTFTBXwC5uiY/2a wEq8nkLWqS4OzIUCluV5c/72NDfayocd1Om5eoy6gnOCDDmRl/MTnjnRSBS8wjej8aCw k8x8X0DTR1Jek+O2DOYFaFicUwi6Pce8XETGNCr2PWjtPY0weEqCNusGWfEqTwiHtfSS APDggpRzxJWB1c9WPEFVXSqNcRvRylxfkzyHCfcfmxDaen1KcwEnTdyWBZ2W9s5jHNwc Wjkg== 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=tSTo0ZVmcIXBU4sUhgJJIvQTxyh09KNFKUZt0nqCMgk=; fh=TYrED6TOMxGX0VC4GtjviASLbYyJe19+7/tKWjN44KQ=; b=a4Gwfku+GcdX2ipoAB7K6w2VTmVHK6zmmWjbHQ/7jx4vAG6wPxv1uCw033+KW2epxm 9oZJ4CYeOADLsD0jA6+qxStjZOZkYayRuMZk+xpvZy0HazzTnRg4RRFNagU82aFIAi3M ye+B4w/iZuHB4pzQlo5Ls9J+eIEoZ+EfgFfz45XDv2v18uizcj2wEiRtHX0bYGtnjYyP Xf/kbkLIjbUGfUd8haeMUenUEH+0wpvaTKzXCD4gF8pTvIk/b0brnKU9DSJRTlMpcldI 8nPqKZRKfECU/cCohIcAGXgL01xVxjo0s7tmKlM7VN4PfkmjCQYdllXQyfZ2SavyJw0X uqUA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=TcvGSaR4; 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 e1-20020a05620a014100b007740f66ad68si3499347qkn.314.2023.10.21.23.13.47 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sat, 21 Oct 2023 23:13:47 -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=TcvGSaR4; 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 1quRX0-0001Tn-P8; Sun, 22 Oct 2023 02:01:46 -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 1quRWp-0000zL-0C for qemu-devel@nongnu.org; Sun, 22 Oct 2023 02:01:36 -0400 Received: from mail-pj1-x1033.google.com ([2607:f8b0:4864:20::1033]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1quRWn-0001hr-6v for qemu-devel@nongnu.org; Sun, 22 Oct 2023 02:01:34 -0400 Received: by mail-pj1-x1033.google.com with SMTP id 98e67ed59e1d1-27d113508bfso1908668a91.3 for ; Sat, 21 Oct 2023 23:01:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1697954491; x=1698559291; 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=tSTo0ZVmcIXBU4sUhgJJIvQTxyh09KNFKUZt0nqCMgk=; b=TcvGSaR4ntDbQ8lLdBtj+teX5enCFzhOYTz6Rg08baJaHfz5tO41wDcuRj4BYQehwp D94TL8t3O3hloR+MMEdMGcQ0ctf3AnI3iuE+jiZX/cD1sSJh44ItQlI8mc2VkCLSYwPq LnWi+k67kUYVjEloR7PUBTMTd/g6Xgm2Fry0QFAhnLj3r9i6wD2fCXABooInb1lL3j4U lWv2ExMp1O/4h6Ph1c68kFSAY16f7zrejg+OD3gO7pE1y5gfis1uZx2W8L4IQxSirfgO TtsB5xnMpEDI+Rfy8dGm6B2Xdax01V8N+Wl9UZn9kiV/fJJ8akI4C8kIhUn0Sqgqi/es S2mA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697954491; x=1698559291; 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=tSTo0ZVmcIXBU4sUhgJJIvQTxyh09KNFKUZt0nqCMgk=; b=uddypqxlPPapIVcYYCGuNycmfabkFcPs7Rl3zeUwkOnJOQusU7fTwaipmBp5vx4J2E 8xjvsujbbKsv2Wo0QA/dHwsIilsKoB26XfVayWKGb7Jcv9FMhu62YtAevIovqd5K7cjJ e+WfXGnVYe21lFZOxTczmOPavtF5bjPLcV83eHSGGyPUK8QMirc2y1fPCGAJXMhnizpN d1SbHGJJcposuxEnE25UiLTNAU0YUKGaKlAOXW6KE2mphh3cxrHTW0VBXR3EotXsJt3P K7EitT2ZYwX/dxu7UG53sdNLx5z2PQOIfgivX6Npg+V+oXIgXYUVqo05MxWqJOu4pcrI 9iIA== X-Gm-Message-State: AOJu0YwVAFpFNEju4ecppb11LEC7VHR1wyCBbOSMUAK9PaMQA/vLsUYC RmbU01yIEm36w9Pk5Qrmzu2IactsZMbI6My0i2Q= X-Received: by 2002:a17:90a:5286:b0:27c:fe72:6e9 with SMTP id w6-20020a17090a528600b0027cfe7206e9mr6097902pjh.27.1697954491613; Sat, 21 Oct 2023 23:01:31 -0700 (PDT) Received: from stoup.. ([71.212.149.95]) by smtp.gmail.com with ESMTPSA id je17-20020a170903265100b001c728609574sm3999887plb.6.2023.10.21.23.01.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 21 Oct 2023 23:01:31 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: mark.cave-ayland@ilande.co.uk Subject: [PATCH v4 35/90] target/sparc: Move UDIV, SDIV to decodetree Date: Sat, 21 Oct 2023 22:59:36 -0700 Message-Id: <20231022060031.490251-36-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231022060031.490251-1-richard.henderson@linaro.org> References: <20231022060031.490251-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::1033; envelope-from=richard.henderson@linaro.org; helo=mail-pj1-x1033.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 | 2 ++ target/sparc/helper.c | 4 --- target/sparc/translate.c | 55 ++++++++++++++++++--------------------- 3 files changed, 28 insertions(+), 33 deletions(-) diff --git a/target/sparc/insns.decode b/target/sparc/insns.decode index dd0ed3a993..4415d03858 100644 --- a/target/sparc/insns.decode +++ b/target/sparc/insns.decode @@ -173,6 +173,8 @@ SMUL 10 ..... 0.1011 ..... . ............. @r_r_ri_cc UDIVX 10 ..... 001101 ..... . ............. @r_r_ri_cc0 SDIVX 10 ..... 101101 ..... . ............. @r_r_ri_cc0 +UDIV 10 ..... 0.1110 ..... . ............. @r_r_ri_cc +SDIV 10 ..... 0.1111 ..... . ............. @r_r_ri_cc Tcc_r 10 0 cond:4 111010 rs1:5 0 cc:1 0000000 rs2:5 { diff --git a/target/sparc/helper.c b/target/sparc/helper.c index c4358bba84..e25fdaeedd 100644 --- a/target/sparc/helper.c +++ b/target/sparc/helper.c @@ -102,9 +102,7 @@ static target_ulong do_udiv(CPUSPARCState *env, target_ulong a, } if (cc) { - env->cc_dst = x0; env->cc_src2 = overflow; - env->cc_op = CC_OP_DIV; } return x0; } @@ -143,9 +141,7 @@ static target_ulong do_sdiv(CPUSPARCState *env, target_ulong a, } if (cc) { - env->cc_dst = x0; env->cc_src2 = overflow; - env->cc_op = CC_OP_DIV; } return x0; } diff --git a/target/sparc/translate.c b/target/sparc/translate.c index 6ea857d8ee..efe62e3d59 100644 --- a/target/sparc/translate.c +++ b/target/sparc/translate.c @@ -697,6 +697,26 @@ static void gen_op_sdivx(TCGv dst, TCGv src1, TCGv src2) gen_helper_sdivx(dst, tcg_env, src1, src2); } +static void gen_op_udiv(TCGv dst, TCGv src1, TCGv src2) +{ + gen_helper_udiv(dst, tcg_env, src1, src2); +} + +static void gen_op_sdiv(TCGv dst, TCGv src1, TCGv src2) +{ + gen_helper_sdiv(dst, tcg_env, src1, src2); +} + +static void gen_op_udivcc(TCGv dst, TCGv src1, TCGv src2) +{ + gen_helper_udiv_cc(dst, tcg_env, src1, src2); +} + +static void gen_op_sdivcc(TCGv dst, TCGv src1, TCGv src2) +{ + gen_helper_sdiv_cc(dst, tcg_env, src1, src2); +} + // 1 static void gen_op_eval_ba(TCGv dst) { @@ -2911,6 +2931,7 @@ static void gen_faligndata(TCGv dst, TCGv gsr, TCGv s1, TCGv s2) # define avail_64(C) false #endif #define avail_ASR17(C) ((C)->def->features & CPU_FEATURE_ASR17) +#define avail_DIV(C) ((C)->def->features & CPU_FEATURE_DIV) #define avail_GL(C) ((C)->def->features & CPU_FEATURE_GL) #define avail_HYPV(C) ((C)->def->features & CPU_FEATURE_HYPV) #define avail_MUL(C) ((C)->def->features & CPU_FEATURE_MUL) @@ -4247,6 +4268,10 @@ TRANS(UMUL, MUL, do_arith, a, CC_OP_LOGIC, gen_op_umul, NULL) TRANS(SMUL, MUL, do_arith, a, CC_OP_LOGIC, gen_op_smul, NULL) TRANS(UDIVX, 64, do_arith, a, 0, gen_op_udivx, NULL) TRANS(SDIVX, 64, do_arith, a, 0, gen_op_sdivx, NULL) +TRANS(UDIV, DIV, do_arith, a, CC_OP_DIV, + a->cc ? gen_op_udivcc : gen_op_udiv, NULL) +TRANS(SDIV, DIV, do_arith, a, CC_OP_DIV, + a->cc ? gen_op_sdivcc : gen_op_sdiv, NULL) static bool trans_OR(DisasContext *dc, arg_r_r_ri_cc *a) { @@ -4766,35 +4791,7 @@ static void disas_sparc_legacy(DisasContext *dc, unsigned int insn) #endif } else if (xop < 0x36) { if (xop < 0x20) { - cpu_src1 = get_src1(dc, insn); - cpu_src2 = get_src2(dc, insn); - switch (xop & ~0x10) { - case 0xe: /* udiv */ - CHECK_IU_FEATURE(dc, DIV); - if (xop & 0x10) { - gen_helper_udiv_cc(cpu_dst, tcg_env, cpu_src1, - cpu_src2); - dc->cc_op = CC_OP_DIV; - } else { - gen_helper_udiv(cpu_dst, tcg_env, cpu_src1, - cpu_src2); - } - break; - case 0xf: /* sdiv */ - CHECK_IU_FEATURE(dc, DIV); - if (xop & 0x10) { - gen_helper_sdiv_cc(cpu_dst, tcg_env, cpu_src1, - cpu_src2); - dc->cc_op = CC_OP_DIV; - } else { - gen_helper_sdiv(cpu_dst, tcg_env, cpu_src1, - cpu_src2); - } - break; - default: - goto illegal_insn; - } - gen_store_gpr(dc, rd, cpu_dst); + goto illegal_insn; } else { cpu_src1 = get_src1(dc, insn); cpu_src2 = get_src2(dc, insn); From patchwork Sun Oct 22 05:59:37 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 736988 Delivered-To: patch@linaro.org Received: by 2002:adf:dd81:0:b0:32d:baff:b0ca with SMTP id x1csp1006164wrl; Sat, 21 Oct 2023 23:14:05 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFdz/XrjT0Bc5pEnKZuvXHjDMhtNOySklxxHf+OU+GhIRGQ9dI+EkYFAyK/0OulBBGfDUBj X-Received: by 2002:a05:6214:242a:b0:658:71e1:5490 with SMTP id gy10-20020a056214242a00b0065871e15490mr8485625qvb.21.1697955244876; Sat, 21 Oct 2023 23:14:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697955244; cv=none; d=google.com; s=arc-20160816; b=k9dojguWbXlpFtCKMJD+66/LEFrlavtpay5pkE/fYmlv1FlJdTmaXk65vRl8MXv9HK reuBH5tSqHOcLrypZestMwmdT+uKJrwp/ikgdOTf4ZxoddD8wYadwjl3FPhN1y6B6aMj s4r2N5aOH1tAl21+36HbyGqwA6fDpQ/xPupFgQ0+12vNmpPkFV+/xaaEJR+3paowlf7R nXHosEuNFDpRlEFcMERjuQCNqBI2lq6GHZsbabf1kJK9hFxzeOiwz4RzfhcLjxQNnc+B bXxLgj5vMT6XuBjHpI+qM4BsA3UdD0k8cowZc1bavFIdSezqA5uOR45XdcU5dtOfw610 6YqA== 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=HXkD+rvdqzNALKCxEFa+poT9hkB/xVhRGYWjgXIaYq4=; fh=TYrED6TOMxGX0VC4GtjviASLbYyJe19+7/tKWjN44KQ=; b=OqX+7GneuAJQFjgUtBB+1j2hNSOpWRN3YflGPXRWqaRcu1H4RltCMGcB2bVs1I3oiR idYrQaHLAjeXV2HPjdM1FgzxacMsBU75z4PNjOLwRjtKxsE80qusoAxdoQ8X5eonapRS BgO5ZKortYHw7g/RkhdaahI7kUc6V0uNxpPL7L1erYPYDUg8RBBK7RRHWpakuDdzZwvY 1njV5cdZtaItjGwhZSM1wkh+63TZM+n4Lm/BNMgYV5DnghmpKdHpiFNtF0cDaWAqCQ9v oyLtatO+/m76ZxHMDiyCfdiLpQPMBgGoZOZhAob9toc51wUt4u0QariBztFCH7FtIgFt cMqQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=TGUKwl3o; 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 cs3-20020ad44c43000000b0065af2299bafsi3826806qvb.276.2023.10.21.23.14.04 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sat, 21 Oct 2023 23:14:04 -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=TGUKwl3o; 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 1quRX0-0001S5-Ld; Sun, 22 Oct 2023 02:01:46 -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 1quRWs-00012e-9D for qemu-devel@nongnu.org; Sun, 22 Oct 2023 02:01:38 -0400 Received: from mail-pf1-x436.google.com ([2607:f8b0:4864:20::436]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1quRWn-0001hy-Gm for qemu-devel@nongnu.org; Sun, 22 Oct 2023 02:01:38 -0400 Received: by mail-pf1-x436.google.com with SMTP id d2e1a72fcca58-6b20a48522fso1749191b3a.1 for ; Sat, 21 Oct 2023 23:01:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1697954492; x=1698559292; 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=HXkD+rvdqzNALKCxEFa+poT9hkB/xVhRGYWjgXIaYq4=; b=TGUKwl3oNRaaLI9crKrBfogw2s7Rob0Z3Vyq7udlk6E7/BytehU26A5Q1YxbvLVgqZ AbN39OKg2oPZvB+OI/FtFiCX8PzPdkkkomo5RRCVAdMBUZstA0Kifl5UVGVyrURhbPUM c2Vj6PcVlmskWQp0FGlKmtsYZnb1wJ1XUiv5dwyTlDcrZu4QrxXZ21pP58dbZxLGg/CF 3NTz2zIg/rYr+dWiylqbycWo/GnZeYkitenrKjqjC3xGG8CltT9FUvTBj6k5TDVnOQgc vqP9AidxmY+KzTW2pdvVIu+8dejBfWD+8W/oYwH0cSnPRTiAFshHfLSOnpSgJhExIRVC k3Cg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697954492; x=1698559292; 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=HXkD+rvdqzNALKCxEFa+poT9hkB/xVhRGYWjgXIaYq4=; b=RTfUWCkhmY9BxN+CZKvGGqSLWkWxnXSBzM8ReIU8VcCFl3NHM5KDCb+1D8uI9rSPhF jqEKLaw5kyaFne7zB4CqiKywA5vizRwqWuKVbzokNJ4Z9u0eFOAb7JNltY+AZebYUxm6 gb/MnIe/L+Fl7o+0sXNKoGn+15L+FT7AZSgxOSFEHL7zWWGKJBi3BF1MWCtrMvJ4vaMY 2FsqkVcysQ22ts624OHzwUQdtEGQlpA2Rbuou/GP4DyCz7LevNsLerYp4HMp18XU+U7o 25rE4GOUQYbYSEs3qC/7hIHgVv7i0d1PEXRZXCtPsvRLszMVENa/fZJMOmlezg+8nROo nS7g== X-Gm-Message-State: AOJu0YxVR0dMpA/mT4kLxN/BJqCiCypdPkyY989IHSr+9bfKzLbPOL24 qkkdmt/tBa8VxkeYV7DYzhRiJgpRm093gZUOWGo= X-Received: by 2002:a17:902:cec9:b0:1c9:b207:d412 with SMTP id d9-20020a170902cec900b001c9b207d412mr4342129plg.37.1697954492309; Sat, 21 Oct 2023 23:01:32 -0700 (PDT) Received: from stoup.. ([71.212.149.95]) by smtp.gmail.com with ESMTPSA id je17-20020a170903265100b001c728609574sm3999887plb.6.2023.10.21.23.01.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 21 Oct 2023 23:01:31 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: mark.cave-ayland@ilande.co.uk Subject: [PATCH v4 36/90] target/sparc: Move TADD, TSUB, MULS to decodetree Date: Sat, 21 Oct 2023 22:59:37 -0700 Message-Id: <20231022060031.490251-37-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231022060031.490251-1-richard.henderson@linaro.org> References: <20231022060031.490251-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::436; envelope-from=richard.henderson@linaro.org; helo=mail-pf1-x436.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, T_SPF_TEMPERROR=0.01 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 | 7 ++++++ target/sparc/helper.c | 4 ---- target/sparc/translate.c | 48 ++++++++++++++++++--------------------- 3 files changed, 29 insertions(+), 30 deletions(-) diff --git a/target/sparc/insns.decode b/target/sparc/insns.decode index 4415d03858..b35921aabb 100644 --- a/target/sparc/insns.decode +++ b/target/sparc/insns.decode @@ -32,6 +32,7 @@ CALL 01 i:s30 &r_r_ri_cc rd rs1 rs2_or_imm imm:bool cc:bool @r_r_ri_cc .. rd:5 . cc:1 .... rs1:5 imm:1 rs2_or_imm:s13 &r_r_ri_cc @r_r_ri_cc0 .. rd:5 ...... rs1:5 imm:1 rs2_or_imm:s13 &r_r_ri_cc cc=0 +@r_r_ri_cc1 .. rd:5 ...... rs1:5 imm:1 rs2_or_imm:s13 &r_r_ri_cc cc=1 { [ @@ -170,12 +171,18 @@ SUBC 10 ..... 0.1100 ..... . ............. @r_r_ri_cc MULX 10 ..... 001001 ..... . ............. @r_r_ri_cc0 UMUL 10 ..... 0.1010 ..... . ............. @r_r_ri_cc SMUL 10 ..... 0.1011 ..... . ............. @r_r_ri_cc +MULScc 10 ..... 100100 ..... . ............. @r_r_ri_cc1 UDIVX 10 ..... 001101 ..... . ............. @r_r_ri_cc0 SDIVX 10 ..... 101101 ..... . ............. @r_r_ri_cc0 UDIV 10 ..... 0.1110 ..... . ............. @r_r_ri_cc SDIV 10 ..... 0.1111 ..... . ............. @r_r_ri_cc +TADDcc 10 ..... 100000 ..... . ............. @r_r_ri_cc1 +TSUBcc 10 ..... 100001 ..... . ............. @r_r_ri_cc1 +TADDccTV 10 ..... 100010 ..... . ............. @r_r_ri_cc1 +TSUBccTV 10 ..... 100011 ..... . ............. @r_r_ri_cc1 + Tcc_r 10 0 cond:4 111010 rs1:5 0 cc:1 0000000 rs2:5 { # For v7, the entire simm13 field is present, but masked to 7 bits. diff --git a/target/sparc/helper.c b/target/sparc/helper.c index e25fdaeedd..2bcdc81d54 100644 --- a/target/sparc/helper.c +++ b/target/sparc/helper.c @@ -198,10 +198,8 @@ target_ulong helper_taddcctv(CPUSPARCState *env, target_ulong src1, } /* Only modify the CC after any exceptions have been generated. */ - env->cc_op = CC_OP_TADDTV; env->cc_src = src1; env->cc_src2 = src2; - env->cc_dst = dst; return dst; tag_overflow: @@ -226,10 +224,8 @@ target_ulong helper_tsubcctv(CPUSPARCState *env, target_ulong src1, } /* Only modify the CC after any exceptions have been generated. */ - env->cc_op = CC_OP_TSUBTV; env->cc_src = src1; env->cc_src2 = src2; - env->cc_dst = dst; return dst; tag_overflow: diff --git a/target/sparc/translate.c b/target/sparc/translate.c index efe62e3d59..179f991c5d 100644 --- a/target/sparc/translate.c +++ b/target/sparc/translate.c @@ -717,6 +717,16 @@ static void gen_op_sdivcc(TCGv dst, TCGv src1, TCGv src2) gen_helper_sdiv_cc(dst, tcg_env, src1, src2); } +static void gen_op_taddcctv(TCGv dst, TCGv src1, TCGv src2) +{ + gen_helper_taddcctv(dst, tcg_env, src1, src2); +} + +static void gen_op_tsubcctv(TCGv dst, TCGv src1, TCGv src2) +{ + gen_helper_tsubcctv(dst, tcg_env, src1, src2); +} + // 1 static void gen_op_eval_ba(TCGv dst) { @@ -4273,6 +4283,11 @@ TRANS(UDIV, DIV, do_arith, a, CC_OP_DIV, TRANS(SDIV, DIV, do_arith, a, CC_OP_DIV, a->cc ? gen_op_sdivcc : gen_op_sdiv, NULL) +TRANS(TADDcc, ALL, do_arith, a, CC_OP_TADD, gen_op_add_cc, NULL) +TRANS(TSUBcc, ALL, do_arith, a, CC_OP_TSUB, gen_op_sub_cc, NULL) +TRANS(TADDccTV, ALL, do_arith, a, CC_OP_TADDTV, gen_op_taddcctv, NULL) +TRANS(TSUBccTV, ALL, do_arith, a, CC_OP_TSUBTV, gen_op_tsubcctv, NULL) + static bool trans_OR(DisasContext *dc, arg_r_r_ri_cc *a) { /* OR with %g0 is the canonical alias for MOV. */ @@ -4370,6 +4385,12 @@ static bool trans_SUBC(DisasContext *dc, arg_r_r_ri_cc *a) return do_arith(dc, a, CC_OP_SUBX, func, NULL); } +static bool trans_MULScc(DisasContext *dc, arg_r_r_ri_cc *a) +{ + update_psr(dc); + return do_arith(dc, a, CC_OP_ADD, gen_op_mulscc, NULL); +} + #define CHECK_IU_FEATURE(dc, FEATURE) \ if (!((dc)->def->features & CPU_FEATURE_ ## FEATURE)) \ goto illegal_insn; @@ -4797,36 +4818,11 @@ static void disas_sparc_legacy(DisasContext *dc, unsigned int insn) cpu_src2 = get_src2(dc, insn); switch (xop) { case 0x20: /* taddcc */ - gen_op_add_cc(cpu_dst, cpu_src1, cpu_src2); - gen_store_gpr(dc, rd, cpu_dst); - tcg_gen_movi_i32(cpu_cc_op, CC_OP_TADD); - dc->cc_op = CC_OP_TADD; - break; case 0x21: /* tsubcc */ - gen_op_sub_cc(cpu_dst, cpu_src1, cpu_src2); - gen_store_gpr(dc, rd, cpu_dst); - tcg_gen_movi_i32(cpu_cc_op, CC_OP_TSUB); - dc->cc_op = CC_OP_TSUB; - break; case 0x22: /* taddcctv */ - gen_helper_taddcctv(cpu_dst, tcg_env, - cpu_src1, cpu_src2); - gen_store_gpr(dc, rd, cpu_dst); - dc->cc_op = CC_OP_TADDTV; - break; case 0x23: /* tsubcctv */ - gen_helper_tsubcctv(cpu_dst, tcg_env, - cpu_src1, cpu_src2); - gen_store_gpr(dc, rd, cpu_dst); - dc->cc_op = CC_OP_TSUBTV; - break; case 0x24: /* mulscc */ - update_psr(dc); - gen_op_mulscc(cpu_dst, cpu_src1, cpu_src2); - gen_store_gpr(dc, rd, cpu_dst); - tcg_gen_movi_i32(cpu_cc_op, CC_OP_ADD); - dc->cc_op = CC_OP_ADD; - break; + goto illegal_insn; /* in decodetree */ #ifndef TARGET_SPARC64 case 0x25: /* sll */ if (IS_IMM) { /* immediate */ From patchwork Sun Oct 22 05:59:38 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 736963 Delivered-To: patch@linaro.org Received: by 2002:adf:dd81:0:b0:32d:baff:b0ca with SMTP id x1csp1005794wrl; Sat, 21 Oct 2023 23:12:26 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHErl+veE6Aoz7LNMIEvubmP/Pv/AqatdL15jjyM7QUZgthDx9qhwgJAZIP5/OnhE+3FCKU X-Received: by 2002:a05:620a:40c5:b0:778:b483:83f0 with SMTP id g5-20020a05620a40c500b00778b48383f0mr3899210qko.15.1697955145877; Sat, 21 Oct 2023 23:12:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697955145; cv=none; d=google.com; s=arc-20160816; b=RqH5SrOUJKSq3d5fJCWDALo6E1Ik30W5aL41o+KE3ODIAfD3xIcNd2ukKtIlypNB3d vuHoqKF+5u/0l32K1qv/3kFdpkhD7JOIvH+pGn3nNgQIEefim3tntAc3Hz37ZuZsVKT5 lhwltMclgBHyay/a8fUQ2JC122JxZVcHkGAdhFELTeNAQYEpecdKzadhi0vP6neOGHTE smVhQIG3WPxuU7UedOBc4pWPwOHuvklJac8IF4ctPsDl3pwfJ46zldDcTJ7svjow42b+ aEv6TlOzUr/Snt9yuQ/Ru4iWgxGj9xLCNJ/5R/nP9wNTNI8rU9u59PjauQyzn8vArEDv vRYg== 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=NWlKsn/wZN4eT45rH03CDpAb6KA/TazNayvN7ccWLg0=; fh=TYrED6TOMxGX0VC4GtjviASLbYyJe19+7/tKWjN44KQ=; b=069wpehPDp/Rrpio6M/vUf+H+Hbijm6A6BjY5BAMrBqlPBaUBGQ08QfTLZ+heSC4G4 mnzgbIeoby9MN17v6bVkttOOX+nE0azPlMW2gZJs6tegAIvk5lTspO7BzyDIMTWrweNw Sh6zVB+8oySd+70HyqIKTLWvRVIWw6SIWfZcwJbG/K1slnhrac7UKgp7D92t6N5XhfnD 7/evxx9oZ8Gz/rCq7V/tfW8tx5e9+/ASnwuhq8vStyY6Tj4I0DoBY4CRI0U3Bvy1G0Bw AH8g0G+Fj5MP2757DRvPVBvMOflGaqS/PPp8gIgV6UlArWC2cqSnrCYpnot921dbOlWz jpeQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=VC1V+VVS; 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 x12-20020a05620a448c00b00774d385db69si3784228qkp.184.2023.10.21.23.12.25 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sat, 21 Oct 2023 23:12:25 -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=VC1V+VVS; 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 1quRX4-0001r2-0D; Sun, 22 Oct 2023 02:01:50 -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 1quRWt-00018H-Ee for qemu-devel@nongnu.org; Sun, 22 Oct 2023 02:01:40 -0400 Received: from mail-pf1-x432.google.com ([2607:f8b0:4864:20::432]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1quRWp-0001iI-G7 for qemu-devel@nongnu.org; Sun, 22 Oct 2023 02:01:39 -0400 Received: by mail-pf1-x432.google.com with SMTP id d2e1a72fcca58-6bd96cfb99cso1659278b3a.2 for ; Sat, 21 Oct 2023 23:01:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1697954493; x=1698559293; 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=NWlKsn/wZN4eT45rH03CDpAb6KA/TazNayvN7ccWLg0=; b=VC1V+VVS/jtW5bQPJ3/0nJBvk2XaxnXFX6gZoy5MdYw+d/SsOlQWSVdZdgfd1hkV+y UIUY78Pt9tOei8s7nF5MgOTZ0i/cy3C73T5OsjN7eoQjoqw4x6SGldRQhtNsXsNCPCAS EQBIvP7/q8HrHOWxe1h7UZzfPg3ZQVwOommNPu4UT55z5IWTWwWci+pBkzP1v6YQDXg3 8PV4/v44b9z/6U2J0dLwT/k3Cw2wk/gFyj/jRPUA9uK4XwayWzqCOcPtrG+QpeHHmqJe koDoKpUVKOf60TC8NE6K24fvyPF+VzoMfntqzH64ZFyvpSJNVXtIoW9VY45ETB0jBcmZ UMfw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697954493; x=1698559293; 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=NWlKsn/wZN4eT45rH03CDpAb6KA/TazNayvN7ccWLg0=; b=QKnl3HrVt9Pqzt4BtQI6L4y1EMkgz/TFXC51bFVf7GAZ/mikDVzzX4PsN7vfR8c2qw q66uhDyMZ0yKKb6F9JKs3rMUzhlMbEkTStft+V4HaKhlo7+aCl1zUaNYv8COS6nFNKT+ bl4d980XWk74jGwk51Q9e13psNoLrDCzQPNwp4NTXxfM/gOrgrpKZqCG0OQiVxx3jr6Z 5+xBUcvlUaUBKTOSgiaRn0/J4etbFN6ttKds1MvgOuHQmH15GS9dt55nOqPOjAJyjzDQ 255LH7HHHXqe2x9tBdS5M4OjhE9TevWeHqzEkDLbEVZ+v2nNCKbNt71kUTF8qEd0EMSo C0Zw== X-Gm-Message-State: AOJu0YzIVwkXGdf6bjLgWxNS90Ysl4dxwvzNnVyer0ojc4oSWXS2+11z iZVPWl1PJWBlXdDjIwjV3M/5tLBIEuDdbdpBR0A= X-Received: by 2002:a17:90b:3883:b0:27d:669e:5a10 with SMTP id mu3-20020a17090b388300b0027d669e5a10mr4059430pjb.13.1697954493055; Sat, 21 Oct 2023 23:01:33 -0700 (PDT) Received: from stoup.. ([71.212.149.95]) by smtp.gmail.com with ESMTPSA id je17-20020a170903265100b001c728609574sm3999887plb.6.2023.10.21.23.01.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 21 Oct 2023 23:01:32 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: mark.cave-ayland@ilande.co.uk Subject: [PATCH v4 37/90] target/sparc: Move SLL, SRL, SRA to decodetree Date: Sat, 21 Oct 2023 22:59:38 -0700 Message-Id: <20231022060031.490251-38-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231022060031.490251-1-richard.henderson@linaro.org> References: <20231022060031.490251-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::432; envelope-from=richard.henderson@linaro.org; helo=mail-pf1-x432.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 | 14 +++ target/sparc/translate.c | 182 ++++++++++++++++---------------------- 2 files changed, 92 insertions(+), 104 deletions(-) diff --git a/target/sparc/insns.decode b/target/sparc/insns.decode index b35921aabb..51cddc826d 100644 --- a/target/sparc/insns.decode +++ b/target/sparc/insns.decode @@ -183,6 +183,20 @@ TSUBcc 10 ..... 100001 ..... . ............. @r_r_ri_cc1 TADDccTV 10 ..... 100010 ..... . ............. @r_r_ri_cc1 TSUBccTV 10 ..... 100011 ..... . ............. @r_r_ri_cc1 +&shiftr rd rs1 rs2 x:bool +@shiftr .. rd:5 ...... rs1:5 . x:1 ....... rs2:5 &shiftr + +SLL_r 10 ..... 100101 ..... 0 . 0000000 ..... @shiftr +SRL_r 10 ..... 100110 ..... 0 . 0000000 ..... @shiftr +SRA_r 10 ..... 100111 ..... 0 . 0000000 ..... @shiftr + +&shifti rd rs1 i x:bool +@shifti .. rd:5 ...... rs1:5 . x:1 ...... i:6 &shifti + +SLL_i 10 ..... 100101 ..... 1 . 000000 ...... @shifti +SRL_i 10 ..... 100110 ..... 1 . 000000 ...... @shifti +SRA_i 10 ..... 100111 ..... 1 . 000000 ...... @shifti + Tcc_r 10 0 cond:4 111010 rs1:5 0 cc:1 0000000 rs2:5 { # For v7, the entire simm13 field is present, but masked to 7 bits. diff --git a/target/sparc/translate.c b/target/sparc/translate.c index 179f991c5d..3785728e66 100644 --- a/target/sparc/translate.c +++ b/target/sparc/translate.c @@ -4391,6 +4391,83 @@ static bool trans_MULScc(DisasContext *dc, arg_r_r_ri_cc *a) return do_arith(dc, a, CC_OP_ADD, gen_op_mulscc, NULL); } +static bool do_shift_r(DisasContext *dc, arg_shiftr *a, bool l, bool u) +{ + TCGv dst, src1, src2; + + /* Reject 64-bit shifts for sparc32. */ + if (avail_32(dc) && a->x) { + return false; + } + + src2 = tcg_temp_new(); + tcg_gen_andi_tl(src2, gen_load_gpr(dc, a->rs2), a->x ? 63 : 31); + src1 = gen_load_gpr(dc, a->rs1); + dst = gen_dest_gpr(dc, a->rd); + + if (l) { + tcg_gen_shl_tl(dst, src1, src2); + if (!a->x) { + tcg_gen_ext32u_tl(dst, dst); + } + } else if (u) { + if (!a->x) { + tcg_gen_ext32u_tl(dst, src1); + src1 = dst; + } + tcg_gen_shr_tl(dst, src1, src2); + } else { + if (!a->x) { + tcg_gen_ext32s_tl(dst, src1); + src1 = dst; + } + tcg_gen_sar_tl(dst, src1, src2); + } + gen_store_gpr(dc, a->rd, dst); + return advance_pc(dc); +} + +TRANS(SLL_r, ALL, do_shift_r, a, true, true) +TRANS(SRL_r, ALL, do_shift_r, a, false, true) +TRANS(SRA_r, ALL, do_shift_r, a, false, false) + +static bool do_shift_i(DisasContext *dc, arg_shifti *a, bool l, bool u) +{ + TCGv dst, src1; + + /* Reject 64-bit shifts for sparc32. */ + if (avail_32(dc) && (a->x || a->i >= 32)) { + return false; + } + + src1 = gen_load_gpr(dc, a->rs1); + dst = gen_dest_gpr(dc, a->rd); + + if (avail_32(dc) || a->x) { + if (l) { + tcg_gen_shli_tl(dst, src1, a->i); + } else if (u) { + tcg_gen_shri_tl(dst, src1, a->i); + } else { + tcg_gen_sari_tl(dst, src1, a->i); + } + } else { + if (l) { + tcg_gen_deposit_z_tl(dst, src1, a->i, 32 - a->i); + } else if (u) { + tcg_gen_extract_tl(dst, src1, a->i, 32 - a->i); + } else { + tcg_gen_sextract_tl(dst, src1, a->i, 32 - a->i); + } + } + gen_store_gpr(dc, a->rd, dst); + return advance_pc(dc); +} + +TRANS(SLL_i, ALL, do_shift_i, a, true, true) +TRANS(SRL_i, ALL, do_shift_i, a, false, true) +TRANS(SRA_i, ALL, do_shift_i, a, false, false) + #define CHECK_IU_FEATURE(dc, FEATURE) \ if (!((dc)->def->features & CPU_FEATURE_ ## FEATURE)) \ goto illegal_insn; @@ -4739,77 +4816,6 @@ static void disas_sparc_legacy(DisasContext *dc, unsigned int insn) default: goto illegal_insn; } -#ifdef TARGET_SPARC64 - } else if (xop == 0x25) { /* sll, V9 sllx */ - cpu_src1 = get_src1(dc, insn); - if (IS_IMM) { /* immediate */ - simm = GET_FIELDs(insn, 20, 31); - if (insn & (1 << 12)) { - tcg_gen_shli_i64(cpu_dst, cpu_src1, simm & 0x3f); - } else { - tcg_gen_shli_i64(cpu_dst, cpu_src1, simm & 0x1f); - } - } else { /* register */ - rs2 = GET_FIELD(insn, 27, 31); - cpu_src2 = gen_load_gpr(dc, rs2); - cpu_tmp0 = tcg_temp_new(); - if (insn & (1 << 12)) { - tcg_gen_andi_i64(cpu_tmp0, cpu_src2, 0x3f); - } else { - tcg_gen_andi_i64(cpu_tmp0, cpu_src2, 0x1f); - } - tcg_gen_shl_i64(cpu_dst, cpu_src1, cpu_tmp0); - } - gen_store_gpr(dc, rd, cpu_dst); - } else if (xop == 0x26) { /* srl, V9 srlx */ - cpu_src1 = get_src1(dc, insn); - if (IS_IMM) { /* immediate */ - simm = GET_FIELDs(insn, 20, 31); - if (insn & (1 << 12)) { - tcg_gen_shri_i64(cpu_dst, cpu_src1, simm & 0x3f); - } else { - tcg_gen_andi_i64(cpu_dst, cpu_src1, 0xffffffffULL); - tcg_gen_shri_i64(cpu_dst, cpu_dst, simm & 0x1f); - } - } else { /* register */ - rs2 = GET_FIELD(insn, 27, 31); - cpu_src2 = gen_load_gpr(dc, rs2); - cpu_tmp0 = tcg_temp_new(); - if (insn & (1 << 12)) { - tcg_gen_andi_i64(cpu_tmp0, cpu_src2, 0x3f); - tcg_gen_shr_i64(cpu_dst, cpu_src1, cpu_tmp0); - } else { - tcg_gen_andi_i64(cpu_tmp0, cpu_src2, 0x1f); - tcg_gen_andi_i64(cpu_dst, cpu_src1, 0xffffffffULL); - tcg_gen_shr_i64(cpu_dst, cpu_dst, cpu_tmp0); - } - } - gen_store_gpr(dc, rd, cpu_dst); - } else if (xop == 0x27) { /* sra, V9 srax */ - cpu_src1 = get_src1(dc, insn); - if (IS_IMM) { /* immediate */ - simm = GET_FIELDs(insn, 20, 31); - if (insn & (1 << 12)) { - tcg_gen_sari_i64(cpu_dst, cpu_src1, simm & 0x3f); - } else { - tcg_gen_ext32s_i64(cpu_dst, cpu_src1); - tcg_gen_sari_i64(cpu_dst, cpu_dst, simm & 0x1f); - } - } else { /* register */ - rs2 = GET_FIELD(insn, 27, 31); - cpu_src2 = gen_load_gpr(dc, rs2); - cpu_tmp0 = tcg_temp_new(); - if (insn & (1 << 12)) { - tcg_gen_andi_i64(cpu_tmp0, cpu_src2, 0x3f); - tcg_gen_sar_i64(cpu_dst, cpu_src1, cpu_tmp0); - } else { - tcg_gen_andi_i64(cpu_tmp0, cpu_src2, 0x1f); - tcg_gen_ext32s_i64(cpu_dst, cpu_src1); - tcg_gen_sar_i64(cpu_dst, cpu_dst, cpu_tmp0); - } - } - gen_store_gpr(dc, rd, cpu_dst); -#endif } else if (xop < 0x36) { if (xop < 0x20) { goto illegal_insn; @@ -4822,42 +4828,10 @@ static void disas_sparc_legacy(DisasContext *dc, unsigned int insn) case 0x22: /* taddcctv */ case 0x23: /* tsubcctv */ case 0x24: /* mulscc */ - goto illegal_insn; /* in decodetree */ -#ifndef TARGET_SPARC64 case 0x25: /* sll */ - if (IS_IMM) { /* immediate */ - simm = GET_FIELDs(insn, 20, 31); - tcg_gen_shli_tl(cpu_dst, cpu_src1, simm & 0x1f); - } else { /* register */ - cpu_tmp0 = tcg_temp_new(); - tcg_gen_andi_tl(cpu_tmp0, cpu_src2, 0x1f); - tcg_gen_shl_tl(cpu_dst, cpu_src1, cpu_tmp0); - } - gen_store_gpr(dc, rd, cpu_dst); - break; case 0x26: /* srl */ - if (IS_IMM) { /* immediate */ - simm = GET_FIELDs(insn, 20, 31); - tcg_gen_shri_tl(cpu_dst, cpu_src1, simm & 0x1f); - } else { /* register */ - cpu_tmp0 = tcg_temp_new(); - tcg_gen_andi_tl(cpu_tmp0, cpu_src2, 0x1f); - tcg_gen_shr_tl(cpu_dst, cpu_src1, cpu_tmp0); - } - gen_store_gpr(dc, rd, cpu_dst); - break; case 0x27: /* sra */ - if (IS_IMM) { /* immediate */ - simm = GET_FIELDs(insn, 20, 31); - tcg_gen_sari_tl(cpu_dst, cpu_src1, simm & 0x1f); - } else { /* register */ - cpu_tmp0 = tcg_temp_new(); - tcg_gen_andi_tl(cpu_tmp0, cpu_src2, 0x1f); - tcg_gen_sar_tl(cpu_dst, cpu_src1, cpu_tmp0); - } - gen_store_gpr(dc, rd, cpu_dst); - break; -#endif + goto illegal_insn; /* in decodetree */ case 0x30: goto illegal_insn; /* WRASR in decodetree */ case 0x32: From patchwork Sun Oct 22 05:59:39 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 736957 Delivered-To: patch@linaro.org Received: by 2002:adf:dd81:0:b0:32d:baff:b0ca with SMTP id x1csp1005610wrl; Sat, 21 Oct 2023 23:11:33 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGUdGTBZHYX29EddqUaMwBN7G+TSkBY79dT/+s3kvR+HTr8G+I3z86+6vXMzBf1+kWnjPZA X-Received: by 2002:ad4:5b85:0:b0:64f:49d1:3fe7 with SMTP id 5-20020ad45b85000000b0064f49d13fe7mr8219399qvp.23.1697955093118; Sat, 21 Oct 2023 23:11:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697955093; cv=none; d=google.com; s=arc-20160816; b=hJQhD4mOjZb5/cyE6VM//M9YJmCIbFBkFRTOFCnctyye85IJfd2N2i1/V9JK+E6c5+ aH5QF3J4xHy5CLTKBE2AhjYPlQYiAp9UoWYaOiGsicZ78yNBnw3AMgXuaBI+SOd98orR Dyv173mBCOSUCN9sXk3uo9LuU1Ow3mcq+X4Bb/yiDZUTD3EmM4JBwgj4x1LIb34Lod+6 Gri4r2/P3MFol3JoxwOTRo3TRgi6Cskn8yqkxXftqdC2igR7eQ/hR4MQ0X4bij0T8IDR hObDkYNU4ZqNam+MbBSjFobKPo/8+GmjqNmMnmYfLUt2RpENMOihLZYgwZp0ZMdcbQAl /y4g== 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=pB9Vhm2yWNKoG9Y3BvzSobyBZzPNG8Ki0Uham9/uwZs=; fh=TYrED6TOMxGX0VC4GtjviASLbYyJe19+7/tKWjN44KQ=; b=G0lRf6folWVsNYfP9u2LwFtatFDcOQIIRA5X9r9Nqa/5uIKUUPMcwDLaxPsE/pq7q9 bxZCKcNTo+1x/Pn/Vn+ZRxh9dhD9J+CFafBmn9cvGXn0I0x8vxPY7Fs1pP/HC21B49So c1Zq6LKviDToLRK2BOMyIsnh/qsKNMtGQuMwQJLQdhp+seVA7+pnRdgjXtwOsL5QlAWG B3WjAbQ/psFH+jCv4VTtISNKX6kVDMAl8c6vu3TIYUtDRzeT18TnSOQuY91tJIO4uAX9 LI6+dZ5Jz2s9ZoFgVn7fN55SL9NekuFrsA19cgSIs7iIShyJh5i7XZdXfCxWTs35p1Wz qSKA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=N34AHRdT; 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 g3-20020ac85803000000b00419842fb21csi3606423qtg.488.2023.10.21.23.11.32 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sat, 21 Oct 2023 23:11:33 -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=N34AHRdT; 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 1quRX4-0001uQ-R4; Sun, 22 Oct 2023 02:01:50 -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 1quRWt-00017Y-7f for qemu-devel@nongnu.org; Sun, 22 Oct 2023 02:01:40 -0400 Received: from mail-pf1-x42a.google.com ([2607:f8b0:4864:20::42a]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1quRWq-0001iV-7A for qemu-devel@nongnu.org; Sun, 22 Oct 2023 02:01:38 -0400 Received: by mail-pf1-x42a.google.com with SMTP id d2e1a72fcca58-6b3c2607d9bso1766943b3a.1 for ; Sat, 21 Oct 2023 23:01:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1697954494; x=1698559294; 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=pB9Vhm2yWNKoG9Y3BvzSobyBZzPNG8Ki0Uham9/uwZs=; b=N34AHRdTJtAYFmFahK9fo9/ESZcWHJ7IqW1MyuFDACs/wH1Qkd8BeQqNroDTlrRiMF 31BYMYN6JilfpvTDXcese/NY7RZKkpgfmTFKEkFA9iFFAl2dMt7cgOvG2FNytQQxUnfw cRWoEKUePzlrzOqH2lykNyjhkYl3ymRAXjXCqAmlEnYgR329pHQ2n5ZiEmDjrCeKvXcy mEqmxabad2KeMOp2VTCrxh9tu9/a47gCBiN51UTx7UH77WblR+UK4MQqKa+5Ij14Ck2i k25S04nPu0la6CB9tnaOYoBErEm9mbDf5sHq71iiJr9uSxfDAo9/krBEiLMP2TjbpaIr W4zg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697954494; x=1698559294; 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=pB9Vhm2yWNKoG9Y3BvzSobyBZzPNG8Ki0Uham9/uwZs=; b=VgAEipDc5AtQRdaGtwGNxSIO7PDQiNKvpG9/19fymdr8+L288DKhFBNva5/L/Gn0UM Scx9ykkAyMi0ysdLf5sCGsMYMbQk1y6SQowmjVv9vxn9h9C0HBn77npN2+G0PitMeIRu UyD1xZvqtBJN5s93KMsSrg3A6I0Sakyx06r1o26E6bVCmbKU8pALJJSin0/VRGmmXaSy 8IhyhaFxJyHjn9/EWAJY33wauIkgwK/uB5oJ61v+v3zoRnt5bxtwQcO3LeDxJNgHf6wq OMB7N0qCfZavbp1i1PRSqwrM2RuG7PJumW2pwOx49NGRmDuCO3VQpwk8ymB00ySecsaD hafQ== X-Gm-Message-State: AOJu0YxKwlBMgLFuAWuSl/3MJP3ZitCL5f6d5TG2fItemROGCw1jexMn RsujwBmHMBl4d0duq/SPD1gDqhiXzUU+FUzvJbs= X-Received: by 2002:a05:6300:8089:b0:171:4921:f1b7 with SMTP id ap9-20020a056300808900b001714921f1b7mr4895231pzc.41.1697954493936; Sat, 21 Oct 2023 23:01:33 -0700 (PDT) Received: from stoup.. ([71.212.149.95]) by smtp.gmail.com with ESMTPSA id je17-20020a170903265100b001c728609574sm3999887plb.6.2023.10.21.23.01.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 21 Oct 2023 23:01:33 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: mark.cave-ayland@ilande.co.uk Subject: [PATCH v4 38/90] target/sparc: Move MOVcc, MOVR to decodetree Date: Sat, 21 Oct 2023 22:59:39 -0700 Message-Id: <20231022060031.490251-39-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231022060031.490251-1-richard.henderson@linaro.org> References: <20231022060031.490251-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::42a; envelope-from=richard.henderson@linaro.org; helo=mail-pf1-x42a.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 | 4 ++ target/sparc/translate.c | 116 ++++++++++++++++++++------------------ 2 files changed, 64 insertions(+), 56 deletions(-) diff --git a/target/sparc/insns.decode b/target/sparc/insns.decode index 51cddc826d..cb21405e1a 100644 --- a/target/sparc/insns.decode +++ b/target/sparc/insns.decode @@ -209,3 +209,7 @@ Tcc_r 10 0 cond:4 111010 rs1:5 0 cc:1 0000000 rs2:5 # Bits [10:8] are reserved and the OSA2011 manual says they must be 0. Tcc_i_v9 10 0 cond:4 111010 rs1:5 1 cc:1 0 000 i:8 } + +MOVcc 10 rd:5 101100 1 cond:4 imm:1 cc:1 0 rs2_or_imm:s11 +MOVfcc 10 rd:5 101100 0 cond:4 imm:1 cc:2 rs2_or_imm:s11 +MOVR 10 rd:5 101111 rs1:5 imm:1 cond:3 rs2_or_imm:s10 diff --git a/target/sparc/translate.c b/target/sparc/translate.c index 3785728e66..b907873359 100644 --- a/target/sparc/translate.c +++ b/target/sparc/translate.c @@ -4468,6 +4468,64 @@ TRANS(SLL_i, ALL, do_shift_i, a, true, true) TRANS(SRL_i, ALL, do_shift_i, a, false, true) TRANS(SRA_i, ALL, do_shift_i, a, false, false) +static TCGv gen_rs2_or_imm(DisasContext *dc, bool imm, int rs2_or_imm) +{ + /* For simplicity, we under-decoded the rs2 form. */ + if (!imm && rs2_or_imm & ~0x1f) { + return NULL; + } + if (imm || rs2_or_imm == 0) { + return tcg_constant_tl(rs2_or_imm); + } else { + return cpu_regs[rs2_or_imm]; + } +} + +static bool do_mov_cond(DisasContext *dc, DisasCompare *cmp, int rd, TCGv src2) +{ + TCGv dst = gen_load_gpr(dc, rd); + + tcg_gen_movcond_tl(cmp->cond, dst, cmp->c1, cmp->c2, src2, dst); + gen_store_gpr(dc, rd, dst); + return advance_pc(dc); +} + +static bool trans_MOVcc(DisasContext *dc, arg_MOVcc *a) +{ + TCGv src2 = gen_rs2_or_imm(dc, a->imm, a->rs2_or_imm); + DisasCompare cmp; + + if (src2 == NULL) { + return false; + } + gen_compare(&cmp, a->cc, a->cond, dc); + return do_mov_cond(dc, &cmp, a->rd, src2); +} + +static bool trans_MOVfcc(DisasContext *dc, arg_MOVfcc *a) +{ + TCGv src2 = gen_rs2_or_imm(dc, a->imm, a->rs2_or_imm); + DisasCompare cmp; + + if (src2 == NULL) { + return false; + } + gen_fcompare(&cmp, a->cc, a->cond); + return do_mov_cond(dc, &cmp, a->rd, src2); +} + +static bool trans_MOVR(DisasContext *dc, arg_MOVR *a) +{ + TCGv src2 = gen_rs2_or_imm(dc, a->imm, a->rs2_or_imm); + DisasCompare cmp; + + if (src2 == NULL) { + return false; + } + gen_compare_reg(&cmp, a->cond, gen_load_gpr(dc, a->rs1)); + return do_mov_cond(dc, &cmp, a->rd, src2); +} + #define CHECK_IU_FEATURE(dc, FEATURE) \ if (!((dc)->def->features & CPU_FEATURE_ ## FEATURE)) \ goto illegal_insn; @@ -4840,66 +4898,12 @@ static void disas_sparc_legacy(DisasContext *dc, unsigned int insn) goto illegal_insn; /* WRTBR, WRHPR in decodetree */ #ifdef TARGET_SPARC64 case 0x2c: /* V9 movcc */ - { - int cc = GET_FIELD_SP(insn, 11, 12); - int cond = GET_FIELD_SP(insn, 14, 17); - DisasCompare cmp; - TCGv dst; - - if (insn & (1 << 18)) { - if (cc == 0) { - gen_compare(&cmp, 0, cond, dc); - } else if (cc == 2) { - gen_compare(&cmp, 1, cond, dc); - } else { - goto illegal_insn; - } - } else { - gen_fcompare(&cmp, cc, cond); - } - - /* The get_src2 above loaded the normal 13-bit - immediate field, not the 11-bit field we have - in movcc. But it did handle the reg case. */ - if (IS_IMM) { - simm = GET_FIELD_SPs(insn, 0, 10); - tcg_gen_movi_tl(cpu_src2, simm); - } - - dst = gen_load_gpr(dc, rd); - tcg_gen_movcond_tl(cmp.cond, dst, - cmp.c1, cmp.c2, - cpu_src2, dst); - gen_store_gpr(dc, rd, dst); - break; - } + case 0x2f: /* V9 movr */ + goto illegal_insn; /* in decodetree */ case 0x2e: /* V9 popc */ tcg_gen_ctpop_tl(cpu_dst, cpu_src2); gen_store_gpr(dc, rd, cpu_dst); break; - case 0x2f: /* V9 movr */ - { - int cond = GET_FIELD_SP(insn, 10, 12); - DisasCompare cmp; - TCGv dst; - - gen_compare_reg(&cmp, cond, cpu_src1); - - /* The get_src2 above loaded the normal 13-bit - immediate field, not the 10-bit field we have - in movr. But it did handle the reg case. */ - if (IS_IMM) { - simm = GET_FIELD_SPs(insn, 0, 9); - tcg_gen_movi_tl(cpu_src2, simm); - } - - dst = gen_load_gpr(dc, rd); - tcg_gen_movcond_tl(cmp.cond, dst, - cmp.c1, cmp.c2, - cpu_src2, dst); - gen_store_gpr(dc, rd, dst); - break; - } #endif default: goto illegal_insn; From patchwork Sun Oct 22 05:59:40 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 736938 Delivered-To: patch@linaro.org Received: by 2002:adf:dd81:0:b0:32d:baff:b0ca with SMTP id x1csp1003961wrl; Sat, 21 Oct 2023 23:05:01 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEKhO+STCK9vepxF9E5bpe3qs26BZPl2dHHmpNbAurNPXpJxJhoBZa2Un0a2r18eJj2Tzbo X-Received: by 2002:a05:620a:8292:b0:778:953e:3433 with SMTP id ox18-20020a05620a829200b00778953e3433mr5308093qkn.31.1697954701132; Sat, 21 Oct 2023 23:05:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697954701; cv=none; d=google.com; s=arc-20160816; b=VyGZeRMMRxQtH6wXs7AhoAhXPitMGlq7uun1Btws8e8Jmybeqs/RLkExgSgg4u80jG YLZg6n7MQV5ciHGtx8ChkOoU5TpSJ1cphQqbl/VpmXFZS3RyN3+6kgng/VEeQHi9xL5x ImhsoP0u1mtDQFoZ7pxIWvCMpNd7TKhujHRXGbY5Fet6V53VQ8wnzjrLJP1Dxq6L+GJ3 zEBAPNxkKeIC6rxWlpfemyQ+pUtCxYUAZcGTAxIEVmu714kMvxYsyFmFBdlfNJ9Pv6SA 88MVIDkkfPAJa2eJuFY/q8bQpDgm4eOuw5mlACd+wCdHzLJPkMThUGTWNssa2HC3/adj bLCA== 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=7rGtH1mlIN2jrrxzbt2zOrF5UKFFP1IE2RgIKYzMTdo=; fh=TYrED6TOMxGX0VC4GtjviASLbYyJe19+7/tKWjN44KQ=; b=ZjBVAv9xfmRPN+SPUjYZ5ijmlmNqR+MM9Mfd4E5P83MPJbKAgs4zFlH1MHF2QL4d4Q seLKC8AG04fUIq8E7WmiGa3VDwAUT1nz+GPJCJkoJiZzI86rBZk1ua7ZPDWGFbbQqpK/ FeEN6/9Y9BmDd+ZeOu0Y+TuRTX5eSm4KrQX41s5dCjFEGvli2PKhCHbctrh02vzsZupM mZMQbBBG18iRYZRXkVLmJWAVDIs7iB5CKWM94hVEESgKcmtqE7Id4D/9BH0p5QK3aHTu dJDXO7JaR7KbiDfCQqV5Zjdb2J+4VNn4IzXFPBwkMZftsnw9Q4P7ASmj8kZXEiOYGux6 EHdg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Cvrqihh6; 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 x9-20020ae9e909000000b0077898244b50si3679258qkf.119.2023.10.21.23.05.00 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sat, 21 Oct 2023 23:05:01 -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=Cvrqihh6; 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 1quRX4-0001sG-9W; Sun, 22 Oct 2023 02:01:50 -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 1quRWt-00017Q-6y for qemu-devel@nongnu.org; Sun, 22 Oct 2023 02:01:39 -0400 Received: from mail-oi1-x233.google.com ([2607:f8b0:4864:20::233]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1quRWp-0001ie-OJ for qemu-devel@nongnu.org; Sun, 22 Oct 2023 02:01:38 -0400 Received: by mail-oi1-x233.google.com with SMTP id 5614622812f47-3b2ec5ee2e4so1583097b6e.3 for ; Sat, 21 Oct 2023 23:01:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1697954494; x=1698559294; 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=7rGtH1mlIN2jrrxzbt2zOrF5UKFFP1IE2RgIKYzMTdo=; b=Cvrqihh6xmmVzlbdhqEWnJmDCZzkFu+eZ0cR7ihvMJUkMihdXS3BXZ00f/1xifXq5z 8T0ZX7JcfElXgRO8R3wUJRge6NgZusvpmrCMwxtNRizz2wxwCw6mBaEy+9HqM/WdhaJ4 WM7Xc6zsFR4CjW4i68j2cs7VVeWL9su8oArnZUFK4sKk0OIT2pETUGBsDoxeaKeye/Bz baZy0zV9ylTFh00ghVQcAVy8wBY7HJ6dPxh+f1dUiyGPHKmFaum/H0UoFhN9obyI9TSu IrhdAgL2MMFasb+VlfsjIalUdW54UYYIoMhHvrHWtLn3tQR3fGxOTekUrAHL2GmZOzAn +uAw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697954494; x=1698559294; 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=7rGtH1mlIN2jrrxzbt2zOrF5UKFFP1IE2RgIKYzMTdo=; b=M9huMMpySALsxJs7BL9yKR3gl2y4L21Vbi/OniF3BP5BOk1ItrlJetkOYSbA9s4Ena 6ZEuUxYOjiS548Cm1MA5I+Stip0541MEGN6F4zWoENvc2oRcEoprDX24fRObz0kL2W1L rb2qLGg1vn1y2biMqFGted3FGY9p2O7+l2wgU9Ebd3BU4hqTaSUy66WLS9I1rJPDsMUy +TBvm8oDG8sdgOIh0RgwSluULtGOV9bqYCISBoOM/TpZNK9Fx14lLNsbQENuBbbDBVdu ctOtyqoYFs8XhW8ZFzuBd3p8ybRUFsOzqgrBHeCxvooubfgCwTgAWqX6oWOKESLQKCxX mYcA== X-Gm-Message-State: AOJu0YzxF3kByN3OFuMrODI6HuHhgdw/VptuWPkF0PahZBpixyElnJZy rBm2rad6mi4DAvUjNHAqDIEb0piR3kzhcz/tEvk= X-Received: by 2002:a05:6870:9728:b0:1e9:e02e:f4c8 with SMTP id n40-20020a056870972800b001e9e02ef4c8mr8023589oaq.54.1697954494651; Sat, 21 Oct 2023 23:01:34 -0700 (PDT) Received: from stoup.. ([71.212.149.95]) by smtp.gmail.com with ESMTPSA id je17-20020a170903265100b001c728609574sm3999887plb.6.2023.10.21.23.01.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 21 Oct 2023 23:01:34 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: mark.cave-ayland@ilande.co.uk Subject: [PATCH v4 39/90] target/sparc: Move POPC to decodetree Date: Sat, 21 Oct 2023 22:59:40 -0700 Message-Id: <20231022060031.490251-40-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231022060031.490251-1-richard.henderson@linaro.org> References: <20231022060031.490251-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::233; envelope-from=richard.henderson@linaro.org; helo=mail-oi1-x233.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 | 3 +++ target/sparc/translate.c | 56 +++++++-------------------------------- 2 files changed, 12 insertions(+), 47 deletions(-) diff --git a/target/sparc/insns.decode b/target/sparc/insns.decode index cb21405e1a..a596b0fc85 100644 --- a/target/sparc/insns.decode +++ b/target/sparc/insns.decode @@ -183,6 +183,9 @@ TSUBcc 10 ..... 100001 ..... . ............. @r_r_ri_cc1 TADDccTV 10 ..... 100010 ..... . ............. @r_r_ri_cc1 TSUBccTV 10 ..... 100011 ..... . ............. @r_r_ri_cc1 +POPC 10 rd:5 101110 00000 imm:1 rs2_or_imm:s13 \ + &r_r_ri_cc rs1=0 cc=0 + &shiftr rd rs1 rs2 x:bool @shiftr .. rd:5 ...... rs1:5 . x:1 ....... rs2:5 &shiftr diff --git a/target/sparc/translate.c b/target/sparc/translate.c index b907873359..9d1307653c 100644 --- a/target/sparc/translate.c +++ b/target/sparc/translate.c @@ -727,6 +727,11 @@ static void gen_op_tsubcctv(TCGv dst, TCGv src1, TCGv src2) gen_helper_tsubcctv(dst, tcg_env, src1, src2); } +static void gen_op_popc(TCGv dst, TCGv src1, TCGv src2) +{ + tcg_gen_ctpop_tl(dst, src2); +} + // 1 static void gen_op_eval_ba(TCGv dst) { @@ -2720,19 +2725,6 @@ static TCGv get_src1(DisasContext *dc, unsigned int insn) return gen_load_gpr(dc, rs1); } -static TCGv get_src2(DisasContext *dc, unsigned int insn) -{ - if (IS_IMM) { /* immediate */ - target_long simm = GET_FIELDs(insn, 19, 31); - TCGv t = tcg_temp_new(); - tcg_gen_movi_tl(t, simm); - return t; - } else { /* register */ - unsigned int rs2 = GET_FIELD(insn, 27, 31); - return gen_load_gpr(dc, rs2); - } -} - #ifdef TARGET_SPARC64 static void gen_fmovs(DisasContext *dc, DisasCompare *cmp, int rd, int rs) { @@ -4288,6 +4280,9 @@ TRANS(TSUBcc, ALL, do_arith, a, CC_OP_TSUB, gen_op_sub_cc, NULL) TRANS(TADDccTV, ALL, do_arith, a, CC_OP_TADDTV, gen_op_taddcctv, NULL) TRANS(TSUBccTV, ALL, do_arith, a, CC_OP_TSUBTV, gen_op_tsubcctv, NULL) +/* TODO: Should have feature bit -- comes in with UltraSparc T2. */ +TRANS(POPC, 64, do_arith, a, 0, gen_op_popc, NULL) + static bool trans_OR(DisasContext *dc, arg_r_r_ri_cc *a) { /* OR with %g0 is the canonical alias for MOV. */ @@ -4875,40 +4870,7 @@ static void disas_sparc_legacy(DisasContext *dc, unsigned int insn) goto illegal_insn; } } else if (xop < 0x36) { - if (xop < 0x20) { - goto illegal_insn; - } else { - cpu_src1 = get_src1(dc, insn); - cpu_src2 = get_src2(dc, insn); - switch (xop) { - case 0x20: /* taddcc */ - case 0x21: /* tsubcc */ - case 0x22: /* taddcctv */ - case 0x23: /* tsubcctv */ - case 0x24: /* mulscc */ - case 0x25: /* sll */ - case 0x26: /* srl */ - case 0x27: /* sra */ - goto illegal_insn; /* in decodetree */ - case 0x30: - goto illegal_insn; /* WRASR in decodetree */ - case 0x32: - goto illegal_insn; /* WRPR in decodetree */ - case 0x33: /* wrtbr, UA2005 wrhpr */ - goto illegal_insn; /* WRTBR, WRHPR in decodetree */ -#ifdef TARGET_SPARC64 - case 0x2c: /* V9 movcc */ - case 0x2f: /* V9 movr */ - goto illegal_insn; /* in decodetree */ - case 0x2e: /* V9 popc */ - tcg_gen_ctpop_tl(cpu_dst, cpu_src2); - gen_store_gpr(dc, rd, cpu_dst); - break; -#endif - default: - goto illegal_insn; - } - } + goto illegal_insn; /* in decodetree */ } else if (xop == 0x36) { /* UltraSparc shutdown, VIS, V8 CPop1 */ #ifdef TARGET_SPARC64 int opf = GET_FIELD_SP(insn, 5, 13); From patchwork Sun Oct 22 05:59:41 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 737002 Delivered-To: patch@linaro.org Received: by 2002:adf:dd81:0:b0:32d:baff:b0ca with SMTP id x1csp1006381wrl; Sat, 21 Oct 2023 23:14:56 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHskkm/FAPytZDJ2o5+QIB1tIc72rfUOfv4UvFX5QVmyk8WTg+TiDwlWkEOQ1mj6sRi8Eg6 X-Received: by 2002:a0c:f194:0:b0:66d:2e59:4fc7 with SMTP id m20-20020a0cf194000000b0066d2e594fc7mr8470086qvl.19.1697955295911; Sat, 21 Oct 2023 23:14:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697955295; cv=none; d=google.com; s=arc-20160816; b=oBmWMTmGWQsubePd5yiZ7LAmqFj+gkyuOePuES0xHQwcb36EKo2WkSyiUbi/Fsv+wk nzTG7IQ3te/9FFxIFrlGp7czeHcJJBnyEwPlRmHu+LKU1q+pmMFNGoE1SLfBFNa+mqAk MjuouCVJ63ZlbnTpVSWQSzU1ghOUAyUKrzEj3quvH8A7ih3SzRMFJWffPSp5VeBtiqmq YEYvV5dRnZNaIitPoIs9ggzAkMrLjAuhxF161QlSBsG+hTYmgIgdwSjxcb/6GDsbJYhY J1PmRSr2j4Zl31UQxRemrsBcJRajvgtyuBf/eCZWBvJu+ezzKxSbB22dV0ORdslecLcW S76Q== 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=Qj77X/ZWz9rFPcm4wIph+0j5QZrOxK4G7bJejnWFGq4=; fh=TYrED6TOMxGX0VC4GtjviASLbYyJe19+7/tKWjN44KQ=; b=Sr6oK3sF1KI1gvCeyNQgQS9yqUpjEYdZ+A4+BJroRyXBp5qNgLL3RLSf+LaVsNJjJR fp+hh8vtitacCUBs0Ere+gQjzSDjhPDunQIcpQUUiKeRb9d7868rMHuoHRcPQ3HthO+9 3aanR3HR+U4gDNRj07zQwWxvLZti+0ZW6MBmwTpc9TK9DkGeIsrfZkN00t+K8OfON2NN n9KTvV3El4eN6JNT93e41rAKZAOgRFB56ucUyY3aqTvk1+ybTHuuISoOH8lJOEtOf6K5 caDE56kl8igtqgJWjYygpWpHqhCZDEu1Owiv0rooa2Dpp25seT2tDEooUXT+q45ZT6V4 GjNw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=XUvf1u6G; 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 b6-20020ac87fc6000000b00417d93ca9d3si3700483qtk.146.2023.10.21.23.14.55 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sat, 21 Oct 2023 23:14:55 -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=XUvf1u6G; 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 1quRZq-0008NP-Ba; Sun, 22 Oct 2023 02:04:42 -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 1quRZn-0008Hw-ND for qemu-devel@nongnu.org; Sun, 22 Oct 2023 02:04:39 -0400 Received: from mail-pf1-x430.google.com ([2607:f8b0:4864:20::430]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1quRZl-0002Cp-KS for qemu-devel@nongnu.org; Sun, 22 Oct 2023 02:04:39 -0400 Received: by mail-pf1-x430.google.com with SMTP id d2e1a72fcca58-6b77ab73c6fso1593372b3a.1 for ; Sat, 21 Oct 2023 23:04:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1697954676; x=1698559476; 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=Qj77X/ZWz9rFPcm4wIph+0j5QZrOxK4G7bJejnWFGq4=; b=XUvf1u6GpNb/ES2xFAM6qhiKoSakBspzxRDU0z8JEjQCtDLdu17uZg88FB2gG55SvL b6z65mgybr8gHPPyBPFRTY2VSXTPGxfS8aTGqAySn6jILBIfOBdWqgnKFksuYSfxEHRi WnpwQfNBk2+zY2E3/kcSYb8cJKfXwQCdF16fTKvSUxAv612AA+a33Wph/sM9KtqE1/lL 6x6hcXawdL4P9fSpZolpLmHCy+jpYNHmmG8Iq1TVnj30TsI2IYDPpn/3oP87aIVqBJDE 7XCycqnD+f7XQLfOXGlaobbKebOYK5mqO93Vi4EM75z8ixuQgd4uoiK//pGKQOHhU/fV XkAA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697954676; x=1698559476; 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=Qj77X/ZWz9rFPcm4wIph+0j5QZrOxK4G7bJejnWFGq4=; b=VhHM+2BGsR7wnJApoVjQOxYjhufOE3rfZKT18HVDWZd4eHFDhC98LVkT5WlwOiq6mB eAySYZ+hiJMaCZEiYV1e4dKswm+gZxjmoX6T6c7I5VN+QnNL7/yHHSJTxV/94cPwLRoW JUbh2wUsJOp2EfmldvMEr9jBywGM8yRL5NQpyEEbEwHLh0kpMX8GbpTHnXyl4JZvY+yJ ZDyg+gf7j/3KXHkLLC9dY2BuRFLMzL7JvUANAROyN5C1TnHpYwYiU73G5R99yhpnaV12 O4Qu4iN9OjUfW5XupoSHHpxmXy6mnlqHZ/PIIYAGxRiTh8pQSZUXE3kjyJNK2DHvdDJo m0tQ== X-Gm-Message-State: AOJu0YyAugwae1rr3mC1AxVSSqfAcwzI8SoC3ywiJ0vra3Ef0iZH7dBt YXvWv4787f+naaZMto+ASCIijI1Sx+xWXgd5hh4= X-Received: by 2002:a05:6a00:10c5:b0:68f:b5a3:5ec6 with SMTP id d5-20020a056a0010c500b0068fb5a35ec6mr7537537pfu.0.1697954675818; Sat, 21 Oct 2023 23:04:35 -0700 (PDT) Received: from stoup.. ([71.212.149.95]) by smtp.gmail.com with ESMTPSA id fb13-20020a056a002d8d00b0068a46cd4120sm4007373pfb.199.2023.10.21.23.04.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 21 Oct 2023 23:04:35 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: mark.cave-ayland@ilande.co.uk Subject: [PATCH v4 40/90] target/sparc: Convert remaining v8 coproc insns to decodetree Date: Sat, 21 Oct 2023 22:59:41 -0700 Message-Id: <20231022060031.490251-41-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231022060031.490251-1-richard.henderson@linaro.org> References: <20231022060031.490251-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::430; envelope-from=richard.henderson@linaro.org; helo=mail-pf1-x430.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 | 11 +++++++++++ target/sparc/translate.c | 32 ++++++-------------------------- 2 files changed, 17 insertions(+), 26 deletions(-) diff --git a/target/sparc/insns.decode b/target/sparc/insns.decode index a596b0fc85..8de986f0bb 100644 --- a/target/sparc/insns.decode +++ b/target/sparc/insns.decode @@ -216,3 +216,14 @@ Tcc_r 10 0 cond:4 111010 rs1:5 0 cc:1 0000000 rs2:5 MOVcc 10 rd:5 101100 1 cond:4 imm:1 cc:1 0 rs2_or_imm:s11 MOVfcc 10 rd:5 101100 0 cond:4 imm:1 cc:2 rs2_or_imm:s11 MOVR 10 rd:5 101111 rs1:5 imm:1 cond:3 rs2_or_imm:s10 + +NCP 10 ----- 110110 ----- --------- ----- # v8 CPop1 +NCP 10 ----- 110111 ----- --------- ----- # v8 CPop2 + +NCP 11 ----- 110000 ----- --------- ----- # v8 LDC +NCP 11 ----- 110001 ----- --------- ----- # v8 LDCSR +NCP 11 ----- 110011 ----- --------- ----- # v8 LDDC +NCP 11 ----- 110100 ----- --------- ----- # v8 STC +NCP 11 ----- 110101 ----- --------- ----- # v8 STCSR +NCP 11 ----- 110110 ----- --------- ----- # v8 STDCQ +NCP 11 ----- 110111 ----- --------- ----- # v8 STDC diff --git a/target/sparc/translate.c b/target/sparc/translate.c index 9d1307653c..7f6adf35ae 100644 --- a/target/sparc/translate.c +++ b/target/sparc/translate.c @@ -4871,8 +4871,9 @@ static void disas_sparc_legacy(DisasContext *dc, unsigned int insn) } } else if (xop < 0x36) { goto illegal_insn; /* in decodetree */ - } else if (xop == 0x36) { /* UltraSparc shutdown, VIS, V8 CPop1 */ + } else if (xop == 0x36) { #ifdef TARGET_SPARC64 + /* VIS */ int opf = GET_FIELD_SP(insn, 5, 13); rs1 = GET_FIELD(insn, 13, 17); rs2 = GET_FIELD(insn, 27, 31); @@ -5312,14 +5313,11 @@ static void disas_sparc_legacy(DisasContext *dc, unsigned int insn) goto illegal_insn; } #else - goto ncp_insn; -#endif - } else if (xop == 0x37) { /* V8 CPop2, V9 impdep2 */ -#ifdef TARGET_SPARC64 - goto illegal_insn; -#else - goto ncp_insn; + g_assert_not_reached(); /* in decodetree */ #endif + } else if (xop == 0x37) { + /* V8 CPop2, V9 impdep2 */ + goto illegal_insn; /* in decodetree */ #ifdef TARGET_SPARC64 } else if (xop == 0x39) { /* V9 return */ save_state(dc); @@ -5535,13 +5533,6 @@ static void disas_sparc_legacy(DisasContext *dc, unsigned int insn) cpu_src1 = gen_load_gpr(dc, rd); gen_swap_asi(dc, cpu_val, cpu_src1, cpu_addr, insn); break; - -#ifndef TARGET_SPARC64 - case 0x30: /* ldc */ - case 0x31: /* ldcsr */ - case 0x33: /* lddc */ - goto ncp_insn; -#endif #endif #ifdef TARGET_SPARC64 case 0x08: /* V9 ldsw */ @@ -5802,12 +5793,6 @@ static void disas_sparc_legacy(DisasContext *dc, unsigned int insn) cpu_src2 = gen_load_gpr(dc, rs2); gen_casx_asi(dc, cpu_addr, cpu_src2, insn, rd); break; -#else - case 0x34: /* stc */ - case 0x35: /* stcsr */ - case 0x36: /* stdcq */ - case 0x37: /* stdc */ - goto ncp_insn; #endif #if !defined(CONFIG_USER_ONLY) || defined(TARGET_SPARC64) case 0x3c: /* V9 or LEON3 casa */ @@ -5847,11 +5832,6 @@ static void disas_sparc_legacy(DisasContext *dc, unsigned int insn) gen_op_fpexception_im(dc, FSR_FTT_SEQ_ERROR); return; #endif -#ifndef TARGET_SPARC64 - ncp_insn: - gen_exception(dc, TT_NCP_INSN); - return; -#endif } static void sparc_tr_init_disas_context(DisasContextBase *dcbase, CPUState *cs) From patchwork Sun Oct 22 05:59:42 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 736945 Delivered-To: patch@linaro.org Received: by 2002:adf:dd81:0:b0:32d:baff:b0ca with SMTP id x1csp1004169wrl; Sat, 21 Oct 2023 23:05:50 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEOA5wgZSCvBATPF05a50ObuVSZJ9ap/qEN/KFAgy3GhjK0oFAVHNXwtEKedkZ5XXWA8rVm X-Received: by 2002:a05:622a:19a7:b0:417:fd7e:2154 with SMTP id u39-20020a05622a19a700b00417fd7e2154mr6742083qtc.9.1697954750314; Sat, 21 Oct 2023 23:05:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697954750; cv=none; d=google.com; s=arc-20160816; b=XxV6978VoZDFlHm5b4wHDqV9az0N7RCt96tCvNqP6DLvPP7od6nWMg0s/s+PU/bfxu 2/c6QJIOiXsUNd0GM3Nmej7mQA7PWCh4taWsFAXjo2xnSWpulSrlHSkpNCKpVH+gRm7I bilLrwTTt4hfb0qVyKSliLJQMN0Ch4/pIwHMl+W7vtJ66IFOnzxRTop7EfREfiPz7h4E myd5Q/aReA2Psd0Lpmh4UXzoYjdMIY3PSauCMT6ua8T+4XDZBzr03A2mxTS2kPx57VCZ D1CnliEkgTOZgMqQI6WZM6LOMlFjg8TooNMrClhTjlfuIsGjvSdzib/PQqUNewo9qDLY HmUQ== 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=cnwEciCqRLHW6xqGiSbpmNMI0J3+4NepgqBlmJVzz/k=; fh=TYrED6TOMxGX0VC4GtjviASLbYyJe19+7/tKWjN44KQ=; b=AvHFSRjw3uW5uL5s5JcI4hq3to98hqCDOssP/lWlcoJJn2z4h7GGBz9nrL/FAe/Bww GbAFNx2bP5hrJb7ASzI1EwCB++apiaI6cZ+eOzqVWF2uoI8rz33W+zKoXo/f3XiMRyLD TjF25B4ufWpG1bruuThYnZnqlLDjEXpcPpBnqwBW/M9kjTfrmRVpe1FKl0mE16owv86l qjliALl7BWMZ7DmsyM2NtwggPaZAKEPswOuKtq/2OtYbVUBVJ4Tg/KqUFG1dPfue8ryH 9F3mcJZ2R3r0clfLbvUUHiqb9N+iwnvrq1p+BeXY7ixJcT4L/SMj6akdP4+Y6mMoWOAb t1Fg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=wZGU+IsX; 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 b6-20020ac87fc6000000b004199bf94c55si3693982qtk.197.2023.10.21.23.05.50 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sat, 21 Oct 2023 23:05:50 -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=wZGU+IsX; 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 1quRZu-000091-Dm; Sun, 22 Oct 2023 02:04:46 -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 1quRZp-0008MB-Gg for qemu-devel@nongnu.org; Sun, 22 Oct 2023 02:04:41 -0400 Received: from mail-pf1-x432.google.com ([2607:f8b0:4864:20::432]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1quRZm-0002Cx-6k for qemu-devel@nongnu.org; Sun, 22 Oct 2023 02:04:41 -0400 Received: by mail-pf1-x432.google.com with SMTP id d2e1a72fcca58-6b89ab5ddb7so2209132b3a.0 for ; Sat, 21 Oct 2023 23:04:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1697954677; x=1698559477; 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=cnwEciCqRLHW6xqGiSbpmNMI0J3+4NepgqBlmJVzz/k=; b=wZGU+IsXDOVaU5veuzBWeoV9nCLr05CPKDupwK3A1tVExoZHExIJrXOusK3ZNwSCAk oohDQxqp6zZQKUhaJscTIsDq6tOI8U2hmnCuIhqDs6ZSUoTYe1mB1AuxTXLRmnboAhJQ gwotKBOt7/BlE0d/ugMfbP3hG7/13SEdougmWD+gltub7slVk6Sj1qPuRh6yxWo9NP6R 504LN2FYZ4jKSHiEFLbsoL9i5FgmJsGiB+NK58O4/SKoCd3Cc584hm49IGprJJfYNG5c OMhpU2lAKRlm3WxfN5KQIaaeKKC79NtPkctYOzABIYF1c+6yD2TiRF2hE6qOAXBXIlBc g4UQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697954677; x=1698559477; 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=cnwEciCqRLHW6xqGiSbpmNMI0J3+4NepgqBlmJVzz/k=; b=Rqq65MBb1PsSO9GByQNsQTcOuqVrbw4qdnckVZNXsF7n++5hgdW05yOjkQtM53BG86 qvOKUy2ptERL8KTZpPxxgxO418ArnbzC7frgyxGNAj9sd/VDIhc1F6Dkzer1v2ytADJa 6JUfZ6E1ptsYoCfYywyYu94h2LbylVRWOf6kgdBKGL+myar0owml5X/sfiBiKbMJdxjR uBGyEgJGKRh61/5wvDsT6HkMxZQIHhjPu3dk1bWtSkx7Pn2JVeJNtktRVX/VPb6d3bZs OPo0qpoSzZoll3JiCYZu0eE3a7QhjsEIQvtmIpQOCifle/W+kiPrJFlkTLwmiXV5FSLv TMZA== X-Gm-Message-State: AOJu0Yy4OzoKuYJP62KPQ/8pdXEhxFnd+/0LjQowsJ/4+d2qKtjD0U6x pYbtZXOFEuEypJTBqDJiAFFVn26IGgVJHjM6Wwc= X-Received: by 2002:a62:8412:0:b0:6b1:e876:168b with SMTP id k18-20020a628412000000b006b1e876168bmr7004316pfd.11.1697954676825; Sat, 21 Oct 2023 23:04:36 -0700 (PDT) Received: from stoup.. ([71.212.149.95]) by smtp.gmail.com with ESMTPSA id fb13-20020a056a002d8d00b0068a46cd4120sm4007373pfb.199.2023.10.21.23.04.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 21 Oct 2023 23:04:36 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: mark.cave-ayland@ilande.co.uk Subject: [PATCH v4 41/90] target/sparc: Move JMPL, RETT, RETURN to decodetree Date: Sat, 21 Oct 2023 22:59:42 -0700 Message-Id: <20231022060031.490251-42-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231022060031.490251-1-richard.henderson@linaro.org> References: <20231022060031.490251-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::432; envelope-from=richard.henderson@linaro.org; helo=mail-pf1-x432.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 | 7 +++ target/sparc/translate.c | 126 ++++++++++++++++++++++++-------------- 2 files changed, 88 insertions(+), 45 deletions(-) diff --git a/target/sparc/insns.decode b/target/sparc/insns.decode index 8de986f0bb..271789ac13 100644 --- a/target/sparc/insns.decode +++ b/target/sparc/insns.decode @@ -28,6 +28,7 @@ CALL 01 i:s30 &r_r_ri rd rs1 rs2_or_imm imm:bool @n_r_ri .. ..... ...... rs1:5 imm:1 rs2_or_imm:s13 &r_r_ri rd=0 +@r_r_ri .. rd:5 ...... rs1:5 imm:1 rs2_or_imm:s13 &r_r_ri &r_r_ri_cc rd rs1 rs2_or_imm imm:bool cc:bool @r_r_ri_cc .. rd:5 . cc:1 .... rs1:5 imm:1 rs2_or_imm:s13 &r_r_ri_cc @@ -217,6 +218,12 @@ MOVcc 10 rd:5 101100 1 cond:4 imm:1 cc:1 0 rs2_or_imm:s11 MOVfcc 10 rd:5 101100 0 cond:4 imm:1 cc:2 rs2_or_imm:s11 MOVR 10 rd:5 101111 rs1:5 imm:1 cond:3 rs2_or_imm:s10 +JMPL 10 ..... 111000 ..... . ............. @r_r_ri +{ + RETT 10 00000 111001 ..... . ............. @n_r_ri + RETURN 10 00000 111001 ..... . ............. @n_r_ri +} + NCP 10 ----- 110110 ----- --------- ----- # v8 CPop1 NCP 10 ----- 110111 ----- --------- ----- # v8 CPop2 diff --git a/target/sparc/translate.c b/target/sparc/translate.c index 7f6adf35ae..861aeaaa34 100644 --- a/target/sparc/translate.c +++ b/target/sparc/translate.c @@ -40,6 +40,7 @@ #define gen_helper_rdpsr(D, E) qemu_build_not_reached() #define gen_helper_wrpsr(E, S) qemu_build_not_reached() #define gen_helper_power_down(E) g_assert_not_reached() +#define gen_helper_rett(E) qemu_build_not_reached() #else #define gen_helper_rdccr(D, E) qemu_build_not_reached() #define gen_helper_rdcwp(D, E) qemu_build_not_reached() @@ -4521,6 +4522,85 @@ static bool trans_MOVR(DisasContext *dc, arg_MOVR *a) return do_mov_cond(dc, &cmp, a->rd, src2); } +static bool do_add_special(DisasContext *dc, arg_r_r_ri *a, + bool (*func)(DisasContext *dc, int rd, TCGv src)) +{ + TCGv src1, sum; + + /* For simplicity, we under-decoded the rs2 form. */ + if (!a->imm && a->rs2_or_imm & ~0x1f) { + return false; + } + + /* + * Always load the sum into a new temporary. + * This is required to capture the value across a window change, + * e.g. SAVE and RESTORE, and may be optimized away otherwise. + */ + sum = tcg_temp_new(); + src1 = gen_load_gpr(dc, a->rs1); + if (a->imm || a->rs2_or_imm == 0) { + tcg_gen_addi_tl(sum, src1, a->rs2_or_imm); + } else { + tcg_gen_add_tl(sum, src1, cpu_regs[a->rs2_or_imm]); + } + return func(dc, a->rd, sum); +} + +static bool do_jmpl(DisasContext *dc, int rd, TCGv src) +{ + /* + * Preserve pc across advance, so that we can delay + * the writeback to rd until after src is consumed. + */ + target_ulong cur_pc = dc->pc; + + gen_check_align(dc, src, 3); + + gen_mov_pc_npc(dc); + tcg_gen_mov_tl(cpu_npc, src); + gen_address_mask(dc, cpu_npc); + gen_store_gpr(dc, rd, tcg_constant_tl(cur_pc)); + + dc->npc = DYNAMIC_PC_LOOKUP; + return true; +} + +TRANS(JMPL, ALL, do_add_special, a, do_jmpl) + +static bool do_rett(DisasContext *dc, int rd, TCGv src) +{ + if (!supervisor(dc)) { + return raise_priv(dc); + } + + gen_check_align(dc, src, 3); + + gen_mov_pc_npc(dc); + tcg_gen_mov_tl(cpu_npc, src); + gen_helper_rett(tcg_env); + + dc->npc = DYNAMIC_PC; + return true; +} + +TRANS(RETT, 32, do_add_special, a, do_rett) + +static bool do_return(DisasContext *dc, int rd, TCGv src) +{ + gen_check_align(dc, src, 3); + + gen_mov_pc_npc(dc); + tcg_gen_mov_tl(cpu_npc, src); + gen_address_mask(dc, cpu_npc); + + gen_helper_restore(tcg_env); + dc->npc = DYNAMIC_PC_LOOKUP; + return true; +} + +TRANS(RETURN, 64, do_add_special, a, do_return) + #define CHECK_IU_FEATURE(dc, FEATURE) \ if (!((dc)->def->features & CPU_FEATURE_ ## FEATURE)) \ goto illegal_insn; @@ -5318,30 +5398,6 @@ static void disas_sparc_legacy(DisasContext *dc, unsigned int insn) } else if (xop == 0x37) { /* V8 CPop2, V9 impdep2 */ goto illegal_insn; /* in decodetree */ -#ifdef TARGET_SPARC64 - } else if (xop == 0x39) { /* V9 return */ - save_state(dc); - 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); - } - } - gen_check_align(dc, cpu_tmp0, 3); - gen_helper_restore(tcg_env); - gen_mov_pc_npc(dc); - tcg_gen_mov_tl(cpu_npc, cpu_tmp0); - dc->npc = DYNAMIC_PC_LOOKUP; - goto jmp_insn; -#endif } else { cpu_src1 = get_src1(dc, insn); cpu_tmp0 = tcg_temp_new(); @@ -5359,28 +5415,8 @@ static void disas_sparc_legacy(DisasContext *dc, unsigned int insn) } switch (xop) { case 0x38: /* jmpl */ - { - gen_check_align(dc, cpu_tmp0, 3); - gen_store_gpr(dc, rd, tcg_constant_tl(dc->pc)); - gen_mov_pc_npc(dc); - gen_address_mask(dc, cpu_tmp0); - tcg_gen_mov_tl(cpu_npc, cpu_tmp0); - dc->npc = DYNAMIC_PC_LOOKUP; - } - goto jmp_insn; -#if !defined(CONFIG_USER_ONLY) && !defined(TARGET_SPARC64) case 0x39: /* rett, V9 return */ - { - if (!supervisor(dc)) - goto priv_insn; - gen_check_align(dc, cpu_tmp0, 3); - gen_mov_pc_npc(dc); - tcg_gen_mov_tl(cpu_npc, cpu_tmp0); - dc->npc = DYNAMIC_PC; - gen_helper_rett(tcg_env); - } - goto jmp_insn; -#endif + g_assert_not_reached(); /* in decode tree */ case 0x3b: /* flush */ /* nop */ break; From patchwork Sun Oct 22 05:59:43 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 736986 Delivered-To: patch@linaro.org Received: by 2002:adf:dd81:0:b0:32d:baff:b0ca with SMTP id x1csp1006155wrl; Sat, 21 Oct 2023 23:14:02 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHYoSFh53isOzuD4zLodfMFpeUZ0NZlLuGouQ4+0wgjGn1xM1+gZeavHSeHOAscMr1Jy5bj X-Received: by 2002:a05:6214:18d4:b0:66d:66cd:a351 with SMTP id cy20-20020a05621418d400b0066d66cda351mr12830180qvb.18.1697955241924; Sat, 21 Oct 2023 23:14:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697955241; cv=none; d=google.com; s=arc-20160816; b=vgRL0jLNORYZ9WGOt/0UuQmWI0I39wcyTtwfeiyT3ORfFTDd9qYUMiw0TezDF5di4V Qq/akmLIc6NZI3KL2OQzJVtaXPfLwXqqbs3rS6l66oYuHQ4kMDp1h6YjlqURkDyuod1t JtB3MVrzZPK/OuAFbxb/cY6Ezc8bg5Kae7yb3/gg/lxUjHqJP6NyiEzP3JBXfT7xIiIN L7lngopWma4Tusv5LlMGKRvKUB6O2VbrUUD1dl0AvM63LTuPGlLhs7+Rz8sQzUn2/imI 5pQRmg/e7CoWu0K5qiGk768M8cUQF8fawHyQdkVX1OMskrjITuwcimetn71/mDigVA3v Z9mQ== 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=qlZGGo9skZpt5kXsH4zxBgv3Gua/KvvRaliGeEBdcVo=; fh=TYrED6TOMxGX0VC4GtjviASLbYyJe19+7/tKWjN44KQ=; b=0XITGxXN80AmFLy4uf5x6vAlkzS8phjoNL4T2n1i+6qz9k8YwxUZNAOml4cynNY1/M FIpgOUI8lgfKCnaerHnXg3FhNGPLXNnJSZ8pKslW/eFxkqUgCVFTZ8syFr6zIsPyoH3X KUgb/mJpej6WqErAzQq8iJhfYR5lvRJUtUUjYZ4XHI5Lcy5oncf5sx4XAAsTd28OV71A Xg4+RPDWL+sL77mcu0Fj2jjgAyDXjDG5MQe0QZwxrb18xqk3UXdCZdZlj+AOQEyRIlH9 f2/OxDKwywrUbprqCQlkpQuuwXvXSzg4KaTg08mdnqyYO2I4sQdn+fq6BbAI/gkU9kvg RjZw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Tn4fWs24; 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 l12-20020ad44bcc000000b0066d0289954dsi3766233qvw.66.2023.10.21.23.14.01 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sat, 21 Oct 2023 23:14:01 -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=Tn4fWs24; 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 1quRZr-0008S4-RA; Sun, 22 Oct 2023 02:04:43 -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 1quRZp-0008La-8A for qemu-devel@nongnu.org; Sun, 22 Oct 2023 02:04:41 -0400 Received: from mail-pf1-x432.google.com ([2607:f8b0:4864:20::432]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1quRZm-0002D4-Vm for qemu-devel@nongnu.org; Sun, 22 Oct 2023 02:04:40 -0400 Received: by mail-pf1-x432.google.com with SMTP id d2e1a72fcca58-6bd73395bceso1615889b3a.0 for ; Sat, 21 Oct 2023 23:04:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1697954677; x=1698559477; 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=qlZGGo9skZpt5kXsH4zxBgv3Gua/KvvRaliGeEBdcVo=; b=Tn4fWs24qHqrJ4XWLqzpMrX2qYwj0+oR4/SDy9XGTPrDkFQlt6YEZoFkXRGDyEmB5P qouicGEI4WedtvTW0kjRW0vPp1nT95VmsqAo9bq+2kMh3XTp+Xg5pYhY4q5mWXcCCVuq zdvmhoQQMqPuwvCewk2ea+BKI3KSUJtcngl7IWMQDaxKKLisFdjtgN/ubLRufyPgiefq TZPEGlvqnOHUorumKdy/0+4tz74fL75BStCtJFwNhb0LtahZdQNIsFa2jSblZjus3kyx a4nbVfLwNuk3B8A+hh/LMBKnyLbEnkYkuNxoydsOj1hVxzy8hUtVeV8eTYkfZuiIDWvI UuKg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697954677; x=1698559477; 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=qlZGGo9skZpt5kXsH4zxBgv3Gua/KvvRaliGeEBdcVo=; b=QewU8SsqGwmaMsVWYiSpfJetvaA/8tkB+5y6A2LHEOpxC8LpUhhQaQp7yiIyHbAeP1 LtE4TlV7ME3i2fhTIh1CQ5nuAzEyJO7pKxrw9+IiYhsu+rn0M/2cvL9CpMODkGR5kjkt A1ZRAfyyT9+bZ9KH6EyGxcTJCvKPcilnbf+jVckiRren+nbx+qb93lS+uV7hc4mTKTaX uEs3ty9N+SbIoHSLWlAX5m/k+V+OhHe5fCoEPxMwosPuw6Twpdg/RnhlMR3p3pT5Qx2B LmH8yoN1flhSDuO3uRSXKuRgAMT3vu0PUDAmeHJzHMVRsXstr4L0Nob3f9PcBrwLsRai jtfw== X-Gm-Message-State: AOJu0Yznou3OO9WEx8FskopZ26qGn39Yq2yNCOJoMhR7OdSuT1DqCycK K22+KKlvv/nCm8Kkb5Fyi+UfqluYWNhc/SmDJqE= X-Received: by 2002:a62:b610:0:b0:68a:6d34:474b with SMTP id j16-20020a62b610000000b0068a6d34474bmr10673235pff.15.1697954677683; Sat, 21 Oct 2023 23:04:37 -0700 (PDT) Received: from stoup.. ([71.212.149.95]) by smtp.gmail.com with ESMTPSA id fb13-20020a056a002d8d00b0068a46cd4120sm4007373pfb.199.2023.10.21.23.04.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 21 Oct 2023 23:04:37 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: mark.cave-ayland@ilande.co.uk Subject: [PATCH v4 42/90] target/sparc: Move FLUSH, SAVE, RESTORE to decodetree Date: Sat, 21 Oct 2023 22:59:43 -0700 Message-Id: <20231022060031.490251-43-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231022060031.490251-1-richard.henderson@linaro.org> References: <20231022060031.490251-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::432; envelope-from=richard.henderson@linaro.org; helo=mail-pf1-x432.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 | 4 ++++ target/sparc/translate.c | 35 +++++++++++++++++++++++++---------- 2 files changed, 29 insertions(+), 10 deletions(-) diff --git a/target/sparc/insns.decode b/target/sparc/insns.decode index 271789ac13..aa90b5c5bb 100644 --- a/target/sparc/insns.decode +++ b/target/sparc/insns.decode @@ -223,6 +223,10 @@ JMPL 10 ..... 111000 ..... . ............. @r_r_ri RETT 10 00000 111001 ..... . ............. @n_r_ri RETURN 10 00000 111001 ..... . ............. @n_r_ri } +NOP 10 00000 111011 ----- 0 00000000----- # FLUSH reg+reg +NOP 10 00000 111011 ----- 1 ------------- # FLUSH reg+imm +SAVE 10 ..... 111100 ..... . ............. @r_r_ri +RESTORE 10 ..... 111101 ..... . ............. @r_r_ri NCP 10 ----- 110110 ----- --------- ----- # v8 CPop1 NCP 10 ----- 110111 ----- --------- ----- # v8 CPop2 diff --git a/target/sparc/translate.c b/target/sparc/translate.c index 861aeaaa34..7f414c1a52 100644 --- a/target/sparc/translate.c +++ b/target/sparc/translate.c @@ -4213,6 +4213,11 @@ static bool do_saved_restored(DisasContext *dc, void (*func)(TCGv_env)) TRANS(SAVED, 64, do_saved_restored, gen_helper_saved) TRANS(RESTORED, 64, do_saved_restored, gen_helper_restored) +static bool trans_NOP(DisasContext *dc, arg_NOP *a) +{ + return advance_pc(dc); +} + static bool trans_NOP_v7(DisasContext *dc, arg_NOP_v7 *a) { /* @@ -4601,6 +4606,24 @@ static bool do_return(DisasContext *dc, int rd, TCGv src) TRANS(RETURN, 64, do_add_special, a, do_return) +static bool do_save(DisasContext *dc, int rd, TCGv src) +{ + gen_helper_save(tcg_env); + gen_store_gpr(dc, rd, src); + return advance_pc(dc); +} + +TRANS(SAVE, ALL, do_add_special, a, do_save) + +static bool do_restore(DisasContext *dc, int rd, TCGv src) +{ + gen_helper_restore(tcg_env); + gen_store_gpr(dc, rd, src); + return advance_pc(dc); +} + +TRANS(RESTORE, ALL, do_add_special, a, do_restore) + #define CHECK_IU_FEATURE(dc, FEATURE) \ if (!((dc)->def->features & CPU_FEATURE_ ## FEATURE)) \ goto illegal_insn; @@ -5416,18 +5439,10 @@ static void disas_sparc_legacy(DisasContext *dc, unsigned int insn) switch (xop) { case 0x38: /* jmpl */ case 0x39: /* rett, V9 return */ - g_assert_not_reached(); /* in decode tree */ - case 0x3b: /* flush */ - /* nop */ - break; + case 0x3b: /* flush */ case 0x3c: /* save */ - gen_helper_save(tcg_env); - gen_store_gpr(dc, rd, cpu_tmp0); - break; case 0x3d: /* restore */ - gen_helper_restore(tcg_env); - gen_store_gpr(dc, rd, cpu_tmp0); - break; + g_assert_not_reached(); /* in decode tree */ #if !defined(CONFIG_USER_ONLY) && defined(TARGET_SPARC64) case 0x3e: /* V9 done/retry */ { From patchwork Sun Oct 22 05:59:44 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 736994 Delivered-To: patch@linaro.org Received: by 2002:adf:dd81:0:b0:32d:baff:b0ca with SMTP id x1csp1006274wrl; Sat, 21 Oct 2023 23:14:33 -0700 (PDT) X-Google-Smtp-Source: AGHT+IG2fD3zsiaxsJdgaz3C+ZjzDHy6RH3eIia8/zFADmm4uharDdGiPLXKlp3un3AxW+OZzQIQ X-Received: by 2002:a05:622a:44f:b0:41c:c149:731e with SMTP id o15-20020a05622a044f00b0041cc149731emr6900824qtx.28.1697955272833; Sat, 21 Oct 2023 23:14:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697955272; cv=none; d=google.com; s=arc-20160816; b=tog2i/8GITFqUkrKCaTuA5ezv6jROvFQW2PCDcggZoqPrrFlx76F9I8S19M1LgO9vp xDbKVbJL1jGu0P4wupIz9JhtBtIXLFclzDLUo/4KmDCylQGKot62U+Zov+ljtoE22ohf ja7NbUXq03vGWWCFJOPkbaupQO5/BLbjmulLaiorvg7NU/1mYUmEj5ULBL0p9pRt1ZKP ZySYJoIrK43H3OwcZl4dKZ+fV6lNKHavsN6XQKUNxOK+qBdHOWwy2619S0hSJF7iPaco UiJALRtTwHt6cHm/jMi+BqJyXWp4YyeaMyfHUcMXhv1oPOuL4m+4H7DZE1Jm/ZsRoi7R YIhw== 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=EgAvE3ILgOC04O5hwZsYiQqJ/IAC/A4vqkebsqCStlA=; fh=TYrED6TOMxGX0VC4GtjviASLbYyJe19+7/tKWjN44KQ=; b=CqZRMU743qwkHLrJXlTevjAEyox3sMHV/RJRyWEj91/yYLvjo7mYfEAo4eMQmaXKRx 1qGl5c0N29/CxdRm74JNLqU9iQel0Mx/dbC094y01cdwwWXILmjhLYrlE2RO1pkK2sMZ B8/H3tYsEQrHMIpC/66gpKxLQDT6knisbNed83se4i3usQF2mzXk5Wp8xM6zNrDdIVjx nuMazTa8XAUW0IN7Iu/dtBEv3Q5QbE/QWF1kcKLfIm6jCTX7wh7RBjxn1Esad2Je2UhS TkL+5j1D7zsfp8Ddgfv93RFyGkQ/Xw5AnPvowdq596o5B1J43BcXGUFXOyYOlAbGZL6M 12pQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=SuKI6aYi; 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 eb20-20020ad44e54000000b0066d08b5a900si3703660qvb.557.2023.10.21.23.14.32 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sat, 21 Oct 2023 23:14:32 -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=SuKI6aYi; 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 1quRZx-0000Jz-9F; Sun, 22 Oct 2023 02:04:49 -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 1quRZq-0008Nm-49 for qemu-devel@nongnu.org; Sun, 22 Oct 2023 02:04:42 -0400 Received: from mail-pf1-x434.google.com ([2607:f8b0:4864:20::434]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1quRZo-0002DD-0s for qemu-devel@nongnu.org; Sun, 22 Oct 2023 02:04:41 -0400 Received: by mail-pf1-x434.google.com with SMTP id d2e1a72fcca58-6b89ab5ddb7so2209146b3a.0 for ; Sat, 21 Oct 2023 23:04:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1697954678; x=1698559478; 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=EgAvE3ILgOC04O5hwZsYiQqJ/IAC/A4vqkebsqCStlA=; b=SuKI6aYi46xSlAyDAl/tgfVx9vZZTdjWujWADwgVOUd8c4h5VpQbZaMZkM1Ijiaz3w BpixXRLLky4tjyFc0pGC7zIPgVfPzk45nHVs3r/hUteXapyOpq5yw5oCcqwBjISpMfs/ RQoW77WWyz630fAdCSsXBe0fP9eyvnRinQzg+i4gQxOkPMWi9zTCS1PzgxMjE0akKMzY CAGMg2MugAy08IDuWJF4Zq6L9msk9hNqX8EhlIcQKenQmYUZVJuuklwtHOCUePRVck76 GVrfkURwBtRSc3Hzf+TsPKmlL/LGDhZc43rnEvX1O4r2p5a/6flrJLO86PURvvotv2P3 TbRQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697954678; x=1698559478; 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=EgAvE3ILgOC04O5hwZsYiQqJ/IAC/A4vqkebsqCStlA=; b=IGgSJTOyb0qNA9cFUs0eICPjfo7AtkzOYvdK1mPDpmvuHFRvuycQyGwCFS2kgwWeHw RzBMxvuK4EA4UxpYBxSvbY5flYKf6lx8NuZDhu/UCrWWCVjp5mNt4/SWcMhw+/XIvT7+ 08qG9m/tlc9M12M/ow68Q8IrMwpDx7Q3TZNvk61eyeD8Y+nbBa5GbAzIk3zPrRg2OlL3 Zsv2sl3et+yuBBZraNCJE6+s8ldE6Sd38A8gKddyGKgWQAVqf/d5d28dxOJOMh6GTvtO ndT1nJVWdxDcq9YSh9o3z6esn9x//PweV1FzFgzbJsh8zj0eKiKQ3egwlwpGlCdvislI 97Pg== X-Gm-Message-State: AOJu0YyvNNvATaTlKTYU/GEYHoCVjjw169rDYbaADJLXgNCNczf6t+w7 EeG3pUuZIeZllVc+Ffaya3WO55zfREpVRDE0KiU= X-Received: by 2002:a05:6a20:432a:b0:17b:3fe8:b4e1 with SMTP id h42-20020a056a20432a00b0017b3fe8b4e1mr7414468pzk.50.1697954678533; Sat, 21 Oct 2023 23:04:38 -0700 (PDT) Received: from stoup.. ([71.212.149.95]) by smtp.gmail.com with ESMTPSA id fb13-20020a056a002d8d00b0068a46cd4120sm4007373pfb.199.2023.10.21.23.04.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 21 Oct 2023 23:04:38 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: mark.cave-ayland@ilande.co.uk Subject: [PATCH v4 43/90] target/sparc: Move DONE, RETRY to decodetree Date: Sat, 21 Oct 2023 22:59:44 -0700 Message-Id: <20231022060031.490251-44-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231022060031.490251-1-richard.henderson@linaro.org> References: <20231022060031.490251-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::434; envelope-from=richard.henderson@linaro.org; helo=mail-pf1-x434.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 | 3 ++ target/sparc/translate.c | 99 +++++++++++++++------------------------ 2 files changed, 40 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 7f414c1a52..48e69389e5 100644 --- a/target/sparc/translate.c +++ b/target/sparc/translate.c @@ -54,6 +54,8 @@ #define gen_helper_write_softint(E, S) qemu_build_not_reached() #define gen_helper_saved ({ qemu_build_not_reached(); NULL; }) #define gen_helper_restored ({ qemu_build_not_reached(); NULL; }) +#define gen_helper_done(E) qemu_build_not_reached() +#define gen_helper_retry(E) qemu_build_not_reached() #define gen_helper_udivx(D, E, A, B) qemu_build_not_reached() #define gen_helper_sdivx(D, E, A, B) qemu_build_not_reached() #endif @@ -4624,6 +4626,36 @@ static bool do_restore(DisasContext *dc, int rd, TCGv src) TRANS(RESTORE, ALL, do_add_special, a, do_restore) +static bool trans_DONE(DisasContext *dc, arg_DONE *a) +{ + if (!avail_64(dc)) { + return false; + } + if (!supervisor(dc)) { + return raise_priv(dc); + } + dc->npc = DYNAMIC_PC; + dc->pc = DYNAMIC_PC; + translator_io_start(&dc->base); + gen_helper_done(tcg_env); + return true; +} + +static bool trans_RETRY(DisasContext *dc, arg_RETRY *a) +{ + if (!avail_64(dc)) { + return false; + } + if (!supervisor(dc)) { + return raise_priv(dc); + } + dc->npc = DYNAMIC_PC; + dc->pc = DYNAMIC_PC; + translator_io_start(&dc->base); + gen_helper_retry(tcg_env); + return true; +} + #define CHECK_IU_FEATURE(dc, FEATURE) \ if (!((dc)->def->features & CPU_FEATURE_ ## FEATURE)) \ goto illegal_insn; @@ -4635,7 +4667,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; @@ -4650,9 +4683,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)) { @@ -4972,8 +5004,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 */ @@ -5415,65 +5445,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 */ @@ -5870,7 +5845,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; From patchwork Sun Oct 22 05:59: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: 736958 Delivered-To: patch@linaro.org Received: by 2002:adf:dd81:0:b0:32d:baff:b0ca with SMTP id x1csp1005622wrl; Sat, 21 Oct 2023 23:11:38 -0700 (PDT) X-Google-Smtp-Source: AGHT+IE6lfA9mOWKOEZ+giNArBaiSqsJR+Bb1UCPug89URDcTdgX6lsWMRBFMPCkRY2pYF0cN3jZ X-Received: by 2002:a05:6214:1c0d:b0:66d:11fd:c9c0 with SMTP id u13-20020a0562141c0d00b0066d11fdc9c0mr9312002qvc.58.1697955098524; Sat, 21 Oct 2023 23:11:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697955098; cv=none; d=google.com; s=arc-20160816; b=YS2QVMr5rZ4DW+pgWeiIz/x6qeO3QDnzQguGxc65VkfO1qtV5NU2nZeLjeLyLmickG I23iw0pPytnNSsEq3wVQi2nVtDRycZwPmIzTQru1Um+V6OeEyPBq3pJDao9lGGDnTcXj +T3m0gBvHnBtB4AP+wBpyJjf2LWrnkxyuTEuL0KujncDqoJNOM/GP1Zlz2kkOo48uJ52 ge1yPj0G1gy+Hso3vcl6HrTw5/Hh0vjEOzB0cpI0IBSNdwl0spaBEe4ePVyAfSosEbvp FZQJNKx6jhYeJnXQFbg9lWn+0m0U+V83pGoYc3jZPfZFFAjoslbmQ07uQtI+ymqstVDU rEVw== 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=ydcqatW2bnzMrZaY8ZtfzySXSm+HsAl/9hXJ+Ym7/Lw=; fh=TYrED6TOMxGX0VC4GtjviASLbYyJe19+7/tKWjN44KQ=; b=IiXSmUf9cVp6ctwQqOw84OAbEQH69HWZf51T6NG/cB1kC9QDaZw6g0EKxi+yDmJ8Ni YY6NvKDmAtYuDMa6MDf5UB+rOH5M/pyH7jw/YuQZ7BX47qloyIabsCMdFotgm3hiuIpY qQqABZuzfDUPgKNECtWodlcvodoR+pfnXtzoqfXH1oHsmn18Co7ravto5evfmGRMtBgF DVj25f9RAS03M8EKLmi7mGWxiuy4yVP++cWi5jQi1xADBDGC63xB0iuMi3GGxTNjX7lW 7OmSrSAzWYbgLTN8DKUcm/G2uW+6cBqtAG4t7/mPM0XM9xDB2dAVjee/hvI344a5SW73 RkLA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=LpYZsbNI; 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 nh2-20020a056214390200b0066d138d1bf1si3934336qvb.308.2023.10.21.23.11.38 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sat, 21 Oct 2023 23:11:38 -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=LpYZsbNI; 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 1quRa0-0000Sk-8v; Sun, 22 Oct 2023 02:04:52 -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 1quRZq-0008Pn-R3 for qemu-devel@nongnu.org; Sun, 22 Oct 2023 02:04:42 -0400 Received: from mail-oo1-xc29.google.com ([2607:f8b0:4864:20::c29]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1quRZo-0002DT-PW for qemu-devel@nongnu.org; Sun, 22 Oct 2023 02:04:42 -0400 Received: by mail-oo1-xc29.google.com with SMTP id 006d021491bc7-581cb88f645so1448477eaf.1 for ; Sat, 21 Oct 2023 23:04:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1697954679; x=1698559479; 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=ydcqatW2bnzMrZaY8ZtfzySXSm+HsAl/9hXJ+Ym7/Lw=; b=LpYZsbNIbapWzDa89k6chXIoD+PvXqfSKhM1Vm/H8b+SdopKjVxVD/7zrvtAbsCMxg euWHyThmw2ldVeHzQFRdIKKTk+FUsJ/tOwQkCgSKxSQrMnEJR+0ErQoL3BZaXxnNIfz8 QhVGkthfy2D1w/SioJWX7VtZ/vOPR8K1MmFAZPt1RZDNZfJNhZcDG5Qtxz1Z15jKvC0+ hZxdxTSbatGcXBcwIs9YPUued7g605a/b0uGeUBpTin3kiyNXhIpK1rLNYtsaBTQsKg3 0OdtkrwNzWFgkkY1oRI/rKhq1lipnMR0gz1HG0Gx6NQgAyzQ24R9AaN4b4Vpz5KnVndn v3Sg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697954679; x=1698559479; 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=ydcqatW2bnzMrZaY8ZtfzySXSm+HsAl/9hXJ+Ym7/Lw=; b=LkLwjc1nX2pKBhpqFd9mM2KWRze9sjSSFVNIzrI7mcXwNYxCUcDt3vCeipR+05s7e7 9J3yIdpLFUAmlcoGWzN/dRbL4FvTqhaZmcUJYtSOcyJQ3t2EafPG3U3S5CAWxMNDBA8i x55jqLHmxprl9Hsi/YzvkOI2wLjjiO7Gpf76VBtVzdZWEasEkKczvDimb4dsOjinoI+X 9VgqjYipDpKpuY7ZfHOXTi0FTbb0r61hKU1JRHUup2/v0uRb4XR1v1192khi2WXBchtn NcNwsL2CvS4M1Kx7XG+veiH9WRcgRkuZ0DyH8cZ4dhnviLpA0XlDkxd14qAcY0AqW9XY Ezqw== X-Gm-Message-State: AOJu0YzRH3Z+HqxfvcQN2b9uJNoTuCCY9ORifi/r4ehqHDjmTztNVVon yGj0/iH9Nqw7X817O/6Btxy3j4L6KDVWnbWr4H8= X-Received: by 2002:a05:6358:2822:b0:14f:6a41:5d14 with SMTP id k34-20020a056358282200b0014f6a415d14mr7107075rwb.27.1697954679298; Sat, 21 Oct 2023 23:04:39 -0700 (PDT) Received: from stoup.. ([71.212.149.95]) by smtp.gmail.com with ESMTPSA id fb13-20020a056a002d8d00b0068a46cd4120sm4007373pfb.199.2023.10.21.23.04.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 21 Oct 2023 23:04:38 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: mark.cave-ayland@ilande.co.uk Subject: [PATCH v4 44/90] target/sparc: Split out resolve_asi Date: Sat, 21 Oct 2023 22:59:45 -0700 Message-Id: <20231022060031.490251-45-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231022060031.490251-1-richard.henderson@linaro.org> References: <20231022060031.490251-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::c29; envelope-from=richard.henderson@linaro.org; helo=mail-oo1-xc29.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/translate.c | 25 +++++++++++++++++++++---- 1 file changed, 21 insertions(+), 4 deletions(-) diff --git a/target/sparc/translate.c b/target/sparc/translate.c index 48e69389e5..9b1bd97947 100644 --- a/target/sparc/translate.c +++ b/target/sparc/translate.c @@ -1906,15 +1906,25 @@ typedef struct { MemOp memop; } DisasASI; -static DisasASI get_asi(DisasContext *dc, int insn, MemOp memop) +/* + * Build DisasASI. + * For asi == -1, treat as non-asi. + * For ask == -2, treat as immediate offset (v8 error, v9 %asi). + */ +static DisasASI resolve_asi(DisasContext *dc, int asi, MemOp memop) { - int asi = GET_FIELD(insn, 19, 26); ASIType type = GET_ASI_HELPER; int mem_idx = dc->mem_idx; + if (asi == -1) { + /* Artificial "non-asi" case. */ + type = GET_ASI_DIRECT; + goto done; + } + #ifndef TARGET_SPARC64 /* Before v9, all asis are immediate and privileged. */ - if (IS_IMM) { + if (asi < 0) { gen_exception(dc, TT_ILL_INSN); type = GET_ASI_EXCP; } else if (supervisor(dc) @@ -1957,7 +1967,7 @@ static DisasASI get_asi(DisasContext *dc, int insn, MemOp memop) type = GET_ASI_EXCP; } #else - if (IS_IMM) { + if (asi < 0) { asi = dc->asi; } /* With v9, all asis below 0x80 are privileged. */ @@ -2116,9 +2126,16 @@ static DisasASI get_asi(DisasContext *dc, int insn, MemOp memop) } #endif + done: return (DisasASI){ type, asi, mem_idx, memop }; } +static DisasASI get_asi(DisasContext *dc, int insn, MemOp memop) +{ + int asi = IS_IMM ? -2 : GET_FIELD(insn, 19, 26); + return resolve_asi(dc, asi, memop); +} + static void gen_ld_asi(DisasContext *dc, TCGv dst, TCGv addr, int insn, MemOp memop) { From patchwork Sun Oct 22 05:59:46 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 736940 Delivered-To: patch@linaro.org Received: by 2002:adf:dd81:0:b0:32d:baff:b0ca with SMTP id x1csp1003966wrl; Sat, 21 Oct 2023 23:05:01 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHnvhptSAPwOso7mFHsOEHdSFpRAQ/qk5W0KvIS1DkOpKaz5PtP/qYy241bYjZAYYjRy/cl X-Received: by 2002:a05:620a:2412:b0:779:cf30:600b with SMTP id d18-20020a05620a241200b00779cf30600bmr1836887qkn.4.1697954701637; Sat, 21 Oct 2023 23:05:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697954701; cv=none; d=google.com; s=arc-20160816; b=V49flATKR7p92znjY4ueRnIAdmRE267IAPtMDOQLhdwhI6GV76R6PWuotq7VFRiKiy tK6VAb6jkgF0q4pRcPmiBtIc6kRSP9ADxZpULbjF2/aHyy2W4omvWQU05J1L0xgiB77Y Bn20/VDcKAERQeEqKvRzFuPCjBEpPMf80H1Qi9rzXs8FfO0MTgxNsWp5iz3Xbxm7CGIi q/ctjsw8fV2LYhM9pg4UEkKnIOKmI1cifcZNugJ75d+8FYc5os0d4MGCn29bwJytnLR+ t2L2PdfUCWuaM2ooyd1g/RALj5WCRMp3kXy43CsVfIc9BTIRnJctJ1ddjk6CUF8kchdb Gfrw== 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=Fqur4Bi6E3LW+knuatXkBdwIHpDBdwugkOArA2uSeic=; fh=TYrED6TOMxGX0VC4GtjviASLbYyJe19+7/tKWjN44KQ=; b=Rm4CelLkCOZ7d8F9y1wjUr6e7CTUoU9B0lbcJeTK+yrn6FeOX2yXUJQeNwCFohPDVf MA+pSbaf5SS3fP51OwCXg7AnNFklQ0320c5dRzRkic7AnaQC0Xg4O06UvABz/lyjPW9j ccTzJlowyb3dX1I7+fZcJK6lgA43X/KUHrIa0ODSyJcKo2OIs61ooTv7PkSe476JqM56 o9xvL0uaBxOFLD2tH1w2rvXS4q8ELGdos41O1n47OFiMnLZQ878RVb5Inlslb1qrSjz2 aX2gQhUZjsvbJ795G4eiQ5p4UNq5t00GgFAohTK9ElDy8YEuMOIdujP1SHV7Q15grzII s+ZQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=PSBN35+P; 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 e8-20020a05620a208800b007775a24742asi3749375qka.613.2023.10.21.23.05.01 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sat, 21 Oct 2023 23:05:01 -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=PSBN35+P; 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 1quRZu-00008M-6x; Sun, 22 Oct 2023 02:04:46 -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 1quRZr-0008Td-VG for qemu-devel@nongnu.org; Sun, 22 Oct 2023 02:04:43 -0400 Received: from mail-oo1-xc2a.google.com ([2607:f8b0:4864:20::c2a]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1quRZp-0002Dc-C5 for qemu-devel@nongnu.org; Sun, 22 Oct 2023 02:04:43 -0400 Received: by mail-oo1-xc2a.google.com with SMTP id 006d021491bc7-581fb6f53fcso1396051eaf.2 for ; Sat, 21 Oct 2023 23:04:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1697954680; x=1698559480; 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=Fqur4Bi6E3LW+knuatXkBdwIHpDBdwugkOArA2uSeic=; b=PSBN35+POUQdv7xh6KNZpmqcsGSspLYzoWM/nbm8cb4dTwg6vJzG/shPyX4MQFd2uZ 3T8yHtwTriaLRZvHGLeK43edu5Hk4CB2hYQqrN9Poo2mL7rKKvbeObL8uWQctFPpZ1CX 9BWhMO+MsRYYq88Jb5Zi6tSVCKo9wNSgv6gTT8+Bi3cAmBbMw5tu2sIrh3dq1v7VVyha urQC0fIvdXT1+5xdViq7p7n3f3SwS6I4Xo2dTHgnA13SrzW6ofGTzgWtCYaAkcVOiAvE j4+gyClhRT+w+bfew81EcOyWG1HexGqL/kj7NwP5NwdxP03nQuADCnXxlXW2Dv3QFYoM aiqQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697954680; x=1698559480; 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=Fqur4Bi6E3LW+knuatXkBdwIHpDBdwugkOArA2uSeic=; b=VQnBMFywyCRl+AtOprjQPEYUFbK1HuK+G4F6o24BJ40g+VUH952vCbbUpTCImN49KE Pftc0AtbEXK9h/smtyfzcuCsbRYwVhjEMdNE9C0XuyPpVon+6zckA93aepaOHq5S6E0a vNzSqHI/9GH9nIuFt8/5KUkFqQA2w3/Er6S7hPRkDm7nXGPLEXqjVD9WNKvbKzaYFVVP C+kXHCR+4GsFv/xrCAmHvcOBkeMNrJiw1LfWUco5N4b9peozdSOKD5fTDGutvY3OxopW V/Qv3mnjIGrgC4dqB9yUOLY8QoB4muRqn1KXwRgWZz/Q0bRS1+D/ec+ggrXkrmW5KNOE eLVA== X-Gm-Message-State: AOJu0YzPzkmaPM92T1qFyL8QOGdc0YHdGOtOpMtCyLToIO4jLESdnRwd 6AmSQzs5Ew/l55kaCMBOniaH40B79TeSH9a4Yhc= X-Received: by 2002:a05:6358:9387:b0:142:dfc2:a441 with SMTP id h7-20020a056358938700b00142dfc2a441mr8108184rwb.8.1697954680039; Sat, 21 Oct 2023 23:04:40 -0700 (PDT) Received: from stoup.. ([71.212.149.95]) by smtp.gmail.com with ESMTPSA id fb13-20020a056a002d8d00b0068a46cd4120sm4007373pfb.199.2023.10.21.23.04.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 21 Oct 2023 23:04:39 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: mark.cave-ayland@ilande.co.uk Subject: [PATCH v4 45/90] target/sparc: Drop ifdef around get_asi and friends Date: Sat, 21 Oct 2023 22:59:46 -0700 Message-Id: <20231022060031.490251-46-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231022060031.490251-1-richard.henderson@linaro.org> References: <20231022060031.490251-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::c2a; envelope-from=richard.henderson@linaro.org; helo=mail-oo1-xc2a.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 Mark some of the functions as unused, temporarily. Fix up some tl vs i64 issues revealed in the process. Signed-off-by: Richard Henderson --- target/sparc/translate.c | 187 +++++++++++++++------------------------ 1 file changed, 70 insertions(+), 117 deletions(-) diff --git a/target/sparc/translate.c b/target/sparc/translate.c index 9b1bd97947..6802399647 100644 --- a/target/sparc/translate.c +++ b/target/sparc/translate.c @@ -58,6 +58,18 @@ #define gen_helper_retry(E) qemu_build_not_reached() #define gen_helper_udivx(D, E, A, B) qemu_build_not_reached() #define gen_helper_sdivx(D, E, A, B) qemu_build_not_reached() +# ifdef CONFIG_USER_ONLY +static void gen_helper_ld_asi(TCGv_i64 r, TCGv_env e, TCGv a, + TCGv_i32 asi, TCGv_i32 mop) +{ + g_assert_not_reached(); +} +static void gen_helper_st_asi(TCGv_env e, TCGv a, TCGv_i64 r, + TCGv_i32 asi, TCGv_i32 mop) +{ + g_assert_not_reached(); +} +# endif #endif /* Dynamic PC, must exit to main loop. */ @@ -1887,7 +1899,6 @@ static void gen_ldstub(DisasContext *dc, TCGv dst, TCGv addr, int mmu_idx) } /* asi moves */ -#if !defined(CONFIG_USER_ONLY) || defined(TARGET_SPARC64) typedef enum { GET_ASI_HELPER, GET_ASI_EXCP, @@ -2136,8 +2147,8 @@ static DisasASI get_asi(DisasContext *dc, int insn, MemOp memop) return resolve_asi(dc, asi, memop); } -static void gen_ld_asi(DisasContext *dc, TCGv dst, TCGv addr, - int insn, MemOp memop) +static void __attribute__((unused)) +gen_ld_asi(DisasContext *dc, TCGv dst, TCGv addr, int insn, MemOp memop) { DisasASI da = get_asi(dc, insn, memop); @@ -2171,8 +2182,8 @@ static void gen_ld_asi(DisasContext *dc, TCGv dst, TCGv addr, } } -static void gen_st_asi(DisasContext *dc, TCGv src, TCGv addr, - int insn, MemOp memop) +static void __attribute__((unused)) +gen_st_asi(DisasContext *dc, TCGv src, TCGv addr, int insn, MemOp memop) { DisasASI da = get_asi(dc, insn, memop); @@ -2247,8 +2258,8 @@ static void gen_st_asi(DisasContext *dc, TCGv src, TCGv addr, } } -static void gen_swap_asi(DisasContext *dc, TCGv dst, TCGv src, - TCGv addr, int insn) +static void __attribute__((unused)) +gen_swap_asi(DisasContext *dc, TCGv dst, TCGv src, TCGv addr, int insn) { DisasASI da = get_asi(dc, insn, MO_TEUL); @@ -2265,8 +2276,8 @@ static void gen_swap_asi(DisasContext *dc, TCGv dst, TCGv src, } } -static void gen_cas_asi(DisasContext *dc, TCGv addr, TCGv cmpv, - int insn, int rd) +static void __attribute__((unused)) +gen_cas_asi(DisasContext *dc, TCGv addr, TCGv cmpv, int insn, int rd) { DisasASI da = get_asi(dc, insn, MO_TEUL); TCGv oldv; @@ -2287,7 +2298,8 @@ static void gen_cas_asi(DisasContext *dc, TCGv addr, TCGv cmpv, } } -static void gen_ldstub_asi(DisasContext *dc, TCGv dst, TCGv addr, int insn) +static void __attribute__((unused)) +gen_ldstub_asi(DisasContext *dc, TCGv dst, TCGv addr, int insn) { DisasASI da = get_asi(dc, insn, MO_UB); @@ -2322,11 +2334,9 @@ static void gen_ldstub_asi(DisasContext *dc, TCGv dst, TCGv addr, int insn) break; } } -#endif -#ifdef TARGET_SPARC64 -static void gen_ldf_asi(DisasContext *dc, TCGv addr, - int insn, int size, int rd) +static void __attribute__((unused)) +gen_ldf_asi(DisasContext *dc, TCGv addr, int insn, int size, int rd) { DisasASI da = get_asi(dc, insn, (size == 4 ? MO_TEUL : MO_TEUQ)); TCGv_i32 d32; @@ -2434,8 +2444,8 @@ static void gen_ldf_asi(DisasContext *dc, TCGv addr, } } -static void gen_stf_asi(DisasContext *dc, TCGv addr, - int insn, int size, int rd) +static void __attribute__((unused)) +gen_stf_asi(DisasContext *dc, TCGv addr, int insn, int size, int rd) { DisasASI da = get_asi(dc, insn, (size == 4 ? MO_TEUL : MO_TEUQ)); TCGv_i32 d32; @@ -2517,21 +2527,23 @@ static void gen_stf_asi(DisasContext *dc, TCGv addr, } } -static void gen_ldda_asi(DisasContext *dc, TCGv addr, int insn, int rd) +static void __attribute__((unused)) +gen_ldda_asi(DisasContext *dc, TCGv addr, int insn, int rd) { DisasASI da = get_asi(dc, insn, MO_TEUQ); - TCGv_i64 hi = gen_dest_gpr(dc, rd); - TCGv_i64 lo = gen_dest_gpr(dc, rd + 1); + TCGv hi = gen_dest_gpr(dc, rd); + TCGv lo = gen_dest_gpr(dc, rd + 1); switch (da.type) { case GET_ASI_EXCP: return; case GET_ASI_DTWINX: + assert(TARGET_LONG_BITS == 64); gen_address_mask(dc, addr); - tcg_gen_qemu_ld_i64(hi, addr, da.mem_idx, da.memop | MO_ALIGN_16); + tcg_gen_qemu_ld_tl(hi, addr, da.mem_idx, da.memop | MO_ALIGN_16); tcg_gen_addi_tl(addr, addr, 8); - tcg_gen_qemu_ld_i64(lo, addr, da.mem_idx, da.memop); + tcg_gen_qemu_ld_tl(lo, addr, da.mem_idx, da.memop); break; case GET_ASI_DIRECT: @@ -2545,9 +2557,9 @@ static void gen_ldda_asi(DisasContext *dc, TCGv addr, int insn, int rd) result is byte swapped. Having just performed one 64-bit bswap, we need now to swap the writebacks. */ if ((da.memop & MO_BSWAP) == MO_TE) { - tcg_gen_extr32_i64(lo, hi, tmp); + tcg_gen_extr_i64_tl(lo, hi, tmp); } else { - tcg_gen_extr32_i64(hi, lo, tmp); + tcg_gen_extr_i64_tl(hi, lo, tmp); } } break; @@ -2567,9 +2579,9 @@ static void gen_ldda_asi(DisasContext *dc, TCGv addr, int insn, int rd) /* See above. */ if ((da.memop & MO_BSWAP) == MO_TE) { - tcg_gen_extr32_i64(lo, hi, tmp); + tcg_gen_extr_i64_tl(lo, hi, tmp); } else { - tcg_gen_extr32_i64(hi, lo, tmp); + tcg_gen_extr_i64_tl(hi, lo, tmp); } } break; @@ -2579,8 +2591,8 @@ static void gen_ldda_asi(DisasContext *dc, TCGv addr, int insn, int rd) gen_store_gpr(dc, rd + 1, lo); } -static void gen_stda_asi(DisasContext *dc, TCGv hi, TCGv addr, - int insn, int rd) +static void __attribute__((unused)) +gen_stda_asi(DisasContext *dc, TCGv hi, TCGv addr, int insn, int rd) { DisasASI da = get_asi(dc, insn, MO_TEUQ); TCGv lo = gen_load_gpr(dc, rd + 1); @@ -2590,10 +2602,11 @@ static void gen_stda_asi(DisasContext *dc, TCGv hi, TCGv addr, break; case GET_ASI_DTWINX: + assert(TARGET_LONG_BITS == 64); gen_address_mask(dc, addr); - tcg_gen_qemu_st_i64(hi, addr, da.mem_idx, da.memop | MO_ALIGN_16); + tcg_gen_qemu_st_tl(hi, addr, da.mem_idx, da.memop | MO_ALIGN_16); tcg_gen_addi_tl(addr, addr, 8); - tcg_gen_qemu_st_i64(lo, addr, da.mem_idx, da.memop); + tcg_gen_qemu_st_tl(lo, addr, da.mem_idx, da.memop); break; case GET_ASI_DIRECT: @@ -2604,15 +2617,37 @@ static void gen_stda_asi(DisasContext *dc, TCGv hi, TCGv addr, byte swapped. We will perform one 64-bit LE store, so now we must swap the order of the construction. */ if ((da.memop & MO_BSWAP) == MO_TE) { - tcg_gen_concat32_i64(t64, lo, hi); + tcg_gen_concat_tl_i64(t64, lo, hi); } else { - tcg_gen_concat32_i64(t64, hi, lo); + tcg_gen_concat_tl_i64(t64, hi, lo); } gen_address_mask(dc, addr); tcg_gen_qemu_st_i64(t64, addr, da.mem_idx, da.memop | MO_ALIGN); } break; + case GET_ASI_BFILL: + assert(TARGET_LONG_BITS == 32); + /* Store 32 bytes of T64 to ADDR. */ + /* ??? The original qemu code suggests 8-byte alignment, dropping + the low bits, but the only place I can see this used is in the + Linux kernel with 32 byte alignment, which would make more sense + as a cacheline-style operation. */ + { + TCGv_i64 t64 = tcg_temp_new_i64(); + TCGv d_addr = tcg_temp_new(); + TCGv eight = tcg_constant_tl(8); + int i; + + tcg_gen_concat_tl_i64(t64, lo, hi); + tcg_gen_andi_tl(d_addr, addr, -8); + for (i = 0; i < 32; i += 8) { + tcg_gen_qemu_st_i64(t64, d_addr, da.mem_idx, da.memop); + tcg_gen_add_tl(d_addr, d_addr, eight); + } + } + break; + default: /* ??? In theory we've handled all of the ASIs that are valid for stda, and this should raise DAE_invalid_asi. */ @@ -2623,9 +2658,9 @@ static void gen_stda_asi(DisasContext *dc, TCGv hi, TCGv addr, /* See above. */ if ((da.memop & MO_BSWAP) == MO_TE) { - tcg_gen_concat32_i64(t64, lo, hi); + tcg_gen_concat_tl_i64(t64, lo, hi); } else { - tcg_gen_concat32_i64(t64, hi, lo); + tcg_gen_concat_tl_i64(t64, hi, lo); } save_state(dc); @@ -2635,8 +2670,8 @@ static void gen_stda_asi(DisasContext *dc, TCGv hi, TCGv addr, } } -static void gen_casx_asi(DisasContext *dc, TCGv addr, TCGv cmpv, - int insn, int rd) +static void __attribute__((unused)) +gen_casx_asi(DisasContext *dc, TCGv addr, TCGv cmpv, int insn, int rd) { DisasASI da = get_asi(dc, insn, MO_TEUQ); TCGv oldv; @@ -2657,88 +2692,6 @@ static void gen_casx_asi(DisasContext *dc, TCGv addr, TCGv cmpv, } } -#elif !defined(CONFIG_USER_ONLY) -static void gen_ldda_asi(DisasContext *dc, TCGv addr, int insn, int rd) -{ - /* ??? Work around an apparent bug in Ubuntu gcc 4.8.2-10ubuntu2+12, - whereby "rd + 1" elicits "error: array subscript is above array". - Since we have already asserted that rd is even, the semantics - are unchanged. */ - TCGv lo = gen_dest_gpr(dc, rd | 1); - TCGv hi = gen_dest_gpr(dc, rd); - TCGv_i64 t64 = tcg_temp_new_i64(); - DisasASI da = get_asi(dc, insn, MO_TEUQ); - - switch (da.type) { - case GET_ASI_EXCP: - return; - case GET_ASI_DIRECT: - gen_address_mask(dc, addr); - tcg_gen_qemu_ld_i64(t64, addr, da.mem_idx, da.memop | MO_ALIGN); - break; - default: - { - TCGv_i32 r_asi = tcg_constant_i32(da.asi); - TCGv_i32 r_mop = tcg_constant_i32(MO_UQ); - - save_state(dc); - gen_helper_ld_asi(t64, tcg_env, addr, r_asi, r_mop); - } - break; - } - - tcg_gen_extr_i64_i32(lo, hi, t64); - gen_store_gpr(dc, rd | 1, lo); - gen_store_gpr(dc, rd, hi); -} - -static void gen_stda_asi(DisasContext *dc, TCGv hi, TCGv addr, - int insn, int rd) -{ - DisasASI da = get_asi(dc, insn, MO_TEUQ); - TCGv lo = gen_load_gpr(dc, rd + 1); - TCGv_i64 t64 = tcg_temp_new_i64(); - - tcg_gen_concat_tl_i64(t64, lo, hi); - - switch (da.type) { - case GET_ASI_EXCP: - break; - case GET_ASI_DIRECT: - gen_address_mask(dc, addr); - tcg_gen_qemu_st_i64(t64, addr, da.mem_idx, da.memop | MO_ALIGN); - break; - case GET_ASI_BFILL: - /* Store 32 bytes of T64 to ADDR. */ - /* ??? The original qemu code suggests 8-byte alignment, dropping - the low bits, but the only place I can see this used is in the - Linux kernel with 32 byte alignment, which would make more sense - as a cacheline-style operation. */ - { - TCGv d_addr = tcg_temp_new(); - TCGv eight = tcg_constant_tl(8); - int i; - - tcg_gen_andi_tl(d_addr, addr, -8); - for (i = 0; i < 32; i += 8) { - tcg_gen_qemu_st_i64(t64, d_addr, da.mem_idx, da.memop); - tcg_gen_add_tl(d_addr, d_addr, eight); - } - } - break; - default: - { - TCGv_i32 r_asi = tcg_constant_i32(da.asi); - TCGv_i32 r_mop = tcg_constant_i32(MO_UQ); - - save_state(dc); - gen_helper_st_asi(tcg_env, addr, t64, r_asi, r_mop); - } - break; - } -} -#endif - static TCGv get_src1(DisasContext *dc, unsigned int insn) { unsigned int rs1 = GET_FIELD(insn, 13, 17); From patchwork Sun Oct 22 05:59:47 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 736961 Delivered-To: patch@linaro.org Received: by 2002:adf:dd81:0:b0:32d:baff:b0ca with SMTP id x1csp1005629wrl; Sat, 21 Oct 2023 23:11:39 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEOuKbtvIjOZxS12prvVkwf988YmU3Gi9pp3GABH4pD5K6gwV0hrhN66WBRxg5FLpDAg7Mb X-Received: by 2002:a05:620a:2951:b0:76f:1076:3b43 with SMTP id n17-20020a05620a295100b0076f10763b43mr6137037qkp.1.1697955099298; Sat, 21 Oct 2023 23:11:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697955099; cv=none; d=google.com; s=arc-20160816; b=hK1gGDxm5TurJyqTfcHHxW0Us41PlVz1mLQzdsOScUeyPHctH5FNttA4ll5RBuwC0r bhbMnpDbLlZPzsQbNdL34EYlkgDcQ1lV2jNuJbOG2PBUw9OWD54Y2NwwIlRPH9D00TqH QQ+pch96djMDAQRTpLsLrIlQoaxmorBsUWX2a26yNlPrdejR+FmoLm9oC3OMK/o13kFz f73IRy5UrD58FRrrFNt9X04xv8uNPQojsFbqRhtuhwZ+rCf20wGZklYImOv7vZvq94Yw NyEY1TMxzCN0oRFxGpDVFwcRETh0gYU9VmodfhDKOLZgVWkWE0m767bl1c4Z+e9rKHZ4 86NQ== 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=TTNgbuPbtC9nIODeF8TXrQUffC7OOzP95DUSxezgrqQ=; fh=TYrED6TOMxGX0VC4GtjviASLbYyJe19+7/tKWjN44KQ=; b=pfpD/SOAnMfYkr38c2AMIk3h7kI6txu0MQ5vlWqxx5G0aV8vw7vpnuBFFxuZxww8V6 OkBOdYWLmVemac9BuIiih88kLK5oYnkJevM4mq8FERVKC9Y/j3VoEq3gnXlIdE5Y6RSx 1C5vKeGv19IshGSe00zMZo4vZXLwoGN47DKzUpqwkBs5K6gw+U+r8W7TLNlPm3PY4PzH zA858dKskRNaDe2r8+DbnRczZFIjwCE3Z25dohfqBvMY/Ovadh+h2WC6epjPOPOBJq4g NWsNc6ljdcHpt0v3kBUNbq/lEdPIXttlZtdLL0EKzIBMUSg0+6w3nFtq7OwpyT8kt8Fa 0czA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="F/jk6djg"; 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 d19-20020a05620a141300b00767dc58f2f8si3490523qkj.48.2023.10.21.23.11.39 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sat, 21 Oct 2023 23:11: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="F/jk6djg"; 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 1quRaA-0001CD-DJ; Sun, 22 Oct 2023 02:05:02 -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 1quRZx-0000KL-2S for qemu-devel@nongnu.org; Sun, 22 Oct 2023 02:04:49 -0400 Received: from mail-pf1-x430.google.com ([2607:f8b0:4864:20::430]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1quRZq-0002Dz-J6 for qemu-devel@nongnu.org; Sun, 22 Oct 2023 02:04:47 -0400 Received: by mail-pf1-x430.google.com with SMTP id d2e1a72fcca58-6b5e6301a19so2090218b3a.0 for ; Sat, 21 Oct 2023 23:04:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1697954681; x=1698559481; 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=TTNgbuPbtC9nIODeF8TXrQUffC7OOzP95DUSxezgrqQ=; b=F/jk6djgRbmrcB7Y2yEQED3JTOF7WQQYtkkiaS1PEdMIETNp86c6LF1gsBp0+rHwMc KAmcKPgqEjHKXN7/DGeb15XNcteGQ5oHPBga+u1TqtNYWudItZycpOIgeF9PbAtpGfhx 42GDrvg5NBomU1etxJW1giFKjHiC0wael4NFJA5VPmstllFaQfni16JFzkMP40ExEWNm b/OpYnX2RN4zd1ciEJ8bPXSLKcPm65xrUIj+ENwzmlnrUWkVbE7ZDFdKHsoWSwPqvvDB H7K4licMKfaMy+6giO879trW94GZdnO2s0Sxm76VnT5SELhO/dwRXaJO5wLhSRwql0nU dcUg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697954681; x=1698559481; 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=TTNgbuPbtC9nIODeF8TXrQUffC7OOzP95DUSxezgrqQ=; b=nt566WpDXBcBidwCSVFCndwrK49V7H79ZRsB/fIVRugUwhQBM/Fyjbe8Iv6CThOJK2 dICJGK5gsRtQRUbiSdKaCgJ2HjfN8LypM7BIQyjVCOQhWLRsxEZOcZ/jyO20qoitptfu embbyk3iM1CNZizV+ptdIAS0uxj+Bxd8zO/pJbwP/euXRD6usQ6r2LKEXS2QVD2V80GA AEYwBeA5ypvbBmpUGZy5LNo8YLM9gvpwMRm+v26mVdsGY+DZYPrVNaQA2e/pAGhUxfvF PZIvGjF3ABB3XSryUSLI8qA3YAwL2zjdkRsmcvBVuIy65RtO7HhDtywbnrvNYU1Hu3pT zTVA== X-Gm-Message-State: AOJu0Ywu+HKPFZbX4o4oUVmhuJr6S28VnPVM77PJAJX0yHyvQ9LzzERj WuM3wHcqDon2LH+Iv5tDvPFODXplZ8osym/gK9Q= X-Received: by 2002:a05:6a00:13a5:b0:6bb:4360:159e with SMTP id t37-20020a056a0013a500b006bb4360159emr7203957pfg.17.1697954680851; Sat, 21 Oct 2023 23:04:40 -0700 (PDT) Received: from stoup.. ([71.212.149.95]) by smtp.gmail.com with ESMTPSA id fb13-20020a056a002d8d00b0068a46cd4120sm4007373pfb.199.2023.10.21.23.04.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 21 Oct 2023 23:04:40 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: mark.cave-ayland@ilande.co.uk Subject: [PATCH v4 46/90] target/sparc: Split out ldst functions with asi pre-computed Date: Sat, 21 Oct 2023 22:59:47 -0700 Message-Id: <20231022060031.490251-47-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231022060031.490251-1-richard.henderson@linaro.org> References: <20231022060031.490251-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::430; envelope-from=richard.henderson@linaro.org; helo=mail-pf1-x430.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 As an intermediate step in decodetree conversion, create new functions passing in DisasASI and not insn. Signed-off-by: Richard Henderson --- target/sparc/translate.c | 215 ++++++++++++++++++++++----------------- 1 file changed, 123 insertions(+), 92 deletions(-) diff --git a/target/sparc/translate.c b/target/sparc/translate.c index 6802399647..dbadc860c3 100644 --- a/target/sparc/translate.c +++ b/target/sparc/translate.c @@ -2147,25 +2147,21 @@ static DisasASI get_asi(DisasContext *dc, int insn, MemOp memop) return resolve_asi(dc, asi, memop); } -static void __attribute__((unused)) -gen_ld_asi(DisasContext *dc, TCGv dst, TCGv addr, int insn, MemOp memop) +static void gen_ld_asi0(DisasContext *dc, DisasASI *da, TCGv dst, TCGv addr) { - DisasASI da = get_asi(dc, insn, memop); - - switch (da.type) { + switch (da->type) { case GET_ASI_EXCP: break; case GET_ASI_DTWINX: /* Reserved for ldda. */ gen_exception(dc, TT_ILL_INSN); break; case GET_ASI_DIRECT: - gen_address_mask(dc, addr); - tcg_gen_qemu_ld_tl(dst, addr, da.mem_idx, da.memop | MO_ALIGN); + tcg_gen_qemu_ld_tl(dst, addr, da->mem_idx, da->memop | MO_ALIGN); break; default: { - TCGv_i32 r_asi = tcg_constant_i32(da.asi); - TCGv_i32 r_mop = tcg_constant_i32(memop | MO_ALIGN); + TCGv_i32 r_asi = tcg_constant_i32(da->asi); + TCGv_i32 r_mop = tcg_constant_i32(da->memop | MO_ALIGN); save_state(dc); #ifdef TARGET_SPARC64 @@ -2183,33 +2179,38 @@ gen_ld_asi(DisasContext *dc, TCGv dst, TCGv addr, int insn, MemOp memop) } static void __attribute__((unused)) -gen_st_asi(DisasContext *dc, TCGv src, TCGv addr, int insn, MemOp memop) +gen_ld_asi(DisasContext *dc, TCGv dst, TCGv addr, int insn, MemOp memop) { DisasASI da = get_asi(dc, insn, memop); - switch (da.type) { + gen_address_mask(dc, addr); + gen_ld_asi0(dc, &da, dst, addr); +} + +static void gen_st_asi0(DisasContext *dc, DisasASI *da, TCGv src, TCGv addr) +{ + switch (da->type) { case GET_ASI_EXCP: break; + case GET_ASI_DTWINX: /* Reserved for stda. */ -#ifndef TARGET_SPARC64 - gen_exception(dc, TT_ILL_INSN); - break; -#else - if (!(dc->def->features & CPU_FEATURE_HYPV)) { + if (TARGET_LONG_BITS == 32) { + gen_exception(dc, TT_ILL_INSN); + break; + } else if (!(dc->def->features & CPU_FEATURE_HYPV)) { /* Pre OpenSPARC CPUs don't have these */ gen_exception(dc, TT_ILL_INSN); - return; + break; } - /* in OpenSPARC T1+ CPUs TWINX ASIs in store instructions - * are ST_BLKINIT_ ASIs */ -#endif + /* In OpenSPARC T1+ CPUs TWINX ASIs in store are ST_BLKINIT_ ASIs */ /* fall through */ + case GET_ASI_DIRECT: - gen_address_mask(dc, addr); - tcg_gen_qemu_st_tl(src, addr, da.mem_idx, da.memop | MO_ALIGN); + tcg_gen_qemu_st_tl(src, addr, da->mem_idx, da->memop | MO_ALIGN); break; -#if !defined(TARGET_SPARC64) && !defined(CONFIG_USER_ONLY) + case GET_ASI_BCOPY: + assert(TARGET_LONG_BITS == 32); /* Copy 32 bytes from the address in SRC to ADDR. */ /* ??? The original qemu code suggests 4-byte alignment, dropping the low bits, but the only place I can see this used is in the @@ -2227,18 +2228,18 @@ gen_st_asi(DisasContext *dc, TCGv src, TCGv addr, int insn, MemOp memop) for (i = 0; i < 32; i += 4) { /* Since the loads and stores are paired, allow the copy to happen in the host endianness. */ - tcg_gen_qemu_ld_i32(tmp, saddr, da.mem_idx, MO_UL); - tcg_gen_qemu_st_i32(tmp, daddr, da.mem_idx, MO_UL); + tcg_gen_qemu_ld_i32(tmp, saddr, da->mem_idx, MO_UL); + tcg_gen_qemu_st_i32(tmp, daddr, da->mem_idx, MO_UL); tcg_gen_add_tl(saddr, saddr, four); tcg_gen_add_tl(daddr, daddr, four); } } break; -#endif + default: { - TCGv_i32 r_asi = tcg_constant_i32(da.asi); - TCGv_i32 r_mop = tcg_constant_i32(memop | MO_ALIGN); + TCGv_i32 r_asi = tcg_constant_i32(da->asi); + TCGv_i32 r_mop = tcg_constant_i32(da->memop | MO_ALIGN); save_state(dc); #ifdef TARGET_SPARC64 @@ -2258,16 +2259,49 @@ gen_st_asi(DisasContext *dc, TCGv src, TCGv addr, int insn, MemOp memop) } } +static void __attribute__((unused)) +gen_st_asi(DisasContext *dc, TCGv src, TCGv addr, int insn, MemOp memop) +{ + DisasASI da = get_asi(dc, insn, memop); + + gen_address_mask(dc, addr); + gen_st_asi0(dc, &da, src, addr); +} + +static void gen_swap_asi0(DisasContext *dc, DisasASI *da, + TCGv dst, TCGv src, TCGv addr) +{ + switch (da->type) { + case GET_ASI_EXCP: + break; + case GET_ASI_DIRECT: + gen_swap(dc, dst, src, addr, da->mem_idx, da->memop); + break; + default: + /* ??? Should be DAE_invalid_asi. */ + gen_exception(dc, TT_DATA_ACCESS); + break; + } +} + static void __attribute__((unused)) gen_swap_asi(DisasContext *dc, TCGv dst, TCGv src, TCGv addr, int insn) { DisasASI da = get_asi(dc, insn, MO_TEUL); - switch (da.type) { + gen_address_mask(dc, addr); + gen_swap_asi0(dc, &da, dst, src, addr); +} + +static void gen_cas_asi0(DisasContext *dc, DisasASI *da, + TCGv oldv, TCGv newv, TCGv cmpv, TCGv addr) +{ + switch (da->type) { case GET_ASI_EXCP: - break; + return; case GET_ASI_DIRECT: - gen_swap(dc, dst, src, addr, da.mem_idx, da.memop); + tcg_gen_atomic_cmpxchg_tl(oldv, addr, cmpv, newv, + da->mem_idx, da->memop | MO_ALIGN); break; default: /* ??? Should be DAE_invalid_asi. */ @@ -2280,34 +2314,33 @@ static void __attribute__((unused)) gen_cas_asi(DisasContext *dc, TCGv addr, TCGv cmpv, int insn, int rd) { DisasASI da = get_asi(dc, insn, MO_TEUL); - TCGv oldv; + TCGv oldv = gen_dest_gpr(dc, rd); + TCGv newv = gen_load_gpr(dc, rd); - switch (da.type) { - case GET_ASI_EXCP: - return; - case GET_ASI_DIRECT: - oldv = tcg_temp_new(); - tcg_gen_atomic_cmpxchg_tl(oldv, addr, cmpv, gen_load_gpr(dc, rd), - da.mem_idx, da.memop | MO_ALIGN); - gen_store_gpr(dc, rd, oldv); - break; - default: - /* ??? Should be DAE_invalid_asi. */ - gen_exception(dc, TT_DATA_ACCESS); - break; - } + gen_address_mask(dc, addr); + gen_cas_asi0(dc, &da, oldv, newv, cmpv, addr); + gen_store_gpr(dc, rd, oldv); } static void __attribute__((unused)) -gen_ldstub_asi(DisasContext *dc, TCGv dst, TCGv addr, int insn) +gen_casx_asi(DisasContext *dc, TCGv addr, TCGv cmpv, int insn, int rd) { - DisasASI da = get_asi(dc, insn, MO_UB); + DisasASI da = get_asi(dc, insn, MO_TEUQ); + TCGv oldv = gen_dest_gpr(dc, rd); + TCGv newv = gen_load_gpr(dc, rd); - switch (da.type) { + gen_address_mask(dc, addr); + gen_cas_asi0(dc, &da, oldv, newv, cmpv, addr); + gen_store_gpr(dc, rd, oldv); +} + +static void gen_ldstub_asi0(DisasContext *dc, DisasASI *da, TCGv dst, TCGv addr) +{ + switch (da->type) { case GET_ASI_EXCP: break; case GET_ASI_DIRECT: - gen_ldstub(dc, dst, addr, da.mem_idx); + gen_ldstub(dc, dst, addr, da->mem_idx); break; default: /* ??? In theory, this should be raise DAE_invalid_asi. @@ -2315,7 +2348,7 @@ gen_ldstub_asi(DisasContext *dc, TCGv dst, TCGv addr, int insn) if (tb_cflags(dc->base.tb) & CF_PARALLEL) { gen_helper_exit_atomic(tcg_env); } else { - TCGv_i32 r_asi = tcg_constant_i32(da.asi); + TCGv_i32 r_asi = tcg_constant_i32(da->asi); TCGv_i32 r_mop = tcg_constant_i32(MO_UB); TCGv_i64 s64, t64; @@ -2335,6 +2368,15 @@ gen_ldstub_asi(DisasContext *dc, TCGv dst, TCGv addr, int insn) } } +static void __attribute__((unused)) +gen_ldstub_asi(DisasContext *dc, TCGv dst, TCGv addr, int insn) +{ + DisasASI da = get_asi(dc, insn, MO_UB); + + gen_address_mask(dc, addr); + gen_ldstub_asi0(dc, &da, dst, addr); +} + static void __attribute__((unused)) gen_ldf_asi(DisasContext *dc, TCGv addr, int insn, int size, int rd) { @@ -2527,36 +2569,32 @@ gen_stf_asi(DisasContext *dc, TCGv addr, int insn, int size, int rd) } } -static void __attribute__((unused)) -gen_ldda_asi(DisasContext *dc, TCGv addr, int insn, int rd) +static void gen_ldda_asi0(DisasContext *dc, DisasASI *da, TCGv addr, int rd) { - DisasASI da = get_asi(dc, insn, MO_TEUQ); TCGv hi = gen_dest_gpr(dc, rd); TCGv lo = gen_dest_gpr(dc, rd + 1); - switch (da.type) { + switch (da->type) { case GET_ASI_EXCP: return; case GET_ASI_DTWINX: assert(TARGET_LONG_BITS == 64); - gen_address_mask(dc, addr); - tcg_gen_qemu_ld_tl(hi, addr, da.mem_idx, da.memop | MO_ALIGN_16); + tcg_gen_qemu_ld_tl(hi, addr, da->mem_idx, da->memop | MO_ALIGN_16); tcg_gen_addi_tl(addr, addr, 8); - tcg_gen_qemu_ld_tl(lo, addr, da.mem_idx, da.memop); + tcg_gen_qemu_ld_tl(lo, addr, da->mem_idx, da->memop); break; case GET_ASI_DIRECT: { TCGv_i64 tmp = tcg_temp_new_i64(); - gen_address_mask(dc, addr); - tcg_gen_qemu_ld_i64(tmp, addr, da.mem_idx, da.memop | MO_ALIGN); + tcg_gen_qemu_ld_i64(tmp, addr, da->mem_idx, da->memop | MO_ALIGN); /* Note that LE ldda acts as if each 32-bit register result is byte swapped. Having just performed one 64-bit bswap, we need now to swap the writebacks. */ - if ((da.memop & MO_BSWAP) == MO_TE) { + if ((da->memop & MO_BSWAP) == MO_TE) { tcg_gen_extr_i64_tl(lo, hi, tmp); } else { tcg_gen_extr_i64_tl(hi, lo, tmp); @@ -2570,15 +2608,15 @@ gen_ldda_asi(DisasContext *dc, TCGv addr, int insn, int rd) real hardware allows others. This can be seen with e.g. FreeBSD 10.3 wrt ASI_IC_TAG. */ { - TCGv_i32 r_asi = tcg_constant_i32(da.asi); - TCGv_i32 r_mop = tcg_constant_i32(da.memop); + TCGv_i32 r_asi = tcg_constant_i32(da->asi); + TCGv_i32 r_mop = tcg_constant_i32(da->memop); TCGv_i64 tmp = tcg_temp_new_i64(); save_state(dc); gen_helper_ld_asi(tmp, tcg_env, addr, r_asi, r_mop); /* See above. */ - if ((da.memop & MO_BSWAP) == MO_TE) { + if ((da->memop & MO_BSWAP) == MO_TE) { tcg_gen_extr_i64_tl(lo, hi, tmp); } else { tcg_gen_extr_i64_tl(hi, lo, tmp); @@ -2592,21 +2630,28 @@ gen_ldda_asi(DisasContext *dc, TCGv addr, int insn, int rd) } static void __attribute__((unused)) -gen_stda_asi(DisasContext *dc, TCGv hi, TCGv addr, int insn, int rd) +gen_ldda_asi(DisasContext *dc, TCGv addr, int insn, int rd) { DisasASI da = get_asi(dc, insn, MO_TEUQ); + + gen_address_mask(dc, addr); + gen_ldda_asi0(dc, &da, addr, rd); +} + +static void gen_stda_asi0(DisasContext *dc, DisasASI *da, TCGv addr, int rd) +{ + TCGv hi = gen_load_gpr(dc, rd); TCGv lo = gen_load_gpr(dc, rd + 1); - switch (da.type) { + switch (da->type) { case GET_ASI_EXCP: break; case GET_ASI_DTWINX: assert(TARGET_LONG_BITS == 64); - gen_address_mask(dc, addr); - tcg_gen_qemu_st_tl(hi, addr, da.mem_idx, da.memop | MO_ALIGN_16); + tcg_gen_qemu_st_tl(hi, addr, da->mem_idx, da->memop | MO_ALIGN_16); tcg_gen_addi_tl(addr, addr, 8); - tcg_gen_qemu_st_tl(lo, addr, da.mem_idx, da.memop); + tcg_gen_qemu_st_tl(lo, addr, da->mem_idx, da->memop); break; case GET_ASI_DIRECT: @@ -2616,13 +2661,12 @@ gen_stda_asi(DisasContext *dc, TCGv hi, TCGv addr, int insn, int rd) /* Note that LE stda acts as if each 32-bit register result is byte swapped. We will perform one 64-bit LE store, so now we must swap the order of the construction. */ - if ((da.memop & MO_BSWAP) == MO_TE) { + if ((da->memop & MO_BSWAP) == MO_TE) { tcg_gen_concat_tl_i64(t64, lo, hi); } else { tcg_gen_concat_tl_i64(t64, hi, lo); } - gen_address_mask(dc, addr); - tcg_gen_qemu_st_i64(t64, addr, da.mem_idx, da.memop | MO_ALIGN); + tcg_gen_qemu_st_i64(t64, addr, da->mem_idx, da->memop | MO_ALIGN); } break; @@ -2642,7 +2686,7 @@ gen_stda_asi(DisasContext *dc, TCGv hi, TCGv addr, int insn, int rd) tcg_gen_concat_tl_i64(t64, lo, hi); tcg_gen_andi_tl(d_addr, addr, -8); for (i = 0; i < 32; i += 8) { - tcg_gen_qemu_st_i64(t64, d_addr, da.mem_idx, da.memop); + tcg_gen_qemu_st_i64(t64, d_addr, da->mem_idx, da->memop); tcg_gen_add_tl(d_addr, d_addr, eight); } } @@ -2652,12 +2696,12 @@ gen_stda_asi(DisasContext *dc, TCGv hi, TCGv addr, int insn, int rd) /* ??? In theory we've handled all of the ASIs that are valid for stda, and this should raise DAE_invalid_asi. */ { - TCGv_i32 r_asi = tcg_constant_i32(da.asi); - TCGv_i32 r_mop = tcg_constant_i32(da.memop); + TCGv_i32 r_asi = tcg_constant_i32(da->asi); + TCGv_i32 r_mop = tcg_constant_i32(da->memop); TCGv_i64 t64 = tcg_temp_new_i64(); /* See above. */ - if ((da.memop & MO_BSWAP) == MO_TE) { + if ((da->memop & MO_BSWAP) == MO_TE) { tcg_gen_concat_tl_i64(t64, lo, hi); } else { tcg_gen_concat_tl_i64(t64, hi, lo); @@ -2671,25 +2715,12 @@ gen_stda_asi(DisasContext *dc, TCGv hi, TCGv addr, int insn, int rd) } static void __attribute__((unused)) -gen_casx_asi(DisasContext *dc, TCGv addr, TCGv cmpv, int insn, int rd) +gen_stda_asi(DisasContext *dc, TCGv hi, TCGv addr, int insn, int rd) { DisasASI da = get_asi(dc, insn, MO_TEUQ); - TCGv oldv; - switch (da.type) { - case GET_ASI_EXCP: - return; - case GET_ASI_DIRECT: - oldv = tcg_temp_new(); - tcg_gen_atomic_cmpxchg_tl(oldv, addr, cmpv, gen_load_gpr(dc, rd), - da.mem_idx, da.memop | MO_ALIGN); - gen_store_gpr(dc, rd, oldv); - break; - default: - /* ??? Should be DAE_invalid_asi. */ - gen_exception(dc, TT_DATA_ACCESS); - break; - } + gen_address_mask(dc, addr); + gen_stda_asi0(dc, &da, addr, rd); } static TCGv get_src1(DisasContext *dc, unsigned int insn) From patchwork Sun Oct 22 05:59:48 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 736960 Delivered-To: patch@linaro.org Received: by 2002:adf:dd81:0:b0:32d:baff:b0ca with SMTP id x1csp1005627wrl; Sat, 21 Oct 2023 23:11:39 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGq99JAT6N9uNHonKzO1TtlNxcMreQHsBhbFMDMTJTfuwSlPq9TjMrZuiu7UoC+YNEJTGO3 X-Received: by 2002:a05:6214:212c:b0:656:4712:af9f with SMTP id r12-20020a056214212c00b006564712af9fmr8027719qvc.13.1697955099079; Sat, 21 Oct 2023 23:11:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697955099; cv=none; d=google.com; s=arc-20160816; b=U0TXlHluJLi/JU6SEt8TQ1fx2bMVAfGSc5b5FwfmGwtYQ9RLzt8Mg8ORzPdHq+z+Ff 6BbgnIl4ZPZF6tLlnxdsW7cPcCQ59qYt2IM2YJuH2jRzlrHl62XSZu+wmsxYlrXpjJNL ckxkEyThPMGM/gRDgGI/88JFcLey7qLH1r1sbprA2j0tyodk0TYns+nhlZMxlAAYtGj7 xJtFeteLPFGkccPfAHH+OI45cbRJrE0/Xdpnex8xRKjj4wWH+2YkVQamICdK0IRQI+Nc jwomSP6YhzKPkEIgeZIZgGEn5TvJTK0r7K6817hhXNXntYYuDver1JCaaI8v3B+gY1OD e3/Q== 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=n4gVY2mbOcElI1vUEaatHV71uTw57mIjZRVd7BNlWrY=; fh=TYrED6TOMxGX0VC4GtjviASLbYyJe19+7/tKWjN44KQ=; b=GELq1Zr5NFLXryiqJrk4WoCsZFcofEgOLW/IShD6DLqUs2PSZl/WpPZ1mqwTXxGgcV x/NVeTxZSAbbQTMop2/Keze+RrAcPkCW8Jx5L18FKb2T995pG2wpcsSoyPTLtSzyRRJG tbDaA+B6nTvbFvW8BPSlcktCKHuk0nE3M6F4+Sy8SogUJhEs9UAKcenEFOG0tHbW/iSc 6hbIwVHIHMi2C0xBn5XlrThZdSwwYVThOdWYlFLiy2k3ppjZnJo0KaTT32ERQ2CmHNUV 3fd4xsGreiUoU3eMfexd9YfUzT3QkC3UaEI3SgTjwBrKS1/+nxD7o3UKXSUJGSHI4jDF gpnQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=GWnva+CK; 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=fail (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 g10-20020a0cf84a000000b0066d20b83677si3838706qvo.119.2023.10.21.23.11.38 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sat, 21 Oct 2023 23:11: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=fail header.i=@linaro.org header.s=google header.b=GWnva+CK; 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=fail (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 1quRaF-0001l1-0O; Sun, 22 Oct 2023 02:05:08 -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 1quRZx-0000KO-2N for qemu-devel@nongnu.org; Sun, 22 Oct 2023 02:04:49 -0400 Received: from mail-pf1-x42b.google.com ([2607:f8b0:4864:20::42b]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1quRZr-0002EC-Bg for qemu-devel@nongnu.org; Sun, 22 Oct 2023 02:04:47 -0400 Received: by mail-pf1-x42b.google.com with SMTP id d2e1a72fcca58-6b89ab5ddb7so2209171b3a.0 for ; Sat, 21 Oct 2023 23:04:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1697954681; x=1698559481; 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=n4gVY2mbOcElI1vUEaatHV71uTw57mIjZRVd7BNlWrY=; b=GWnva+CKbZMhj45NzKQ8ufWEMhZ1zUepkcf3OkA6Twics1KAGtqxg/AFcmuoyuAYKO tz02rQWFjA0xr7spfTRqvIx2/FSVVO0qOphI6UAOYZBSaYhawvKHIi5D3gBFYD2PJlr5 B55KSHJLLobsS4BQYuzKy4ZcFiibAQvXWXQxxbPkAFjpkCWk6HSwj5ZGOP1RtxQ4ym7i iwnIkeamZZvDHoNrwxd/vAawBd9YgdbpqNZVe8iyG2AvBjNPvIz/sq9/YvgeX+erva7Z qWiUIi4xhai9992cLST7dNWZd5OtK+VCPWXCzaoM2vpyYfCyviEZgxs1SWZ3xrwvpQfw GNSQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697954681; x=1698559481; 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=n4gVY2mbOcElI1vUEaatHV71uTw57mIjZRVd7BNlWrY=; b=XuPj47bm/pOT1lxupzV+K20aWMEHpJnFw1Lc2w+p2M989OxpNI/g5kQtUb1pb4vSqV NqWtH0hTghz6k4KrOGaoP0K0HwVshW1RtDvYT05r1CprKa0h5plsSfyy4QcPmy9X0F3D rsctkelbU6jxemMhx8tFKzYcMFf0zOwLnV4TusgsFeq3eS0un49La3KiTdHq9E63+fHm 06eiwt/wQUzvshA1wBUfBB6W1ZTYy3eH+4OVhYsTgu3ypWDOJlW3EcaxcU7ANkq5YOSE nlbgc+TZPsL/R5EUZu3sUvsS/tzOpQciXYKB57D9Z7L/EhclZo8sjHwFXAEzYHP71HzC U02w== X-Gm-Message-State: AOJu0YxYL8zIZCjys65ck6UglKywkVOQE2LZDegZa84l6Y1QEusRftId lh2VcOffwIAX+1kLsdpH8vNlCR2Ng5YSret4670= X-Received: by 2002:a05:6a00:248d:b0:6b2:5992:9e89 with SMTP id c13-20020a056a00248d00b006b259929e89mr7517000pfv.9.1697954681529; Sat, 21 Oct 2023 23:04:41 -0700 (PDT) Received: from stoup.. ([71.212.149.95]) by smtp.gmail.com with ESMTPSA id fb13-20020a056a002d8d00b0068a46cd4120sm4007373pfb.199.2023.10.21.23.04.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 21 Oct 2023 23:04:41 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: mark.cave-ayland@ilande.co.uk Subject: [PATCH v4 47/90] target/sparc: Use tcg_gen_qemu_{ld, st}_i128 for GET_ASI_DTWINX Date: Sat, 21 Oct 2023 22:59:48 -0700 Message-Id: <20231022060031.490251-48-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231022060031.490251-1-richard.henderson@linaro.org> References: <20231022060031.490251-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::42b; envelope-from=richard.henderson@linaro.org; helo=mail-pf1-x42b.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 Perform one atomic 16-byte operation. The atomicity is required for the LDTXA instructions. Signed-off-by: Richard Henderson --- target/sparc/translate.c | 48 +++++++++++++++++++++++++++++++++------- 1 file changed, 40 insertions(+), 8 deletions(-) diff --git a/target/sparc/translate.c b/target/sparc/translate.c index dbadc860c3..f0284ac87b 100644 --- a/target/sparc/translate.c +++ b/target/sparc/translate.c @@ -2579,11 +2579,27 @@ static void gen_ldda_asi0(DisasContext *dc, DisasASI *da, TCGv addr, int rd) return; case GET_ASI_DTWINX: - assert(TARGET_LONG_BITS == 64); - tcg_gen_qemu_ld_tl(hi, addr, da->mem_idx, da->memop | MO_ALIGN_16); - tcg_gen_addi_tl(addr, addr, 8); - tcg_gen_qemu_ld_tl(lo, addr, da->mem_idx, da->memop); +#ifdef TARGET_SPARC64 + { + MemOp mop = (da->memop & MO_BSWAP) | MO_128 | MO_ALIGN_16; + TCGv_i128 t = tcg_temp_new_i128(); + + tcg_gen_qemu_ld_i128(t, addr, da->mem_idx, mop); + /* + * Note that LE twinx acts as if each 64-bit register result is + * byte swapped. We perform one 128-bit LE load, so must swap + * the order of the writebacks. + */ + if ((mop & MO_BSWAP) == MO_TE) { + tcg_gen_extr_i128_i64(lo, hi, t); + } else { + tcg_gen_extr_i128_i64(hi, lo, t); + } + } break; +#else + g_assert_not_reached(); +#endif case GET_ASI_DIRECT: { @@ -2648,11 +2664,27 @@ static void gen_stda_asi0(DisasContext *dc, DisasASI *da, TCGv addr, int rd) break; case GET_ASI_DTWINX: - assert(TARGET_LONG_BITS == 64); - tcg_gen_qemu_st_tl(hi, addr, da->mem_idx, da->memop | MO_ALIGN_16); - tcg_gen_addi_tl(addr, addr, 8); - tcg_gen_qemu_st_tl(lo, addr, da->mem_idx, da->memop); +#ifdef TARGET_SPARC64 + { + MemOp mop = (da->memop & MO_BSWAP) | MO_128 | MO_ALIGN_16; + TCGv_i128 t = tcg_temp_new_i128(); + + /* + * Note that LE twinx acts as if each 64-bit register result is + * byte swapped. We perform one 128-bit LE store, so must swap + * the order of the construction. + */ + if ((mop & MO_BSWAP) == MO_TE) { + tcg_gen_concat_i64_i128(t, lo, hi); + } else { + tcg_gen_concat_i64_i128(t, hi, lo); + } + tcg_gen_qemu_st_i128(t, addr, da->mem_idx, mop); + } break; +#else + g_assert_not_reached(); +#endif case GET_ASI_DIRECT: { From patchwork Sun Oct 22 05:59:49 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 736943 Delivered-To: patch@linaro.org Received: by 2002:adf:dd81:0:b0:32d:baff:b0ca with SMTP id x1csp1004091wrl; Sat, 21 Oct 2023 23:05:30 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEf0/CbLzk/9RVK96rnoEf0Q0KNFH0a1CsrQPN//tVcmMEaOx3Jm1Ix0OGPMP70MW87QASi X-Received: by 2002:a05:622a:2cd:b0:413:3384:d43f with SMTP id a13-20020a05622a02cd00b004133384d43fmr9200976qtx.11.1697954729911; Sat, 21 Oct 2023 23:05:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697954729; cv=none; d=google.com; s=arc-20160816; b=V2PEZbJfhBy3m8lGxtR4QGltT39f0+oeCpR/Z+pH7LAaKohPeD35TGFspega65pA4q HCMOaGgnWXyDQCnqV1SeKMhBjN0EuVOUOrsUiDy42GNkoamUBKSihVtQiKVE6zbgHZqe P6rql1vpHz1nYY4z00o1E6hWhZPbvu0V+YbxvAJS9NgTXTuOe6k+aAkOCX6gXZBDVlxC bbndlKbXGndisqKM5H9sgV7P9/fqpwvFJkD1Uf62bg76tJ4CSdocVWrT0+2cbjZDitS2 D+Z/paHfGkf6lMXTSg6txpAeiJCsLXjaxE9/wBHeGbxks843/9JwRrfIGQrZQhxXO43l DUhQ== 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=DDShXHFlkb/aGesg4pKF+3s03FjX72Kk5HSf1YXK7r0=; fh=TYrED6TOMxGX0VC4GtjviASLbYyJe19+7/tKWjN44KQ=; b=Kx4Q8bsVQ12GkRL6/3b5hcG1O4MkA+Rg9ea3qXueg+4h1RANGcenK4Nj3WVSzvw6al Sq5UFFXqCKGA1C+QNBCAar94XjwpZQFNLrFAE9foZym6RmK+R3amHaamD62FrjVAlatD 2Cjb+rCJy0gT03jaGlAKiNcjrgCV6UxJh/6f3hPR/Rk6I8nVbH84GewEXknjcpHsI1zu sDbLu1TFVjUjl2DF9LoLEYGc+uQYuHfwBGrk8NnqP/rZQ0hzSUcbBbjLkrzJJsT+KXVQ LCp1GRUg8JUBPjHM6zOoED3Q9v3Thdjmph7HxqjYcWsMBB748KobWb4TSSEtvzV7ahuF +gVA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=zGk9IuA4; 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 b18-20020a05622a021200b004122c43463asi3755831qtx.806.2023.10.21.23.05.29 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sat, 21 Oct 2023 23:05:29 -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=zGk9IuA4; 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 1quRa4-0000pk-H1; Sun, 22 Oct 2023 02:04:56 -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 1quRZx-0000KM-2K for qemu-devel@nongnu.org; Sun, 22 Oct 2023 02:04:49 -0400 Received: from mail-oo1-xc32.google.com ([2607:f8b0:4864:20::c32]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1quRZr-0002EQ-Pg for qemu-devel@nongnu.org; Sun, 22 Oct 2023 02:04:48 -0400 Received: by mail-oo1-xc32.google.com with SMTP id 006d021491bc7-58111e624bdso1430703eaf.3 for ; Sat, 21 Oct 2023 23:04:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1697954682; x=1698559482; 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=DDShXHFlkb/aGesg4pKF+3s03FjX72Kk5HSf1YXK7r0=; b=zGk9IuA4ff1UNtjdgJj2ZfXPpZGoFUplpFrLbFFf10HQVk1mWlS/d1rbiJgKrJU+o0 sY9MK25zriolF4RACcVZmJ/DUIJDLEtFryuR4qUnmvk0QlBdXh4v/QQyt4/r4oipeD3K wx2BsfPBHSoKi6HhplcPY/exsnObH4mbrUIvn2daQzZycixFTecycrHkVHA+W941RS7O hdBq5kB5+Wr9GAfWk49NWbexvgQknsw3rHQ04kP72Sj1ks14MiIDvq9SXfPMpsPO2gQg /E9cxULgThKA/+BwT1ll6ehcIMBKxHxCyDTWhv340wKMyGSaxxo+j5pyPQvtuPQ4KY+8 eLUA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697954682; x=1698559482; 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=DDShXHFlkb/aGesg4pKF+3s03FjX72Kk5HSf1YXK7r0=; b=stRLkp+LWUqFv9isqmVJ4i8WRdGPRwqwbW8YhF9pdm/xn9Oprc/STnCgutuYIhuuhs XYaG5TfG4MOy7bRJEKp5Lp8PlX4XwaSaCd6vKJ6YriiFHLhBUcusUG5Taw2LAvMVQw9K AbchXKSRcXuBApRPOhpdE1zqWBAw6P2wf01TtCvESt7kUbwifCCF0j2NoL3CZPwdY8GP DmI4cdF8n4TgSn8MnrzvsPRzKiyy/sctL5Z1B/5DrpqDrXKTMtbUEpSfBc66enzMjvzV sxuP40jHi9aDIYgEqIsimd4VrMDhM6MVKHQcePlqAZsWtAXh1fagvB9futWsg60mq5RH hbGA== X-Gm-Message-State: AOJu0YyViuIS7e/4wobYaTyD5BFcLyjfVgg20QkeKWQMhMHikEMXwv5m lIuCxQKw7zMZLF1u8ZhITr2PTCsYwtlFQIgV148= X-Received: by 2002:a05:6358:279c:b0:143:8984:4ffa with SMTP id l28-20020a056358279c00b0014389844ffamr7975981rwb.26.1697954682308; Sat, 21 Oct 2023 23:04:42 -0700 (PDT) Received: from stoup.. ([71.212.149.95]) by smtp.gmail.com with ESMTPSA id fb13-20020a056a002d8d00b0068a46cd4120sm4007373pfb.199.2023.10.21.23.04.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 21 Oct 2023 23:04:41 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: mark.cave-ayland@ilande.co.uk Subject: [PATCH v4 48/90] target/sparc: Move simple integer load/store to decodetree Date: Sat, 21 Oct 2023 22:59:49 -0700 Message-Id: <20231022060031.490251-49-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231022060031.490251-1-richard.henderson@linaro.org> References: <20231022060031.490251-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::c32; envelope-from=richard.henderson@linaro.org; helo=mail-oo1-xc32.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 Move LDUW, LDUB, LDUH, LDD, LDSW, LDSB, LDSH, LDX, STW, STB, STH, STD, STX. Signed-off-by: Richard Henderson --- target/sparc/insns.decode | 22 +++++ target/sparc/translate.c | 196 +++++++++++++++++++++++--------------- 2 files changed, 142 insertions(+), 76 deletions(-) diff --git a/target/sparc/insns.decode b/target/sparc/insns.decode index 137b7eb3c6..6197fbdb03 100644 --- a/target/sparc/insns.decode +++ b/target/sparc/insns.decode @@ -231,6 +231,28 @@ RESTORE 10 ..... 111101 ..... . ............. @r_r_ri DONE 10 00000 111110 00000 0 0000000000000 RETRY 10 00001 111110 00000 0 0000000000000 +## +## Major Opcode 11 -- load and store instructions +## + +&r_r_ri_asi rd rs1 rs2_or_imm asi imm:bool +@r_r_ri_na .. rd:5 ...... rs1:5 imm:1 rs2_or_imm:s13 &r_r_ri_asi asi=-1 + +LDUW 11 ..... 000000 ..... . ............. @r_r_ri_na +LDUB 11 ..... 000001 ..... . ............. @r_r_ri_na +LDUH 11 ..... 000010 ..... . ............. @r_r_ri_na +LDD 11 ..... 000011 ..... . ............. @r_r_ri_na +LDSW 11 ..... 001000 ..... . ............. @r_r_ri_na +LDSB 11 ..... 001001 ..... . ............. @r_r_ri_na +LDSH 11 ..... 001010 ..... . ............. @r_r_ri_na +LDX 11 ..... 001011 ..... . ............. @r_r_ri_na + +STW 11 ..... 000100 ..... . ............. @r_r_ri_na +STB 11 ..... 000101 ..... . ............. @r_r_ri_na +STH 11 ..... 000110 ..... . ............. @r_r_ri_na +STD 11 ..... 000111 ..... . ............. @r_r_ri_na +STX 11 ..... 001110 ..... . ............. @r_r_ri_na + NCP 10 ----- 110110 ----- --------- ----- # v8 CPop1 NCP 10 ----- 110111 ----- --------- ----- # v8 CPop2 diff --git a/target/sparc/translate.c b/target/sparc/translate.c index f0284ac87b..1f47a103f5 100644 --- a/target/sparc/translate.c +++ b/target/sparc/translate.c @@ -4689,6 +4689,117 @@ static bool trans_RETRY(DisasContext *dc, arg_RETRY *a) return true; } +/* + * Major opcode 11 -- load and store instructions + */ + +static TCGv gen_ldst_addr(DisasContext *dc, int rs1, bool imm, int rs2_or_imm) +{ + TCGv addr, tmp = NULL; + + /* For simplicity, we under-decoded the rs2 form. */ + if (!imm && rs2_or_imm & ~0x1f) { + return NULL; + } + + addr = gen_load_gpr(dc, rs1); + if (rs2_or_imm) { + tmp = tcg_temp_new(); + if (imm) { + tcg_gen_addi_tl(tmp, addr, rs2_or_imm); + } else { + tcg_gen_add_tl(tmp, addr, cpu_regs[rs2_or_imm]); + } + addr = tmp; + } + if (AM_CHECK(dc)) { + if (!tmp) { + tmp = tcg_temp_new(); + } + tcg_gen_ext32u_tl(tmp, addr); + addr = tmp; + } + return addr; +} + +static bool do_ld_gpr(DisasContext *dc, arg_r_r_ri_asi *a, MemOp mop) +{ + TCGv reg, addr = gen_ldst_addr(dc, a->rs1, a->imm, a->rs2_or_imm); + DisasASI da; + + if (addr == NULL) { + return false; + } + da = resolve_asi(dc, a->asi, mop); + + reg = gen_dest_gpr(dc, a->rd); + gen_ld_asi0(dc, &da, reg, addr); + gen_store_gpr(dc, a->rd, reg); + return advance_pc(dc); +} + +TRANS(LDUW, ALL, do_ld_gpr, a, MO_TEUL) +TRANS(LDUB, ALL, do_ld_gpr, a, MO_UB) +TRANS(LDUH, ALL, do_ld_gpr, a, MO_TEUW) +TRANS(LDSB, ALL, do_ld_gpr, a, MO_SB) +TRANS(LDSH, ALL, do_ld_gpr, a, MO_TESW) +TRANS(LDSW, 64, do_ld_gpr, a, MO_TESL) +TRANS(LDX, 64, do_ld_gpr, a, MO_TEUQ) + +static bool do_st_gpr(DisasContext *dc, arg_r_r_ri_asi *a, MemOp mop) +{ + TCGv reg, addr = gen_ldst_addr(dc, a->rs1, a->imm, a->rs2_or_imm); + DisasASI da; + + if (addr == NULL) { + return false; + } + da = resolve_asi(dc, a->asi, mop); + + reg = gen_load_gpr(dc, a->rd); + gen_st_asi0(dc, &da, reg, addr); + return advance_pc(dc); +} + +TRANS(STW, ALL, do_st_gpr, a, MO_TEUL) +TRANS(STB, ALL, do_st_gpr, a, MO_UB) +TRANS(STH, ALL, do_st_gpr, a, MO_TEUW) +TRANS(STX, 64, do_st_gpr, a, MO_TEUQ) + +static bool trans_LDD(DisasContext *dc, arg_r_r_ri_asi *a) +{ + TCGv addr; + DisasASI da; + + if (a->rd & 1) { + return false; + } + addr = gen_ldst_addr(dc, a->rs1, a->imm, a->rs2_or_imm); + if (addr == NULL) { + return false; + } + da = resolve_asi(dc, a->asi, MO_TEUQ); + gen_ldda_asi0(dc, &da, addr, a->rd); + return advance_pc(dc); +} + +static bool trans_STD(DisasContext *dc, arg_r_r_ri_asi *a) +{ + TCGv addr; + DisasASI da; + + if (a->rd & 1) { + return false; + } + addr = gen_ldst_addr(dc, a->rs1, a->imm, a->rs2_or_imm); + if (addr == NULL) { + return false; + } + da = resolve_asi(dc, a->asi, MO_TEUQ); + gen_stda_asi0(dc, &da, addr, a->rd); + return advance_pc(dc); +} + #define CHECK_IU_FEATURE(dc, FEATURE) \ if (!((dc)->def->features & CPU_FEATURE_ ## FEATURE)) \ goto illegal_insn; @@ -5512,47 +5623,15 @@ static void disas_sparc_legacy(DisasContext *dc, unsigned int insn) switch (xop) { case 0x0: /* ld, V9 lduw, load unsigned word */ - gen_address_mask(dc, cpu_addr); - tcg_gen_qemu_ld_tl(cpu_val, cpu_addr, - dc->mem_idx, MO_TEUL | MO_ALIGN); - break; case 0x1: /* ldub, load unsigned byte */ - gen_address_mask(dc, cpu_addr); - tcg_gen_qemu_ld_tl(cpu_val, cpu_addr, - dc->mem_idx, MO_UB); - break; case 0x2: /* lduh, load unsigned halfword */ - gen_address_mask(dc, cpu_addr); - tcg_gen_qemu_ld_tl(cpu_val, cpu_addr, - dc->mem_idx, MO_TEUW | MO_ALIGN); - break; case 0x3: /* ldd, load double word */ - if (rd & 1) - goto illegal_insn; - else { - TCGv_i64 t64; - - gen_address_mask(dc, cpu_addr); - t64 = tcg_temp_new_i64(); - tcg_gen_qemu_ld_i64(t64, cpu_addr, - dc->mem_idx, MO_TEUQ | MO_ALIGN); - tcg_gen_trunc_i64_tl(cpu_val, t64); - tcg_gen_ext32u_tl(cpu_val, cpu_val); - gen_store_gpr(dc, rd + 1, cpu_val); - tcg_gen_shri_i64(t64, t64, 32); - tcg_gen_trunc_i64_tl(cpu_val, t64); - tcg_gen_ext32u_tl(cpu_val, cpu_val); - } - break; case 0x9: /* ldsb, load signed byte */ - gen_address_mask(dc, cpu_addr); - tcg_gen_qemu_ld_tl(cpu_val, cpu_addr, dc->mem_idx, MO_SB); - break; case 0xa: /* ldsh, load signed halfword */ - gen_address_mask(dc, cpu_addr); - tcg_gen_qemu_ld_tl(cpu_val, cpu_addr, - dc->mem_idx, MO_TESW | MO_ALIGN); - break; + g_assert_not_reached(); /* in decodetree */ + case 0x08: /* V9 ldsw */ + case 0x0b: /* V9 ldx */ + goto illegal_insn; /* in decodetree */ case 0xd: /* ldstub */ gen_ldstub(dc, cpu_val, cpu_addr, dc->mem_idx); break; @@ -5594,16 +5673,6 @@ static void disas_sparc_legacy(DisasContext *dc, unsigned int insn) break; #endif #ifdef TARGET_SPARC64 - case 0x08: /* V9 ldsw */ - gen_address_mask(dc, cpu_addr); - tcg_gen_qemu_ld_tl(cpu_val, cpu_addr, - dc->mem_idx, MO_TESL | MO_ALIGN); - break; - case 0x0b: /* V9 ldx */ - gen_address_mask(dc, cpu_addr); - tcg_gen_qemu_ld_tl(cpu_val, cpu_addr, - dc->mem_idx, MO_TEUQ | MO_ALIGN); - break; case 0x18: /* V9 ldswa */ gen_ld_asi(dc, cpu_val, cpu_addr, insn, MO_TESL); break; @@ -5696,38 +5765,18 @@ static void disas_sparc_legacy(DisasContext *dc, unsigned int insn) } } else if (xop < 8 || (xop >= 0x14 && xop < 0x18) || xop == 0xe || xop == 0x1e) { +#if !defined(CONFIG_USER_ONLY) || defined(TARGET_SPARC64) TCGv cpu_val = gen_load_gpr(dc, rd); +#endif switch (xop) { case 0x4: /* st, store word */ - gen_address_mask(dc, cpu_addr); - tcg_gen_qemu_st_tl(cpu_val, cpu_addr, - dc->mem_idx, MO_TEUL | MO_ALIGN); - break; case 0x5: /* stb, store byte */ - gen_address_mask(dc, cpu_addr); - tcg_gen_qemu_st_tl(cpu_val, cpu_addr, dc->mem_idx, MO_UB); - break; case 0x6: /* sth, store halfword */ - gen_address_mask(dc, cpu_addr); - tcg_gen_qemu_st_tl(cpu_val, cpu_addr, - dc->mem_idx, MO_TEUW | MO_ALIGN); - break; case 0x7: /* std, store double word */ - if (rd & 1) - goto illegal_insn; - else { - TCGv_i64 t64; - TCGv lo; - - gen_address_mask(dc, cpu_addr); - lo = gen_load_gpr(dc, rd + 1); - t64 = tcg_temp_new_i64(); - tcg_gen_concat_tl_i64(t64, lo, cpu_val); - tcg_gen_qemu_st_i64(t64, cpu_addr, - dc->mem_idx, MO_TEUQ | MO_ALIGN); - } - break; + g_assert_not_reached(); /* in decodetree */ + case 0x0e: /* V9 stx */ + goto illegal_insn; /* in decodetree */ #if !defined(CONFIG_USER_ONLY) || defined(TARGET_SPARC64) case 0x14: /* sta, V9 stwa, store word alternate */ gen_st_asi(dc, cpu_val, cpu_addr, insn, MO_TEUL); @@ -5746,11 +5795,6 @@ static void disas_sparc_legacy(DisasContext *dc, unsigned int insn) break; #endif #ifdef TARGET_SPARC64 - case 0x0e: /* V9 stx */ - gen_address_mask(dc, cpu_addr); - tcg_gen_qemu_st_tl(cpu_val, cpu_addr, - dc->mem_idx, MO_TEUQ | MO_ALIGN); - break; case 0x1e: /* V9 stxa */ gen_st_asi(dc, cpu_val, cpu_addr, insn, MO_TEUQ); break; From patchwork Sun Oct 22 05:59:50 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 736974 Delivered-To: patch@linaro.org Received: by 2002:adf:dd81:0:b0:32d:baff:b0ca with SMTP id x1csp1006015wrl; Sat, 21 Oct 2023 23:13:28 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEa+nrCrWEMPlV29oJi3W6AihqxXXkqwU8qMxjt53CMRa/JkwS4HwQMYrczlCFfMwFZvdIq X-Received: by 2002:a05:6214:f01:b0:66d:37bc:bb91 with SMTP id gw1-20020a0562140f0100b0066d37bcbb91mr7749365qvb.56.1697955207781; Sat, 21 Oct 2023 23:13:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697955207; cv=none; d=google.com; s=arc-20160816; b=aiEYnH7f/zUJKB1xgiEZGNdEp0YbiwsW96L/01XS9IWT7mMpADzPyLZA9f/9rh9OAs TXclLRIgOFBbNjZoq4eAbQSn+uAoSS8GUObampVya9wkPkdnO1azk7Iz13Ohv43D4AIb tFp178044Dd+Suwa2ik2qea/4s7epUUZUhmwy/97RekN+ybEJtzSt2j0jpwYeaP2rDc9 jm7l/CS/LLTTl5exfytuJsOonpBEsOBfRU8zuJTAwvJwnCh2aw08IoK+mdlAYUDVZ1Hf 4FkItetHKh8ZZTPrF++bEQQjS+1G4mbFRVSRNfPyZdk4cE8+eWlWeAx9esMkufFy+OhV 6vsQ== 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=6iyjkQAZ0yvh9B7Vlq25HGxiDxblIfgbTHAoga1O+i4=; fh=TYrED6TOMxGX0VC4GtjviASLbYyJe19+7/tKWjN44KQ=; b=uNIDoswuO0RwK6b2S4neKSqsBrXuXuqT27MFhGRBqqa69RmeJafGUh+RIot9anI0wA fDv9BaBzWoB+1hxgKCytiE894tkusI5IoZqL6ZNo2fUDvK7rS4g+vIHbwtfMs73lFmgZ QJrBgJ/D5gB481FLEkRg/zdwKNCkyCC+6KED5KPctzOmFrk5hj+Vvd8y+iNbkwaA5NwP 9+SuhRDx7ePiaeCAFOVAsG1CF2OYGV+1gtu5qRLAE5CBMcDRpiPvj+/bYu58Ds5F1Gie vB+m0BwVE2T2dDoW52Z+U/yv7LlYM0KrU3eH3EmQ2Zl7CghSZXJj3TDpy9dz46+q9r6K M+Nw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="QD3c8QX/"; 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 ly6-20020a0562145c0600b0066cfe943369si3976299qvb.358.2023.10.21.23.13.27 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sat, 21 Oct 2023 23:13:27 -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="QD3c8QX/"; 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 1quRa0-0000UQ-HP; Sun, 22 Oct 2023 02:04:52 -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 1quRZx-0000Kh-58 for qemu-devel@nongnu.org; Sun, 22 Oct 2023 02:04:49 -0400 Received: from mail-pg1-x530.google.com ([2607:f8b0:4864:20::530]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1quRZs-0002Eb-LZ for qemu-devel@nongnu.org; Sun, 22 Oct 2023 02:04:48 -0400 Received: by mail-pg1-x530.google.com with SMTP id 41be03b00d2f7-565334377d0so1646273a12.2 for ; Sat, 21 Oct 2023 23:04:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1697954683; x=1698559483; 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=6iyjkQAZ0yvh9B7Vlq25HGxiDxblIfgbTHAoga1O+i4=; b=QD3c8QX/RWKYpZ0b93Y3Gh2mwh+RZ9+fLALdmpRwLwh6RrIZAiehNwh4g0eIsql38e s/RZMyiaKgWgMza+HEoBkvFVP//nhWGuHqTWiSc7JTe0As0qjZJQiELFlW5LlHYrL9TK W5eTq+n+Wax+Gs844DeV6BgHsSpXaQL3U6u+qySgxVpjnqfnN0As5eSsE6DhGVEHH+SY oCIiNEeGRvuBpnr6jOSyMofQZz1nke5gxd8tH++ZyUA9xeh7Vh94q9g5WznqxDlBp0Kb EhN2bgonAwq7bUGu1FX/dtGrxgNurcz/fUho8H1N63xB0JWGKwSqn54/0wFMpQayDHqF 3zaA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697954683; x=1698559483; 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=6iyjkQAZ0yvh9B7Vlq25HGxiDxblIfgbTHAoga1O+i4=; b=lM5TgsQtqmyK8im3l3yQhnFmMo13MtgKWgUHlb9S0IiQOJtJ6Skcz+dSwysB2XA5Aw ctUV4Ak3Y2f/dKluC6NT+6GeP3cP0rfFp3nc1K6BvnFRS1i/jyLj+KMvt/IkqSubfXEU EjvHojEAsVVkOAapOvHEO7s9GyPmlIzxu4kYF2uylfHvMAT5f30gB2Uu66Ar/eA1oBRs 44hgESHBzTrw8d9ZJFcDG/YxWKUdv9jgUD9PuWCg/ZMNzIEzXn6YmJntrEoo05bvaRuI nXq61q9Kvteu9G7a7sxoePL5TcmXP+CpbjHJOZB0nrgnimBIaagRfG8Z3eMHMm2+IBDf dTLg== X-Gm-Message-State: AOJu0YyHtDlA8pvTI9eoGgxaJsACXMqvhwMNf2bkFcJEIS9mXPtC3lBY oIRCARpg44G5PK6JMiS88vXKCgnpnbZhhIxBXig= X-Received: by 2002:a05:6a20:e596:b0:16b:d470:b403 with SMTP id ng22-20020a056a20e59600b0016bd470b403mr5407856pzb.28.1697954683081; Sat, 21 Oct 2023 23:04:43 -0700 (PDT) Received: from stoup.. ([71.212.149.95]) by smtp.gmail.com with ESMTPSA id fb13-20020a056a002d8d00b0068a46cd4120sm4007373pfb.199.2023.10.21.23.04.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 21 Oct 2023 23:04:42 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: mark.cave-ayland@ilande.co.uk Subject: [PATCH v4 49/90] target/sparc: Move asi integer load/store to decodetree Date: Sat, 21 Oct 2023 22:59:50 -0700 Message-Id: <20231022060031.490251-50-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231022060031.490251-1-richard.henderson@linaro.org> References: <20231022060031.490251-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::530; envelope-from=richard.henderson@linaro.org; helo=mail-pg1-x530.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 Move LDDA, LDSBA, LDSHA, LDSWA, LDUBA, LDUHA, LDUWA, LDXA, STBA, STDA, STHA, STWA, STXA. Signed-off-by: Richard Henderson --- target/sparc/insns.decode | 31 +++++++++ target/sparc/translate.c | 128 +++++--------------------------------- 2 files changed, 48 insertions(+), 111 deletions(-) diff --git a/target/sparc/insns.decode b/target/sparc/insns.decode index 6197fbdb03..280b19f033 100644 --- a/target/sparc/insns.decode +++ b/target/sparc/insns.decode @@ -237,6 +237,9 @@ RETRY 10 00001 111110 00000 0 0000000000000 &r_r_ri_asi rd rs1 rs2_or_imm asi imm:bool @r_r_ri_na .. rd:5 ...... rs1:5 imm:1 rs2_or_imm:s13 &r_r_ri_asi asi=-1 +@r_r_r_asi .. rd:5 ...... rs1:5 0 asi:8 rs2_or_imm:5 &r_r_ri_asi imm=0 +@r_r_i_asi .. rd:5 ...... rs1:5 1 rs2_or_imm:s13 \ + &r_r_ri_asi imm=1 asi=-2 LDUW 11 ..... 000000 ..... . ............. @r_r_ri_na LDUB 11 ..... 000001 ..... . ............. @r_r_ri_na @@ -253,6 +256,34 @@ STH 11 ..... 000110 ..... . ............. @r_r_ri_na STD 11 ..... 000111 ..... . ............. @r_r_ri_na STX 11 ..... 001110 ..... . ............. @r_r_ri_na +LDUW 11 ..... 010000 ..... . ............. @r_r_r_asi # LDUWA +LDUW 11 ..... 010000 ..... . ............. @r_r_i_asi # LDUWA +LDUB 11 ..... 010001 ..... . ............. @r_r_r_asi # LDUBA +LDUB 11 ..... 010001 ..... . ............. @r_r_i_asi # LDUBA +LDUH 11 ..... 010010 ..... . ............. @r_r_r_asi # LDUHA +LDUH 11 ..... 010010 ..... . ............. @r_r_i_asi # LDUHA +LDD 11 ..... 010011 ..... . ............. @r_r_r_asi # LDDA +LDD 11 ..... 010011 ..... . ............. @r_r_i_asi # LDDA +LDX 11 ..... 011011 ..... . ............. @r_r_r_asi # LDXA +LDX 11 ..... 011011 ..... . ............. @r_r_i_asi # LDXA +LDSB 11 ..... 011001 ..... . ............. @r_r_r_asi # LDSBA +LDSB 11 ..... 011001 ..... . ............. @r_r_i_asi # LDSBA +LDSH 11 ..... 011010 ..... . ............. @r_r_r_asi # LDSHA +LDSH 11 ..... 011010 ..... . ............. @r_r_i_asi # LDSHA +LDSW 11 ..... 011000 ..... . ............. @r_r_r_asi # LDSWA +LDSW 11 ..... 011000 ..... . ............. @r_r_i_asi # LDSWA + +STW 11 ..... 010100 ..... . ............. @r_r_r_asi # STWA +STW 11 ..... 010100 ..... . ............. @r_r_i_asi # STWA +STB 11 ..... 010101 ..... . ............. @r_r_r_asi # STBA +STB 11 ..... 010101 ..... . ............. @r_r_i_asi # STBA +STH 11 ..... 010110 ..... . ............. @r_r_r_asi # STHA +STH 11 ..... 010110 ..... . ............. @r_r_i_asi # STHA +STD 11 ..... 010111 ..... . ............. @r_r_r_asi # STDA +STD 11 ..... 010111 ..... . ............. @r_r_i_asi # STDA +STX 11 ..... 011110 ..... . ............. @r_r_r_asi # STXA +STX 11 ..... 011110 ..... . ............. @r_r_i_asi # STXA + NCP 10 ----- 110110 ----- --------- ----- # v8 CPop1 NCP 10 ----- 110111 ----- --------- ----- # v8 CPop2 diff --git a/target/sparc/translate.c b/target/sparc/translate.c index 1f47a103f5..7af95df66f 100644 --- a/target/sparc/translate.c +++ b/target/sparc/translate.c @@ -2147,7 +2147,7 @@ static DisasASI get_asi(DisasContext *dc, int insn, MemOp memop) return resolve_asi(dc, asi, memop); } -static void gen_ld_asi0(DisasContext *dc, DisasASI *da, TCGv dst, TCGv addr) +static void gen_ld_asi(DisasContext *dc, DisasASI *da, TCGv dst, TCGv addr) { switch (da->type) { case GET_ASI_EXCP: @@ -2178,16 +2178,7 @@ static void gen_ld_asi0(DisasContext *dc, DisasASI *da, TCGv dst, TCGv addr) } } -static void __attribute__((unused)) -gen_ld_asi(DisasContext *dc, TCGv dst, TCGv addr, int insn, MemOp memop) -{ - DisasASI da = get_asi(dc, insn, memop); - - gen_address_mask(dc, addr); - gen_ld_asi0(dc, &da, dst, addr); -} - -static void gen_st_asi0(DisasContext *dc, DisasASI *da, TCGv src, TCGv addr) +static void gen_st_asi(DisasContext *dc, DisasASI *da, TCGv src, TCGv addr) { switch (da->type) { case GET_ASI_EXCP: @@ -2259,15 +2250,6 @@ static void gen_st_asi0(DisasContext *dc, DisasASI *da, TCGv src, TCGv addr) } } -static void __attribute__((unused)) -gen_st_asi(DisasContext *dc, TCGv src, TCGv addr, int insn, MemOp memop) -{ - DisasASI da = get_asi(dc, insn, memop); - - gen_address_mask(dc, addr); - gen_st_asi0(dc, &da, src, addr); -} - static void gen_swap_asi0(DisasContext *dc, DisasASI *da, TCGv dst, TCGv src, TCGv addr) { @@ -2569,7 +2551,7 @@ gen_stf_asi(DisasContext *dc, TCGv addr, int insn, int size, int rd) } } -static void gen_ldda_asi0(DisasContext *dc, DisasASI *da, TCGv addr, int rd) +static void gen_ldda_asi(DisasContext *dc, DisasASI *da, TCGv addr, int rd) { TCGv hi = gen_dest_gpr(dc, rd); TCGv lo = gen_dest_gpr(dc, rd + 1); @@ -2645,16 +2627,7 @@ static void gen_ldda_asi0(DisasContext *dc, DisasASI *da, TCGv addr, int rd) gen_store_gpr(dc, rd + 1, lo); } -static void __attribute__((unused)) -gen_ldda_asi(DisasContext *dc, TCGv addr, int insn, int rd) -{ - DisasASI da = get_asi(dc, insn, MO_TEUQ); - - gen_address_mask(dc, addr); - gen_ldda_asi0(dc, &da, addr, rd); -} - -static void gen_stda_asi0(DisasContext *dc, DisasASI *da, TCGv addr, int rd) +static void gen_stda_asi(DisasContext *dc, DisasASI *da, TCGv addr, int rd) { TCGv hi = gen_load_gpr(dc, rd); TCGv lo = gen_load_gpr(dc, rd + 1); @@ -2746,15 +2719,6 @@ static void gen_stda_asi0(DisasContext *dc, DisasASI *da, TCGv addr, int rd) } } -static void __attribute__((unused)) -gen_stda_asi(DisasContext *dc, TCGv hi, TCGv addr, int insn, int rd) -{ - DisasASI da = get_asi(dc, insn, MO_TEUQ); - - gen_address_mask(dc, addr); - gen_stda_asi0(dc, &da, addr, rd); -} - static TCGv get_src1(DisasContext *dc, unsigned int insn) { unsigned int rs1 = GET_FIELD(insn, 13, 17); @@ -4733,7 +4697,7 @@ static bool do_ld_gpr(DisasContext *dc, arg_r_r_ri_asi *a, MemOp mop) da = resolve_asi(dc, a->asi, mop); reg = gen_dest_gpr(dc, a->rd); - gen_ld_asi0(dc, &da, reg, addr); + gen_ld_asi(dc, &da, reg, addr); gen_store_gpr(dc, a->rd, reg); return advance_pc(dc); } @@ -4757,7 +4721,7 @@ static bool do_st_gpr(DisasContext *dc, arg_r_r_ri_asi *a, MemOp mop) da = resolve_asi(dc, a->asi, mop); reg = gen_load_gpr(dc, a->rd); - gen_st_asi0(dc, &da, reg, addr); + gen_st_asi(dc, &da, reg, addr); return advance_pc(dc); } @@ -4779,7 +4743,7 @@ static bool trans_LDD(DisasContext *dc, arg_r_r_ri_asi *a) return false; } da = resolve_asi(dc, a->asi, MO_TEUQ); - gen_ldda_asi0(dc, &da, addr, a->rd); + gen_ldda_asi(dc, &da, addr, a->rd); return advance_pc(dc); } @@ -4796,7 +4760,7 @@ static bool trans_STD(DisasContext *dc, arg_r_r_ri_asi *a) return false; } da = resolve_asi(dc, a->asi, MO_TEUQ); - gen_stda_asi0(dc, &da, addr, a->rd); + gen_stda_asi(dc, &da, addr, a->rd); return advance_pc(dc); } @@ -5628,9 +5592,17 @@ static void disas_sparc_legacy(DisasContext *dc, unsigned int insn) case 0x3: /* ldd, load double word */ case 0x9: /* ldsb, load signed byte */ case 0xa: /* ldsh, load signed halfword */ + case 0x10: /* lda, V9 lduwa, load word alternate */ + case 0x11: /* lduba, load unsigned byte alternate */ + case 0x12: /* lduha, load unsigned halfword alternate */ + case 0x13: /* ldda, load double word alternate */ + case 0x19: /* ldsba, load signed byte alternate */ + case 0x1a: /* ldsha, load signed halfword alternate */ g_assert_not_reached(); /* in decodetree */ case 0x08: /* V9 ldsw */ case 0x0b: /* V9 ldx */ + case 0x18: /* V9 ldswa */ + case 0x1b: /* V9 ldxa */ goto illegal_insn; /* in decodetree */ case 0xd: /* ldstub */ gen_ldstub(dc, cpu_val, cpu_addr, dc->mem_idx); @@ -5642,27 +5614,6 @@ static void disas_sparc_legacy(DisasContext *dc, unsigned int insn) dc->mem_idx, MO_TEUL); break; #if !defined(CONFIG_USER_ONLY) || defined(TARGET_SPARC64) - case 0x10: /* lda, V9 lduwa, load word alternate */ - gen_ld_asi(dc, cpu_val, cpu_addr, insn, MO_TEUL); - break; - case 0x11: /* lduba, load unsigned byte alternate */ - gen_ld_asi(dc, cpu_val, cpu_addr, insn, MO_UB); - break; - case 0x12: /* lduha, load unsigned halfword alternate */ - gen_ld_asi(dc, cpu_val, cpu_addr, insn, MO_TEUW); - break; - case 0x13: /* ldda, load double word alternate */ - if (rd & 1) { - goto illegal_insn; - } - gen_ldda_asi(dc, cpu_addr, insn, rd); - goto skip_move; - case 0x19: /* ldsba, load signed byte alternate */ - gen_ld_asi(dc, cpu_val, cpu_addr, insn, MO_SB); - break; - case 0x1a: /* ldsha, load signed halfword alternate */ - gen_ld_asi(dc, cpu_val, cpu_addr, insn, MO_TESW); - break; case 0x1d: /* ldstuba -- XXX: should be atomically */ gen_ldstub_asi(dc, cpu_val, cpu_addr, insn); break; @@ -5673,12 +5624,6 @@ static void disas_sparc_legacy(DisasContext *dc, unsigned int insn) break; #endif #ifdef TARGET_SPARC64 - case 0x18: /* V9 ldswa */ - gen_ld_asi(dc, cpu_val, cpu_addr, insn, MO_TESL); - break; - case 0x1b: /* V9 ldxa */ - gen_ld_asi(dc, cpu_val, cpu_addr, insn, MO_TEUQ); - break; case 0x2d: /* V9 prefetch, no effect */ goto skip_move; case 0x30: /* V9 ldfa */ @@ -5710,7 +5655,7 @@ static void disas_sparc_legacy(DisasContext *dc, unsigned int insn) goto illegal_insn; } gen_store_gpr(dc, rd, cpu_val); -#if !defined(CONFIG_USER_ONLY) || defined(TARGET_SPARC64) +#if defined(TARGET_SPARC64) skip_move: ; #endif } else if (xop >= 0x20 && xop < 0x24) { @@ -5763,45 +5708,6 @@ static void disas_sparc_legacy(DisasContext *dc, unsigned int insn) default: goto illegal_insn; } - } else if (xop < 8 || (xop >= 0x14 && xop < 0x18) || - xop == 0xe || xop == 0x1e) { -#if !defined(CONFIG_USER_ONLY) || defined(TARGET_SPARC64) - TCGv cpu_val = gen_load_gpr(dc, rd); -#endif - - switch (xop) { - case 0x4: /* st, store word */ - case 0x5: /* stb, store byte */ - case 0x6: /* sth, store halfword */ - case 0x7: /* std, store double word */ - g_assert_not_reached(); /* in decodetree */ - case 0x0e: /* V9 stx */ - goto illegal_insn; /* in decodetree */ -#if !defined(CONFIG_USER_ONLY) || defined(TARGET_SPARC64) - case 0x14: /* sta, V9 stwa, store word alternate */ - gen_st_asi(dc, cpu_val, cpu_addr, insn, MO_TEUL); - break; - case 0x15: /* stba, store byte alternate */ - gen_st_asi(dc, cpu_val, cpu_addr, insn, MO_UB); - break; - case 0x16: /* stha, store halfword alternate */ - gen_st_asi(dc, cpu_val, cpu_addr, insn, MO_TEUW); - break; - case 0x17: /* stda, store double word alternate */ - if (rd & 1) { - goto illegal_insn; - } - gen_stda_asi(dc, cpu_val, cpu_addr, insn, rd); - break; -#endif -#ifdef TARGET_SPARC64 - case 0x1e: /* V9 stxa */ - gen_st_asi(dc, cpu_val, cpu_addr, insn, MO_TEUQ); - break; -#endif - default: - goto illegal_insn; - } } else if (xop > 0x23 && xop < 0x28) { if (gen_trap_ifnofpu(dc)) { goto jmp_insn; From patchwork Sun Oct 22 05:59:51 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 736995 Delivered-To: patch@linaro.org Received: by 2002:adf:dd81:0:b0:32d:baff:b0ca with SMTP id x1csp1006283wrl; Sat, 21 Oct 2023 23:14:34 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGrwImH9oOXy4t+TbtvkjnK1NnvMBCX40TpdjddQxRFMJil+t/+8dRnDbMfCLNr8/DXpgSc X-Received: by 2002:a05:6214:2121:b0:66d:35b8:e661 with SMTP id r1-20020a056214212100b0066d35b8e661mr7961113qvc.45.1697955274475; Sat, 21 Oct 2023 23:14:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697955274; cv=none; d=google.com; s=arc-20160816; b=lF+NxdoBNAnJrRgoxCZFPjOPRVkfn4UQYQdfnf8QKzJl1DXxqItj+aRC0J0R6qWr2l T4RQA6keZFDz83c8jf247YdgwDo9ibdlQX91w9A2C2YTBmmFhF1dXlteco/Ruauwt7hl rSWwDkzavq6hqLC0ubANjDrGjUu3pinoXW7OhGjor3pt55uM8hu0T6CSUJEFv+hqJlbX Wqr7PC1f4fs4AoPXdUgVknmgMWMae/DxOBNuan0LpMWLsvMcybvAA55ASkEDcpLLt2ap UU0qTb/vZ6bX6ZvUoC6m7EUMhk90hCJPkwG2K19672jOkKEsgG6lxu0ITmMyZZefeEiY srJg== 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=mP6+VlPNB//yP5a6QZd7OLrJPFY+aQa3GFEyeJdT0uQ=; fh=TYrED6TOMxGX0VC4GtjviASLbYyJe19+7/tKWjN44KQ=; b=vdB0yjqPntpW5iirZLR2ILsbAHVTeSBdRaaUf3PXXWlTZWNjrys7KnzcLhlyRO7k8k 6YfIPNsH3doSNIn5p/WsOXdC0lkyfNveckqUdwX0Uck5t7aBoZHP0ZeaP/yUq3ctGNJF aJ5zZd2shVJZ03F+cgHvmp777lgfNEtISvSNcvYtVo8zN9aIsK15jq2lpx+rgnceT2rh ivSVJ5p7mN0HE9VfxVl7er7Rf8zCMinDHdXqaDFh+ErXQO5zU29dM+lQerlhZ4a8Ap+G CjPxqh/84HAH0UDl3aH/qyc5EScCPhGthiRk1joqN7+67ShpXjukU23UeS1BPBNsK8YT /aew== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="sEx/7C9h"; 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 e13-20020ad4418d000000b0064711f7b6cesi3649238qvp.603.2023.10.21.23.14.34 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sat, 21 Oct 2023 23:14:34 -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="sEx/7C9h"; 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 1quRaL-0002Js-RV; Sun, 22 Oct 2023 02:05:13 -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 1quRa0-0000UV-85 for qemu-devel@nongnu.org; Sun, 22 Oct 2023 02:04:52 -0400 Received: from mail-oo1-xc2a.google.com ([2607:f8b0:4864:20::c2a]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1quRZt-0002Et-Ea for qemu-devel@nongnu.org; Sun, 22 Oct 2023 02:04:51 -0400 Received: by mail-oo1-xc2a.google.com with SMTP id 006d021491bc7-5844bc378feso381397eaf.0 for ; Sat, 21 Oct 2023 23:04:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1697954684; x=1698559484; 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=mP6+VlPNB//yP5a6QZd7OLrJPFY+aQa3GFEyeJdT0uQ=; b=sEx/7C9hZ2Cv2+03hCSp3rPY8HZfUHwAVeHSE4PJK6BHwXoJSulhre6H1fabfILTWG ROoDieoyoJG0MUTMQPfH8TVUKha0EpIYEw2lf3tp1Z39D/pr4gDpCEpyuXcoCwccPQhf IoTpqQzeRy9VBk7vIBTFOHkBt9ynEMHCMhghl/mVSNFY9+JDR4b8kZLt2MYQkYgEAB6L fAmO1py41UBr9mltcVV3d/e9/cejIu9j6Qp1dLpXc63D8jpvTNAGHdDL4LrRrIz8COj7 bmx81F9V1QtLLlMu+Mxz2wpnR41Y9OQ7GM2WBHpLrD5SGYsmzs96Dd36f3uU0FbiwKvI Gk9Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697954684; x=1698559484; 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=mP6+VlPNB//yP5a6QZd7OLrJPFY+aQa3GFEyeJdT0uQ=; b=SVbz5DPYm/F554Qld3OS+Vi48vGQJ2ieDnz1CFyD8pcnfWY4ELBHjPdYBV6A8PA0tP cAcM+6y6/735uC/2HJtd9fhgF3GW9ppJf/OdcfbxoBLF1dbrAOf3jb4ZujvPkP2MbIcB lbAXd1lx4sjXncDHwaxP9qZnRwyGYheVyoDmcXhv7Kg3j7pLLi7wRXSJVIxws2Rq1v+w r+kU7KR761gmZOLTyCBZEU5One0MpdSG6zYbMMuxMwH7VrECyGw8+L17BUHT6GNYJsdM Lik/1LgF5e3WEfWCKXkbClIXGSUHrIKhIBzFPwb/xln9sCO4SNyIg5FUWldJ6CZ0LPPi 4zsA== X-Gm-Message-State: AOJu0Yw35TwkVc0gLpK4ZzL1QokPhLTBG/MyyKQyB3pzrC8UN6UUP5PA nDv73g2IM402laXOz8DRScitoMEc5TuPG8yia/U= X-Received: by 2002:a05:6358:418d:b0:14f:736b:7745 with SMTP id w13-20020a056358418d00b0014f736b7745mr7227055rwc.31.1697954683837; Sat, 21 Oct 2023 23:04:43 -0700 (PDT) Received: from stoup.. ([71.212.149.95]) by smtp.gmail.com with ESMTPSA id fb13-20020a056a002d8d00b0068a46cd4120sm4007373pfb.199.2023.10.21.23.04.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 21 Oct 2023 23:04:43 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: mark.cave-ayland@ilande.co.uk Subject: [PATCH v4 50/90] target/sparc: Move LDSTUB, LDSTUBA to decodetree Date: Sat, 21 Oct 2023 22:59:51 -0700 Message-Id: <20231022060031.490251-51-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231022060031.490251-1-richard.henderson@linaro.org> References: <20231022060031.490251-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::c2a; envelope-from=richard.henderson@linaro.org; helo=mail-oo1-xc2a.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 Remove gen_ldstub_asi. Rename gen_ldstub_asi0 to gen_ldstub_asi. Merge gen_ldstub into gen_ldstub_asi. Signed-off-by: Richard Henderson --- target/sparc/insns.decode | 4 ++++ target/sparc/translate.c | 46 +++++++++++++++++++-------------------- 2 files changed, 26 insertions(+), 24 deletions(-) diff --git a/target/sparc/insns.decode b/target/sparc/insns.decode index 280b19f033..2f950000b5 100644 --- a/target/sparc/insns.decode +++ b/target/sparc/insns.decode @@ -284,6 +284,10 @@ STD 11 ..... 010111 ..... . ............. @r_r_i_asi # STDA STX 11 ..... 011110 ..... . ............. @r_r_r_asi # STXA STX 11 ..... 011110 ..... . ............. @r_r_i_asi # STXA +LDSTUB 11 ..... 001101 ..... . ............. @r_r_ri_na +LDSTUB 11 ..... 011101 ..... . ............. @r_r_r_asi # LDSTUBA +LDSTUB 11 ..... 011101 ..... . ............. @r_r_i_asi # LDSTUBA + NCP 10 ----- 110110 ----- --------- ----- # v8 CPop1 NCP 10 ----- 110111 ----- --------- ----- # v8 CPop2 diff --git a/target/sparc/translate.c b/target/sparc/translate.c index 7af95df66f..cba453e5ff 100644 --- a/target/sparc/translate.c +++ b/target/sparc/translate.c @@ -1891,13 +1891,6 @@ static void gen_swap(DisasContext *dc, TCGv dst, TCGv src, tcg_gen_atomic_xchg_tl(dst, addr, src, mmu_idx, memop | MO_ALIGN); } -static void gen_ldstub(DisasContext *dc, TCGv dst, TCGv addr, int mmu_idx) -{ - TCGv m1 = tcg_constant_tl(0xff); - gen_address_mask(dc, addr); - tcg_gen_atomic_xchg_tl(dst, addr, m1, mmu_idx, MO_UB); -} - /* asi moves */ typedef enum { GET_ASI_HELPER, @@ -2316,13 +2309,14 @@ gen_casx_asi(DisasContext *dc, TCGv addr, TCGv cmpv, int insn, int rd) gen_store_gpr(dc, rd, oldv); } -static void gen_ldstub_asi0(DisasContext *dc, DisasASI *da, TCGv dst, TCGv addr) +static void gen_ldstub_asi(DisasContext *dc, DisasASI *da, TCGv dst, TCGv addr) { switch (da->type) { case GET_ASI_EXCP: break; case GET_ASI_DIRECT: - gen_ldstub(dc, dst, addr, da->mem_idx); + tcg_gen_atomic_xchg_tl(dst, addr, tcg_constant_tl(0xff), + da->mem_idx, MO_UB); break; default: /* ??? In theory, this should be raise DAE_invalid_asi. @@ -2350,15 +2344,6 @@ static void gen_ldstub_asi0(DisasContext *dc, DisasASI *da, TCGv dst, TCGv addr) } } -static void __attribute__((unused)) -gen_ldstub_asi(DisasContext *dc, TCGv dst, TCGv addr, int insn) -{ - DisasASI da = get_asi(dc, insn, MO_UB); - - gen_address_mask(dc, addr); - gen_ldstub_asi0(dc, &da, dst, addr); -} - static void __attribute__((unused)) gen_ldf_asi(DisasContext *dc, TCGv addr, int insn, int size, int rd) { @@ -4764,6 +4749,23 @@ static bool trans_STD(DisasContext *dc, arg_r_r_ri_asi *a) return advance_pc(dc); } +static bool trans_LDSTUB(DisasContext *dc, arg_r_r_ri_asi *a) +{ + TCGv addr, reg; + DisasASI da; + + addr = gen_ldst_addr(dc, a->rs1, a->imm, a->rs2_or_imm); + if (addr == NULL) { + return false; + } + da = resolve_asi(dc, a->asi, MO_UB); + + reg = gen_dest_gpr(dc, a->rd); + gen_ldstub_asi(dc, &da, reg, addr); + gen_store_gpr(dc, a->rd, reg); + return advance_pc(dc); +} + #define CHECK_IU_FEATURE(dc, FEATURE) \ if (!((dc)->def->features & CPU_FEATURE_ ## FEATURE)) \ goto illegal_insn; @@ -5592,21 +5594,20 @@ static void disas_sparc_legacy(DisasContext *dc, unsigned int insn) case 0x3: /* ldd, load double word */ case 0x9: /* ldsb, load signed byte */ case 0xa: /* ldsh, load signed halfword */ + case 0xd: /* ldstub */ case 0x10: /* lda, V9 lduwa, load word alternate */ case 0x11: /* lduba, load unsigned byte alternate */ case 0x12: /* lduha, load unsigned halfword alternate */ case 0x13: /* ldda, load double word alternate */ case 0x19: /* ldsba, load signed byte alternate */ case 0x1a: /* ldsha, load signed halfword alternate */ + case 0x1d: /* ldstuba */ g_assert_not_reached(); /* in decodetree */ case 0x08: /* V9 ldsw */ case 0x0b: /* V9 ldx */ case 0x18: /* V9 ldswa */ case 0x1b: /* V9 ldxa */ goto illegal_insn; /* in decodetree */ - case 0xd: /* ldstub */ - gen_ldstub(dc, cpu_val, cpu_addr, dc->mem_idx); - break; case 0x0f: /* swap, swap register with memory. Also atomically */ cpu_src1 = gen_load_gpr(dc, rd); @@ -5614,9 +5615,6 @@ static void disas_sparc_legacy(DisasContext *dc, unsigned int insn) dc->mem_idx, MO_TEUL); break; #if !defined(CONFIG_USER_ONLY) || defined(TARGET_SPARC64) - case 0x1d: /* ldstuba -- XXX: should be atomically */ - gen_ldstub_asi(dc, cpu_val, cpu_addr, insn); - break; case 0x1f: /* swapa, swap reg with alt. memory. Also atomically */ cpu_src1 = gen_load_gpr(dc, rd); From patchwork Sun Oct 22 05:59:52 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 737004 Delivered-To: patch@linaro.org Received: by 2002:adf:dd81:0:b0:32d:baff:b0ca with SMTP id x1csp1006597wrl; Sat, 21 Oct 2023 23:15:57 -0700 (PDT) X-Google-Smtp-Source: AGHT+IH55BiaV32rPPQQWo/q0JRP3BD6jtTATvsr6IHtRBRR10OMyqIK5NTfdRwLT58D71dMuV8R X-Received: by 2002:a05:622a:1653:b0:410:ab6d:54da with SMTP id y19-20020a05622a165300b00410ab6d54damr7520991qtj.16.1697955357163; Sat, 21 Oct 2023 23:15:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697955357; cv=none; d=google.com; s=arc-20160816; b=omcSRjqi6bIJPE/w5eyn8Sxgczh2E7vuBiltRW26AIri9vlnbMZdnO4YNneCd6C8Qc ABBV6Fe1kgolB14vxLQbj2ls+5CtUed6ecQVdM6IBiiRWaZqfB11W5oebvPjpcn8dHDq 2DZeAGJTucrEsTdJ7Ahtq8akRoAGuMUa6O0TqQGf4IbDvwI10ysvJTCd1C1lb4F9w+ks ymCA+90oDSsIUXpAZQJlR/fos2IzHX9IPECkIALiCPBZbnOnzSr2786OKsLo8UwAoS4X i7A8tOaexuUJHvdYNjYxxIdIu6wHIG5B1uz48eZRxg2OoDMCJD7iqfNJoyvvfRe9aZPD hXFw== 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=JgafbUxzPcRrNpMg2DdW/+ZW+itPO8ApXYi0Ba+fYVM=; fh=TYrED6TOMxGX0VC4GtjviASLbYyJe19+7/tKWjN44KQ=; b=K4Ox7W+w7RIzRwRycViM9PKKFZYZkEt4DVaQ9hwvWt5J6X6gJmmwdNKxf6TdV1+N6S VmQssQUmrvlVYw2e3q6tFv1d7oZaRkN5b1gIvXMxlGUF/UjR72cwzGppBS2K3M4sH/w4 4xf8WQ16hRZzmkcLEM0OnSodjV9iHwiXRCtoU/jnio4FSCMyMMT7qKmTzVbM70Qw5bA2 WmYDzDXotGzgtxVLMpk7l2HTj75q3q4qXWxxhlRPH5g/DKINDFD78s5CdtP+oB7kTVl/ BL8Euym6JEcxnoHwMryuMLcomyYWln0TIFopoq9tzhFlArqK9XwF6BMqZsK1eNE/RwHz KWTw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=hTfrPgCN; 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 v36-20020a05622a18a400b0040fe864c812si3748402qtc.10.2023.10.21.23.15.57 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sat, 21 Oct 2023 23:15:57 -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=hTfrPgCN; 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 1quRa6-0000s8-Bo; Sun, 22 Oct 2023 02:04:58 -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 1quRa0-0000UW-83 for qemu-devel@nongnu.org; Sun, 22 Oct 2023 02:04:52 -0400 Received: from mail-oo1-xc2e.google.com ([2607:f8b0:4864:20::c2e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1quRZu-0002F6-PI for qemu-devel@nongnu.org; Sun, 22 Oct 2023 02:04:51 -0400 Received: by mail-oo1-xc2e.google.com with SMTP id 006d021491bc7-5842c251d7cso1003527eaf.1 for ; Sat, 21 Oct 2023 23:04:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1697954685; x=1698559485; 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=JgafbUxzPcRrNpMg2DdW/+ZW+itPO8ApXYi0Ba+fYVM=; b=hTfrPgCN0X50zKZwTY5v81YKYm02zSbssqMtGwyC5Gzbgn+UE3hEjXu+kRb1ZoopFR e/Qvuc+QY5XUCVLgor7tZa2JLua/ClVctSEQ7soZRUJVGiDHOir/owgprEeAo9H0oBiS AMXpytVjorOEJycrGiFLFjeStlF/rTlhE0xbtiiRzVSE3xuLga4rOmzOYAGjRMeWe/1S Rr8w1V4hOTLi6oGcxo9Coj4KPHV6zcimSRKDZwQWVNLEAPBLBB3rUPeYgXLDDbutCufv 6nrmBhOYVQ2p/fWxSLRdp6fcaeDrD8Pw/KnbhkQh1Jrbgmo+i2GKCY6jT9jndfNbw4qK avmQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697954685; x=1698559485; 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=JgafbUxzPcRrNpMg2DdW/+ZW+itPO8ApXYi0Ba+fYVM=; b=arW05ZOfE2dZ/TAe4e7q8JIbS2cbdpPqvH4Mu578L2rLUZjKZSHBotpLIotOmv8VWi NwjW2zpqNxMHp8e+Rg8k6xAl4rnjL+j1emfSOVaaFfWBv2jIeJq0r8NIJkvOZvbDlPU3 +XeZI0JHKs7gOU1zTZQ1ZSNgAyB7660UWbazMUJ1ckOHhUyvi4NwX1P7ctTiuM5X/yEs skcx07qC4zV4z+n7qwvGfcTNvm9nAZOjcbLj+S6J13K2dCLsjs4yDrq6VyD8vnRQVpqZ Noj6waktKFyLFXSpbazsU+8Dzsa0M6/2QF+6VUBaDs5hEcRJtsweX1tBR0Fy2I3d0CtY ChIw== X-Gm-Message-State: AOJu0YzEULI+PENHasXseWJkyh65njZZ7VD9EyCTdZnXwhHQr6dEJVye +qXcHq0Vsqg0h0S0ijBlIjNuf7lLuXi+NjUOg9w= X-Received: by 2002:a05:6358:4311:b0:143:61d:ffd3 with SMTP id r17-20020a056358431100b00143061dffd3mr5475098rwc.4.1697954684676; Sat, 21 Oct 2023 23:04:44 -0700 (PDT) Received: from stoup.. ([71.212.149.95]) by smtp.gmail.com with ESMTPSA id fb13-20020a056a002d8d00b0068a46cd4120sm4007373pfb.199.2023.10.21.23.04.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 21 Oct 2023 23:04:44 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: mark.cave-ayland@ilande.co.uk Subject: [PATCH v4 51/90] target/sparc: Move SWAP, SWAPA to decodetree Date: Sat, 21 Oct 2023 22:59:52 -0700 Message-Id: <20231022060031.490251-52-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231022060031.490251-1-richard.henderson@linaro.org> References: <20231022060031.490251-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::c2e; envelope-from=richard.henderson@linaro.org; helo=mail-oo1-xc2e.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 Remove gen_swap_asi. Rename gen_swap_asi0 to gen_swap_asi. Merge gen_swap into gen_swap_asi. Signed-off-by: Richard Henderson --- target/sparc/insns.decode | 4 +++ target/sparc/translate.c | 58 +++++++++++++++++---------------------- 2 files changed, 29 insertions(+), 33 deletions(-) diff --git a/target/sparc/insns.decode b/target/sparc/insns.decode index 2f950000b5..9c4597317c 100644 --- a/target/sparc/insns.decode +++ b/target/sparc/insns.decode @@ -288,6 +288,10 @@ LDSTUB 11 ..... 001101 ..... . ............. @r_r_ri_na LDSTUB 11 ..... 011101 ..... . ............. @r_r_r_asi # LDSTUBA LDSTUB 11 ..... 011101 ..... . ............. @r_r_i_asi # LDSTUBA +SWAP 11 ..... 001111 ..... . ............. @r_r_ri_na +SWAP 11 ..... 011111 ..... . ............. @r_r_r_asi # SWAPA +SWAP 11 ..... 011111 ..... . ............. @r_r_i_asi # SWAPA + NCP 10 ----- 110110 ----- --------- ----- # v8 CPop1 NCP 10 ----- 110111 ----- --------- ----- # v8 CPop2 diff --git a/target/sparc/translate.c b/target/sparc/translate.c index cba453e5ff..4a42acafd9 100644 --- a/target/sparc/translate.c +++ b/target/sparc/translate.c @@ -1884,13 +1884,6 @@ static void gen_ne_fop_QD(DisasContext *dc, int rd, int rs, gen_update_fprs_dirty(dc, QFPREG(rd)); } -static void gen_swap(DisasContext *dc, TCGv dst, TCGv src, - TCGv addr, int mmu_idx, MemOp memop) -{ - gen_address_mask(dc, addr); - tcg_gen_atomic_xchg_tl(dst, addr, src, mmu_idx, memop | MO_ALIGN); -} - /* asi moves */ typedef enum { GET_ASI_HELPER, @@ -2243,14 +2236,15 @@ static void gen_st_asi(DisasContext *dc, DisasASI *da, TCGv src, TCGv addr) } } -static void gen_swap_asi0(DisasContext *dc, DisasASI *da, - TCGv dst, TCGv src, TCGv addr) +static void gen_swap_asi(DisasContext *dc, DisasASI *da, + TCGv dst, TCGv src, TCGv addr) { switch (da->type) { case GET_ASI_EXCP: break; case GET_ASI_DIRECT: - gen_swap(dc, dst, src, addr, da->mem_idx, da->memop); + tcg_gen_atomic_xchg_tl(dst, addr, src, + da->mem_idx, da->memop | MO_ALIGN); break; default: /* ??? Should be DAE_invalid_asi. */ @@ -2259,15 +2253,6 @@ static void gen_swap_asi0(DisasContext *dc, DisasASI *da, } } -static void __attribute__((unused)) -gen_swap_asi(DisasContext *dc, TCGv dst, TCGv src, TCGv addr, int insn) -{ - DisasASI da = get_asi(dc, insn, MO_TEUL); - - gen_address_mask(dc, addr); - gen_swap_asi0(dc, &da, dst, src, addr); -} - static void gen_cas_asi0(DisasContext *dc, DisasASI *da, TCGv oldv, TCGv newv, TCGv cmpv, TCGv addr) { @@ -4766,6 +4751,24 @@ static bool trans_LDSTUB(DisasContext *dc, arg_r_r_ri_asi *a) return advance_pc(dc); } +static bool trans_SWAP(DisasContext *dc, arg_r_r_ri_asi *a) +{ + TCGv addr, dst, src; + DisasASI da; + + addr = gen_ldst_addr(dc, a->rs1, a->imm, a->rs2_or_imm); + if (addr == NULL) { + return false; + } + da = resolve_asi(dc, a->asi, MO_TEUL); + + dst = gen_dest_gpr(dc, a->rd); + src = gen_load_gpr(dc, a->rd); + gen_swap_asi(dc, &da, dst, src, addr); + gen_store_gpr(dc, a->rd, dst); + return advance_pc(dc); +} + #define CHECK_IU_FEATURE(dc, FEATURE) \ if (!((dc)->def->features & CPU_FEATURE_ ## FEATURE)) \ goto illegal_insn; @@ -4777,7 +4780,7 @@ static bool trans_LDSTUB(DisasContext *dc, arg_r_r_ri_asi *a) static void disas_sparc_legacy(DisasContext *dc, unsigned int insn) { unsigned int opc, rs1, rs2, rd; - TCGv cpu_src1; + TCGv cpu_src1 __attribute__((unused)); 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; @@ -5595,6 +5598,7 @@ static void disas_sparc_legacy(DisasContext *dc, unsigned int insn) case 0x9: /* ldsb, load signed byte */ case 0xa: /* ldsh, load signed halfword */ case 0xd: /* ldstub */ + case 0x0f: /* swap */ case 0x10: /* lda, V9 lduwa, load word alternate */ case 0x11: /* lduba, load unsigned byte alternate */ case 0x12: /* lduha, load unsigned halfword alternate */ @@ -5602,25 +5606,13 @@ static void disas_sparc_legacy(DisasContext *dc, unsigned int insn) case 0x19: /* ldsba, load signed byte alternate */ case 0x1a: /* ldsha, load signed halfword alternate */ case 0x1d: /* ldstuba */ + case 0x1f: /* swapa */ g_assert_not_reached(); /* in decodetree */ case 0x08: /* V9 ldsw */ case 0x0b: /* V9 ldx */ case 0x18: /* V9 ldswa */ case 0x1b: /* V9 ldxa */ goto illegal_insn; /* in decodetree */ - case 0x0f: - /* swap, swap register with memory. Also atomically */ - cpu_src1 = gen_load_gpr(dc, rd); - gen_swap(dc, cpu_val, cpu_src1, cpu_addr, - dc->mem_idx, MO_TEUL); - break; -#if !defined(CONFIG_USER_ONLY) || defined(TARGET_SPARC64) - case 0x1f: /* swapa, swap reg with alt. memory. Also - atomically */ - cpu_src1 = gen_load_gpr(dc, rd); - gen_swap_asi(dc, cpu_val, cpu_src1, cpu_addr, insn); - break; -#endif #ifdef TARGET_SPARC64 case 0x2d: /* V9 prefetch, no effect */ goto skip_move; From patchwork Sun Oct 22 05:59:53 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 737010 Delivered-To: patch@linaro.org Received: by 2002:adf:dd81:0:b0:32d:baff:b0ca with SMTP id x1csp1006752wrl; Sat, 21 Oct 2023 23:16:35 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGoqtYfw/wsNKpTrHXjHocfZEvQyYUF+8tD7zGQhmRbEuTtf/GUHxqT0BcviQfbbF589X4A X-Received: by 2002:a05:620a:2a15:b0:775:ce76:4840 with SMTP id o21-20020a05620a2a1500b00775ce764840mr12953609qkp.7.1697955395602; Sat, 21 Oct 2023 23:16:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697955395; cv=none; d=google.com; s=arc-20160816; b=GfVPO/GVo23GvfQrMZ7xcuOmOhQJi/9cnHCADpj+6Nnh4vFGUmTCQ2stn+uAx6SWG4 XQbhc83iUkxbjV86Kdpiro0uGN8ekVSuxEpt0Arr4s09zEgwBKmUVgghjo3XiXKcwKC5 AkLs0gfd7Xl37al3d1KWHU7TYBZm2ih3uwTrIiDbRqDL0PPlW1YKPgkG17ZTf8J6maU/ 3PCY6s9Wa8wBwJxQrkz3k2qdcvA7a5cRsADd280t1FJT9xsnGlQ6plX3VZSySjMBDqSd Q4uIXaDNH0kpWq44TcRnDsxEQcz0qjjd4ciJ+oqOgqJO8yj4F6RVMUvO3doV39v+LfKf i3sA== 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=+Or2gtRGec4B/FJVTj/3PoJs8Ws9mqR+t3l35TgK5yM=; fh=TYrED6TOMxGX0VC4GtjviASLbYyJe19+7/tKWjN44KQ=; b=gkNvycpjx6OpwuuGTWBg/YuHDD2cxD7kbk8JavOiPThFNjcM7DuTXU80smpmMty9cd as5yykg7EQgZ138vLdOqztgBxmSsxPfSGLJDdhDQ39W5s5E40nXnueHdmrnK+g7wB3o3 idhPM4Xfd8hb4iCB/QZx78sjH3yQI/EaeumL1EJH6E4KBlNDrtq1RDDLh9tr1vltymGe OiRIMYShVJHsioR0Flkztf7BJ6v4iG5b4LzRoHoqQb02Si0isGM+MCE84esVkEJMZpQP 9UVSotFQGSOgNOK/0ZaCldE+v8tbfCNtIiTU7WikDF8nxTNoVVblJ8P45Vo6YETUalCV L8cg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=i5i8ftQU; 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 ev2-20020a0562140a8200b006589ed189c5si3742037qvb.5.2023.10.21.23.16.35 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sat, 21 Oct 2023 23:16:35 -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=i5i8ftQU; 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 1quRaT-0002tj-3v; Sun, 22 Oct 2023 02:05:22 -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 1quRa4-0000pj-AJ for qemu-devel@nongnu.org; Sun, 22 Oct 2023 02:04:56 -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 1quRZw-0002FE-Kq for qemu-devel@nongnu.org; Sun, 22 Oct 2023 02:04:52 -0400 Received: by mail-pf1-x433.google.com with SMTP id d2e1a72fcca58-6bd73395bceso1615914b3a.0 for ; Sat, 21 Oct 2023 23:04:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1697954685; x=1698559485; 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=+Or2gtRGec4B/FJVTj/3PoJs8Ws9mqR+t3l35TgK5yM=; b=i5i8ftQUCErZg9Tq54VWOxtUiCo2zuvRC6i+Mr0i1SAI13qRDPGXpkrXT3u+8/ozZR JSNdLuFlQm1lfgSmrpVxoFi5zDxVaUww+AxxTXy6wivPf1jwzySzHUgSwzvhgU9xv/YM k20hZk6LQHMz69tGoe0P8sgSOlGFc56rTU7znLzHojp7L2H2DF8pTR5GhAUKSPkRal2d eCtEjmCpk7HtsRo+4DMfZqidb77EFv8wJBn0byKlb8+JJiJI2dJt8ZwFAP6SAckpe3Rg 3INxjJ179ZZ75zvkMONnOECSXZ+L9eOthUoOo8l7zX4mb08Xk4RRM/U3N9+vNfbalEgW 0ceg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697954685; x=1698559485; 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=+Or2gtRGec4B/FJVTj/3PoJs8Ws9mqR+t3l35TgK5yM=; b=dg+VRVTmkKJVnmsqPO2HgqoAzZ7vjfPp6oodFjExRWqEnNb+LIGquh4JFf4mlQ9TA8 PaR0dFTFL3alk9EjBWmGoQu+5faOeoqSxfVRa3UbmxfVQWd1wk0Ki2XQGIEoibPLQozt STDvdbH0r1VoNXKgTaiw7ilSOMgpE13kYdDrTXRB/8EVgfntyASw/xSc+xSlSuiaI0Dc nOWT26bc9mYD539owvjq+YpPej6Nr6PCTl5CRc8yxr5tgR2DxGsXRbS2jkBCGMKHzIJe cwtiuAJ2sjWkT0W56BIYprf1Z4EoNXo4JQBHmDJjf/TEbN57yDifje4lLs4N4DfLaeDr E6Zg== X-Gm-Message-State: AOJu0YypN3DIVrFkoKvUyXUNIteKhEFXIZ8CbTh3GS13p/mMmKIGfedq gKHL/VHJkUSRgj6fCULOYkrApzNvsaQkoxPlnBI= X-Received: by 2002:a05:6a00:10c5:b0:68f:b5a3:5ec6 with SMTP id d5-20020a056a0010c500b0068fb5a35ec6mr7537823pfu.0.1697954685512; Sat, 21 Oct 2023 23:04:45 -0700 (PDT) Received: from stoup.. ([71.212.149.95]) by smtp.gmail.com with ESMTPSA id fb13-20020a056a002d8d00b0068a46cd4120sm4007373pfb.199.2023.10.21.23.04.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 21 Oct 2023 23:04:45 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: mark.cave-ayland@ilande.co.uk Subject: [PATCH v4 52/90] target/sparc: Move CASA, CASXA to decodetree Date: Sat, 21 Oct 2023 22:59:53 -0700 Message-Id: <20231022060031.490251-53-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231022060031.490251-1-richard.henderson@linaro.org> References: <20231022060031.490251-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 Remove gen_cas_asi, gen_casx_asi. Rename gen_cas_asi0 to gen_cas_asi. Signed-off-by: Richard Henderson --- target/sparc/insns.decode | 7 ++++ target/sparc/translate.c | 71 +++++++++++++++------------------------ 2 files changed, 35 insertions(+), 43 deletions(-) diff --git a/target/sparc/insns.decode b/target/sparc/insns.decode index 9c4597317c..82c484fbc7 100644 --- a/target/sparc/insns.decode +++ b/target/sparc/insns.decode @@ -240,6 +240,8 @@ RETRY 10 00001 111110 00000 0 0000000000000 @r_r_r_asi .. rd:5 ...... rs1:5 0 asi:8 rs2_or_imm:5 &r_r_ri_asi imm=0 @r_r_i_asi .. rd:5 ...... rs1:5 1 rs2_or_imm:s13 \ &r_r_ri_asi imm=1 asi=-2 +@casa_imm .. rd:5 ...... rs1:5 1 00000000 rs2_or_imm:5 \ + &r_r_ri_asi imm=1 asi=-2 LDUW 11 ..... 000000 ..... . ............. @r_r_ri_na LDUB 11 ..... 000001 ..... . ............. @r_r_ri_na @@ -292,6 +294,11 @@ SWAP 11 ..... 001111 ..... . ............. @r_r_ri_na SWAP 11 ..... 011111 ..... . ............. @r_r_r_asi # SWAPA SWAP 11 ..... 011111 ..... . ............. @r_r_i_asi # SWAPA +CASA 11 ..... 111100 ..... . ............. @r_r_r_asi +CASA 11 ..... 111100 ..... . ............. @casa_imm +CASXA 11 ..... 111110 ..... . ............. @r_r_r_asi +CASXA 11 ..... 111110 ..... . ............. @casa_imm + NCP 10 ----- 110110 ----- --------- ----- # v8 CPop1 NCP 10 ----- 110111 ----- --------- ----- # v8 CPop2 diff --git a/target/sparc/translate.c b/target/sparc/translate.c index 4a42acafd9..c5dd9e6dd6 100644 --- a/target/sparc/translate.c +++ b/target/sparc/translate.c @@ -2253,8 +2253,8 @@ static void gen_swap_asi(DisasContext *dc, DisasASI *da, } } -static void gen_cas_asi0(DisasContext *dc, DisasASI *da, - TCGv oldv, TCGv newv, TCGv cmpv, TCGv addr) +static void gen_cas_asi(DisasContext *dc, DisasASI *da, + TCGv oldv, TCGv newv, TCGv cmpv, TCGv addr) { switch (da->type) { case GET_ASI_EXCP: @@ -2270,30 +2270,6 @@ static void gen_cas_asi0(DisasContext *dc, DisasASI *da, } } -static void __attribute__((unused)) -gen_cas_asi(DisasContext *dc, TCGv addr, TCGv cmpv, int insn, int rd) -{ - DisasASI da = get_asi(dc, insn, MO_TEUL); - TCGv oldv = gen_dest_gpr(dc, rd); - TCGv newv = gen_load_gpr(dc, rd); - - gen_address_mask(dc, addr); - gen_cas_asi0(dc, &da, oldv, newv, cmpv, addr); - gen_store_gpr(dc, rd, oldv); -} - -static void __attribute__((unused)) -gen_casx_asi(DisasContext *dc, TCGv addr, TCGv cmpv, int insn, int rd) -{ - DisasASI da = get_asi(dc, insn, MO_TEUQ); - TCGv oldv = gen_dest_gpr(dc, rd); - TCGv newv = gen_load_gpr(dc, rd); - - gen_address_mask(dc, addr); - gen_cas_asi0(dc, &da, oldv, newv, cmpv, addr); - gen_store_gpr(dc, rd, oldv); -} - static void gen_ldstub_asi(DisasContext *dc, DisasASI *da, TCGv dst, TCGv addr) { switch (da->type) { @@ -2903,6 +2879,7 @@ static void gen_faligndata(TCGv dst, TCGv gsr, TCGv s1, TCGv s2) # define avail_64(C) false #endif #define avail_ASR17(C) ((C)->def->features & CPU_FEATURE_ASR17) +#define avail_CASA(C) ((C)->def->features & CPU_FEATURE_CASA) #define avail_DIV(C) ((C)->def->features & CPU_FEATURE_DIV) #define avail_GL(C) ((C)->def->features & CPU_FEATURE_GL) #define avail_HYPV(C) ((C)->def->features & CPU_FEATURE_HYPV) @@ -4769,6 +4746,28 @@ static bool trans_SWAP(DisasContext *dc, arg_r_r_ri_asi *a) return advance_pc(dc); } +static bool do_casa(DisasContext *dc, arg_r_r_ri_asi *a, MemOp mop) +{ + TCGv addr, o, n, c; + DisasASI da; + + addr = gen_ldst_addr(dc, a->rs1, true, 0); + if (addr == NULL) { + return false; + } + da = resolve_asi(dc, a->asi, mop); + + o = gen_dest_gpr(dc, a->rd); + n = gen_load_gpr(dc, a->rd); + c = gen_load_gpr(dc, a->rs2_or_imm); + gen_cas_asi(dc, &da, o, n, c, addr); + gen_store_gpr(dc, a->rd, o); + return advance_pc(dc); +} + +TRANS(CASA, CASA, do_casa, a, MO_TEUL) +TRANS(CASXA, 64, do_casa, a, MO_TEUQ) + #define CHECK_IU_FEATURE(dc, FEATURE) \ if (!((dc)->def->features & CPU_FEATURE_ ## FEATURE)) \ goto illegal_insn; @@ -5572,9 +5571,7 @@ static void disas_sparc_legacy(DisasContext *dc, unsigned int insn) TCGv cpu_addr = tcg_temp_new(); tcg_gen_mov_tl(cpu_addr, get_src1(dc, insn)); - if (xop == 0x3c || xop == 0x3e) { - /* V9 casa/casxa : no offset */ - } else if (IS_IMM) { /* immediate */ + if (IS_IMM) { /* immediate */ simm = GET_FIELDs(insn, 19, 31); if (simm != 0) { tcg_gen_addi_tl(cpu_addr, cpu_addr, simm); @@ -5787,22 +5784,10 @@ static void disas_sparc_legacy(DisasContext *dc, unsigned int insn) } gen_stf_asi(dc, cpu_addr, insn, 8, DFPREG(rd)); break; +#endif case 0x3e: /* V9 casxa */ - rs2 = GET_FIELD(insn, 27, 31); - cpu_src2 = gen_load_gpr(dc, rs2); - gen_casx_asi(dc, cpu_addr, cpu_src2, insn, rd); - break; -#endif -#if !defined(CONFIG_USER_ONLY) || defined(TARGET_SPARC64) case 0x3c: /* V9 or LEON3 casa */ -#ifndef TARGET_SPARC64 - CHECK_IU_FEATURE(dc, CASA); -#endif - rs2 = GET_FIELD(insn, 27, 31); - cpu_src2 = gen_load_gpr(dc, rs2); - gen_cas_asi(dc, cpu_addr, cpu_src2, insn, rd); - break; -#endif + goto illegal_insn; /* in decodetree */ default: goto illegal_insn; } From patchwork Sun Oct 22 05:59:54 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 736997 Delivered-To: patch@linaro.org Received: by 2002:adf:dd81:0:b0:32d:baff:b0ca with SMTP id x1csp1006323wrl; Sat, 21 Oct 2023 23:14:42 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGY+FUNMIETIH2T2W4khb6gROnRiWyw75dI/sAX8HjGMsjy0oy2WOwDk8kEq7aC+8XNplB/ X-Received: by 2002:ad4:5c67:0:b0:66d:9e70:61ed with SMTP id i7-20020ad45c67000000b0066d9e7061edmr5944952qvh.3.1697955282214; Sat, 21 Oct 2023 23:14:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697955282; cv=none; d=google.com; s=arc-20160816; b=i0Av3cfcE29ht3u9jL+4ldL7IuaeMLzwIBYvpYiUELIsR8zzlrAoJXlu2xtTHnfDJs 3QdV74ld/edqiTkF4No9eIgqd1rvdx5VEuJ7b5s0tJ9nXmIy3lDkmF+UB7wF7gseWDXM 3PWnRK1JMn3xXE1buS97+Q9jEwLPkEoQ4JTruLr1e0nxuj0dDNpzpQ1MQTDoO1Fb5CSg a0hgciEcUDcH3sItwL/NC7vZofnCoNbuoYOKxE6nAglJsRTfXFrzwvB8TWW/VH37AS7Y EWcDQpv3gJkMTOQyRsW6gQyIbnsVu1OuxdmMtzGVwSZ5iCgiK7jHabivkFEy5tJB1Kto bN4A== 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=tUuu11MzrRlUr2WMpsShk9sCSBE/f2VIDlDq3G60qeg=; fh=TYrED6TOMxGX0VC4GtjviASLbYyJe19+7/tKWjN44KQ=; b=0SZ24/C3ssjT6V5u0mZAN5s15YC5jMYo3nkZ3lJQF2baqW1uqyY6hy6E/4k7hgGqwm iOCON4CHMEUM60eIO+TFIlLzl0p+W1fWqAWcCFDokFiHauRH2Og7W3Z/olt+6W6yziI3 zYm7RBEQqcHwkzSjQ1drskV6emnyC8Jba7O4LbiGMbeRZFQr1JnbFFQLQilqWrk6rkmr mcbA9LzAPA3OVstQHB5lcAYxcgk2N+51wY0nzQ8brwHsV22ZPHLiOY0Vk/C8YZeezicu By4n0bd2/HsgAk9LH240lP63WvMx+Mt80KmvMPMXiph5C0asuj1/uyB+Nx1YLBFTbu0H tajQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=YWSGdgSz; 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 dj18-20020a056214091200b0066d14dca029si3807696qvb.555.2023.10.21.23.14.42 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sat, 21 Oct 2023 23:14:42 -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=YWSGdgSz; 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 1quRas-0003vB-8A; Sun, 22 Oct 2023 02:05:46 -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 1quRa4-0000pb-59 for qemu-devel@nongnu.org; Sun, 22 Oct 2023 02:04:56 -0400 Received: from mail-oo1-xc2c.google.com ([2607:f8b0:4864:20::c2c]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1quRZw-0002FL-MK for qemu-devel@nongnu.org; Sun, 22 Oct 2023 02:04:52 -0400 Received: by mail-oo1-xc2c.google.com with SMTP id 006d021491bc7-581f78a0206so1331186eaf.2 for ; Sat, 21 Oct 2023 23:04:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1697954686; x=1698559486; 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=tUuu11MzrRlUr2WMpsShk9sCSBE/f2VIDlDq3G60qeg=; b=YWSGdgSz60akDEld7GC4le47iU1LXulI9wy9FDGEpOf0OHvU6pO3wuDWYvefRnWx7a KI4A4TPzpEPaYlNsY+JGOfeOQaW3D8iYt6JX5LbdZj4WqCy/zgTgyduK7/gwd4V/BENM Ilm9ZoiTgBXYp5kt+64cNBkMzIdS4bXwihwezPYNVN3kvzBsx8IbFs2UsDKeXSAtxvED C53oqtHVq3V4UptKBKQTvmk9H7ItRKypzbJQc8XyXMLLaTXajrodDqqS/1+jwFWQA07j 2pVX29t1WoJAf6JuCywBiX6s1cBtobdBPfHTv+Bjo1JDS1uAYOlfyz20oWxOtzQdBjG1 CdIg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697954686; x=1698559486; 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=tUuu11MzrRlUr2WMpsShk9sCSBE/f2VIDlDq3G60qeg=; b=JIcmwPf9pTHVmbjv2QsVwI/cSZayhYlPAlH3IB2OxEarE5oPqPe0eyKNPrlk5+7NEH vYHnRSUvsvcAZ/KjBbzYWw19P0EQZGPsnsFGzj9hYF5N8g1pHsGIuTicnc+QMstfcOBJ LC+hy1xt2VvsJwh1oDlR0FX0V7ULTPnZJUuZhbSdgxHz8xBAjZyloysW/JfSnZRPBj6x BjNRUNCVSOrf947QFCXpviUhq1UWIaROgewF3Gbp7eivsKsv7vAWz1/qjH7tpd218cvr bIAZhSUtp3nYuJ+LXNK1+W3jauuyB2YCKKz665wKLu5z5QoJmO+TIXb4Z6S++9naq7Cw JnQQ== X-Gm-Message-State: AOJu0YzBfydYoeM7bu+0cZkZnb8uWN+/UMN11JcK46DqThJ6SEaHGoXZ 6Au8lab2PW8OOEsr8cVBAksnW6Khg/UdmL44Ztk= X-Received: by 2002:a05:6358:921c:b0:13a:d269:bd22 with SMTP id d28-20020a056358921c00b0013ad269bd22mr7366572rwb.25.1697954686302; Sat, 21 Oct 2023 23:04:46 -0700 (PDT) Received: from stoup.. ([71.212.149.95]) by smtp.gmail.com with ESMTPSA id fb13-20020a056a002d8d00b0068a46cd4120sm4007373pfb.199.2023.10.21.23.04.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 21 Oct 2023 23:04:45 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: mark.cave-ayland@ilande.co.uk Subject: [PATCH v4 53/90] target/sparc: Move PREFETCH, PREFETCHA to decodetree Date: Sat, 21 Oct 2023 22:59:54 -0700 Message-Id: <20231022060031.490251-54-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231022060031.490251-1-richard.henderson@linaro.org> References: <20231022060031.490251-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::c2c; envelope-from=richard.henderson@linaro.org; helo=mail-oo1-xc2c.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 | 8 ++++++-- target/sparc/translate.c | 14 ++++++++++---- 2 files changed, 16 insertions(+), 6 deletions(-) diff --git a/target/sparc/insns.decode b/target/sparc/insns.decode index 82c484fbc7..aa452f1d00 100644 --- a/target/sparc/insns.decode +++ b/target/sparc/insns.decode @@ -231,6 +231,9 @@ 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 + ## ## Major Opcode 11 -- load and store instructions ## @@ -299,8 +302,9 @@ CASA 11 ..... 111100 ..... . ............. @casa_imm CASXA 11 ..... 111110 ..... . ............. @r_r_r_asi CASXA 11 ..... 111110 ..... . ............. @casa_imm -NCP 10 ----- 110110 ----- --------- ----- # v8 CPop1 -NCP 10 ----- 110111 ----- --------- ----- # v8 CPop2 +NOP_v9 11 ----- 101101 ----- 0 00000000 ----- # PREFETCH +NOP_v9 11 ----- 101101 ----- 1 ------------- # PREFETCH +NOP_v9 11 ----- 111101 ----- - ------------- # PREFETCHA NCP 11 ----- 110000 ----- --------- ----- # v8 LDC NCP 11 ----- 110001 ----- --------- ----- # v8 LDCSR diff --git a/target/sparc/translate.c b/target/sparc/translate.c index c5dd9e6dd6..07bd3c123a 100644 --- a/target/sparc/translate.c +++ b/target/sparc/translate.c @@ -4176,6 +4176,14 @@ static bool trans_NOP_v7(DisasContext *dc, arg_NOP_v7 *a) return false; } +static bool trans_NOP_v9(DisasContext *dc, arg_NOP_v9 *a) +{ + if (avail_64(dc)) { + return advance_pc(dc); + } + return false; +} + static bool do_arith(DisasContext *dc, arg_r_r_ri_cc *a, int cc_op, void (*func)(TCGv, TCGv, TCGv), void (*funci)(TCGv, TCGv, target_long)) @@ -5609,10 +5617,10 @@ static void disas_sparc_legacy(DisasContext *dc, unsigned int insn) case 0x0b: /* V9 ldx */ case 0x18: /* V9 ldswa */ case 0x1b: /* V9 ldxa */ + case 0x2d: /* V9 prefetch */ + case 0x3d: /* V9 prefetcha */ goto illegal_insn; /* in decodetree */ #ifdef TARGET_SPARC64 - case 0x2d: /* V9 prefetch, no effect */ - goto skip_move; case 0x30: /* V9 ldfa */ if (gen_trap_ifnofpu(dc)) { goto jmp_insn; @@ -5627,8 +5635,6 @@ static void disas_sparc_legacy(DisasContext *dc, unsigned int insn) gen_ldf_asi(dc, cpu_addr, insn, 8, DFPREG(rd)); gen_update_fprs_dirty(dc, DFPREG(rd)); goto skip_move; - case 0x3d: /* V9 prefetcha, no effect */ - goto skip_move; case 0x32: /* V9 ldqfa */ CHECK_FPU_FEATURE(dc, FLOAT128); if (gen_trap_ifnofpu(dc)) { From patchwork Sun Oct 22 05:59:55 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 736968 Delivered-To: patch@linaro.org Received: by 2002:adf:dd81:0:b0:32d:baff:b0ca with SMTP id x1csp1005844wrl; Sat, 21 Oct 2023 23:12:41 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGwbE5bEqfu/ru2QpxZv/ozica1exbcaGFDhE9Hh28W5B2W4nzaAhthHeGovT4B6YS01vrr X-Received: by 2002:ad4:5be8:0:b0:66d:15de:329c with SMTP id k8-20020ad45be8000000b0066d15de329cmr8123754qvc.43.1697955161096; Sat, 21 Oct 2023 23:12:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697955161; cv=none; d=google.com; s=arc-20160816; b=bBty07vd0ykASLyNbluNBq7ey/Fof7UIjJXgrbljfj9Y0HjVTeiREUSq+UnNZ40oQN BgvdLIZzOKFjVI8Y/qcCEtZeL5Xar84SidfBHEqtCbOfaoHYDGgP+1UK8atnMWw9M2yZ SDKQhqssnqv4si9Te8GFLUY6HksRskNLagdFSEaca4iV6L8H9aSjSUWZqNQC3q1LUvBi U8UeLZNVuZft13BE3e2EOyLnrAfhaFijoGtfGyVT69J2cMc5YNoM2+TX8YSFIVz0OaEI yuyw9YFym2f9iLkDS/oK8pQZSLXtINfN4UGYNS2aTdSVN5Eix+BPfvtCIO0yrt3voNbl isVg== 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=iEi9EO+FIbId6BvqeWNibh5o/A3CalHenj5faU92Nh4=; fh=TYrED6TOMxGX0VC4GtjviASLbYyJe19+7/tKWjN44KQ=; b=QMVlrd1NP5rr2KttFdme/uOa6Vh9yVjWFluVn3tyu9bWiPEwi5iFc6MPmlLqfcfl0t xx41aWz1MEAohpB9smqU1FlV9IXsGSx+pDZlH8J8AEVB9IcVSr0n7gWLi+SvQrAWLDRG wuhi4O8ijbh1aLUHpkc7urWTk49nnWUO8piRKmrcdfs3hjxWz+JxqOWkAe7aWuYc6/h0 3/y2zBUkSYjw1Dou9UPVDOk+Hvux4QWb6gceE++bP/mSRoM7L+jK77W9Yy5w/YPpBHPm XMcktJupcCfx5qfYevifAK1dl69DWlV60tuxY9CHiZIWfKXyunluqupliH5TEegk/Tlk idqQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=bD3C1Iq3; 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 h9-20020a0cf8c9000000b0066d1f324166si3798919qvo.215.2023.10.21.23.12.40 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sat, 21 Oct 2023 23:12:41 -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=bD3C1Iq3; 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 1quRaS-0002o9-Je; Sun, 22 Oct 2023 02:05:20 -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 1quRa4-0000q3-DG for qemu-devel@nongnu.org; Sun, 22 Oct 2023 02:04:56 -0400 Received: from mail-oo1-xc36.google.com ([2607:f8b0:4864:20::c36]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1quRZw-0002Fa-Mc for qemu-devel@nongnu.org; Sun, 22 Oct 2023 02:04:55 -0400 Received: by mail-oo1-xc36.google.com with SMTP id 006d021491bc7-58441865ffaso516097eaf.1 for ; Sat, 21 Oct 2023 23:04:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1697954687; x=1698559487; 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=iEi9EO+FIbId6BvqeWNibh5o/A3CalHenj5faU92Nh4=; b=bD3C1Iq3GkLWFr1Wl5PTdSgCW6o2ZWtmvk+y+OqKrKs6UQdCwmzXoTIW74G35XtOQ2 FjEYMVhiLpZuZYVvRaYZ0ltdhlFEpdhKXdNFyONMe0tmuGZaZlQpE4w9hRvvylY5JW6y J0YzYh0BbmjW0aMP+tMOQqCZu8km4+6DRpcqCU2CoRu0jQXv/SttXktVCJF1GFihbcuO Diwaw4lfYmbS6XoD+YF37WmTxD3BtQQA0fdGTcnuuZp36zrJXlUD2EWU/6hFtCFvIbjI 2s8xuaTyq05Utppo0SocjW568mcEXghVfby0P8X4I6jCXc2I472jq0r8VwEXWUaRiPjM ob6Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697954687; x=1698559487; 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=iEi9EO+FIbId6BvqeWNibh5o/A3CalHenj5faU92Nh4=; b=UgHNKCalZrzhyKqjR+8u8rPic5NZ8IclI4Jce2dUvNKz58zLGOFYN54+cMXvx5Nlbn hNtXM8bFTujjMD8DLxCQWHbSMGfFp9KVAFRwz16pr5xELz310iJh+iI6BBmU7eJ5n0lk OEjyDk9Wv1enQX5JQgK1nSUx8rlJgIwolT49GW+mXK+Y2tvKTMHISPsO9zwO8UCZeE/s okbYKTAyaWIO4VAZUxyUgi4TH23qmdWScKAxRYKNKqf+I+Lgi608pEmDtKBTHN4hTnmW gZYRCLq36WpfGJd8pEAx5vdnzTbN3Ov3wKpaKRLPsaVsaZHwrc7sl6ARyKUHAMDxI88d D7HQ== X-Gm-Message-State: AOJu0Yw/T3aRHeni6ZsjBSya+I5Fsij1p2Man6EIvUiEV48xME/GDZtN hxzbTjjPQyB1ezgFPyxlU8Z/orxxiIYp75LHokQ= X-Received: by 2002:a05:6358:9895:b0:140:fbfe:d941 with SMTP id q21-20020a056358989500b00140fbfed941mr7906278rwa.20.1697954687110; Sat, 21 Oct 2023 23:04:47 -0700 (PDT) Received: from stoup.. ([71.212.149.95]) by smtp.gmail.com with ESMTPSA id fb13-20020a056a002d8d00b0068a46cd4120sm4007373pfb.199.2023.10.21.23.04.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 21 Oct 2023 23:04:46 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: mark.cave-ayland@ilande.co.uk Subject: [PATCH v4 54/90] target/sparc: Split out fp ldst functions with asi precomputed Date: Sat, 21 Oct 2023 22:59:55 -0700 Message-Id: <20231022060031.490251-55-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231022060031.490251-1-richard.henderson@linaro.org> References: <20231022060031.490251-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::c36; envelope-from=richard.henderson@linaro.org; helo=mail-oo1-xc36.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 Take the operation size from the MemOp instead of a separate parameter. Signed-off-by: Richard Henderson --- target/sparc/translate.c | 138 +++++++++++++++++++++++---------------- 1 file changed, 80 insertions(+), 58 deletions(-) diff --git a/target/sparc/translate.c b/target/sparc/translate.c index 07bd3c123a..5a385024ce 100644 --- a/target/sparc/translate.c +++ b/target/sparc/translate.c @@ -2305,35 +2305,41 @@ static void gen_ldstub_asi(DisasContext *dc, DisasASI *da, TCGv dst, TCGv addr) } } -static void __attribute__((unused)) -gen_ldf_asi(DisasContext *dc, TCGv addr, int insn, int size, int rd) +static void gen_ldf_asi0(DisasContext *dc, DisasASI *da, MemOp orig_size, + TCGv addr, int rd) { - DisasASI da = get_asi(dc, insn, (size == 4 ? MO_TEUL : MO_TEUQ)); + MemOp memop = da->memop; + MemOp size = memop & MO_SIZE; TCGv_i32 d32; TCGv_i64 d64; - switch (da.type) { + /* TODO: Use 128-bit load/store below. */ + if (size == MO_128) { + memop = (memop & ~MO_SIZE) | MO_64; + } + + switch (da->type) { case GET_ASI_EXCP: break; case GET_ASI_DIRECT: - gen_address_mask(dc, addr); + memop |= MO_ALIGN_4; switch (size) { - case 4: + case MO_32: d32 = gen_dest_fpr_F(dc); - tcg_gen_qemu_ld_i32(d32, addr, da.mem_idx, da.memop | MO_ALIGN); + tcg_gen_qemu_ld_i32(d32, addr, da->mem_idx, memop); gen_store_fpr_F(dc, rd, d32); break; - case 8: - tcg_gen_qemu_ld_i64(cpu_fpr[rd / 2], addr, da.mem_idx, - da.memop | MO_ALIGN_4); + + case MO_64: + tcg_gen_qemu_ld_i64(cpu_fpr[rd / 2], addr, da->mem_idx, memop); break; - case 16: + + case MO_128: d64 = tcg_temp_new_i64(); - tcg_gen_qemu_ld_i64(d64, addr, da.mem_idx, da.memop | MO_ALIGN_4); + tcg_gen_qemu_ld_i64(d64, addr, da->mem_idx, memop); tcg_gen_addi_tl(addr, addr, 8); - tcg_gen_qemu_ld_i64(cpu_fpr[rd/2+1], addr, da.mem_idx, - da.memop | MO_ALIGN_4); + tcg_gen_qemu_ld_i64(cpu_fpr[rd / 2 + 1], addr, da->mem_idx, memop); tcg_gen_mov_i64(cpu_fpr[rd / 2], d64); break; default: @@ -2343,24 +2349,19 @@ gen_ldf_asi(DisasContext *dc, TCGv addr, int insn, int size, int rd) case GET_ASI_BLOCK: /* Valid for lddfa on aligned registers only. */ - if (size == 8 && (rd & 7) == 0) { - MemOp memop; + if (orig_size == MO_64 && (rd & 7) == 0) { TCGv eight; int i; - gen_address_mask(dc, addr); - /* The first operation checks required alignment. */ - memop = da.memop | MO_ALIGN_64; eight = tcg_constant_tl(8); for (i = 0; ; ++i) { - tcg_gen_qemu_ld_i64(cpu_fpr[rd / 2 + i], addr, - da.mem_idx, memop); + tcg_gen_qemu_ld_i64(cpu_fpr[rd / 2 + i], addr, da->mem_idx, + memop | (i == 0 ? MO_ALIGN_64 : 0)); if (i == 7) { break; } tcg_gen_add_tl(addr, addr, eight); - memop = da.memop; } } else { gen_exception(dc, TT_ILL_INSN); @@ -2369,10 +2370,9 @@ gen_ldf_asi(DisasContext *dc, TCGv addr, int insn, int size, int rd) case GET_ASI_SHORT: /* Valid for lddfa only. */ - if (size == 8) { - gen_address_mask(dc, addr); - tcg_gen_qemu_ld_i64(cpu_fpr[rd / 2], addr, da.mem_idx, - da.memop | MO_ALIGN); + if (orig_size == MO_64) { + tcg_gen_qemu_ld_i64(cpu_fpr[rd / 2], addr, da->mem_idx, + memop | MO_ALIGN); } else { gen_exception(dc, TT_ILL_INSN); } @@ -2380,8 +2380,8 @@ gen_ldf_asi(DisasContext *dc, TCGv addr, int insn, int size, int rd) default: { - TCGv_i32 r_asi = tcg_constant_i32(da.asi); - TCGv_i32 r_mop = tcg_constant_i32(da.memop | MO_ALIGN); + TCGv_i32 r_asi = tcg_constant_i32(da->asi); + TCGv_i32 r_mop = tcg_constant_i32(memop | MO_ALIGN); save_state(dc); /* According to the table in the UA2011 manual, the only @@ -2389,21 +2389,23 @@ gen_ldf_asi(DisasContext *dc, TCGv addr, int insn, int size, int rd) the NO_FAULT asis. We still need a helper for these, but we can just use the integer asi helper for them. */ switch (size) { - case 4: + case MO_32: d64 = tcg_temp_new_i64(); gen_helper_ld_asi(d64, tcg_env, addr, r_asi, r_mop); d32 = gen_dest_fpr_F(dc); tcg_gen_extrl_i64_i32(d32, d64); gen_store_fpr_F(dc, rd, d32); break; - case 8: - gen_helper_ld_asi(cpu_fpr[rd / 2], tcg_env, addr, r_asi, r_mop); + case MO_64: + gen_helper_ld_asi(cpu_fpr[rd / 2], tcg_env, addr, + r_asi, r_mop); break; - case 16: + case MO_128: d64 = tcg_temp_new_i64(); gen_helper_ld_asi(d64, tcg_env, addr, r_asi, r_mop); tcg_gen_addi_tl(addr, addr, 8); - gen_helper_ld_asi(cpu_fpr[rd/2+1], tcg_env, addr, r_asi, r_mop); + gen_helper_ld_asi(cpu_fpr[rd / 2 + 1], tcg_env, addr, + r_asi, r_mop); tcg_gen_mov_i64(cpu_fpr[rd / 2], d64); break; default: @@ -2415,36 +2417,52 @@ gen_ldf_asi(DisasContext *dc, TCGv addr, int insn, int size, int rd) } static void __attribute__((unused)) -gen_stf_asi(DisasContext *dc, TCGv addr, int insn, int size, int rd) +gen_ldf_asi(DisasContext *dc, TCGv addr, int insn, int size, int rd) { - DisasASI da = get_asi(dc, insn, (size == 4 ? MO_TEUL : MO_TEUQ)); + MemOp sz = ctz32(size); + DisasASI da = get_asi(dc, insn, MO_TE | sz); + + gen_address_mask(dc, addr); + gen_ldf_asi0(dc, &da, sz, addr, rd); +} + +static void gen_stf_asi0(DisasContext *dc, DisasASI *da, MemOp orig_size, + TCGv addr, int rd) +{ + MemOp memop = da->memop; + MemOp size = memop & MO_SIZE; TCGv_i32 d32; - switch (da.type) { + /* TODO: Use 128-bit load/store below. */ + if (size == MO_128) { + memop = (memop & ~MO_SIZE) | MO_64; + } + + switch (da->type) { case GET_ASI_EXCP: break; case GET_ASI_DIRECT: - gen_address_mask(dc, addr); + memop |= MO_ALIGN_4; switch (size) { - case 4: + case MO_32: d32 = gen_load_fpr_F(dc, rd); - tcg_gen_qemu_st_i32(d32, addr, da.mem_idx, da.memop | MO_ALIGN); + tcg_gen_qemu_st_i32(d32, addr, da->mem_idx, memop | MO_ALIGN); break; - case 8: - tcg_gen_qemu_st_i64(cpu_fpr[rd / 2], addr, da.mem_idx, - da.memop | MO_ALIGN_4); + case MO_64: + tcg_gen_qemu_st_i64(cpu_fpr[rd / 2], addr, da->mem_idx, + memop | MO_ALIGN_4); break; - case 16: + case MO_128: /* Only 4-byte alignment required. However, it is legal for the cpu to signal the alignment fault, and the OS trap handler is required to fix it up. Requiring 16-byte alignment here avoids having to probe the second page before performing the first write. */ - tcg_gen_qemu_st_i64(cpu_fpr[rd / 2], addr, da.mem_idx, - da.memop | MO_ALIGN_16); + tcg_gen_qemu_st_i64(cpu_fpr[rd / 2], addr, da->mem_idx, + memop | MO_ALIGN_16); tcg_gen_addi_tl(addr, addr, 8); - tcg_gen_qemu_st_i64(cpu_fpr[rd/2+1], addr, da.mem_idx, da.memop); + tcg_gen_qemu_st_i64(cpu_fpr[rd / 2 + 1], addr, da->mem_idx, memop); break; default: g_assert_not_reached(); @@ -2453,24 +2471,19 @@ gen_stf_asi(DisasContext *dc, TCGv addr, int insn, int size, int rd) case GET_ASI_BLOCK: /* Valid for stdfa on aligned registers only. */ - if (size == 8 && (rd & 7) == 0) { - MemOp memop; + if (orig_size == MO_64 && (rd & 7) == 0) { TCGv eight; int i; - gen_address_mask(dc, addr); - /* The first operation checks required alignment. */ - memop = da.memop | MO_ALIGN_64; eight = tcg_constant_tl(8); for (i = 0; ; ++i) { - tcg_gen_qemu_st_i64(cpu_fpr[rd / 2 + i], addr, - da.mem_idx, memop); + tcg_gen_qemu_st_i64(cpu_fpr[rd / 2 + i], addr, da->mem_idx, + memop | (i == 0 ? MO_ALIGN_64 : 0)); if (i == 7) { break; } tcg_gen_add_tl(addr, addr, eight); - memop = da.memop; } } else { gen_exception(dc, TT_ILL_INSN); @@ -2479,10 +2492,9 @@ gen_stf_asi(DisasContext *dc, TCGv addr, int insn, int size, int rd) case GET_ASI_SHORT: /* Valid for stdfa only. */ - if (size == 8) { - gen_address_mask(dc, addr); - tcg_gen_qemu_st_i64(cpu_fpr[rd / 2], addr, da.mem_idx, - da.memop | MO_ALIGN); + if (orig_size == MO_64) { + tcg_gen_qemu_st_i64(cpu_fpr[rd / 2], addr, da->mem_idx, + memop | MO_ALIGN); } else { gen_exception(dc, TT_ILL_INSN); } @@ -2497,6 +2509,16 @@ gen_stf_asi(DisasContext *dc, TCGv addr, int insn, int size, int rd) } } +static void __attribute__((unused)) +gen_stf_asi(DisasContext *dc, TCGv addr, int insn, int size, int rd) +{ + MemOp sz = ctz32(size); + DisasASI da = get_asi(dc, insn, MO_TE | sz); + + gen_address_mask(dc, addr); + gen_stf_asi0(dc, &da, sz, addr, rd); +} + static void gen_ldda_asi(DisasContext *dc, DisasASI *da, TCGv addr, int rd) { TCGv hi = gen_dest_gpr(dc, rd); From patchwork Sun Oct 22 05:59:56 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 736980 Delivered-To: patch@linaro.org Received: by 2002:adf:dd81:0:b0:32d:baff:b0ca with SMTP id x1csp1006104wrl; Sat, 21 Oct 2023 23:13:48 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGjhaSwv7Xg5Y231NAWq/ClSma1Cd98ci2aZM0QYnEjWGD1mdTLwnnt1GN9PNY5Jxf0yH7V X-Received: by 2002:a05:620a:4002:b0:76e:f3a9:1e12 with SMTP id h2-20020a05620a400200b0076ef3a91e12mr8699214qko.1.1697955228552; Sat, 21 Oct 2023 23:13:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697955228; cv=none; d=google.com; s=arc-20160816; b=zNDcJHJ0EZTNO7tie/fBI9c5KAmJIlWS+O+hLSEaKaeSovpbz12okaebpo3ojStZSr V9QfcK2G9cQxmLnzIm0xFTjeXNzYKe0XplQdAvPydIhAd/tvJxA+A2CRWneinlflZNWw 8Wln52La8cPZ8xIN5sqpXG+vl2LqlNnzPzAZWvPZv1JYK1ATIA7HBAxj1ii9mUnH7ciA DCgVH/r6kfE9nLHi6x6STF9ra64UUe1ukav+bDYaDrBeMDlDl+KZA6a0r/+E+cf4NK1R +cBL/iWXN13jg8dRuzXz4F/bJJk+Wilrq6872oSIJrdFBIldvt8lqJ3QRO17aQ0RAr3W DkrQ== 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=e/5geg+qbsrgszhS9EeejwZMl4IzQHNLDfvAQNYRYVk=; fh=TYrED6TOMxGX0VC4GtjviASLbYyJe19+7/tKWjN44KQ=; b=WC1IvvlJWbf3J3eBYB9P22IPBNoIH8kJvW7/8kUlj+XAb+JE6PJPPQuMerBZGfMzr/ DTsWRdEl1luYR7t5TCAMOgxLDqHBxKF93JLHTqAcm8B6sxRxoXFeK1DaQk6NQxGHwjK8 KxkQQueVjmiuRqzRE54hPgkdckSJhfD6urmkAg5qdqASQvA0D+fXampl+jiwrM4nJl+c p+Li1fImbIoPRYugVqL5ehGKfwAQgFbZ36vlzx5JDgPIS2vP99ZiSJXIowgxG0kDgzAx JarC/pUmYl6z8VnZTPvKkCiB4hDAWI9gjW+PAm4xwwxbD8aaaIpyEN/A00QxTHkYSqxH sUPQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=INZsUoxP; 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 m18-20020a05620a291200b007758f43eea9si3840146qkp.353.2023.10.21.23.13.48 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sat, 21 Oct 2023 23:13:48 -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=INZsUoxP; 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 1quRaM-0002RU-NO; Sun, 22 Oct 2023 02:05:14 -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 1quRa4-0000pl-9r for qemu-devel@nongnu.org; Sun, 22 Oct 2023 02:04:56 -0400 Received: from mail-pf1-x434.google.com ([2607:f8b0:4864:20::434]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1quRZx-0002Fh-CE for qemu-devel@nongnu.org; Sun, 22 Oct 2023 02:04:55 -0400 Received: by mail-pf1-x434.google.com with SMTP id d2e1a72fcca58-6b77ab73c6fso1593410b3a.1 for ; Sat, 21 Oct 2023 23:04:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1697954688; x=1698559488; 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=e/5geg+qbsrgszhS9EeejwZMl4IzQHNLDfvAQNYRYVk=; b=INZsUoxP6hs34P6F1Q2AaIM25DqoE/jOkYqPTT7vkFPP5ScmUvx0ZJGo9HRcQxXK8T dPe7Eh0TdTHP7KSuq1nnRPUMfeQlVIZepNBlZYNGqmgv/JOepthnk6SKYiOgearUul1P p+eiYbIyPfC+8jdNJWTJsQurqKcAeJKzMezq4PJjBihruIjsPXSnY9h15stumMSnkjRR IYlGyIBdX2F42RDas8GpaHCAbdwztSxBPC00zDcjhv/ULhg4bTvA8sMAYHz2t5eyFmmN mC5npyamEB28tNwWWwEUYr2ZMQ3Re9IXge0psoN5LQClpW4zBVGG7EoYCH2AXBtObVdA HXqg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697954688; x=1698559488; 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=e/5geg+qbsrgszhS9EeejwZMl4IzQHNLDfvAQNYRYVk=; b=OintEUFtqtcrMUJBJ/mjf/ZxFt6Ue//7YaQBl773QgorYaLzwBfvfhVyfATsOBy3Gj /6XjK6p268yfdMtr/jWhO6brRYz2+F3W+QBN1fo7GekMEY9akRDKvNp/a6oZOZMgrqk4 8RT02l7yGDRUzjzkJxTYKw7V1ZUEBm8uDvJF0RT74EnJ9FuNGpzgDuUKNRbdNED+8GlX qPojYYSuy4/pr5VcRhpjDnPVJ+Eixr2whjHYE/CgjvuqSDrCPh605wJaGXImeF06cTFl ACimzF+5AmSLTD8vrmgp1LY95dsR8N69z6UKpKv8RqgkojueIcT41rayCuxUsV/xP+xN VBDw== X-Gm-Message-State: AOJu0Yw/muY5Dv5kBJSfj5FaBaPzpYrLUXIM81BwHc5DRfZvidPqdKP7 RPfqJzXcyFmhXugo/g+qoSiGKlZvj2NkNmPdcgQ= X-Received: by 2002:aa7:8b85:0:b0:68f:c2f7:cef0 with SMTP id r5-20020aa78b85000000b0068fc2f7cef0mr11549411pfd.4.1697954687895; Sat, 21 Oct 2023 23:04:47 -0700 (PDT) Received: from stoup.. ([71.212.149.95]) by smtp.gmail.com with ESMTPSA id fb13-20020a056a002d8d00b0068a46cd4120sm4007373pfb.199.2023.10.21.23.04.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 21 Oct 2023 23:04:47 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: mark.cave-ayland@ilande.co.uk Subject: [PATCH v4 55/90] target/sparc: Move simple fp load/store to decodetree Date: Sat, 21 Oct 2023 22:59:56 -0700 Message-Id: <20231022060031.490251-56-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231022060031.490251-1-richard.henderson@linaro.org> References: <20231022060031.490251-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::434; envelope-from=richard.henderson@linaro.org; helo=mail-pf1-x434.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 | 19 ++++ target/sparc/translate.c | 194 ++++++++++++++++++-------------------- 2 files changed, 113 insertions(+), 100 deletions(-) diff --git a/target/sparc/insns.decode b/target/sparc/insns.decode index aa452f1d00..1150890e44 100644 --- a/target/sparc/insns.decode +++ b/target/sparc/insns.decode @@ -238,8 +238,16 @@ NCP 10 ----- 110111 ----- --------- ----- # v8 CPop2 ## Major Opcode 11 -- load and store instructions ## +%dfp_rd 25:5 !function=extract_dfpreg +%qfp_rd 25:5 !function=extract_qfpreg + &r_r_ri_asi rd rs1 rs2_or_imm asi imm:bool @r_r_ri_na .. rd:5 ...... rs1:5 imm:1 rs2_or_imm:s13 &r_r_ri_asi asi=-1 +@d_r_ri_na .. ..... ...... rs1:5 imm:1 rs2_or_imm:s13 \ + &r_r_ri_asi rd=%dfp_rd asi=-1 +@q_r_ri_na .. ..... ...... rs1:5 imm:1 rs2_or_imm:s13 \ + &r_r_ri_asi rd=%qfp_rd asi=-1 + @r_r_r_asi .. rd:5 ...... rs1:5 0 asi:8 rs2_or_imm:5 &r_r_ri_asi imm=0 @r_r_i_asi .. rd:5 ...... rs1:5 1 rs2_or_imm:s13 \ &r_r_ri_asi imm=1 asi=-2 @@ -289,6 +297,17 @@ STD 11 ..... 010111 ..... . ............. @r_r_i_asi # STDA STX 11 ..... 011110 ..... . ............. @r_r_r_asi # STXA STX 11 ..... 011110 ..... . ............. @r_r_i_asi # STXA +LDF 11 ..... 100000 ..... . ............. @r_r_ri_na +LDQF 11 ..... 100010 ..... . ............. @q_r_ri_na +LDDF 11 ..... 100011 ..... . ............. @d_r_ri_na + +STF 11 ..... 100100 ..... . ............. @r_r_ri_na +{ + STQF 11 ..... 100110 ..... . ............. @q_r_ri_na + STDFQ 11 ----- 100110 ----- - ------------- +} +STDF 11 ..... 100111 ..... . ............. @d_r_ri_na + LDSTUB 11 ..... 001101 ..... . ............. @r_r_ri_na LDSTUB 11 ..... 011101 ..... . ............. @r_r_r_asi # LDSTUBA LDSTUB 11 ..... 011101 ..... . ............. @r_r_i_asi # LDSTUBA diff --git a/target/sparc/translate.c b/target/sparc/translate.c index 5a385024ce..2770d4d84f 100644 --- a/target/sparc/translate.c +++ b/target/sparc/translate.c @@ -253,29 +253,7 @@ static void gen_op_store_QT0_fpr(unsigned int dst) offsetof(CPU_QuadU, ll.lower)); } -static void gen_store_fpr_Q(DisasContext *dc, unsigned int dst, - TCGv_i64 v1, TCGv_i64 v2) -{ - dst = QFPREG(dst); - - tcg_gen_mov_i64(cpu_fpr[dst / 2], v1); - tcg_gen_mov_i64(cpu_fpr[dst / 2 + 1], v2); - gen_update_fprs_dirty(dc, dst); -} - #ifdef TARGET_SPARC64 -static TCGv_i64 gen_load_fpr_Q0(DisasContext *dc, unsigned int src) -{ - src = QFPREG(src); - return cpu_fpr[src / 2]; -} - -static TCGv_i64 gen_load_fpr_Q1(DisasContext *dc, unsigned int src) -{ - src = QFPREG(src); - return cpu_fpr[src / 2 + 1]; -} - static void gen_move_Q(DisasContext *dc, unsigned int rd, unsigned int rs) { rd = QFPREG(rd); @@ -2885,6 +2863,16 @@ static void gen_faligndata(TCGv dst, TCGv gsr, TCGv s1, TCGv s2) } #endif +static int extract_dfpreg(DisasContext *dc, int x) +{ + return DFPREG(x); +} + +static int extract_qfpreg(DisasContext *dc, int x) +{ + return QFPREG(x); +} + /* Include the auto-generated decoder. */ #include "decode-insns.c.inc" @@ -3013,6 +3001,20 @@ static bool raise_priv(DisasContext *dc) return true; } +static bool raise_unimpfpop(DisasContext *dc) +{ + gen_op_fpexception_im(dc, FSR_FTT_UNIMPFPOP); + return true; +} + +static bool gen_trap_float128(DisasContext *dc) +{ + if (dc->def->features & CPU_FEATURE_FLOAT128) { + return false; + } + return raise_unimpfpop(dc); +} + static bool do_bpcc(DisasContext *dc, arg_bcc *a) { target_long target = address_mask_i(dc, dc->pc + a->i * 4); @@ -4798,6 +4800,68 @@ static bool do_casa(DisasContext *dc, arg_r_r_ri_asi *a, MemOp mop) TRANS(CASA, CASA, do_casa, a, MO_TEUL) TRANS(CASXA, 64, do_casa, a, MO_TEUQ) +static bool do_ld_fpr(DisasContext *dc, arg_r_r_ri_asi *a, MemOp sz) +{ + TCGv addr = gen_ldst_addr(dc, a->rs1, a->imm, a->rs2_or_imm); + DisasASI da; + + if (addr == NULL) { + return false; + } + if (gen_trap_ifnofpu(dc)) { + return true; + } + if (sz == MO_128 && gen_trap_float128(dc)) { + return true; + } + da = resolve_asi(dc, a->asi, MO_TE | sz); + gen_ldf_asi0(dc, &da, sz, addr, a->rd); + gen_update_fprs_dirty(dc, a->rd); + return advance_pc(dc); +} + +TRANS(LDF, ALL, do_ld_fpr, a, MO_32) +TRANS(LDDF, ALL, do_ld_fpr, a, MO_64) +TRANS(LDQF, ALL, do_ld_fpr, a, MO_128) + +static bool do_st_fpr(DisasContext *dc, arg_r_r_ri_asi *a, MemOp sz) +{ + TCGv addr = gen_ldst_addr(dc, a->rs1, a->imm, a->rs2_or_imm); + DisasASI da; + + if (addr == NULL) { + return false; + } + if (gen_trap_ifnofpu(dc)) { + return true; + } + if (sz == MO_128 && gen_trap_float128(dc)) { + return true; + } + da = resolve_asi(dc, a->asi, MO_TE | sz); + gen_stf_asi0(dc, &da, sz, addr, a->rd); + return advance_pc(dc); +} + +TRANS(STF, ALL, do_st_fpr, a, MO_32) +TRANS(STDF, ALL, do_st_fpr, a, MO_64) +TRANS(STQF, ALL, do_st_fpr, a, MO_128) + +static bool trans_STDFQ(DisasContext *dc, arg_STDFQ *a) +{ + if (!avail_32(dc)) { + return false; + } + if (!supervisor(dc)) { + return raise_priv(dc); + } + if (gen_trap_ifnofpu(dc)) { + return true; + } + gen_op_fpexception_im(dc, FSR_FTT_SEQ_ERROR); + return true; +} + #define CHECK_IU_FEATURE(dc, FEATURE) \ if (!((dc)->def->features & CPU_FEATURE_ ## FEATURE)) \ goto illegal_insn; @@ -4812,7 +4876,8 @@ static void disas_sparc_legacy(DisasContext *dc, unsigned int insn) TCGv cpu_src1 __attribute__((unused)); 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; + TCGv_i64 cpu_src1_64, cpu_src2_64; + TCGv_i64 cpu_dst_64 __attribute__((unused)); target_long simm; opc = GET_FIELD(insn, 0, 1); @@ -5679,12 +5744,9 @@ static void disas_sparc_legacy(DisasContext *dc, unsigned int insn) } switch (xop) { case 0x20: /* ldf, load fpreg */ - gen_address_mask(dc, cpu_addr); - cpu_dst_32 = gen_dest_fpr_F(dc); - tcg_gen_qemu_ld_i32(cpu_dst_32, cpu_addr, - dc->mem_idx, MO_TEUL | MO_ALIGN); - gen_store_fpr_F(dc, rd, cpu_dst_32); - break; + case 0x22: /* ldqf, load quad fpreg */ + case 0x23: /* lddf, load double fpreg */ + g_assert_not_reached(); /* in decodetree */ case 0x21: /* ldfsr, V9 ldxfsr */ #ifdef TARGET_SPARC64 gen_address_mask(dc, cpu_addr); @@ -5701,25 +5763,6 @@ static void disas_sparc_legacy(DisasContext *dc, unsigned int insn) dc->mem_idx, MO_TEUL | MO_ALIGN); gen_helper_ldfsr(cpu_fsr, tcg_env, cpu_fsr, cpu_dst_32); break; - case 0x22: /* ldqf, load quad fpreg */ - CHECK_FPU_FEATURE(dc, FLOAT128); - gen_address_mask(dc, cpu_addr); - cpu_src1_64 = tcg_temp_new_i64(); - tcg_gen_qemu_ld_i64(cpu_src1_64, cpu_addr, dc->mem_idx, - MO_TEUQ | MO_ALIGN_4); - tcg_gen_addi_tl(cpu_addr, cpu_addr, 8); - cpu_src2_64 = tcg_temp_new_i64(); - tcg_gen_qemu_ld_i64(cpu_src2_64, cpu_addr, dc->mem_idx, - MO_TEUQ | MO_ALIGN_4); - gen_store_fpr_Q(dc, rd, cpu_src1_64, cpu_src2_64); - break; - case 0x23: /* lddf, load double fpreg */ - gen_address_mask(dc, cpu_addr); - cpu_dst_64 = gen_dest_fpr_D(dc, rd); - tcg_gen_qemu_ld_i64(cpu_dst_64, cpu_addr, dc->mem_idx, - MO_TEUQ | MO_ALIGN_4); - gen_store_fpr_D(dc, rd, cpu_dst_64); - break; default: goto illegal_insn; } @@ -5729,11 +5772,9 @@ static void disas_sparc_legacy(DisasContext *dc, unsigned int insn) } switch (xop) { case 0x24: /* stf, store fpreg */ - gen_address_mask(dc, cpu_addr); - cpu_src1_32 = gen_load_fpr_F(dc, rd); - tcg_gen_qemu_st_i32(cpu_src1_32, cpu_addr, - dc->mem_idx, MO_TEUL | MO_ALIGN); - break; + case 0x26: /* v9 stqf, v8 stdfq */ + case 0x27: /* stdf, store double fpreg */ + g_assert_not_reached(); case 0x25: /* stfsr, V9 stxfsr */ { #ifdef TARGET_SPARC64 @@ -5748,43 +5789,6 @@ static void disas_sparc_legacy(DisasContext *dc, unsigned int insn) dc->mem_idx, MO_TEUL | MO_ALIGN); } break; - case 0x26: -#ifdef TARGET_SPARC64 - /* V9 stqf, store quad fpreg */ - CHECK_FPU_FEATURE(dc, FLOAT128); - gen_address_mask(dc, cpu_addr); - /* ??? While stqf only requires 4-byte alignment, it is - legal for the cpu to signal the unaligned exception. - The OS trap handler is then required to fix it up. - For qemu, this avoids having to probe the second page - before performing the first write. */ - cpu_src1_64 = gen_load_fpr_Q0(dc, rd); - tcg_gen_qemu_st_i64(cpu_src1_64, cpu_addr, - dc->mem_idx, MO_TEUQ | MO_ALIGN_16); - tcg_gen_addi_tl(cpu_addr, cpu_addr, 8); - cpu_src2_64 = gen_load_fpr_Q1(dc, rd); - tcg_gen_qemu_st_i64(cpu_src1_64, cpu_addr, - dc->mem_idx, MO_TEUQ); - break; -#else /* !TARGET_SPARC64 */ - /* stdfq, store floating point queue */ -#if defined(CONFIG_USER_ONLY) - goto illegal_insn; -#else - if (!supervisor(dc)) - goto priv_insn; - if (gen_trap_ifnofpu(dc)) { - goto jmp_insn; - } - goto nfq_insn; -#endif -#endif - case 0x27: /* stdf, store double fpreg */ - gen_address_mask(dc, cpu_addr); - cpu_src1_64 = gen_load_fpr_D(dc, rd); - tcg_gen_qemu_st_i64(cpu_src1_64, cpu_addr, dc->mem_idx, - MO_TEUQ | MO_ALIGN_4); - break; default: goto illegal_insn; } @@ -5831,19 +5835,9 @@ static void disas_sparc_legacy(DisasContext *dc, unsigned int insn) illegal_insn: gen_exception(dc, TT_ILL_INSN); return; -#if !defined(CONFIG_USER_ONLY) && !defined(TARGET_SPARC64) - priv_insn: - gen_exception(dc, TT_PRIV_INSN); - return; -#endif nfpu_insn: gen_op_fpexception_im(dc, FSR_FTT_UNIMPFPOP); return; -#if !defined(CONFIG_USER_ONLY) && !defined(TARGET_SPARC64) - nfq_insn: - gen_op_fpexception_im(dc, FSR_FTT_SEQ_ERROR); - return; -#endif } static void sparc_tr_init_disas_context(DisasContextBase *dcbase, CPUState *cs) From patchwork Sun Oct 22 05:59:57 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 736975 Delivered-To: patch@linaro.org Received: by 2002:adf:dd81:0:b0:32d:baff:b0ca with SMTP id x1csp1006028wrl; Sat, 21 Oct 2023 23:13:30 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEM9Nypu05r085vFCQnbp5WEx3pkdsEuFUFtFw8luF90mkjj4hJdeM+4fAS1kXOpxUpDHpA X-Received: by 2002:a05:6214:d64:b0:66d:3690:7c2f with SMTP id 4-20020a0562140d6400b0066d36907c2fmr7842788qvs.51.1697955210692; Sat, 21 Oct 2023 23:13:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697955210; cv=none; d=google.com; s=arc-20160816; b=Tt6nk2vt/P1e/pkn48GVLdkM2fxRc/5ouvhazIJZSDKRmdKDgA4HCAZzV3o7hDurZb a9fFiZSIYuNIBDn/l0xVu5gIsWiic+eW6g6Lf4t3p/HRr04IOCQC/PaJmtx+Qxn6+BzS UJIVBBwYg7OVTaDkTJEVO+O6MiwWQPjN+h1LyX97iIfzZc1Wk9kruaaZNFbIQq5hJLn4 Dwud9fqmtWroLp9jCbV+8C5TEV9IkiXoYuNDwya9dbA04BuLfhxy9F1gVrzsY5HFTEhZ KZEsRWw20HoZXsyjDEI19mw2oI8ogCNkTDqYzIQs22fdTe+8tIknEi4WTGaw1GyzVxcF LMew== 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=oZQhXKAL/opxiwegqNL6OXID+/btYCfjYspMKwXz4p0=; fh=TYrED6TOMxGX0VC4GtjviASLbYyJe19+7/tKWjN44KQ=; b=wXtNalh9K347ZOC4mcoMZr0A7SUN00uOGfMDkYWRWeLB9vJ7ISV/Pj/Y1vyzschwIX gOIarCM+nlN3PVgVwjTGKk9Z3ANd16tADyCwNP/0Pnl+SUfoEvQ6BlHGZaWItajmDCH/ qabzuujq02NTgLgHrnBZq7gLF1o5vWdeYrivSJ0sb/aAMK0ir2wqbBPyg6jL3MLmX9aH EqMFeHqOzyiFZS4mrdEjLG2dG1HZvYd4S0blmaSxCIiKvCFVLypdM+a1y0UT31RkKy4u qqEj0EIIJcAk77iu6PWyqFm1C73YiKqDcgCbqQPfBNPmlWoQc6ktPYCl+nVQ4vFeTvkA yUOA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=xyETqqBA; 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 c19-20020a056214071300b0065b086dcab8si3894264qvz.457.2023.10.21.23.13.30 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sat, 21 Oct 2023 23:13:30 -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=xyETqqBA; 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 1quRaO-0002lJ-U9; Sun, 22 Oct 2023 02:05:18 -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 1quRa4-0000po-Bf for qemu-devel@nongnu.org; Sun, 22 Oct 2023 02:04:56 -0400 Received: from mail-oo1-xc31.google.com ([2607:f8b0:4864:20::c31]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1quRZy-0002GC-6D for qemu-devel@nongnu.org; Sun, 22 Oct 2023 02:04:54 -0400 Received: by mail-oo1-xc31.google.com with SMTP id 006d021491bc7-581de3e691dso1357457eaf.3 for ; Sat, 21 Oct 2023 23:04:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1697954689; x=1698559489; 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=oZQhXKAL/opxiwegqNL6OXID+/btYCfjYspMKwXz4p0=; b=xyETqqBA6f1wq387SCWGsRDLzNB+61F3WIX36lDFnMi2PVyXxG/H95o67yLkUl4pp2 I1hdxQ8WpDZA0fSVggBry80U//yieb3YUzDPXz7taM70IY4SPZN+5cS/YXJDEfpzc5sb /hC7H+cole20axABgAgspkhUoPkfcsGsuNEec0S/2sHnsY2G0CoacFeG7+MtaNecoSBF nB6xcFPszIOXIKxsLGRQ0MmfwX3tkbpjLw3nLJiRyDWqpOFrkNIeRvkKHleIZBToloBg CYL5HECbstNQMcFhfijL1d9LzY5jsPpRMkpVOmUxcwXiNr4wF3vuzGGO0woDB++hfPNh j8mA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697954689; x=1698559489; 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=oZQhXKAL/opxiwegqNL6OXID+/btYCfjYspMKwXz4p0=; b=lZux/vB3yqZqr+thV5Mk/rd+JJIKH5CUbdgq7vqE7q+eylRpAg7atnrHK4gjIXF7QS pcxvDsrIrS9ai2eanPv3wvMxNwJY/TCLh31fg4ZoTylV4mQhTtvK0Au++wLf+tn6rHSs LW8Y2vjY5qaCLgqDbdEfDsRt8Vt5SYLoSw9wzt3O1QXl4C7yzsRdGYjmG2S+ljbYuJSQ 9UYT9QRwBT/7CrcHuCXSUivinIYrxqBMA+9Gu2A0XTF1oysa0BgxZPdjJvt/7mtaHmmD gCRRmuu1X8sNnLcRpVDq/b0mHBI037phdUQtD5fZ9ExUSBBcLlK+u1/b8zS21uNgEnnx HLYg== X-Gm-Message-State: AOJu0YxDjL3WT/hXt4hku6pCKXbyDdt7jjnfrOGhTFmOU7VskMir+yyd 1hwPJy51mPc/WbbwBm9LuTQARbaFX0KVv3M4qCE= X-Received: by 2002:a05:6359:809a:b0:168:d284:50b5 with SMTP id re26-20020a056359809a00b00168d28450b5mr1770031rwb.21.1697954688671; Sat, 21 Oct 2023 23:04:48 -0700 (PDT) Received: from stoup.. ([71.212.149.95]) by smtp.gmail.com with ESMTPSA id fb13-20020a056a002d8d00b0068a46cd4120sm4007373pfb.199.2023.10.21.23.04.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 21 Oct 2023 23:04:48 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: mark.cave-ayland@ilande.co.uk Subject: [PATCH v4 56/90] target/sparc: Move asi fp load/store to decodetree Date: Sat, 21 Oct 2023 22:59:57 -0700 Message-Id: <20231022060031.490251-57-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231022060031.490251-1-richard.henderson@linaro.org> References: <20231022060031.490251-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::c31; envelope-from=richard.henderson@linaro.org; helo=mail-oo1-xc31.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 | 51 +++++++++-- target/sparc/translate.c | 173 ++++++++------------------------------ 2 files changed, 81 insertions(+), 143 deletions(-) diff --git a/target/sparc/insns.decode b/target/sparc/insns.decode index 1150890e44..45eb6a967f 100644 --- a/target/sparc/insns.decode +++ b/target/sparc/insns.decode @@ -251,6 +251,14 @@ NCP 10 ----- 110111 ----- --------- ----- # v8 CPop2 @r_r_r_asi .. rd:5 ...... rs1:5 0 asi:8 rs2_or_imm:5 &r_r_ri_asi imm=0 @r_r_i_asi .. rd:5 ...... rs1:5 1 rs2_or_imm:s13 \ &r_r_ri_asi imm=1 asi=-2 +@d_r_r_asi .. ..... ...... rs1:5 0 asi:8 rs2_or_imm:5 \ + &r_r_ri_asi rd=%dfp_rd imm=0 +@d_r_i_asi .. ..... ...... rs1:5 1 rs2_or_imm:s13 \ + &r_r_ri_asi rd=%dfp_rd imm=1 asi=-2 +@q_r_r_asi .. ..... ...... rs1:5 0 asi:8 rs2_or_imm:5 \ + &r_r_ri_asi rd=%qfp_rd imm=0 +@q_r_i_asi .. ..... ...... rs1:5 1 rs2_or_imm:s13 \ + &r_r_ri_asi rd=%qfp_rd imm=1 asi=-2 @casa_imm .. rd:5 ...... rs1:5 1 00000000 rs2_or_imm:5 \ &r_r_ri_asi imm=1 asi=-2 @@ -325,10 +333,43 @@ NOP_v9 11 ----- 101101 ----- 0 00000000 ----- # PREFETCH NOP_v9 11 ----- 101101 ----- 1 ------------- # PREFETCH NOP_v9 11 ----- 111101 ----- - ------------- # PREFETCHA -NCP 11 ----- 110000 ----- --------- ----- # v8 LDC +{ + [ + LDFA 11 ..... 110000 ..... . ............. @r_r_r_asi + LDFA 11 ..... 110000 ..... . ............. @r_r_i_asi + ] + NCP 11 ----- 110000 ----- --------- ----- # v8 LDC +} NCP 11 ----- 110001 ----- --------- ----- # v8 LDCSR -NCP 11 ----- 110011 ----- --------- ----- # v8 LDDC -NCP 11 ----- 110100 ----- --------- ----- # v8 STC +LDQFA 11 ..... 110010 ..... . ............. @q_r_r_asi +LDQFA 11 ..... 110010 ..... . ............. @q_r_i_asi +{ + [ + LDDFA 11 ..... 110011 ..... . ............. @d_r_r_asi + LDDFA 11 ..... 110011 ..... . ............. @d_r_i_asi + ] + NCP 11 ----- 110011 ----- --------- ----- # v8 LDDC +} + +{ + [ + STFA 11 ..... 110100 ..... . ............. @r_r_r_asi + STFA 11 ..... 110100 ..... . ............. @r_r_i_asi + ] + NCP 11 ----- 110100 ----- --------- ----- # v8 STC +} NCP 11 ----- 110101 ----- --------- ----- # v8 STCSR -NCP 11 ----- 110110 ----- --------- ----- # v8 STDCQ -NCP 11 ----- 110111 ----- --------- ----- # v8 STDC +{ + [ + STQFA 11 ..... 110110 ..... . ............. @q_r_r_asi + STQFA 11 ..... 110110 ..... . ............. @q_r_i_asi + ] + NCP 11 ----- 110110 ----- --------- ----- # v8 STDCQ +} +{ + [ + STDFA 11 ..... 110111 ..... . ............. @d_r_r_asi + STDFA 11 ..... 110111 ..... . ............. @d_r_i_asi + ] + NCP 11 ----- 110111 ----- --------- ----- # v8 STDC +} diff --git a/target/sparc/translate.c b/target/sparc/translate.c index 2770d4d84f..5710d1e381 100644 --- a/target/sparc/translate.c +++ b/target/sparc/translate.c @@ -2105,12 +2105,6 @@ static DisasASI resolve_asi(DisasContext *dc, int asi, MemOp memop) return (DisasASI){ type, asi, mem_idx, memop }; } -static DisasASI get_asi(DisasContext *dc, int insn, MemOp memop) -{ - int asi = IS_IMM ? -2 : GET_FIELD(insn, 19, 26); - return resolve_asi(dc, asi, memop); -} - static void gen_ld_asi(DisasContext *dc, DisasASI *da, TCGv dst, TCGv addr) { switch (da->type) { @@ -2283,13 +2277,14 @@ static void gen_ldstub_asi(DisasContext *dc, DisasASI *da, TCGv dst, TCGv addr) } } -static void gen_ldf_asi0(DisasContext *dc, DisasASI *da, MemOp orig_size, - TCGv addr, int rd) +static void gen_ldf_asi(DisasContext *dc, DisasASI *da, MemOp orig_size, + TCGv addr, int rd) { MemOp memop = da->memop; MemOp size = memop & MO_SIZE; TCGv_i32 d32; TCGv_i64 d64; + TCGv addr_tmp; /* TODO: Use 128-bit load/store below. */ if (size == MO_128) { @@ -2316,8 +2311,9 @@ static void gen_ldf_asi0(DisasContext *dc, DisasASI *da, MemOp orig_size, case MO_128: d64 = tcg_temp_new_i64(); tcg_gen_qemu_ld_i64(d64, addr, da->mem_idx, memop); - tcg_gen_addi_tl(addr, addr, 8); - tcg_gen_qemu_ld_i64(cpu_fpr[rd / 2 + 1], addr, da->mem_idx, memop); + addr_tmp = tcg_temp_new(); + tcg_gen_addi_tl(addr_tmp, addr, 8); + tcg_gen_qemu_ld_i64(cpu_fpr[rd / 2 + 1], addr_tmp, da->mem_idx, memop); tcg_gen_mov_i64(cpu_fpr[rd / 2], d64); break; default: @@ -2328,18 +2324,16 @@ static void gen_ldf_asi0(DisasContext *dc, DisasASI *da, MemOp orig_size, case GET_ASI_BLOCK: /* Valid for lddfa on aligned registers only. */ if (orig_size == MO_64 && (rd & 7) == 0) { - TCGv eight; - int i; - /* The first operation checks required alignment. */ - eight = tcg_constant_tl(8); - for (i = 0; ; ++i) { + addr_tmp = tcg_temp_new(); + for (int i = 0; ; ++i) { tcg_gen_qemu_ld_i64(cpu_fpr[rd / 2 + i], addr, da->mem_idx, memop | (i == 0 ? MO_ALIGN_64 : 0)); if (i == 7) { break; } - tcg_gen_add_tl(addr, addr, eight); + tcg_gen_addi_tl(addr_tmp, addr, 8); + addr = addr_tmp; } } else { gen_exception(dc, TT_ILL_INSN); @@ -2381,8 +2375,9 @@ static void gen_ldf_asi0(DisasContext *dc, DisasASI *da, MemOp orig_size, case MO_128: d64 = tcg_temp_new_i64(); gen_helper_ld_asi(d64, tcg_env, addr, r_asi, r_mop); - tcg_gen_addi_tl(addr, addr, 8); - gen_helper_ld_asi(cpu_fpr[rd / 2 + 1], tcg_env, addr, + addr_tmp = tcg_temp_new(); + tcg_gen_addi_tl(addr_tmp, addr, 8); + gen_helper_ld_asi(cpu_fpr[rd / 2 + 1], tcg_env, addr_tmp, r_asi, r_mop); tcg_gen_mov_i64(cpu_fpr[rd / 2], d64); break; @@ -2394,22 +2389,13 @@ static void gen_ldf_asi0(DisasContext *dc, DisasASI *da, MemOp orig_size, } } -static void __attribute__((unused)) -gen_ldf_asi(DisasContext *dc, TCGv addr, int insn, int size, int rd) -{ - MemOp sz = ctz32(size); - DisasASI da = get_asi(dc, insn, MO_TE | sz); - - gen_address_mask(dc, addr); - gen_ldf_asi0(dc, &da, sz, addr, rd); -} - -static void gen_stf_asi0(DisasContext *dc, DisasASI *da, MemOp orig_size, - TCGv addr, int rd) +static void gen_stf_asi(DisasContext *dc, DisasASI *da, MemOp orig_size, + TCGv addr, int rd) { MemOp memop = da->memop; MemOp size = memop & MO_SIZE; TCGv_i32 d32; + TCGv addr_tmp; /* TODO: Use 128-bit load/store below. */ if (size == MO_128) { @@ -2439,8 +2425,9 @@ static void gen_stf_asi0(DisasContext *dc, DisasASI *da, MemOp orig_size, write. */ tcg_gen_qemu_st_i64(cpu_fpr[rd / 2], addr, da->mem_idx, memop | MO_ALIGN_16); - tcg_gen_addi_tl(addr, addr, 8); - tcg_gen_qemu_st_i64(cpu_fpr[rd / 2 + 1], addr, da->mem_idx, memop); + addr_tmp = tcg_temp_new(); + tcg_gen_addi_tl(addr_tmp, addr, 8); + tcg_gen_qemu_st_i64(cpu_fpr[rd / 2 + 1], addr_tmp, da->mem_idx, memop); break; default: g_assert_not_reached(); @@ -2450,18 +2437,16 @@ static void gen_stf_asi0(DisasContext *dc, DisasASI *da, MemOp orig_size, case GET_ASI_BLOCK: /* Valid for stdfa on aligned registers only. */ if (orig_size == MO_64 && (rd & 7) == 0) { - TCGv eight; - int i; - /* The first operation checks required alignment. */ - eight = tcg_constant_tl(8); - for (i = 0; ; ++i) { + addr_tmp = tcg_temp_new(); + for (int i = 0; ; ++i) { tcg_gen_qemu_st_i64(cpu_fpr[rd / 2 + i], addr, da->mem_idx, memop | (i == 0 ? MO_ALIGN_64 : 0)); if (i == 7) { break; } - tcg_gen_add_tl(addr, addr, eight); + tcg_gen_addi_tl(addr_tmp, addr, 8); + addr = addr_tmp; } } else { gen_exception(dc, TT_ILL_INSN); @@ -2487,16 +2472,6 @@ static void gen_stf_asi0(DisasContext *dc, DisasASI *da, MemOp orig_size, } } -static void __attribute__((unused)) -gen_stf_asi(DisasContext *dc, TCGv addr, int insn, int size, int rd) -{ - MemOp sz = ctz32(size); - DisasASI da = get_asi(dc, insn, MO_TE | sz); - - gen_address_mask(dc, addr); - gen_stf_asi0(dc, &da, sz, addr, rd); -} - static void gen_ldda_asi(DisasContext *dc, DisasASI *da, TCGv addr, int rd) { TCGv hi = gen_dest_gpr(dc, rd); @@ -4815,7 +4790,7 @@ static bool do_ld_fpr(DisasContext *dc, arg_r_r_ri_asi *a, MemOp sz) return true; } da = resolve_asi(dc, a->asi, MO_TE | sz); - gen_ldf_asi0(dc, &da, sz, addr, a->rd); + gen_ldf_asi(dc, &da, sz, addr, a->rd); gen_update_fprs_dirty(dc, a->rd); return advance_pc(dc); } @@ -4824,6 +4799,10 @@ TRANS(LDF, ALL, do_ld_fpr, a, MO_32) TRANS(LDDF, ALL, do_ld_fpr, a, MO_64) TRANS(LDQF, ALL, do_ld_fpr, a, MO_128) +TRANS(LDFA, 64, do_ld_fpr, a, MO_32) +TRANS(LDDFA, 64, do_ld_fpr, a, MO_64) +TRANS(LDQFA, 64, do_ld_fpr, a, MO_128) + static bool do_st_fpr(DisasContext *dc, arg_r_r_ri_asi *a, MemOp sz) { TCGv addr = gen_ldst_addr(dc, a->rs1, a->imm, a->rs2_or_imm); @@ -4839,7 +4818,7 @@ static bool do_st_fpr(DisasContext *dc, arg_r_r_ri_asi *a, MemOp sz) return true; } da = resolve_asi(dc, a->asi, MO_TE | sz); - gen_stf_asi0(dc, &da, sz, addr, a->rd); + gen_stf_asi(dc, &da, sz, addr, a->rd); return advance_pc(dc); } @@ -4847,6 +4826,10 @@ TRANS(STF, ALL, do_st_fpr, a, MO_32) TRANS(STDF, ALL, do_st_fpr, a, MO_64) TRANS(STQF, ALL, do_st_fpr, a, MO_128) +TRANS(STFA, 64, do_st_fpr, a, MO_32) +TRANS(STDFA, 64, do_st_fpr, a, MO_64) +TRANS(STQFA, 64, do_st_fpr, a, MO_128) + static bool trans_STDFQ(DisasContext *dc, arg_STDFQ *a) { if (!avail_32(dc)) { @@ -5680,64 +5663,7 @@ static void disas_sparc_legacy(DisasContext *dc, unsigned int insn) if (xop < 4 || (xop > 7 && xop < 0x14 && xop != 0x0e) || (xop > 0x17 && xop <= 0x1d ) || (xop > 0x2c && xop <= 0x33) || xop == 0x1f || xop == 0x3d) { - TCGv cpu_val = gen_dest_gpr(dc, rd); - - switch (xop) { - case 0x0: /* ld, V9 lduw, load unsigned word */ - case 0x1: /* ldub, load unsigned byte */ - case 0x2: /* lduh, load unsigned halfword */ - case 0x3: /* ldd, load double word */ - case 0x9: /* ldsb, load signed byte */ - case 0xa: /* ldsh, load signed halfword */ - case 0xd: /* ldstub */ - case 0x0f: /* swap */ - case 0x10: /* lda, V9 lduwa, load word alternate */ - case 0x11: /* lduba, load unsigned byte alternate */ - case 0x12: /* lduha, load unsigned halfword alternate */ - case 0x13: /* ldda, load double word alternate */ - case 0x19: /* ldsba, load signed byte alternate */ - case 0x1a: /* ldsha, load signed halfword alternate */ - case 0x1d: /* ldstuba */ - case 0x1f: /* swapa */ - g_assert_not_reached(); /* in decodetree */ - case 0x08: /* V9 ldsw */ - case 0x0b: /* V9 ldx */ - case 0x18: /* V9 ldswa */ - case 0x1b: /* V9 ldxa */ - case 0x2d: /* V9 prefetch */ - case 0x3d: /* V9 prefetcha */ - goto illegal_insn; /* in decodetree */ -#ifdef TARGET_SPARC64 - case 0x30: /* V9 ldfa */ - if (gen_trap_ifnofpu(dc)) { - goto jmp_insn; - } - gen_ldf_asi(dc, cpu_addr, insn, 4, rd); - gen_update_fprs_dirty(dc, rd); - goto skip_move; - case 0x33: /* V9 lddfa */ - if (gen_trap_ifnofpu(dc)) { - goto jmp_insn; - } - gen_ldf_asi(dc, cpu_addr, insn, 8, DFPREG(rd)); - gen_update_fprs_dirty(dc, DFPREG(rd)); - goto skip_move; - case 0x32: /* V9 ldqfa */ - CHECK_FPU_FEATURE(dc, FLOAT128); - if (gen_trap_ifnofpu(dc)) { - goto jmp_insn; - } - gen_ldf_asi(dc, cpu_addr, insn, 16, QFPREG(rd)); - gen_update_fprs_dirty(dc, QFPREG(rd)); - goto skip_move; -#endif - default: - goto illegal_insn; - } - gen_store_gpr(dc, rd, cpu_val); -#if defined(TARGET_SPARC64) - skip_move: ; -#endif + goto illegal_insn; /* in decodetree */ } else if (xop >= 0x20 && xop < 0x24) { if (gen_trap_ifnofpu(dc)) { goto jmp_insn; @@ -5793,36 +5719,7 @@ static void disas_sparc_legacy(DisasContext *dc, unsigned int insn) goto illegal_insn; } } else if (xop > 0x33 && xop < 0x3f) { - switch (xop) { -#ifdef TARGET_SPARC64 - case 0x34: /* V9 stfa */ - if (gen_trap_ifnofpu(dc)) { - goto jmp_insn; - } - gen_stf_asi(dc, cpu_addr, insn, 4, rd); - break; - case 0x36: /* V9 stqfa */ - { - CHECK_FPU_FEATURE(dc, FLOAT128); - if (gen_trap_ifnofpu(dc)) { - goto jmp_insn; - } - gen_stf_asi(dc, cpu_addr, insn, 16, QFPREG(rd)); - } - break; - case 0x37: /* V9 stdfa */ - if (gen_trap_ifnofpu(dc)) { - goto jmp_insn; - } - gen_stf_asi(dc, cpu_addr, insn, 8, DFPREG(rd)); - break; -#endif - case 0x3e: /* V9 casxa */ - case 0x3c: /* V9 or LEON3 casa */ - goto illegal_insn; /* in decodetree */ - default: - goto illegal_insn; - } + goto illegal_insn; /* in decodetree */ } else { goto illegal_insn; } From patchwork Sun Oct 22 05:59:58 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 736972 Delivered-To: patch@linaro.org Received: by 2002:adf:dd81:0:b0:32d:baff:b0ca with SMTP id x1csp1005981wrl; Sat, 21 Oct 2023 23:13:19 -0700 (PDT) X-Google-Smtp-Source: AGHT+IF4NGxzsHVz2omFsEtU/G/q92gXFLGF1CRtj8zrOc46TguuER+k1nZLxSeCDyMcvim5BgA8 X-Received: by 2002:a05:622a:1316:b0:410:9af1:f9b2 with SMTP id v22-20020a05622a131600b004109af1f9b2mr8746193qtk.3.1697955198875; Sat, 21 Oct 2023 23:13:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697955198; cv=none; d=google.com; s=arc-20160816; b=Jc0tLLBIBM3bSz6sjK1/IKr0kz8c4zxT1/ietO/hKifJ6ennYkgGjSsBWyC8oy8Z9u wdb1o9aeUHKOXdX52ZY6LpVpXcCEHkRtyVIuyLaT1Oju8o1Ks1G3cXCUqjoOAbBQy5wd Io09LD4px00F90cs9bTEwEliGnBnSrKXJ5zSX2YPLJp7FdyOMtel/96ZNP2bte1+sVoO ImyMkoD3O3KpNmwMCkHtn7SK3Gee22vtUvGQXgSI6+lX9560uiOXFLyPpgNmRgiB9sKb RWgOpkKdec8sJzW4pqDd1uVm0NUID7cKlaIJYgIylKO719TbQinl6AZo21HFns6ZkTHz KY7w== 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=3KuBjHl9aPFZmiyY3Pe/eBk4uBQaIfqnlZt6LP6BWRo=; fh=TYrED6TOMxGX0VC4GtjviASLbYyJe19+7/tKWjN44KQ=; b=jmdCK0RbJQp/DA7xzTJ/DU7fgVa001nTZUxpinj5r1YzYzgWHOApDY8QRhazwFv0Wz 4X1hqIp1UHX3cMa8FnpoabXT/+bjdfpl8SigEQG0bCDOhPUD02IUsn7ZmqTBd1Dk5gSl esmZQvCcnJgh3oU9A2/4fC4UURzznI/8QULK1IITpkesJTkZzGRIhxu5uLC+P5LIZB+x FlYdM8QaM/TMwWyeYhlY9kV7bqjURrwPQU6M3GrmL1P2FFHA7sjDhEy1rafS3FVU31bI G1yoY+i//SH3Lke3zdrir6IU/6N3BFk4jz33lnc045MK7MfmKR7mewYjWdV1qHwCpje9 uP/w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=rn31x+gb; 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 s7-20020a05622a178700b003f9bd68a453si3510428qtk.791.2023.10.21.23.13.18 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sat, 21 Oct 2023 23:13:18 -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=rn31x+gb; 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 1quRaA-0001CG-D3; Sun, 22 Oct 2023 02:05:02 -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 1quRa4-0000ph-9H for qemu-devel@nongnu.org; Sun, 22 Oct 2023 02:04:56 -0400 Received: from mail-oi1-x22d.google.com ([2607:f8b0:4864:20::22d]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1quRZz-0002GO-Ry for qemu-devel@nongnu.org; Sun, 22 Oct 2023 02:04:54 -0400 Received: by mail-oi1-x22d.google.com with SMTP id 5614622812f47-3b2ec5ee2e4so1584139b6e.3 for ; Sat, 21 Oct 2023 23:04:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1697954689; x=1698559489; 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=3KuBjHl9aPFZmiyY3Pe/eBk4uBQaIfqnlZt6LP6BWRo=; b=rn31x+gbbnsEGkiUYnC6jDKmL4n4XYxWYaVTC7aajH8jHkhqg0NmiCV4ZpsGeZ52K1 cf903tbTeEwxd11kZx4ZsGHuEzXgUGq3ivSB0MF1JP3gkwPSpB/vtcLcefPY+BbwIQEx pK4mYfIDJ8XQV4Xf1Q9z7bgb57QWiEDlJab0Q4O8L2Mz7D/E0cn5eb5NsWWVkd1WbfIX cFHlDeE9CA45zggEa939A8c/CrHFN1EkUbL80tTbEXODF+LjGVQFISMVM8UFIz405oXG lc2vzfvOzzJJL0QaitSKRRnikIB9CWsGbl8QtW7g8sDvEri5Vf7gkIOj57Sj70bA4Ljg HDMg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697954689; x=1698559489; 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=3KuBjHl9aPFZmiyY3Pe/eBk4uBQaIfqnlZt6LP6BWRo=; b=gpfcQIn7xMDTmgM6WJ9iBVZGuDfwyyPHDxAymjssfvNQ0nyZvkLvmoZX8IVhztr9N8 UtthCTup1JOg4Ps5Vb2SyBPej9hsnsMGmFEoCiM4UlXSBrYaDORMpYvSU8ChW6QdkH4D d4CEn8RKIgcOqWIeRx2tDBf2rF94lVk0YZTVX26B8luplxJvMYfP0RpdQHnXjVMHcx1E PtTxxHY98JjNPhzLnffYMnYISVKyGyFpEzHaAkwkQiAhUwrdHcQCdQKCdBraTa5omBAc siKjFJDB2xx1QYumbw6mDD/tvhdyJpw/KqoLluXSXMhyB1ReVzQxA0t/ptZo15Wrufnu 09HQ== X-Gm-Message-State: AOJu0YynPfF6QUzwdCnzGJsTR32dmN7ogX+BBp/Bu/xWI4aerMfFaDlu jOjReoWQhFu4tUNcZ1SvrB0a9XzW60ILOJ1FF6A= X-Received: by 2002:a05:6358:5927:b0:168:a3b2:945a with SMTP id g39-20020a056358592700b00168a3b2945amr8444231rwf.0.1697954689449; Sat, 21 Oct 2023 23:04:49 -0700 (PDT) Received: from stoup.. ([71.212.149.95]) by smtp.gmail.com with ESMTPSA id fb13-20020a056a002d8d00b0068a46cd4120sm4007373pfb.199.2023.10.21.23.04.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 21 Oct 2023 23:04:49 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: mark.cave-ayland@ilande.co.uk Subject: [PATCH v4 57/90] target/sparc: Move LDFSR, STFSR to decodetree Date: Sat, 21 Oct 2023 22:59:58 -0700 Message-Id: <20231022060031.490251-58-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231022060031.490251-1-richard.henderson@linaro.org> References: <20231022060031.490251-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::22d; envelope-from=richard.henderson@linaro.org; helo=mail-oi1-x22d.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 | 4 + target/sparc/translate.c | 152 +++++++++++++++----------------------- 2 files changed, 64 insertions(+), 92 deletions(-) diff --git a/target/sparc/insns.decode b/target/sparc/insns.decode index 45eb6a967f..5df3b1add4 100644 --- a/target/sparc/insns.decode +++ b/target/sparc/insns.decode @@ -306,10 +306,14 @@ STX 11 ..... 011110 ..... . ............. @r_r_r_asi # STXA STX 11 ..... 011110 ..... . ............. @r_r_i_asi # STXA LDF 11 ..... 100000 ..... . ............. @r_r_ri_na +LDFSR 11 00000 100001 ..... . ............. @n_r_ri +LDXFSR 11 00001 100001 ..... . ............. @n_r_ri LDQF 11 ..... 100010 ..... . ............. @q_r_ri_na LDDF 11 ..... 100011 ..... . ............. @d_r_ri_na STF 11 ..... 100100 ..... . ............. @r_r_ri_na +STFSR 11 00000 100101 ..... . ............. @n_r_ri +STXFSR 11 00001 100101 ..... . ............. @n_r_ri { STQF 11 ..... 100110 ..... . ............. @q_r_ri_na STDFQ 11 ----- 100110 ----- - ------------- diff --git a/target/sparc/translate.c b/target/sparc/translate.c index 5710d1e381..ef71fbabfe 100644 --- a/target/sparc/translate.c +++ b/target/sparc/translate.c @@ -58,6 +58,7 @@ #define gen_helper_retry(E) qemu_build_not_reached() #define gen_helper_udivx(D, E, A, B) qemu_build_not_reached() #define gen_helper_sdivx(D, E, A, B) qemu_build_not_reached() +#define gen_helper_ldxfsr(R, E, X, Y) qemu_build_not_reached() # ifdef CONFIG_USER_ONLY static void gen_helper_ld_asi(TCGv_i64 r, TCGv_env e, TCGv a, TCGv_i32 asi, TCGv_i32 mop) @@ -163,12 +164,6 @@ typedef struct { #define UA2005_HTRAP_MASK 0xff #define V8_TRAP_MASK 0x7f -static int sign_extend(int x, int len) -{ - len = 32 - len; - return (x << len) >> len; -} - #define IS_IMM (insn & (1<<13)) static void gen_update_fprs_dirty(DisasContext *dc, int rd) @@ -2640,13 +2635,13 @@ static void gen_stda_asi(DisasContext *dc, DisasASI *da, TCGv addr, int rd) } } +#ifdef TARGET_SPARC64 static TCGv get_src1(DisasContext *dc, unsigned int insn) { unsigned int rs1 = GET_FIELD(insn, 13, 17); return gen_load_gpr(dc, rs1); } -#ifdef TARGET_SPARC64 static void gen_fmovs(DisasContext *dc, DisasCompare *cmp, int rd, int rs) { TCGv_i32 c32, zero, dst, s1, s2; @@ -4845,6 +4840,61 @@ static bool trans_STDFQ(DisasContext *dc, arg_STDFQ *a) return true; } +static bool trans_LDFSR(DisasContext *dc, arg_r_r_ri *a) +{ + TCGv addr; + TCGv_i32 tmp; + + addr = gen_ldst_addr(dc, a->rs1, a->imm, a->rs2_or_imm); + if (addr == NULL) { + return false; + } + if (gen_trap_ifnofpu(dc)) { + return true; + } + tmp = tcg_temp_new_i32(); + tcg_gen_qemu_ld_i32(tmp, addr, dc->mem_idx, MO_TEUL | MO_ALIGN); + gen_helper_ldfsr(cpu_fsr, tcg_env, cpu_fsr, tmp); + return advance_pc(dc); +} + +static bool trans_LDXFSR(DisasContext *dc, arg_r_r_ri *a) +{ + TCGv addr; + TCGv_i64 tmp; + + if (!avail_64(dc)) { + return false; + } + addr = gen_ldst_addr(dc, a->rs1, a->imm, a->rs2_or_imm); + if (addr == NULL) { + return false; + } + if (gen_trap_ifnofpu(dc)) { + return true; + } + tmp = tcg_temp_new_i64(); + tcg_gen_qemu_ld_i64(tmp, addr, dc->mem_idx, MO_TEUQ | MO_ALIGN); + gen_helper_ldxfsr(cpu_fsr, tcg_env, cpu_fsr, tmp); + return advance_pc(dc); +} + +static bool do_stfsr(DisasContext *dc, arg_r_r_ri *a, MemOp mop) +{ + TCGv addr = gen_ldst_addr(dc, a->rs1, a->imm, a->rs2_or_imm); + if (addr == NULL) { + return false; + } + if (gen_trap_ifnofpu(dc)) { + return true; + } + tcg_gen_qemu_st_tl(cpu_fsr, addr, dc->mem_idx, mop | MO_ALIGN); + return advance_pc(dc); +} + +TRANS(STFSR, ALL, do_stfsr, a, MO_TEUL) +TRANS(STXFSR, 64, do_stfsr, a, MO_TEUQ) + #define CHECK_IU_FEATURE(dc, FEATURE) \ if (!((dc)->def->features & CPU_FEATURE_ ## FEATURE)) \ goto illegal_insn; @@ -4858,10 +4908,10 @@ static void disas_sparc_legacy(DisasContext *dc, unsigned int insn) unsigned int opc, rs1, rs2, rd; TCGv cpu_src1 __attribute__((unused)); TCGv cpu_src2 __attribute__((unused)); - TCGv_i32 cpu_src1_32, cpu_src2_32, cpu_dst_32; + TCGv_i32 cpu_src1_32, cpu_src2_32; TCGv_i64 cpu_src1_64, cpu_src2_64; + TCGv_i32 cpu_dst_32 __attribute__((unused)); TCGv_i64 cpu_dst_64 __attribute__((unused)); - target_long simm; opc = GET_FIELD(insn, 0, 1); rd = GET_FIELD(insn, 2, 6); @@ -5642,89 +5692,7 @@ static void disas_sparc_legacy(DisasContext *dc, unsigned int insn) } break; case 3: /* load/store instructions */ - { - unsigned int xop = GET_FIELD(insn, 7, 12); - /* ??? gen_address_mask prevents us from using a source - register directly. Always generate a temporary. */ - TCGv cpu_addr = tcg_temp_new(); - - tcg_gen_mov_tl(cpu_addr, get_src1(dc, insn)); - if (IS_IMM) { /* immediate */ - simm = GET_FIELDs(insn, 19, 31); - if (simm != 0) { - tcg_gen_addi_tl(cpu_addr, cpu_addr, simm); - } - } else { /* register */ - rs2 = GET_FIELD(insn, 27, 31); - if (rs2 != 0) { - tcg_gen_add_tl(cpu_addr, cpu_addr, gen_load_gpr(dc, rs2)); - } - } - if (xop < 4 || (xop > 7 && xop < 0x14 && xop != 0x0e) || - (xop > 0x17 && xop <= 0x1d ) || - (xop > 0x2c && xop <= 0x33) || xop == 0x1f || xop == 0x3d) { - goto illegal_insn; /* in decodetree */ - } else if (xop >= 0x20 && xop < 0x24) { - if (gen_trap_ifnofpu(dc)) { - goto jmp_insn; - } - switch (xop) { - case 0x20: /* ldf, load fpreg */ - case 0x22: /* ldqf, load quad fpreg */ - case 0x23: /* lddf, load double fpreg */ - g_assert_not_reached(); /* in decodetree */ - case 0x21: /* ldfsr, V9 ldxfsr */ -#ifdef TARGET_SPARC64 - gen_address_mask(dc, cpu_addr); - if (rd == 1) { - TCGv_i64 t64 = tcg_temp_new_i64(); - tcg_gen_qemu_ld_i64(t64, cpu_addr, - dc->mem_idx, MO_TEUQ | MO_ALIGN); - gen_helper_ldxfsr(cpu_fsr, tcg_env, cpu_fsr, t64); - break; - } -#endif - cpu_dst_32 = tcg_temp_new_i32(); - tcg_gen_qemu_ld_i32(cpu_dst_32, cpu_addr, - dc->mem_idx, MO_TEUL | MO_ALIGN); - gen_helper_ldfsr(cpu_fsr, tcg_env, cpu_fsr, cpu_dst_32); - break; - default: - goto illegal_insn; - } - } else if (xop > 0x23 && xop < 0x28) { - if (gen_trap_ifnofpu(dc)) { - goto jmp_insn; - } - switch (xop) { - case 0x24: /* stf, store fpreg */ - case 0x26: /* v9 stqf, v8 stdfq */ - case 0x27: /* stdf, store double fpreg */ - g_assert_not_reached(); - case 0x25: /* stfsr, V9 stxfsr */ - { -#ifdef TARGET_SPARC64 - gen_address_mask(dc, cpu_addr); - if (rd == 1) { - tcg_gen_qemu_st_tl(cpu_fsr, cpu_addr, - dc->mem_idx, MO_TEUQ | MO_ALIGN); - break; - } -#endif - tcg_gen_qemu_st_tl(cpu_fsr, cpu_addr, - dc->mem_idx, MO_TEUL | MO_ALIGN); - } - break; - default: - goto illegal_insn; - } - } else if (xop > 0x33 && xop < 0x3f) { - goto illegal_insn; /* in decodetree */ - } else { - goto illegal_insn; - } - } - break; + goto illegal_insn; /* in decodetree */ } advance_pc(dc); jmp_insn: From patchwork Sun Oct 22 05:59:59 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 736981 Delivered-To: patch@linaro.org Received: by 2002:adf:dd81:0:b0:32d:baff:b0ca with SMTP id x1csp1006110wrl; Sat, 21 Oct 2023 23:13:50 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEhg2w87adKWe52k96mxrdpmE5Q1U/WeCLh5IwZNVMRJGzjNK46siebrVRzZLPFF7O8/7gm X-Received: by 2002:a05:620a:24d3:b0:778:abc4:cc3 with SMTP id m19-20020a05620a24d300b00778abc40cc3mr6613425qkn.61.1697955230144; Sat, 21 Oct 2023 23:13:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697955230; cv=none; d=google.com; s=arc-20160816; b=dk9rY/clKdx1AyCpKadXmFN+mm+NGIwGvMmWdHHgEzMUQLZRgOqwnTaBmk5tHGFx3D BOC1/1GmYvVm4NdGLMxKSINAa8CQurnJgiXo/uFy8grsVeUQiprdob28rDUkTDikxLjq w8Qa6nsERwMdJK/GdtMzbH4gimwa7zAvTjSJbf8bUqpmCwaTrCmzjF260oU1OvGyqVtt RR7YxSpRh6v8+bWUxmn57TCOZyex+VG8yti8h0ZWTAg80JhDr0qxBMiGgwTx/HVpgh36 IiV4jVk5RZLY/7XYWEbAC4EUZLiHAbZUJM9O6mYlmM/aZgi0elWChx8uxsf40vB5Onf1 Qtsw== 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=sf/xioMDuWilBydMcWkl4WctY3+1Sv1VJWom1zZiwnw=; fh=TYrED6TOMxGX0VC4GtjviASLbYyJe19+7/tKWjN44KQ=; b=ZXb6kkGsLVkl3mX8Nm6+ib1bd6T3Fi45Sa5wRTM1Zt43lFlVRxBrvZ2v6vFGW6xYO9 nLT5LS2DVrV8ohmW2BwMUN60eTix0h73tqZUiR0G7927JG+7T1pHJGL7KJwL4twPtlbb qZ+U3hZ5XYABDGAoCJ4oIYNE/a6HdTGSFaTc6fpJZ3vQjbIdbZ3pGU2bsqc4Zc2fuBxE d2umYCPCYNpBK+osLyva/iWhiDfNUN3s3ERIrDrE1J5dovZxXuZlDPyzq9dmaYBiOqAU n8TTTUYDLX2ouTXdJ6VbdAmpkbbM709g9eNVkQUbq6svJTXhAu4KcxQoV4YWtWEPDhfK 0Wwg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=kt6BtTKl; 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 x18-20020a05620a099200b00767185b2dfasi3626952qkx.622.2023.10.21.23.13.49 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sat, 21 Oct 2023 23:13:50 -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=kt6BtTKl; 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 1quRaA-0001HF-CO; Sun, 22 Oct 2023 02:05:02 -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 1quRa4-0000pg-8p for qemu-devel@nongnu.org; Sun, 22 Oct 2023 02:04:56 -0400 Received: from mail-oi1-x233.google.com ([2607:f8b0:4864:20::233]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1quRZz-0002GZ-Rh for qemu-devel@nongnu.org; Sun, 22 Oct 2023 02:04:53 -0400 Received: by mail-oi1-x233.google.com with SMTP id 5614622812f47-3b2e4107f47so1690700b6e.2 for ; Sat, 21 Oct 2023 23:04:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1697954690; x=1698559490; 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=sf/xioMDuWilBydMcWkl4WctY3+1Sv1VJWom1zZiwnw=; b=kt6BtTKlUsva75gGkeGH/k29wVFpW2Wz8u30pc1NeHTOGDpeA63q4XSTz3tg0cFZz8 KuuXzSatmLiNg9Q+x4seC9RKbm27esdn4+BnOMgznmq1PzCfnH53fG1yI51T7nisRC7Y 7YDPyIDwftY7gPPualFPSlAHWcyhlYTbG7mT1TCEGmmE5pkZynO6/W0LRFvL2AXs/Xb3 gRMqTNIjg4oj2JWRdQNbGlGip1WxXnnm8xQtd+w36QpzihWjrlg+Uz8Kto4CFvWCZFG7 aOax9QAQKQCVky/MU8rNvAsHAglgwfZFVWq970Q9RZmetXk8WJfjnjcY8UyvPlAMrvth +nKg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697954690; x=1698559490; 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=sf/xioMDuWilBydMcWkl4WctY3+1Sv1VJWom1zZiwnw=; b=SxiLIMdiqdTfF3cN4nxaAdJfdg893/5E0kYca7vsW6lyrs1yASNdynP5KzNsVypKoE rtpN0x0aW7GeOlhLxZulWIVkqZnbqbOZbTmRp/3nnT7PhITBo0u2SzPJBlQoYbyfiOFy 36qlTsp+sSlFpRKmtH48E2ZxGHiuT5bKul2ohy/K5pubJBh0A42A4zCTp2oV8pgik8QX pZ1b4A+I4ntl2fV+VdbB0ydlY5HBPSSM9TCRQWjkTTtAKvIqvUWB4qHgG1ON7Sy5rDQJ jsH9YFMkEn+OgU0dkA8fnS60kZ7z6iWJkLMZoj6sTdMjpLLAtZp6cJ1W48FaKFrOjOYn Tj5Q== X-Gm-Message-State: AOJu0Yzyki6v+UuQzdyq+Sozv79+uF6GFmlYmhLTFkFxvQ7NMveSxJdw OXIAGuCegKpQhbH5oPIOg+cDUAnbSlH3mWYMLJ0= X-Received: by 2002:a05:6808:b29:b0:3b2:f576:3f97 with SMTP id t9-20020a0568080b2900b003b2f5763f97mr6583717oij.12.1697954690248; Sat, 21 Oct 2023 23:04:50 -0700 (PDT) Received: from stoup.. ([71.212.149.95]) by smtp.gmail.com with ESMTPSA id fb13-20020a056a002d8d00b0068a46cd4120sm4007373pfb.199.2023.10.21.23.04.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 21 Oct 2023 23:04:49 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: mark.cave-ayland@ilande.co.uk Subject: [PATCH v4 58/90] target/sparc: Merge LDFSR, LDXFSR implementations Date: Sat, 21 Oct 2023 22:59:59 -0700 Message-Id: <20231022060031.490251-59-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231022060031.490251-1-richard.henderson@linaro.org> References: <20231022060031.490251-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::233; envelope-from=richard.henderson@linaro.org; helo=mail-oi1-x233.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 Combine the helper to a single set_fsr(). Perform the mask and merge inline. Signed-off-by: Richard Henderson --- target/sparc/helper.h | 3 +-- target/sparc/fop_helper.c | 17 ++-------------- target/sparc/translate.c | 42 ++++++++++++--------------------------- 3 files changed, 16 insertions(+), 46 deletions(-) diff --git a/target/sparc/helper.h b/target/sparc/helper.h index b116ddcb29..790752467f 100644 --- a/target/sparc/helper.h +++ b/target/sparc/helper.h @@ -42,7 +42,7 @@ DEF_HELPER_FLAGS_4(ld_asi, TCG_CALL_NO_WG, i64, env, tl, int, i32) DEF_HELPER_FLAGS_5(st_asi, TCG_CALL_NO_WG, void, env, tl, i64, int, i32) #endif DEF_HELPER_FLAGS_1(check_ieee_exceptions, TCG_CALL_NO_WG, tl, env) -DEF_HELPER_FLAGS_3(ldfsr, TCG_CALL_NO_RWG, tl, env, tl, i32) +DEF_HELPER_FLAGS_2(set_fsr, TCG_CALL_NO_RWG, void, env, tl) DEF_HELPER_FLAGS_1(fabss, TCG_CALL_NO_RWG_SE, f32, f32) DEF_HELPER_FLAGS_2(fsqrts, TCG_CALL_NO_RWG, f32, env, f32) DEF_HELPER_FLAGS_2(fsqrtd, TCG_CALL_NO_RWG, f64, env, f64) @@ -54,7 +54,6 @@ DEF_HELPER_FLAGS_1(fsqrtq, TCG_CALL_NO_RWG, void, env) DEF_HELPER_FLAGS_1(fcmpq, TCG_CALL_NO_WG, tl, env) DEF_HELPER_FLAGS_1(fcmpeq, TCG_CALL_NO_WG, tl, env) #ifdef TARGET_SPARC64 -DEF_HELPER_FLAGS_3(ldxfsr, TCG_CALL_NO_RWG, tl, env, tl, i64) DEF_HELPER_FLAGS_1(fabsd, TCG_CALL_NO_RWG_SE, f64, f64) DEF_HELPER_FLAGS_3(fcmps_fcc1, TCG_CALL_NO_WG, tl, env, f32, f32) DEF_HELPER_FLAGS_3(fcmps_fcc2, TCG_CALL_NO_WG, tl, env, f32, f32) diff --git a/target/sparc/fop_helper.c b/target/sparc/fop_helper.c index f54fa9b959..0f8aa3abcd 100644 --- a/target/sparc/fop_helper.c +++ b/target/sparc/fop_helper.c @@ -382,20 +382,7 @@ static void set_fsr(CPUSPARCState *env, target_ulong fsr) set_float_rounding_mode(rnd_mode, &env->fp_status); } -target_ulong helper_ldfsr(CPUSPARCState *env, target_ulong old_fsr, - uint32_t new_fsr) +void helper_set_fsr(CPUSPARCState *env, target_ulong fsr) { - old_fsr = (new_fsr & FSR_LDFSR_MASK) | (old_fsr & FSR_LDFSR_OLDMASK); - set_fsr(env, old_fsr); - return old_fsr; + set_fsr(env, fsr); } - -#ifdef TARGET_SPARC64 -target_ulong helper_ldxfsr(CPUSPARCState *env, target_ulong old_fsr, - uint64_t new_fsr) -{ - old_fsr = (new_fsr & FSR_LDXFSR_MASK) | (old_fsr & FSR_LDXFSR_OLDMASK); - set_fsr(env, old_fsr); - return old_fsr; -} -#endif diff --git a/target/sparc/translate.c b/target/sparc/translate.c index ef71fbabfe..df15ff0ee6 100644 --- a/target/sparc/translate.c +++ b/target/sparc/translate.c @@ -58,7 +58,8 @@ #define gen_helper_retry(E) qemu_build_not_reached() #define gen_helper_udivx(D, E, A, B) qemu_build_not_reached() #define gen_helper_sdivx(D, E, A, B) qemu_build_not_reached() -#define gen_helper_ldxfsr(R, E, X, Y) qemu_build_not_reached() +#define FSR_LDXFSR_MASK ({ qemu_build_not_reached(); 0; }) +#define FSR_LDXFSR_OLDMASK ({ qemu_build_not_reached(); 0; }) # ifdef CONFIG_USER_ONLY static void gen_helper_ld_asi(TCGv_i64 r, TCGv_env e, TCGv a, TCGv_i32 asi, TCGv_i32 mop) @@ -4840,44 +4841,27 @@ static bool trans_STDFQ(DisasContext *dc, arg_STDFQ *a) return true; } -static bool trans_LDFSR(DisasContext *dc, arg_r_r_ri *a) +static bool do_ldfsr(DisasContext *dc, arg_r_r_ri *a, MemOp mop, + target_ulong new_mask, target_ulong old_mask) { - TCGv addr; - TCGv_i32 tmp; - - addr = gen_ldst_addr(dc, a->rs1, a->imm, a->rs2_or_imm); + TCGv tmp, addr = gen_ldst_addr(dc, a->rs1, a->imm, a->rs2_or_imm); if (addr == NULL) { return false; } if (gen_trap_ifnofpu(dc)) { return true; } - tmp = tcg_temp_new_i32(); - tcg_gen_qemu_ld_i32(tmp, addr, dc->mem_idx, MO_TEUL | MO_ALIGN); - gen_helper_ldfsr(cpu_fsr, tcg_env, cpu_fsr, tmp); + tmp = tcg_temp_new(); + tcg_gen_qemu_ld_tl(tmp, addr, dc->mem_idx, mop | MO_ALIGN); + tcg_gen_andi_tl(tmp, tmp, new_mask); + tcg_gen_andi_tl(cpu_fsr, cpu_fsr, old_mask); + tcg_gen_or_tl(cpu_fsr, cpu_fsr, tmp); + gen_helper_set_fsr(tcg_env, cpu_fsr); return advance_pc(dc); } -static bool trans_LDXFSR(DisasContext *dc, arg_r_r_ri *a) -{ - TCGv addr; - TCGv_i64 tmp; - - if (!avail_64(dc)) { - return false; - } - addr = gen_ldst_addr(dc, a->rs1, a->imm, a->rs2_or_imm); - if (addr == NULL) { - return false; - } - if (gen_trap_ifnofpu(dc)) { - return true; - } - tmp = tcg_temp_new_i64(); - tcg_gen_qemu_ld_i64(tmp, addr, dc->mem_idx, MO_TEUQ | MO_ALIGN); - gen_helper_ldxfsr(cpu_fsr, tcg_env, cpu_fsr, tmp); - return advance_pc(dc); -} +TRANS(LDFSR, ALL, do_ldfsr, a, MO_TEUL, FSR_LDFSR_MASK, FSR_LDFSR_OLDMASK) +TRANS(LDXFSR, 64, do_ldfsr, a, MO_TEUQ, FSR_LDXFSR_MASK, FSR_LDXFSR_OLDMASK) static bool do_stfsr(DisasContext *dc, arg_r_r_ri *a, MemOp mop) { From patchwork Sun Oct 22 06:00:00 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 736966 Delivered-To: patch@linaro.org Received: by 2002:adf:dd81:0:b0:32d:baff:b0ca with SMTP id x1csp1005802wrl; Sat, 21 Oct 2023 23:12:29 -0700 (PDT) X-Google-Smtp-Source: AGHT+IH8+J4evu6qsVpTWUQ+uxA3fOh2xh+AV3PJp2KqouXIAhT1iyyW5EV99kzx/qPeZS8WUVuj X-Received: by 2002:ac8:598d:0:b0:410:60a4:ffc7 with SMTP id e13-20020ac8598d000000b0041060a4ffc7mr8307463qte.10.1697955149431; Sat, 21 Oct 2023 23:12:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697955149; cv=none; d=google.com; s=arc-20160816; b=FR3IH7pxqnjSDMYshWOBPypILUQx/6UVb8SarYM+wP0NHBh3+s0xG50vB0uMUlVLNl cwa3fOgE5Bdox3wo4CaLnhZ09QPKyArDqD6P7fK/L5fX9azNLHiMozP42sR8b2V63+zl BJNdIsLv+OsaywfCIQy34+OiR58inc0Jn2Xvp9fCWBCv8sEdPBiLj6zquBj08y9kMMEU coFsrevBHMHpv+cD896g7bT3S30PcbUp5MXZ88SLFBk12fqSm1iPVcUbaroIDn6rPnR8 hMlpeiu8vBINfFVCearLy7lseirGTE9BDJEeXsTGiTXawRO36p7ShH18bfCgzuwsH9gg INrw== 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=U5QqxOgFXORgACa6u4z9brFJBZqP6gkgM5cgRFzA2GU=; fh=TYrED6TOMxGX0VC4GtjviASLbYyJe19+7/tKWjN44KQ=; b=S3mJmTs/7APXZyENE3s3YYk8JKCriOzws4z0nl3TZUA8hwRofz77DienCIILR4TE8Y AR811KDkQWXFfeEjMzv4azeh+HeVuGCqOzq6KgbWGqD34C2xSY1AYyfL0LyPoqogGULI R8Oo4CInvyHu0nmABIuWLJx0QquIwuzsy2WEg9FCgkybUD49ciDB7UwSByOQNHSIVPIv +uzSb1SCitV59L5FTV/8H1/CBBAthqZkdIs3UJJq2OY/Dzkl+Mm7q6DiRHTX2WyMJl+6 hE6aoSH1buaWR5e6fu9axlngMjjarBnEfIGhWyQXXJ3QxRmvJI/+N5Xdc1qN4ZpYe99r ffpA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="E/wVPkgA"; 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 bp11-20020a05622a1b8b00b0041987badccasi3572067qtb.233.2023.10.21.23.12.29 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sat, 21 Oct 2023 23:12:29 -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="E/wVPkgA"; 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 1quRay-0004GM-Pl; Sun, 22 Oct 2023 02:05:52 -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 1quRa7-000155-90 for qemu-devel@nongnu.org; Sun, 22 Oct 2023 02:04:59 -0400 Received: from mail-oo1-xc34.google.com ([2607:f8b0:4864:20::c34]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1quRa2-0002Gg-04 for qemu-devel@nongnu.org; Sun, 22 Oct 2023 02:04:58 -0400 Received: by mail-oo1-xc34.google.com with SMTP id 006d021491bc7-57babef76deso1344453eaf.0 for ; Sat, 21 Oct 2023 23:04:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1697954691; x=1698559491; 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=U5QqxOgFXORgACa6u4z9brFJBZqP6gkgM5cgRFzA2GU=; b=E/wVPkgAtVgtSEEnbXJDRz3bM11OSLevcpMg2O8GFZMyr6PfbCdDFq3UL910gaMX+g 1dG9RbPXaL2AI1FKGb3YFCI3qEm9y+YpVhwvD/ZwpWtBlzrOuNwMQuPrFMnGpNtB3/+5 NLGFy2kQlQhM4k/oyH0CLHiSkV3tPhGLC31HyBFrF2IqO94H8Da8WVWGW1dfVhy7dsAG sZ24BRrfK5HWSqO6OV0ZGlOw7YP4hsFzYLT13CYPfxtZC6vECcH2XLNr6y+DwPGEuq+A CeWYSb49EFDR1pSR0hZy05BcapmVlnzfKbzF571/f/zdFV6/QvRitpr8wRKqEY6/OCak VPIw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697954691; x=1698559491; 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=U5QqxOgFXORgACa6u4z9brFJBZqP6gkgM5cgRFzA2GU=; b=jjhdvTQvktce6y9RfxzcIpl7s+Ys57mpTcSjN3KexGiYrwhzxLiyH93z3YJkC60ltj OuujMn2Qm2sRKCN2HwTJOCJR6GUCfkgHwYQI72YTvFxCSn33npsv4hvwLsfidIdTZV9C TQ4s1ectU4TELhpJffM0UrBdCmyxa5aEp/uoTLH12na3gWGwvbTs+3hzfSJD3oPHYscB 5AN+sjyLBBl1v6VoIrg9cea/gJ2kqby8hxoWKlOG12QAyh7iHQPOy9GpAapmZlc5JjQK tJ1TOKflzcr8dcov3JSolGQp0/8JnN3PHszHQT4G47iHI5p2oXqQFiIh+O4ZUkRUpL2n N5ag== X-Gm-Message-State: AOJu0YzabOICjQVXYpdIaqp4O1LJk2ILOxIREhMHlrZkG7TWK78OFcM+ Nf+4nzl4hbgXMey3ULBpMSlUez+PWMs1D/4agZk= X-Received: by 2002:a05:6358:33a6:b0:134:fdfc:4319 with SMTP id i38-20020a05635833a600b00134fdfc4319mr6770229rwd.20.1697954691120; Sat, 21 Oct 2023 23:04:51 -0700 (PDT) Received: from stoup.. ([71.212.149.95]) by smtp.gmail.com with ESMTPSA id fb13-20020a056a002d8d00b0068a46cd4120sm4007373pfb.199.2023.10.21.23.04.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 21 Oct 2023 23:04:50 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: mark.cave-ayland@ilande.co.uk Subject: [PATCH v4 59/90] target/sparc: Move EDGE* to decodetree Date: Sat, 21 Oct 2023 23:00:00 -0700 Message-Id: <20231022060031.490251-60-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231022060031.490251-1-richard.henderson@linaro.org> References: <20231022060031.490251-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::c34; envelope-from=richard.henderson@linaro.org; helo=mail-oo1-xc34.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 | 22 +++- target/sparc/translate.c | 269 ++++++++++++++++---------------------- 2 files changed, 131 insertions(+), 160 deletions(-) diff --git a/target/sparc/insns.decode b/target/sparc/insns.decode index 5df3b1add4..a9630509bd 100644 --- a/target/sparc/insns.decode +++ b/target/sparc/insns.decode @@ -35,6 +35,9 @@ CALL 01 i:s30 @r_r_ri_cc0 .. rd:5 ...... rs1:5 imm:1 rs2_or_imm:s13 &r_r_ri_cc cc=0 @r_r_ri_cc1 .. rd:5 ...... rs1:5 imm:1 rs2_or_imm:s13 &r_r_ri_cc cc=1 +&r_r_r rd rs1 rs2 +@r_r_r .. rd:5 ...... rs1:5 . ........ rs2:5 &r_r_r + { [ STBAR 10 00000 101000 01111 0 0000000000000 @@ -231,7 +234,24 @@ 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 +{ + [ + EDGE8cc 10 ..... 110110 ..... 0 0000 0000 ..... @r_r_r + EDGE8N 10 ..... 110110 ..... 0 0000 0001 ..... @r_r_r + EDGE8Lcc 10 ..... 110110 ..... 0 0000 0010 ..... @r_r_r + EDGE8LN 10 ..... 110110 ..... 0 0000 0011 ..... @r_r_r + EDGE16cc 10 ..... 110110 ..... 0 0000 0100 ..... @r_r_r + EDGE16N 10 ..... 110110 ..... 0 0000 0101 ..... @r_r_r + EDGE16Lcc 10 ..... 110110 ..... 0 0000 0110 ..... @r_r_r + EDGE16LN 10 ..... 110110 ..... 0 0000 0111 ..... @r_r_r + EDGE32cc 10 ..... 110110 ..... 0 0000 1000 ..... @r_r_r + EDGE32N 10 ..... 110110 ..... 0 0000 1001 ..... @r_r_r + EDGE32Lcc 10 ..... 110110 ..... 0 0000 1010 ..... @r_r_r + EDGE32LN 10 ..... 110110 ..... 0 0000 1011 ..... @r_r_r + ] + NCP 10 ----- 110110 ----- --------- ----- # v8 CPop1 +} + NCP 10 ----- 110111 ----- --------- ----- # v8 CPop2 ## diff --git a/target/sparc/translate.c b/target/sparc/translate.c index df15ff0ee6..eeb22d64c9 100644 --- a/target/sparc/translate.c +++ b/target/sparc/translate.c @@ -2713,93 +2713,6 @@ static void gen_load_trap_state_at_tl(TCGv_ptr r_tsptr) } } -static void gen_edge(DisasContext *dc, TCGv dst, TCGv s1, TCGv s2, - int width, bool cc, bool left) -{ - TCGv lo1, lo2; - uint64_t amask, tabl, tabr; - int shift, imask, omask; - - if (cc) { - tcg_gen_mov_tl(cpu_cc_src, s1); - tcg_gen_mov_tl(cpu_cc_src2, s2); - tcg_gen_sub_tl(cpu_cc_dst, s1, s2); - tcg_gen_movi_i32(cpu_cc_op, CC_OP_SUB); - dc->cc_op = CC_OP_SUB; - } - - /* Theory of operation: there are two tables, left and right (not to - be confused with the left and right versions of the opcode). These - are indexed by the low 3 bits of the inputs. To make things "easy", - these tables are loaded into two constants, TABL and TABR below. - The operation index = (input & imask) << shift calculates the index - into the constant, while val = (table >> index) & omask calculates - the value we're looking for. */ - switch (width) { - case 8: - imask = 0x7; - shift = 3; - omask = 0xff; - if (left) { - tabl = 0x80c0e0f0f8fcfeffULL; - tabr = 0xff7f3f1f0f070301ULL; - } else { - tabl = 0x0103070f1f3f7fffULL; - tabr = 0xfffefcf8f0e0c080ULL; - } - break; - case 16: - imask = 0x6; - shift = 1; - omask = 0xf; - if (left) { - tabl = 0x8cef; - tabr = 0xf731; - } else { - tabl = 0x137f; - tabr = 0xfec8; - } - break; - case 32: - imask = 0x4; - shift = 0; - omask = 0x3; - if (left) { - tabl = (2 << 2) | 3; - tabr = (3 << 2) | 1; - } else { - tabl = (1 << 2) | 3; - tabr = (3 << 2) | 2; - } - break; - default: - abort(); - } - - lo1 = tcg_temp_new(); - lo2 = tcg_temp_new(); - tcg_gen_andi_tl(lo1, s1, imask); - tcg_gen_andi_tl(lo2, s2, imask); - tcg_gen_shli_tl(lo1, lo1, shift); - tcg_gen_shli_tl(lo2, lo2, shift); - - tcg_gen_shr_tl(lo1, tcg_constant_tl(tabl), lo1); - tcg_gen_shr_tl(lo2, tcg_constant_tl(tabr), lo2); - tcg_gen_andi_tl(lo1, lo1, omask); - tcg_gen_andi_tl(lo2, lo2, omask); - - amask = -8; - if (AM_CHECK(dc)) { - amask &= 0xffffffffULL; - } - tcg_gen_andi_tl(s1, s1, amask); - tcg_gen_andi_tl(s2, s2, amask); - - /* Compute dst = (s1 == s2 ? lo1 : lo1 & lo2). */ - tcg_gen_and_tl(lo2, lo2, lo1); - tcg_gen_movcond_tl(TCG_COND_EQ, dst, s1, s2, lo1, lo2); -} - static void gen_alignaddr(TCGv dst, TCGv s1, TCGv s2, bool left) { TCGv tmp = tcg_temp_new(); @@ -2866,6 +2779,8 @@ static int extract_qfpreg(DisasContext *dc, int x) #define avail_HYPV(C) ((C)->def->features & CPU_FEATURE_HYPV) #define avail_MUL(C) ((C)->def->features & CPU_FEATURE_MUL) #define avail_POWERDOWN(C) ((C)->def->features & CPU_FEATURE_POWERDOWN) +#define avail_VIS1(C) ((C)->def->features & CPU_FEATURE_VIS1) +#define avail_VIS2(C) ((C)->def->features & CPU_FEATURE_VIS2) /* Default case for non jump instructions. */ static bool advance_pc(DisasContext *dc) @@ -4341,6 +4256,113 @@ static bool trans_MULScc(DisasContext *dc, arg_r_r_ri_cc *a) return do_arith(dc, a, CC_OP_ADD, gen_op_mulscc, NULL); } +static bool gen_edge(DisasContext *dc, arg_r_r_r *a, + int width, bool cc, bool left) +{ + TCGv dst, s1, s2, lo1, lo2; + uint64_t amask, tabl, tabr; + int shift, imask, omask; + + dst = gen_dest_gpr(dc, a->rd); + s1 = gen_load_gpr(dc, a->rs1); + s2 = gen_load_gpr(dc, a->rs2); + + if (cc) { + tcg_gen_mov_tl(cpu_cc_src, s1); + tcg_gen_mov_tl(cpu_cc_src2, s2); + tcg_gen_sub_tl(cpu_cc_dst, s1, s2); + tcg_gen_movi_i32(cpu_cc_op, CC_OP_SUB); + dc->cc_op = CC_OP_SUB; + } + + /* + * Theory of operation: there are two tables, left and right (not to + * be confused with the left and right versions of the opcode). These + * are indexed by the low 3 bits of the inputs. To make things "easy", + * these tables are loaded into two constants, TABL and TABR below. + * The operation index = (input & imask) << shift calculates the index + * into the constant, while val = (table >> index) & omask calculates + * the value we're looking for. + */ + switch (width) { + case 8: + imask = 0x7; + shift = 3; + omask = 0xff; + if (left) { + tabl = 0x80c0e0f0f8fcfeffULL; + tabr = 0xff7f3f1f0f070301ULL; + } else { + tabl = 0x0103070f1f3f7fffULL; + tabr = 0xfffefcf8f0e0c080ULL; + } + break; + case 16: + imask = 0x6; + shift = 1; + omask = 0xf; + if (left) { + tabl = 0x8cef; + tabr = 0xf731; + } else { + tabl = 0x137f; + tabr = 0xfec8; + } + break; + case 32: + imask = 0x4; + shift = 0; + omask = 0x3; + if (left) { + tabl = (2 << 2) | 3; + tabr = (3 << 2) | 1; + } else { + tabl = (1 << 2) | 3; + tabr = (3 << 2) | 2; + } + break; + default: + abort(); + } + + lo1 = tcg_temp_new(); + lo2 = tcg_temp_new(); + tcg_gen_andi_tl(lo1, s1, imask); + tcg_gen_andi_tl(lo2, s2, imask); + tcg_gen_shli_tl(lo1, lo1, shift); + tcg_gen_shli_tl(lo2, lo2, shift); + + tcg_gen_shr_tl(lo1, tcg_constant_tl(tabl), lo1); + tcg_gen_shr_tl(lo2, tcg_constant_tl(tabr), lo2); + tcg_gen_andi_tl(lo1, lo1, omask); + tcg_gen_andi_tl(lo2, lo2, omask); + + amask = address_mask_i(dc, -8); + tcg_gen_andi_tl(s1, s1, amask); + tcg_gen_andi_tl(s2, s2, amask); + + /* Compute dst = (s1 == s2 ? lo1 : lo1 & lo2). */ + tcg_gen_and_tl(lo2, lo2, lo1); + tcg_gen_movcond_tl(TCG_COND_EQ, dst, s1, s2, lo1, lo2); + + gen_store_gpr(dc, a->rd, dst); + return advance_pc(dc); +} + +TRANS(EDGE8cc, VIS1, gen_edge, a, 8, 1, 0) +TRANS(EDGE8Lcc, VIS1, gen_edge, a, 8, 1, 1) +TRANS(EDGE16cc, VIS1, gen_edge, a, 16, 1, 0) +TRANS(EDGE16Lcc, VIS1, gen_edge, a, 16, 1, 1) +TRANS(EDGE32cc, VIS1, gen_edge, a, 32, 1, 0) +TRANS(EDGE32Lcc, VIS1, gen_edge, a, 32, 1, 1) + +TRANS(EDGE8N, VIS2, gen_edge, a, 8, 0, 0) +TRANS(EDGE8LN, VIS2, gen_edge, a, 8, 0, 1) +TRANS(EDGE16N, VIS2, gen_edge, a, 16, 0, 0) +TRANS(EDGE16LN, VIS2, gen_edge, a, 16, 0, 1) +TRANS(EDGE32N, VIS2, gen_edge, a, 32, 0, 0) +TRANS(EDGE32LN, VIS2, gen_edge, a, 32, 0, 1) + static bool do_shift_r(DisasContext *dc, arg_shiftr *a, bool l, bool u) { TCGv dst, src1, src2; @@ -5240,89 +5262,18 @@ static void disas_sparc_legacy(DisasContext *dc, unsigned int insn) switch (opf) { case 0x000: /* VIS I edge8cc */ - CHECK_FPU_FEATURE(dc, VIS1); - cpu_src1 = gen_load_gpr(dc, rs1); - cpu_src2 = gen_load_gpr(dc, rs2); - gen_edge(dc, cpu_dst, cpu_src1, cpu_src2, 8, 1, 0); - gen_store_gpr(dc, rd, cpu_dst); - break; case 0x001: /* VIS II edge8n */ - CHECK_FPU_FEATURE(dc, VIS2); - cpu_src1 = gen_load_gpr(dc, rs1); - cpu_src2 = gen_load_gpr(dc, rs2); - gen_edge(dc, cpu_dst, cpu_src1, cpu_src2, 8, 0, 0); - gen_store_gpr(dc, rd, cpu_dst); - break; case 0x002: /* VIS I edge8lcc */ - CHECK_FPU_FEATURE(dc, VIS1); - cpu_src1 = gen_load_gpr(dc, rs1); - cpu_src2 = gen_load_gpr(dc, rs2); - gen_edge(dc, cpu_dst, cpu_src1, cpu_src2, 8, 1, 1); - gen_store_gpr(dc, rd, cpu_dst); - break; case 0x003: /* VIS II edge8ln */ - CHECK_FPU_FEATURE(dc, VIS2); - cpu_src1 = gen_load_gpr(dc, rs1); - cpu_src2 = gen_load_gpr(dc, rs2); - gen_edge(dc, cpu_dst, cpu_src1, cpu_src2, 8, 0, 1); - gen_store_gpr(dc, rd, cpu_dst); - break; case 0x004: /* VIS I edge16cc */ - CHECK_FPU_FEATURE(dc, VIS1); - cpu_src1 = gen_load_gpr(dc, rs1); - cpu_src2 = gen_load_gpr(dc, rs2); - gen_edge(dc, cpu_dst, cpu_src1, cpu_src2, 16, 1, 0); - gen_store_gpr(dc, rd, cpu_dst); - break; case 0x005: /* VIS II edge16n */ - CHECK_FPU_FEATURE(dc, VIS2); - cpu_src1 = gen_load_gpr(dc, rs1); - cpu_src2 = gen_load_gpr(dc, rs2); - gen_edge(dc, cpu_dst, cpu_src1, cpu_src2, 16, 0, 0); - gen_store_gpr(dc, rd, cpu_dst); - break; case 0x006: /* VIS I edge16lcc */ - CHECK_FPU_FEATURE(dc, VIS1); - cpu_src1 = gen_load_gpr(dc, rs1); - cpu_src2 = gen_load_gpr(dc, rs2); - gen_edge(dc, cpu_dst, cpu_src1, cpu_src2, 16, 1, 1); - gen_store_gpr(dc, rd, cpu_dst); - break; case 0x007: /* VIS II edge16ln */ - CHECK_FPU_FEATURE(dc, VIS2); - cpu_src1 = gen_load_gpr(dc, rs1); - cpu_src2 = gen_load_gpr(dc, rs2); - gen_edge(dc, cpu_dst, cpu_src1, cpu_src2, 16, 0, 1); - gen_store_gpr(dc, rd, cpu_dst); - break; case 0x008: /* VIS I edge32cc */ - CHECK_FPU_FEATURE(dc, VIS1); - cpu_src1 = gen_load_gpr(dc, rs1); - cpu_src2 = gen_load_gpr(dc, rs2); - gen_edge(dc, cpu_dst, cpu_src1, cpu_src2, 32, 1, 0); - gen_store_gpr(dc, rd, cpu_dst); - break; case 0x009: /* VIS II edge32n */ - CHECK_FPU_FEATURE(dc, VIS2); - cpu_src1 = gen_load_gpr(dc, rs1); - cpu_src2 = gen_load_gpr(dc, rs2); - gen_edge(dc, cpu_dst, cpu_src1, cpu_src2, 32, 0, 0); - gen_store_gpr(dc, rd, cpu_dst); - break; case 0x00a: /* VIS I edge32lcc */ - CHECK_FPU_FEATURE(dc, VIS1); - cpu_src1 = gen_load_gpr(dc, rs1); - cpu_src2 = gen_load_gpr(dc, rs2); - gen_edge(dc, cpu_dst, cpu_src1, cpu_src2, 32, 1, 1); - gen_store_gpr(dc, rd, cpu_dst); - break; case 0x00b: /* VIS II edge32ln */ - CHECK_FPU_FEATURE(dc, VIS2); - cpu_src1 = gen_load_gpr(dc, rs1); - cpu_src2 = gen_load_gpr(dc, rs2); - gen_edge(dc, cpu_dst, cpu_src1, cpu_src2, 32, 0, 1); - gen_store_gpr(dc, rd, cpu_dst); - break; + g_assert_not_reached(); /* in decodetree */ case 0x010: /* VIS I array8 */ CHECK_FPU_FEATURE(dc, VIS1); cpu_src1 = gen_load_gpr(dc, rs1); From patchwork Sun Oct 22 06:00:01 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 737001 Delivered-To: patch@linaro.org Received: by 2002:adf:dd81:0:b0:32d:baff:b0ca with SMTP id x1csp1006376wrl; Sat, 21 Oct 2023 23:14:55 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFEFSC09sIcDsxR8Hj0bo0AJIthI1tjInTTiDlm+2d0S4KOGncM9/f/5/xYs9FSaAU2LvRY X-Received: by 2002:a05:622a:58e:b0:3f8:4905:9533 with SMTP id c14-20020a05622a058e00b003f849059533mr7819995qtb.50.1697955295379; Sat, 21 Oct 2023 23:14:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697955295; cv=none; d=google.com; s=arc-20160816; b=TIURFLvR12Bqw/TwPMkZNBzC/eiiHEumKhaq6Rfx27cTHa9Vhj+LJP4ep3wUNIQVQi yvk0jeJNzB/8E+UG3UqXKftEtVAslaW2aYWm9/RVUBFygNC7PmkqJ0qBlNTbuU4FVwkQ B1TuzyiNa1sQv2MEc/Y07V8c+cfajU4FZebBZ7x2UsibVBi0lehbK1obrLK3i47CNeQs S7pTnc5O/ud0CKgeUOg9TpVcx6Z5UeyVsrc994Q/PpaCSaGL3y5q3ATxJ6mifH0Y/U14 Iy6uuWYCoM8DkHDKlIpoyPjCVfpujmztLjrbJHi2XjUnB984EblyX4DCDgLFTbaknSM+ C06Q== 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=SN7hYFcaRqlSL/9M4b670NiRTGmh+kO+P3lyFpCaU7c=; fh=TYrED6TOMxGX0VC4GtjviASLbYyJe19+7/tKWjN44KQ=; b=EGVOymjn2lYL8rLAFtfCyYLcpL4SgJ+UY2VcnukIX3olQ2HSZ3SuS92WimweEwIryM X+r0Uw854pNqZ85Y/8bVjfNSMQZQihIwspGFvYQaGmydVJeSN/kK1DoF/T3DWuIAgOCF ieUsEzFrfc6W1deFOBIkJtxbHw7uAVwFk0Ux7NXsJVB7nRJZYEptu+UpCYELw5wao/ki QtortkbHL20Fx7siAukjbg1NnwLax9aH1FlK/M7NeAGOf4dXEBWddA/Xpxx9bfc+OWDX E7SfGXuMauM+2lqXQvlMVFYrnllX0phhxJJRUaE9YOuhMKX7rresWHDnvy8dOPAgGMgJ 807Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=psPMcWVd; 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 j22-20020ac85c56000000b00417f4c0115asi3732845qtj.509.2023.10.21.23.14.55 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sat, 21 Oct 2023 23:14:55 -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=psPMcWVd; 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 1quRau-00043Q-Mm; Sun, 22 Oct 2023 02:05:48 -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 1quRa9-0001GS-Lz for qemu-devel@nongnu.org; Sun, 22 Oct 2023 02:05:01 -0400 Received: from mail-oi1-x229.google.com ([2607:f8b0:4864:20::229]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1quRa3-0002Gx-Sa for qemu-devel@nongnu.org; Sun, 22 Oct 2023 02:05:01 -0400 Received: by mail-oi1-x229.google.com with SMTP id 5614622812f47-3b3e13fc1f7so1677771b6e.0 for ; Sat, 21 Oct 2023 23:04:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1697954692; x=1698559492; 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=SN7hYFcaRqlSL/9M4b670NiRTGmh+kO+P3lyFpCaU7c=; b=psPMcWVdVdcYYMZrRrFpuaSOB0FmQhzR/75sdUsDpvPoy4DkixE8vqygidrcZL3Myg Y6F2L3Vu09M2FDOYX26J1EASSNnYHuR1KxpKwDd5+OXQthhm6Cyt5ZUBCxYUTal2gZ38 +y+Z9ugZ0DD1Is9eQhJ2qnruAjmMI2bKzRPMKhqdyl+6q6IdbhPEFGiHZLZ/Poqn1vru s9fk3YwaNO1SxNagYoGliAgan09qshJxGLtAroy/aAYej2iwtt+nzd2osEpxjhF+yKY5 mM2dVkKpZhTxSq6i2cNHUdb1gLOkpKPmE1Qs/5VZIS5MsYqD+sKEk/Yl+d6IQ/rgN2BO PIVw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697954692; x=1698559492; 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=SN7hYFcaRqlSL/9M4b670NiRTGmh+kO+P3lyFpCaU7c=; b=lHItovN8ctheCs+JPWmGdYeu5VQ9sGZDJvV+pxWPYZpijN9dYE6+JUPf6xQZj7vTi/ a9Jq9HuOGmCznpOJ/WyVazi4xdpjrwWX4uVoYKCBFvQ1ABzj4koCTOpRJXL41gSHsbL5 L+Onu/xpg/qstxw3H8iWR46eF6/9hXAExbZ+6IpEDcZQZoaKp9UV1r1dGn7Rw/NOsTk4 Xetphngd8O0SpwighJ0rDDBvxoxQYp0Id/qqBTbbLTbIls0tbVqpfQIKUl2lpZmSHgd9 ZbhQM5S5NtrY/Rt0qUsOmrRzp3JRnTTloyI++nx1sIJYaRAb5u3kgqIV9h/wM+s7o3wt sQIQ== X-Gm-Message-State: AOJu0Yzq8b6EKYF3H7cZj9Ib5ZS5k+aPgWHmCNCxQiRlJ32YLgoj01zs LJxgJm9w4GhI/K4/dOafZoa1ibqmtrS34j3wwMI= X-Received: by 2002:a05:6358:339f:b0:14d:bad5:6adf with SMTP id i31-20020a056358339f00b0014dbad56adfmr8597850rwd.21.1697954691917; Sat, 21 Oct 2023 23:04:51 -0700 (PDT) Received: from stoup.. ([71.212.149.95]) by smtp.gmail.com with ESMTPSA id fb13-20020a056a002d8d00b0068a46cd4120sm4007373pfb.199.2023.10.21.23.04.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 21 Oct 2023 23:04:51 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: mark.cave-ayland@ilande.co.uk Subject: [PATCH v4 60/90] target/sparc: Move ARRAY* to decodetree Date: Sat, 21 Oct 2023 23:00:01 -0700 Message-Id: <20231022060031.490251-61-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231022060031.490251-1-richard.henderson@linaro.org> References: <20231022060031.490251-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::229; envelope-from=richard.henderson@linaro.org; helo=mail-oi1-x229.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 | 4 +++ target/sparc/translate.c | 54 ++++++++++++++++++++++++--------------- 2 files changed, 37 insertions(+), 21 deletions(-) diff --git a/target/sparc/insns.decode b/target/sparc/insns.decode index a9630509bd..b15ede5fd4 100644 --- a/target/sparc/insns.decode +++ b/target/sparc/insns.decode @@ -248,6 +248,10 @@ RETRY 10 00001 111110 00000 0 0000000000000 EDGE32N 10 ..... 110110 ..... 0 0000 1001 ..... @r_r_r EDGE32Lcc 10 ..... 110110 ..... 0 0000 1010 ..... @r_r_r EDGE32LN 10 ..... 110110 ..... 0 0000 1011 ..... @r_r_r + + ARRAY8 10 ..... 110110 ..... 0 0001 0000 ..... @r_r_r + ARRAY16 10 ..... 110110 ..... 0 0001 0010 ..... @r_r_r + ARRAY32 10 ..... 110110 ..... 0 0001 0100 ..... @r_r_r ] NCP 10 ----- 110110 ----- --------- ----- # v8 CPop1 } diff --git a/target/sparc/translate.c b/target/sparc/translate.c index eeb22d64c9..794e997a58 100644 --- a/target/sparc/translate.c +++ b/target/sparc/translate.c @@ -72,6 +72,10 @@ static void gen_helper_st_asi(TCGv_env e, TCGv a, TCGv_i64 r, g_assert_not_reached(); } # endif +static void gen_helper_array8(TCGv r, TCGv a, TCGv b) +{ + g_assert_not_reached(); +} #endif /* Dynamic PC, must exit to main loop. */ @@ -721,6 +725,18 @@ static void gen_op_popc(TCGv dst, TCGv src1, TCGv src2) tcg_gen_ctpop_tl(dst, src2); } +static void gen_op_array16(TCGv dst, TCGv src1, TCGv src2) +{ + gen_helper_array8(dst, src1, src2); + tcg_gen_shli_tl(dst, dst, 1); +} + +static void gen_op_array32(TCGv dst, TCGv src1, TCGv src2) +{ + gen_helper_array8(dst, src1, src2); + tcg_gen_shli_tl(dst, dst, 2); +} + // 1 static void gen_op_eval_ba(TCGv dst) { @@ -4363,6 +4379,22 @@ TRANS(EDGE16LN, VIS2, gen_edge, a, 16, 0, 1) TRANS(EDGE32N, VIS2, gen_edge, a, 32, 0, 0) TRANS(EDGE32LN, VIS2, gen_edge, a, 32, 0, 1) +static bool do_rrr(DisasContext *dc, arg_r_r_r *a, + void (*func)(TCGv, TCGv, TCGv)) +{ + TCGv dst = gen_dest_gpr(dc, a->rd); + TCGv src1 = gen_load_gpr(dc, a->rs1); + TCGv src2 = gen_load_gpr(dc, a->rs2); + + func(dst, src1, src2); + gen_store_gpr(dc, a->rd, dst); + return advance_pc(dc); +} + +TRANS(ARRAY8, VIS1, do_rrr, a, gen_helper_array8) +TRANS(ARRAY16, VIS1, do_rrr, a, gen_op_array16) +TRANS(ARRAY32, VIS1, do_rrr, a, gen_op_array32) + static bool do_shift_r(DisasContext *dc, arg_shiftr *a, bool l, bool u) { TCGv dst, src1, src2; @@ -5273,30 +5305,10 @@ static void disas_sparc_legacy(DisasContext *dc, unsigned int insn) case 0x009: /* VIS II edge32n */ case 0x00a: /* VIS I edge32lcc */ case 0x00b: /* VIS II edge32ln */ - g_assert_not_reached(); /* in decodetree */ case 0x010: /* VIS I array8 */ - CHECK_FPU_FEATURE(dc, VIS1); - cpu_src1 = gen_load_gpr(dc, rs1); - cpu_src2 = gen_load_gpr(dc, rs2); - gen_helper_array8(cpu_dst, cpu_src1, cpu_src2); - gen_store_gpr(dc, rd, cpu_dst); - break; case 0x012: /* VIS I array16 */ - CHECK_FPU_FEATURE(dc, VIS1); - cpu_src1 = gen_load_gpr(dc, rs1); - cpu_src2 = gen_load_gpr(dc, rs2); - gen_helper_array8(cpu_dst, cpu_src1, cpu_src2); - tcg_gen_shli_i64(cpu_dst, cpu_dst, 1); - gen_store_gpr(dc, rd, cpu_dst); - break; case 0x014: /* VIS I array32 */ - CHECK_FPU_FEATURE(dc, VIS1); - cpu_src1 = gen_load_gpr(dc, rs1); - cpu_src2 = gen_load_gpr(dc, rs2); - gen_helper_array8(cpu_dst, cpu_src1, cpu_src2); - tcg_gen_shli_i64(cpu_dst, cpu_dst, 2); - gen_store_gpr(dc, rd, cpu_dst); - break; + g_assert_not_reached(); /* in decodetree */ case 0x018: /* VIS I alignaddr */ CHECK_FPU_FEATURE(dc, VIS1); cpu_src1 = gen_load_gpr(dc, rs1); From patchwork Sun Oct 22 06:00:02 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 736993 Delivered-To: patch@linaro.org Received: by 2002:adf:dd81:0:b0:32d:baff:b0ca with SMTP id x1csp1006273wrl; Sat, 21 Oct 2023 23:14:32 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFqkK453JTqA/d5w+1T5xbbws9nN6ak1z/BD/l8Fi8gjdCNTN/FptQFcsHUphS+QWuZuUiZ X-Received: by 2002:a05:620a:4015:b0:774:2e8f:2170 with SMTP id h21-20020a05620a401500b007742e8f2170mr5681990qko.4.1697955272696; Sat, 21 Oct 2023 23:14:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697955272; cv=none; d=google.com; s=arc-20160816; b=DZnkHULrxn4XB9N3sKi11mCor1bukqXe2sU/PBRMOP4G4Pr2cdkjGiaDW87EBBQ84A Gdy7BP3wvYhJkK6jbEHhi0f8PIZH5hmFPI90nEJa6rKkLv2+KrMtjEX7+9nQmzTw566U 6G7ldPl2+0qc4rYoqkpra79tifgIt9C3wOKm4EXuxzXSFExvBC4iF3FA6j11N/wg1pZ0 8dQ4tRQJ3Zmf4WT3SX/PT0wLd79SFXuWK91JBdc7UHSHWvIUtAx4TT4HGj5PJZN+f32q UXvvfOrZNpzXC6Yzb/jVeOUYCp3IsEFSMm5Uwvuvz9kCgfJkuzbo+cANJ/J8OCa+Had3 jrFw== 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=0dGIKHgnks7VMeLKQBJKmStofpnFqBucPOv5sSVTrkA=; fh=TYrED6TOMxGX0VC4GtjviASLbYyJe19+7/tKWjN44KQ=; b=DM9atxQzHcVs0S64f8EM4pEaBpJ2afIx+gMqR+G2e6faFLYZ5fBG+yMsmahmUaHrny rp7EitC+7HjZUC4sCaITIQy0bccG7v2rdp7OmccmBppldzqKjXU6tJSCGkNzooXV+a8b qPrl+AccryHzWR8R89cqOxMh1tiecw3q88kb6ECLtlzIbUtptE47WrpV8CwwcskRmTdN VsVWMENE+lRBMvO8OmJUUWcgyV/NcyY/oEgGEGCKDdMqi0lBd2FViapDY1mGmZUGkeUU 7+K1dyegH3RcJwJp8BN5sEJwMkxfK7tpKgZQhWtFtFrxQWK5pyV4U2+r5ZHBA6xrD1XN jfOQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=UPg0JPYl; 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 u6-20020a05620a120600b0076da127884csi3589583qkj.223.2023.10.21.23.14.32 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sat, 21 Oct 2023 23:14:32 -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=UPg0JPYl; 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 1quRar-0003pe-G2; Sun, 22 Oct 2023 02:05:45 -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 1quRa6-00011s-Oc for qemu-devel@nongnu.org; Sun, 22 Oct 2023 02:04:58 -0400 Received: from mail-oo1-xc31.google.com ([2607:f8b0:4864:20::c31]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1quRa2-0002H8-Tg for qemu-devel@nongnu.org; Sun, 22 Oct 2023 02:04:58 -0400 Received: by mail-oo1-xc31.google.com with SMTP id 006d021491bc7-581edcde26cso1439256eaf.1 for ; Sat, 21 Oct 2023 23:04:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1697954693; x=1698559493; 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=0dGIKHgnks7VMeLKQBJKmStofpnFqBucPOv5sSVTrkA=; b=UPg0JPYlrpv8pOAo1ZNEi2C8yOT+CSYyHbWlzFQuVTNlMzRfTictkRJqSRpYiTHGzR XiDx/KwnmaHdFFDNelAZ+hnNnfqIfBs/LRMGjsDf8Xt8pdnGRXwHC9lxTPLZpRypaBny HI+oWNFcySs9agInxr605xnCE0Wuy+AFo8v4bqMHXp6RUoU/ZRqYj88kCWfcBKvjNutd lTzwlQkosRIx4+sNXRdeKbLP0U/YhO1j0rGngErq/tAZ45h9QEqCHRIQuIOLc8M4FQGE tMDOfenNk6KBvaAiu0+O8f8mAAxvZBxhGvo9WVduqSHjZzYz3GCYkhhckDgn8kskS7Rz 8g+g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697954693; x=1698559493; 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=0dGIKHgnks7VMeLKQBJKmStofpnFqBucPOv5sSVTrkA=; b=OueEaqFoAOSRe4r93rlAeGBDbLejzHmLzKb2T8LFOeVKxOiZscUntGdcVKkq3TB40X +3gqfnZMBZGcOGyEEdAAikOlum0jQVLIwrbgCUxPseMVbcILyB3j8Gn0xNCS4THJrUav WgT5kXZwZ8aRmCoMVjKjZMtT36+emcx1GkpijZSQ9e21xSpTQGdBklJgw8jJTwVD91e5 UmbB9hjUWKobzB9BSeiKfTcHI4zvd6a1zgdm+HKkT1HJPqNyL472VxaYGg3Sqs4chvK1 u0G/HeKB0pvDemQ+60isyb2gTiVLb5JEwr8xJvKHZDvhQNYYkyQYoCiomrTANcfpaVjf s49g== X-Gm-Message-State: AOJu0YydBFvp6rXVMqfKkI6CQrgekK/oMMxKuDRRmiiMjrzrDcadnEYq MLFe5MqniIkYHnnyfgOCI0WFjHIzuwt/s9EzYCM= X-Received: by 2002:a05:6358:7211:b0:166:e43e:6f5b with SMTP id h17-20020a056358721100b00166e43e6f5bmr9880292rwa.16.1697954692858; Sat, 21 Oct 2023 23:04:52 -0700 (PDT) Received: from stoup.. ([71.212.149.95]) by smtp.gmail.com with ESMTPSA id fb13-20020a056a002d8d00b0068a46cd4120sm4007373pfb.199.2023.10.21.23.04.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 21 Oct 2023 23:04:52 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: mark.cave-ayland@ilande.co.uk Subject: [PATCH v4 61/90] target/sparc: Move ADDRALIGN* to decodetree Date: Sat, 21 Oct 2023 23:00:02 -0700 Message-Id: <20231022060031.490251-62-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231022060031.490251-1-richard.henderson@linaro.org> References: <20231022060031.490251-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::c31; envelope-from=richard.henderson@linaro.org; helo=mail-oo1-xc31.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 | 3 +++ target/sparc/translate.c | 56 ++++++++++++++++++++++----------------- 2 files changed, 34 insertions(+), 25 deletions(-) diff --git a/target/sparc/insns.decode b/target/sparc/insns.decode index b15ede5fd4..f70423895e 100644 --- a/target/sparc/insns.decode +++ b/target/sparc/insns.decode @@ -252,6 +252,9 @@ RETRY 10 00001 111110 00000 0 0000000000000 ARRAY8 10 ..... 110110 ..... 0 0001 0000 ..... @r_r_r ARRAY16 10 ..... 110110 ..... 0 0001 0010 ..... @r_r_r ARRAY32 10 ..... 110110 ..... 0 0001 0100 ..... @r_r_r + + ALIGNADDR 10 ..... 110110 ..... 0 0001 1000 ..... @r_r_r + ALIGNADDRL 10 ..... 110110 ..... 0 0001 1010 ..... @r_r_r ] NCP 10 ----- 110110 ----- --------- ----- # v8 CPop1 } diff --git a/target/sparc/translate.c b/target/sparc/translate.c index 794e997a58..9b9281feb7 100644 --- a/target/sparc/translate.c +++ b/target/sparc/translate.c @@ -2729,18 +2729,6 @@ static void gen_load_trap_state_at_tl(TCGv_ptr r_tsptr) } } -static void gen_alignaddr(TCGv dst, TCGv s1, TCGv s2, bool left) -{ - TCGv tmp = tcg_temp_new(); - - tcg_gen_add_tl(tmp, s1, s2); - tcg_gen_andi_tl(dst, tmp, -8); - if (left) { - tcg_gen_neg_tl(tmp, tmp); - } - tcg_gen_deposit_tl(cpu_gsr, cpu_gsr, tmp, 0, 3); -} - static void gen_faligndata(TCGv dst, TCGv gsr, TCGv s1, TCGv s2) { TCGv t1, t2, shift; @@ -4395,6 +4383,36 @@ TRANS(ARRAY8, VIS1, do_rrr, a, gen_helper_array8) TRANS(ARRAY16, VIS1, do_rrr, a, gen_op_array16) TRANS(ARRAY32, VIS1, do_rrr, a, gen_op_array32) +static void gen_op_alignaddr(TCGv dst, TCGv s1, TCGv s2) +{ +#ifdef TARGET_SPARC64 + TCGv tmp = tcg_temp_new(); + + tcg_gen_add_tl(tmp, s1, s2); + tcg_gen_andi_tl(dst, tmp, -8); + tcg_gen_deposit_tl(cpu_gsr, cpu_gsr, tmp, 0, 3); +#else + g_assert_not_reached(); +#endif +} + +static void gen_op_alignaddrl(TCGv dst, TCGv s1, TCGv s2) +{ +#ifdef TARGET_SPARC64 + TCGv tmp = tcg_temp_new(); + + tcg_gen_add_tl(tmp, s1, s2); + tcg_gen_andi_tl(dst, tmp, -8); + tcg_gen_neg_tl(tmp, tmp); + tcg_gen_deposit_tl(cpu_gsr, cpu_gsr, tmp, 0, 3); +#else + g_assert_not_reached(); +#endif +} + +TRANS(ALIGNADDR, VIS1, do_rrr, a, gen_op_alignaddr) +TRANS(ALIGNADDRL, VIS1, do_rrr, a, gen_op_alignaddrl) + static bool do_shift_r(DisasContext *dc, arg_shiftr *a, bool l, bool u) { TCGv dst, src1, src2; @@ -5308,21 +5326,9 @@ static void disas_sparc_legacy(DisasContext *dc, unsigned int insn) case 0x010: /* VIS I array8 */ case 0x012: /* VIS I array16 */ case 0x014: /* VIS I array32 */ - g_assert_not_reached(); /* in decodetree */ case 0x018: /* VIS I alignaddr */ - CHECK_FPU_FEATURE(dc, VIS1); - cpu_src1 = gen_load_gpr(dc, rs1); - cpu_src2 = gen_load_gpr(dc, rs2); - gen_alignaddr(cpu_dst, cpu_src1, cpu_src2, 0); - gen_store_gpr(dc, rd, cpu_dst); - break; case 0x01a: /* VIS I alignaddrl */ - CHECK_FPU_FEATURE(dc, VIS1); - cpu_src1 = gen_load_gpr(dc, rs1); - cpu_src2 = gen_load_gpr(dc, rs2); - gen_alignaddr(cpu_dst, cpu_src1, cpu_src2, 1); - gen_store_gpr(dc, rd, cpu_dst); - break; + g_assert_not_reached(); /* in decodetree */ case 0x019: /* VIS II bmask */ CHECK_FPU_FEATURE(dc, VIS2); cpu_src1 = gen_load_gpr(dc, rs1); From patchwork Sun Oct 22 06:00:03 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 736970 Delivered-To: patch@linaro.org Received: by 2002:adf:dd81:0:b0:32d:baff:b0ca with SMTP id x1csp1005891wrl; Sat, 21 Oct 2023 23:12:58 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHDD0Cwbv0qK64LovpoADvlhwJ4iRperm0sHaNMpPttMyOSy/Jtq6lEV2PUJDPdDY2R5who X-Received: by 2002:ac8:5b86:0:b0:41c:b617:8529 with SMTP id a6-20020ac85b86000000b0041cb6178529mr7054020qta.21.1697955178012; Sat, 21 Oct 2023 23:12:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697955177; cv=none; d=google.com; s=arc-20160816; b=Nt1O4OeeCa7o9wi1PQfW4K607VXpheVq27XntzYWCAVUGH1aCxXt/02iWkq0SxktEh mnEMFSy1g3v6BgReOnF7nwuRVSP5stvZhTO8qXh81wBiOvfVzCJAqVTWykZIF/igHBL3 o0dRwykUkqw5VwdxGcF4MKmvON2U47t4pm5L6BxZmAdzZB4VNkjouIlGrmJXZIyYVjsk ymwNWsYFCjzrCEDdwT9xoDqYHkxW1M4w0HM1wwvLMfgAoWBL7IvMeEXzwUoR/GsNxWNy d5KvePIFp7sK0i1lO8PDx9d6N/dRuskEjni7jESc8O/GtWhcdHKvaxTJVTjipy9mJQjw lQvg== 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=D/eF6Q1p9hNhFbCjsK4WyimB14kKHitG94P/DKFJk6U=; fh=TYrED6TOMxGX0VC4GtjviASLbYyJe19+7/tKWjN44KQ=; b=L3HolAhdct6daFHHqClHLwysSHCNuDyM4Yv0PYIMVPELQ5kH2tQeInBRVL8brhf+co nktMNJwpmpJ6YhqA68VhjzfaCBmj2cnPACrHpOb0N5cFY6tn56T33XScpop3yZywzL2z nQl4BRn1ZO3CTbKeysmhOTcUPmcC78rAc9I0sN+1Uo9cwkIsa5MLXQWL1lVSlVXGCAgN nxAZ1b45twxJbyu57MwbsF/5kAPBnzff/73WKp8iS6kJaK6nISCUkkA/m52SYntcC7BV agCNDcd6Qz5QV9yPMVI5o//ygoAxXUSU7pmGt6LF5nF1F0BfL7iTnrZEUomc5c6nqJp+ dBYQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=OJYYggwL; 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 v3-20020a05622a014300b004178d0895aasi3903060qtw.137.2023.10.21.23.12.57 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sat, 21 Oct 2023 23:12:57 -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=OJYYggwL; 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 1quRaF-0001ou-Vi; Sun, 22 Oct 2023 02:05:08 -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 1quRa6-00012I-Q8 for qemu-devel@nongnu.org; Sun, 22 Oct 2023 02:04:58 -0400 Received: from mail-oo1-xc30.google.com ([2607:f8b0:4864:20::c30]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1quRa3-0002HH-TS for qemu-devel@nongnu.org; Sun, 22 Oct 2023 02:04:58 -0400 Received: by mail-oo1-xc30.google.com with SMTP id 006d021491bc7-584042e7f73so1416955eaf.2 for ; Sat, 21 Oct 2023 23:04:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1697954693; x=1698559493; 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=D/eF6Q1p9hNhFbCjsK4WyimB14kKHitG94P/DKFJk6U=; b=OJYYggwLNI+9ovuGSKjOaDELVJTsMPermPfhnjTKR0xczjOe/CZnFYxhC5OrIwA1jr CfKRsF3JEWxtso1jt0NKjIgzEDbnq5j1BMDRvM8oi79d9mfGcVZ4c0d3i4/1QWdMbttg Yyxlucd3eMv2bDwUBPoNlhPKqmekin0X+AQiMhpezxwh5x9K4NKCzbqU79402Z7s8L5B 1bRNFZB2OEsPwhDU3hj50IDZISqvEwgSZPNe8w6ZB9+fsrgrv1awK3TAn7dADvKusAOX i8jY5ZbL8taA0PW4TmrdHIBSbIx2hifNMFXgMRApLKjlsj2InzDICl2mkUZM0htOJRCX Qvpw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697954693; x=1698559493; 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=D/eF6Q1p9hNhFbCjsK4WyimB14kKHitG94P/DKFJk6U=; b=Qa4Wtbi60UP5YBrA8tDSLTQkTIWjrjZXjiEvdkBjIstB7tYXLswh+gV5JW+/7x34t/ cgLU14smUTI6J64rmz9dfrIdvq3R25ClhMhSfNisnRO66imSh3eJtjoe+AesxHqVPatk 1ZHYwJKpACBFq2LBYbZlfGa1XM70t/pMUQmaWkBih9pSCmKCabA5+6IUjDIG+hETy51W OrSSgDwbMPa72DD/pqQX5REw/Qg919KbCze/wEtpz0K1BZn+SBoenhe/NOtjrOzr6Q+L 9oB37cUVSwtWD6KY8N6A2+Hb6CWSmTef4yke957ow6wkDJ+ym3C7qkGoDQRFmEZUWTrW Cmcg== X-Gm-Message-State: AOJu0YztG3rdPMK0zhy6P+96Zk6dl+gBkxAXM2pL7S+PE9mBPq/nSaej WrlEhFK9u6U/HXWpsk+XtYwJqZCvChFBqW5J1QU= X-Received: by 2002:a05:6358:7295:b0:168:d282:90e with SMTP id w21-20020a056358729500b00168d282090emr1648384rwf.5.1697954693630; Sat, 21 Oct 2023 23:04:53 -0700 (PDT) Received: from stoup.. ([71.212.149.95]) by smtp.gmail.com with ESMTPSA id fb13-20020a056a002d8d00b0068a46cd4120sm4007373pfb.199.2023.10.21.23.04.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 21 Oct 2023 23:04:53 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: mark.cave-ayland@ilande.co.uk Subject: [PATCH v4 62/90] target/sparc: Move BMASK to decodetree Date: Sat, 21 Oct 2023 23:00:03 -0700 Message-Id: <20231022060031.490251-63-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231022060031.490251-1-richard.henderson@linaro.org> References: <20231022060031.490251-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::c30; envelope-from=richard.henderson@linaro.org; helo=mail-oo1-xc30.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 | 2 ++ target/sparc/translate.c | 22 +++++++++++++--------- 2 files changed, 15 insertions(+), 9 deletions(-) diff --git a/target/sparc/insns.decode b/target/sparc/insns.decode index f70423895e..db372573a2 100644 --- a/target/sparc/insns.decode +++ b/target/sparc/insns.decode @@ -255,6 +255,8 @@ RETRY 10 00001 111110 00000 0 0000000000000 ALIGNADDR 10 ..... 110110 ..... 0 0001 1000 ..... @r_r_r ALIGNADDRL 10 ..... 110110 ..... 0 0001 1010 ..... @r_r_r + + BMASK 10 ..... 110110 ..... 0 0001 1001 ..... @r_r_r ] NCP 10 ----- 110110 ----- --------- ----- # v8 CPop1 } diff --git a/target/sparc/translate.c b/target/sparc/translate.c index 9b9281feb7..f91b7ae0c0 100644 --- a/target/sparc/translate.c +++ b/target/sparc/translate.c @@ -4413,6 +4413,18 @@ static void gen_op_alignaddrl(TCGv dst, TCGv s1, TCGv s2) TRANS(ALIGNADDR, VIS1, do_rrr, a, gen_op_alignaddr) TRANS(ALIGNADDRL, VIS1, do_rrr, a, gen_op_alignaddrl) +static void gen_op_bmask(TCGv dst, TCGv s1, TCGv s2) +{ +#ifdef TARGET_SPARC64 + tcg_gen_add_tl(dst, s1, s2); + tcg_gen_deposit_tl(cpu_gsr, cpu_gsr, dst, 32, 32); +#else + g_assert_not_reached(); +#endif +} + +TRANS(BMASK, VIS2, do_rrr, a, gen_op_bmask) + static bool do_shift_r(DisasContext *dc, arg_shiftr *a, bool l, bool u) { TCGv dst, src1, src2; @@ -4963,7 +4975,6 @@ static void disas_sparc_legacy(DisasContext *dc, unsigned int insn) { unsigned int opc, rs1, rs2, rd; TCGv cpu_src1 __attribute__((unused)); - TCGv cpu_src2 __attribute__((unused)); TCGv_i32 cpu_src1_32, cpu_src2_32; TCGv_i64 cpu_src1_64, cpu_src2_64; TCGv_i32 cpu_dst_32 __attribute__((unused)); @@ -5328,15 +5339,8 @@ static void disas_sparc_legacy(DisasContext *dc, unsigned int insn) case 0x014: /* VIS I array32 */ case 0x018: /* VIS I alignaddr */ case 0x01a: /* VIS I alignaddrl */ - g_assert_not_reached(); /* in decodetree */ case 0x019: /* VIS II bmask */ - CHECK_FPU_FEATURE(dc, VIS2); - cpu_src1 = gen_load_gpr(dc, rs1); - cpu_src2 = gen_load_gpr(dc, rs2); - tcg_gen_add_tl(cpu_dst, cpu_src1, cpu_src2); - tcg_gen_deposit_tl(cpu_gsr, cpu_gsr, cpu_dst, 32, 32); - gen_store_gpr(dc, rd, cpu_dst); - break; + g_assert_not_reached(); /* in decodetree */ case 0x020: /* VIS I fcmple16 */ CHECK_FPU_FEATURE(dc, VIS1); cpu_src1_64 = gen_load_fpr_D(dc, rs1); From patchwork Sun Oct 22 06:00:04 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 736965 Delivered-To: patch@linaro.org Received: by 2002:adf:dd81:0:b0:32d:baff:b0ca with SMTP id x1csp1005798wrl; Sat, 21 Oct 2023 23:12:27 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHoGRgy7YaIOefYQuIWIJ9C67cEEDAa8yH+yuX7KgfbvIBZsdBnz0yYtsW7QOHUek+wqwji X-Received: by 2002:ac8:59d3:0:b0:41b:7759:2a9a with SMTP id f19-20020ac859d3000000b0041b77592a9amr7238177qtf.13.1697955147311; Sat, 21 Oct 2023 23:12:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697955147; cv=none; d=google.com; s=arc-20160816; b=K+97CV0xkLktuJdKH5rKHKdLYGvQgdcqRoxp3oRmrKTKMyL6hviAUVvlSp4jX0en7I ZtK1rWD2PA5Nb4VMFKUkU6xh/MO7/DhmGOHFtXq2wwuJH2NOmyt45tJPY+BE06LpL0R/ bJuDUvXJquvUXkAxq3t5f8UPdH6pDatK12QJ654p4fYhtQFbwAcxy2UxNIopLQVirKca SXPyoQG2EMwjx/8qbXKAD6r11m51Y1GgfBeKS9k8Lw4OsOZhtBcP2Bec+hPEy+Cu7b7b aCqnGB8strsn4WPipN8Qgu9L8w4kQAF6JmmiaaftQMiDzTj9WeqAaidG5pc2BsX8jXO+ QAVw== 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=MShxFeIoGzyVU+5tfjMPw7APYYdHVl4qBa32XHP3hTg=; fh=TYrED6TOMxGX0VC4GtjviASLbYyJe19+7/tKWjN44KQ=; b=Gnyjp6YEx5Y8JlsIr110kS2GcOFhqCQMCvjl7J48qBxiPORU0kSQ9emvY6+L8g5QUG y5zYD7BhgJPVdBmzDXOYZzK/mepDvcQSH/Mo5GDKUlUtzT2zpf2RUs8LWqyM63VulVPe dLfVMf3Q1rwAeSpqjzPR1+nDglWrwOitetHIqZoD/2cbrLlkaWUezyTiQtdXqwJSA0dN FGlA3weGaWhYm7KlnNl1yOuorzrYenaXInoq7+/TFfaUJIx+13GHXcfEt/atOqY6g8xL 8lUP8X3UzshTNsVmlJTUWF7j3rd0NdPRO077GvnAPZKx1HcCdVxdjorjm2OB+r3akDOr 2dRw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=ze3w13uw; 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 bp40-20020a05622a1ba800b00403c2e9e72bsi3648482qtb.106.2023.10.21.23.12.27 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sat, 21 Oct 2023 23:12:27 -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=ze3w13uw; 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 1quRbA-0004Xn-6y; Sun, 22 Oct 2023 02:06:04 -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 1quRa7-00016R-Jc for qemu-devel@nongnu.org; Sun, 22 Oct 2023 02:05:00 -0400 Received: from mail-oo1-xc2c.google.com ([2607:f8b0:4864:20::c2c]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1quRa3-0002HS-Ty for qemu-devel@nongnu.org; Sun, 22 Oct 2023 02:04:59 -0400 Received: by mail-oo1-xc2c.google.com with SMTP id 006d021491bc7-5844bc378feso381458eaf.0 for ; Sat, 21 Oct 2023 23:04:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1697954694; x=1698559494; 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=MShxFeIoGzyVU+5tfjMPw7APYYdHVl4qBa32XHP3hTg=; b=ze3w13uwWm3ALDfZipyBF/Mp/Ac0u/yaIp2xQUe4d1viNMoJA3MHbsE4Z0GUCogI1L DUXilarFS6FgkC4laNT7Cuh9dH6IO7CQXujiV9bPaNeKi9Lb4+mvPiBpJQIFOZqkpmvv 049cKxPjEDa20svUpdRAVCbDzH9PwHfVdXE5nSAmbke0wmo503zzwNt0NWL20tdWn8LX vuoTu5IsabrOQyQapWknU73L/m3PRiHviJbQxJsFqcizrzlwUZ9toJ5N2sqy+l2ii1jp 77QuV0KfxbadOE0yhjq8BQucDLRIdKEGdlyL77RcxYBLG09mB+jvQAFnpkR12O+okbpU d7aQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697954694; x=1698559494; 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=MShxFeIoGzyVU+5tfjMPw7APYYdHVl4qBa32XHP3hTg=; b=uTtkOtXPKcHeY+WoVuUU+3LqnD+s/xtg5z0t0ovzVPmCVemMQS+FWyitNeTXcAGmNY 7N1i0vXYBt+GZnD1+KWqqC8qIUJeYws6F4swZcyzHKZrkSIbuRN7aTbWa5BtQc7ITsOc idqsiOoDDDU9bE7Ml9oA9FUl/N9z6UP6d5HHUKojDlgUK4BSw8dyZsOi8kz1QAq6UAo4 rA+8sYa63G53uCTZQgFLTx30IOdwLlDT5AAEwEUWbz2YyK4P2ATgHu8ckZBqdFPwwhXG J+iEQEXYI9lrcHqgTqmex8s91I1a2iHc1d8lIWNMw5yaCZk4EL2DKHgia3R4IM7eGhZo /4sA== X-Gm-Message-State: AOJu0YxUqYwJBaPtiDDDvUkDdLP/aGzb+WIKx43LPSS7MbcGsA7jEzCk MMk81ZrqCnywuCNYYWw0NDBFh08V5HuRCRAOd9g= X-Received: by 2002:a05:6358:9895:b0:143:1063:d1f4 with SMTP id q21-20020a056358989500b001431063d1f4mr8106298rwa.13.1697954694476; Sat, 21 Oct 2023 23:04:54 -0700 (PDT) Received: from stoup.. ([71.212.149.95]) by smtp.gmail.com with ESMTPSA id fb13-20020a056a002d8d00b0068a46cd4120sm4007373pfb.199.2023.10.21.23.04.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 21 Oct 2023 23:04:54 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: mark.cave-ayland@ilande.co.uk Subject: [PATCH v4 63/90] target/sparc: Move FMOVS, FNEGS, FABSS, FSRC*S, FNOT*S to decodetree Date: Sat, 21 Oct 2023 23:00:04 -0700 Message-Id: <20231022060031.490251-64-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231022060031.490251-1-richard.henderson@linaro.org> References: <20231022060031.490251-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::c2c; envelope-from=richard.henderson@linaro.org; helo=mail-oo1-xc2c.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 | 13 ++++++ target/sparc/translate.c | 92 +++++++++++++++++++++------------------ 2 files changed, 62 insertions(+), 43 deletions(-) diff --git a/target/sparc/insns.decode b/target/sparc/insns.decode index db372573a2..669a54e297 100644 --- a/target/sparc/insns.decode +++ b/target/sparc/insns.decode @@ -38,6 +38,10 @@ CALL 01 i:s30 &r_r_r rd rs1 rs2 @r_r_r .. rd:5 ...... rs1:5 . ........ rs2:5 &r_r_r +&r_r rd rs +@r_r1 .. rd:5 ...... rs:5 . ........ ..... &r_r +@r_r2 .. rd:5 ...... ..... . ........ rs:5 &r_r + { [ STBAR 10 00000 101000 01111 0 0000000000000 @@ -234,6 +238,10 @@ RESTORE 10 ..... 111101 ..... . ............. @r_r_ri DONE 10 00000 111110 00000 0 0000000000000 RETRY 10 00001 111110 00000 0 0000000000000 +FMOVs 10 ..... 110100 00000 0 0000 0001 ..... @r_r2 +FNEGs 10 ..... 110100 00000 0 0000 0101 ..... @r_r2 +FABSs 10 ..... 110100 00000 0 0000 1001 ..... @r_r2 + { [ EDGE8cc 10 ..... 110110 ..... 0 0000 0000 ..... @r_r_r @@ -257,6 +265,11 @@ RETRY 10 00001 111110 00000 0 0000000000000 ALIGNADDRL 10 ..... 110110 ..... 0 0001 1010 ..... @r_r_r BMASK 10 ..... 110110 ..... 0 0001 1001 ..... @r_r_r + + FSRCs 10 ..... 110110 ..... 0 0111 0101 00000 @r_r1 # FSRC1s + FSRCs 10 ..... 110110 00000 0 0111 1001 ..... @r_r2 # FSRC2s + FNOTs 10 ..... 110110 ..... 0 0110 1011 00000 @r_r1 # FNOT1s + FNOTs 10 ..... 110110 00000 0 0110 0111 ..... @r_r2 # FNOT2s ] NCP 10 ----- 110110 ----- --------- ----- # v8 CPop1 } diff --git a/target/sparc/translate.c b/target/sparc/translate.c index f91b7ae0c0..206cdd0e1b 100644 --- a/target/sparc/translate.c +++ b/target/sparc/translate.c @@ -1393,6 +1393,29 @@ static void gen_compare_reg(DisasCompare *cmp, int cond, TCGv r_src) cmp->c2 = tcg_constant_tl(0); } +static void gen_op_clear_ieee_excp_and_FTT(void) +{ + tcg_gen_andi_tl(cpu_fsr, cpu_fsr, FSR_FTT_CEXC_NMASK); +} + +static void gen_op_fmovs(TCGv_i32 dst, TCGv_i32 src) +{ + gen_op_clear_ieee_excp_and_FTT(); + tcg_gen_mov_i32(dst, src); +} + +static void gen_op_fnegs(TCGv_i32 dst, TCGv_i32 src) +{ + gen_op_clear_ieee_excp_and_FTT(); + gen_helper_fnegs(dst, src); +} + +static void gen_op_fabss(TCGv_i32 dst, TCGv_i32 src) +{ + gen_op_clear_ieee_excp_and_FTT(); + gen_helper_fabss(dst, src); +} + #ifdef TARGET_SPARC64 static void gen_op_fcmps(int fccno, TCGv_i32 r_rs1, TCGv_i32 r_rs2) { @@ -1553,11 +1576,6 @@ static int gen_trap_ifnofpu(DisasContext *dc) return 0; } -static void gen_op_clear_ieee_excp_and_FTT(void) -{ - tcg_gen_andi_tl(cpu_fsr, cpu_fsr, FSR_FTT_CEXC_NMASK); -} - static void gen_fop_FF(DisasContext *dc, int rd, int rs, void (*gen)(TCGv_i32, TCGv_ptr, TCGv_i32)) { @@ -1572,19 +1590,6 @@ static void gen_fop_FF(DisasContext *dc, int rd, int rs, gen_store_fpr_F(dc, rd, dst); } -static void gen_ne_fop_FF(DisasContext *dc, int rd, int rs, - void (*gen)(TCGv_i32, TCGv_i32)) -{ - TCGv_i32 dst, src; - - src = gen_load_fpr_F(dc, rs); - dst = gen_dest_fpr_F(dc); - - gen(dst, src); - - gen_store_fpr_F(dc, rd, dst); -} - static void gen_fop_FFF(DisasContext *dc, int rd, int rs1, int rs2, void (*gen)(TCGv_i32, TCGv_ptr, TCGv_i32, TCGv_i32)) { @@ -4963,6 +4968,27 @@ static bool do_stfsr(DisasContext *dc, arg_r_r_ri *a, MemOp mop) TRANS(STFSR, ALL, do_stfsr, a, MO_TEUL) TRANS(STXFSR, 64, do_stfsr, a, MO_TEUQ) +static bool do_ff(DisasContext *dc, arg_r_r *a, + void (*func)(TCGv_i32, TCGv_i32)) +{ + TCGv_i32 tmp; + + if (gen_trap_ifnofpu(dc)) { + return true; + } + + tmp = gen_load_fpr_F(dc, a->rs); + func(tmp, tmp); + gen_store_fpr_F(dc, a->rd, tmp); + return advance_pc(dc); +} + +TRANS(FMOVs, ALL, do_ff, a, gen_op_fmovs) +TRANS(FNEGs, ALL, do_ff, a, gen_op_fnegs) +TRANS(FABSs, ALL, do_ff, a, gen_op_fabss) +TRANS(FSRCs, VIS1, do_ff, a, tcg_gen_mov_i32) +TRANS(FNOTs, VIS1, do_ff, a, tcg_gen_not_i32) + #define CHECK_IU_FEATURE(dc, FEATURE) \ if (!((dc)->def->features & CPU_FEATURE_ ## FEATURE)) \ goto illegal_insn; @@ -5004,15 +5030,9 @@ static void disas_sparc_legacy(DisasContext *dc, unsigned int insn) switch (xop) { case 0x1: /* fmovs */ - cpu_src1_32 = gen_load_fpr_F(dc, rs2); - gen_store_fpr_F(dc, rd, cpu_src1_32); - break; case 0x5: /* fnegs */ - gen_ne_fop_FF(dc, rd, rs2, gen_helper_fnegs); - break; case 0x9: /* fabss */ - gen_ne_fop_FF(dc, rd, rs2, gen_helper_fabss); - break; + g_assert_not_reached(); /* in decodetree */ case 0x29: /* fsqrts */ gen_fop_FF(dc, rd, rs2, gen_helper_fsqrts); break; @@ -5340,6 +5360,10 @@ static void disas_sparc_legacy(DisasContext *dc, unsigned int insn) case 0x018: /* VIS I alignaddr */ case 0x01a: /* VIS I alignaddrl */ case 0x019: /* VIS II bmask */ + case 0x067: /* VIS I fnot2s */ + case 0x06b: /* VIS I fnot1s */ + case 0x075: /* VIS I fsrc1s */ + case 0x079: /* VIS I fsrc2s */ g_assert_not_reached(); /* in decodetree */ case 0x020: /* VIS I fcmple16 */ CHECK_FPU_FEATURE(dc, VIS1); @@ -5527,10 +5551,6 @@ static void disas_sparc_legacy(DisasContext *dc, unsigned int insn) CHECK_FPU_FEATURE(dc, VIS1); gen_ne_fop_DD(dc, rd, rs2, tcg_gen_not_i64); break; - case 0x067: /* VIS I fnot2s */ - CHECK_FPU_FEATURE(dc, VIS1); - gen_ne_fop_FF(dc, rd, rs2, tcg_gen_not_i32); - break; case 0x068: /* VIS I fandnot1 */ CHECK_FPU_FEATURE(dc, VIS1); gen_ne_fop_DDD(dc, rd, rs2, rs1, tcg_gen_andc_i64); @@ -5543,10 +5563,6 @@ static void disas_sparc_legacy(DisasContext *dc, unsigned int insn) CHECK_FPU_FEATURE(dc, VIS1); gen_ne_fop_DD(dc, rd, rs1, tcg_gen_not_i64); break; - case 0x06b: /* VIS I fnot1s */ - CHECK_FPU_FEATURE(dc, VIS1); - gen_ne_fop_FF(dc, rd, rs1, tcg_gen_not_i32); - break; case 0x06c: /* VIS I fxor */ CHECK_FPU_FEATURE(dc, VIS1); gen_ne_fop_DDD(dc, rd, rs1, rs2, tcg_gen_xor_i64); @@ -5584,11 +5600,6 @@ static void disas_sparc_legacy(DisasContext *dc, unsigned int insn) cpu_src1_64 = gen_load_fpr_D(dc, rs1); gen_store_fpr_D(dc, rd, cpu_src1_64); break; - case 0x075: /* VIS I fsrc1s */ - CHECK_FPU_FEATURE(dc, VIS1); - cpu_src1_32 = gen_load_fpr_F(dc, rs1); - gen_store_fpr_F(dc, rd, cpu_src1_32); - break; case 0x076: /* VIS I fornot2 */ CHECK_FPU_FEATURE(dc, VIS1); gen_ne_fop_DDD(dc, rd, rs1, rs2, tcg_gen_orc_i64); @@ -5602,11 +5613,6 @@ static void disas_sparc_legacy(DisasContext *dc, unsigned int insn) cpu_src1_64 = gen_load_fpr_D(dc, rs2); gen_store_fpr_D(dc, rd, cpu_src1_64); break; - case 0x079: /* VIS I fsrc2s */ - CHECK_FPU_FEATURE(dc, VIS1); - cpu_src1_32 = gen_load_fpr_F(dc, rs2); - gen_store_fpr_F(dc, rd, cpu_src1_32); - break; case 0x07a: /* VIS I fornot1 */ CHECK_FPU_FEATURE(dc, VIS1); gen_ne_fop_DDD(dc, rd, rs2, rs1, tcg_gen_orc_i64); From patchwork Sun Oct 22 06:00:05 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 736953 Delivered-To: patch@linaro.org Received: by 2002:adf:dd81:0:b0:32d:baff:b0ca with SMTP id x1csp1005078wrl; Sat, 21 Oct 2023 23:09:32 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHviARMkR/xzeBxIw4E4mdk6XymEENcacxr3TX9gGYs0jphQLttyTvS+OplGVWl7HllKQhV X-Received: by 2002:a05:622a:1a2a:b0:412:1c5f:4783 with SMTP id f42-20020a05622a1a2a00b004121c5f4783mr5938162qtb.10.1697954972538; Sat, 21 Oct 2023 23:09:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697954972; cv=none; d=google.com; s=arc-20160816; b=phxxjHY0OeU7RBrDA/yUkaDACRMeE5WyXxMESs02rDIY0umnEq2VoKiNNZRUFMXsWO 9L4Ykmyh410YSJF0xp+gol1tyxfRkQmCKpKPATmcpAqw4xdD5ICLB7vgpMkyfjHoC0sj 6BT8Y49FyNKGsnuXGLOrLCtemdNMw2/otuX0jm3VyMXusAaZ3jKLq7lQ6i+r+7Gk5JHO eVeFfpb6Oii1xl0RTDHYWzwri1aqLjndwkJm36Sd8NbnJY6ZeIdrO1JO/aLSKRNZ6XQ3 2/CDMVf2JunmSmH0EsA7b2v9itrWs/xL8xBuO19jYctC7RkS7XWxEe90s79x2RzXKKfQ Zkkg== 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=1OVRcFJ2QmLm8ph+NPMxY/IOqA91f6jVAqL2Y6rXtGU=; fh=TYrED6TOMxGX0VC4GtjviASLbYyJe19+7/tKWjN44KQ=; b=W/fGVk9n8E/GgkKE6bGxY4zQ2SV4aRrmPYcYtwPp+kwQFp7LdcA1VG2hgAK/msMf8m Vx4I+yKp3O73I3Z13nHLNo1KVgITF5XY3FOKReVwK+brBlDV48AAPft68kCH+eBYq/4s bZJ6oWeReK50nCzN6N2nSaaht7Ce9O6DIwM08qlg6GPqFGg2RD08oRzX06AHLbWSTqnB viboNghLl6aGzdnfEe4LO+tUu/kSLOHvDd5FNtVQaGW6lMQ3z8NYLxURI4RNUl4YoEuH BkF5GWsy52g9sAzzzX2Rkb6pUeeKR6QhXPYNccgpDMB5S1Eklvy9YCMwDQQ6x6TCOVg9 Fq5g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=bVFj7bQT; 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 r6-20020a05622a034600b0041cc53aac18si3466305qtw.644.2023.10.21.23.09.32 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sat, 21 Oct 2023 23:09:32 -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=bVFj7bQT; 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 1quRbN-0004mL-G0; Sun, 22 Oct 2023 02:06:17 -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 1quRaC-0001Wg-3K for qemu-devel@nongnu.org; Sun, 22 Oct 2023 02:05:04 -0400 Received: from mail-pf1-x431.google.com ([2607:f8b0:4864:20::431]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1quRa5-0002Hg-Ve for qemu-devel@nongnu.org; Sun, 22 Oct 2023 02:05:03 -0400 Received: by mail-pf1-x431.google.com with SMTP id d2e1a72fcca58-6be0277c05bso1677870b3a.0 for ; Sat, 21 Oct 2023 23:04:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1697954695; x=1698559495; 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=1OVRcFJ2QmLm8ph+NPMxY/IOqA91f6jVAqL2Y6rXtGU=; b=bVFj7bQTSpcr6mUuvG995560hAvSlvH7t2pAJX0RO3ozUQ3uXPb4Ey+CHCDOIwJwOT 74RoVUAN3+1YD9PFgmCHxR/zSVgFH6iJfJUMioBlTWI+JwKB9t5Vo78RJmNuwJEbHEKP 8I/EycVgcHGLK5FG466ctkXlypA9vhyQHL75jLX7OjIawBMo25cokc12AWxk2/kiZfbk dQOxTloRRNYuLN/SC0GpG4t3QHv6i6XownaEAhhce8LBJtHnNcyHhk7IdU89j+RAJlXj LKORCajqc5G5P1PyTKtPc8jH8eBomWcvJetvLOpZ80nDUmWpgj2f0/almmBF40/Wv/dy w00w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697954695; x=1698559495; 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=1OVRcFJ2QmLm8ph+NPMxY/IOqA91f6jVAqL2Y6rXtGU=; b=wV87MgbXbq/xuIvTqlTNAY+ROi/Sdray7Qj3i+qdnCh9KBuiDnigezOFLO+QYC1u38 ZHJQEEV5hJdBTK1yFi4YqsyHrB+eyaOrY2KsQAlLhp8jZoUrXfTJnXCJ0J7croy3zPzK ejXKPgK8fm/LcwkX/u53Ac/rpXQSclMMNsvZcGcsqVJzoVnvlAOClJ+lJZDVb6cMKtUI PoA2fd6Mh3w20o3v8KS1mPXgXZlW9G79ENk2g90rwUOQuswBCG/ZMhrwkMXWRXFjlJpK YrmAW1oPKTZ7Unj5V4z312gVqkw/C+l1L8ob9jBcZUnMF6M0Q+xN6t9SVmOPaJVtczgm zo6w== X-Gm-Message-State: AOJu0Ywd1c+fffHY3FhE2VNrmCLHsVdYRN3YMprnVhBsWY2UckAzHaiz DZfDOqig/+uPV85hz5DdTCbt1AwaLHuKD3i5z2A= X-Received: by 2002:a05:6a00:9398:b0:68b:a137:3739 with SMTP id ka24-20020a056a00939800b0068ba1373739mr5618850pfb.4.1697954695276; Sat, 21 Oct 2023 23:04:55 -0700 (PDT) Received: from stoup.. ([71.212.149.95]) by smtp.gmail.com with ESMTPSA id fb13-20020a056a002d8d00b0068a46cd4120sm4007373pfb.199.2023.10.21.23.04.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 21 Oct 2023 23:04:54 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: mark.cave-ayland@ilande.co.uk Subject: [PATCH v4 64/90] target/sparc: Move FMOVD, FNEGD, FABSD, FSRC*D, FNOT*D to decodetree Date: Sat, 21 Oct 2023 23:00:05 -0700 Message-Id: <20231022060031.490251-65-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231022060031.490251-1-richard.henderson@linaro.org> References: <20231022060031.490251-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::431; envelope-from=richard.henderson@linaro.org; helo=mail-pf1-x431.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, T_SPF_TEMPERROR=0.01 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 | 7 +++ target/sparc/translate.c | 91 +++++++++++++++++++++------------------ 2 files changed, 56 insertions(+), 42 deletions(-) diff --git a/target/sparc/insns.decode b/target/sparc/insns.decode index 669a54e297..23a21f2c20 100644 --- a/target/sparc/insns.decode +++ b/target/sparc/insns.decode @@ -239,8 +239,11 @@ DONE 10 00000 111110 00000 0 0000000000000 RETRY 10 00001 111110 00000 0 0000000000000 FMOVs 10 ..... 110100 00000 0 0000 0001 ..... @r_r2 +FMOVd 10 ..... 110100 00000 0 0000 0010 ..... @r_r2 FNEGs 10 ..... 110100 00000 0 0000 0101 ..... @r_r2 +FNEGd 10 ..... 110100 00000 0 0000 0110 ..... @r_r2 FABSs 10 ..... 110100 00000 0 0000 1001 ..... @r_r2 +FABSd 10 ..... 110100 00000 0 0000 1010 ..... @r_r2 { [ @@ -266,9 +269,13 @@ FABSs 10 ..... 110100 00000 0 0000 1001 ..... @r_r2 BMASK 10 ..... 110110 ..... 0 0001 1001 ..... @r_r_r + FSRCd 10 ..... 110110 ..... 0 0111 0100 00000 @r_r1 # FSRC1d FSRCs 10 ..... 110110 ..... 0 0111 0101 00000 @r_r1 # FSRC1s + FSRCd 10 ..... 110110 00000 0 0111 1000 ..... @r_r2 # FSRC2d FSRCs 10 ..... 110110 00000 0 0111 1001 ..... @r_r2 # FSRC2s + FNOTd 10 ..... 110110 ..... 0 0110 1010 00000 @r_r1 # FNOT1d FNOTs 10 ..... 110110 ..... 0 0110 1011 00000 @r_r1 # FNOT1s + FNOTd 10 ..... 110110 00000 0 0110 0110 ..... @r_r2 # FNOT2d FNOTs 10 ..... 110110 00000 0 0110 0111 ..... @r_r2 # FNOT2s ] NCP 10 ----- 110110 ----- --------- ----- # v8 CPop1 diff --git a/target/sparc/translate.c b/target/sparc/translate.c index 206cdd0e1b..3e1ef3d28a 100644 --- a/target/sparc/translate.c +++ b/target/sparc/translate.c @@ -54,6 +54,8 @@ #define gen_helper_write_softint(E, S) qemu_build_not_reached() #define gen_helper_saved ({ qemu_build_not_reached(); NULL; }) #define gen_helper_restored ({ qemu_build_not_reached(); NULL; }) +#define gen_helper_fnegd(D, S) qemu_build_not_reached() +#define gen_helper_fabsd(D, S) qemu_build_not_reached() #define gen_helper_done(E) qemu_build_not_reached() #define gen_helper_retry(E) qemu_build_not_reached() #define gen_helper_udivx(D, E, A, B) qemu_build_not_reached() @@ -1416,6 +1418,24 @@ static void gen_op_fabss(TCGv_i32 dst, TCGv_i32 src) gen_helper_fabss(dst, src); } +static void gen_op_fmovd(TCGv_i64 dst, TCGv_i64 src) +{ + gen_op_clear_ieee_excp_and_FTT(); + tcg_gen_mov_i64(dst, src); +} + +static void gen_op_fnegd(TCGv_i64 dst, TCGv_i64 src) +{ + gen_op_clear_ieee_excp_and_FTT(); + gen_helper_fnegd(dst, src); +} + +static void gen_op_fabsd(TCGv_i64 dst, TCGv_i64 src) +{ + gen_op_clear_ieee_excp_and_FTT(); + gen_helper_fabsd(dst, src); +} + #ifdef TARGET_SPARC64 static void gen_op_fcmps(int fccno, TCGv_i32 r_rs1, TCGv_i32 r_rs2) { @@ -1635,21 +1655,6 @@ static void gen_fop_DD(DisasContext *dc, int rd, int rs, gen_store_fpr_D(dc, rd, dst); } -#ifdef TARGET_SPARC64 -static void gen_ne_fop_DD(DisasContext *dc, int rd, int rs, - void (*gen)(TCGv_i64, TCGv_i64)) -{ - TCGv_i64 dst, src; - - src = gen_load_fpr_D(dc, rs); - dst = gen_dest_fpr_D(dc, rd); - - gen(dst, src); - - gen_store_fpr_D(dc, rd, dst); -} -#endif - static void gen_fop_DDD(DisasContext *dc, int rd, int rs1, int rs2, void (*gen)(TCGv_i64, TCGv_ptr, TCGv_i64, TCGv_i64)) { @@ -4989,6 +4994,28 @@ TRANS(FABSs, ALL, do_ff, a, gen_op_fabss) TRANS(FSRCs, VIS1, do_ff, a, tcg_gen_mov_i32) TRANS(FNOTs, VIS1, do_ff, a, tcg_gen_not_i32) +static bool do_dd(DisasContext *dc, arg_r_r *a, + void (*func)(TCGv_i64, TCGv_i64)) +{ + TCGv_i64 dst, src; + + if (gen_trap_ifnofpu(dc)) { + return true; + } + + dst = gen_dest_fpr_D(dc, a->rd); + src = gen_load_fpr_D(dc, a->rs); + func(dst, src); + gen_store_fpr_D(dc, a->rd, dst); + return advance_pc(dc); +} + +TRANS(FMOVd, 64, do_dd, a, gen_op_fmovd) +TRANS(FNEGd, 64, do_dd, a, gen_op_fnegd) +TRANS(FABSd, 64, do_dd, a, gen_op_fabsd) +TRANS(FSRCd, VIS1, do_dd, a, tcg_gen_mov_i64) +TRANS(FNOTd, VIS1, do_dd, a, tcg_gen_not_i64) + #define CHECK_IU_FEATURE(dc, FEATURE) \ if (!((dc)->def->features & CPU_FEATURE_ ## FEATURE)) \ goto illegal_insn; @@ -5032,6 +5059,9 @@ static void disas_sparc_legacy(DisasContext *dc, unsigned int insn) case 0x1: /* fmovs */ case 0x5: /* fnegs */ case 0x9: /* fabss */ + case 0x2: /* V9 fmovd */ + case 0x6: /* V9 fnegd */ + case 0xa: /* V9 fabsd */ g_assert_not_reached(); /* in decodetree */ case 0x29: /* fsqrts */ gen_fop_FF(dc, rd, rs2, gen_helper_fsqrts); @@ -5134,24 +5164,14 @@ static void disas_sparc_legacy(DisasContext *dc, unsigned int insn) gen_fop_FQ(dc, rd, rs2, gen_helper_fqtoi); break; #ifdef TARGET_SPARC64 - case 0x2: /* V9 fmovd */ - cpu_src1_64 = gen_load_fpr_D(dc, rs2); - gen_store_fpr_D(dc, rd, cpu_src1_64); - break; case 0x3: /* V9 fmovq */ CHECK_FPU_FEATURE(dc, FLOAT128); gen_move_Q(dc, rd, rs2); break; - case 0x6: /* V9 fnegd */ - gen_ne_fop_DD(dc, rd, rs2, gen_helper_fnegd); - break; case 0x7: /* V9 fnegq */ CHECK_FPU_FEATURE(dc, FLOAT128); gen_ne_fop_QQ(dc, rd, rs2, gen_helper_fnegq); break; - case 0xa: /* V9 fabsd */ - gen_ne_fop_DD(dc, rd, rs2, gen_helper_fabsd); - break; case 0xb: /* V9 fabsq */ CHECK_FPU_FEATURE(dc, FLOAT128); gen_ne_fop_QQ(dc, rd, rs2, gen_helper_fabsq); @@ -5364,6 +5384,10 @@ static void disas_sparc_legacy(DisasContext *dc, unsigned int insn) case 0x06b: /* VIS I fnot1s */ case 0x075: /* VIS I fsrc1s */ case 0x079: /* VIS I fsrc2s */ + case 0x066: /* VIS I fnot2 */ + case 0x06a: /* VIS I fnot1 */ + case 0x074: /* VIS I fsrc1 */ + case 0x078: /* VIS I fsrc2 */ g_assert_not_reached(); /* in decodetree */ case 0x020: /* VIS I fcmple16 */ CHECK_FPU_FEATURE(dc, VIS1); @@ -5547,10 +5571,6 @@ static void disas_sparc_legacy(DisasContext *dc, unsigned int insn) CHECK_FPU_FEATURE(dc, VIS1); gen_ne_fop_FFF(dc, rd, rs1, rs2, tcg_gen_andc_i32); break; - case 0x066: /* VIS I fnot2 */ - CHECK_FPU_FEATURE(dc, VIS1); - gen_ne_fop_DD(dc, rd, rs2, tcg_gen_not_i64); - break; case 0x068: /* VIS I fandnot1 */ CHECK_FPU_FEATURE(dc, VIS1); gen_ne_fop_DDD(dc, rd, rs2, rs1, tcg_gen_andc_i64); @@ -5559,10 +5579,6 @@ static void disas_sparc_legacy(DisasContext *dc, unsigned int insn) CHECK_FPU_FEATURE(dc, VIS1); gen_ne_fop_FFF(dc, rd, rs2, rs1, tcg_gen_andc_i32); break; - case 0x06a: /* VIS I fnot1 */ - CHECK_FPU_FEATURE(dc, VIS1); - gen_ne_fop_DD(dc, rd, rs1, tcg_gen_not_i64); - break; case 0x06c: /* VIS I fxor */ CHECK_FPU_FEATURE(dc, VIS1); gen_ne_fop_DDD(dc, rd, rs1, rs2, tcg_gen_xor_i64); @@ -5595,10 +5611,6 @@ static void disas_sparc_legacy(DisasContext *dc, unsigned int insn) CHECK_FPU_FEATURE(dc, VIS1); gen_ne_fop_FFF(dc, rd, rs1, rs2, tcg_gen_eqv_i32); break; - case 0x074: /* VIS I fsrc1 */ - CHECK_FPU_FEATURE(dc, VIS1); - cpu_src1_64 = gen_load_fpr_D(dc, rs1); - gen_store_fpr_D(dc, rd, cpu_src1_64); break; case 0x076: /* VIS I fornot2 */ CHECK_FPU_FEATURE(dc, VIS1); @@ -5608,11 +5620,6 @@ static void disas_sparc_legacy(DisasContext *dc, unsigned int insn) CHECK_FPU_FEATURE(dc, VIS1); gen_ne_fop_FFF(dc, rd, rs1, rs2, tcg_gen_orc_i32); break; - case 0x078: /* VIS I fsrc2 */ - CHECK_FPU_FEATURE(dc, VIS1); - cpu_src1_64 = gen_load_fpr_D(dc, rs2); - gen_store_fpr_D(dc, rd, cpu_src1_64); - break; case 0x07a: /* VIS I fornot1 */ CHECK_FPU_FEATURE(dc, VIS1); gen_ne_fop_DDD(dc, rd, rs2, rs1, tcg_gen_orc_i64); From patchwork Sun Oct 22 06:00:06 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 736952 Delivered-To: patch@linaro.org Received: by 2002:adf:dd81:0:b0:32d:baff:b0ca with SMTP id x1csp1004612wrl; Sat, 21 Oct 2023 23:07:37 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGol0RlFFybL/fBQNGhBszFyfB0Z4h4HZrLfXQZj4g5y+lJA0pbapFJV/eJ4MkRIqml/dox X-Received: by 2002:ac8:5853:0:b0:403:b219:89ed with SMTP id h19-20020ac85853000000b00403b21989edmr8384629qth.30.1697954857303; Sat, 21 Oct 2023 23:07:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697954857; cv=none; d=google.com; s=arc-20160816; b=TH9tCK0LIG1BGxIRFBlPWxljrr9oQSjby8DObEcN0WxHPL9SarxPeEm0NcIHlKdl3/ mIKJu6Xgt83qJ3PDtdFF0XrLu+OtuSYCPu8cV7ZHomhqgK55WCyo3pqLRld7g7TmovEt DXnd1g03fNo29gDYgQ+cZ6XWW1CqIFmL79Rgg70A150jJMmYuP6WrXQq4KV/5ld9HaiF Pt+SkVv4L+h6SK3OtF3lsbKOFDXn4aKzw9dMaVZckNXMZZySKpz5Ws0eDxZcUICwSO7A nSCGntCHqkiTB4v+psDSe+9w3T0w+XWhIFhhvPWvfAPiJ9e2W1q/Toekmw+sHUreu3lv 4ljQ== 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=oHTe2pzMiK1pshU/eb99Gibbfx2KzxTlzDMwY6as5Do=; fh=TYrED6TOMxGX0VC4GtjviASLbYyJe19+7/tKWjN44KQ=; b=qfbQd8AfbYJxzhhVzAepIqwvPJ4jI5/TBBmsm15DT/PW4dZ9uXLhoD3i8yEVtRex0J pimSGt77F6yWYbLZeamMFIUHZy/xrAMPNpu4Txo/BMNijWxTe/n2G61olEBq+vTXoXEN jir/ykLvvBdkSNuV0iiBuADv+JW2kvEjP0qJRh/rR+StmmwoiaNrP+ZYjBIsUnKwrU+b Ma2ghl28AVOsfctB6f81vMciYNG3n+N1epJ5GELt/73tsLDTSYr/rMwTGQlhbcbOr4lp CqvQphv2HXq/j+BRZ2M4sUiuDf0xUpGVSYSVFPkHlO9pLiXRl5RzrUmXmwoAZVs+Afeo sYDQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=UmT5Weyk; 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 r12-20020a05622a034c00b0040ed66f2041si3509366qtw.323.2023.10.21.23.07.37 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sat, 21 Oct 2023 23:07:37 -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=UmT5Weyk; 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 1quRaE-0001kr-S6; Sun, 22 Oct 2023 02:05:06 -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 1quRa9-0001HC-PY for qemu-devel@nongnu.org; Sun, 22 Oct 2023 02:05:01 -0400 Received: from mail-oo1-xc2d.google.com ([2607:f8b0:4864:20::c2d]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1quRa6-0002IH-Dy for qemu-devel@nongnu.org; Sun, 22 Oct 2023 02:05:01 -0400 Received: by mail-oo1-xc2d.google.com with SMTP id 006d021491bc7-583f571a213so1391627eaf.3 for ; Sat, 21 Oct 2023 23:04:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1697954696; x=1698559496; 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=oHTe2pzMiK1pshU/eb99Gibbfx2KzxTlzDMwY6as5Do=; b=UmT5WeykiKym96vH/E0ngB6hDoJryjUBjLMPWd/OLHBzm4FnIHHyWbD164VKMD8XqL xhoCOpBFNi9fMlspbFMXY16yGck43M9t7gyN/UtYBay6xV9O1q/Pv6y4AGJUZam7gAFY 3HvhOZiXtaIeNY0c+FUmwfSrg2zB80sN/qzIG6qEglgshz2bBf0W9DMEjeXjINXp65ms rG/n0vpbe70/j3GZwuXkZZWEAtCDUSIuM4/5T+723biTJG4xhcrzkMCp/krtJ+5IEFke YsA04ddynuTUfSSHFk1qRPCCBXDzhoHtrvv+MqC11HOaw7LjV1gAOwOJ+IMrijcET7HR 1UgA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697954696; x=1698559496; 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=oHTe2pzMiK1pshU/eb99Gibbfx2KzxTlzDMwY6as5Do=; b=FC3/DkAPZEZC++RekF5Wtrj/LIEPsKCZtTLvjAoMmMarTKYmzKpIv46Qe745UeIZQq Z+DL4Zdel9qEBwhbU/ZugUgoPX1YPKfwNpxUDroXCBFnjXWg3FfYbBrzLSR3Ow4c3jsN w3ILEw13WfnDjKSsUbxvtAUosy+9FF6xjD/UR+ysw3OtMZnNUraOvZKH0gfTFSUko922 e4eIzW645C8qP7MgF3a6z1e1T+66sJXAlMrPSdzjuJhPQi4O1uQ96phqwAzICCyCtP4A QgVbkuJkQ65b81GP0BSn6Bh63fHsqv/3hsCENSesttOXMGHBvnXMsaQzIAcVYvqjXimj 9qjw== X-Gm-Message-State: AOJu0Yz3HnuCW5TFT2jnvC4HI/iezWsIs6jx6L12h3DMU/7zgHZAlCVI XyjI+KxzDYN+z7Bj9mmhvzKHkPpx/hJ5OurU5bA= X-Received: by 2002:a05:6358:418d:b0:166:e153:db13 with SMTP id w13-20020a056358418d00b00166e153db13mr7206292rwc.16.1697954696093; Sat, 21 Oct 2023 23:04:56 -0700 (PDT) Received: from stoup.. ([71.212.149.95]) by smtp.gmail.com with ESMTPSA id fb13-20020a056a002d8d00b0068a46cd4120sm4007373pfb.199.2023.10.21.23.04.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 21 Oct 2023 23:04:55 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: mark.cave-ayland@ilande.co.uk Subject: [PATCH v4 65/90] target/sparc: Use tcg_gen_vec_{add,sub}* Date: Sat, 21 Oct 2023 23:00:06 -0700 Message-Id: <20231022060031.490251-66-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231022060031.490251-1-richard.henderson@linaro.org> References: <20231022060031.490251-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::c2d; envelope-from=richard.henderson@linaro.org; helo=mail-oo1-xc2d.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 Replace the local helpers for the same integer operations. Signed-off-by: Richard Henderson --- target/sparc/helper.h | 12 -------- target/sparc/translate.c | 15 +++++----- target/sparc/vis_helper.c | 59 --------------------------------------- 3 files changed, 7 insertions(+), 79 deletions(-) diff --git a/target/sparc/helper.h b/target/sparc/helper.h index 790752467f..dd1721a340 100644 --- a/target/sparc/helper.h +++ b/target/sparc/helper.h @@ -137,18 +137,6 @@ DEF_HELPER_FLAGS_2(fpack16, TCG_CALL_NO_RWG_SE, i32, i64, i64) DEF_HELPER_FLAGS_3(fpack32, TCG_CALL_NO_RWG_SE, i64, i64, i64, i64) DEF_HELPER_FLAGS_2(fpackfix, TCG_CALL_NO_RWG_SE, i32, i64, i64) DEF_HELPER_FLAGS_3(bshuffle, TCG_CALL_NO_RWG_SE, i64, i64, i64, i64) -#define VIS_HELPER(name) \ - DEF_HELPER_FLAGS_2(f ## name ## 16, TCG_CALL_NO_RWG_SE, \ - i64, i64, i64) \ - DEF_HELPER_FLAGS_2(f ## name ## 16s, TCG_CALL_NO_RWG_SE, \ - i32, i32, i32) \ - DEF_HELPER_FLAGS_2(f ## name ## 32, TCG_CALL_NO_RWG_SE, \ - i64, i64, i64) \ - DEF_HELPER_FLAGS_2(f ## name ## 32s, TCG_CALL_NO_RWG_SE, \ - i32, i32, i32) - -VIS_HELPER(padd) -VIS_HELPER(psub) #define VIS_CMPHELPER(name) \ DEF_HELPER_FLAGS_2(f##name##16, TCG_CALL_NO_RWG_SE, \ i64, i64, i64) \ diff --git a/target/sparc/translate.c b/target/sparc/translate.c index 3e1ef3d28a..2ec8607f61 100644 --- a/target/sparc/translate.c +++ b/target/sparc/translate.c @@ -25,9 +25,8 @@ #include "exec/helper-proto.h" #include "exec/exec-all.h" #include "tcg/tcg-op.h" - +#include "tcg/tcg-op-gvec.h" #include "exec/helper-gen.h" - #include "exec/translator.h" #include "exec/log.h" #include "asi.h" @@ -5513,15 +5512,15 @@ static void disas_sparc_legacy(DisasContext *dc, unsigned int insn) break; case 0x050: /* VIS I fpadd16 */ CHECK_FPU_FEATURE(dc, VIS1); - gen_ne_fop_DDD(dc, rd, rs1, rs2, gen_helper_fpadd16); + gen_ne_fop_DDD(dc, rd, rs1, rs2, tcg_gen_vec_add16_i64); break; case 0x051: /* VIS I fpadd16s */ CHECK_FPU_FEATURE(dc, VIS1); - gen_ne_fop_FFF(dc, rd, rs1, rs2, gen_helper_fpadd16s); + gen_ne_fop_FFF(dc, rd, rs1, rs2, tcg_gen_vec_add16_i32); break; case 0x052: /* VIS I fpadd32 */ CHECK_FPU_FEATURE(dc, VIS1); - gen_ne_fop_DDD(dc, rd, rs1, rs2, gen_helper_fpadd32); + gen_ne_fop_DDD(dc, rd, rs1, rs2, tcg_gen_vec_add32_i64); break; case 0x053: /* VIS I fpadd32s */ CHECK_FPU_FEATURE(dc, VIS1); @@ -5529,15 +5528,15 @@ static void disas_sparc_legacy(DisasContext *dc, unsigned int insn) break; case 0x054: /* VIS I fpsub16 */ CHECK_FPU_FEATURE(dc, VIS1); - gen_ne_fop_DDD(dc, rd, rs1, rs2, gen_helper_fpsub16); + gen_ne_fop_DDD(dc, rd, rs1, rs2, tcg_gen_vec_sub16_i64); break; case 0x055: /* VIS I fpsub16s */ CHECK_FPU_FEATURE(dc, VIS1); - gen_ne_fop_FFF(dc, rd, rs1, rs2, gen_helper_fpsub16s); + gen_ne_fop_FFF(dc, rd, rs1, rs2, tcg_gen_vec_sub16_i32); break; case 0x056: /* VIS I fpsub32 */ CHECK_FPU_FEATURE(dc, VIS1); - gen_ne_fop_DDD(dc, rd, rs1, rs2, gen_helper_fpsub32); + gen_ne_fop_DDD(dc, rd, rs1, rs2, tcg_gen_vec_add32_i64); break; case 0x057: /* VIS I fpsub32s */ CHECK_FPU_FEATURE(dc, VIS1); diff --git a/target/sparc/vis_helper.c b/target/sparc/vis_helper.c index 3afdc6975c..7763b16c24 100644 --- a/target/sparc/vis_helper.c +++ b/target/sparc/vis_helper.c @@ -275,65 +275,6 @@ uint64_t helper_fexpand(uint64_t src1, uint64_t src2) return d.ll; } -#define VIS_HELPER(name, F) \ - uint64_t name##16(uint64_t src1, uint64_t src2) \ - { \ - VIS64 s, d; \ - \ - s.ll = src1; \ - d.ll = src2; \ - \ - d.VIS_W64(0) = F(d.VIS_W64(0), s.VIS_W64(0)); \ - d.VIS_W64(1) = F(d.VIS_W64(1), s.VIS_W64(1)); \ - d.VIS_W64(2) = F(d.VIS_W64(2), s.VIS_W64(2)); \ - d.VIS_W64(3) = F(d.VIS_W64(3), s.VIS_W64(3)); \ - \ - return d.ll; \ - } \ - \ - uint32_t name##16s(uint32_t src1, uint32_t src2) \ - { \ - VIS32 s, d; \ - \ - s.l = src1; \ - d.l = src2; \ - \ - d.VIS_W32(0) = F(d.VIS_W32(0), s.VIS_W32(0)); \ - d.VIS_W32(1) = F(d.VIS_W32(1), s.VIS_W32(1)); \ - \ - return d.l; \ - } \ - \ - uint64_t name##32(uint64_t src1, uint64_t src2) \ - { \ - VIS64 s, d; \ - \ - s.ll = src1; \ - d.ll = src2; \ - \ - d.VIS_L64(0) = F(d.VIS_L64(0), s.VIS_L64(0)); \ - d.VIS_L64(1) = F(d.VIS_L64(1), s.VIS_L64(1)); \ - \ - return d.ll; \ - } \ - \ - uint32_t name##32s(uint32_t src1, uint32_t src2) \ - { \ - VIS32 s, d; \ - \ - s.l = src1; \ - d.l = src2; \ - \ - d.l = F(d.l, s.l); \ - \ - return d.l; \ - } - -#define FADD(a, b) ((a) + (b)) -#define FSUB(a, b) ((a) - (b)) -VIS_HELPER(helper_fpadd, FADD) -VIS_HELPER(helper_fpsub, FSUB) - #define VIS_CMPHELPER(name, F) \ uint64_t name##16(uint64_t src1, uint64_t src2) \ { \ From patchwork Sun Oct 22 06:00:07 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 736985 Delivered-To: patch@linaro.org Received: by 2002:adf:dd81:0:b0:32d:baff:b0ca with SMTP id x1csp1006150wrl; Sat, 21 Oct 2023 23:14:01 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGxrqioGaM9Ns2vDbSZo+aH9HIEjoq2oJ5TbfMiLwalNIksT+TyXK80xEWpNz3gedj5snG7 X-Received: by 2002:a05:622a:58e:b0:3f8:4905:9533 with SMTP id c14-20020a05622a058e00b003f849059533mr7818264qtb.50.1697955241000; Sat, 21 Oct 2023 23:14:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697955240; cv=none; d=google.com; s=arc-20160816; b=jxjwGiC54nZc/aMknIn3+a3R4F1SkRsMdImD+MTBc9SZybDlzHkgLhbM/UxTFoTPry I9EXvH/DBeSl25wzS5z5PwhNkzWglk2tQ+us7po1LNDL2ntgO1iv63OjLWZmWXi+cLYE hCM6H76Qve33b+DquCQrJ3CDXyNDx/gFkZPWcirLwcX1lDB1c2MUZ6NqyTLVwHgiaJc3 szLPn/6LaG+odVF+TKbmwh24W1d7rfkeV6z/a2lrQtRDwm9tLQMcTUnGIRyS+uiTw9yu E0ApKra+Xb7PxqvQngQr6Nf4s6Qgwt+iq/+5B+tVwZmqQIMR2OjnMI+eFJAQWjWrEusz 7xPA== 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=qi3wCnDQ9Ymw74YfvoiX4pceVq28hJP85OjC7WpyrDc=; fh=TYrED6TOMxGX0VC4GtjviASLbYyJe19+7/tKWjN44KQ=; b=Kr2kPyI/JMQusODi0WQWVgIZZnVYf7XrFTjTYfuSDOk9bQq1dxfiVBX7I1S1bJUCLV 0JsmDKvP53bXzbcW1AKvm9+v93ZrmB53W5qeg9DjEHlUDoRk2GtVk8ft3jTP6dRpoL0c tW+0lPE8c1GuP415evkS8QhsmsurKU3P+bgpLwjLIs1Y6xo/CICTUludQnD4f3yg/Q7w xaJKndSUObzdCTpfzxg97MoSUnoZe0gv370BIm8KQFAZqf1qh4spm/uuzaDrYE+Bo7KC TA5LYfFy0I1+r6WCcBNGSUdkYxT7OL1gi+mtarqTIyOuAlven1msdWwWkZyNrrDcLy2v 5tuw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=bDUn112U; 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 f22-20020a05622a1a1600b0041971052879si3750053qtb.120.2023.10.21.23.14.00 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sat, 21 Oct 2023 23:14:00 -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=bDUn112U; 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 1quRaM-0002SU-R3; Sun, 22 Oct 2023 02:05:14 -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 1quRaA-0001Iy-56 for qemu-devel@nongnu.org; Sun, 22 Oct 2023 02:05:02 -0400 Received: from mail-oi1-x22b.google.com ([2607:f8b0:4864:20::22b]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1quRa6-0002IV-Dn for qemu-devel@nongnu.org; Sun, 22 Oct 2023 02:05:01 -0400 Received: by mail-oi1-x22b.google.com with SMTP id 5614622812f47-3b3e13fc1f7so1677784b6e.0 for ; Sat, 21 Oct 2023 23:04:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1697954697; x=1698559497; 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=qi3wCnDQ9Ymw74YfvoiX4pceVq28hJP85OjC7WpyrDc=; b=bDUn112UcQR0sj7CJYo/lDZYD+Z+w5FUMdAX8lD5lL647XIPjHQs/41MbbxW5000V/ Wf+N3EUKh2QnA3Y5Ih5HvOI/C/kLJyHppMu4841h/n7L2RUg/iHGhjFjBwycPYVcb2gv 85fAQWa0S1PyyKAZXXsA23Al7FvkZPK5FbKALOSwSanAS/yWQCjySkYBQDATjr9f+T1f KbR2xqqbDa6aG1uoTz7TBeTPUBUDQDiGp9n3MFPefZwVsFdwomrxwf9HdHssuc8KNdeb 4lS/5nGDKrPikKD8+Hht3K55ySdyHehKGYBO4GHXX9D41/k3NAyfnb3kwof86oyAMrns Ws3g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697954697; x=1698559497; 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=qi3wCnDQ9Ymw74YfvoiX4pceVq28hJP85OjC7WpyrDc=; b=CzEOLX2hkvzyh0scmr6z9Q98yEtwOAAjlghYAH6Q2VviTAOejXSYgsw17NTbntdrLq fGYEbkhvaKgzhQS7IRzL3X55Kw9kGYcJjVZY4pHQiilBELovafa4fV7186ziLfI70PdQ mSVP5MWAIo0wsebVgb1njtElfnPzI/kX3xsFgCes4rPLf6xZuyRiHTZcRZITAweLD/+q aSEDQTjh7z+3QhfRvNVpBpepkVA1CQALgGZ4wgbjEcTjw6ys5qbyvs1pNdClOsiHByr9 OrR2AlFL7lYRGI36qyHEBns5dpGAt8A1SPoJ7bjCDsVYb4Uh4q6TblCJpB59LPVdoYgl QHbw== X-Gm-Message-State: AOJu0YxZ1rpYC2JKaP6Mk4JXajJsh24bRkn7sIzrko+yhAfAjGb+/UAn L3OKbGQCUxPHrga2GTNdn3+MY+ISPoDnIjZD7/I= X-Received: by 2002:a05:6358:52cf:b0:143:5180:1700 with SMTP id z15-20020a05635852cf00b0014351801700mr8833170rwz.27.1697954696891; Sat, 21 Oct 2023 23:04:56 -0700 (PDT) Received: from stoup.. ([71.212.149.95]) by smtp.gmail.com with ESMTPSA id fb13-20020a056a002d8d00b0068a46cd4120sm4007373pfb.199.2023.10.21.23.04.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 21 Oct 2023 23:04:56 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: mark.cave-ayland@ilande.co.uk Subject: [PATCH v4 66/90] target/sparc: Move gen_ne_fop_FFF insns to decodetree Date: Sat, 21 Oct 2023 23:00:07 -0700 Message-Id: <20231022060031.490251-67-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231022060031.490251-1-richard.henderson@linaro.org> References: <20231022060031.490251-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::22b; envelope-from=richard.henderson@linaro.org; helo=mail-oi1-x22b.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 Move FANDNOT1s, FANDNOT2s, FANDs, FNANDs, FNORs, FORNOT1s, FORNOT2s, FORs, FPADD16s, FPADD32s, FPSUB16s, FPSUB32s, FXNORs, FXORs. Signed-off-by: Richard Henderson --- target/sparc/insns.decode | 16 ++++++ target/sparc/translate.c | 116 ++++++++++++++------------------------ 2 files changed, 59 insertions(+), 73 deletions(-) diff --git a/target/sparc/insns.decode b/target/sparc/insns.decode index 23a21f2c20..0290f2aefb 100644 --- a/target/sparc/insns.decode +++ b/target/sparc/insns.decode @@ -37,6 +37,7 @@ CALL 01 i:s30 &r_r_r rd rs1 rs2 @r_r_r .. rd:5 ...... rs1:5 . ........ rs2:5 &r_r_r +@r_r_r_swap .. rd:5 ...... rs2:5 . ........ rs1:5 &r_r_r &r_r rd rs @r_r1 .. rd:5 ...... rs:5 . ........ ..... &r_r @@ -277,6 +278,21 @@ FABSd 10 ..... 110100 00000 0 0000 1010 ..... @r_r2 FNOTs 10 ..... 110110 ..... 0 0110 1011 00000 @r_r1 # FNOT1s FNOTd 10 ..... 110110 00000 0 0110 0110 ..... @r_r2 # FNOT2d FNOTs 10 ..... 110110 00000 0 0110 0111 ..... @r_r2 # FNOT2s + + FPADD16s 10 ..... 110110 ..... 0 0101 0001 ..... @r_r_r + FPADD32s 10 ..... 110110 ..... 0 0101 0011 ..... @r_r_r + FPSUB16s 10 ..... 110110 ..... 0 0101 0101 ..... @r_r_r + FPSUB32s 10 ..... 110110 ..... 0 0101 0111 ..... @r_r_r + FNORs 10 ..... 110110 ..... 0 0110 0011 ..... @r_r_r + FANDNOTs 10 ..... 110110 ..... 0 0110 0101 ..... @r_r_r # FANDNOT2s + FANDNOTs 10 ..... 110110 ..... 0 0110 1001 ..... @r_r_r_swap # ... 1s + FXORs 10 ..... 110110 ..... 0 0110 1101 ..... @r_r_r + FNANDs 10 ..... 110110 ..... 0 0110 1111 ..... @r_r_r + FANDs 10 ..... 110110 ..... 0 0111 0001 ..... @r_r_r + FXNORs 10 ..... 110110 ..... 0 0111 0011 ..... @r_r_r + FORNOTs 10 ..... 110110 ..... 0 0111 0111 ..... @r_r_r # FORNOT2s + FORNOTs 10 ..... 110110 ..... 0 0111 1011 ..... @r_r_r_swap # ... 1s + FORs 10 ..... 110110 ..... 0 0111 1101 ..... @r_r_r ] NCP 10 ----- 110110 ----- --------- ----- # v8 CPop1 } diff --git a/target/sparc/translate.c b/target/sparc/translate.c index 2ec8607f61..1944936760 100644 --- a/target/sparc/translate.c +++ b/target/sparc/translate.c @@ -1624,22 +1624,6 @@ static void gen_fop_FFF(DisasContext *dc, int rd, int rs1, int rs2, gen_store_fpr_F(dc, rd, dst); } -#ifdef TARGET_SPARC64 -static void gen_ne_fop_FFF(DisasContext *dc, int rd, int rs1, int rs2, - void (*gen)(TCGv_i32, TCGv_i32, TCGv_i32)) -{ - TCGv_i32 dst, src1, src2; - - src1 = gen_load_fpr_F(dc, rs1); - src2 = gen_load_fpr_F(dc, rs2); - dst = gen_dest_fpr_F(dc); - - gen(dst, src1, src2); - - gen_store_fpr_F(dc, rd, dst); -} -#endif - static void gen_fop_DD(DisasContext *dc, int rd, int rs, void (*gen)(TCGv_i64, TCGv_ptr, TCGv_i64)) { @@ -5015,6 +4999,35 @@ TRANS(FABSd, 64, do_dd, a, gen_op_fabsd) TRANS(FSRCd, VIS1, do_dd, a, tcg_gen_mov_i64) TRANS(FNOTd, VIS1, do_dd, a, tcg_gen_not_i64) +static bool do_fff(DisasContext *dc, arg_r_r_r *a, + void (*func)(TCGv_i32, TCGv_i32, TCGv_i32)) +{ + TCGv_i32 src1, src2; + + if (gen_trap_ifnofpu(dc)) { + return true; + } + + src1 = gen_load_fpr_F(dc, a->rs1); + src2 = gen_load_fpr_F(dc, a->rs2); + func(src1, src1, src2); + gen_store_fpr_F(dc, a->rd, src1); + return advance_pc(dc); +} + +TRANS(FPADD16s, VIS1, do_fff, a, tcg_gen_vec_add16_i32) +TRANS(FPADD32s, VIS1, do_fff, a, tcg_gen_add_i32) +TRANS(FPSUB16s, VIS1, do_fff, a, tcg_gen_vec_sub16_i32) +TRANS(FPSUB32s, VIS1, do_fff, a, tcg_gen_sub_i32) +TRANS(FNORs, VIS1, do_fff, a, tcg_gen_nor_i32) +TRANS(FANDNOTs, VIS1, do_fff, a, tcg_gen_andc_i32) +TRANS(FXORs, VIS1, do_fff, a, tcg_gen_xor_i32) +TRANS(FNANDs, VIS1, do_fff, a, tcg_gen_nand_i32) +TRANS(FANDs, VIS1, do_fff, a, tcg_gen_and_i32) +TRANS(FXNORs, VIS1, do_fff, a, tcg_gen_eqv_i32) +TRANS(FORNOTs, VIS1, do_fff, a, tcg_gen_orc_i32) +TRANS(FORs, VIS1, do_fff, a, tcg_gen_or_i32) + #define CHECK_IU_FEATURE(dc, FEATURE) \ if (!((dc)->def->features & CPU_FEATURE_ ## FEATURE)) \ goto illegal_insn; @@ -5387,6 +5400,20 @@ static void disas_sparc_legacy(DisasContext *dc, unsigned int insn) case 0x06a: /* VIS I fnot1 */ case 0x074: /* VIS I fsrc1 */ case 0x078: /* VIS I fsrc2 */ + case 0x051: /* VIS I fpadd16s */ + case 0x053: /* VIS I fpadd32s */ + case 0x055: /* VIS I fpsub16s */ + case 0x057: /* VIS I fpsub32s */ + case 0x063: /* VIS I fnors */ + case 0x065: /* VIS I fandnot2s */ + case 0x069: /* VIS I fandnot1s */ + case 0x06d: /* VIS I fxors */ + case 0x06f: /* VIS I fnands */ + case 0x071: /* VIS I fands */ + case 0x073: /* VIS I fxnors */ + case 0x077: /* VIS I fornot2s */ + case 0x07b: /* VIS I fornot1s */ + case 0x07d: /* VIS I fors */ g_assert_not_reached(); /* in decodetree */ case 0x020: /* VIS I fcmple16 */ CHECK_FPU_FEATURE(dc, VIS1); @@ -5514,34 +5541,18 @@ static void disas_sparc_legacy(DisasContext *dc, unsigned int insn) CHECK_FPU_FEATURE(dc, VIS1); gen_ne_fop_DDD(dc, rd, rs1, rs2, tcg_gen_vec_add16_i64); break; - case 0x051: /* VIS I fpadd16s */ - CHECK_FPU_FEATURE(dc, VIS1); - gen_ne_fop_FFF(dc, rd, rs1, rs2, tcg_gen_vec_add16_i32); - break; case 0x052: /* VIS I fpadd32 */ CHECK_FPU_FEATURE(dc, VIS1); gen_ne_fop_DDD(dc, rd, rs1, rs2, tcg_gen_vec_add32_i64); break; - case 0x053: /* VIS I fpadd32s */ - CHECK_FPU_FEATURE(dc, VIS1); - gen_ne_fop_FFF(dc, rd, rs1, rs2, tcg_gen_add_i32); - break; case 0x054: /* VIS I fpsub16 */ CHECK_FPU_FEATURE(dc, VIS1); gen_ne_fop_DDD(dc, rd, rs1, rs2, tcg_gen_vec_sub16_i64); break; - case 0x055: /* VIS I fpsub16s */ - CHECK_FPU_FEATURE(dc, VIS1); - gen_ne_fop_FFF(dc, rd, rs1, rs2, tcg_gen_vec_sub16_i32); - break; case 0x056: /* VIS I fpsub32 */ CHECK_FPU_FEATURE(dc, VIS1); gen_ne_fop_DDD(dc, rd, rs1, rs2, tcg_gen_vec_add32_i64); break; - case 0x057: /* VIS I fpsub32s */ - CHECK_FPU_FEATURE(dc, VIS1); - gen_ne_fop_FFF(dc, rd, rs1, rs2, tcg_gen_sub_i32); - break; case 0x060: /* VIS I fzero */ CHECK_FPU_FEATURE(dc, VIS1); cpu_dst_64 = gen_dest_fpr_D(dc, rd); @@ -5558,83 +5569,42 @@ static void disas_sparc_legacy(DisasContext *dc, unsigned int insn) CHECK_FPU_FEATURE(dc, VIS1); gen_ne_fop_DDD(dc, rd, rs1, rs2, tcg_gen_nor_i64); break; - case 0x063: /* VIS I fnors */ - CHECK_FPU_FEATURE(dc, VIS1); - gen_ne_fop_FFF(dc, rd, rs1, rs2, tcg_gen_nor_i32); - break; case 0x064: /* VIS I fandnot2 */ CHECK_FPU_FEATURE(dc, VIS1); gen_ne_fop_DDD(dc, rd, rs1, rs2, tcg_gen_andc_i64); break; - case 0x065: /* VIS I fandnot2s */ - CHECK_FPU_FEATURE(dc, VIS1); - gen_ne_fop_FFF(dc, rd, rs1, rs2, tcg_gen_andc_i32); - break; case 0x068: /* VIS I fandnot1 */ CHECK_FPU_FEATURE(dc, VIS1); gen_ne_fop_DDD(dc, rd, rs2, rs1, tcg_gen_andc_i64); break; - case 0x069: /* VIS I fandnot1s */ - CHECK_FPU_FEATURE(dc, VIS1); - gen_ne_fop_FFF(dc, rd, rs2, rs1, tcg_gen_andc_i32); - break; case 0x06c: /* VIS I fxor */ CHECK_FPU_FEATURE(dc, VIS1); gen_ne_fop_DDD(dc, rd, rs1, rs2, tcg_gen_xor_i64); break; - case 0x06d: /* VIS I fxors */ - CHECK_FPU_FEATURE(dc, VIS1); - gen_ne_fop_FFF(dc, rd, rs1, rs2, tcg_gen_xor_i32); - break; case 0x06e: /* VIS I fnand */ CHECK_FPU_FEATURE(dc, VIS1); gen_ne_fop_DDD(dc, rd, rs1, rs2, tcg_gen_nand_i64); break; - case 0x06f: /* VIS I fnands */ - CHECK_FPU_FEATURE(dc, VIS1); - gen_ne_fop_FFF(dc, rd, rs1, rs2, tcg_gen_nand_i32); - break; case 0x070: /* VIS I fand */ CHECK_FPU_FEATURE(dc, VIS1); gen_ne_fop_DDD(dc, rd, rs1, rs2, tcg_gen_and_i64); break; - case 0x071: /* VIS I fands */ - CHECK_FPU_FEATURE(dc, VIS1); - gen_ne_fop_FFF(dc, rd, rs1, rs2, tcg_gen_and_i32); - break; case 0x072: /* VIS I fxnor */ CHECK_FPU_FEATURE(dc, VIS1); gen_ne_fop_DDD(dc, rd, rs1, rs2, tcg_gen_eqv_i64); break; - case 0x073: /* VIS I fxnors */ - CHECK_FPU_FEATURE(dc, VIS1); - gen_ne_fop_FFF(dc, rd, rs1, rs2, tcg_gen_eqv_i32); - break; - break; case 0x076: /* VIS I fornot2 */ CHECK_FPU_FEATURE(dc, VIS1); gen_ne_fop_DDD(dc, rd, rs1, rs2, tcg_gen_orc_i64); break; - case 0x077: /* VIS I fornot2s */ - CHECK_FPU_FEATURE(dc, VIS1); - gen_ne_fop_FFF(dc, rd, rs1, rs2, tcg_gen_orc_i32); - break; case 0x07a: /* VIS I fornot1 */ CHECK_FPU_FEATURE(dc, VIS1); gen_ne_fop_DDD(dc, rd, rs2, rs1, tcg_gen_orc_i64); break; - case 0x07b: /* VIS I fornot1s */ - CHECK_FPU_FEATURE(dc, VIS1); - gen_ne_fop_FFF(dc, rd, rs2, rs1, tcg_gen_orc_i32); - break; case 0x07c: /* VIS I for */ CHECK_FPU_FEATURE(dc, VIS1); gen_ne_fop_DDD(dc, rd, rs1, rs2, tcg_gen_or_i64); break; - case 0x07d: /* VIS I fors */ - CHECK_FPU_FEATURE(dc, VIS1); - gen_ne_fop_FFF(dc, rd, rs1, rs2, tcg_gen_or_i32); - break; case 0x07e: /* VIS I fone */ CHECK_FPU_FEATURE(dc, VIS1); cpu_dst_64 = gen_dest_fpr_D(dc, rd); From patchwork Sun Oct 22 06:00:08 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 736991 Delivered-To: patch@linaro.org Received: by 2002:adf:dd81:0:b0:32d:baff:b0ca with SMTP id x1csp1006205wrl; Sat, 21 Oct 2023 23:14:14 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFmYK4bQToe47v8xibtMrMwumZhZSLrhYGIxuyA++aAAQJSaclkM/eY+P8NJWTm2WyHusUP X-Received: by 2002:a05:6214:21a5:b0:66d:173a:aca7 with SMTP id t5-20020a05621421a500b0066d173aaca7mr6204212qvc.55.1697955254616; Sat, 21 Oct 2023 23:14:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697955254; cv=none; d=google.com; s=arc-20160816; b=mdcrScOy9s2CbBDpM488h5jQg1fkrA0Yq23he/5JUmtBgCGd4X7apF4Y1YxSyFy0Qo odjwoMMkkBXXuqYXQXmqvA0jZJCG7ibBfXEssIYjP9/C1GnfeeSni3TxQchvCb0rQLZg CdS+07K7HaIamaC3KCof9itb+N+gojE4pqhgVzq7UTTZeoF7tg/bmzOoEAW+7u3+Dn9H w4NXvpWn8Atp+1KqCyItwn6eInERU10tAfxFwqcsNDvVdgNoOpMDYg3KGhcv9re99psx 0BK6jZeK2pXHXZgyO8rQOSHhof9edD2Yjw6XQuNeTrF90hpWpxmhkxxKjkpD5RZ414Mp 9Sog== 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=xg9shQSCsSXjzt9vctIOIFcNcvJVErfH1MJpmRAJyfA=; fh=TYrED6TOMxGX0VC4GtjviASLbYyJe19+7/tKWjN44KQ=; b=b7F2ncOO2SykNuVcheBgLRsz7N9cB5R9P5d67qG1L/kvYI7YVzpjWGLEL1I66efNpu H+hKt6OdNm1AWND2GvqExNxjTCbAON2YofjBKLYgSHFvmY8OWpEt9eoeHVaPIb3W68is NstYRb0ex+pf4c68eLUR0vvFJDgVUQYoOuRmA0I7gfy4tic3zd5OhU53bpSw2jLZuz5Q gyjzSu1LfxiCPOMKwy68aoA0NmjXhg08uCIZHpo4Sufr6CMzfmMESnVaI27e0KBlEPEy VNN9TlqQ3kC/sGFCbTxqwBFnjVwI1je/aMy7CgBCCWjXXgl9DQSOl5xFCEKYXfTgOnRx 74qw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=casXWRjF; 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 c4-20020a0cd604000000b0066cfd0ec363si3797531qvj.418.2023.10.21.23.14.14 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sat, 21 Oct 2023 23:14:14 -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=casXWRjF; 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 1quRbM-0004kl-HK; Sun, 22 Oct 2023 02:06:16 -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 1quRaC-0001bx-Ug for qemu-devel@nongnu.org; Sun, 22 Oct 2023 02:05:05 -0400 Received: from mail-pf1-x431.google.com ([2607:f8b0:4864:20::431]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1quRa9-0002Il-AN for qemu-devel@nongnu.org; Sun, 22 Oct 2023 02:05:04 -0400 Received: by mail-pf1-x431.google.com with SMTP id d2e1a72fcca58-6b89ab5ddb7so2209304b3a.0 for ; Sat, 21 Oct 2023 23:04:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1697954698; x=1698559498; 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=xg9shQSCsSXjzt9vctIOIFcNcvJVErfH1MJpmRAJyfA=; b=casXWRjFU0cKGBVE2ikSqM0iufwM96skm88aSHmC2JQz50JQO559vrSC/cV+Tc7TYy clU0ZZAgKtzUO6NzdZbnxlEeDMs4ycqbHeJw5CJlD30dpgz2sDiJbz4PXJnpmY6KZ0Vm 2sLk7LkQagCHLE/ldqrIGYaplUsE2YKitkZVxODIjZzjucfCshua8K41+1VZ2L8e3Miy mEnbL61Uao5Xq5cbuKQHMc/94P/E4hbDsshSL4AVCUmxZ+25nbDpjKrJTha5o/xlqV9e p0vdub0L+cxGUhFCgy6JlgQa4yKcEdNBvNMNrmuPVX2VX0/4oGw9JCRVLXzLjyC0lmPW UI3A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697954698; x=1698559498; 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=xg9shQSCsSXjzt9vctIOIFcNcvJVErfH1MJpmRAJyfA=; b=okc5rTQPeir0jVbfVh1Imd0kU+/fzn08tFEA/E8teZpkkuoIqi8TUojk3tHkbuELWZ k8Sp2ou2gD96FlM100fMmcklIp+sbMe9SAxIp5doOwaoM0Yx5Mz18/Tju8IAGRyP3u6k Oi9YgYlpJrluA8SOsH1Zar4I8whBDr3CiiJCX42EV387w8gfsSTBBDZDuY1FoLuIKGwA B+I3ikKrePGmkRVTYc1aX953G/YrpeW+w8UFO+Eh4+Fpy9E8WPRYVAoLmxydvIgiS038 cpATtas5q+2wQrmzw8xygadVpHDcd3uBujqmOKW3JPiDhfwix3vZfPJy8n3VjhPbjCTG 2MXg== X-Gm-Message-State: AOJu0Yze0Ko+fWsFbUltkpBGgOYhHqHmwVeJn4RdojldtPk9GPWgGo82 LhQbSqGJqtP7xXhvZMfpcq55K8dd4PLi7dJE284= X-Received: by 2002:a05:6a00:2345:b0:68f:bb02:fdf with SMTP id j5-20020a056a00234500b0068fbb020fdfmr6759455pfj.27.1697954697941; Sat, 21 Oct 2023 23:04:57 -0700 (PDT) Received: from stoup.. ([71.212.149.95]) by smtp.gmail.com with ESMTPSA id fb13-20020a056a002d8d00b0068a46cd4120sm4007373pfb.199.2023.10.21.23.04.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 21 Oct 2023 23:04:57 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: mark.cave-ayland@ilande.co.uk Subject: [PATCH v4 67/90] target/sparc: Move gen_ne_fop_DDD insns to decodetree Date: Sat, 21 Oct 2023 23:00:08 -0700 Message-Id: <20231022060031.490251-68-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231022060031.490251-1-richard.henderson@linaro.org> References: <20231022060031.490251-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::431; envelope-from=richard.henderson@linaro.org; helo=mail-pf1-x431.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 Move FMUL8x16, FMUL8x16AU, FMUL8x16AL, FMUL8SUx16, FMUL8ULx16, FMULD8SUx16, FMULD8ULx16, FPMERGE, FEXPAND, FANDNOT1d, FANDNOT2d, FANDd, FNANDd, FNORd, FORNOT1d, FORNOT2d, FORd, FPADD16d, FPADD32d, FPSUB16d, FPSUB32d, FXNORd, FXORd. Signed-off-by: Richard Henderson --- target/sparc/insns.decode | 26 ++++++ target/sparc/translate.c | 178 +++++++++++++++----------------------- 2 files changed, 98 insertions(+), 106 deletions(-) diff --git a/target/sparc/insns.decode b/target/sparc/insns.decode index 0290f2aefb..0e29629b5c 100644 --- a/target/sparc/insns.decode +++ b/target/sparc/insns.decode @@ -270,6 +270,17 @@ FABSd 10 ..... 110100 00000 0 0000 1010 ..... @r_r2 BMASK 10 ..... 110110 ..... 0 0001 1001 ..... @r_r_r + FMUL8x16 10 ..... 110110 ..... 0 0011 0001 ..... @r_r_r + FMUL8x16AU 10 ..... 110110 ..... 0 0011 0011 ..... @r_r_r + FMUL8x16AL 10 ..... 110110 ..... 0 0011 0101 ..... @r_r_r + FMUL8SUx16 10 ..... 110110 ..... 0 0011 0110 ..... @r_r_r + FMUL8ULx16 10 ..... 110110 ..... 0 0011 0111 ..... @r_r_r + FMULD8SUx16 10 ..... 110110 ..... 0 0011 1000 ..... @r_r_r + FMULD8ULx16 10 ..... 110110 ..... 0 0011 1001 ..... @r_r_r + + FPMERGE 10 ..... 110110 ..... 0 0100 1011 ..... @r_r_r + FEXPAND 10 ..... 110110 ..... 0 0100 1101 ..... @r_r_r + FSRCd 10 ..... 110110 ..... 0 0111 0100 00000 @r_r1 # FSRC1d FSRCs 10 ..... 110110 ..... 0 0111 0101 00000 @r_r1 # FSRC1s FSRCd 10 ..... 110110 00000 0 0111 1000 ..... @r_r2 # FSRC2d @@ -279,19 +290,34 @@ FABSd 10 ..... 110100 00000 0 0000 1010 ..... @r_r2 FNOTd 10 ..... 110110 00000 0 0110 0110 ..... @r_r2 # FNOT2d FNOTs 10 ..... 110110 00000 0 0110 0111 ..... @r_r2 # FNOT2s + FPADD16 10 ..... 110110 ..... 0 0101 0000 ..... @r_r_r FPADD16s 10 ..... 110110 ..... 0 0101 0001 ..... @r_r_r + FPADD32 10 ..... 110110 ..... 0 0101 0010 ..... @r_r_r FPADD32s 10 ..... 110110 ..... 0 0101 0011 ..... @r_r_r + FPSUB16 10 ..... 110110 ..... 0 0101 0100 ..... @r_r_r FPSUB16s 10 ..... 110110 ..... 0 0101 0101 ..... @r_r_r + FPSUB32 10 ..... 110110 ..... 0 0101 0110 ..... @r_r_r FPSUB32s 10 ..... 110110 ..... 0 0101 0111 ..... @r_r_r + + FNORd 10 ..... 110110 ..... 0 0110 0010 ..... @r_r_r FNORs 10 ..... 110110 ..... 0 0110 0011 ..... @r_r_r + FANDNOTd 10 ..... 110110 ..... 0 0110 0100 ..... @r_r_r # FANDNOT2d FANDNOTs 10 ..... 110110 ..... 0 0110 0101 ..... @r_r_r # FANDNOT2s + FANDNOTd 10 ..... 110110 ..... 0 0110 1000 ..... @r_r_r_swap # ... 1d FANDNOTs 10 ..... 110110 ..... 0 0110 1001 ..... @r_r_r_swap # ... 1s + FXORd 10 ..... 110110 ..... 0 0110 1100 ..... @r_r_r FXORs 10 ..... 110110 ..... 0 0110 1101 ..... @r_r_r + FNANDd 10 ..... 110110 ..... 0 0110 1110 ..... @r_r_r FNANDs 10 ..... 110110 ..... 0 0110 1111 ..... @r_r_r + FANDd 10 ..... 110110 ..... 0 0111 0000 ..... @r_r_r FANDs 10 ..... 110110 ..... 0 0111 0001 ..... @r_r_r + FXNORd 10 ..... 110110 ..... 0 0111 0010 ..... @r_r_r FXNORs 10 ..... 110110 ..... 0 0111 0011 ..... @r_r_r + FORNOTd 10 ..... 110110 ..... 0 0111 0110 ..... @r_r_r # FORNOT2d FORNOTs 10 ..... 110110 ..... 0 0111 0111 ..... @r_r_r # FORNOT2s + FORNOTd 10 ..... 110110 ..... 0 0111 1010 ..... @r_r_r_swap # ... 1d FORNOTs 10 ..... 110110 ..... 0 0111 1011 ..... @r_r_r_swap # ... 1s + FORd 10 ..... 110110 ..... 0 0111 1100 ..... @r_r_r FORs 10 ..... 110110 ..... 0 0111 1101 ..... @r_r_r ] NCP 10 ----- 110110 ----- --------- ----- # v8 CPop1 diff --git a/target/sparc/translate.c b/target/sparc/translate.c index 1944936760..51f96d2253 100644 --- a/target/sparc/translate.c +++ b/target/sparc/translate.c @@ -59,6 +59,15 @@ #define gen_helper_retry(E) qemu_build_not_reached() #define gen_helper_udivx(D, E, A, B) qemu_build_not_reached() #define gen_helper_sdivx(D, E, A, B) qemu_build_not_reached() +#define gen_helper_fmul8x16 ({ g_assert_not_reached(); NULL; }) +#define gen_helper_fmul8x16au ({ g_assert_not_reached(); NULL; }) +#define gen_helper_fmul8x16al ({ g_assert_not_reached(); NULL; }) +#define gen_helper_fmul8sux16 ({ g_assert_not_reached(); NULL; }) +#define gen_helper_fmul8ulx16 ({ g_assert_not_reached(); NULL; }) +#define gen_helper_fmuld8sux16 ({ g_assert_not_reached(); NULL; }) +#define gen_helper_fmuld8ulx16 ({ g_assert_not_reached(); NULL; }) +#define gen_helper_fpmerge ({ g_assert_not_reached(); NULL; }) +#define gen_helper_fexpand ({ g_assert_not_reached(); NULL; }) #define FSR_LDXFSR_MASK ({ qemu_build_not_reached(); 0; }) #define FSR_LDXFSR_OLDMASK ({ qemu_build_not_reached(); 0; }) # ifdef CONFIG_USER_ONLY @@ -1654,20 +1663,6 @@ static void gen_fop_DDD(DisasContext *dc, int rd, int rs1, int rs2, } #ifdef TARGET_SPARC64 -static void gen_ne_fop_DDD(DisasContext *dc, int rd, int rs1, int rs2, - void (*gen)(TCGv_i64, TCGv_i64, TCGv_i64)) -{ - TCGv_i64 dst, src1, src2; - - src1 = gen_load_fpr_D(dc, rs1); - src2 = gen_load_fpr_D(dc, rs2); - dst = gen_dest_fpr_D(dc, rd); - - gen(dst, src1, src2); - - gen_store_fpr_D(dc, rd, dst); -} - static void gen_gsr_fop_DDD(DisasContext *dc, int rd, int rs1, int rs2, void (*gen)(TCGv_i64, TCGv_i64, TCGv_i64, TCGv_i64)) { @@ -5028,6 +5023,46 @@ TRANS(FXNORs, VIS1, do_fff, a, tcg_gen_eqv_i32) TRANS(FORNOTs, VIS1, do_fff, a, tcg_gen_orc_i32) TRANS(FORs, VIS1, do_fff, a, tcg_gen_or_i32) +static bool do_ddd(DisasContext *dc, arg_r_r_r *a, + void (*func)(TCGv_i64, TCGv_i64, TCGv_i64)) +{ + TCGv_i64 dst, src1, src2; + + if (gen_trap_ifnofpu(dc)) { + return true; + } + + dst = gen_dest_fpr_D(dc, a->rd); + src1 = gen_load_fpr_D(dc, a->rs1); + src2 = gen_load_fpr_D(dc, a->rs2); + func(dst, src1, src2); + gen_store_fpr_D(dc, a->rd, dst); + return advance_pc(dc); +} + +TRANS(FMUL8x16, VIS1, do_ddd, a, gen_helper_fmul8x16) +TRANS(FMUL8x16AU, VIS1, do_ddd, a, gen_helper_fmul8x16au) +TRANS(FMUL8x16AL, VIS1, do_ddd, a, gen_helper_fmul8x16al) +TRANS(FMUL8SUx16, VIS1, do_ddd, a, gen_helper_fmul8sux16) +TRANS(FMUL8ULx16, VIS1, do_ddd, a, gen_helper_fmul8ulx16) +TRANS(FMULD8SUx16, VIS1, do_ddd, a, gen_helper_fmuld8sux16) +TRANS(FMULD8ULx16, VIS1, do_ddd, a, gen_helper_fmuld8ulx16) +TRANS(FPMERGE, VIS1, do_ddd, a, gen_helper_fpmerge) +TRANS(FEXPAND, VIS1, do_ddd, a, gen_helper_fexpand) + +TRANS(FPADD16, VIS1, do_ddd, a, tcg_gen_vec_add16_i64) +TRANS(FPADD32, VIS1, do_ddd, a, tcg_gen_vec_add32_i64) +TRANS(FPSUB16, VIS1, do_ddd, a, tcg_gen_vec_sub16_i64) +TRANS(FPSUB32, VIS1, do_ddd, a, tcg_gen_vec_sub32_i64) +TRANS(FNORd, VIS1, do_ddd, a, tcg_gen_nor_i64) +TRANS(FANDNOTd, VIS1, do_ddd, a, tcg_gen_andc_i64) +TRANS(FXORd, VIS1, do_ddd, a, tcg_gen_xor_i64) +TRANS(FNANDd, VIS1, do_ddd, a, tcg_gen_nand_i64) +TRANS(FANDd, VIS1, do_ddd, a, tcg_gen_and_i64) +TRANS(FXNORd, VIS1, do_ddd, a, tcg_gen_eqv_i64) +TRANS(FORNOTd, VIS1, do_ddd, a, tcg_gen_orc_i64) +TRANS(FORd, VIS1, do_ddd, a, tcg_gen_or_i64) + #define CHECK_IU_FEATURE(dc, FEATURE) \ if (!((dc)->def->features & CPU_FEATURE_ ## FEATURE)) \ goto illegal_insn; @@ -5414,6 +5449,29 @@ static void disas_sparc_legacy(DisasContext *dc, unsigned int insn) case 0x077: /* VIS I fornot2s */ case 0x07b: /* VIS I fornot1s */ case 0x07d: /* VIS I fors */ + case 0x050: /* VIS I fpadd16 */ + case 0x052: /* VIS I fpadd32 */ + case 0x054: /* VIS I fpsub16 */ + case 0x056: /* VIS I fpsub32 */ + case 0x062: /* VIS I fnor */ + case 0x064: /* VIS I fandnot2 */ + case 0x068: /* VIS I fandnot1 */ + case 0x06c: /* VIS I fxor */ + case 0x06e: /* VIS I fnand */ + case 0x070: /* VIS I fand */ + case 0x072: /* VIS I fxnor */ + case 0x076: /* VIS I fornot2 */ + case 0x07a: /* VIS I fornot1 */ + case 0x07c: /* VIS I for */ + case 0x031: /* VIS I fmul8x16 */ + case 0x033: /* VIS I fmul8x16au */ + case 0x035: /* VIS I fmul8x16al */ + case 0x036: /* VIS I fmul8sux16 */ + case 0x037: /* VIS I fmul8ulx16 */ + case 0x038: /* VIS I fmuld8sux16 */ + case 0x039: /* VIS I fmuld8ulx16 */ + case 0x04b: /* VIS I fpmerge */ + case 0x04d: /* VIS I fexpand */ g_assert_not_reached(); /* in decodetree */ case 0x020: /* VIS I fcmple16 */ CHECK_FPU_FEATURE(dc, VIS1); @@ -5471,34 +5529,6 @@ static void disas_sparc_legacy(DisasContext *dc, unsigned int insn) gen_helper_fcmpeq32(cpu_dst, cpu_src1_64, cpu_src2_64); gen_store_gpr(dc, rd, cpu_dst); break; - case 0x031: /* VIS I fmul8x16 */ - CHECK_FPU_FEATURE(dc, VIS1); - gen_ne_fop_DDD(dc, rd, rs1, rs2, gen_helper_fmul8x16); - break; - case 0x033: /* VIS I fmul8x16au */ - CHECK_FPU_FEATURE(dc, VIS1); - gen_ne_fop_DDD(dc, rd, rs1, rs2, gen_helper_fmul8x16au); - break; - case 0x035: /* VIS I fmul8x16al */ - CHECK_FPU_FEATURE(dc, VIS1); - gen_ne_fop_DDD(dc, rd, rs1, rs2, gen_helper_fmul8x16al); - break; - case 0x036: /* VIS I fmul8sux16 */ - CHECK_FPU_FEATURE(dc, VIS1); - gen_ne_fop_DDD(dc, rd, rs1, rs2, gen_helper_fmul8sux16); - break; - case 0x037: /* VIS I fmul8ulx16 */ - CHECK_FPU_FEATURE(dc, VIS1); - gen_ne_fop_DDD(dc, rd, rs1, rs2, gen_helper_fmul8ulx16); - break; - case 0x038: /* VIS I fmuld8sux16 */ - CHECK_FPU_FEATURE(dc, VIS1); - gen_ne_fop_DDD(dc, rd, rs1, rs2, gen_helper_fmuld8sux16); - break; - case 0x039: /* VIS I fmuld8ulx16 */ - CHECK_FPU_FEATURE(dc, VIS1); - gen_ne_fop_DDD(dc, rd, rs1, rs2, gen_helper_fmuld8ulx16); - break; case 0x03a: /* VIS I fpack32 */ CHECK_FPU_FEATURE(dc, VIS1); gen_gsr_fop_DDD(dc, rd, rs1, rs2, gen_helper_fpack32); @@ -5525,34 +5555,10 @@ static void disas_sparc_legacy(DisasContext *dc, unsigned int insn) CHECK_FPU_FEATURE(dc, VIS1); gen_gsr_fop_DDD(dc, rd, rs1, rs2, gen_faligndata); break; - case 0x04b: /* VIS I fpmerge */ - CHECK_FPU_FEATURE(dc, VIS1); - gen_ne_fop_DDD(dc, rd, rs1, rs2, gen_helper_fpmerge); - break; case 0x04c: /* VIS II bshuffle */ CHECK_FPU_FEATURE(dc, VIS2); gen_gsr_fop_DDD(dc, rd, rs1, rs2, gen_helper_bshuffle); break; - case 0x04d: /* VIS I fexpand */ - CHECK_FPU_FEATURE(dc, VIS1); - gen_ne_fop_DDD(dc, rd, rs1, rs2, gen_helper_fexpand); - break; - case 0x050: /* VIS I fpadd16 */ - CHECK_FPU_FEATURE(dc, VIS1); - gen_ne_fop_DDD(dc, rd, rs1, rs2, tcg_gen_vec_add16_i64); - break; - case 0x052: /* VIS I fpadd32 */ - CHECK_FPU_FEATURE(dc, VIS1); - gen_ne_fop_DDD(dc, rd, rs1, rs2, tcg_gen_vec_add32_i64); - break; - case 0x054: /* VIS I fpsub16 */ - CHECK_FPU_FEATURE(dc, VIS1); - gen_ne_fop_DDD(dc, rd, rs1, rs2, tcg_gen_vec_sub16_i64); - break; - case 0x056: /* VIS I fpsub32 */ - CHECK_FPU_FEATURE(dc, VIS1); - gen_ne_fop_DDD(dc, rd, rs1, rs2, tcg_gen_vec_add32_i64); - break; case 0x060: /* VIS I fzero */ CHECK_FPU_FEATURE(dc, VIS1); cpu_dst_64 = gen_dest_fpr_D(dc, rd); @@ -5565,46 +5571,6 @@ static void disas_sparc_legacy(DisasContext *dc, unsigned int insn) tcg_gen_movi_i32(cpu_dst_32, 0); gen_store_fpr_F(dc, rd, cpu_dst_32); break; - case 0x062: /* VIS I fnor */ - CHECK_FPU_FEATURE(dc, VIS1); - gen_ne_fop_DDD(dc, rd, rs1, rs2, tcg_gen_nor_i64); - break; - case 0x064: /* VIS I fandnot2 */ - CHECK_FPU_FEATURE(dc, VIS1); - gen_ne_fop_DDD(dc, rd, rs1, rs2, tcg_gen_andc_i64); - break; - case 0x068: /* VIS I fandnot1 */ - CHECK_FPU_FEATURE(dc, VIS1); - gen_ne_fop_DDD(dc, rd, rs2, rs1, tcg_gen_andc_i64); - break; - case 0x06c: /* VIS I fxor */ - CHECK_FPU_FEATURE(dc, VIS1); - gen_ne_fop_DDD(dc, rd, rs1, rs2, tcg_gen_xor_i64); - break; - case 0x06e: /* VIS I fnand */ - CHECK_FPU_FEATURE(dc, VIS1); - gen_ne_fop_DDD(dc, rd, rs1, rs2, tcg_gen_nand_i64); - break; - case 0x070: /* VIS I fand */ - CHECK_FPU_FEATURE(dc, VIS1); - gen_ne_fop_DDD(dc, rd, rs1, rs2, tcg_gen_and_i64); - break; - case 0x072: /* VIS I fxnor */ - CHECK_FPU_FEATURE(dc, VIS1); - gen_ne_fop_DDD(dc, rd, rs1, rs2, tcg_gen_eqv_i64); - break; - case 0x076: /* VIS I fornot2 */ - CHECK_FPU_FEATURE(dc, VIS1); - gen_ne_fop_DDD(dc, rd, rs1, rs2, tcg_gen_orc_i64); - break; - case 0x07a: /* VIS I fornot1 */ - CHECK_FPU_FEATURE(dc, VIS1); - gen_ne_fop_DDD(dc, rd, rs2, rs1, tcg_gen_orc_i64); - break; - case 0x07c: /* VIS I for */ - CHECK_FPU_FEATURE(dc, VIS1); - gen_ne_fop_DDD(dc, rd, rs1, rs2, tcg_gen_or_i64); - break; case 0x07e: /* VIS I fone */ CHECK_FPU_FEATURE(dc, VIS1); cpu_dst_64 = gen_dest_fpr_D(dc, rd); From patchwork Sun Oct 22 06:00:09 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 736969 Delivered-To: patch@linaro.org Received: by 2002:adf:dd81:0:b0:32d:baff:b0ca with SMTP id x1csp1005866wrl; Sat, 21 Oct 2023 23:12:48 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHErHLNbWEEQdMBR2QoPIt6LHWfWXENgRN5FWH6ZQAKvKPyhnY76LFSJzWF7tujaousyEpz X-Received: by 2002:ac8:5c91:0:b0:418:1a99:3918 with SMTP id r17-20020ac85c91000000b004181a993918mr7937185qta.6.1697955168064; Sat, 21 Oct 2023 23:12:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697955168; cv=none; d=google.com; s=arc-20160816; b=ceKADXVuZfyiYAt3z6WaIjj10AkdzvrRuzCHr21Gj4+Vu2WJiBX7ISJdhIpWIWUILB 60FB0rxWmIAzPwPnEyD44B/vjntIXWcHpGB9K5SWiSP1LdiPe4qj1mkr0bIqEcZwVXpe sb3iYBC5VpbA4e0SrN3dS5ZjkohwKmAuw8+MFjnY8ofn6fyCs4aHQWLqD307/Ck7h4XS IKEmacbv+WehsvUnc4nkHSpW82+ywOBzEoTFZGcQRqBLX0rgRvUQWjdu7yi/R3gNwnvA V/occAMjS9xwWrovOP48Cf8r2VioB+Lg2t+87JC7TPzMeMEFh45NVdpHtNYFh4f1M7FB AoTw== 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=wobaPdMLmdNNcr2LxtwQ6wdYNx2FFwm+kYJQe6jhC/o=; fh=TYrED6TOMxGX0VC4GtjviASLbYyJe19+7/tKWjN44KQ=; b=xrVVe8784X90u3GKmqRLAZc06hHFaj0n/hZEgSNE8XmWthxI7dh5zoBACxkrUc+7ao 9YLTqCz73NLo7hyxET0GkPNHBTG1ERm6xQnjs68XqZtGoJz21Dx/2GZEycSVB7AqCyf5 ndEKNWWVBv9inFGXvbbvVGgnB8EnHbkq/aPm0EdcdFRDcdFdQP6z65SKygaTCRKtyMXN 1LzVcTvtcbzi1Hl6H7DiKvE8EOIyZ1jP2EgJrOelLfbmapsrRfo04tvdqJW2Pq1hjYyH Yf+6hw5/nbTiHvoqurnMJcWndAFgjwBx9DaVV75EPwmaxPrODFVw85sigKu+ECf7/x3C 6jzg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=MJF5p0lv; 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 k10-20020a05622a03ca00b0041975795c17si3549237qtx.230.2023.10.21.23.12.47 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sat, 21 Oct 2023 23:12:48 -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=MJF5p0lv; 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 1quRaw-00049u-Bq; Sun, 22 Oct 2023 02:05:50 -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 1quRaB-0001UO-Gf for qemu-devel@nongnu.org; Sun, 22 Oct 2023 02:05:04 -0400 Received: from mail-oo1-xc2e.google.com ([2607:f8b0:4864:20::c2e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1quRa9-0002J9-9M for qemu-devel@nongnu.org; Sun, 22 Oct 2023 02:05:02 -0400 Received: by mail-oo1-xc2e.google.com with SMTP id 006d021491bc7-584042a01eeso1440384eaf.2 for ; Sat, 21 Oct 2023 23:04:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1697954699; x=1698559499; 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=wobaPdMLmdNNcr2LxtwQ6wdYNx2FFwm+kYJQe6jhC/o=; b=MJF5p0lvhXBq8PEp0c4cunHN9MNkkkNtnyUC8f3gPiCBJMA0dnlODUdydrh3stBVec 6wNTmd+z1iric5Xil6rAFkJ4yOOBNgoUcN/r94ShYRHxZD3SdO+R0kbzGGxyR4hTp5pV l3TyPCaEVU9GSapvIQ/+/fkVn/3KOdtiPJaHT+wBFbA449Ev+qeHEWMX1rJl5QmYqfii drdfJ2E1/nnDPP+/x3bEEraEfZ7nf8i7r0ejAYvQYYvVW4IObfZwCkr9a9vswlcVyQIW 0ktZJy/wamPkyngshnNo6gKCOGao3cXzk0ExWVAhWu1xVFRPV/0yoN9B8A6uVCUzZBm9 Rc4A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697954699; x=1698559499; 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=wobaPdMLmdNNcr2LxtwQ6wdYNx2FFwm+kYJQe6jhC/o=; b=CaSz4GaE2tjwnp6TKo1C7e/tl/045FfP175wP743qyd0rlwADISWDOcnCdx6k4U9HL 07BU9QbmIM4rtPUZMClhNxsd67cJiIRObe0ol4pAOkympHosRf86UXWVuoLzvuCn75kN HbzPwlV2u5rCqOh0cThFUaHXOO0C9tQdH8kEJlqceSvljG6O5igOjompb6dW7qyNd9SC eaxc8YuMLhWwD0IoVirXyIfEDg5+JipvFeg7n5nR0twPRCGctficqBrJjSidWBQtyD2s UGDYKqVIapchKpIBjGI3TUXfY//qX/b7RHPyppEO0L3hR5K/oxutIvEH7WkODRfcchHA h5Ww== X-Gm-Message-State: AOJu0Yxizyp0FgwwtVzYP4gi3dhgx1+Aw2bUmCicyVKsddf8mTxnXWvF jyyoyWUiaJnOp7VEYWtOHwB15bZxpPoAbnV65Xk= X-Received: by 2002:a05:6358:5922:b0:142:eb11:b0b8 with SMTP id g34-20020a056358592200b00142eb11b0b8mr6936124rwf.1.1697954698887; Sat, 21 Oct 2023 23:04:58 -0700 (PDT) Received: from stoup.. ([71.212.149.95]) by smtp.gmail.com with ESMTPSA id fb13-20020a056a002d8d00b0068a46cd4120sm4007373pfb.199.2023.10.21.23.04.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 21 Oct 2023 23:04:58 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: mark.cave-ayland@ilande.co.uk Subject: [PATCH v4 68/90] target/sparc: Move PDIST to decodetree Date: Sat, 21 Oct 2023 23:00:09 -0700 Message-Id: <20231022060031.490251-69-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231022060031.490251-1-richard.henderson@linaro.org> References: <20231022060031.490251-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::c2e; envelope-from=richard.henderson@linaro.org; helo=mail-oo1-xc2e.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 | 1 + target/sparc/translate.c | 41 +++++++++++++++++++++------------------ 2 files changed, 23 insertions(+), 19 deletions(-) diff --git a/target/sparc/insns.decode b/target/sparc/insns.decode index 0e29629b5c..42d740ad44 100644 --- a/target/sparc/insns.decode +++ b/target/sparc/insns.decode @@ -277,6 +277,7 @@ FABSd 10 ..... 110100 00000 0 0000 1010 ..... @r_r2 FMUL8ULx16 10 ..... 110110 ..... 0 0011 0111 ..... @r_r_r FMULD8SUx16 10 ..... 110110 ..... 0 0011 1000 ..... @r_r_r FMULD8ULx16 10 ..... 110110 ..... 0 0011 1001 ..... @r_r_r + PDIST 10 ..... 110110 ..... 0 0011 1110 ..... @r_r_r FPMERGE 10 ..... 110110 ..... 0 0100 1011 ..... @r_r_r FEXPAND 10 ..... 110110 ..... 0 0100 1101 ..... @r_r_r diff --git a/target/sparc/translate.c b/target/sparc/translate.c index 51f96d2253..ebcc8fae6b 100644 --- a/target/sparc/translate.c +++ b/target/sparc/translate.c @@ -68,6 +68,7 @@ #define gen_helper_fmuld8ulx16 ({ g_assert_not_reached(); NULL; }) #define gen_helper_fpmerge ({ g_assert_not_reached(); NULL; }) #define gen_helper_fexpand ({ g_assert_not_reached(); NULL; }) +#define gen_helper_pdist ({ g_assert_not_reached(); NULL; }) #define FSR_LDXFSR_MASK ({ qemu_build_not_reached(); 0; }) #define FSR_LDXFSR_OLDMASK ({ qemu_build_not_reached(); 0; }) # ifdef CONFIG_USER_ONLY @@ -1676,21 +1677,6 @@ static void gen_gsr_fop_DDD(DisasContext *dc, int rd, int rs1, int rs2, gen_store_fpr_D(dc, rd, dst); } - -static void gen_ne_fop_DDDD(DisasContext *dc, int rd, int rs1, int rs2, - void (*gen)(TCGv_i64, TCGv_i64, TCGv_i64, TCGv_i64)) -{ - TCGv_i64 dst, src0, src1, src2; - - src1 = gen_load_fpr_D(dc, rs1); - src2 = gen_load_fpr_D(dc, rs2); - src0 = gen_load_fpr_D(dc, rd); - dst = gen_dest_fpr_D(dc, rd); - - gen(dst, src0, src1, src2); - - gen_store_fpr_D(dc, rd, dst); -} #endif static void gen_fop_QQ(DisasContext *dc, int rd, int rs, @@ -5063,6 +5049,26 @@ TRANS(FXNORd, VIS1, do_ddd, a, tcg_gen_eqv_i64) TRANS(FORNOTd, VIS1, do_ddd, a, tcg_gen_orc_i64) TRANS(FORd, VIS1, do_ddd, a, tcg_gen_or_i64) +static bool do_dddd(DisasContext *dc, arg_r_r_r *a, + void (*func)(TCGv_i64, TCGv_i64, TCGv_i64, TCGv_i64)) +{ + TCGv_i64 dst, src0, src1, src2; + + if (gen_trap_ifnofpu(dc)) { + return true; + } + + dst = gen_dest_fpr_D(dc, a->rd); + src0 = gen_load_fpr_D(dc, a->rd); + src1 = gen_load_fpr_D(dc, a->rs1); + src2 = gen_load_fpr_D(dc, a->rs2); + func(dst, src0, src1, src2); + gen_store_fpr_D(dc, a->rd, dst); + return advance_pc(dc); +} + +TRANS(PDIST, VIS1, do_dddd, a, gen_helper_pdist) + #define CHECK_IU_FEATURE(dc, FEATURE) \ if (!((dc)->def->features & CPU_FEATURE_ ## FEATURE)) \ goto illegal_insn; @@ -5472,6 +5478,7 @@ static void disas_sparc_legacy(DisasContext *dc, unsigned int insn) case 0x039: /* VIS I fmuld8ulx16 */ case 0x04b: /* VIS I fpmerge */ case 0x04d: /* VIS I fexpand */ + case 0x03e: /* VIS I pdist */ g_assert_not_reached(); /* in decodetree */ case 0x020: /* VIS I fcmple16 */ CHECK_FPU_FEATURE(dc, VIS1); @@ -5547,10 +5554,6 @@ static void disas_sparc_legacy(DisasContext *dc, unsigned int insn) gen_helper_fpackfix(cpu_dst_32, cpu_gsr, cpu_src1_64); gen_store_fpr_F(dc, rd, cpu_dst_32); break; - case 0x03e: /* VIS I pdist */ - CHECK_FPU_FEATURE(dc, VIS1); - gen_ne_fop_DDDD(dc, rd, rs1, rs2, gen_helper_pdist); - break; case 0x048: /* VIS I faligndata */ CHECK_FPU_FEATURE(dc, VIS1); gen_gsr_fop_DDD(dc, rd, rs1, rs2, gen_faligndata); From patchwork Sun Oct 22 06:00:10 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 736976 Delivered-To: patch@linaro.org Received: by 2002:adf:dd81:0:b0:32d:baff:b0ca with SMTP id x1csp1006033wrl; Sat, 21 Oct 2023 23:13:31 -0700 (PDT) X-Google-Smtp-Source: AGHT+IG6dvAOqJAq6PFaf6xvuB1ppFDRQs4B4l4amUOyFtjKiZ2ZyAIGJZ1NkDeCDe3W+mqtagJI X-Received: by 2002:a05:620a:28c6:b0:777:5120:d5ba with SMTP id l6-20020a05620a28c600b007775120d5bamr6486749qkp.8.1697955211690; Sat, 21 Oct 2023 23:13:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697955211; cv=none; d=google.com; s=arc-20160816; b=jWm93n0/4A7WxJXW/cU3/Lw01BZsnCA8M8fTyLhBQ2Iw2RpAsyUwOgWUMO20ooZJOm j3ZQmilEAULF0RqyPk+G0uZXDiiMLwkzyWJRULiTqWrG0ighUR0/iCranJUoJdZftfIR Tptm64Gg7kHEDN2Dt/YfiqzQVYgeMEY0Vzuqe0iqIOwBhpIBNhRdC6Z/FgD/utCxqixy EY+b9efQG2kNURb5BUYMCMOXtEW4HIwe3jd7zwe5IIsd8gNrLFL7T7iBwjD7F+0Aq4Tu RBkL0FF7ughgJ8WBtZxPh+CQ0tdhJXTGm0zxBwWCxjs9VtMIjiw/l4kaTNAt+oz4wZ0H qP3w== 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=TR+fWlwCjtkGBaCz8luUNVYFZSetVObTTw4qwW/abek=; fh=TYrED6TOMxGX0VC4GtjviASLbYyJe19+7/tKWjN44KQ=; b=o+PJ/WKsYdSMzNS+GzOdsP7RSl+rQGDwq5YF1UScdXOR0RVSSZVWXGcJ6ZIAm3twxf H2pQ0lQ0/0PoE2dEAuI/0WP4By58nXDTciTdF4sNErB8dIUHR25a5SHbFH9P5upizWlJ jYhib0SoMYZd+psffKanClUZvALTkCT7BLjGArdm4U2g/k7deq+ifcXjLN1p7NE4lhbR DeCCj3NkmC1JGyNOrknOm+XR33izJYZu8jlcsj78lsjaSfWEptaw/rjC1fGy9QDAukju cTksIAzLtFhnhm/s2SBIApK6Yd1VOFt6CSslep4+FAQIhPno4iDwKkCMzD1nOp2p7q+5 1C7g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=UwARxvkL; 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 vu7-20020a05620a560700b0077419a1ea24si3841590qkn.579.2023.10.21.23.13.31 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sat, 21 Oct 2023 23:13: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=UwARxvkL; 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 1quRax-0004Cr-6W; Sun, 22 Oct 2023 02:05:51 -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 1quRaB-0001VL-NJ for qemu-devel@nongnu.org; Sun, 22 Oct 2023 02:05:05 -0400 Received: from mail-oi1-x22d.google.com ([2607:f8b0:4864:20::22d]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1quRa9-0002JR-9s for qemu-devel@nongnu.org; Sun, 22 Oct 2023 02:05:03 -0400 Received: by mail-oi1-x22d.google.com with SMTP id 5614622812f47-3b2f28caab9so1505669b6e.1 for ; Sat, 21 Oct 2023 23:05:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1697954700; x=1698559500; 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=TR+fWlwCjtkGBaCz8luUNVYFZSetVObTTw4qwW/abek=; b=UwARxvkLmu40WyjmNYQwKx+YypVjDLPr22YkM4QtdJSLe+aqUDTwjjIxpeXfNjr4vG HcyR2RxC0fszOxWuGmt4eib1WyY5zm8SezZGYCJwfTGnSz8F558wbyuD4BnYEdt1rqV6 WD3O0t9xFWD5kJJtJTJRB1a1QwJFX3Sq7WXp6tTOFZe2tIfNLx+bi70txdnasftPHCwW yW6BgkcZ2pobYTuNOU9h4LPHRtdVRc970dsVxYPqLI8NX23Li0PJmA+n0f8BDmE4g7Wk E0X3ovd/7F6/Kk4WvYyopQjqSt+jP3v/aHBahISQY8Dk4ARvoVJz1Y6tmsU/mZselbOZ rtsA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697954700; x=1698559500; 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=TR+fWlwCjtkGBaCz8luUNVYFZSetVObTTw4qwW/abek=; b=PaW0ewpvRtjTbi//sUlIseqy7FFfbMwtRP5fBG0Ti/R9r6I6dkJAivAZEKeM3voVRE qRUTRLOQlPF6VHhGjGjX9Yd7wdK1iPTAEjSozoDKyne1hPZ3zQa8kgHlvMGK7VRPaXGE 8/pikiFbKFQmNjVFBgMLPd53jXRfRg9gYAhpGHtqZGLDfFIo0q/hv4rFgD5wBnBuuO4b OoSS1k7hLuezwhfyre1jVaqSrhXVn6tHvQDQc4A1LIso13m6pRLaAjXvN1m55FKDsVZI DnThvEGw+640iJJ4XgE+12AGlEGIBP7Ytcdpt6KCs91atMX+//tM+sSWdiPyFbRZ7rYI 1YPg== X-Gm-Message-State: AOJu0YwdeoJzmI2fJlCy6SDeSIg3clCVvVUeu3GvBXPqk4IfB9doeDDv P7INRYm43aGuChLXmkHj1UTCf6TD26RESt7HMTs= X-Received: by 2002:a05:6808:1c1:b0:3b2:f588:5a9c with SMTP id x1-20020a05680801c100b003b2f5885a9cmr6560572oic.6.1697954699793; Sat, 21 Oct 2023 23:04:59 -0700 (PDT) Received: from stoup.. ([71.212.149.95]) by smtp.gmail.com with ESMTPSA id fb13-20020a056a002d8d00b0068a46cd4120sm4007373pfb.199.2023.10.21.23.04.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 21 Oct 2023 23:04:59 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: mark.cave-ayland@ilande.co.uk Subject: [PATCH v4 69/90] target/sparc: Move gen_gsr_fop_DDD insns to decodetree Date: Sat, 21 Oct 2023 23:00:10 -0700 Message-Id: <20231022060031.490251-70-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231022060031.490251-1-richard.henderson@linaro.org> References: <20231022060031.490251-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::22d; envelope-from=richard.henderson@linaro.org; helo=mail-oi1-x22d.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 Move FPACK32, FALIGNDATA, BSHUFFLE. Signed-off-by: Richard Henderson --- target/sparc/insns.decode | 3 ++ target/sparc/translate.c | 101 ++++++++++++++++++++------------------ 2 files changed, 55 insertions(+), 49 deletions(-) diff --git a/target/sparc/insns.decode b/target/sparc/insns.decode index 42d740ad44..bc449023dd 100644 --- a/target/sparc/insns.decode +++ b/target/sparc/insns.decode @@ -277,9 +277,12 @@ FABSd 10 ..... 110100 00000 0 0000 1010 ..... @r_r2 FMUL8ULx16 10 ..... 110110 ..... 0 0011 0111 ..... @r_r_r FMULD8SUx16 10 ..... 110110 ..... 0 0011 1000 ..... @r_r_r FMULD8ULx16 10 ..... 110110 ..... 0 0011 1001 ..... @r_r_r + FPACK32 10 ..... 110110 ..... 0 0011 1010 ..... @r_r_r PDIST 10 ..... 110110 ..... 0 0011 1110 ..... @r_r_r + FALIGNDATAg 10 ..... 110110 ..... 0 0100 1000 ..... @r_r_r FPMERGE 10 ..... 110110 ..... 0 0100 1011 ..... @r_r_r + BSHUFFLE 10 ..... 110110 ..... 0 0100 1100 ..... @r_r_r FEXPAND 10 ..... 110110 ..... 0 0100 1101 ..... @r_r_r FSRCd 10 ..... 110110 ..... 0 0111 0100 00000 @r_r1 # FSRC1d diff --git a/target/sparc/translate.c b/target/sparc/translate.c index ebcc8fae6b..f60e7603d5 100644 --- a/target/sparc/translate.c +++ b/target/sparc/translate.c @@ -748,6 +748,51 @@ static void gen_op_array32(TCGv dst, TCGv src1, TCGv src2) tcg_gen_shli_tl(dst, dst, 2); } +static void gen_op_fpack32(TCGv_i64 dst, TCGv_i64 src1, TCGv_i64 src2) +{ +#ifdef TARGET_SPARC64 + gen_helper_fpack32(dst, cpu_gsr, src1, src2); +#else + g_assert_not_reached(); +#endif +} + +static void gen_op_faligndata(TCGv_i64 dst, TCGv_i64 s1, TCGv_i64 s2) +{ +#ifdef TARGET_SPARC64 + TCGv t1, t2, shift; + + t1 = tcg_temp_new(); + t2 = tcg_temp_new(); + shift = tcg_temp_new(); + + tcg_gen_andi_tl(shift, cpu_gsr, 7); + tcg_gen_shli_tl(shift, shift, 3); + tcg_gen_shl_tl(t1, s1, shift); + + /* + * A shift of 64 does not produce 0 in TCG. Divide this into a + * shift of (up to 63) followed by a constant shift of 1. + */ + tcg_gen_xori_tl(shift, shift, 63); + tcg_gen_shr_tl(t2, s2, shift); + tcg_gen_shri_tl(t2, t2, 1); + + tcg_gen_or_tl(dst, t1, t2); +#else + g_assert_not_reached(); +#endif +} + +static void gen_op_bshuffle(TCGv_i64 dst, TCGv_i64 src1, TCGv_i64 src2) +{ +#ifdef TARGET_SPARC64 + gen_helper_bshuffle(dst, cpu_gsr, src1, src2); +#else + g_assert_not_reached(); +#endif +} + // 1 static void gen_op_eval_ba(TCGv dst) { @@ -1663,22 +1708,6 @@ static void gen_fop_DDD(DisasContext *dc, int rd, int rs1, int rs2, gen_store_fpr_D(dc, rd, dst); } -#ifdef TARGET_SPARC64 -static void gen_gsr_fop_DDD(DisasContext *dc, int rd, int rs1, int rs2, - void (*gen)(TCGv_i64, TCGv_i64, TCGv_i64, TCGv_i64)) -{ - TCGv_i64 dst, src1, src2; - - src1 = gen_load_fpr_D(dc, rs1); - src2 = gen_load_fpr_D(dc, rs2); - dst = gen_dest_fpr_D(dc, rd); - - gen(dst, cpu_gsr, src1, src2); - - gen_store_fpr_D(dc, rd, dst); -} -#endif - static void gen_fop_QQ(DisasContext *dc, int rd, int rs, void (*gen)(TCGv_ptr)) { @@ -2702,27 +2731,6 @@ static void gen_load_trap_state_at_tl(TCGv_ptr r_tsptr) tcg_gen_add_ptr(r_tsptr, r_tsptr, r_tl_tmp); } } - -static void gen_faligndata(TCGv dst, TCGv gsr, TCGv s1, TCGv s2) -{ - TCGv t1, t2, shift; - - t1 = tcg_temp_new(); - t2 = tcg_temp_new(); - shift = tcg_temp_new(); - - tcg_gen_andi_tl(shift, gsr, 7); - tcg_gen_shli_tl(shift, shift, 3); - tcg_gen_shl_tl(t1, s1, shift); - - /* A shift of 64 does not produce 0 in TCG. Divide this into a - shift of (up to 63) followed by a constant shift of 1. */ - tcg_gen_xori_tl(shift, shift, 63); - tcg_gen_shr_tl(t2, s2, shift); - tcg_gen_shri_tl(t2, t2, 1); - - tcg_gen_or_tl(dst, t1, t2); -} #endif static int extract_dfpreg(DisasContext *dc, int x) @@ -5049,6 +5057,10 @@ TRANS(FXNORd, VIS1, do_ddd, a, tcg_gen_eqv_i64) TRANS(FORNOTd, VIS1, do_ddd, a, tcg_gen_orc_i64) TRANS(FORd, VIS1, do_ddd, a, tcg_gen_or_i64) +TRANS(FPACK32, VIS1, do_ddd, a, gen_op_fpack32) +TRANS(FALIGNDATAg, VIS1, do_ddd, a, gen_op_faligndata) +TRANS(BSHUFFLE, VIS2, do_ddd, a, gen_op_bshuffle) + static bool do_dddd(DisasContext *dc, arg_r_r_r *a, void (*func)(TCGv_i64, TCGv_i64, TCGv_i64, TCGv_i64)) { @@ -5479,6 +5491,9 @@ static void disas_sparc_legacy(DisasContext *dc, unsigned int insn) case 0x04b: /* VIS I fpmerge */ case 0x04d: /* VIS I fexpand */ case 0x03e: /* VIS I pdist */ + case 0x03a: /* VIS I fpack32 */ + case 0x048: /* VIS I faligndata */ + case 0x04c: /* VIS II bshuffle */ g_assert_not_reached(); /* in decodetree */ case 0x020: /* VIS I fcmple16 */ CHECK_FPU_FEATURE(dc, VIS1); @@ -5536,10 +5551,6 @@ static void disas_sparc_legacy(DisasContext *dc, unsigned int insn) gen_helper_fcmpeq32(cpu_dst, cpu_src1_64, cpu_src2_64); gen_store_gpr(dc, rd, cpu_dst); break; - case 0x03a: /* VIS I fpack32 */ - CHECK_FPU_FEATURE(dc, VIS1); - gen_gsr_fop_DDD(dc, rd, rs1, rs2, gen_helper_fpack32); - break; case 0x03b: /* VIS I fpack16 */ CHECK_FPU_FEATURE(dc, VIS1); cpu_src1_64 = gen_load_fpr_D(dc, rs2); @@ -5554,14 +5565,6 @@ static void disas_sparc_legacy(DisasContext *dc, unsigned int insn) gen_helper_fpackfix(cpu_dst_32, cpu_gsr, cpu_src1_64); gen_store_fpr_F(dc, rd, cpu_dst_32); break; - case 0x048: /* VIS I faligndata */ - CHECK_FPU_FEATURE(dc, VIS1); - gen_gsr_fop_DDD(dc, rd, rs1, rs2, gen_faligndata); - break; - case 0x04c: /* VIS II bshuffle */ - CHECK_FPU_FEATURE(dc, VIS2); - gen_gsr_fop_DDD(dc, rd, rs1, rs2, gen_helper_bshuffle); - break; case 0x060: /* VIS I fzero */ CHECK_FPU_FEATURE(dc, VIS1); cpu_dst_64 = gen_dest_fpr_D(dc, rd); From patchwork Sun Oct 22 06:00:11 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 737000 Delivered-To: patch@linaro.org Received: by 2002:adf:dd81:0:b0:32d:baff:b0ca with SMTP id x1csp1006348wrl; Sat, 21 Oct 2023 23:14:47 -0700 (PDT) X-Google-Smtp-Source: AGHT+IG6Kgz5PQZjpSzkygrRSNijgokJsdYj8V1WoZQV9qwz0DRJWOqiRHTDaDr7yUNK984AFHVI X-Received: by 2002:a05:620a:3953:b0:777:ac03:4b51 with SMTP id qs19-20020a05620a395300b00777ac034b51mr12017961qkn.14.1697955287646; Sat, 21 Oct 2023 23:14:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697955287; cv=none; d=google.com; s=arc-20160816; b=vfqs1ug/EFdlJNFj6mLMl9pqgVjVFnivEUgj0Y+kOoHpqcyrrad0wwtEXYTU9fDavd ZMEG2HOQCbwLh34ZqoR5B0k9tEkFyurNLvx0kUS2bdtEra8YIn2f3/r9iOffw3V4Og9D 2AU5BI4FTHcGlOXG0C97V7RoDBJHfBDX7V2xoKB9uBeMdCmpaeTf/7VWvrmCzge3vf6y EAkkmE7/880QLIPCWAz2H1TTtLUwRABy8ix8yPXa1+e9m8U6hti40M8BG4S9YWa/p8Ju V1bLZI73X1ujuoH0I8C5fYUhUOgOvlmFIlytJbslAziBgKgUyEgjYjXpf/ZmWBPYI72O RCUw== 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=gt7vNVHDSQjpKHVY0urCrIGKDYssGAGhvlT0D79szQE=; fh=TYrED6TOMxGX0VC4GtjviASLbYyJe19+7/tKWjN44KQ=; b=06lir3soevhZYyrF06G2+JFF8nEmM4twJtVb4dJpd++lUk5TwEls/g9PC3ZL/1OOZx 8k+7dDy8CehiExy4SEvr/tWM3pXVQJ16OvtxJfsSQSBywbbUNfRhQOloiDChDIHBGHg4 INhLUHpjcaHctNauwT8QmlxJab05w5KI5sr8wBVLEoGx1WAmceznP//S3dOhQ38o/h2U r2My9tWAambCgkndlwiCCc1Dpxt6wTDuPpJgwKNNu54O87jYUYelZCiKtQ1W1+HqGt5n zUuTCpM+PZkVolKwVAsFbQWOjnLfA/Z0glolJBVNhFPdg6wb88dJIatpHkLj8tIatLkd /t8Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=AckcCwxt; 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 j6-20020a05620a288600b0077435da759esi3650932qkp.595.2023.10.21.23.14.47 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sat, 21 Oct 2023 23:14:47 -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=AckcCwxt; 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 1quRas-0003w0-MA; Sun, 22 Oct 2023 02:05:46 -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 1quRaC-0001cm-V5 for qemu-devel@nongnu.org; Sun, 22 Oct 2023 02:05:05 -0400 Received: from mail-pf1-x42b.google.com ([2607:f8b0:4864:20::42b]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1quRaA-0002JZ-9d for qemu-devel@nongnu.org; Sun, 22 Oct 2023 02:05:04 -0400 Received: by mail-pf1-x42b.google.com with SMTP id d2e1a72fcca58-6b44befac59so2441266b3a.0 for ; Sat, 21 Oct 2023 23:05:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1697954701; x=1698559501; 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=gt7vNVHDSQjpKHVY0urCrIGKDYssGAGhvlT0D79szQE=; b=AckcCwxto8NTVb5WKPt+EYNypfWTOUq11IIos2r/WoXOU+6fcC+9X6kGbdC251U3JZ F128Tu+lcuyht+/CbHGS9IbLZryM6qLXk7qA/dPJbTudG65INx/RwZ5iLTBShbHk064B gRNlRArek/MU46vYpyiG4Jp8N1R8y4YnZxXTD+5lvK3AF+uQIPZ5EwIEii293wNhoRTy K4LG3IDopjcPgwwS20tqaj3lp+k5BPOCJb5ZxFrcJqj0surRx4BL/6GGINyi33N8QGQp oFveGKn2cPJ2LqzoO9CCjLZWMcRxYq5R1QhJKrGKxlQALPoci5aIDHxK+oVbsWGa1TE0 c98g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697954701; x=1698559501; 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=gt7vNVHDSQjpKHVY0urCrIGKDYssGAGhvlT0D79szQE=; b=bZZu+nl0OZ1BIKfA0v4bTLKzzaV6Br++mP2+eoJUsFMUl/vUtuhWfq4KO4C5SARV3c FEjBk9c2QM9c3TiQirSC89zf3jWP8G3DllMF4nUYz24wd3+ajzk7vzLuKBYJ4QwlOTWD KIiRidxA8bxHm01cdLrci0Nx6Gy4/OpG+LqcJv5UrOaCpD+IBKgp5YVynIrO38bIdgaa x0N0LozjtRIqBmi5YadDWJv24gQ6vePv1Q3JMihzGRW5RwZWbT6GTHDj5Fa897oOozuW 5yiUGYvX6nhZkMLVOCQ0QpuNXbi0x03RiKxIQEHaDyrqEwAaTBnj5GFa/z8H4rWN8+1E WzyA== X-Gm-Message-State: AOJu0Yz1HDNbTG6CQkBZmmJ18NKXlMtmzEdxnnVp4uyZdhSsuF0PHRrr GEIPZUflE9pekdUZaJHsjff13FzU+kGB52Rc6B4= X-Received: by 2002:a05:6a20:2593:b0:15d:8366:65be with SMTP id k19-20020a056a20259300b0015d836665bemr7243437pzd.9.1697954700701; Sat, 21 Oct 2023 23:05:00 -0700 (PDT) Received: from stoup.. ([71.212.149.95]) by smtp.gmail.com with ESMTPSA id fb13-20020a056a002d8d00b0068a46cd4120sm4007373pfb.199.2023.10.21.23.04.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 21 Oct 2023 23:05:00 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: mark.cave-ayland@ilande.co.uk Subject: [PATCH v4 70/90] target/sparc: Move gen_fop_FF insns to decodetree Date: Sat, 21 Oct 2023 23:00:11 -0700 Message-Id: <20231022060031.490251-71-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231022060031.490251-1-richard.henderson@linaro.org> References: <20231022060031.490251-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::42b; envelope-from=richard.henderson@linaro.org; helo=mail-pf1-x42b.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 Move FSQRTs, FiTOs, FsTOi. Signed-off-by: Richard Henderson --- target/sparc/insns.decode | 3 +++ target/sparc/translate.c | 47 ++++++++++++++++++++------------------- 2 files changed, 27 insertions(+), 23 deletions(-) diff --git a/target/sparc/insns.decode b/target/sparc/insns.decode index bc449023dd..85464285b7 100644 --- a/target/sparc/insns.decode +++ b/target/sparc/insns.decode @@ -245,6 +245,9 @@ FNEGs 10 ..... 110100 00000 0 0000 0101 ..... @r_r2 FNEGd 10 ..... 110100 00000 0 0000 0110 ..... @r_r2 FABSs 10 ..... 110100 00000 0 0000 1001 ..... @r_r2 FABSd 10 ..... 110100 00000 0 0000 1010 ..... @r_r2 +FSQRTs 10 ..... 110100 00000 0 0010 1001 ..... @r_r2 +FiTOs 10 ..... 110100 00000 0 1100 0100 ..... @r_r2 +FsTOi 10 ..... 110100 00000 0 1101 0001 ..... @r_r2 { [ diff --git a/target/sparc/translate.c b/target/sparc/translate.c index f60e7603d5..ce5e6ef6ab 100644 --- a/target/sparc/translate.c +++ b/target/sparc/translate.c @@ -1650,20 +1650,6 @@ static int gen_trap_ifnofpu(DisasContext *dc) return 0; } -static void gen_fop_FF(DisasContext *dc, int rd, int rs, - void (*gen)(TCGv_i32, TCGv_ptr, TCGv_i32)) -{ - TCGv_i32 dst, src; - - src = gen_load_fpr_F(dc, rs); - dst = gen_dest_fpr_F(dc); - - gen(dst, tcg_env, src); - gen_helper_check_ieee_exceptions(cpu_fsr, tcg_env); - - gen_store_fpr_F(dc, rd, dst); -} - static void gen_fop_FFF(DisasContext *dc, int rd, int rs1, int rs2, void (*gen)(TCGv_i32, TCGv_ptr, TCGv_i32, TCGv_i32)) { @@ -4966,6 +4952,27 @@ TRANS(FABSs, ALL, do_ff, a, gen_op_fabss) TRANS(FSRCs, VIS1, do_ff, a, tcg_gen_mov_i32) TRANS(FNOTs, VIS1, do_ff, a, tcg_gen_not_i32) +static bool do_env_ff(DisasContext *dc, arg_r_r *a, + void (*func)(TCGv_i32, TCGv_env, TCGv_i32)) +{ + TCGv_i32 tmp; + + if (gen_trap_ifnofpu(dc)) { + return true; + } + + gen_op_clear_ieee_excp_and_FTT(); + tmp = gen_load_fpr_F(dc, a->rs); + func(tmp, tcg_env, tmp); + gen_helper_check_ieee_exceptions(cpu_fsr, tcg_env); + gen_store_fpr_F(dc, a->rd, tmp); + return advance_pc(dc); +} + +TRANS(FSQRTs, ALL, do_env_ff, a, gen_helper_fsqrts) +TRANS(FiTOs, ALL, do_env_ff, a, gen_helper_fitos) +TRANS(FsTOi, ALL, do_env_ff, a, gen_helper_fstoi) + static bool do_dd(DisasContext *dc, arg_r_r *a, void (*func)(TCGv_i64, TCGv_i64)) { @@ -5127,10 +5134,10 @@ static void disas_sparc_legacy(DisasContext *dc, unsigned int insn) case 0x2: /* V9 fmovd */ case 0x6: /* V9 fnegd */ case 0xa: /* V9 fabsd */ - g_assert_not_reached(); /* in decodetree */ case 0x29: /* fsqrts */ - gen_fop_FF(dc, rd, rs2, gen_helper_fsqrts); - break; + case 0xc4: /* fitos */ + case 0xd1: /* fstoi */ + g_assert_not_reached(); /* in decodetree */ case 0x2a: /* fsqrtd */ gen_fop_DD(dc, rd, rs2, gen_helper_fsqrtd); break; @@ -5186,9 +5193,6 @@ static void disas_sparc_legacy(DisasContext *dc, unsigned int insn) CHECK_FPU_FEATURE(dc, FLOAT128); gen_fop_QDD(dc, rd, rs1, rs2, gen_helper_fdmulq); break; - case 0xc4: /* fitos */ - gen_fop_FF(dc, rd, rs2, gen_helper_fitos); - break; case 0xc6: /* fdtos */ gen_fop_FD(dc, rd, rs2, gen_helper_fdtos); break; @@ -5218,9 +5222,6 @@ static void disas_sparc_legacy(DisasContext *dc, unsigned int insn) CHECK_FPU_FEATURE(dc, FLOAT128); gen_ne_fop_QD(dc, rd, rs2, gen_helper_fdtoq); break; - case 0xd1: /* fstoi */ - gen_fop_FF(dc, rd, rs2, gen_helper_fstoi); - break; case 0xd2: /* fdtoi */ gen_fop_FD(dc, rd, rs2, gen_helper_fdtoi); break; From patchwork Sun Oct 22 06:00:12 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 736973 Delivered-To: patch@linaro.org Received: by 2002:adf:dd81:0:b0:32d:baff:b0ca with SMTP id x1csp1005984wrl; Sat, 21 Oct 2023 23:13:20 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHKdDwNrWDIA0Vnv46ZkSdiir9+xzXlyZ7QWnMmrsU0RjBiAcxsBrOCDtRrRt6oGIBXMcyp X-Received: by 2002:a05:6214:300f:b0:66d:630a:79b9 with SMTP id ke15-20020a056214300f00b0066d630a79b9mr6426287qvb.40.1697955199966; Sat, 21 Oct 2023 23:13:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697955199; cv=none; d=google.com; s=arc-20160816; b=hvoZAuWWb39hQCNG8iNk+LqLbFMxTK+FgTZ/HrJTa601xHlqRQdWDo9dHMlJksb1u2 nvvi4Ynx2cfkncHmWAhcmOr0p+iALi+Fs1czyOsOuc5yWzsO70fInEaMEn/1t6RaBdf7 vXCk208k73zNyVvvCr8xPr4B/nh+MeAkcngjYGyPPwiphZ6U5qyE9fizRgsNfEf9JXeS Ewt0YF7xv3FwCfhm7H/Ghxj86XeyDVhJVojd319OZ6Na2FgjJ+QAHt6z+HBYe16BhW94 0ST1KFTGXMRPp0TQkYrBE9/vcRyl9sGgpqyWQUT3m0xI46ae8vjRCJxHyifXv9r5VPaz WhVA== 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=M6g5vyScz+ALeWhTnmxU/lfyDo1xkWRNCrvwy5rwAQA=; fh=TYrED6TOMxGX0VC4GtjviASLbYyJe19+7/tKWjN44KQ=; b=VYxqIwPZo4PxVatmdPx304XRFM+nFPXDLcIn4n3Bv7EmRyA8lvaCWMrZGPhiiEfbQY LmGqLhp74f75BmDJYMaKH/xj6SY3CZ36W++I2bgt9TShsojC1AXMmfpCqphiNglttzEL EOEWu+EuqpEHvN6V8AjoLuQgCAzrBL58zGItguX1YvCEOEehm3y6mPHZckmKx89avyz6 rEkkL+ovoYYMLZMxQBNAZiLxcKDpWrx3iYyidMOHQvNp8Qlu+qLldT6+uIKMiByPdQ7j /UvRkN1/5R1zf3gx+iw8euVgdsIH1fwnR9SvsfArsLUN18gCWGeyDbCRIBL/46UmpVdW dvSQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=jIkuXhki; 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 oh8-20020a056214438800b0065af80f546asi3996648qvb.2.2023.10.21.23.13.19 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sat, 21 Oct 2023 23:13: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=jIkuXhki; 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 1quRbQ-0004qL-3t; Sun, 22 Oct 2023 02:06:20 -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 1quRaD-0001eE-Dg for qemu-devel@nongnu.org; Sun, 22 Oct 2023 02:05:05 -0400 Received: from mail-oi1-x232.google.com ([2607:f8b0:4864:20::232]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1quRaA-0002K0-PA for qemu-devel@nongnu.org; Sun, 22 Oct 2023 02:05:04 -0400 Received: by mail-oi1-x232.google.com with SMTP id 5614622812f47-3af604c3f8fso1698286b6e.1 for ; Sat, 21 Oct 2023 23:05:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1697954701; x=1698559501; 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=M6g5vyScz+ALeWhTnmxU/lfyDo1xkWRNCrvwy5rwAQA=; b=jIkuXhkiADGE7cj+vQhA7HH9vNc5K9LCnXL9fYMwpU5x12kUUhnhXPZyammRZI7Uz8 L2aWrsBqvacNd24FWmOZdGc5r+xtNYjLwxxpU8CskZ6iXqAiShVYbve3IwGq5+g3j7uq fhqW7FJxZuf43KZv9QbQOkwCE63S5BuhP/1ndyDJfj4ELvvkDy57NClYYnddqT841CmS ALd32KVIsE6WQ5kRqggDXnaW3Bj5wWRvWrA7YR637h6O6sprUouzlvMC8CLB3SvekUkw R4Lb7eEkxf9KDsR6JQIxBHeQqoUYGpeJCtJourwR3X2ntiQhcVmPpKACaVDag5lBU82R IwfA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697954701; x=1698559501; 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=M6g5vyScz+ALeWhTnmxU/lfyDo1xkWRNCrvwy5rwAQA=; b=hgmTVb0DrSVQBICES1FXmGoPN8bxaHXN/vj2T2z7Kd9gKTnolESptx/veS5WNljexA hA996yyVGvIpKGKJy0KCYI5+y566ceb1Q2VLLxA02/WZzlp1GKu4gPIfcD5mAuGm9xF6 qa7lAuYlWE92OUaHlWbuXNrB+meygDvQgldZXVlxWmSrI25ddF/ykQ//6XfZti/p5Kbi QkWaI+XnS4HZxr+wt7qA6Y2hPG4bl00m3TR9XlkgRiA8pvokKi00i0j3hDDCDjGHOzvJ vidgASFLsIF0HVLU2xnmKSfZVEwTedDRxCNmhu/CWVpE3YbUG3Dsp0RTAkicwF7bY94z PQ7Q== X-Gm-Message-State: AOJu0YwQ2IPsPaIk5GUeGTAXbVir61S1kvJw/E67Kk3hs8kjujZgc/4T XWhg008FPhxlI+xnzFCJbhp78wco/qOYqzWoRPA= X-Received: by 2002:a05:6808:309a:b0:3b2:e5cb:8e53 with SMTP id bl26-20020a056808309a00b003b2e5cb8e53mr8653629oib.10.1697954701498; Sat, 21 Oct 2023 23:05:01 -0700 (PDT) Received: from stoup.. ([71.212.149.95]) by smtp.gmail.com with ESMTPSA id fb13-20020a056a002d8d00b0068a46cd4120sm4007373pfb.199.2023.10.21.23.05.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 21 Oct 2023 23:05:01 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: mark.cave-ayland@ilande.co.uk Subject: [PATCH v4 71/90] target/sparc: Move gen_fop_DD insns to decodetree Date: Sat, 21 Oct 2023 23:00:12 -0700 Message-Id: <20231022060031.490251-72-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231022060031.490251-1-richard.henderson@linaro.org> References: <20231022060031.490251-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::232; envelope-from=richard.henderson@linaro.org; helo=mail-oi1-x232.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 Move FSQRTd, FxTOd, FdTOx. Signed-off-by: Richard Henderson --- target/sparc/insns.decode | 3 +++ target/sparc/translate.c | 50 +++++++++++++++++++++------------------ 2 files changed, 30 insertions(+), 23 deletions(-) diff --git a/target/sparc/insns.decode b/target/sparc/insns.decode index 85464285b7..1d766fab21 100644 --- a/target/sparc/insns.decode +++ b/target/sparc/insns.decode @@ -246,6 +246,9 @@ FNEGd 10 ..... 110100 00000 0 0000 0110 ..... @r_r2 FABSs 10 ..... 110100 00000 0 0000 1001 ..... @r_r2 FABSd 10 ..... 110100 00000 0 0000 1010 ..... @r_r2 FSQRTs 10 ..... 110100 00000 0 0010 1001 ..... @r_r2 +FSQRTd 10 ..... 110100 00000 0 0010 1010 ..... @r_r2 +FdTOx 10 ..... 110100 00000 0 1000 0010 ..... @r_r2 +FxTOd 10 ..... 110100 00000 0 1000 1000 ..... @r_r2 FiTOs 10 ..... 110100 00000 0 1100 0100 ..... @r_r2 FsTOi 10 ..... 110100 00000 0 1101 0001 ..... @r_r2 diff --git a/target/sparc/translate.c b/target/sparc/translate.c index ce5e6ef6ab..1d046151d9 100644 --- a/target/sparc/translate.c +++ b/target/sparc/translate.c @@ -53,6 +53,8 @@ #define gen_helper_write_softint(E, S) qemu_build_not_reached() #define gen_helper_saved ({ qemu_build_not_reached(); NULL; }) #define gen_helper_restored ({ qemu_build_not_reached(); NULL; }) +#define gen_helper_fdtox ({ qemu_build_not_reached(); NULL; }) +#define gen_helper_fxtod ({ qemu_build_not_reached(); NULL; }) #define gen_helper_fnegd(D, S) qemu_build_not_reached() #define gen_helper_fabsd(D, S) qemu_build_not_reached() #define gen_helper_done(E) qemu_build_not_reached() @@ -1665,20 +1667,6 @@ static void gen_fop_FFF(DisasContext *dc, int rd, int rs1, int rs2, gen_store_fpr_F(dc, rd, dst); } -static void gen_fop_DD(DisasContext *dc, int rd, int rs, - void (*gen)(TCGv_i64, TCGv_ptr, TCGv_i64)) -{ - TCGv_i64 dst, src; - - src = gen_load_fpr_D(dc, rs); - dst = gen_dest_fpr_D(dc, rd); - - gen(dst, tcg_env, src); - gen_helper_check_ieee_exceptions(cpu_fsr, tcg_env); - - gen_store_fpr_D(dc, rd, dst); -} - static void gen_fop_DDD(DisasContext *dc, int rd, int rs1, int rs2, void (*gen)(TCGv_i64, TCGv_ptr, TCGv_i64, TCGv_i64)) { @@ -4995,6 +4983,28 @@ TRANS(FABSd, 64, do_dd, a, gen_op_fabsd) TRANS(FSRCd, VIS1, do_dd, a, tcg_gen_mov_i64) TRANS(FNOTd, VIS1, do_dd, a, tcg_gen_not_i64) +static bool do_env_dd(DisasContext *dc, arg_r_r *a, + void (*func)(TCGv_i64, TCGv_env, TCGv_i64)) +{ + TCGv_i64 dst, src; + + if (gen_trap_ifnofpu(dc)) { + return true; + } + + gen_op_clear_ieee_excp_and_FTT(); + dst = gen_dest_fpr_D(dc, a->rd); + src = gen_load_fpr_D(dc, a->rs); + func(dst, tcg_env, src); + gen_helper_check_ieee_exceptions(cpu_fsr, tcg_env); + gen_store_fpr_D(dc, a->rd, dst); + return advance_pc(dc); +} + +TRANS(FSQRTd, ALL, do_env_dd, a, gen_helper_fsqrtd) +TRANS(FxTOd, 64, do_env_dd, a, gen_helper_fxtod) +TRANS(FdTOx, 64, do_env_dd, a, gen_helper_fdtox) + static bool do_fff(DisasContext *dc, arg_r_r_r *a, void (*func)(TCGv_i32, TCGv_i32, TCGv_i32)) { @@ -5137,10 +5147,10 @@ static void disas_sparc_legacy(DisasContext *dc, unsigned int insn) case 0x29: /* fsqrts */ case 0xc4: /* fitos */ case 0xd1: /* fstoi */ - g_assert_not_reached(); /* in decodetree */ case 0x2a: /* fsqrtd */ - gen_fop_DD(dc, rd, rs2, gen_helper_fsqrtd); - break; + case 0x82: /* V9 fdtox */ + case 0x88: /* V9 fxtod */ + g_assert_not_reached(); /* in decodetree */ case 0x2b: /* fsqrtq */ CHECK_FPU_FEATURE(dc, FLOAT128); gen_fop_QQ(dc, rd, rs2, gen_helper_fsqrtq); @@ -5245,9 +5255,6 @@ static void disas_sparc_legacy(DisasContext *dc, unsigned int insn) case 0x81: /* V9 fstox */ gen_fop_DF(dc, rd, rs2, gen_helper_fstox); break; - case 0x82: /* V9 fdtox */ - gen_fop_DD(dc, rd, rs2, gen_helper_fdtox); - break; case 0x83: /* V9 fqtox */ CHECK_FPU_FEATURE(dc, FLOAT128); gen_fop_DQ(dc, rd, rs2, gen_helper_fqtox); @@ -5255,9 +5262,6 @@ static void disas_sparc_legacy(DisasContext *dc, unsigned int insn) case 0x84: /* V9 fxtos */ gen_fop_FD(dc, rd, rs2, gen_helper_fxtos); break; - case 0x88: /* V9 fxtod */ - gen_fop_DD(dc, rd, rs2, gen_helper_fxtod); - break; case 0x8c: /* V9 fxtoq */ CHECK_FPU_FEATURE(dc, FLOAT128); gen_ne_fop_QD(dc, rd, rs2, gen_helper_fxtoq); From patchwork Sun Oct 22 06:00:13 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 736962 Delivered-To: patch@linaro.org Received: by 2002:adf:dd81:0:b0:32d:baff:b0ca with SMTP id x1csp1005788wrl; Sat, 21 Oct 2023 23:12:23 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFCM64Ry8/W9dS4RkpSgiTSiJM5hzKgUZaCOO2/p5wYcxeGVYL5bEAm7N9Ygi07L+LqQ8nw X-Received: by 2002:a05:620a:284b:b0:777:5b4e:e52e with SMTP id h11-20020a05620a284b00b007775b4ee52emr6285090qkp.66.1697955143277; Sat, 21 Oct 2023 23:12:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697955143; cv=none; d=google.com; s=arc-20160816; b=OqWC3jTl5KuwtvOLYToL1ehRLtTlFoLix+hefqn9Y2Z7EMVyRex/kTfatE5N3HTCNM +nqIUcUw5QPlGB14GamdSbBzNXmZtywXOBq0HKBvx4nJIXInnrCzCrh7t5CI82qwOikR 16WeagoG7moqkDQnEFB9v1eLF4H/0dp4EWjzHs9DCXjv/jZDisjf3kkLxZGUh9eNcqPu w/nosgfxphgY1KkWkJGfv791vqfDh9bQMvV3/WRLuiR1h0atPC8ZMg+izMhQ5U8DmxHr kCWWH1UrOzSWyDQTr6+eVtqbIhU2vRFgEYafuI7aHwi7ay5Pf4u4xn0ekdDXbEbqeiiL +FUA== 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=9TKr08lEUaGVu+t150hWUxpw8P0o9Xs1m7wUe0676Uc=; fh=TYrED6TOMxGX0VC4GtjviASLbYyJe19+7/tKWjN44KQ=; b=b4EEY+yjIKm9NqExxCDP2uJBHiiufrtVZfhG7gPsWBNxNBzk4Maa7fSktjzp0x7ePg i6X/aE/VBffytjXZziHovdOuG8SHRHV2kFHgH43u3/Z3bH8l0NKso0f6AhpHKF1mQyyt gbLiUkkkn9KDMpVOkcoUJ3C9czEA5Aq5RBxSwOh6JBGQfHoxbeyNDyQ6eMFC+Zmh8vrf kgAh5QvpYkzoq+0ItknAQh80lKUqxQSvfUkWS6EIQfTMnecoKEh0DahMXN8b5RrDbEnX jimbEgknrfz7h7ZvxwWhyUs+LLiteV8Sg0l+oQ34ANTJvk7DH8tT4PH6MEClO9/rffvM rZFA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=lsZq1qUn; 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 i7-20020a05620a248700b007758e273104si3759015qkn.334.2023.10.21.23.12.23 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sat, 21 Oct 2023 23:12:23 -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=lsZq1qUn; 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 1quRb4-0004NV-5R; Sun, 22 Oct 2023 02:06:02 -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 1quRaE-0001lb-Ky for qemu-devel@nongnu.org; Sun, 22 Oct 2023 02:05:06 -0400 Received: from mail-oo1-xc34.google.com ([2607:f8b0:4864:20::c34]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1quRaB-0002KH-Sr for qemu-devel@nongnu.org; Sun, 22 Oct 2023 02:05:06 -0400 Received: by mail-oo1-xc34.google.com with SMTP id 006d021491bc7-581de3e691dso1357515eaf.3 for ; Sat, 21 Oct 2023 23:05:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1697954702; x=1698559502; 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=9TKr08lEUaGVu+t150hWUxpw8P0o9Xs1m7wUe0676Uc=; b=lsZq1qUnQ8F8OCgQxFYCbKRmwYAxtBknTyU8+wH5vrDRJSHradwZaPTqHY1WwpJSl1 avTaPjxqoNxl2VhQH2BHUNAqnaUPgELcdXYFmLweO/GnZqKQktuyVrhSPrJMiNHTtKfC XI5haNaZ08unkeGgJr/cYlnGmbwwOhKDgEpOM+yjxf4exc6O/T12MbZN0t96HdlCSiDC b/+2vb9mA2Ym9JdNMPqnlli/TgnKT0VbZ7JIUFNOpYoSm6ePdDHzWScGJkq45n+gX3jA ezApeGnXwAc8XuzjrgGV/fdREuImIh2kIi84oi+4am8/odtB9hdj6YUWHyOJ4mSNj7T2 rv7Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697954702; x=1698559502; 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=9TKr08lEUaGVu+t150hWUxpw8P0o9Xs1m7wUe0676Uc=; b=Wg+P7It1mSVJJFntQtBBp7IjbNy1JkXYCmzIjkrPzHrrx3VcECdd1vYDgYMQ4MiwUL Uc7qivaFwkScU4UW70yNz+96Rn3eDAJw362M28bS5hgjziU/RZ0Ea0bhCYKzBexoquJy iw646kK+K5SFXWseNEHRpdUD+0r3OPlrYLaZWkE4FTsxW7ieXNHEuqvbhiB7ijVa60VJ c6G8cs6hzw9lbQwtfRYKFAccnSCaYUV7Yl6Zid/Y9B8G+zcfDVq289sgR2A3CqzVCjEj GqrxL7v1k1Jp5VZdZbnzgdTCYI6b1tUN9H5dKY1/M7werEgb1y39prtF/hbLhD7vRZJM 6KYQ== X-Gm-Message-State: AOJu0YwW9fGnBajXMQT9BPpVqzyIYyv9oiV5zHtjNuiuA2Lj60vAHkAG 3qAOkt8lzVA2TvPGd8QVNugPG0hzxWtzHHDN+28= X-Received: by 2002:a05:6359:1b82:b0:168:d161:c907 with SMTP id ur2-20020a0563591b8200b00168d161c907mr1629175rwb.18.1697954702268; Sat, 21 Oct 2023 23:05:02 -0700 (PDT) Received: from stoup.. ([71.212.149.95]) by smtp.gmail.com with ESMTPSA id fb13-20020a056a002d8d00b0068a46cd4120sm4007373pfb.199.2023.10.21.23.05.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 21 Oct 2023 23:05:01 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: mark.cave-ayland@ilande.co.uk Subject: [PATCH v4 72/90] target/sparc: Move FSQRTq to decodetree Date: Sat, 21 Oct 2023 23:00:13 -0700 Message-Id: <20231022060031.490251-73-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231022060031.490251-1-richard.henderson@linaro.org> References: <20231022060031.490251-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::c34; envelope-from=richard.henderson@linaro.org; helo=mail-oo1-xc34.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 | 1 + target/sparc/translate.c | 39 +++++++++++++++++++++++---------------- 2 files changed, 24 insertions(+), 16 deletions(-) diff --git a/target/sparc/insns.decode b/target/sparc/insns.decode index 1d766fab21..4cb250265d 100644 --- a/target/sparc/insns.decode +++ b/target/sparc/insns.decode @@ -247,6 +247,7 @@ FABSs 10 ..... 110100 00000 0 0000 1001 ..... @r_r2 FABSd 10 ..... 110100 00000 0 0000 1010 ..... @r_r2 FSQRTs 10 ..... 110100 00000 0 0010 1001 ..... @r_r2 FSQRTd 10 ..... 110100 00000 0 0010 1010 ..... @r_r2 +FSQRTq 10 ..... 110100 00000 0 0010 1011 ..... @r_r2 FdTOx 10 ..... 110100 00000 0 1000 0010 ..... @r_r2 FxTOd 10 ..... 110100 00000 0 1000 1000 ..... @r_r2 FiTOs 10 ..... 110100 00000 0 1100 0100 ..... @r_r2 diff --git a/target/sparc/translate.c b/target/sparc/translate.c index 1d046151d9..acc8f5d8cd 100644 --- a/target/sparc/translate.c +++ b/target/sparc/translate.c @@ -71,6 +71,7 @@ #define gen_helper_fpmerge ({ g_assert_not_reached(); NULL; }) #define gen_helper_fexpand ({ g_assert_not_reached(); NULL; }) #define gen_helper_pdist ({ g_assert_not_reached(); NULL; }) +#define gen_helper_fsqrtq ({ g_assert_not_reached(); NULL; }) #define FSR_LDXFSR_MASK ({ qemu_build_not_reached(); 0; }) #define FSR_LDXFSR_OLDMASK ({ qemu_build_not_reached(); 0; }) # ifdef CONFIG_USER_ONLY @@ -1682,18 +1683,6 @@ static void gen_fop_DDD(DisasContext *dc, int rd, int rs1, int rs2, gen_store_fpr_D(dc, rd, dst); } -static void gen_fop_QQ(DisasContext *dc, int rd, int rs, - void (*gen)(TCGv_ptr)) -{ - gen_op_load_fpr_QT1(QFPREG(rs)); - - gen(tcg_env); - gen_helper_check_ieee_exceptions(cpu_fsr, tcg_env); - - gen_op_store_QT0_fpr(QFPREG(rd)); - gen_update_fprs_dirty(dc, QFPREG(rd)); -} - #ifdef TARGET_SPARC64 static void gen_ne_fop_QQ(DisasContext *dc, int rd, int rs, void (*gen)(TCGv_ptr)) @@ -5005,6 +4994,27 @@ TRANS(FSQRTd, ALL, do_env_dd, a, gen_helper_fsqrtd) TRANS(FxTOd, 64, do_env_dd, a, gen_helper_fxtod) TRANS(FdTOx, 64, do_env_dd, a, gen_helper_fdtox) +static bool do_env_qq(DisasContext *dc, arg_r_r *a, + void (*func)(TCGv_env)) +{ + if (gen_trap_ifnofpu(dc)) { + return true; + } + if (gen_trap_float128(dc)) { + return true; + } + + gen_op_clear_ieee_excp_and_FTT(); + gen_op_load_fpr_QT1(QFPREG(a->rs)); + func(tcg_env); + gen_helper_check_ieee_exceptions(cpu_fsr, tcg_env); + gen_op_store_QT0_fpr(QFPREG(a->rd)); + gen_update_fprs_dirty(dc, QFPREG(a->rd)); + return advance_pc(dc); +} + +TRANS(FSQRTq, ALL, do_env_qq, a, gen_helper_fsqrtq) + static bool do_fff(DisasContext *dc, arg_r_r_r *a, void (*func)(TCGv_i32, TCGv_i32, TCGv_i32)) { @@ -5150,11 +5160,8 @@ static void disas_sparc_legacy(DisasContext *dc, unsigned int insn) case 0x2a: /* fsqrtd */ case 0x82: /* V9 fdtox */ case 0x88: /* V9 fxtod */ - g_assert_not_reached(); /* in decodetree */ case 0x2b: /* fsqrtq */ - CHECK_FPU_FEATURE(dc, FLOAT128); - gen_fop_QQ(dc, rd, rs2, gen_helper_fsqrtq); - break; + g_assert_not_reached(); /* in decodetree */ case 0x41: /* fadds */ gen_fop_FFF(dc, rd, rs1, rs2, gen_helper_fadds); break; From patchwork Sun Oct 22 06:00:14 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 736989 Delivered-To: patch@linaro.org Received: by 2002:adf:dd81:0:b0:32d:baff:b0ca with SMTP id x1csp1006168wrl; Sat, 21 Oct 2023 23:14:05 -0700 (PDT) X-Google-Smtp-Source: AGHT+IG9hbl/+280WRdydQEoOaAr+wetjcLJhksMfG4uWk2gXsRrdFWWAtRi4uGLCSj/AwCqsS4i X-Received: by 2002:ac8:4e8a:0:b0:412:24e6:a485 with SMTP id 10-20020ac84e8a000000b0041224e6a485mr5348718qtp.2.1697955245402; Sat, 21 Oct 2023 23:14:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697955245; cv=none; d=google.com; s=arc-20160816; b=0AS8yjaIkBiVfjU0ouC6OiukuSJcvcuaS+Ud7ZEww6pyOiYoT28fZU+SFHXvt9lxrt cSqjT1PfemMQu3PBhGLPvZSdkQkkzzCco366IvQM0aA2ry4YpiWoCC6/LDPQCcNTh4w+ CZKbMP/aX/FGtLzYB1i+CEBZNRP8nShvpdZu18vGnfInL5oJK1YxrhCaaatZhPPNidJd YjMMILKcgKsebj4DcL9en+lT68zaikxzyFjkshKqj1rwnsIBChmPClI8VuIO3Ktpjz7/ YMdgyix4y0TFOoZDN/yCbk5oY5FRY89++K/jNh3yIUtuHeXWcklqUjlsXCC1kFHoMrtd a0Lg== 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=xnIQrvzJCX4VoBhqb/gTJTcjxh0opmIuZUH0PLud/BA=; fh=TYrED6TOMxGX0VC4GtjviASLbYyJe19+7/tKWjN44KQ=; b=w2jn921f5gzOAQ9RHseLPaG9mkxSFoEh2Uv2iN+p2MBeRDph9Fa7sVPSF1aL52+y+F cUFsMtoK3w+s7ty5iPteQ9kZY95GEqrU8lQJguO10Mf+WEvziJynlyR3J1IoD+Trwi6r PZzDdAK2zDYOgEGbsKlOlbp8QAw3yam9rAvwxRsGtmWhcCu+CaGX9x/MAQ7fIg8gpBdg eOzPeEof82E4Ur3/PCkjWAF6DUpG2z2gIFpoIU2tPcisRVitaAhhiEtH+/l78PeRe9dG yRMj6b0ztKN6P2m0/uItSye6W5z3314AvwZO9HysgWaoWDpl9Dq6H9EuAfJTk6mrnJLU vETw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=lVI6SEoa; 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 t35-20020a05622a182300b00417b7e010c4si3688279qtc.305.2023.10.21.23.14.05 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sat, 21 Oct 2023 23:14:05 -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=lVI6SEoa; 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 1quRbM-0004kE-HM; Sun, 22 Oct 2023 02:06:16 -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 1quRaF-0001os-4C for qemu-devel@nongnu.org; Sun, 22 Oct 2023 02:05:07 -0400 Received: from mail-pf1-x42a.google.com ([2607:f8b0:4864:20::42a]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1quRaC-0002Ke-Pb for qemu-devel@nongnu.org; Sun, 22 Oct 2023 02:05:06 -0400 Received: by mail-pf1-x42a.google.com with SMTP id d2e1a72fcca58-6b1ef786b7fso2076797b3a.3 for ; Sat, 21 Oct 2023 23:05:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1697954703; x=1698559503; 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=xnIQrvzJCX4VoBhqb/gTJTcjxh0opmIuZUH0PLud/BA=; b=lVI6SEoa2GXSGCQgFeSb4hACYDC1VdQKplBrkfZXa1NHFdEMF4dEx8xnl2zcGsWQdl JhNcUfMpx6uiFgXEInvzvCrnVjjU8OiEVyKE+cmJr2Dttf6IJuiZ7OA+/EETS9ehS4Ol iu3anTaUOf04zIYrT/73o/+cnupB5Otme9Ps/3DA3X+TZtNE3Dn58dD7XO+YHm4V8NMm 0nMuFZQ8ebF7wCu5OvU/hOKzU9XPxLCnXkEqVPSbky3dV90Ab+j1AZnxpFpHdzrKkBBh 9U+NUA8V/tjMxK5j8D/A4pDjAe9HvZpBfhvESA0yIT0u3GDS21Si18l8fHCo11f3opwS Vhog== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697954703; x=1698559503; 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=xnIQrvzJCX4VoBhqb/gTJTcjxh0opmIuZUH0PLud/BA=; b=FCrkNaRSILgOU3eDxpoLaRyBwon/0sIskP5Id9gDo2ZMx+lYgLmm89hHtNWSlHQU+i MD42YLsWV8gv5+HoTZmHGtXWTrWNfMIDdCPW5ey/6cAVoydWEsUwozkfkvb6Tsai9ju0 jIdQEOeoc7AW/GBEjDe6YreiadfiFCbwHcm5zJwsFVTVVSG00hscahYz6030j8uxQqp6 QJ+AnGxpuPQuAaHUD8iD8VhOBVpJqVzKFdOoNnbIoYLxP7FLDq53ShaNGLItJXFz3uDf 5CrHCFg8//poONW4kQFcXvsRo96o3Rx0UY6o8OrfexlT0eM9/qtl+cQVS5AtxAWSWCrN BmWw== X-Gm-Message-State: AOJu0YxI8aWP4MSdqcVrSy2gN8l6decToPWuLYIs/Weblsqysvoyj2n6 dSHEKLrvjoKzP+dPsLXYBp4l5MGgsdlKO1n7xoE= X-Received: by 2002:a05:6a00:21c4:b0:6bf:50df:2df5 with SMTP id t4-20020a056a0021c400b006bf50df2df5mr3987052pfj.13.1697954703234; Sat, 21 Oct 2023 23:05:03 -0700 (PDT) Received: from stoup.. ([71.212.149.95]) by smtp.gmail.com with ESMTPSA id fb13-20020a056a002d8d00b0068a46cd4120sm4007373pfb.199.2023.10.21.23.05.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 21 Oct 2023 23:05:02 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: mark.cave-ayland@ilande.co.uk Subject: [PATCH v4 73/90] target/sparc: Move gen_fop_FFF insns to decodetree Date: Sat, 21 Oct 2023 23:00:14 -0700 Message-Id: <20231022060031.490251-74-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231022060031.490251-1-richard.henderson@linaro.org> References: <20231022060031.490251-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::42a; envelope-from=richard.henderson@linaro.org; helo=mail-pf1-x42a.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 Move FADDs, FSUBs, FMULs, FDIVs. Signed-off-by: Richard Henderson --- target/sparc/insns.decode | 4 +++ target/sparc/translate.c | 54 +++++++++++++++++++-------------------- 2 files changed, 31 insertions(+), 27 deletions(-) diff --git a/target/sparc/insns.decode b/target/sparc/insns.decode index 4cb250265d..09444e313f 100644 --- a/target/sparc/insns.decode +++ b/target/sparc/insns.decode @@ -248,6 +248,10 @@ FABSd 10 ..... 110100 00000 0 0000 1010 ..... @r_r2 FSQRTs 10 ..... 110100 00000 0 0010 1001 ..... @r_r2 FSQRTd 10 ..... 110100 00000 0 0010 1010 ..... @r_r2 FSQRTq 10 ..... 110100 00000 0 0010 1011 ..... @r_r2 +FADDs 10 ..... 110100 ..... 0 0100 0001 ..... @r_r_r +FSUBs 10 ..... 110100 ..... 0 0100 0101 ..... @r_r_r +FMULs 10 ..... 110100 ..... 0 0100 1001 ..... @r_r_r +FDIVs 10 ..... 110100 ..... 0 0100 1101 ..... @r_r_r FdTOx 10 ..... 110100 00000 0 1000 0010 ..... @r_r2 FxTOd 10 ..... 110100 00000 0 1000 1000 ..... @r_r2 FiTOs 10 ..... 110100 00000 0 1100 0100 ..... @r_r2 diff --git a/target/sparc/translate.c b/target/sparc/translate.c index acc8f5d8cd..1bcdaf31d8 100644 --- a/target/sparc/translate.c +++ b/target/sparc/translate.c @@ -1653,21 +1653,6 @@ static int gen_trap_ifnofpu(DisasContext *dc) return 0; } -static void gen_fop_FFF(DisasContext *dc, int rd, int rs1, int rs2, - void (*gen)(TCGv_i32, TCGv_ptr, TCGv_i32, TCGv_i32)) -{ - TCGv_i32 dst, src1, src2; - - src1 = gen_load_fpr_F(dc, rs1); - src2 = gen_load_fpr_F(dc, rs2); - dst = gen_dest_fpr_F(dc); - - gen(dst, tcg_env, src1, src2); - gen_helper_check_ieee_exceptions(cpu_fsr, tcg_env); - - gen_store_fpr_F(dc, rd, dst); -} - static void gen_fop_DDD(DisasContext *dc, int rd, int rs1, int rs2, void (*gen)(TCGv_i64, TCGv_ptr, TCGv_i64, TCGv_i64)) { @@ -5044,6 +5029,29 @@ TRANS(FXNORs, VIS1, do_fff, a, tcg_gen_eqv_i32) TRANS(FORNOTs, VIS1, do_fff, a, tcg_gen_orc_i32) TRANS(FORs, VIS1, do_fff, a, tcg_gen_or_i32) +static bool do_env_fff(DisasContext *dc, arg_r_r_r *a, + void (*func)(TCGv_i32, TCGv_env, TCGv_i32, TCGv_i32)) +{ + TCGv_i32 src1, src2; + + if (gen_trap_ifnofpu(dc)) { + return true; + } + + gen_op_clear_ieee_excp_and_FTT(); + src1 = gen_load_fpr_F(dc, a->rs1); + src2 = gen_load_fpr_F(dc, a->rs2); + func(src1, tcg_env, src1, src2); + gen_helper_check_ieee_exceptions(cpu_fsr, tcg_env); + gen_store_fpr_F(dc, a->rd, src1); + return advance_pc(dc); +} + +TRANS(FADDs, ALL, do_env_fff, a, gen_helper_fadds) +TRANS(FSUBs, ALL, do_env_fff, a, gen_helper_fsubs) +TRANS(FMULs, ALL, do_env_fff, a, gen_helper_fmuls) +TRANS(FDIVs, ALL, do_env_fff, a, gen_helper_fdivs) + static bool do_ddd(DisasContext *dc, arg_r_r_r *a, void (*func)(TCGv_i64, TCGv_i64, TCGv_i64)) { @@ -5161,10 +5169,11 @@ static void disas_sparc_legacy(DisasContext *dc, unsigned int insn) case 0x82: /* V9 fdtox */ case 0x88: /* V9 fxtod */ case 0x2b: /* fsqrtq */ - g_assert_not_reached(); /* in decodetree */ case 0x41: /* fadds */ - gen_fop_FFF(dc, rd, rs1, rs2, gen_helper_fadds); - break; + case 0x45: /* fsubs */ + case 0x49: /* fmuls */ + case 0x4d: /* fdivs */ + g_assert_not_reached(); /* in decodetree */ case 0x42: /* faddd */ gen_fop_DDD(dc, rd, rs1, rs2, gen_helper_faddd); break; @@ -5172,9 +5181,6 @@ static void disas_sparc_legacy(DisasContext *dc, unsigned int insn) CHECK_FPU_FEATURE(dc, FLOAT128); gen_fop_QQQ(dc, rd, rs1, rs2, gen_helper_faddq); break; - case 0x45: /* fsubs */ - gen_fop_FFF(dc, rd, rs1, rs2, gen_helper_fsubs); - break; case 0x46: /* fsubd */ gen_fop_DDD(dc, rd, rs1, rs2, gen_helper_fsubd); break; @@ -5182,9 +5188,6 @@ static void disas_sparc_legacy(DisasContext *dc, unsigned int insn) CHECK_FPU_FEATURE(dc, FLOAT128); gen_fop_QQQ(dc, rd, rs1, rs2, gen_helper_fsubq); break; - case 0x49: /* fmuls */ - gen_fop_FFF(dc, rd, rs1, rs2, gen_helper_fmuls); - break; case 0x4a: /* fmuld */ gen_fop_DDD(dc, rd, rs1, rs2, gen_helper_fmuld); break; @@ -5192,9 +5195,6 @@ static void disas_sparc_legacy(DisasContext *dc, unsigned int insn) CHECK_FPU_FEATURE(dc, FLOAT128); gen_fop_QQQ(dc, rd, rs1, rs2, gen_helper_fmulq); break; - case 0x4d: /* fdivs */ - gen_fop_FFF(dc, rd, rs1, rs2, gen_helper_fdivs); - break; case 0x4e: /* fdivd */ gen_fop_DDD(dc, rd, rs1, rs2, gen_helper_fdivd); break; From patchwork Sun Oct 22 06:00:15 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 736956 Delivered-To: patch@linaro.org Received: by 2002:adf:dd81:0:b0:32d:baff:b0ca with SMTP id x1csp1005563wrl; Sat, 21 Oct 2023 23:11:21 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFsrWPptWQ++yvWxbjTQSgxnfV94q2MGcF8ZpU8sJ+S8jV9qH6PlocZ6Rj6wz9C6Hk2DZ2H X-Received: by 2002:a05:620a:3d0f:b0:76f:24bd:fef2 with SMTP id tq15-20020a05620a3d0f00b0076f24bdfef2mr5468493qkn.68.1697955081021; Sat, 21 Oct 2023 23:11:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697955081; cv=none; d=google.com; s=arc-20160816; b=gx5yYrCI94VU0s6jQPLJFHjDVXTnI2/HQJuao0Zk36xy0GbV8tmpJdIYqw2CcWd2SB 8v2X0J3wlOPoIBuuRXeSWhPBRqKP7AUjxa3Jez4MtEDYEVxa90vWe3CQFf2Lu8KHeL8B ThIJA7U/9mIDJezPCtfkqj8WEsNC5s6JbesCpCcLDJIv7QNd7PRWq7i9BeJp0Z9cFuLK A9QHhJ9dtO9vsAxPjbBmbaLF6dl4xAdIpyiio5iKXuAptPvHGugKQ9g0qrnaH3sCZ/62 k9fsrRDYjd/hqVikJcYSRjbaY3lMSoS5ha/W1FOjtVS95YkwQokBwpjVx0pNcA5Ilec5 fEpw== 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=+iLY1nbBi2JSUWZ6aOE4fru7zD1vQTmHSnEgemsvB5Y=; fh=TYrED6TOMxGX0VC4GtjviASLbYyJe19+7/tKWjN44KQ=; b=mVX0e8xjeAtXAd1BNY+1sooMIjdl8cYp/jZdq1VfNHAgQIweo6t4Dhhx/SeX2fXSc5 92XKI4CcNfStBDdAZ54J1EQpNTk1DkVZ0TC/R3wJCriBBtS4SWWVlNI46n7M6jrpFUtS HsCylAgJTUBIDYgSmw88vQoK42v9j1SVAzljpgviuYHyTQdQYNP3pd6U6weWLHnsHMl8 7MEgc2pzthzuBSu1Pa99pa4tspkhWaW+7G7eaM5VkHvn9wgHzom+omhRfWjsJMZhkPpe bGjrQknSM36wN6gIa5NzL+MeTHeVX+Naw++8DTtoDEiOeNXB1qjroCFYSMS2HlyzB4M6 fC0w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=NvpIw5B7; 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 m20-20020a05620a24d400b0077894fa3885si3665144qkn.268.2023.10.21.23.11.20 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sat, 21 Oct 2023 23:11:21 -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=NvpIw5B7; 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 1quRbS-0004tV-0Q; Sun, 22 Oct 2023 02:06:22 -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 1quRaJ-0002Dc-32 for qemu-devel@nongnu.org; Sun, 22 Oct 2023 02:05:12 -0400 Received: from mail-ot1-x333.google.com ([2607:f8b0:4864:20::333]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1quRaE-0002Ku-Hm for qemu-devel@nongnu.org; Sun, 22 Oct 2023 02:05:08 -0400 Received: by mail-ot1-x333.google.com with SMTP id 46e09a7af769-6ce2988d62eso1493431a34.1 for ; Sat, 21 Oct 2023 23:05:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1697954704; x=1698559504; 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=+iLY1nbBi2JSUWZ6aOE4fru7zD1vQTmHSnEgemsvB5Y=; b=NvpIw5B7WJYkYnDonciwXimTUrVdLlBzr0BKRHdGwOzJQ/XJsIqF88XoT8zcLIp5m1 B/OB7S66+32f8iyU7b8JX7g7hTnWst6xCGGT6visliRDC35Ken6b62VTx9I5XILNglUz vQ4LQk28vdxDpqtmp1vqPHdHXN4FhBKBE+o7U61yoRurRgSaPIQ/sE2/8cnGhnAO19jW fp/l8Hxz+L9TY1kbEAx0VP6N1B3MWrA6Qgd60UXdfVEI9mLcoaVJ+w0sUwI4PsuOtHjZ 0fk8ky0sCyE9Hc0WV6XjdnYMBYgHlERYFjYkFWMv062CuPkhK0Y78IkIreEkZbPpszJz a/Cg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697954704; x=1698559504; 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=+iLY1nbBi2JSUWZ6aOE4fru7zD1vQTmHSnEgemsvB5Y=; b=NvpA8yMfALFblqWQ4be2MYFWGs/iKyJaG+cxOpw+D/fkJIikG8bS9PYiB2mYzcBvW6 hnKDh8uIhTxjOEdpvVmZSgGqhCApl1f962Txs9UV0bqbGOCztpeosew0NkKfpod9pBmD 0yX/283LICmXfpsYEw97SSz7zS7Jl+2h6vS3l792qMJKKSLYmOMBCalpt/p5fZQmA1q1 tcmzdXSVtWD9oRqMtgJ0kzSE1rz21WmptPLagJSAHrX9VqBiXvoA0gLVJ1JJv9Stmr6p 8BbCaLvwGWiwor/omaytt88RJ/FJneu+lk4vHlq7iAqitLc/Mkj50wHLI19S6rkeFVJO /KKA== X-Gm-Message-State: AOJu0Yzt2bMw7vZe2w1KJdDVaZnh/JAAaAniqIZ/tmEoZkdaZeuhrEmH HXQSAYUVTkkh0XcVJ+Ee5JkrQz8kj4+q6l4hAIw= X-Received: by 2002:a05:6358:9895:b0:140:fbfe:d941 with SMTP id q21-20020a056358989500b00140fbfed941mr7907096rwa.20.1697954704072; Sat, 21 Oct 2023 23:05:04 -0700 (PDT) Received: from stoup.. ([71.212.149.95]) by smtp.gmail.com with ESMTPSA id fb13-20020a056a002d8d00b0068a46cd4120sm4007373pfb.199.2023.10.21.23.05.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 21 Oct 2023 23:05:03 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: mark.cave-ayland@ilande.co.uk Subject: [PATCH v4 74/90] target/sparc: Move gen_fop_DDD insns to decodetree Date: Sat, 21 Oct 2023 23:00:15 -0700 Message-Id: <20231022060031.490251-75-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231022060031.490251-1-richard.henderson@linaro.org> References: <20231022060031.490251-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::333; envelope-from=richard.henderson@linaro.org; helo=mail-ot1-x333.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 Move FADDd, FSUBd, FMULd, FDIVd. Signed-off-by: Richard Henderson --- target/sparc/insns.decode | 4 +++ target/sparc/translate.c | 55 ++++++++++++++++++++------------------- 2 files changed, 32 insertions(+), 27 deletions(-) diff --git a/target/sparc/insns.decode b/target/sparc/insns.decode index 09444e313f..a429c04980 100644 --- a/target/sparc/insns.decode +++ b/target/sparc/insns.decode @@ -249,9 +249,13 @@ FSQRTs 10 ..... 110100 00000 0 0010 1001 ..... @r_r2 FSQRTd 10 ..... 110100 00000 0 0010 1010 ..... @r_r2 FSQRTq 10 ..... 110100 00000 0 0010 1011 ..... @r_r2 FADDs 10 ..... 110100 ..... 0 0100 0001 ..... @r_r_r +FADDd 10 ..... 110100 ..... 0 0100 0010 ..... @r_r_r FSUBs 10 ..... 110100 ..... 0 0100 0101 ..... @r_r_r +FSUBd 10 ..... 110100 ..... 0 0100 0110 ..... @r_r_r FMULs 10 ..... 110100 ..... 0 0100 1001 ..... @r_r_r +FMULd 10 ..... 110100 ..... 0 0100 1010 ..... @r_r_r FDIVs 10 ..... 110100 ..... 0 0100 1101 ..... @r_r_r +FDIVd 10 ..... 110100 ..... 0 0100 1110 ..... @r_r_r FdTOx 10 ..... 110100 00000 0 1000 0010 ..... @r_r2 FxTOd 10 ..... 110100 00000 0 1000 1000 ..... @r_r2 FiTOs 10 ..... 110100 00000 0 1100 0100 ..... @r_r2 diff --git a/target/sparc/translate.c b/target/sparc/translate.c index 1bcdaf31d8..7e0990a021 100644 --- a/target/sparc/translate.c +++ b/target/sparc/translate.c @@ -1653,21 +1653,6 @@ static int gen_trap_ifnofpu(DisasContext *dc) return 0; } -static void gen_fop_DDD(DisasContext *dc, int rd, int rs1, int rs2, - void (*gen)(TCGv_i64, TCGv_ptr, TCGv_i64, TCGv_i64)) -{ - TCGv_i64 dst, src1, src2; - - src1 = gen_load_fpr_D(dc, rs1); - src2 = gen_load_fpr_D(dc, rs2); - dst = gen_dest_fpr_D(dc, rd); - - gen(dst, tcg_env, src1, src2); - gen_helper_check_ieee_exceptions(cpu_fsr, tcg_env); - - gen_store_fpr_D(dc, rd, dst); -} - #ifdef TARGET_SPARC64 static void gen_ne_fop_QQ(DisasContext *dc, int rd, int rs, void (*gen)(TCGv_ptr)) @@ -5096,6 +5081,30 @@ TRANS(FPACK32, VIS1, do_ddd, a, gen_op_fpack32) TRANS(FALIGNDATAg, VIS1, do_ddd, a, gen_op_faligndata) TRANS(BSHUFFLE, VIS2, do_ddd, a, gen_op_bshuffle) +static bool do_env_ddd(DisasContext *dc, arg_r_r_r *a, + void (*func)(TCGv_i64, TCGv_env, TCGv_i64, TCGv_i64)) +{ + TCGv_i64 dst, src1, src2; + + if (gen_trap_ifnofpu(dc)) { + return true; + } + + gen_op_clear_ieee_excp_and_FTT(); + dst = gen_dest_fpr_D(dc, a->rd); + src1 = gen_load_fpr_D(dc, a->rs1); + src2 = gen_load_fpr_D(dc, a->rs2); + func(dst, tcg_env, src1, src2); + gen_helper_check_ieee_exceptions(cpu_fsr, tcg_env); + gen_store_fpr_D(dc, a->rd, dst); + return advance_pc(dc); +} + +TRANS(FADDd, ALL, do_env_ddd, a, gen_helper_faddd) +TRANS(FSUBd, ALL, do_env_ddd, a, gen_helper_fsubd) +TRANS(FMULd, ALL, do_env_ddd, a, gen_helper_fmuld) +TRANS(FDIVd, ALL, do_env_ddd, a, gen_helper_fdivd) + static bool do_dddd(DisasContext *dc, arg_r_r_r *a, void (*func)(TCGv_i64, TCGv_i64, TCGv_i64, TCGv_i64)) { @@ -5173,31 +5182,23 @@ static void disas_sparc_legacy(DisasContext *dc, unsigned int insn) case 0x45: /* fsubs */ case 0x49: /* fmuls */ case 0x4d: /* fdivs */ - g_assert_not_reached(); /* in decodetree */ case 0x42: /* faddd */ - gen_fop_DDD(dc, rd, rs1, rs2, gen_helper_faddd); - break; + case 0x46: /* fsubd */ + case 0x4a: /* fmuld */ + case 0x4e: /* fdivd */ + g_assert_not_reached(); /* in decodetree */ case 0x43: /* faddq */ CHECK_FPU_FEATURE(dc, FLOAT128); gen_fop_QQQ(dc, rd, rs1, rs2, gen_helper_faddq); break; - case 0x46: /* fsubd */ - gen_fop_DDD(dc, rd, rs1, rs2, gen_helper_fsubd); - break; case 0x47: /* fsubq */ CHECK_FPU_FEATURE(dc, FLOAT128); gen_fop_QQQ(dc, rd, rs1, rs2, gen_helper_fsubq); break; - case 0x4a: /* fmuld */ - gen_fop_DDD(dc, rd, rs1, rs2, gen_helper_fmuld); - break; case 0x4b: /* fmulq */ CHECK_FPU_FEATURE(dc, FLOAT128); gen_fop_QQQ(dc, rd, rs1, rs2, gen_helper_fmulq); break; - case 0x4e: /* fdivd */ - gen_fop_DDD(dc, rd, rs1, rs2, gen_helper_fdivd); - break; case 0x4f: /* fdivq */ CHECK_FPU_FEATURE(dc, FLOAT128); gen_fop_QQQ(dc, rd, rs1, rs2, gen_helper_fdivq); From patchwork Sun Oct 22 06:00:16 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 736946 Delivered-To: patch@linaro.org Received: by 2002:adf:dd81:0:b0:32d:baff:b0ca with SMTP id x1csp1004450wrl; Sat, 21 Oct 2023 23:06:57 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHIUI5mfmOE15tVdU+DsbYdnx7KKGl+xAU/1H+Wm3/mkCD6ne5O1jPN6xiPoAReGH1P3AyM X-Received: by 2002:ac8:5f52:0:b0:41c:cd2a:f05a with SMTP id y18-20020ac85f52000000b0041ccd2af05amr7461418qta.25.1697954816806; Sat, 21 Oct 2023 23:06:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697954816; cv=none; d=google.com; s=arc-20160816; b=nZCsU0WrkNL1OuM4a2VeGGijsjyczsqsMyeNh4OREg7motwuiKp6owQriN7fYBREvb xfm03Ys9VfGc+sKpBk2Po+4Es81XEtn3qBo3rW7jVIrMIqYDRJT4rrDth3W+52gTZLEt BgINguB721q1TF2/I2hN4x07ydOEzxdc5L7Y0SbeKRj6Qb3hWDKGEsC5VhztFZki3YUr JHshW1K/7V74WyO1t4Dfqt+RpUwViOq9EYxz6Fp4HCmAulZswaj/oXUgOrEhAraDG6QM aoId5Rn599fCxPnVGra3b2fLeQD/YEd/0GWZHr0rP0goVWPXw3OIVkaJaZE2G6qsAO8t g52g== 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=RJtaWlcxrarLCoB15zwusHSxvRo75ARkuqoEtKfRk/k=; fh=TYrED6TOMxGX0VC4GtjviASLbYyJe19+7/tKWjN44KQ=; b=hbCFjZmLHHS3OIgjfBVdhhUJHgbN1xVPFOLiyhu57n+YnXhSFJiryxiZLVFj+WVzwb +yjTBsRuAvQBhtpfAkMU4s1L6KMzKPQsRYi3jbccJ5S7qRKQ3JrNi4QAuNQOsMEYvFPo EiEX/fDsrth6DR3YhQSLSpYNkOMWX9c2oiovZMpvZyjfyj48EvI1MbT5WJUXzXnnouLr i25FJPQJhfBvLEHkQ/viNy/EnpWGnuGnQf3FZFaMqzbHCGmyc+NcuT33jafxbj9YtDyu KcDNCDQkzzsyJST3xvZuJsRYy7hpKYlsGNLUJJo8rwHb5hesW8GP0lzLeXHUwnTqDw3d nXYA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=nu+GbKga; 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 g4-20020ac85d44000000b00419ccbf0021si3764404qtx.9.2023.10.21.23.06.56 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sat, 21 Oct 2023 23:06:56 -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=nu+GbKga; 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 1quRbP-0004pU-CQ; Sun, 22 Oct 2023 02:06:19 -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 1quRaV-000375-0i for qemu-devel@nongnu.org; Sun, 22 Oct 2023 02:05:23 -0400 Received: from mail-pf1-x436.google.com ([2607:f8b0:4864:20::436]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1quRaE-0002LF-VN for qemu-devel@nongnu.org; Sun, 22 Oct 2023 02:05:21 -0400 Received: by mail-pf1-x436.google.com with SMTP id d2e1a72fcca58-6b89ab5ddb7so2209381b3a.0 for ; Sat, 21 Oct 2023 23:05:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1697954705; x=1698559505; 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=RJtaWlcxrarLCoB15zwusHSxvRo75ARkuqoEtKfRk/k=; b=nu+GbKga92BzynyFHSL+oeonWve4i+RSowHt3d+1xXQnJa03r19oUQphqncTI6zzqy XGJ4Hk19NbNYHcvh26toN1en7jfKM3B5SJ5qai+vbjtmaxVDtdbjKTVT+ISedCBsvFhi G0bjTkCzEbRFuCZuzNbuKl1xjFJTgpw29JoGow8oyPB0OtB8fH6nPU5Be4Xjq3DXZpVZ EO6EgAWh36RW4kV+sOPXna3eHaqHYod1VpRZkny7ZYZwjR7sIYvmLPV4NxxANeLtmZFX v84FfCXgFN/BXfnWzB6zuqK+QRasOzD8HN1gllckoppKsQowzS9M3n1ARe4pKW7YtT6e O/8g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697954705; x=1698559505; 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=RJtaWlcxrarLCoB15zwusHSxvRo75ARkuqoEtKfRk/k=; b=ECgx5xswDhu5IgeB8DFfjZeHmuAm4QLFclsaA9i9vvQFxwPvClYrP5syTmDYJ4BPcT zQVJ6g1JM1r+lqqfPeshstd/ZRFaVGBusyLKj4rYreTR6lEts3NK6pcCpY13E0KNsWZ0 tCo4DwsBWbcVUKx6VhACR+MIGKCVGfqIMuCuvl/gv+xTWB7tcBF2YxUAtviNuwHTc3oN XAsIDz+n/+gakfwQhtKaeKZpBox7FeNE22zIQGhcy0mJ587nsKDr5ik8eawXjh+AIgsJ CP0yK8PN+Eq0F70mNZ6HNS0nah8jgVLYGFytI1aWzVJZR6aJ+FkJUw95cSrbM5Np/pKP goYA== X-Gm-Message-State: AOJu0Yx+D8laDwUPzLYtY8pYtPih/dQOoOhWi5UOlJE9Q+taQRSmpJuN ov+DrJwfiuYQaNENLZiQpL+2O9x65txM86QAZMI= X-Received: by 2002:a05:6a00:2e97:b0:692:a727:1fdd with SMTP id fd23-20020a056a002e9700b00692a7271fddmr7680283pfb.4.1697954705086; Sat, 21 Oct 2023 23:05:05 -0700 (PDT) Received: from stoup.. ([71.212.149.95]) by smtp.gmail.com with ESMTPSA id fb13-20020a056a002d8d00b0068a46cd4120sm4007373pfb.199.2023.10.21.23.05.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 21 Oct 2023 23:05:04 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: mark.cave-ayland@ilande.co.uk Subject: [PATCH v4 75/90] target/sparc: Move gen_fop_QQQ insns to decodetree Date: Sat, 21 Oct 2023 23:00:16 -0700 Message-Id: <20231022060031.490251-76-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231022060031.490251-1-richard.henderson@linaro.org> References: <20231022060031.490251-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::436; envelope-from=richard.henderson@linaro.org; helo=mail-pf1-x436.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, 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 Move FADDq, FSUBq, FMULq, FDIVq. Signed-off-by: Richard Henderson --- target/sparc/insns.decode | 4 +++ target/sparc/translate.c | 52 +++++++++++++++++++-------------------- 2 files changed, 30 insertions(+), 26 deletions(-) diff --git a/target/sparc/insns.decode b/target/sparc/insns.decode index a429c04980..f18fd99476 100644 --- a/target/sparc/insns.decode +++ b/target/sparc/insns.decode @@ -250,12 +250,16 @@ FSQRTd 10 ..... 110100 00000 0 0010 1010 ..... @r_r2 FSQRTq 10 ..... 110100 00000 0 0010 1011 ..... @r_r2 FADDs 10 ..... 110100 ..... 0 0100 0001 ..... @r_r_r FADDd 10 ..... 110100 ..... 0 0100 0010 ..... @r_r_r +FADDq 10 ..... 110100 ..... 0 0100 0011 ..... @r_r_r FSUBs 10 ..... 110100 ..... 0 0100 0101 ..... @r_r_r FSUBd 10 ..... 110100 ..... 0 0100 0110 ..... @r_r_r +FSUBq 10 ..... 110100 ..... 0 0100 0111 ..... @r_r_r FMULs 10 ..... 110100 ..... 0 0100 1001 ..... @r_r_r FMULd 10 ..... 110100 ..... 0 0100 1010 ..... @r_r_r +FMULq 10 ..... 110100 ..... 0 0100 1011 ..... @r_r_r FDIVs 10 ..... 110100 ..... 0 0100 1101 ..... @r_r_r FDIVd 10 ..... 110100 ..... 0 0100 1110 ..... @r_r_r +FDIVq 10 ..... 110100 ..... 0 0100 1111 ..... @r_r_r FdTOx 10 ..... 110100 00000 0 1000 0010 ..... @r_r2 FxTOd 10 ..... 110100 00000 0 1000 1000 ..... @r_r2 FiTOs 10 ..... 110100 00000 0 1100 0100 ..... @r_r2 diff --git a/target/sparc/translate.c b/target/sparc/translate.c index 7e0990a021..47f4d0b51c 100644 --- a/target/sparc/translate.c +++ b/target/sparc/translate.c @@ -1666,19 +1666,6 @@ static void gen_ne_fop_QQ(DisasContext *dc, int rd, int rs, } #endif -static void gen_fop_QQQ(DisasContext *dc, int rd, int rs1, int rs2, - void (*gen)(TCGv_ptr)) -{ - gen_op_load_fpr_QT0(QFPREG(rs1)); - gen_op_load_fpr_QT1(QFPREG(rs2)); - - gen(tcg_env); - gen_helper_check_ieee_exceptions(cpu_fsr, tcg_env); - - gen_op_store_QT0_fpr(QFPREG(rd)); - gen_update_fprs_dirty(dc, QFPREG(rd)); -} - static void gen_fop_DFF(DisasContext *dc, int rd, int rs1, int rs2, void (*gen)(TCGv_i64, TCGv_ptr, TCGv_i32, TCGv_i32)) { @@ -5125,6 +5112,31 @@ static bool do_dddd(DisasContext *dc, arg_r_r_r *a, TRANS(PDIST, VIS1, do_dddd, a, gen_helper_pdist) +static bool do_env_qqq(DisasContext *dc, arg_r_r_r *a, + void (*func)(TCGv_env)) +{ + if (gen_trap_ifnofpu(dc)) { + return true; + } + if (gen_trap_float128(dc)) { + return true; + } + + gen_op_clear_ieee_excp_and_FTT(); + gen_op_load_fpr_QT0(QFPREG(a->rs1)); + gen_op_load_fpr_QT1(QFPREG(a->rs2)); + func(tcg_env); + gen_helper_check_ieee_exceptions(cpu_fsr, tcg_env); + gen_op_store_QT0_fpr(QFPREG(a->rd)); + gen_update_fprs_dirty(dc, QFPREG(a->rd)); + return advance_pc(dc); +} + +TRANS(FADDq, ALL, do_env_qqq, a, gen_helper_faddq) +TRANS(FSUBq, ALL, do_env_qqq, a, gen_helper_fsubq) +TRANS(FMULq, ALL, do_env_qqq, a, gen_helper_fmulq) +TRANS(FDIVq, ALL, do_env_qqq, a, gen_helper_fdivq) + #define CHECK_IU_FEATURE(dc, FEATURE) \ if (!((dc)->def->features & CPU_FEATURE_ ## FEATURE)) \ goto illegal_insn; @@ -5186,23 +5198,11 @@ static void disas_sparc_legacy(DisasContext *dc, unsigned int insn) case 0x46: /* fsubd */ case 0x4a: /* fmuld */ case 0x4e: /* fdivd */ - g_assert_not_reached(); /* in decodetree */ case 0x43: /* faddq */ - CHECK_FPU_FEATURE(dc, FLOAT128); - gen_fop_QQQ(dc, rd, rs1, rs2, gen_helper_faddq); - break; case 0x47: /* fsubq */ - CHECK_FPU_FEATURE(dc, FLOAT128); - gen_fop_QQQ(dc, rd, rs1, rs2, gen_helper_fsubq); - break; case 0x4b: /* fmulq */ - CHECK_FPU_FEATURE(dc, FLOAT128); - gen_fop_QQQ(dc, rd, rs1, rs2, gen_helper_fmulq); - break; case 0x4f: /* fdivq */ - CHECK_FPU_FEATURE(dc, FLOAT128); - gen_fop_QQQ(dc, rd, rs1, rs2, gen_helper_fdivq); - break; + g_assert_not_reached(); /* in decodetree */ case 0x69: /* fsmuld */ CHECK_FPU_FEATURE(dc, FSMULD); gen_fop_DFF(dc, rd, rs1, rs2, gen_helper_fsmuld); From patchwork Sun Oct 22 06:00:17 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 736949 Delivered-To: patch@linaro.org Received: by 2002:adf:dd81:0:b0:32d:baff:b0ca with SMTP id x1csp1004484wrl; Sat, 21 Oct 2023 23:07:05 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGtjfasDbp9xo8y9OBbNBW+eaxPPNvyRhqVJJDZzIPu/s7INj+Iv8bDA8rgX9AW59bcARpl X-Received: by 2002:a05:6808:149:b0:3ad:f4cc:79a5 with SMTP id h9-20020a056808014900b003adf4cc79a5mr5957694oie.33.1697954824970; Sat, 21 Oct 2023 23:07:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697954824; cv=none; d=google.com; s=arc-20160816; b=p61egH6n4L+VNVYONPjmVeJEQm67DdYwxqfxyCQGESMhJmjmzlTuu0j1xGt2bRaGAC cplMnyxk/NV8EMjHQOH1zkPKKFmL4Pqr5CO0T20s1NbEHFzzc0MQc7DVNduR8gkXmrBi vg+qPKSB2VKY1S1bCT5G6Yv6buqTSNFCySP8Ud7iNR7p8nIZhXYh+YyppLE9oFU0yEt4 7RdfWN3fxYe8elsI3+LKRKYQCt9R84q63Em+0A/L/JBAWNJn+CS+JHMu+MRt4N3e54AN SImf+KmZFOI3n7lFXkhJ/jojKVp3kWRgM2CSjorq2YPuP4zCYhli9G6aHhsvINF+dnkp b2rg== 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=hMWgiRrrSrMARev/+8b7NYY7aqPYWeuca4L/4DviiH8=; fh=TYrED6TOMxGX0VC4GtjviASLbYyJe19+7/tKWjN44KQ=; b=Ya+lST7ByjQh6NU96a8k7He3PNqpFz7CqNaQsjYoQyQgtrlJ23vljOQpCDuEz1rWjI EcklY/T2ouIry8wcSDHCPbDhzijXW2/lFQv+aHnkH1XIRLTSiCf89RUWbZhQzPuabQ0n g2Y4OJBx2mG+L06tX8K4dmIi9vxz46LKy0wET0nvwMYCfkAf6AocsdROmBUr6glQ70Tr U7UzqEZ7n7fNChCAYerQAaS/fVQraTYQ7xS1ucqKfzbbKr7KFZFDS1I1o3oZCZQTWKVK 6ECAAOCFd4xxLyijCEX5rCoLBks4z84wCZ+j5DgUprT54CtuFsz4PBPoklFPs+3nfQj5 4BGQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=EGtBwJJd; 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 p9-20020a05620a22a900b0076f39f669desi3782878qkh.51.2023.10.21.23.07.04 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sat, 21 Oct 2023 23:07:04 -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=EGtBwJJd; 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 1quRaz-0004Jm-P0; Sun, 22 Oct 2023 02:05:54 -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 1quRaK-0002Jf-Mf for qemu-devel@nongnu.org; Sun, 22 Oct 2023 02:05:13 -0400 Received: from mail-pf1-x431.google.com ([2607:f8b0:4864:20::431]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1quRaF-0002LS-92 for qemu-devel@nongnu.org; Sun, 22 Oct 2023 02:05:12 -0400 Received: by mail-pf1-x431.google.com with SMTP id d2e1a72fcca58-6b2018a11efso2136406b3a.0 for ; Sat, 21 Oct 2023 23:05:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1697954706; x=1698559506; 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=hMWgiRrrSrMARev/+8b7NYY7aqPYWeuca4L/4DviiH8=; b=EGtBwJJdRmYHmGsLQefwb2rKFw3UaPR6Mca46SHSZvOV/kG07RGNIUsb3FvKSAnLbT TE2LvXxtDusNXPH7yFpO/35llv/45D9ZOKDfuPlJ63k49fI0wl+UAcRUT2TgYpmdNNKE 7bAGDApj/wzj8pE9D8c70s9kow0CJhI5mgmWe6cSosvZAXGFQKZMMWk0WuIysiDBT96F CsA44qa6ekQAvB5Dp4WqURUrken3Ms+dTfJur0cZp7RL/MQUjDnNBfEQmchRJOZqbo2D OT5zI0SM5HzM19WMjYEG8u2VDyupIR0q6Z5e0fNPYHCJSfTkBKXvcEdXnFBVINjaueyb 346A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697954706; x=1698559506; 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=hMWgiRrrSrMARev/+8b7NYY7aqPYWeuca4L/4DviiH8=; b=s5TeTIWL42T3Sr7WatRJXyUF3DJnaZtxdB4rAl3e5Q1mMVPz5DAj2U3moXYyG071Gk jtHoXDVc6rq5tDPeNUpygmKPsfctuhFlp/pmDsE4ueTgQE6/t/Ko9nmRhJ+WvBhwrqtD wSptztYIWNhrDLK3XZSMH/0eWLVutGpA8XbaNFF0UF5jZsK1wfKY4m3g2RlZt62zhH43 sox/9/vXxRM7h/Z1UBC/avBvF9Ym3JvcksXnt071jXH+GxYo+gldLvhQWH3TIte2qXq+ ceZxElQNxdwnOwsqlA0W+rztsriGS6e/ZzmiPZcvdkYT5f9hDBp6kydexliqO40eHoZF b1vw== X-Gm-Message-State: AOJu0Yw19QZrESz6Jauwt0XNyDtbXFHJwr0oeJFWADT8mulla9FqFzsj z9/8GD923p7Xr3vagKMI7v3kWF3/nqq1+mPvptY= X-Received: by 2002:a05:6a00:14c9:b0:68f:bbc3:df44 with SMTP id w9-20020a056a0014c900b0068fbbc3df44mr7867782pfu.0.1697954705806; Sat, 21 Oct 2023 23:05:05 -0700 (PDT) Received: from stoup.. ([71.212.149.95]) by smtp.gmail.com with ESMTPSA id fb13-20020a056a002d8d00b0068a46cd4120sm4007373pfb.199.2023.10.21.23.05.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 21 Oct 2023 23:05:05 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: mark.cave-ayland@ilande.co.uk Subject: [PATCH v4 76/90] target/sparc: Move FSMULD to decodetree Date: Sat, 21 Oct 2023 23:00:17 -0700 Message-Id: <20231022060031.490251-77-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231022060031.490251-1-richard.henderson@linaro.org> References: <20231022060031.490251-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::431; envelope-from=richard.henderson@linaro.org; helo=mail-pf1-x431.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, T_SPF_TEMPERROR=0.01 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 | 1 + target/sparc/translate.c | 43 +++++++++++++++++++++------------------ 2 files changed, 24 insertions(+), 20 deletions(-) diff --git a/target/sparc/insns.decode b/target/sparc/insns.decode index f18fd99476..6817d52ca2 100644 --- a/target/sparc/insns.decode +++ b/target/sparc/insns.decode @@ -260,6 +260,7 @@ FMULq 10 ..... 110100 ..... 0 0100 1011 ..... @r_r_r FDIVs 10 ..... 110100 ..... 0 0100 1101 ..... @r_r_r FDIVd 10 ..... 110100 ..... 0 0100 1110 ..... @r_r_r FDIVq 10 ..... 110100 ..... 0 0100 1111 ..... @r_r_r +FsMULd 10 ..... 110100 ..... 0 0110 1001 ..... @r_r_r FdTOx 10 ..... 110100 00000 0 1000 0010 ..... @r_r2 FxTOd 10 ..... 110100 00000 0 1000 1000 ..... @r_r2 FiTOs 10 ..... 110100 00000 0 1100 0100 ..... @r_r2 diff --git a/target/sparc/translate.c b/target/sparc/translate.c index 47f4d0b51c..4a6f25bdf1 100644 --- a/target/sparc/translate.c +++ b/target/sparc/translate.c @@ -1666,22 +1666,6 @@ static void gen_ne_fop_QQ(DisasContext *dc, int rd, int rs, } #endif -static void gen_fop_DFF(DisasContext *dc, int rd, int rs1, int rs2, - void (*gen)(TCGv_i64, TCGv_ptr, TCGv_i32, TCGv_i32)) -{ - TCGv_i64 dst; - TCGv_i32 src1, src2; - - src1 = gen_load_fpr_F(dc, rs1); - src2 = gen_load_fpr_F(dc, rs2); - dst = gen_dest_fpr_D(dc, rd); - - gen(dst, tcg_env, src1, src2); - gen_helper_check_ieee_exceptions(cpu_fsr, tcg_env); - - gen_store_fpr_D(dc, rd, dst); -} - static void gen_fop_QDD(DisasContext *dc, int rd, int rs1, int rs2, void (*gen)(TCGv_ptr, TCGv_i64, TCGv_i64)) { @@ -5092,6 +5076,28 @@ TRANS(FSUBd, ALL, do_env_ddd, a, gen_helper_fsubd) TRANS(FMULd, ALL, do_env_ddd, a, gen_helper_fmuld) TRANS(FDIVd, ALL, do_env_ddd, a, gen_helper_fdivd) +static bool trans_FsMULd(DisasContext *dc, arg_r_r_r *a) +{ + TCGv_i64 dst; + TCGv_i32 src1, src2; + + if (gen_trap_ifnofpu(dc)) { + return true; + } + if (!(dc->def->features & CPU_FEATURE_FSMULD)) { + return raise_unimpfpop(dc); + } + + gen_op_clear_ieee_excp_and_FTT(); + dst = gen_dest_fpr_D(dc, a->rd); + src1 = gen_load_fpr_F(dc, a->rs1); + src2 = gen_load_fpr_F(dc, a->rs2); + gen_helper_fsmuld(dst, tcg_env, src1, src2); + gen_helper_check_ieee_exceptions(cpu_fsr, tcg_env); + gen_store_fpr_D(dc, a->rd, dst); + return advance_pc(dc); +} + static bool do_dddd(DisasContext *dc, arg_r_r_r *a, void (*func)(TCGv_i64, TCGv_i64, TCGv_i64, TCGv_i64)) { @@ -5202,11 +5208,8 @@ static void disas_sparc_legacy(DisasContext *dc, unsigned int insn) case 0x47: /* fsubq */ case 0x4b: /* fmulq */ case 0x4f: /* fdivq */ - g_assert_not_reached(); /* in decodetree */ case 0x69: /* fsmuld */ - CHECK_FPU_FEATURE(dc, FSMULD); - gen_fop_DFF(dc, rd, rs1, rs2, gen_helper_fsmuld); - break; + g_assert_not_reached(); /* in decodetree */ case 0x6e: /* fdmulq */ CHECK_FPU_FEATURE(dc, FLOAT128); gen_fop_QDD(dc, rd, rs1, rs2, gen_helper_fdmulq); From patchwork Sun Oct 22 06:00: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: 737007 Delivered-To: patch@linaro.org Received: by 2002:adf:dd81:0:b0:32d:baff:b0ca with SMTP id x1csp1006724wrl; Sat, 21 Oct 2023 23:16:26 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHHYYl6okCXuxrA8KrTr/9V/VYwabnsJLGsW7VlML17HHtAh9xR7zeFHmXZP6W1TzwLvbH/ X-Received: by 2002:a05:622a:c5:b0:418:1179:9195 with SMTP id p5-20020a05622a00c500b0041811799195mr7485750qtw.66.1697955386765; Sat, 21 Oct 2023 23:16:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697955386; cv=none; d=google.com; s=arc-20160816; b=rgFyZmMYnUN6fFVfqZHKuwUuxJkXXeL+/iK5ipAPbR25dIAjKcbiH9wnaCvNTUgItU AVa4/DqJakmcnExqo/2eBwXwCVcTg+jCDB0icj9nHXEwmaauU062S1COcM8HecTVSr/t 0wa5PqTzCovo/a6VvsFHWWKsnW9pEdvglQjcSJHGh9WDMTh0LpALeZqpxUvDYVZwedNE cqYBwROEU8gFn8NHDuHAo5P+wQtTB70BriJTF5g9jw0TJqq3H96zoyJBs1RLuypRejHv U/NAqFxnCCXQL7iGY20Is/nWuf3Cnp5qvFvec6nqLij0noPeJaLF8pX9TPRgKAoOjmcA Lijg== 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=+/OoPUbu2ZGrfTLxWlxfpsWJVf4tG57sXC/NTuWxRmA=; fh=TYrED6TOMxGX0VC4GtjviASLbYyJe19+7/tKWjN44KQ=; b=H/VW3+ItYAyxMoY43zd3fBQjdf0EbF3t4I95QNzLrWtZ2ZKZVnTVVEFdY73WAEhLg5 75nip+BQOZkn40/usuDcr4PFxlZJmeoC4hK1blG2fHzA0eu7HfXONqrxQAuLYkq8Y0mo dHNnqBZnbZOKTe8PB/yaxUZ9hmFaH1syr1cHJLpQTz+ig+nspMBzB7+6xbkykbuK+XH8 TE1aTFnjC09CBorj6w/fmnFZSElBEq/8CLmBJbCyrmKm1is1alHaP1kaDnU82aaFZt2J /vJk0NpMxCskusnhiTKyIIG8kxqA/AHS/w27fcSVAGcT9csZqzA0iLXOtIMwJHDBSTFR u+pA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=J6qN+911; 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 t7-20020a05622a01c700b004198727ea19si3756659qtw.528.2023.10.21.23.16.26 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sat, 21 Oct 2023 23:16:26 -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=J6qN+911; 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 1quRaX-0003BB-2t; Sun, 22 Oct 2023 02:05:26 -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 1quRaM-0002U7-R3 for qemu-devel@nongnu.org; Sun, 22 Oct 2023 02:05:14 -0400 Received: from mail-pf1-x431.google.com ([2607:f8b0:4864:20::431]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1quRaJ-0002Ll-9E for qemu-devel@nongnu.org; Sun, 22 Oct 2023 02:05:14 -0400 Received: by mail-pf1-x431.google.com with SMTP id d2e1a72fcca58-6b497c8575aso2205584b3a.1 for ; Sat, 21 Oct 2023 23:05:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1697954706; x=1698559506; 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=+/OoPUbu2ZGrfTLxWlxfpsWJVf4tG57sXC/NTuWxRmA=; b=J6qN+911tApA/kwkZNDrykNfDz+J6eSzNwcKYuHQ3+VUYZtyhb38sRd52hqrfM+Jc9 1jvTpEzHqNFcvnsERXBzJt8AImfFNBh06OTgMeZxwiSkouqB2V4wt8iN9wktIPsEIk1C w5iehnPlU7k0vgaSqv6hIPANFaxYjL6yEmGJpo1dKazx89mwnWP6Ij9qqujtDU2YA5La gKjWH3yIt8xVIbv8oIHDqX5U0PxrS1KAAY5v5CzaZ/7vq0pyQs+6ZTVIZ/SohQTotawE rGFMVETL/XpTUOpiNBjMZJJ1K7XDN7540r/UG/51BRyDiMnbAtUM7X8X1UYPhaT6Tmxw qKng== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697954706; x=1698559506; 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=+/OoPUbu2ZGrfTLxWlxfpsWJVf4tG57sXC/NTuWxRmA=; b=R1KyCxJS1mFVrBm+EtH8dK5bnXZIJoSbOKdXDztd1pk4wDO+LorCniBtBB7NPXKtik YvDU81Yxsl3tk+NneTwfh8yFD3zP9+YjCdnPALDmacQgK2odVE1KNJEB15t4h5jIIrMH ZMfECr9g/l/M6IXOnc6Sf0kYPIDUDL0VAx6aHYTtcHkMYOL9VLSYj0qkr+n1+QLGOVyD rDnT9KY2fES+vOwTafhHVhD8wfNEtnHvUOpAj7namUtyZHJMPZz87OIRB0c+AsLURUKu Tfobe6mthi+ULEs+YTLYyU1OypAtGp5a9KRxaB9U2S9NUQaUCZLHDUP7VsN25TNPCcCp yUWw== X-Gm-Message-State: AOJu0Yw+Lt4X7Q806cKDYYd6ZslKOGF6aicttvzqRF4+Iu/4mFsqGDUK 4sYd4bnH09vP6oz5Pe6Kb5G/h0hEQXowxxWgK+s= X-Received: by 2002:a05:6a00:24c6:b0:690:1c1b:aefd with SMTP id d6-20020a056a0024c600b006901c1baefdmr6932561pfv.5.1697954706528; Sat, 21 Oct 2023 23:05:06 -0700 (PDT) Received: from stoup.. ([71.212.149.95]) by smtp.gmail.com with ESMTPSA id fb13-20020a056a002d8d00b0068a46cd4120sm4007373pfb.199.2023.10.21.23.05.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 21 Oct 2023 23:05:06 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: mark.cave-ayland@ilande.co.uk Subject: [PATCH v4 77/90] target/sparc: Move FDMULQ to decodetree Date: Sat, 21 Oct 2023 23:00:18 -0700 Message-Id: <20231022060031.490251-78-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231022060031.490251-1-richard.henderson@linaro.org> References: <20231022060031.490251-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::431; envelope-from=richard.henderson@linaro.org; helo=mail-pf1-x431.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 | 1 + target/sparc/translate.c | 41 +++++++++++++++++++++------------------ 2 files changed, 23 insertions(+), 19 deletions(-) diff --git a/target/sparc/insns.decode b/target/sparc/insns.decode index 6817d52ca2..a19d191603 100644 --- a/target/sparc/insns.decode +++ b/target/sparc/insns.decode @@ -261,6 +261,7 @@ FDIVs 10 ..... 110100 ..... 0 0100 1101 ..... @r_r_r FDIVd 10 ..... 110100 ..... 0 0100 1110 ..... @r_r_r FDIVq 10 ..... 110100 ..... 0 0100 1111 ..... @r_r_r FsMULd 10 ..... 110100 ..... 0 0110 1001 ..... @r_r_r +FdMULq 10 ..... 110100 ..... 0 0110 1110 ..... @r_r_r FdTOx 10 ..... 110100 00000 0 1000 0010 ..... @r_r2 FxTOd 10 ..... 110100 00000 0 1000 1000 ..... @r_r2 FiTOs 10 ..... 110100 00000 0 1100 0100 ..... @r_r2 diff --git a/target/sparc/translate.c b/target/sparc/translate.c index 4a6f25bdf1..6a7788133a 100644 --- a/target/sparc/translate.c +++ b/target/sparc/translate.c @@ -1666,21 +1666,6 @@ static void gen_ne_fop_QQ(DisasContext *dc, int rd, int rs, } #endif -static void gen_fop_QDD(DisasContext *dc, int rd, int rs1, int rs2, - void (*gen)(TCGv_ptr, TCGv_i64, TCGv_i64)) -{ - TCGv_i64 src1, src2; - - src1 = gen_load_fpr_D(dc, rs1); - src2 = gen_load_fpr_D(dc, rs2); - - gen(tcg_env, src1, src2); - gen_helper_check_ieee_exceptions(cpu_fsr, tcg_env); - - gen_op_store_QT0_fpr(QFPREG(rd)); - gen_update_fprs_dirty(dc, QFPREG(rd)); -} - #ifdef TARGET_SPARC64 static void gen_fop_DF(DisasContext *dc, int rd, int rs, void (*gen)(TCGv_i64, TCGv_ptr, TCGv_i32)) @@ -5143,6 +5128,27 @@ TRANS(FSUBq, ALL, do_env_qqq, a, gen_helper_fsubq) TRANS(FMULq, ALL, do_env_qqq, a, gen_helper_fmulq) TRANS(FDIVq, ALL, do_env_qqq, a, gen_helper_fdivq) +static bool trans_FdMULq(DisasContext *dc, arg_r_r_r *a) +{ + TCGv_i64 src1, src2; + + if (gen_trap_ifnofpu(dc)) { + return true; + } + if (gen_trap_float128(dc)) { + return true; + } + + gen_op_clear_ieee_excp_and_FTT(); + src1 = gen_load_fpr_D(dc, a->rs1); + src2 = gen_load_fpr_D(dc, a->rs2); + gen_helper_fdmulq(tcg_env, src1, src2); + gen_helper_check_ieee_exceptions(cpu_fsr, tcg_env); + gen_op_store_QT0_fpr(QFPREG(a->rd)); + gen_update_fprs_dirty(dc, QFPREG(a->rd)); + return advance_pc(dc); +} + #define CHECK_IU_FEATURE(dc, FEATURE) \ if (!((dc)->def->features & CPU_FEATURE_ ## FEATURE)) \ goto illegal_insn; @@ -5209,11 +5215,8 @@ static void disas_sparc_legacy(DisasContext *dc, unsigned int insn) case 0x4b: /* fmulq */ case 0x4f: /* fdivq */ case 0x69: /* fsmuld */ - g_assert_not_reached(); /* in decodetree */ case 0x6e: /* fdmulq */ - CHECK_FPU_FEATURE(dc, FLOAT128); - gen_fop_QDD(dc, rd, rs1, rs2, gen_helper_fdmulq); - break; + g_assert_not_reached(); /* in decodetree */ case 0xc6: /* fdtos */ gen_fop_FD(dc, rd, rs2, gen_helper_fdtos); break; From patchwork Sun Oct 22 06:00:19 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 736984 Delivered-To: patch@linaro.org Received: by 2002:adf:dd81:0:b0:32d:baff:b0ca with SMTP id x1csp1006140wrl; Sat, 21 Oct 2023 23:13:58 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHwypYbke0ovykf51soti4hv3JN3bSwtKj59/DNPCqIeSsYQ0E9c0q1q8wVlpOp0Vy7Zupv X-Received: by 2002:ac8:59d1:0:b0:41b:806e:81c7 with SMTP id f17-20020ac859d1000000b0041b806e81c7mr7480890qtf.32.1697955238053; Sat, 21 Oct 2023 23:13:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697955238; cv=none; d=google.com; s=arc-20160816; b=QnZXLPVMgCeeoDJOll9e9EDcNLnvd5+5/vs/Xx+Esp8tRzx/81eb5MPFu2krq+yW9A lqkF1XmAV31OWXN3JajQfekreDWSN6wteH4p+h7//bsNOwn+rNo4IusRdw5gjyl73SW6 z5heJyW9fDs7ShoCDGfq9Xytuk9m8c3iR/hKJOm6JeCyYKeHPh5n1x42gpyeieZYI7J4 ykhu6833XRqEp8ynqG11AArkE+PCq440+gTiTvMCGLu7u3lEWVUpRn8YYgU92AS8J39W hgXGHg8Jks8nFuMaMVpTHWCGNpcCEvHpYJbLtzfcgy1tISVaymTe0ZE/E5znVchmA/Tq yz1w== 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=ABeqit4PGf6JPZHEITpYHYWXwnUNT03h3HPbEbGAqCg=; fh=TYrED6TOMxGX0VC4GtjviASLbYyJe19+7/tKWjN44KQ=; b=tnb1NZrNkPjqgXBDVe4tOHdENMNhHzDxaVNLW3uPAhCkDcpciC2wzYpIY44w8py0/z aSAv2ZhzyhiHHxwJULr3VRLmsMCxrp63U2B2EpR91Ac4hDz5KfbO2YDuDEqC0hAz/pbc xsC9MOVBy/Y1P2Dwygld//TrCYeP4TIU551q3bNYjOL9BFFqwY5Uue2XlyvRP9SnK6jD hyfnH3T7BWAuMOSeFLk7XPz5hSDkixP3DwKopklhVqQ6qRPOIg59AYBJzC3hU12wjJwh FdeITNqD3bLMrg8d/Ty1xdRZYG3uEMLkUIrR2M5tF75rtZcAU9iDxIeEY58z942yJjZe ZASQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=cOyEbmlV; 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 v12-20020a0ccd8c000000b0066d2ec22d4esi3959733qvm.455.2023.10.21.23.13.57 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sat, 21 Oct 2023 23:13:58 -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=cOyEbmlV; 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 1quRbQ-0004rk-Or; Sun, 22 Oct 2023 02:06:20 -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 1quRaM-0002Ta-QK for qemu-devel@nongnu.org; Sun, 22 Oct 2023 02:05:14 -0400 Received: from mail-pf1-x42e.google.com ([2607:f8b0:4864:20::42e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1quRaJ-0002Lt-9S for qemu-devel@nongnu.org; Sun, 22 Oct 2023 02:05:13 -0400 Received: by mail-pf1-x42e.google.com with SMTP id d2e1a72fcca58-6b26a3163acso1594192b3a.2 for ; Sat, 21 Oct 2023 23:05:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1697954707; x=1698559507; 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=ABeqit4PGf6JPZHEITpYHYWXwnUNT03h3HPbEbGAqCg=; b=cOyEbmlVBXtjGhqOF7oo882dREqGpL5+i8ABpn4v1lhXATFBIXqQA8p9ipniMqmxK0 GVreoW+HpiCnRIk3Mzd7Rq91OtYrTusHuqg/86Zv2CoduDDDn5fepSsqTNIBeL+GTrcW YoPzlG2c251BDytKpdLPBy5luM79Qi5bf2j4h/6fYeUA4TJbt/AExAGZfRSqHHuMl9sA unYzjlecpcTYdJjlNznykcE/K55tHxruxWlMsQg1qJroQHYXY20IDV/Jy4XTVS7Rd7EW 0dv6vqyLuhnqaOnbz4W8hSALKzc5a0JaewgZcM5Osk2al/YUZF0rhNBKbvp3aIGMFhcq x2iw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697954707; x=1698559507; 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=ABeqit4PGf6JPZHEITpYHYWXwnUNT03h3HPbEbGAqCg=; b=gSS1mfX0dOH5DBqsXfyR6ju35Ws10AbCMMl12ONCdjnfHXbyCj6XuWX9JW6UosEzO5 9UegrTFji3JC7HzE92GkFsQkwwjFz6hy/CiogTkQbp5RZMk2eMZYPKnYdhdHo8QuSeV4 P+Q267gw9A5pKhH6+XdyXMLUtk9LiEWVSNjF0De1q9rRWZnETkl0aHOYhty5fEwG28oC zM/Ij9eCR0pV5vHIrWwxTNk5J4Ai3EAgS8JsM4nLDyfN/ayTHdrC6QeoGZkZx0dFJZKp 4+GYB6vcBNWFgeCQLkIWX+3Hlw1jH4SFqXLRTEEc3WCd3m1kYAZhmZn5qnV2+Z141KTp H3dA== X-Gm-Message-State: AOJu0YwRBt9UWLKzyI9cvmm6K1Bfm46pXEaHaYG5izPuBXySQ7MvOm0x efnrdGycw3ZAVXbS8h6x/qDXv4uUDGlpZNdy4kg= X-Received: by 2002:a05:6a00:194c:b0:6b7:18c1:c09a with SMTP id s12-20020a056a00194c00b006b718c1c09amr4376912pfk.5.1697954707539; Sat, 21 Oct 2023 23:05:07 -0700 (PDT) Received: from stoup.. ([71.212.149.95]) by smtp.gmail.com with ESMTPSA id fb13-20020a056a002d8d00b0068a46cd4120sm4007373pfb.199.2023.10.21.23.05.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 21 Oct 2023 23:05:07 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: mark.cave-ayland@ilande.co.uk Subject: [PATCH v4 78/90] target/sparc: Move gen_fop_FD insns to decodetree Date: Sat, 21 Oct 2023 23:00:19 -0700 Message-Id: <20231022060031.490251-79-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231022060031.490251-1-richard.henderson@linaro.org> References: <20231022060031.490251-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::42e; envelope-from=richard.henderson@linaro.org; helo=mail-pf1-x42e.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 Move FdTOs, FdTOi, FxTOs. Signed-off-by: Richard Henderson --- target/sparc/insns.decode | 3 +++ target/sparc/translate.c | 51 +++++++++++++++++++++------------------ 2 files changed, 30 insertions(+), 24 deletions(-) diff --git a/target/sparc/insns.decode b/target/sparc/insns.decode index a19d191603..faf2bcef83 100644 --- a/target/sparc/insns.decode +++ b/target/sparc/insns.decode @@ -263,9 +263,12 @@ FDIVq 10 ..... 110100 ..... 0 0100 1111 ..... @r_r_r FsMULd 10 ..... 110100 ..... 0 0110 1001 ..... @r_r_r FdMULq 10 ..... 110100 ..... 0 0110 1110 ..... @r_r_r FdTOx 10 ..... 110100 00000 0 1000 0010 ..... @r_r2 +FxTOs 10 ..... 110100 00000 0 1000 0100 ..... @r_r2 FxTOd 10 ..... 110100 00000 0 1000 1000 ..... @r_r2 FiTOs 10 ..... 110100 00000 0 1100 0100 ..... @r_r2 +FdTOs 10 ..... 110100 00000 0 1100 0110 ..... @r_r2 FsTOi 10 ..... 110100 00000 0 1101 0001 ..... @r_r2 +FdTOi 10 ..... 110100 00000 0 1101 0010 ..... @r_r2 { [ diff --git a/target/sparc/translate.c b/target/sparc/translate.c index 6a7788133a..eb66f25a65 100644 --- a/target/sparc/translate.c +++ b/target/sparc/translate.c @@ -55,6 +55,7 @@ #define gen_helper_restored ({ qemu_build_not_reached(); NULL; }) #define gen_helper_fdtox ({ qemu_build_not_reached(); NULL; }) #define gen_helper_fxtod ({ qemu_build_not_reached(); NULL; }) +#define gen_helper_fxtos ({ qemu_build_not_reached(); NULL; }) #define gen_helper_fnegd(D, S) qemu_build_not_reached() #define gen_helper_fabsd(D, S) qemu_build_not_reached() #define gen_helper_done(E) qemu_build_not_reached() @@ -1697,21 +1698,6 @@ static void gen_ne_fop_DF(DisasContext *dc, int rd, int rs, gen_store_fpr_D(dc, rd, dst); } -static void gen_fop_FD(DisasContext *dc, int rd, int rs, - void (*gen)(TCGv_i32, TCGv_ptr, TCGv_i64)) -{ - TCGv_i32 dst; - TCGv_i64 src; - - src = gen_load_fpr_D(dc, rs); - dst = gen_dest_fpr_F(dc); - - gen(dst, tcg_env, src); - gen_helper_check_ieee_exceptions(cpu_fsr, tcg_env); - - gen_store_fpr_F(dc, rd, dst); -} - static void gen_fop_FQ(DisasContext *dc, int rd, int rs, void (*gen)(TCGv_i32, TCGv_ptr)) { @@ -4876,6 +4862,29 @@ TRANS(FSQRTs, ALL, do_env_ff, a, gen_helper_fsqrts) TRANS(FiTOs, ALL, do_env_ff, a, gen_helper_fitos) TRANS(FsTOi, ALL, do_env_ff, a, gen_helper_fstoi) +static bool do_env_fd(DisasContext *dc, arg_r_r *a, + void (*func)(TCGv_i32, TCGv_env, TCGv_i64)) +{ + TCGv_i32 dst; + TCGv_i64 src; + + if (gen_trap_ifnofpu(dc)) { + return true; + } + + gen_op_clear_ieee_excp_and_FTT(); + dst = gen_dest_fpr_F(dc); + src = gen_load_fpr_D(dc, a->rs); + func(dst, tcg_env, src); + gen_helper_check_ieee_exceptions(cpu_fsr, tcg_env); + gen_store_fpr_F(dc, a->rd, dst); + return advance_pc(dc); +} + +TRANS(FdTOs, ALL, do_env_fd, a, gen_helper_fdtos) +TRANS(FdTOi, ALL, do_env_fd, a, gen_helper_fdtoi) +TRANS(FxTOs, 64, do_env_fd, a, gen_helper_fxtos) + static bool do_dd(DisasContext *dc, arg_r_r *a, void (*func)(TCGv_i64, TCGv_i64)) { @@ -5216,10 +5225,10 @@ static void disas_sparc_legacy(DisasContext *dc, unsigned int insn) case 0x4f: /* fdivq */ case 0x69: /* fsmuld */ case 0x6e: /* fdmulq */ - g_assert_not_reached(); /* in decodetree */ case 0xc6: /* fdtos */ - gen_fop_FD(dc, rd, rs2, gen_helper_fdtos); - break; + case 0xd2: /* fdtoi */ + case 0x84: /* V9 fxtos */ + g_assert_not_reached(); /* in decodetree */ case 0xc7: /* fqtos */ CHECK_FPU_FEATURE(dc, FLOAT128); gen_fop_FQ(dc, rd, rs2, gen_helper_fqtos); @@ -5246,9 +5255,6 @@ static void disas_sparc_legacy(DisasContext *dc, unsigned int insn) CHECK_FPU_FEATURE(dc, FLOAT128); gen_ne_fop_QD(dc, rd, rs2, gen_helper_fdtoq); break; - case 0xd2: /* fdtoi */ - gen_fop_FD(dc, rd, rs2, gen_helper_fdtoi); - break; case 0xd3: /* fqtoi */ CHECK_FPU_FEATURE(dc, FLOAT128); gen_fop_FQ(dc, rd, rs2, gen_helper_fqtoi); @@ -5273,9 +5279,6 @@ static void disas_sparc_legacy(DisasContext *dc, unsigned int insn) CHECK_FPU_FEATURE(dc, FLOAT128); gen_fop_DQ(dc, rd, rs2, gen_helper_fqtox); break; - case 0x84: /* V9 fxtos */ - gen_fop_FD(dc, rd, rs2, gen_helper_fxtos); - break; case 0x8c: /* V9 fxtoq */ CHECK_FPU_FEATURE(dc, FLOAT128); gen_ne_fop_QD(dc, rd, rs2, gen_helper_fxtoq); From patchwork Sun Oct 22 06:00:20 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 737006 Delivered-To: patch@linaro.org Received: by 2002:adf:dd81:0:b0:32d:baff:b0ca with SMTP id x1csp1006678wrl; Sat, 21 Oct 2023 23:16:13 -0700 (PDT) X-Google-Smtp-Source: AGHT+IH4N63SUFLNN5hIn2OeXXVEXJZ93p4EEXkrU58Iopf/InZdZfezjLRk9rnM2ACR5t3EZ64C X-Received: by 2002:ac8:5f89:0:b0:41c:de9e:d1a8 with SMTP id j9-20020ac85f89000000b0041cde9ed1a8mr6155230qta.52.1697955372962; Sat, 21 Oct 2023 23:16:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697955372; cv=none; d=google.com; s=arc-20160816; b=XbfVcONqHvST2YSAivFq2DlOIYmxbXZMXGXwiTCqcjMMKDUSbxbXDGBss33pqEapiY f5rSNd5BM1hNGYK6EB5+Qro4DWd+DPXOBHfUlQksRKafsD09kTupbyaDHR2s4BJezhbk UnTWvbCRSFBd7r0nmighCTagLz8NdlRsusj7UQFDM+RQ+nu0vzDIO1jPFP2wPjdwI4DC P9pSWj7nYAT2wKAg0zEcmK9PL4WtUDgRyDLphdfZk/YZImXkVT9fZs3DdpkOG8Xe4eEC oGRnGsLAAXzXxLhD1aSn6fZyhSniUOCFrisI+M3hwybl0cL3S/8zWOPMDeLt3WA/a1UE KPLg== 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=CKFFFf4efePSH6sF6nnca+VgvTu6GHbtsFBpYuPsvcQ=; fh=TYrED6TOMxGX0VC4GtjviASLbYyJe19+7/tKWjN44KQ=; b=UfrsjRG+BxTBEVyl4BEV+E8+FQhO/0VXA3JwkGmj6aRoOqKnl+w33/IabIbpwSvUyk J578m5S0Ky+E16e34vXBYDgkFzp8zrgQWjDmX+eAejfxesaQ3g+tWjqDg5Nk7Q7VS5WU 4NI0gNFOWI1SKLz0dKHIpX5BAOvfWj5oCtUo4Brgvyk45/KLqw/zjDKnBdXN1vaHfvxg lW03X71JE50c1dJ/8t658xHKD9op3WSQfdhH9+PXUze8BCzBV7HkWM+5daXs19i3fDB0 Iy2cn2Kt0pAzC/AIpBTCxG7F8oc/Oi3dkrau0EUDT9jIO78iP2g6Dj0/97PX+ePul/XY sQww== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=ts4WQvFQ; 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 f11-20020ac87f0b000000b0041cb41f9b82si3727574qtk.728.2023.10.21.23.16.12 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sat, 21 Oct 2023 23:16:12 -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=ts4WQvFQ; 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 1quRbT-0004wR-Vw; Sun, 22 Oct 2023 02:06:24 -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 1quRaM-0002Ur-To for qemu-devel@nongnu.org; Sun, 22 Oct 2023 02:05:14 -0400 Received: from mail-pf1-x42d.google.com ([2607:f8b0:4864:20::42d]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1quRaK-0002PK-20 for qemu-devel@nongnu.org; Sun, 22 Oct 2023 02:05:14 -0400 Received: by mail-pf1-x42d.google.com with SMTP id d2e1a72fcca58-6b709048d8eso1659090b3a.2 for ; Sat, 21 Oct 2023 23:05:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1697954708; x=1698559508; 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=CKFFFf4efePSH6sF6nnca+VgvTu6GHbtsFBpYuPsvcQ=; b=ts4WQvFQm9AJdOUuCbl7s4kV4QC0ZPI7oqOauTwXKmqJ6QG4TX36GAJpirupjARfnm Dv3h79GnnbxTbSu+KDmlMVVNkoXyBRK92ANyT2qs6aiire7ikRfaxIRiUnNS9LF86nzB dlJHOfFUP8090rjQDqnpZXC6k157ZhucK1kTaD5f+eCTsjZCQbPJ2yE5FAEtTzJWCvQ/ p83Tf7LREiCzoGg+75SpSkIXMGpYwknSeWtMGkI3vHD3s/+PnvOf/bQJQ5xRkgf1l5r+ s0HSjohb7o1B1GK9GbzdZPrM08iOiVs2+LNrUokaifFZJBaTN7way18pUY3fPSrDojKh W0Ag== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697954708; x=1698559508; 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=CKFFFf4efePSH6sF6nnca+VgvTu6GHbtsFBpYuPsvcQ=; b=m2TrQ5XCKwRaQKJDKzT5RIDZKTfGt02jzNN478wbfzNE1ZzDCuAvoPR1B6iu99e8S3 Gys5XJcl0gZxXHhIOmzP0qxtoWUEvHOvjd2f10qTdQQ7NhTkbohy4O35mB0HHDDQ89Jl UL99Oz2GEW3BhfCUWPGUAqF/Rg2D3gkeIFMnFjbzd26XJ9iuWz2Goo7sr/tF5RZELI7J sDB5S89wjGlRt4IsDiMm8SeiYbN/Bxi2Jdp5jo/0+ac+QgTfilfE52UFwX65+k9aAhim PU81JZmtgYgOPBD8y5aZ32xZfrcxN76DTOcl7q4c1AN/MG7vfrzeqAZJheeJxGNlY8XM Jdww== X-Gm-Message-State: AOJu0Yx8Zm+1cfhlyW1F/NQ3u7jaBPokLz9EPqSLtUKrFM08TcWKESW0 c+3pRWfX2ls1/THFVmaJQ3EaFQnAOxwE/AHhTR4= X-Received: by 2002:a05:6a00:150a:b0:68e:3772:4e40 with SMTP id q10-20020a056a00150a00b0068e37724e40mr4980549pfu.3.1697954708333; Sat, 21 Oct 2023 23:05:08 -0700 (PDT) Received: from stoup.. ([71.212.149.95]) by smtp.gmail.com with ESMTPSA id fb13-20020a056a002d8d00b0068a46cd4120sm4007373pfb.199.2023.10.21.23.05.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 21 Oct 2023 23:05:07 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: mark.cave-ayland@ilande.co.uk Subject: [PATCH v4 79/90] target/sparc: Move FiTOd, FsTOd, FsTOx to decodetree Date: Sat, 21 Oct 2023 23:00:20 -0700 Message-Id: <20231022060031.490251-80-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231022060031.490251-1-richard.henderson@linaro.org> References: <20231022060031.490251-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::42d; envelope-from=richard.henderson@linaro.org; helo=mail-pf1-x42d.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 Note that gen_ne_fop_DF was incorrectly named and does pass env. The two sets of helpers should have been unified. Signed-off-by: Richard Henderson --- target/sparc/insns.decode | 3 ++ target/sparc/translate.c | 67 ++++++++++++++++----------------------- 2 files changed, 30 insertions(+), 40 deletions(-) diff --git a/target/sparc/insns.decode b/target/sparc/insns.decode index faf2bcef83..ee9262061b 100644 --- a/target/sparc/insns.decode +++ b/target/sparc/insns.decode @@ -262,11 +262,14 @@ FDIVd 10 ..... 110100 ..... 0 0100 1110 ..... @r_r_r FDIVq 10 ..... 110100 ..... 0 0100 1111 ..... @r_r_r FsMULd 10 ..... 110100 ..... 0 0110 1001 ..... @r_r_r FdMULq 10 ..... 110100 ..... 0 0110 1110 ..... @r_r_r +FsTOx 10 ..... 110100 00000 0 1000 0001 ..... @r_r2 FdTOx 10 ..... 110100 00000 0 1000 0010 ..... @r_r2 FxTOs 10 ..... 110100 00000 0 1000 0100 ..... @r_r2 FxTOd 10 ..... 110100 00000 0 1000 1000 ..... @r_r2 FiTOs 10 ..... 110100 00000 0 1100 0100 ..... @r_r2 FdTOs 10 ..... 110100 00000 0 1100 0110 ..... @r_r2 +FiTOd 10 ..... 110100 00000 0 1100 1000 ..... @r_r2 +FsTOd 10 ..... 110100 00000 0 1100 1001 ..... @r_r2 FsTOi 10 ..... 110100 00000 0 1101 0001 ..... @r_r2 FdTOi 10 ..... 110100 00000 0 1101 0010 ..... @r_r2 diff --git a/target/sparc/translate.c b/target/sparc/translate.c index eb66f25a65..5630dd24f0 100644 --- a/target/sparc/translate.c +++ b/target/sparc/translate.c @@ -54,6 +54,7 @@ #define gen_helper_saved ({ qemu_build_not_reached(); NULL; }) #define gen_helper_restored ({ qemu_build_not_reached(); NULL; }) #define gen_helper_fdtox ({ qemu_build_not_reached(); NULL; }) +#define gen_helper_fstox ({ qemu_build_not_reached(); NULL; }) #define gen_helper_fxtod ({ qemu_build_not_reached(); NULL; }) #define gen_helper_fxtos ({ qemu_build_not_reached(); NULL; }) #define gen_helper_fnegd(D, S) qemu_build_not_reached() @@ -1667,37 +1668,6 @@ static void gen_ne_fop_QQ(DisasContext *dc, int rd, int rs, } #endif -#ifdef TARGET_SPARC64 -static void gen_fop_DF(DisasContext *dc, int rd, int rs, - void (*gen)(TCGv_i64, TCGv_ptr, TCGv_i32)) -{ - TCGv_i64 dst; - TCGv_i32 src; - - src = gen_load_fpr_F(dc, rs); - dst = gen_dest_fpr_D(dc, rd); - - gen(dst, tcg_env, src); - gen_helper_check_ieee_exceptions(cpu_fsr, tcg_env); - - gen_store_fpr_D(dc, rd, dst); -} -#endif - -static void gen_ne_fop_DF(DisasContext *dc, int rd, int rs, - void (*gen)(TCGv_i64, TCGv_ptr, TCGv_i32)) -{ - TCGv_i64 dst; - TCGv_i32 src; - - src = gen_load_fpr_F(dc, rs); - dst = gen_dest_fpr_D(dc, rd); - - gen(dst, tcg_env, src); - - gen_store_fpr_D(dc, rd, dst); -} - static void gen_fop_FQ(DisasContext *dc, int rd, int rs, void (*gen)(TCGv_i32, TCGv_ptr)) { @@ -4929,6 +4899,29 @@ TRANS(FSQRTd, ALL, do_env_dd, a, gen_helper_fsqrtd) TRANS(FxTOd, 64, do_env_dd, a, gen_helper_fxtod) TRANS(FdTOx, 64, do_env_dd, a, gen_helper_fdtox) +static bool do_env_df(DisasContext *dc, arg_r_r *a, + void (*func)(TCGv_i64, TCGv_env, TCGv_i32)) +{ + TCGv_i64 dst; + TCGv_i32 src; + + if (gen_trap_ifnofpu(dc)) { + return true; + } + + gen_op_clear_ieee_excp_and_FTT(); + dst = gen_dest_fpr_D(dc, a->rd); + src = gen_load_fpr_F(dc, a->rs); + func(dst, tcg_env, src); + gen_helper_check_ieee_exceptions(cpu_fsr, tcg_env); + gen_store_fpr_D(dc, a->rd, dst); + return advance_pc(dc); +} + +TRANS(FiTOd, ALL, do_env_df, a, gen_helper_fitod) +TRANS(FsTOd, ALL, do_env_df, a, gen_helper_fstod) +TRANS(FsTOx, 64, do_env_df, a, gen_helper_fstox) + static bool do_env_qq(DisasContext *dc, arg_r_r *a, void (*func)(TCGv_env)) { @@ -5228,17 +5221,14 @@ static void disas_sparc_legacy(DisasContext *dc, unsigned int insn) case 0xc6: /* fdtos */ case 0xd2: /* fdtoi */ case 0x84: /* V9 fxtos */ + case 0xc8: /* fitod */ + case 0xc9: /* fstod */ + case 0x81: /* V9 fstox */ g_assert_not_reached(); /* in decodetree */ case 0xc7: /* fqtos */ CHECK_FPU_FEATURE(dc, FLOAT128); gen_fop_FQ(dc, rd, rs2, gen_helper_fqtos); break; - case 0xc8: /* fitod */ - gen_ne_fop_DF(dc, rd, rs2, gen_helper_fitod); - break; - case 0xc9: /* fstod */ - gen_ne_fop_DF(dc, rd, rs2, gen_helper_fstod); - break; case 0xcb: /* fqtod */ CHECK_FPU_FEATURE(dc, FLOAT128); gen_fop_DQ(dc, rd, rs2, gen_helper_fqtod); @@ -5272,9 +5262,6 @@ static void disas_sparc_legacy(DisasContext *dc, unsigned int insn) CHECK_FPU_FEATURE(dc, FLOAT128); gen_ne_fop_QQ(dc, rd, rs2, gen_helper_fabsq); break; - case 0x81: /* V9 fstox */ - gen_fop_DF(dc, rd, rs2, gen_helper_fstox); - break; case 0x83: /* V9 fqtox */ CHECK_FPU_FEATURE(dc, FLOAT128); gen_fop_DQ(dc, rd, rs2, gen_helper_fqtox); From patchwork Sun Oct 22 06:00:21 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 736983 Delivered-To: patch@linaro.org Received: by 2002:adf:dd81:0:b0:32d:baff:b0ca with SMTP id x1csp1006129wrl; Sat, 21 Oct 2023 23:13:56 -0700 (PDT) X-Google-Smtp-Source: AGHT+IG/uw2gaQIEO0/KlsVcBLgOFCd+pUuZGAFFOqf7hH9obW/cUjb/W3Hw1+2FkR+GwK5HLUaw X-Received: by 2002:ac8:5813:0:b0:417:9a94:870b with SMTP id g19-20020ac85813000000b004179a94870bmr8198235qtg.35.1697955236671; Sat, 21 Oct 2023 23:13:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697955236; cv=none; d=google.com; s=arc-20160816; b=ec4gMkfLTJjiT+NWCcu8QtygPAwP80JTFliOFlkXfbWD8ZYFh103fc7AP4lxI+tqP+ aL4M4dOwpI31qhqctiYHN6rnDcc+7Ca4lZQ71jYQqGMmq92fFtls0Z6wAyYBgAiOc4SY F4yQBTokSEV4Q+JMCwnaK++4HVPbhxtPZiVoztKL6yWu4kacn55zBHaz2o3OLA2mEA5U SYw818e5NNupetpnulg0t8UeYwTnekpNsXF+sffePWuFlvR7U/wnANBvWlSUx8PmEU1o 0wr9v63WicrTWt7ovkTqYS/UI5jwJJ/bP36o3IotedxHNNpLroSvCBwOwBg1Yqmk9Wsh MaYw== 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=k6ZWMTynXcmQhzUUaDVajkzlr4pmWr9Um9ZbZoPbXHM=; fh=TYrED6TOMxGX0VC4GtjviASLbYyJe19+7/tKWjN44KQ=; b=LNHfzVa6xE9ORKkZ8OgBOA3eFRgvIr9sdIosDudqTubxL7LB34tc5FRjmGHedae0eF V+dtAq9VoJ82FbhtUpdJ7ajaWK7ATYm/bDQLLdy7J6RdbKL6iDeg1Q0xsW56yRhJbAIE CzWc73hvAKfEckTfQDkbfYhU417lJMHYxTmkVbAJgZS42Gmf1fcbZTJYp78N1BOV+WnM Gf7P/QUJhuxy++PQu38bT9af5ZH27YQjL2C1NKoOhLBTzmpOIeqX6CS3CaaRZ2OgwuqT pPodPepl9wTJFUuMhQlJFbvdGL+BHjPjuSnvoc4f1IZwL/7twHmAlBMtL2KaACoGSfAQ 8euQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=XjPBV5tu; 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 x14-20020a05622a000e00b00403ea9c5354si3696622qtw.435.2023.10.21.23.13.56 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sat, 21 Oct 2023 23:13:56 -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=XjPBV5tu; 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 1quRdW-0006oq-Ap; Sun, 22 Oct 2023 02:08:30 -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 1quRdR-0006Oh-KE for qemu-devel@nongnu.org; Sun, 22 Oct 2023 02:08:25 -0400 Received: from mail-pf1-x434.google.com ([2607:f8b0:4864:20::434]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1quRdD-00035S-G5 for qemu-devel@nongnu.org; Sun, 22 Oct 2023 02:08:25 -0400 Received: by mail-pf1-x434.google.com with SMTP id d2e1a72fcca58-6b6f4c118b7so1764550b3a.0 for ; Sat, 21 Oct 2023 23:08:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1697954890; x=1698559690; 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=k6ZWMTynXcmQhzUUaDVajkzlr4pmWr9Um9ZbZoPbXHM=; b=XjPBV5tuuKids9kGovcmHo1nkBpgGlIqYGHGc+7Et8pSZ6T0vZaQQ4JSNRdbOfA4AV ijHAa7bFpO+3v5hIbM73IJ0Cyju4Qid9NPANG0QSXx6A3YgkoxlLTzcwAXYjwZBba6Ia 9Tg7DKJROWg/94ebUqueoeTcqb6tRstEAmOlzidg95CjLoG3D4B0ZR4VJNu92gFXDl0d WcZ4kAmkIm3ORo6XSDgydr7F+0k+x0bDZWy5Dn/rPWjAVXeN3GYaDAT8nD0EVTSOIr11 Y+6l4wiZ+S4VyQQMXR05y4GRKQeAYEe5mWip7wJQaimps+fjuRVt7Yl2QdvJ4Nue2F+u ywgQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697954890; x=1698559690; 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=k6ZWMTynXcmQhzUUaDVajkzlr4pmWr9Um9ZbZoPbXHM=; b=DYICcEY4zaj9eTuayyzfnre2fjis1ds0MPaEcfIYJVJtYtd9yLNo8i+tGz9PZyoOFd N+FstGWI8KmOUtO6W2Gq7rYpl6eoVEirfCYj8SoOxAO+43CmbIk8vwN8aYAje0VInGJF yfJ0P40nOhaHqbH9sW4f83YBI9MHFkuumJ8Mu6GlG2crphCsZSA9+zIFoypQlafPRGkV fCfyqXtFfslHc3A7cXeuWDJvk8c5dgzcDG3Evm4DMj54Vyp5kyBeJqWoyeXiw3pua591 ffvE+YBmlE0n0IxbygauVZjkxWC2T9uOH1j3LgGre1G0Ut6iZd/eHlNp58P9vSCjydSn NXgg== X-Gm-Message-State: AOJu0YwMHLO9zdiEAmHWD4s4dXr04UtxFQeY3UMrCN86V6YZBwUG9U0s s6sF5WPl2sSR6wC0KTqwkpOjHsd7enWhMaqzBRY= X-Received: by 2002:a17:903:41c4:b0:1ca:e05a:93a2 with SMTP id u4-20020a17090341c400b001cae05a93a2mr491532ple.32.1697954889402; Sat, 21 Oct 2023 23:08:09 -0700 (PDT) Received: from stoup.. ([71.212.149.95]) by smtp.gmail.com with ESMTPSA id li11-20020a170903294b00b001c444106bcasm3962919plb.46.2023.10.21.23.08.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 21 Oct 2023 23:08:09 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: mark.cave-ayland@ilande.co.uk Subject: [PATCH v4 80/90] target/sparc: Move FqTOs, FqTOi to decodetree Date: Sat, 21 Oct 2023 23:00:21 -0700 Message-Id: <20231022060031.490251-81-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231022060031.490251-1-richard.henderson@linaro.org> References: <20231022060031.490251-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::434; envelope-from=richard.henderson@linaro.org; helo=mail-pf1-x434.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 | 2 ++ target/sparc/translate.c | 48 +++++++++++++++++++++------------------ 2 files changed, 28 insertions(+), 22 deletions(-) diff --git a/target/sparc/insns.decode b/target/sparc/insns.decode index ee9262061b..33f0c738e6 100644 --- a/target/sparc/insns.decode +++ b/target/sparc/insns.decode @@ -268,10 +268,12 @@ FxTOs 10 ..... 110100 00000 0 1000 0100 ..... @r_r2 FxTOd 10 ..... 110100 00000 0 1000 1000 ..... @r_r2 FiTOs 10 ..... 110100 00000 0 1100 0100 ..... @r_r2 FdTOs 10 ..... 110100 00000 0 1100 0110 ..... @r_r2 +FqTOs 10 ..... 110100 00000 0 1100 0111 ..... @r_r2 FiTOd 10 ..... 110100 00000 0 1100 1000 ..... @r_r2 FsTOd 10 ..... 110100 00000 0 1100 1001 ..... @r_r2 FsTOi 10 ..... 110100 00000 0 1101 0001 ..... @r_r2 FdTOi 10 ..... 110100 00000 0 1101 0010 ..... @r_r2 +FqTOi 10 ..... 110100 00000 0 1101 0011 ..... @r_r2 { [ diff --git a/target/sparc/translate.c b/target/sparc/translate.c index 5630dd24f0..e0d5f01887 100644 --- a/target/sparc/translate.c +++ b/target/sparc/translate.c @@ -1668,20 +1668,6 @@ static void gen_ne_fop_QQ(DisasContext *dc, int rd, int rs, } #endif -static void gen_fop_FQ(DisasContext *dc, int rd, int rs, - void (*gen)(TCGv_i32, TCGv_ptr)) -{ - TCGv_i32 dst; - - gen_op_load_fpr_QT1(QFPREG(rs)); - dst = gen_dest_fpr_F(dc); - - gen(dst, tcg_env); - gen_helper_check_ieee_exceptions(cpu_fsr, tcg_env); - - gen_store_fpr_F(dc, rd, dst); -} - static void gen_fop_DQ(DisasContext *dc, int rd, int rs, void (*gen)(TCGv_i64, TCGv_ptr)) { @@ -4943,6 +4929,30 @@ static bool do_env_qq(DisasContext *dc, arg_r_r *a, TRANS(FSQRTq, ALL, do_env_qq, a, gen_helper_fsqrtq) +static bool do_env_fq(DisasContext *dc, arg_r_r *a, + void (*func)(TCGv_i32, TCGv_env)) +{ + TCGv_i32 dst; + + if (gen_trap_ifnofpu(dc)) { + return true; + } + if (gen_trap_float128(dc)) { + return true; + } + + gen_op_clear_ieee_excp_and_FTT(); + gen_op_load_fpr_QT1(QFPREG(a->rs)); + dst = gen_dest_fpr_F(dc); + func(dst, tcg_env); + gen_helper_check_ieee_exceptions(cpu_fsr, tcg_env); + gen_store_fpr_F(dc, a->rd, dst); + return advance_pc(dc); +} + +TRANS(FqTOs, ALL, do_env_fq, a, gen_helper_fqtos) +TRANS(FqTOi, ALL, do_env_fq, a, gen_helper_fqtoi) + static bool do_fff(DisasContext *dc, arg_r_r_r *a, void (*func)(TCGv_i32, TCGv_i32, TCGv_i32)) { @@ -5224,11 +5234,9 @@ static void disas_sparc_legacy(DisasContext *dc, unsigned int insn) case 0xc8: /* fitod */ case 0xc9: /* fstod */ case 0x81: /* V9 fstox */ - g_assert_not_reached(); /* in decodetree */ case 0xc7: /* fqtos */ - CHECK_FPU_FEATURE(dc, FLOAT128); - gen_fop_FQ(dc, rd, rs2, gen_helper_fqtos); - break; + case 0xd3: /* fqtoi */ + g_assert_not_reached(); /* in decodetree */ case 0xcb: /* fqtod */ CHECK_FPU_FEATURE(dc, FLOAT128); gen_fop_DQ(dc, rd, rs2, gen_helper_fqtod); @@ -5245,10 +5253,6 @@ static void disas_sparc_legacy(DisasContext *dc, unsigned int insn) CHECK_FPU_FEATURE(dc, FLOAT128); gen_ne_fop_QD(dc, rd, rs2, gen_helper_fdtoq); break; - case 0xd3: /* fqtoi */ - CHECK_FPU_FEATURE(dc, FLOAT128); - gen_fop_FQ(dc, rd, rs2, gen_helper_fqtoi); - break; #ifdef TARGET_SPARC64 case 0x3: /* V9 fmovq */ CHECK_FPU_FEATURE(dc, FLOAT128); From patchwork Sun Oct 22 06:00:22 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 736999 Delivered-To: patch@linaro.org Received: by 2002:adf:dd81:0:b0:32d:baff:b0ca with SMTP id x1csp1006340wrl; Sat, 21 Oct 2023 23:14:45 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHxPiRMIRVNU2cbCoMVKEOjb+P/STsl43GPn4uiCDDBY09o++uNTmv0vV17VsXpY042li5v X-Received: by 2002:a05:620a:28d6:b0:779:d4ef:5f1f with SMTP id l22-20020a05620a28d600b00779d4ef5f1fmr384890qkp.29.1697955285014; Sat, 21 Oct 2023 23:14:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697955285; cv=none; d=google.com; s=arc-20160816; b=tGBETc844GKjtlRUTCKa3veTwNIUbSId2RL56FAe/gjO/rzO3ipJy/tFqJ5fta/8hD QLXNcpGLZTAOLddiM73vnO8AOc9DX8nvn18L/XF0eFn8kIK9xIk/P+fEl9xTBMxGLWea i5GZYH/QXbflSoMsrZWt6kV+C+EKoDva7jDbtDTOZS+lCcglGfigVIAowahaUgyXaW2e drFDP4NTX/HqTS7IfeGeNJ86wb1IZCoCSVaWSvjMWYVC8h6gMdXMoMLl8/qXnTxeTDbV IdOR/zNQIx9cE53QQJuwu9U0eVy7l0uhJtFkctbQc8rkkur9gJ66lg6hjW4KLS7Hw7wG iuhA== 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=2h7nOSdKbn+qf684EsPSz1FDCTilXbAvf6WAk/B9s4E=; fh=TYrED6TOMxGX0VC4GtjviASLbYyJe19+7/tKWjN44KQ=; b=WdtN7gC/PQ8bJ06/2M4gGzsPB1XhZmHfhaN6NDgpezFsDY69hHMQul0sY+kgWKECuV kOTqTheQNSvq8EvJTvtDT9x6981lbzD82qQm1givwUAPqIiuY+kBbhY4FtTk4V4ibNd3 rFmIQIsOsJEqONK/wJucPl041BBj2NGwCDg6onBNTRQhaCLsFZP+jIlZ6IM7nxl66Twi XcWeOJHUnZbAVQckpQoJrWlWd/JgWHweJJXiZJUSPW3hj5GE3uq0sjf64rdl8kHk2dke HQAyYKOka0PyhS5+i7fVjlUkqKyovzDf2i1I/n8vs5aHfmEy46yu43GRPVtfbvUSXxp/ EngQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=F8tY8hB9; 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 d17-20020a05620a167100b00774373352b5si3565964qko.769.2023.10.21.23.14.44 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sat, 21 Oct 2023 23:14:44 -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=F8tY8hB9; 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 1quRdQ-0006Jo-Qm; Sun, 22 Oct 2023 02:08:24 -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 1quRdO-00067u-1I for qemu-devel@nongnu.org; Sun, 22 Oct 2023 02:08:22 -0400 Received: from mail-oi1-x232.google.com ([2607:f8b0:4864:20::232]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1quRdD-00035Y-GO for qemu-devel@nongnu.org; Sun, 22 Oct 2023 02:08:21 -0400 Received: by mail-oi1-x232.google.com with SMTP id 5614622812f47-3b2b1ae4c21so1677733b6e.0 for ; Sat, 21 Oct 2023 23:08:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1697954890; x=1698559690; 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=2h7nOSdKbn+qf684EsPSz1FDCTilXbAvf6WAk/B9s4E=; b=F8tY8hB9QAKG4xU1hB82D/itxnyKw7ON5uPsFSpR6Gl97yxjNua5CI/BbQ27ZbpJya 9Nj/oYdl6tll3iB9MpWR7+jyJRFOGIN60dn9TAH34zqh3iZCcPn29v+0zVfbtKr79fzj ryRh4C1PZIyNMQCyItO5nteNWfimhozdm3OsCO0wjniZ7gBtc47sfC26eM87cTEc2P1n 1jQm52z5WJIIlNsYfh1975kT5kF+uZeOwtT4CLrNtkUNhvaLbdb6a1o4v4B9eFgLW51h rvmXLGOk1kYS5tQ2444VbBg2Vy7mufo1Zq0xzaJUcNb6Av/Ns3uO3ym0XMHsbWtihnoZ /EgA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697954890; x=1698559690; 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=2h7nOSdKbn+qf684EsPSz1FDCTilXbAvf6WAk/B9s4E=; b=sRbmbO/7p1XhzYjQ8ruA6FL6FwzuhM2UukFv6091cjTqbqf/8DofcWzIfw8AyzX/MO VLbcuyhcqJj64YrbyhxCeWBtU/fwqhlzffZSj0job84GuhrJVClCrPMP7Fzp1Gkfm+FR 3XYddMWC7Xf1B2pDXhF0zccLQ2sGslB0k6/m96YBLmiWMNbx6tAbqp+Ss4Ymk779Ag9t PfFZkBd/QEvVVsuiXYku5jkNVAmsG8QWjHSHLrWpGUJSHbSbXL3GFZ4tvSD2V/YpZslE vimYtJrIRY3nce/vyzUoH0+hrhA3huRNuGSFZyunjxSZH0SV25xufMGWRMtv7oR4XZLN utYA== X-Gm-Message-State: AOJu0YzpFC+889lVreM6wOMMloCCSVjXuL8Ql8ooXFT2prhRsLD9Rf1J Xi1+IXOXHCeLDdQWktU9YQubAc1B+iZmIZ9377Q= X-Received: by 2002:a05:6808:2d1:b0:3ae:3d0:d74a with SMTP id a17-20020a05680802d100b003ae03d0d74amr6862299oid.52.1697954890341; Sat, 21 Oct 2023 23:08:10 -0700 (PDT) Received: from stoup.. ([71.212.149.95]) by smtp.gmail.com with ESMTPSA id li11-20020a170903294b00b001c444106bcasm3962919plb.46.2023.10.21.23.08.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 21 Oct 2023 23:08:09 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: mark.cave-ayland@ilande.co.uk Subject: [PATCH v4 81/90] target/sparc: Move FqTOd, FqTOx to decodetree Date: Sat, 21 Oct 2023 23:00:22 -0700 Message-Id: <20231022060031.490251-82-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231022060031.490251-1-richard.henderson@linaro.org> References: <20231022060031.490251-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::232; envelope-from=richard.henderson@linaro.org; helo=mail-oi1-x232.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 | 2 ++ target/sparc/translate.c | 49 +++++++++++++++++++++------------------ 2 files changed, 29 insertions(+), 22 deletions(-) diff --git a/target/sparc/insns.decode b/target/sparc/insns.decode index 33f0c738e6..7b65b31f89 100644 --- a/target/sparc/insns.decode +++ b/target/sparc/insns.decode @@ -264,6 +264,7 @@ FsMULd 10 ..... 110100 ..... 0 0110 1001 ..... @r_r_r FdMULq 10 ..... 110100 ..... 0 0110 1110 ..... @r_r_r FsTOx 10 ..... 110100 00000 0 1000 0001 ..... @r_r2 FdTOx 10 ..... 110100 00000 0 1000 0010 ..... @r_r2 +FqTOx 10 ..... 110100 00000 0 1000 0011 ..... @r_r2 FxTOs 10 ..... 110100 00000 0 1000 0100 ..... @r_r2 FxTOd 10 ..... 110100 00000 0 1000 1000 ..... @r_r2 FiTOs 10 ..... 110100 00000 0 1100 0100 ..... @r_r2 @@ -271,6 +272,7 @@ FdTOs 10 ..... 110100 00000 0 1100 0110 ..... @r_r2 FqTOs 10 ..... 110100 00000 0 1100 0111 ..... @r_r2 FiTOd 10 ..... 110100 00000 0 1100 1000 ..... @r_r2 FsTOd 10 ..... 110100 00000 0 1100 1001 ..... @r_r2 +FqTOd 10 ..... 110100 00000 0 1100 1011 ..... @r_r2 FsTOi 10 ..... 110100 00000 0 1101 0001 ..... @r_r2 FdTOi 10 ..... 110100 00000 0 1101 0010 ..... @r_r2 FqTOi 10 ..... 110100 00000 0 1101 0011 ..... @r_r2 diff --git a/target/sparc/translate.c b/target/sparc/translate.c index e0d5f01887..6d3b0d6ce1 100644 --- a/target/sparc/translate.c +++ b/target/sparc/translate.c @@ -55,6 +55,7 @@ #define gen_helper_restored ({ qemu_build_not_reached(); NULL; }) #define gen_helper_fdtox ({ qemu_build_not_reached(); NULL; }) #define gen_helper_fstox ({ qemu_build_not_reached(); NULL; }) +#define gen_helper_fqtox ({ qemu_build_not_reached(); NULL; }) #define gen_helper_fxtod ({ qemu_build_not_reached(); NULL; }) #define gen_helper_fxtos ({ qemu_build_not_reached(); NULL; }) #define gen_helper_fnegd(D, S) qemu_build_not_reached() @@ -1668,20 +1669,6 @@ static void gen_ne_fop_QQ(DisasContext *dc, int rd, int rs, } #endif -static void gen_fop_DQ(DisasContext *dc, int rd, int rs, - void (*gen)(TCGv_i64, TCGv_ptr)) -{ - TCGv_i64 dst; - - gen_op_load_fpr_QT1(QFPREG(rs)); - dst = gen_dest_fpr_D(dc, rd); - - gen(dst, tcg_env); - gen_helper_check_ieee_exceptions(cpu_fsr, tcg_env); - - gen_store_fpr_D(dc, rd, dst); -} - static void gen_ne_fop_QF(DisasContext *dc, int rd, int rs, void (*gen)(TCGv_ptr, TCGv_i32)) { @@ -4953,6 +4940,30 @@ static bool do_env_fq(DisasContext *dc, arg_r_r *a, TRANS(FqTOs, ALL, do_env_fq, a, gen_helper_fqtos) TRANS(FqTOi, ALL, do_env_fq, a, gen_helper_fqtoi) +static bool do_env_dq(DisasContext *dc, arg_r_r *a, + void (*func)(TCGv_i64, TCGv_env)) +{ + TCGv_i64 dst; + + if (gen_trap_ifnofpu(dc)) { + return true; + } + if (gen_trap_float128(dc)) { + return true; + } + + gen_op_clear_ieee_excp_and_FTT(); + gen_op_load_fpr_QT1(QFPREG(a->rs)); + dst = gen_dest_fpr_D(dc, a->rd); + func(dst, tcg_env); + gen_helper_check_ieee_exceptions(cpu_fsr, tcg_env); + gen_store_fpr_D(dc, a->rd, dst); + return advance_pc(dc); +} + +TRANS(FqTOd, ALL, do_env_dq, a, gen_helper_fqtod) +TRANS(FqTOx, 64, do_env_dq, a, gen_helper_fqtox) + static bool do_fff(DisasContext *dc, arg_r_r_r *a, void (*func)(TCGv_i32, TCGv_i32, TCGv_i32)) { @@ -5236,11 +5247,9 @@ static void disas_sparc_legacy(DisasContext *dc, unsigned int insn) case 0x81: /* V9 fstox */ case 0xc7: /* fqtos */ case 0xd3: /* fqtoi */ - g_assert_not_reached(); /* in decodetree */ case 0xcb: /* fqtod */ - CHECK_FPU_FEATURE(dc, FLOAT128); - gen_fop_DQ(dc, rd, rs2, gen_helper_fqtod); - break; + case 0x83: /* V9 fqtox */ + g_assert_not_reached(); /* in decodetree */ case 0xcc: /* fitoq */ CHECK_FPU_FEATURE(dc, FLOAT128); gen_ne_fop_QF(dc, rd, rs2, gen_helper_fitoq); @@ -5266,10 +5275,6 @@ static void disas_sparc_legacy(DisasContext *dc, unsigned int insn) CHECK_FPU_FEATURE(dc, FLOAT128); gen_ne_fop_QQ(dc, rd, rs2, gen_helper_fabsq); break; - case 0x83: /* V9 fqtox */ - CHECK_FPU_FEATURE(dc, FLOAT128); - gen_fop_DQ(dc, rd, rs2, gen_helper_fqtox); - break; case 0x8c: /* V9 fxtoq */ CHECK_FPU_FEATURE(dc, FLOAT128); gen_ne_fop_QD(dc, rd, rs2, gen_helper_fxtoq); From patchwork Sun Oct 22 06:00:23 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 736987 Delivered-To: patch@linaro.org Received: by 2002:adf:dd81:0:b0:32d:baff:b0ca with SMTP id x1csp1006162wrl; Sat, 21 Oct 2023 23:14:04 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHCOk/hq4v4I0o1n9QcTYGK5LgIWpgIWVY/6xPfcFV6yv+pvzq0ecMvqaYsmnrISQfCZsOt X-Received: by 2002:a05:6214:5004:b0:66d:9d4d:683 with SMTP id jo4-20020a056214500400b0066d9d4d0683mr6296268qvb.57.1697955244727; Sat, 21 Oct 2023 23:14:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697955244; cv=none; d=google.com; s=arc-20160816; b=p4SKJqdjRqDDOa2mjSOzgXKUMDgLr0RrSWTW2V2s69a1De1IRlyr8BPhVwvFJIX9hs 0U1WdUs3KEofgUR0Izjx/kMg2gMGkak/tv+8/9g7TSwHVKuhAP/D6mv3zWn4+HmNmrYw BMYvGpPXdJC+RUgIzfIQ1DSRfk9OI9kfNRzn9q+TRchFcVJmrrnvEbmeglKK6CsyNsjH v+ya3/TEj/vgjLQQprE5j0GWNwwEuxUJQ2KYWK3RPcsR2opaaBaZaCF0DEDwK2Itt1UY 4AUC7GnUmTBNUxgyz6vS1vrB3N77HR/ACxyX0lvTDLEtM3wniGN3BrAAzKDov7osfTH4 2BhA== 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=YZ9hakJU/7XWFxuxhG16/RDYerrbRSu2CkoxO0pU4Vo=; fh=TYrED6TOMxGX0VC4GtjviASLbYyJe19+7/tKWjN44KQ=; b=i6GxsVPk0ALOwPQ0oV3J5YagF+XPJB3AtWZEVefRQokCYwbtR5P7z0Ak1NNBoJVwvT r8PTP1C0J8JHkU7bf7sJlznM8KXph0G+ilA76p8BwdwKab0a2+EvyzOUHkrWCMlhrJKS dQyvKKN8/fGtQ5TVsKUKrSzpu+XHU5Bq1e9ZjZqwbweyljIYES4kUkhryekrY1dEcP2l spBP4wHrUZqSOgu7afMYV7Ylb9Asm0wbOAXDMKGJNUbqGFcDH+8OOLvXaUx2Tjokc3wj r/JJJwbdGMrIPMVUPqsmODsNhckuBrZhQVEjjPV3lC3lNnMHgOsef6CS0eHOHFDuk2yW Cd2w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=LPGwujlc; 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 m7-20020a05620a290700b00779d17610absi443713qkp.608.2023.10.21.23.14.04 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sat, 21 Oct 2023 23:14:04 -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=LPGwujlc; 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 1quRdR-0006On-OP; Sun, 22 Oct 2023 02:08: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 1quRdP-0006Gk-J4 for qemu-devel@nongnu.org; Sun, 22 Oct 2023 02:08:23 -0400 Received: from mail-pf1-x432.google.com ([2607:f8b0:4864:20::432]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1quRdF-00035q-IU for qemu-devel@nongnu.org; Sun, 22 Oct 2023 02:08:23 -0400 Received: by mail-pf1-x432.google.com with SMTP id d2e1a72fcca58-6b201a93c9cso1611589b3a.0 for ; Sat, 21 Oct 2023 23:08:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1697954891; x=1698559691; 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=YZ9hakJU/7XWFxuxhG16/RDYerrbRSu2CkoxO0pU4Vo=; b=LPGwujlc3cJxLYEPAV8h4D4rYH1UgJm2/rlmAb6e/CNXuI0txEQO+Z9AVjTQgUa/I+ 9VU8yRhBWm/In/JbaXGyKQ/AwVU2uy5y3p0UMmtDDjdP4/G59ElIYz0GNMUHsUmBUjuo vNF/dfHzeh0+mz0ZBYvvGF/HYkNn9BYc9l1fUXTpHZOhCjM9gabbgVmAYkCPXBQYNtr7 PVmD9ZxcM9mkP56SH3ulwnavsP6K/N39rb7zjb/pUYOBrt7q4SZrMSB/hM4HPwARR3kk F9U0h2w63AqVxK/9ZyniYSoI1AMC7HMCiQ2fZbXMOLludXMPs/DVvOT/xMVY1HitgqSJ wPMw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697954891; x=1698559691; 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=YZ9hakJU/7XWFxuxhG16/RDYerrbRSu2CkoxO0pU4Vo=; b=BJK+AseSKDa5Vl64GBUrzq4/coD1zs0upl9VnEj6QI9nNH78oFnMff2CUajbwbo6hG oTswppAUet+J8zVa2r84SFDw5PiiafQ6Sf4jGDLY0uiM8yuccoc6os/RiY58zOWRsp/t 6Grj5Ly+oRODCBQZU+ZP4rpmbdthKtn9Pk28N8wOep3x3NvBjIvcMEw/hLy3alOVdnqs iFWgXspyA318R07QA0rILXyIR8R95Ue4NaYnGWn18mXFHubVzZqzRmLWB3eQ8Zd8fetp D19ZE4IephYelUWnIgj34B//NDqfTVnT4KDnR3NPAqf51GO2REZuyGBWyky4/rVuzVbA 5CPw== X-Gm-Message-State: AOJu0YxN8iqdCHbhn3yaY3itA1vzH/7XNWxuCP8CfNLgh/l9eitoCbFv NDKD0S1048IU7m06+B9Ty0epqET5R/zzFHWIA+Q= X-Received: by 2002:a05:6a21:a5aa:b0:174:af85:9626 with SMTP id gd42-20020a056a21a5aa00b00174af859626mr4791228pzc.11.1697954891260; Sat, 21 Oct 2023 23:08:11 -0700 (PDT) Received: from stoup.. ([71.212.149.95]) by smtp.gmail.com with ESMTPSA id li11-20020a170903294b00b001c444106bcasm3962919plb.46.2023.10.21.23.08.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 21 Oct 2023 23:08:10 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: mark.cave-ayland@ilande.co.uk Subject: [PATCH v4 82/90] target/sparc: Move FiTOq, FsTOq to decodetree Date: Sat, 21 Oct 2023 23:00:23 -0700 Message-Id: <20231022060031.490251-83-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231022060031.490251-1-richard.henderson@linaro.org> References: <20231022060031.490251-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::432; envelope-from=richard.henderson@linaro.org; helo=mail-pf1-x432.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 | 2 ++ target/sparc/translate.c | 44 +++++++++++++++++++++------------------ 2 files changed, 26 insertions(+), 20 deletions(-) diff --git a/target/sparc/insns.decode b/target/sparc/insns.decode index 7b65b31f89..c76e603f2d 100644 --- a/target/sparc/insns.decode +++ b/target/sparc/insns.decode @@ -273,6 +273,8 @@ FqTOs 10 ..... 110100 00000 0 1100 0111 ..... @r_r2 FiTOd 10 ..... 110100 00000 0 1100 1000 ..... @r_r2 FsTOd 10 ..... 110100 00000 0 1100 1001 ..... @r_r2 FqTOd 10 ..... 110100 00000 0 1100 1011 ..... @r_r2 +FiTOq 10 ..... 110100 00000 0 1100 1100 ..... @r_r2 +FsTOq 10 ..... 110100 00000 0 1100 1101 ..... @r_r2 FsTOi 10 ..... 110100 00000 0 1101 0001 ..... @r_r2 FdTOi 10 ..... 110100 00000 0 1101 0010 ..... @r_r2 FqTOi 10 ..... 110100 00000 0 1101 0011 ..... @r_r2 diff --git a/target/sparc/translate.c b/target/sparc/translate.c index 6d3b0d6ce1..f2b7fec72a 100644 --- a/target/sparc/translate.c +++ b/target/sparc/translate.c @@ -1669,19 +1669,6 @@ static void gen_ne_fop_QQ(DisasContext *dc, int rd, int rs, } #endif -static void gen_ne_fop_QF(DisasContext *dc, int rd, int rs, - void (*gen)(TCGv_ptr, TCGv_i32)) -{ - TCGv_i32 src; - - src = gen_load_fpr_F(dc, rs); - - gen(tcg_env, src); - - gen_op_store_QT0_fpr(QFPREG(rd)); - gen_update_fprs_dirty(dc, QFPREG(rd)); -} - static void gen_ne_fop_QD(DisasContext *dc, int rd, int rs, void (*gen)(TCGv_ptr, TCGv_i64)) { @@ -4964,6 +4951,29 @@ static bool do_env_dq(DisasContext *dc, arg_r_r *a, TRANS(FqTOd, ALL, do_env_dq, a, gen_helper_fqtod) TRANS(FqTOx, 64, do_env_dq, a, gen_helper_fqtox) +static bool do_env_qf(DisasContext *dc, arg_r_r *a, + void (*func)(TCGv_env, TCGv_i32)) +{ + TCGv_i32 src; + + if (gen_trap_ifnofpu(dc)) { + return true; + } + if (gen_trap_float128(dc)) { + return true; + } + + gen_op_clear_ieee_excp_and_FTT(); + src = gen_load_fpr_F(dc, a->rs); + func(tcg_env, src); + gen_op_store_QT0_fpr(QFPREG(a->rd)); + gen_update_fprs_dirty(dc, QFPREG(a->rd)); + return advance_pc(dc); +} + +TRANS(FiTOq, ALL, do_env_qf, a, gen_helper_fitoq) +TRANS(FsTOq, ALL, do_env_qf, a, gen_helper_fstoq) + static bool do_fff(DisasContext *dc, arg_r_r_r *a, void (*func)(TCGv_i32, TCGv_i32, TCGv_i32)) { @@ -5249,15 +5259,9 @@ static void disas_sparc_legacy(DisasContext *dc, unsigned int insn) case 0xd3: /* fqtoi */ case 0xcb: /* fqtod */ case 0x83: /* V9 fqtox */ - g_assert_not_reached(); /* in decodetree */ case 0xcc: /* fitoq */ - CHECK_FPU_FEATURE(dc, FLOAT128); - gen_ne_fop_QF(dc, rd, rs2, gen_helper_fitoq); - break; case 0xcd: /* fstoq */ - CHECK_FPU_FEATURE(dc, FLOAT128); - gen_ne_fop_QF(dc, rd, rs2, gen_helper_fstoq); - break; + g_assert_not_reached(); /* in decodetree */ case 0xce: /* fdtoq */ CHECK_FPU_FEATURE(dc, FLOAT128); gen_ne_fop_QD(dc, rd, rs2, gen_helper_fdtoq); From patchwork Sun Oct 22 06:00:24 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 736977 Delivered-To: patch@linaro.org Received: by 2002:adf:dd81:0:b0:32d:baff:b0ca with SMTP id x1csp1006052wrl; Sat, 21 Oct 2023 23:13:36 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFIFOYtSjKttbK+6Cl7+6R5t7DpXamZYhenB18h5YW59be4cNzFU+VyGt618vla0P8fSJ8n X-Received: by 2002:ad4:5b8b:0:b0:66d:4df1:cb0b with SMTP id 11-20020ad45b8b000000b0066d4df1cb0bmr7393549qvp.50.1697955215973; Sat, 21 Oct 2023 23:13:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697955215; cv=none; d=google.com; s=arc-20160816; b=ONXW0ItC9aL77HC4MMgHCkoQMSjo4KHkwu2OkRWT6Kiqpmqb0GnoI+Wp3K+C46jMjl coxlGRL+vneclYzAnqZ1kHolgtTdcXiaDyUGPpH1ks7JG2JbRmKYZ++DllojKEqDT+6w NX62ibhS1SCOwtREYulB9aYU1E063W8v2o12FIpb3NWRryYsNvluG8Yw4xq5SAxCVbgT aLq1Lf8tVKntX7/Em2Kkn4Az2nXM6LItiPjf40etwi+8xxsnRZWXoNOMP424JNjuh3i4 fW1aI4xFm7cj/d+xi0c80hRAnXlb/cgzP77wLrtSZFyON+IFVK4d43Rg3zrwZCQVuZM6 DpyA== 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=jdlq9ySgTJbA8I7iN++KlU5WoLHtRW8xODa9W7sCPyQ=; fh=TYrED6TOMxGX0VC4GtjviASLbYyJe19+7/tKWjN44KQ=; b=bb2QZE/Rw+5Vyf3N+T+kDMUHm0OtkzJUnmDql7yzz4GO62vULYkAwG/8MwIbUEPc9I CLMF2X2Jx9z5kN3ru53HFJS810T9FL5afMo4a/46cLx1jB7MyJoh23jISMAAumseG0Mu l33PYyV8Hyy3HwafNIqNlRLg7jtvAHD43T44ORQFH7kYYXb2EB0aEESxeyX6mMroWXZR Mcx+Va7xJSAomMBRrT9ZIcopXrHk0waQha8SeTimFfnxglc+v41voFeA1ZAObstL7+Fp n2jLXNol3lBhJBzzq6aYCB2qoNpwHczdWrsGyMHgbvAtSIWmg79Dw9W2PRFJ1cfK30PG 4KKA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=RZrwcbjW; 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 q3-20020a05620a038300b0076d763ffd49si3613241qkm.66.2023.10.21.23.13.35 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sat, 21 Oct 2023 23:13:35 -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=RZrwcbjW; 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 1quRdS-0006PY-1k; Sun, 22 Oct 2023 02:08:26 -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 1quRdP-0006Hb-QP for qemu-devel@nongnu.org; Sun, 22 Oct 2023 02:08:23 -0400 Received: from mail-pl1-x632.google.com ([2607:f8b0:4864:20::632]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1quRdH-00035x-IR for qemu-devel@nongnu.org; Sun, 22 Oct 2023 02:08:23 -0400 Received: by mail-pl1-x632.google.com with SMTP id d9443c01a7336-1ca82f015e4so12920155ad.1 for ; Sat, 21 Oct 2023 23:08:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1697954892; x=1698559692; 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=jdlq9ySgTJbA8I7iN++KlU5WoLHtRW8xODa9W7sCPyQ=; b=RZrwcbjWWlqgnUn8Qv9wXjeMWo3T/zcO3gbcle4L93o+Yp2fdgA5x1YVmlLAawd5fu 7ov5rWAsCvxwrNC8wqIMwelz7eAZA0ns8cqWCwoezyCqFRFYuBZ25aGNQNRttXCAuibJ fUD9lAaSEQhlFqnjrpRNDA+1iytKiQn1MkE1opGeOoTgBxHtLB8DjqgKfu2A7+o3sE94 Wp4hFjsJuQNLbLS4cmW4DeHSuuTC8c2dYj0UMivD9dM1REX2LAdR+5uYcy5rH+06l7hk e1aDxw2IGToIlwK4BhfJnClzRYngBeJHVyYUIs9NCXkt3oUP8ivBXL27VI/mpAU+44fy uj7g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697954892; x=1698559692; 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=jdlq9ySgTJbA8I7iN++KlU5WoLHtRW8xODa9W7sCPyQ=; b=JBv9IbBeah/FJfxDfUx7iXlqyMLJpDWZ9178z+hcdm6sgwHv/oZFEnxYcmg377rDlT p48AOhK6/q8qzFZeULDRDY+2VB7JUahiaDyiidKLNRKjzOXsdz+br3qXSEgquqTgRkK5 Fs6KpeIByZRUaiJRRia1P1vaVvXTDHAs6wXR3hJpUztt0DvW+21awM5WmEyIzVDB9oNz DvD8y2rUzBhUThz8BF+0lGuwTHs9TezuUdE6pDaBUHHt5WT2zHVpTE8iXEAf7f9JIAe+ 4pSQvX3got7aR5hV8o0lfFK2EIAQ0nIr/L5X0EnGsT17/m8Zmde1abeNX4YaG+yjmcq6 EQIw== X-Gm-Message-State: AOJu0Yx3AtpLDzFfXc9Nxa6DA6aiusUENlD62PmLTuKhqo3X0bKS7mYp oOrqpk+8DJ5eh2QXBxtVp6T3wYEAU2DahxcP37I= X-Received: by 2002:a17:903:2301:b0:1ca:811e:dcf7 with SMTP id d1-20020a170903230100b001ca811edcf7mr5104033plh.31.1697954892099; Sat, 21 Oct 2023 23:08:12 -0700 (PDT) Received: from stoup.. ([71.212.149.95]) by smtp.gmail.com with ESMTPSA id li11-20020a170903294b00b001c444106bcasm3962919plb.46.2023.10.21.23.08.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 21 Oct 2023 23:08:11 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: mark.cave-ayland@ilande.co.uk Subject: [PATCH v4 83/90] target/sparc: Move FdTOq, FxTOq to decodetree Date: Sat, 21 Oct 2023 23:00:24 -0700 Message-Id: <20231022060031.490251-84-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231022060031.490251-1-richard.henderson@linaro.org> References: <20231022060031.490251-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::632; envelope-from=richard.henderson@linaro.org; helo=mail-pl1-x632.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 | 2 ++ target/sparc/translate.c | 47 ++++++++++++++++++++++----------------- 2 files changed, 28 insertions(+), 21 deletions(-) diff --git a/target/sparc/insns.decode b/target/sparc/insns.decode index c76e603f2d..e1f5394d17 100644 --- a/target/sparc/insns.decode +++ b/target/sparc/insns.decode @@ -267,6 +267,7 @@ FdTOx 10 ..... 110100 00000 0 1000 0010 ..... @r_r2 FqTOx 10 ..... 110100 00000 0 1000 0011 ..... @r_r2 FxTOs 10 ..... 110100 00000 0 1000 0100 ..... @r_r2 FxTOd 10 ..... 110100 00000 0 1000 1000 ..... @r_r2 +FxTOq 10 ..... 110100 00000 0 1000 1100 ..... @r_r2 FiTOs 10 ..... 110100 00000 0 1100 0100 ..... @r_r2 FdTOs 10 ..... 110100 00000 0 1100 0110 ..... @r_r2 FqTOs 10 ..... 110100 00000 0 1100 0111 ..... @r_r2 @@ -275,6 +276,7 @@ FsTOd 10 ..... 110100 00000 0 1100 1001 ..... @r_r2 FqTOd 10 ..... 110100 00000 0 1100 1011 ..... @r_r2 FiTOq 10 ..... 110100 00000 0 1100 1100 ..... @r_r2 FsTOq 10 ..... 110100 00000 0 1100 1101 ..... @r_r2 +FdTOq 10 ..... 110100 00000 0 1100 1110 ..... @r_r2 FsTOi 10 ..... 110100 00000 0 1101 0001 ..... @r_r2 FdTOi 10 ..... 110100 00000 0 1101 0010 ..... @r_r2 FqTOi 10 ..... 110100 00000 0 1101 0011 ..... @r_r2 diff --git a/target/sparc/translate.c b/target/sparc/translate.c index f2b7fec72a..9c03252985 100644 --- a/target/sparc/translate.c +++ b/target/sparc/translate.c @@ -58,6 +58,7 @@ #define gen_helper_fqtox ({ qemu_build_not_reached(); NULL; }) #define gen_helper_fxtod ({ qemu_build_not_reached(); NULL; }) #define gen_helper_fxtos ({ qemu_build_not_reached(); NULL; }) +#define gen_helper_fxtoq ({ qemu_build_not_reached(); NULL; }) #define gen_helper_fnegd(D, S) qemu_build_not_reached() #define gen_helper_fabsd(D, S) qemu_build_not_reached() #define gen_helper_done(E) qemu_build_not_reached() @@ -1669,19 +1670,6 @@ static void gen_ne_fop_QQ(DisasContext *dc, int rd, int rs, } #endif -static void gen_ne_fop_QD(DisasContext *dc, int rd, int rs, - void (*gen)(TCGv_ptr, TCGv_i64)) -{ - TCGv_i64 src; - - src = gen_load_fpr_D(dc, rs); - - gen(tcg_env, src); - - gen_op_store_QT0_fpr(QFPREG(rd)); - gen_update_fprs_dirty(dc, QFPREG(rd)); -} - /* asi moves */ typedef enum { GET_ASI_HELPER, @@ -4974,6 +4962,29 @@ static bool do_env_qf(DisasContext *dc, arg_r_r *a, TRANS(FiTOq, ALL, do_env_qf, a, gen_helper_fitoq) TRANS(FsTOq, ALL, do_env_qf, a, gen_helper_fstoq) +static bool do_env_qd(DisasContext *dc, arg_r_r *a, + void (*func)(TCGv_env, TCGv_i64)) +{ + TCGv_i64 src; + + if (gen_trap_ifnofpu(dc)) { + return true; + } + if (gen_trap_float128(dc)) { + return true; + } + + gen_op_clear_ieee_excp_and_FTT(); + src = gen_load_fpr_D(dc, a->rs); + func(tcg_env, src); + gen_op_store_QT0_fpr(QFPREG(a->rd)); + gen_update_fprs_dirty(dc, QFPREG(a->rd)); + return advance_pc(dc); +} + +TRANS(FdTOq, ALL, do_env_qd, a, gen_helper_fdtoq) +TRANS(FxTOq, 64, do_env_qd, a, gen_helper_fxtoq) + static bool do_fff(DisasContext *dc, arg_r_r_r *a, void (*func)(TCGv_i32, TCGv_i32, TCGv_i32)) { @@ -5261,11 +5272,9 @@ static void disas_sparc_legacy(DisasContext *dc, unsigned int insn) case 0x83: /* V9 fqtox */ case 0xcc: /* fitoq */ case 0xcd: /* fstoq */ - g_assert_not_reached(); /* in decodetree */ case 0xce: /* fdtoq */ - CHECK_FPU_FEATURE(dc, FLOAT128); - gen_ne_fop_QD(dc, rd, rs2, gen_helper_fdtoq); - break; + case 0x8c: /* V9 fxtoq */ + g_assert_not_reached(); /* in decodetree */ #ifdef TARGET_SPARC64 case 0x3: /* V9 fmovq */ CHECK_FPU_FEATURE(dc, FLOAT128); @@ -5279,10 +5288,6 @@ static void disas_sparc_legacy(DisasContext *dc, unsigned int insn) CHECK_FPU_FEATURE(dc, FLOAT128); gen_ne_fop_QQ(dc, rd, rs2, gen_helper_fabsq); break; - case 0x8c: /* V9 fxtoq */ - CHECK_FPU_FEATURE(dc, FLOAT128); - gen_ne_fop_QD(dc, rd, rs2, gen_helper_fxtoq); - break; #endif default: goto illegal_insn; From patchwork Sun Oct 22 06:00:25 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 736979 Delivered-To: patch@linaro.org Received: by 2002:adf:dd81:0:b0:32d:baff:b0ca with SMTP id x1csp1006098wrl; Sat, 21 Oct 2023 23:13:47 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEggMX0quDBAXSuc3Z7ChU5VxzwOeqJboaurDGobZgOZxqiYUDwk9qxdFyrXRlZ6pAReQU7 X-Received: by 2002:a0c:d60c:0:b0:66d:953e:226d with SMTP id c12-20020a0cd60c000000b0066d953e226dmr7971937qvj.26.1697955227496; Sat, 21 Oct 2023 23:13:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697955227; cv=none; d=google.com; s=arc-20160816; b=rM4HUZdHIHz+OxpTG8oHfH14IClyaHX0ivOyPD0aY7Y8yN3AuCoaL5vDBHeIhXnLiQ 3sH+z5YtnXdRTuxNb+2WZDiucRZSzZl0TSXBDTM0dBB7ckNb1IC/LtPsYeI5+gnSl9i0 cz+GkJe7PC/U6lTcGo0UyxYS0fgZtQa7HSsXD0Bn3nyBAQtol0bp6DgYzFZLXRYkMcyg ABbgvTLl5MwpaTVbx9xVIHePs32VKiRLS42QicBKWgeUdJtS9269kklnwYN3RIkHyPtC UEkp0WIVSxOq6/rIm+v1A7ZFlPgAwTUZXf/pixc07jBq0S3DZmjONCtq85OMRioRn63y HGWw== 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=SLUQq6yH6eotNO197OBhBhzGOOD5wcukbMsP1cfI+xY=; fh=TYrED6TOMxGX0VC4GtjviASLbYyJe19+7/tKWjN44KQ=; b=PUXwfx/jWr9wkQJMA9/UCvXtq7BL1JcyFmNcqd8051tAXWh7796I5OjRVG3QytIcjU NmskjVKqzWIIWOzKF9WUZSuHD8xcLvJTtEvxeAoy6P1dqu41SbMaug+jIwI/KS7yYz1c OxkRAAty7iPvgcUHZeuFE/N2EGT+sKurYLysNJPVPaeEVbCQpQyxQwHl74CS8RVWJGam 25jefuwnVKdvF3iVGtKPFoILaeQFnhmg64U2Kx5bO5rYrX1Zr149m9JhX0WWkr8GenU1 7f0M5LkevNfMckDNOoSUK+BP0qfNR2vx/QVxk6mJg9KAYgZBjJMQR/y3RC6F+6Kkv+5q DiKA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=XL7HYFlP; 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 es6-20020a056214192600b0065af74b868dsi3698853qvb.381.2023.10.21.23.13.47 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sat, 21 Oct 2023 23:13:47 -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=XL7HYFlP; 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 1quRdb-0007Re-7W; Sun, 22 Oct 2023 02:08:35 -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 1quRdS-0006SI-Fo for qemu-devel@nongnu.org; Sun, 22 Oct 2023 02:08:26 -0400 Received: from mail-pg1-x529.google.com ([2607:f8b0:4864:20::529]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1quRdN-00036B-71 for qemu-devel@nongnu.org; Sun, 22 Oct 2023 02:08:26 -0400 Received: by mail-pg1-x529.google.com with SMTP id 41be03b00d2f7-5b837dc2855so1498083a12.0 for ; Sat, 21 Oct 2023 23:08:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1697954893; x=1698559693; 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=SLUQq6yH6eotNO197OBhBhzGOOD5wcukbMsP1cfI+xY=; b=XL7HYFlPp19aJxLYBGlULDFsN6cuPtIxrfWQblLlUc1XzLjCpAOCjn3qW1nTyDygmW WOMU3Krx699WiPhwM4B8W4vIYSjRfiHWmKDO3l1Wo5fVswOfXaZnawLqxti9Ss4NYjUW vvEotlwdueFQsxeFr3XsBZGhw/ES/SzuG4WD5ZzRGHs0U3Mos9Hof71FeNREAteSLMMH /sTIXTUsqVtgj6ik55tkjOfrPYrZ4HkaOQ3sbs2l8UffT8MnyG3gvMVBgK+DOuU+L/TG NGPSbRFAZVlw/mXoqbPhL2pmYJUADrc7jm2UFOenTRytWbrcIpydIbe/61YHwRtElcLo mCXQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697954893; x=1698559693; 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=SLUQq6yH6eotNO197OBhBhzGOOD5wcukbMsP1cfI+xY=; b=cEmLa6JJoJgNjFrvSiquyO9BRqmqHtBDWAmOMECDpVgHfiiNXKlk2phfdHQ3gUvfjV 93Kk1YDaebA2ORrNmcjZWSIm9w8HV+9dBIr21SsoMxK3zTO0Vx+yoZ6yrPjLXKXfXZpn tlGhFoIyO2B7A4in8+0/rVNbdPlHHQBdKcTqg0ZntG0KkizZJQTjIImY/keBzj8HHpYt K4ySD8JCYjIP5g1W5zjCxXXO2EYoWpa9oHOWIe6HhZIGv3VueaIvDzWcplyS2BpiX9dU BeUg/pc/HBYvbAW0PLbamWXItEFkyUoXz2WL253bo+UXOAneeO8Z3q6kd03vUy2r2avK 8ppw== X-Gm-Message-State: AOJu0Yzf9fB/M6V4maDQUZ3r5rjftIB080aMothzE7gi+X+st/may7DS xJHEieljFI1CcNQqWYygXyBi/KO7RjAVhQM/ZQE= X-Received: by 2002:a17:902:f542:b0:1bf:193a:70b6 with SMTP id h2-20020a170902f54200b001bf193a70b6mr7676022plf.5.1697954892909; Sat, 21 Oct 2023 23:08:12 -0700 (PDT) Received: from stoup.. ([71.212.149.95]) by smtp.gmail.com with ESMTPSA id li11-20020a170903294b00b001c444106bcasm3962919plb.46.2023.10.21.23.08.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 21 Oct 2023 23:08:12 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: mark.cave-ayland@ilande.co.uk Subject: [PATCH v4 84/90] target/sparc: Move FMOVq, FNEGq, FABSq to decodetree Date: Sat, 21 Oct 2023 23:00:25 -0700 Message-Id: <20231022060031.490251-85-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231022060031.490251-1-richard.henderson@linaro.org> References: <20231022060031.490251-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::529; envelope-from=richard.henderson@linaro.org; helo=mail-pg1-x529.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 | 3 + target/sparc/translate.c | 140 +++++++++++++------------------------- 2 files changed, 50 insertions(+), 93 deletions(-) diff --git a/target/sparc/insns.decode b/target/sparc/insns.decode index e1f5394d17..807ed3f66f 100644 --- a/target/sparc/insns.decode +++ b/target/sparc/insns.decode @@ -241,10 +241,13 @@ RETRY 10 00001 111110 00000 0 0000000000000 FMOVs 10 ..... 110100 00000 0 0000 0001 ..... @r_r2 FMOVd 10 ..... 110100 00000 0 0000 0010 ..... @r_r2 +FMOVq 10 ..... 110100 00000 0 0000 0011 ..... @r_r2 FNEGs 10 ..... 110100 00000 0 0000 0101 ..... @r_r2 FNEGd 10 ..... 110100 00000 0 0000 0110 ..... @r_r2 +FNEGq 10 ..... 110100 00000 0 0000 0111 ..... @r_r2 FABSs 10 ..... 110100 00000 0 0000 1001 ..... @r_r2 FABSd 10 ..... 110100 00000 0 0000 1010 ..... @r_r2 +FABSq 10 ..... 110100 00000 0 0000 1011 ..... @r_r2 FSQRTs 10 ..... 110100 00000 0 0010 1001 ..... @r_r2 FSQRTd 10 ..... 110100 00000 0 0010 1010 ..... @r_r2 FSQRTq 10 ..... 110100 00000 0 0010 1011 ..... @r_r2 diff --git a/target/sparc/translate.c b/target/sparc/translate.c index 9c03252985..0fc888df8c 100644 --- a/target/sparc/translate.c +++ b/target/sparc/translate.c @@ -59,6 +59,8 @@ #define gen_helper_fxtod ({ qemu_build_not_reached(); NULL; }) #define gen_helper_fxtos ({ qemu_build_not_reached(); NULL; }) #define gen_helper_fxtoq ({ qemu_build_not_reached(); NULL; }) +#define gen_helper_fabsq ({ qemu_build_not_reached(); NULL; }) +#define gen_helper_fnegq ({ qemu_build_not_reached(); NULL; }) #define gen_helper_fnegd(D, S) qemu_build_not_reached() #define gen_helper_fabsd(D, S) qemu_build_not_reached() #define gen_helper_done(E) qemu_build_not_reached() @@ -271,18 +273,6 @@ static void gen_op_store_QT0_fpr(unsigned int dst) offsetof(CPU_QuadU, ll.lower)); } -#ifdef TARGET_SPARC64 -static void gen_move_Q(DisasContext *dc, unsigned int rd, unsigned int rs) -{ - rd = QFPREG(rd); - rs = QFPREG(rs); - - tcg_gen_mov_i64(cpu_fpr[rd / 2], cpu_fpr[rs / 2]); - tcg_gen_mov_i64(cpu_fpr[rd / 2 + 1], cpu_fpr[rs / 2 + 1]); - gen_update_fprs_dirty(dc, rd); -} -#endif - /* moves */ #ifdef CONFIG_USER_ONLY #define supervisor(dc) 0 @@ -1657,19 +1647,6 @@ static int gen_trap_ifnofpu(DisasContext *dc) return 0; } -#ifdef TARGET_SPARC64 -static void gen_ne_fop_QQ(DisasContext *dc, int rd, int rs, - void (*gen)(TCGv_ptr)) -{ - gen_op_load_fpr_QT1(QFPREG(rs)); - - gen(tcg_env); - - gen_op_store_QT0_fpr(QFPREG(rd)); - gen_update_fprs_dirty(dc, QFPREG(rd)); -} -#endif - /* asi moves */ typedef enum { GET_ASI_HELPER, @@ -4870,6 +4847,50 @@ TRANS(FiTOd, ALL, do_env_df, a, gen_helper_fitod) TRANS(FsTOd, ALL, do_env_df, a, gen_helper_fstod) TRANS(FsTOx, 64, do_env_df, a, gen_helper_fstox) +static bool trans_FMOVq(DisasContext *dc, arg_FMOVq *a) +{ + int rd, rs; + + if (!avail_64(dc)) { + return false; + } + if (gen_trap_ifnofpu(dc)) { + return true; + } + if (gen_trap_float128(dc)) { + return true; + } + + gen_op_clear_ieee_excp_and_FTT(); + rd = QFPREG(a->rd); + rs = QFPREG(a->rs); + tcg_gen_mov_i64(cpu_fpr[rd / 2], cpu_fpr[rs / 2]); + tcg_gen_mov_i64(cpu_fpr[rd / 2 + 1], cpu_fpr[rs / 2 + 1]); + gen_update_fprs_dirty(dc, rd); + return advance_pc(dc); +} + +static bool do_qq(DisasContext *dc, arg_r_r *a, + void (*func)(TCGv_env)) +{ + if (gen_trap_ifnofpu(dc)) { + return true; + } + if (gen_trap_float128(dc)) { + return true; + } + + gen_op_clear_ieee_excp_and_FTT(); + gen_op_load_fpr_QT1(QFPREG(a->rs)); + func(tcg_env); + gen_op_store_QT0_fpr(QFPREG(a->rd)); + gen_update_fprs_dirty(dc, QFPREG(a->rd)); + return advance_pc(dc); +} + +TRANS(FNEGq, 64, do_qq, a, gen_helper_fnegq) +TRANS(FABSq, 64, do_qq, a, gen_helper_fabsq) + static bool do_env_qq(DisasContext *dc, arg_r_r *a, void (*func)(TCGv_env)) { @@ -5224,74 +5245,7 @@ static void disas_sparc_legacy(DisasContext *dc, unsigned int insn) TCGv cpu_dst __attribute__((unused)) = tcg_temp_new(); if (xop == 0x34) { /* FPU Operations */ - if (gen_trap_ifnofpu(dc)) { - goto jmp_insn; - } - gen_op_clear_ieee_excp_and_FTT(); - rs1 = GET_FIELD(insn, 13, 17); - rs2 = GET_FIELD(insn, 27, 31); - xop = GET_FIELD(insn, 18, 26); - - switch (xop) { - case 0x1: /* fmovs */ - case 0x5: /* fnegs */ - case 0x9: /* fabss */ - case 0x2: /* V9 fmovd */ - case 0x6: /* V9 fnegd */ - case 0xa: /* V9 fabsd */ - case 0x29: /* fsqrts */ - case 0xc4: /* fitos */ - case 0xd1: /* fstoi */ - case 0x2a: /* fsqrtd */ - case 0x82: /* V9 fdtox */ - case 0x88: /* V9 fxtod */ - case 0x2b: /* fsqrtq */ - case 0x41: /* fadds */ - case 0x45: /* fsubs */ - case 0x49: /* fmuls */ - case 0x4d: /* fdivs */ - case 0x42: /* faddd */ - case 0x46: /* fsubd */ - case 0x4a: /* fmuld */ - case 0x4e: /* fdivd */ - case 0x43: /* faddq */ - case 0x47: /* fsubq */ - case 0x4b: /* fmulq */ - case 0x4f: /* fdivq */ - case 0x69: /* fsmuld */ - case 0x6e: /* fdmulq */ - case 0xc6: /* fdtos */ - case 0xd2: /* fdtoi */ - case 0x84: /* V9 fxtos */ - case 0xc8: /* fitod */ - case 0xc9: /* fstod */ - case 0x81: /* V9 fstox */ - case 0xc7: /* fqtos */ - case 0xd3: /* fqtoi */ - case 0xcb: /* fqtod */ - case 0x83: /* V9 fqtox */ - case 0xcc: /* fitoq */ - case 0xcd: /* fstoq */ - case 0xce: /* fdtoq */ - case 0x8c: /* V9 fxtoq */ - g_assert_not_reached(); /* in decodetree */ -#ifdef TARGET_SPARC64 - case 0x3: /* V9 fmovq */ - CHECK_FPU_FEATURE(dc, FLOAT128); - gen_move_Q(dc, rd, rs2); - break; - case 0x7: /* V9 fnegq */ - CHECK_FPU_FEATURE(dc, FLOAT128); - gen_ne_fop_QQ(dc, rd, rs2, gen_helper_fnegq); - break; - case 0xb: /* V9 fabsq */ - CHECK_FPU_FEATURE(dc, FLOAT128); - gen_ne_fop_QQ(dc, rd, rs2, gen_helper_fabsq); - break; -#endif - default: - goto illegal_insn; - } + goto illegal_insn; /* in decodetree */ } else if (xop == 0x35) { /* FPU Operations */ #ifdef TARGET_SPARC64 int cond; From patchwork Sun Oct 22 06:00:26 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 736967 Delivered-To: patch@linaro.org Received: by 2002:adf:dd81:0:b0:32d:baff:b0ca with SMTP id x1csp1005843wrl; Sat, 21 Oct 2023 23:12:41 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEf9TaxdzCoRpaPM3le40GLCXncqpBRYHLrJDmAH5InBBBS0cq/6D0j46rAuDj++hz1+zwK X-Received: by 2002:a05:620a:4491:b0:767:c30:517 with SMTP id x17-20020a05620a449100b007670c300517mr12103273qkp.3.1697955160868; Sat, 21 Oct 2023 23:12:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697955160; cv=none; d=google.com; s=arc-20160816; b=XDc0Xa+PQe4bYtMKwquhJcfejwDHlJO98WneKO1cyyDjtJN1O0DJgsKEXwP1l2i9P2 /n7IFT6/PWyqwN8js9IvDaoE4aMsE9cDxqsvTOShVz7OZrUBLxs5YTEWhijJbbNAIYzZ JRO7zuYN2oHIhF/1OnI7CjMZTBplKLX+7b6xfW8zPuTmsib7i4onbo3J++xCbQL0p9L8 zqH78Kab4DKusGEwXOZYhOuqB8a/UaQZDLPM74YQqDdwpULPwrPHtQgKZbFQ1TbQ7gCl dI+xV5pyqHsuBzrTVxf2ushO+bfAYnV9iIvdGNGgtgSRuN5R0tVCAR4W6F/Amvhy7v4Z W2uA== 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=jogQ35aRRgI9mzO+SNU5OqjkSwSPVpvLibPLED8oonY=; fh=TYrED6TOMxGX0VC4GtjviASLbYyJe19+7/tKWjN44KQ=; b=PPrMrEi6p1sJ9+SE+mZvVfHjlB1EDKBxiZKVAZdwfF0pykNSfDM7jTxNwdI/7Vp75n PbRokM+scEPR6qcVL73f0quoe3LMqEo6LKqPA0ypuAym9PnLkIJ3mImM0EHWRaQvGr6w NAiEy1ap7z89yBtdKRLX/YBzxlMZIZ8Tal05yj6cI2iAw8HVhgwzqr20E6xgJz3JixH1 o8rESx5d3sTDFFs4HI4bNYQNnvCjgTHhlwOfV7NRWjkSwSFPTvH5ZPEl6rW9O5mlpWQx 6Foe0EA9xSEpyoZ/284iAtkY2RzyUIj5rvX5IhHOd/7M1l1DZSjRvlTRLrm+qVRexm05 PkUA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=YcuCVx+C; 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 u6-20020a05620a120600b007758e56b4a3si3742181qkj.36.2023.10.21.23.12.40 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sat, 21 Oct 2023 23:12:40 -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=YcuCVx+C; 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 1quRdZ-0007HT-Pn; Sun, 22 Oct 2023 02:08:33 -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 1quRdS-0006SJ-FS for qemu-devel@nongnu.org; Sun, 22 Oct 2023 02:08:26 -0400 Received: from mail-pl1-x634.google.com ([2607:f8b0:4864:20::634]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1quRdN-00036H-6t for qemu-devel@nongnu.org; Sun, 22 Oct 2023 02:08:26 -0400 Received: by mail-pl1-x634.google.com with SMTP id d9443c01a7336-1c9e95aa02dso16049265ad.0 for ; Sat, 21 Oct 2023 23:08:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1697954894; x=1698559694; 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=jogQ35aRRgI9mzO+SNU5OqjkSwSPVpvLibPLED8oonY=; b=YcuCVx+CCqhYfllbydzRGx/dKqvnaKjFr040vvCBLZSCLseS1QFuJwxXjjOYBVF2XX hXLNEsfR9KOH8y2ECpzHSEiqgMuORKA5IFq19Av8cUyr38NrT3CmIvfsJUoHwlyf37nK soY/DX4uyssXCW4yj9p7Nj2+LvmlFF7CQYVSqBsT5LIw/OegVZgv82gm8WUShdkoxUvH oUswkHlYXo1N1BJ0FFzcfxKNjds6q3HZ9W1Jjp64tV4SGuxfXtBdKPvzqnDNBblwBNLj Kvb3DxmY1utF2D0frvHSBaYDi4ta7iGUnkmci7YufisQsAG7IwzZO+moequI0HgQCiRH mQdw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697954894; x=1698559694; 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=jogQ35aRRgI9mzO+SNU5OqjkSwSPVpvLibPLED8oonY=; b=OTxthobUu0JwFi+IrBSsy9Ae2C+Fw6fBQA57DkXKOXwIwxYAST5a5VBKHBkkrGVm7A 5SCSdPpDEaqX2H+XYAPKic1nsYrFB0+ozYnu9ns4kh2HMdqnk2erLk997tg86aMsoqKx zA7W8q7E7iYJ53bFG7F1T8pBi7PR8ggg5mLcmtmfFiOIgzPhTJG+qlUQqhww5BNgacZG n9QA3H813vp9xwl4sKS7yOWXbi0+ZeYdfXQO5f0psQc38JejLMk5+KiPnPimFue++AVC K3h6uxLnd78rlmravLE1AwavWOS9qwo9p3myDE8nSVMA0zdQUg0ZOkze9MRM7fEBm3eN aArg== X-Gm-Message-State: AOJu0YwvYec3StCLkk7gK4YjVwiPHEwTdY3zvNPyNiFpmXiU/1mOigs3 xOgPDXSpQ9sXRI/pwBYvmBkfuNTJA5uo3XTWCgg= X-Received: by 2002:a17:902:c949:b0:1c5:7d49:570e with SMTP id i9-20020a170902c94900b001c57d49570emr8879651pla.29.1697954893742; Sat, 21 Oct 2023 23:08:13 -0700 (PDT) Received: from stoup.. ([71.212.149.95]) by smtp.gmail.com with ESMTPSA id li11-20020a170903294b00b001c444106bcasm3962919plb.46.2023.10.21.23.08.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 21 Oct 2023 23:08:13 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: mark.cave-ayland@ilande.co.uk Subject: [PATCH v4 85/90] target/sparc: Move FMOVR, FMOVcc, FMOVfcc to decodetree Date: Sat, 21 Oct 2023 23:00:26 -0700 Message-Id: <20231022060031.490251-86-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231022060031.490251-1-richard.henderson@linaro.org> References: <20231022060031.490251-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::634; envelope-from=richard.henderson@linaro.org; helo=mail-pl1-x634.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 | 12 +++ target/sparc/translate.c | 192 ++++++++++++++++---------------------- 2 files changed, 91 insertions(+), 113 deletions(-) diff --git a/target/sparc/insns.decode b/target/sparc/insns.decode index 807ed3f66f..d4487e326a 100644 --- a/target/sparc/insns.decode +++ b/target/sparc/insns.decode @@ -284,6 +284,18 @@ FsTOi 10 ..... 110100 00000 0 1101 0001 ..... @r_r2 FdTOi 10 ..... 110100 00000 0 1101 0010 ..... @r_r2 FqTOi 10 ..... 110100 00000 0 1101 0011 ..... @r_r2 +FMOVscc 10 rd:5 110101 0 cond:4 1 cc:1 0 000001 rs2:5 +FMOVdcc 10 rd:5 110101 0 cond:4 1 cc:1 0 000010 rs2:5 +FMOVqcc 10 rd:5 110101 0 cond:4 1 cc:1 0 000011 rs2:5 + +FMOVsfcc 10 rd:5 110101 0 cond:4 0 cc:2 000001 rs2:5 +FMOVdfcc 10 rd:5 110101 0 cond:4 0 cc:2 000010 rs2:5 +FMOVqfcc 10 rd:5 110101 0 cond:4 0 cc:2 000011 rs2:5 + +FMOVRs 10 rd:5 110101 rs1:5 0 cond:3 00101 rs2:5 +FMOVRd 10 rd:5 110101 rs1:5 0 cond:3 00110 rs2:5 +FMOVRq 10 rd:5 110101 rs1:5 0 cond:3 00111 rs2:5 + { [ EDGE8cc 10 ..... 110110 ..... 0 0000 0000 ..... @r_r_r diff --git a/target/sparc/translate.c b/target/sparc/translate.c index 0fc888df8c..de1c18d93b 100644 --- a/target/sparc/translate.c +++ b/target/sparc/translate.c @@ -2425,15 +2425,9 @@ static void gen_stda_asi(DisasContext *dc, DisasASI *da, TCGv addr, int rd) } } -#ifdef TARGET_SPARC64 -static TCGv get_src1(DisasContext *dc, unsigned int insn) -{ - unsigned int rs1 = GET_FIELD(insn, 13, 17); - return gen_load_gpr(dc, rs1); -} - static void gen_fmovs(DisasContext *dc, DisasCompare *cmp, int rd, int rs) { +#ifdef TARGET_SPARC64 TCGv_i32 c32, zero, dst, s1, s2; /* We have two choices here: extend the 32 bit data and use movcond_i64, @@ -2456,19 +2450,27 @@ static void gen_fmovs(DisasContext *dc, DisasCompare *cmp, int rd, int rs) tcg_gen_movcond_i32(TCG_COND_NE, dst, c32, zero, s1, s2); gen_store_fpr_F(dc, rd, dst); +#else + qemu_build_not_reached(); +#endif } static void gen_fmovd(DisasContext *dc, DisasCompare *cmp, int rd, int rs) { +#ifdef TARGET_SPARC64 TCGv_i64 dst = gen_dest_fpr_D(dc, rd); tcg_gen_movcond_i64(cmp->cond, dst, cmp->c1, cmp->c2, gen_load_fpr_D(dc, rs), gen_load_fpr_D(dc, rd)); gen_store_fpr_D(dc, rd, dst); +#else + qemu_build_not_reached(); +#endif } static void gen_fmovq(DisasContext *dc, DisasCompare *cmp, int rd, int rs) { +#ifdef TARGET_SPARC64 int qd = QFPREG(rd); int qs = QFPREG(rs); @@ -2478,8 +2480,12 @@ static void gen_fmovq(DisasContext *dc, DisasCompare *cmp, int rd, int rs) cpu_fpr[qs / 2 + 1], cpu_fpr[qd / 2 + 1]); gen_update_fprs_dirty(dc, qd); +#else + qemu_build_not_reached(); +#endif } +#ifdef TARGET_SPARC64 static void gen_load_trap_state_at_tl(TCGv_ptr r_tsptr) { TCGv_i32 r_tl = tcg_temp_new_i32(); @@ -5214,6 +5220,72 @@ static bool trans_FdMULq(DisasContext *dc, arg_r_r_r *a) return advance_pc(dc); } +static bool do_fmovr(DisasContext *dc, arg_FMOVRs *a, bool is_128, + void (*func)(DisasContext *, DisasCompare *, int, int)) +{ + DisasCompare cmp; + + if (gen_trap_ifnofpu(dc)) { + return true; + } + if (is_128 && gen_trap_float128(dc)) { + return true; + } + + gen_op_clear_ieee_excp_and_FTT(); + gen_compare_reg(&cmp, a->cond, gen_load_gpr(dc, a->rs1)); + func(dc, &cmp, a->rd, a->rs2); + return advance_pc(dc); +} + +TRANS(FMOVRs, 64, do_fmovr, a, false, gen_fmovs) +TRANS(FMOVRd, 64, do_fmovr, a, false, gen_fmovd) +TRANS(FMOVRq, 64, do_fmovr, a, true, gen_fmovq) + +static bool do_fmovcc(DisasContext *dc, arg_FMOVscc *a, bool is_128, + void (*func)(DisasContext *, DisasCompare *, int, int)) +{ + DisasCompare cmp; + + if (gen_trap_ifnofpu(dc)) { + return true; + } + if (is_128 && gen_trap_float128(dc)) { + return true; + } + + gen_op_clear_ieee_excp_and_FTT(); + gen_compare(&cmp, a->cc, a->cond, dc); + func(dc, &cmp, a->rd, a->rs2); + return advance_pc(dc); +} + +TRANS(FMOVscc, 64, do_fmovcc, a, false, gen_fmovs) +TRANS(FMOVdcc, 64, do_fmovcc, a, false, gen_fmovd) +TRANS(FMOVqcc, 64, do_fmovcc, a, true, gen_fmovq) + +static bool do_fmovfcc(DisasContext *dc, arg_FMOVsfcc *a, bool is_128, + void (*func)(DisasContext *, DisasCompare *, int, int)) +{ + DisasCompare cmp; + + if (gen_trap_ifnofpu(dc)) { + return true; + } + if (is_128 && gen_trap_float128(dc)) { + return true; + } + + gen_op_clear_ieee_excp_and_FTT(); + gen_fcompare(&cmp, a->cc, a->cond); + func(dc, &cmp, a->rd, a->rs2); + return advance_pc(dc); +} + +TRANS(FMOVsfcc, 64, do_fmovfcc, a, false, gen_fmovs) +TRANS(FMOVdfcc, 64, do_fmovfcc, a, false, gen_fmovd) +TRANS(FMOVqfcc, 64, do_fmovfcc, a, true, gen_fmovq) + #define CHECK_IU_FEATURE(dc, FEATURE) \ if (!((dc)->def->features & CPU_FEATURE_ ## FEATURE)) \ goto illegal_insn; @@ -5247,9 +5319,6 @@ static void disas_sparc_legacy(DisasContext *dc, unsigned int insn) if (xop == 0x34) { /* FPU Operations */ goto illegal_insn; /* in decodetree */ } else if (xop == 0x35) { /* FPU Operations */ -#ifdef TARGET_SPARC64 - int cond; -#endif if (gen_trap_ifnofpu(dc)) { goto jmp_insn; } @@ -5258,110 +5327,7 @@ static void disas_sparc_legacy(DisasContext *dc, unsigned int insn) rs2 = GET_FIELD(insn, 27, 31); xop = GET_FIELD(insn, 18, 26); -#ifdef TARGET_SPARC64 -#define FMOVR(sz) \ - do { \ - DisasCompare cmp; \ - cond = GET_FIELD_SP(insn, 10, 12); \ - cpu_src1 = get_src1(dc, insn); \ - gen_compare_reg(&cmp, cond, cpu_src1); \ - gen_fmov##sz(dc, &cmp, rd, rs2); \ - } while (0) - - if ((xop & 0x11f) == 0x005) { /* V9 fmovsr */ - FMOVR(s); - break; - } else if ((xop & 0x11f) == 0x006) { // V9 fmovdr - FMOVR(d); - break; - } else if ((xop & 0x11f) == 0x007) { // V9 fmovqr - CHECK_FPU_FEATURE(dc, FLOAT128); - FMOVR(q); - break; - } -#undef FMOVR -#endif switch (xop) { -#ifdef TARGET_SPARC64 -#define FMOVCC(fcc, sz) \ - do { \ - DisasCompare cmp; \ - cond = GET_FIELD_SP(insn, 14, 17); \ - gen_fcompare(&cmp, fcc, cond); \ - gen_fmov##sz(dc, &cmp, rd, rs2); \ - } while (0) - - case 0x001: /* V9 fmovscc %fcc0 */ - FMOVCC(0, s); - break; - case 0x002: /* V9 fmovdcc %fcc0 */ - FMOVCC(0, d); - break; - case 0x003: /* V9 fmovqcc %fcc0 */ - CHECK_FPU_FEATURE(dc, FLOAT128); - FMOVCC(0, q); - break; - case 0x041: /* V9 fmovscc %fcc1 */ - FMOVCC(1, s); - break; - case 0x042: /* V9 fmovdcc %fcc1 */ - FMOVCC(1, d); - break; - case 0x043: /* V9 fmovqcc %fcc1 */ - CHECK_FPU_FEATURE(dc, FLOAT128); - FMOVCC(1, q); - break; - case 0x081: /* V9 fmovscc %fcc2 */ - FMOVCC(2, s); - break; - case 0x082: /* V9 fmovdcc %fcc2 */ - FMOVCC(2, d); - break; - case 0x083: /* V9 fmovqcc %fcc2 */ - CHECK_FPU_FEATURE(dc, FLOAT128); - FMOVCC(2, q); - break; - case 0x0c1: /* V9 fmovscc %fcc3 */ - FMOVCC(3, s); - break; - case 0x0c2: /* V9 fmovdcc %fcc3 */ - FMOVCC(3, d); - break; - case 0x0c3: /* V9 fmovqcc %fcc3 */ - CHECK_FPU_FEATURE(dc, FLOAT128); - FMOVCC(3, q); - break; -#undef FMOVCC -#define FMOVCC(xcc, sz) \ - do { \ - DisasCompare cmp; \ - cond = GET_FIELD_SP(insn, 14, 17); \ - gen_compare(&cmp, xcc, cond, dc); \ - gen_fmov##sz(dc, &cmp, rd, rs2); \ - } while (0) - - case 0x101: /* V9 fmovscc %icc */ - FMOVCC(0, s); - break; - case 0x102: /* V9 fmovdcc %icc */ - FMOVCC(0, d); - break; - case 0x103: /* V9 fmovqcc %icc */ - CHECK_FPU_FEATURE(dc, FLOAT128); - FMOVCC(0, q); - break; - case 0x181: /* V9 fmovscc %xcc */ - FMOVCC(1, s); - break; - case 0x182: /* V9 fmovdcc %xcc */ - FMOVCC(1, d); - break; - case 0x183: /* V9 fmovqcc %xcc */ - CHECK_FPU_FEATURE(dc, FLOAT128); - FMOVCC(1, q); - break; -#undef FMOVCC -#endif case 0x51: /* fcmps, V9 %fcc */ cpu_src1_32 = gen_load_fpr_F(dc, rs1); cpu_src2_32 = gen_load_fpr_F(dc, rs2); From patchwork Sun Oct 22 06:00:27 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 736992 Delivered-To: patch@linaro.org Received: by 2002:adf:dd81:0:b0:32d:baff:b0ca with SMTP id x1csp1006237wrl; Sat, 21 Oct 2023 23:14:23 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHoG0Cgfdpwib2cuC5rlGqUrcl89Wx7bZnOP/nuzxll4HtWVUprU+9MnLxlDvSliX0mQBn1 X-Received: by 2002:a05:620a:4450:b0:775:446b:85fa with SMTP id w16-20020a05620a445000b00775446b85famr8241148qkp.3.1697955263541; Sat, 21 Oct 2023 23:14:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697955263; cv=none; d=google.com; s=arc-20160816; b=Ca+7lu1oG6LS8TY+lWwt7kG9GoRa5HYzR4p85SF+fquTXmT3fLD+BJSINu59euElRb Wb/MwAis68zSa2u/pmyvYe842AP7Hr3mxlh9QfFde5TAV/IcnxbMVDRUfc749Bvphcq2 P3PsdADb4/0RAyGfz492s2itULceN5t+dvfqnDG2NPYAJJO1A980yjxceEWxjXo4sFeo OSDla29wVyECwgMWz5iNhUI/UbRgmoxQe4Yr0dwniYZVN8SNTQje6kI8uxWraqbj76L+ OrMn3v6XmsFEEzAzXp8VErkJdvx3POt7EnexZyR6fkWIw4qPbpgD1EyZhbDmSK04gw8u TMsw== 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=Evq7CIpzXcx3yrXwcB1jo0LKSLZATdCv+zawU7+n2WQ=; fh=TYrED6TOMxGX0VC4GtjviASLbYyJe19+7/tKWjN44KQ=; b=izmiJRkOu95O104B3p5SC2ZQSvzErncDq4C/JvPGO4n2FLMUvCvLTdWYE+fY/WES2A TKGicOvJDdNvBuJQuWQbXyJUJAeItdbngXY6zJsisu8OeXPhT9vd/N+DH3b/oC3QKt02 VRNglB7JG/HN+2FRkfj9mi/iy6YQuyh7Qm+BJOKynP2Rw6jhwV2AQPM3JiuCnasqttkT QI2DCkeQJY4ojjCPLCgzkd6mkG/Ulwn54EjEIsQeLnr6BhRB40anEhdpIY4ULBr3V6uT sTXe+MUGjMnPk9LrQfgLo7HW3EzLFISL9qjnmttDoMgsB6zukmbtts754yENUyg0PwI6 QONw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=VvaKaJqU; 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 o3-20020a05620a2a0300b007783026be9esi2196572qkp.621.2023.10.21.23.14.23 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sat, 21 Oct 2023 23:14:23 -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=VvaKaJqU; 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 1quRdY-00078W-H5; Sun, 22 Oct 2023 02:08:32 -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 1quRdS-0006RJ-8X for qemu-devel@nongnu.org; Sun, 22 Oct 2023 02:08:26 -0400 Received: from mail-pl1-x62b.google.com ([2607:f8b0:4864:20::62b]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1quRdN-00036N-7T for qemu-devel@nongnu.org; Sun, 22 Oct 2023 02:08:25 -0400 Received: by mail-pl1-x62b.google.com with SMTP id d9443c01a7336-1c9d922c039so18128685ad.3 for ; Sat, 21 Oct 2023 23:08:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1697954894; x=1698559694; 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=Evq7CIpzXcx3yrXwcB1jo0LKSLZATdCv+zawU7+n2WQ=; b=VvaKaJqU3A/hF8ePQ4ym9l6Osvk8AxM981eGkK9lnuT0/ALY7gRxTkorH8B/ix/jny IuO7L5Ui4rCaDUk8tWnL7l+hdyfREWsJ65bDvhtGIJWwifkrbV8yVWnQ7r+cM6XAo0WE T3fnHkv7BH/CBGZ+s8xLrU/j6UQ2y+F2Fb5A+algWz8+wShtLiT0VxHle4pfavR12zXU NPhT5RENwgcw+VzoA90KD7sU5PXKU39hPr3531+dBBZUi9Qu/NZjrI9Hn1fOS5gJnfQ+ Z+d9gZKiGFqrKt5mGXcVPA5Ew5n2QGeyVglMG4X5Efs+Fyh8hCzQi7CAvTw1X0To/+hO dyaw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697954894; x=1698559694; 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=Evq7CIpzXcx3yrXwcB1jo0LKSLZATdCv+zawU7+n2WQ=; b=e1EhIyP8j2HTyAOwDIXCAHeblMt4dfhtXBpLPajfcQB3wdaLQ3hW1Ji/s13dOBG7HX jU/BPsUd9KaDMOhx173o6st/oNcfg2IiHqN2/P5NgD353dL1XE6DSzsQXMfYURiVsRFI RwtLh+Ggu3kmrdunjc6SIJa4URQBH31fYYEjYEUjotyh0QfXT9RzoDwvR2DQwcjZFyEQ jCam7LoH0ePQLtS2c32qfg60aTlffeg9NYrzDlRswLPrCOrDJVptqEMAE6xIAMpDJXqq Twj+o/HoyEsmyMbeVGNdbAZsP9AUu2MN3St4hCoH2dui254F/62gMb3JAMVhfr/JY+RC djYQ== X-Gm-Message-State: AOJu0Yy24SJsNdRHttpn7kZy5XJuOk3cK5bkcTnqwgFaeVoBnAinZViD WnVCkbB7wZZkHT8sFhIk4NNwgxbuEdQ21pl3zA0= X-Received: by 2002:a17:902:eecc:b0:1c5:ba50:2b28 with SMTP id h12-20020a170902eecc00b001c5ba502b28mr5701344plb.25.1697954894465; Sat, 21 Oct 2023 23:08:14 -0700 (PDT) Received: from stoup.. ([71.212.149.95]) by smtp.gmail.com with ESMTPSA id li11-20020a170903294b00b001c444106bcasm3962919plb.46.2023.10.21.23.08.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 21 Oct 2023 23:08:14 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: mark.cave-ayland@ilande.co.uk Subject: [PATCH v4 86/90] target/sparc: Convert FCMP, FCMPE to decodetree Date: Sat, 21 Oct 2023 23:00:27 -0700 Message-Id: <20231022060031.490251-87-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231022060031.490251-1-richard.henderson@linaro.org> References: <20231022060031.490251-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::62b; envelope-from=richard.henderson@linaro.org; helo=mail-pl1-x62b.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 | 7 ++ target/sparc/translate.c | 145 +++++++++++++++++++++++--------------- 2 files changed, 96 insertions(+), 56 deletions(-) diff --git a/target/sparc/insns.decode b/target/sparc/insns.decode index d4487e326a..f197bb0b36 100644 --- a/target/sparc/insns.decode +++ b/target/sparc/insns.decode @@ -296,6 +296,13 @@ FMOVRs 10 rd:5 110101 rs1:5 0 cond:3 00101 rs2:5 FMOVRd 10 rd:5 110101 rs1:5 0 cond:3 00110 rs2:5 FMOVRq 10 rd:5 110101 rs1:5 0 cond:3 00111 rs2:5 +FCMPs 10 000 cc:2 110101 rs1:5 0 0101 0001 rs2:5 +FCMPd 10 000 cc:2 110101 rs1:5 0 0101 0010 rs2:5 +FCMPq 10 000 cc:2 110101 rs1:5 0 0101 0011 rs2:5 +FCMPEs 10 000 cc:2 110101 rs1:5 0 0101 0101 rs2:5 +FCMPEd 10 000 cc:2 110101 rs1:5 0 0101 0110 rs2:5 +FCMPEq 10 000 cc:2 110101 rs1:5 0 0101 0111 rs2:5 + { [ EDGE8cc 10 ..... 110110 ..... 0 0000 0000 ..... @r_r_r diff --git a/target/sparc/translate.c b/target/sparc/translate.c index de1c18d93b..dee155143c 100644 --- a/target/sparc/translate.c +++ b/target/sparc/translate.c @@ -5286,6 +5286,82 @@ TRANS(FMOVsfcc, 64, do_fmovfcc, a, false, gen_fmovs) TRANS(FMOVdfcc, 64, do_fmovfcc, a, false, gen_fmovd) TRANS(FMOVqfcc, 64, do_fmovfcc, a, true, gen_fmovq) +static bool do_fcmps(DisasContext *dc, arg_FCMPs *a, bool e) +{ + TCGv_i32 src1, src2; + + if (avail_32(dc) && a->cc != 0) { + return false; + } + if (gen_trap_ifnofpu(dc)) { + return true; + } + + gen_op_clear_ieee_excp_and_FTT(); + src1 = gen_load_fpr_F(dc, a->rs1); + src2 = gen_load_fpr_F(dc, a->rs2); + if (e) { + gen_op_fcmpes(a->cc, src1, src2); + } else { + gen_op_fcmps(a->cc, src1, src2); + } + return advance_pc(dc); +} + +TRANS(FCMPs, ALL, do_fcmps, a, false) +TRANS(FCMPEs, ALL, do_fcmps, a, true) + +static bool do_fcmpd(DisasContext *dc, arg_FCMPd *a, bool e) +{ + TCGv_i64 src1, src2; + + if (avail_32(dc) && a->cc != 0) { + return false; + } + if (gen_trap_ifnofpu(dc)) { + return true; + } + + gen_op_clear_ieee_excp_and_FTT(); + src1 = gen_load_fpr_D(dc, a->rs1); + src2 = gen_load_fpr_D(dc, a->rs2); + if (e) { + gen_op_fcmped(a->cc, src1, src2); + } else { + gen_op_fcmpd(a->cc, src1, src2); + } + return advance_pc(dc); +} + +TRANS(FCMPd, ALL, do_fcmpd, a, false) +TRANS(FCMPEd, ALL, do_fcmpd, a, true) + +static bool do_fcmpq(DisasContext *dc, arg_FCMPq *a, bool e) +{ + if (avail_32(dc) && a->cc != 0) { + return false; + } + if (gen_trap_ifnofpu(dc)) { + return true; + } + if (gen_trap_float128(dc)) { + return true; + } + + gen_op_clear_ieee_excp_and_FTT(); + gen_op_load_fpr_QT0(QFPREG(a->rs1)); + gen_op_load_fpr_QT1(QFPREG(a->rs2)); + if (e) { + gen_op_fcmpeq(a->cc); + } else { + gen_op_fcmpq(a->cc); + } + return advance_pc(dc); +} + +TRANS(FCMPq, ALL, do_fcmpq, a, false) +TRANS(FCMPEq, ALL, do_fcmpq, a, true) + #define CHECK_IU_FEATURE(dc, FEATURE) \ if (!((dc)->def->features & CPU_FEATURE_ ## FEATURE)) \ goto illegal_insn; @@ -5296,15 +5372,7 @@ TRANS(FMOVqfcc, 64, do_fmovfcc, a, true, gen_fmovq) /* before an instruction, dc->pc must be static */ static void disas_sparc_legacy(DisasContext *dc, unsigned int insn) { - unsigned int opc, rs1, rs2, rd; - TCGv cpu_src1 __attribute__((unused)); - TCGv_i32 cpu_src1_32, cpu_src2_32; - TCGv_i64 cpu_src1_64, cpu_src2_64; - TCGv_i32 cpu_dst_32 __attribute__((unused)); - TCGv_i64 cpu_dst_64 __attribute__((unused)); - - opc = GET_FIELD(insn, 0, 1); - rd = GET_FIELD(insn, 2, 6); + unsigned int opc = GET_FIELD(insn, 0, 1); switch (opc) { case 0: @@ -5314,61 +5382,22 @@ static void disas_sparc_legacy(DisasContext *dc, unsigned int insn) case 2: /* FPU & Logical Operations */ { unsigned int xop = GET_FIELD(insn, 7, 12); - TCGv cpu_dst __attribute__((unused)) = tcg_temp_new(); if (xop == 0x34) { /* FPU Operations */ goto illegal_insn; /* in decodetree */ } else if (xop == 0x35) { /* FPU Operations */ - if (gen_trap_ifnofpu(dc)) { - goto jmp_insn; - } - gen_op_clear_ieee_excp_and_FTT(); - rs1 = GET_FIELD(insn, 13, 17); - rs2 = GET_FIELD(insn, 27, 31); - xop = GET_FIELD(insn, 18, 26); - - switch (xop) { - case 0x51: /* fcmps, V9 %fcc */ - cpu_src1_32 = gen_load_fpr_F(dc, rs1); - cpu_src2_32 = gen_load_fpr_F(dc, rs2); - gen_op_fcmps(rd & 3, cpu_src1_32, cpu_src2_32); - break; - case 0x52: /* fcmpd, V9 %fcc */ - cpu_src1_64 = gen_load_fpr_D(dc, rs1); - cpu_src2_64 = gen_load_fpr_D(dc, rs2); - gen_op_fcmpd(rd & 3, cpu_src1_64, cpu_src2_64); - break; - case 0x53: /* fcmpq, V9 %fcc */ - CHECK_FPU_FEATURE(dc, FLOAT128); - gen_op_load_fpr_QT0(QFPREG(rs1)); - gen_op_load_fpr_QT1(QFPREG(rs2)); - gen_op_fcmpq(rd & 3); - break; - case 0x55: /* fcmpes, V9 %fcc */ - cpu_src1_32 = gen_load_fpr_F(dc, rs1); - cpu_src2_32 = gen_load_fpr_F(dc, rs2); - gen_op_fcmpes(rd & 3, cpu_src1_32, cpu_src2_32); - break; - case 0x56: /* fcmped, V9 %fcc */ - cpu_src1_64 = gen_load_fpr_D(dc, rs1); - cpu_src2_64 = gen_load_fpr_D(dc, rs2); - gen_op_fcmped(rd & 3, cpu_src1_64, cpu_src2_64); - break; - case 0x57: /* fcmpeq, V9 %fcc */ - CHECK_FPU_FEATURE(dc, FLOAT128); - gen_op_load_fpr_QT0(QFPREG(rs1)); - gen_op_load_fpr_QT1(QFPREG(rs2)); - gen_op_fcmpeq(rd & 3); - break; - default: - goto illegal_insn; - } + goto illegal_insn; /* in decodetree */ } else if (xop == 0x36) { #ifdef TARGET_SPARC64 /* VIS */ + TCGv_i64 cpu_src1_64, cpu_src2_64, cpu_dst_64; + TCGv_i32 cpu_dst_32; + TCGv cpu_dst = tcg_temp_new(); int opf = GET_FIELD_SP(insn, 5, 13); - rs1 = GET_FIELD(insn, 13, 17); - rs2 = GET_FIELD(insn, 27, 31); + int rs1 = GET_FIELD(insn, 13, 17); + int rs2 = GET_FIELD(insn, 27, 31); + int rd = GET_FIELD(insn, 2, 6); + if (gen_trap_ifnofpu(dc)) { goto jmp_insn; } @@ -5553,14 +5582,18 @@ static void disas_sparc_legacy(DisasContext *dc, unsigned int insn) goto illegal_insn; /* in decodetree */ } advance_pc(dc); +#ifdef TARGET_SPARC64 jmp_insn: +#endif return; illegal_insn: gen_exception(dc, TT_ILL_INSN); return; +#ifdef TARGET_SPARC64 nfpu_insn: gen_op_fpexception_im(dc, FSR_FTT_UNIMPFPOP); return; +#endif } static void sparc_tr_init_disas_context(DisasContextBase *dcbase, CPUState *cs) From patchwork Sun Oct 22 06:00:28 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 737008 Delivered-To: patch@linaro.org Received: by 2002:adf:dd81:0:b0:32d:baff:b0ca with SMTP id x1csp1006744wrl; Sat, 21 Oct 2023 23:16:35 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEKceM+zarHhuwPlTeXZO0wBJQ+slCPQ3Rtc957wGntoarqahJskexVuloGB2rMdIeTpCmY X-Received: by 2002:a05:6214:2586:b0:66d:1d22:42d8 with SMTP id fq6-20020a056214258600b0066d1d2242d8mr8298694qvb.11.1697955394789; Sat, 21 Oct 2023 23:16:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697955394; cv=none; d=google.com; s=arc-20160816; b=XysCp5A7Av6fzodkl2Z45aUWmdQVxptxKjVQCEQWgDG/Kh5GYa1S2s7sF6D8NmHCyO fhxiogusVjEyMo01OX9YuYYXpNC3fhJqRVA8SnV2Kci+ko7JWovZlctl0vaA+T4gZfvv jQiIczo0SjZYjC0RFnUGV3JV2SRiR9c/sX70y2QAemB29Ev0M18/CSWZoLZ1+iRmmrOq sfyyTRjWbUCLyiFjBl4FukgdHapTKH7G08k4D18ML14KckdeT5zfHsvOZYliFi+L/qPl XHzt41KeGuo2ACI6p6RfRKz30aGf3sYi1b+q+6Rpr3T96o4MgvCiSTCKfnJW/nWSdgru uRBg== 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=XsNnFrEXDzNI5ZBm2Uh3OFwIpNm92O4Amms6buapB9k=; fh=TYrED6TOMxGX0VC4GtjviASLbYyJe19+7/tKWjN44KQ=; b=thu5oVO2mxbzbj3NV7PMvKxpc2qdfNTJVk0R1NY1xNXKA3nzRQ/jDr2ZVBv1zfhQDN 3WXb9RnjjZmS1sDf/aEcDGTd5B3UPsQjDcdj197YRXlbqWZTzsqo8Z9h+Xa6HFAPw85P cTdaUAXtIV8IqoavLoMr+761m3hPcBnGd7D7BKvnz8vYOFA0sYSpBN/T/W21gUqGGmp2 u+SvGZUoZDsSLGgiefjklL6LiQ7Ukt+LlE93zZgAGB1kwc5Ody8I8Xhufv7tMDDFv9Zb ILfIMF5jPANNjsvHGayEVST+JjDWBqoWsf7grWOr2gywbNrOCKqRs5fMg5mkZ6pu0Erp S1Bg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="YFxwx/jn"; 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 du14-20020a05621409ae00b0065615c8acc7si3787659qvb.452.2023.10.21.23.16.34 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sat, 21 Oct 2023 23:16:34 -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="YFxwx/jn"; 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 1quRdX-0006wD-4v; Sun, 22 Oct 2023 02:08:31 -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 1quRdT-0006Wp-8z for qemu-devel@nongnu.org; Sun, 22 Oct 2023 02:08:27 -0400 Received: from mail-pf1-x42e.google.com ([2607:f8b0:4864:20::42e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1quRdN-00037b-7N for qemu-devel@nongnu.org; Sun, 22 Oct 2023 02:08:26 -0400 Received: by mail-pf1-x42e.google.com with SMTP id d2e1a72fcca58-6bb4abb8100so1744683b3a.2 for ; Sat, 21 Oct 2023 23:08:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1697954895; x=1698559695; 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=XsNnFrEXDzNI5ZBm2Uh3OFwIpNm92O4Amms6buapB9k=; b=YFxwx/jnSzETi1RxhmtkiAgi43Fcu5caWNBJmOkcRZQkZiKMijRB9YBNOldePSAfEb IJ2f0dOriIZja1n1QDLmSISSO7ZZL/JRT/VPMat1/wOMLqhjbJI5LCo7NYqXO0I7gI6P dsQ5r8e8kZr2OINDarbdzRMsJ57uNEpIbEkog8H5AqWsSBdcvDSbQBmTPGyXmTyWMPe4 NU1C4yAQKaw2fKxxuiE1kHHQe/0UJs1rM7gxgqc2DqXW1kODrO9h+Rm6gUXY7kIFBl3b pSNrMKmV5y9YsKxKslKaR4fbb20ubBG5nK8iyLy9xzyPMTfqJGVfRvmt2tFLf6jcvmH5 BIHw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697954895; x=1698559695; 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=XsNnFrEXDzNI5ZBm2Uh3OFwIpNm92O4Amms6buapB9k=; b=JUr8u6oeOAkNKTuJR/LrpvkgEWaZBEWigyhyi9jVmrMdtVRuakKR9BWNCTb9pnMmCv Snvgf/BiqHeCzROGpcRJ2dhQh3NXdDUUtylZt+rn0Rs/ZAR4O9f6zW7P7Mk1DYnDL7DZ 7r4MDPdpwWmgMs0ve04buWy5DNMcP6eIg0WmNsANAZ0XuWHRpcgcwERr8KXjx/B/UMxB v8/Zz/PF+B7epX1DEvLqS/ah7QNf1zryyR10usLR47d6wF7NkbSZ4lgoSHds4ugA9hNQ b9heoKGtKBsbJ63mdy3Ubl9yq+lH4nf5QC/9RAt8+yuR4GAfBmrfdMMAU0YoghWNZ/PW 0/AQ== X-Gm-Message-State: AOJu0YzpEz48cBhiYYGagySxnnLBvJE0lMcltJFzXkeU4i+eQkhE2H0l xFwXwQMeXVLebACnnxAMXgMBFHI3kZOWP1peYD8= X-Received: by 2002:a05:6a21:33a0:b0:17e:466:ea62 with SMTP id yy32-20020a056a2133a000b0017e0466ea62mr174638pzb.42.1697954895308; Sat, 21 Oct 2023 23:08:15 -0700 (PDT) Received: from stoup.. ([71.212.149.95]) by smtp.gmail.com with ESMTPSA id li11-20020a170903294b00b001c444106bcasm3962919plb.46.2023.10.21.23.08.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 21 Oct 2023 23:08:14 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: mark.cave-ayland@ilande.co.uk Subject: [PATCH v4 87/90] target/sparc: Move FPCMP* to decodetree Date: Sat, 21 Oct 2023 23:00:28 -0700 Message-Id: <20231022060031.490251-88-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231022060031.490251-1-richard.henderson@linaro.org> References: <20231022060031.490251-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::42e; envelope-from=richard.henderson@linaro.org; helo=mail-pf1-x42e.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 | 9 ++++ target/sparc/translate.c | 94 +++++++++++++++++---------------------- 2 files changed, 50 insertions(+), 53 deletions(-) diff --git a/target/sparc/insns.decode b/target/sparc/insns.decode index f197bb0b36..781c3cd7f7 100644 --- a/target/sparc/insns.decode +++ b/target/sparc/insns.decode @@ -327,6 +327,15 @@ FCMPEq 10 000 cc:2 110101 rs1:5 0 0101 0111 rs2:5 BMASK 10 ..... 110110 ..... 0 0001 1001 ..... @r_r_r + FPCMPLE16 10 ..... 110110 ..... 0 0010 0000 ..... @r_r_r + FPCMPNE16 10 ..... 110110 ..... 0 0010 0010 ..... @r_r_r + FPCMPGT16 10 ..... 110110 ..... 0 0010 1000 ..... @r_r_r + FPCMPEQ16 10 ..... 110110 ..... 0 0010 1010 ..... @r_r_r + FPCMPLE32 10 ..... 110110 ..... 0 0010 0100 ..... @r_r_r + FPCMPNE32 10 ..... 110110 ..... 0 0010 0110 ..... @r_r_r + FPCMPGT32 10 ..... 110110 ..... 0 0010 1100 ..... @r_r_r + FPCMPEQ32 10 ..... 110110 ..... 0 0010 1110 ..... @r_r_r + FMUL8x16 10 ..... 110110 ..... 0 0011 0001 ..... @r_r_r FMUL8x16AU 10 ..... 110110 ..... 0 0011 0011 ..... @r_r_r FMUL8x16AL 10 ..... 110110 ..... 0 0011 0101 ..... @r_r_r diff --git a/target/sparc/translate.c b/target/sparc/translate.c index dee155143c..ff849f33e4 100644 --- a/target/sparc/translate.c +++ b/target/sparc/translate.c @@ -77,7 +77,14 @@ #define gen_helper_fpmerge ({ g_assert_not_reached(); NULL; }) #define gen_helper_fexpand ({ g_assert_not_reached(); NULL; }) #define gen_helper_pdist ({ g_assert_not_reached(); NULL; }) -#define gen_helper_fsqrtq ({ g_assert_not_reached(); NULL; }) +#define gen_helper_fcmpeq16 ({ g_assert_not_reached(); NULL; }) +#define gen_helper_fcmpne16 ({ g_assert_not_reached(); NULL; }) +#define gen_helper_fcmple16 ({ g_assert_not_reached(); NULL; }) +#define gen_helper_fcmpgt16 ({ g_assert_not_reached(); NULL; }) +#define gen_helper_fcmpeq32 ({ g_assert_not_reached(); NULL; }) +#define gen_helper_fcmpne32 ({ g_assert_not_reached(); NULL; }) +#define gen_helper_fcmple32 ({ g_assert_not_reached(); NULL; }) +#define gen_helper_fcmpgt32 ({ g_assert_not_reached(); NULL; }) #define FSR_LDXFSR_MASK ({ qemu_build_not_reached(); 0; }) #define FSR_LDXFSR_OLDMASK ({ qemu_build_not_reached(); 0; }) # ifdef CONFIG_USER_ONLY @@ -5108,6 +5115,37 @@ TRANS(FPACK32, VIS1, do_ddd, a, gen_op_fpack32) TRANS(FALIGNDATAg, VIS1, do_ddd, a, gen_op_faligndata) TRANS(BSHUFFLE, VIS2, do_ddd, a, gen_op_bshuffle) +static bool do_rdd(DisasContext *dc, arg_r_r_r *a, + void (*func)(TCGv_i64, TCGv_i64, TCGv_i64)) +{ +#ifdef TARGET_SPARC64 + TCGv_i64 dst, src1, src2; + + if (gen_trap_ifnofpu(dc)) { + return true; + } + + dst = gen_dest_gpr(dc, a->rd); + src1 = gen_load_fpr_D(dc, a->rs1); + src2 = gen_load_fpr_D(dc, a->rs2); + func(dst, src1, src2); + gen_store_gpr(dc, a->rd, dst); + return advance_pc(dc); +#else + g_assert_not_reached(); +#endif +} + +TRANS(FPCMPLE16, VIS1, do_rdd, a, gen_helper_fcmple16) +TRANS(FPCMPNE16, VIS1, do_rdd, a, gen_helper_fcmpne16) +TRANS(FPCMPGT16, VIS1, do_rdd, a, gen_helper_fcmpgt16) +TRANS(FPCMPEQ16, VIS1, do_rdd, a, gen_helper_fcmpeq16) + +TRANS(FPCMPLE32, VIS1, do_rdd, a, gen_helper_fcmple32) +TRANS(FPCMPNE32, VIS1, do_rdd, a, gen_helper_fcmpne32) +TRANS(FPCMPGT32, VIS1, do_rdd, a, gen_helper_fcmpgt32) +TRANS(FPCMPEQ32, VIS1, do_rdd, a, gen_helper_fcmpeq32) + static bool do_env_ddd(DisasContext *dc, arg_r_r_r *a, void (*func)(TCGv_i64, TCGv_env, TCGv_i64, TCGv_i64)) { @@ -5390,11 +5428,9 @@ static void disas_sparc_legacy(DisasContext *dc, unsigned int insn) } else if (xop == 0x36) { #ifdef TARGET_SPARC64 /* VIS */ - TCGv_i64 cpu_src1_64, cpu_src2_64, cpu_dst_64; + TCGv_i64 cpu_src1_64, cpu_dst_64; TCGv_i32 cpu_dst_32; - TCGv cpu_dst = tcg_temp_new(); int opf = GET_FIELD_SP(insn, 5, 13); - int rs1 = GET_FIELD(insn, 13, 17); int rs2 = GET_FIELD(insn, 27, 31); int rd = GET_FIELD(insn, 2, 6); @@ -5470,63 +5506,15 @@ static void disas_sparc_legacy(DisasContext *dc, unsigned int insn) case 0x03a: /* VIS I fpack32 */ case 0x048: /* VIS I faligndata */ case 0x04c: /* VIS II bshuffle */ - g_assert_not_reached(); /* in decodetree */ case 0x020: /* VIS I fcmple16 */ - CHECK_FPU_FEATURE(dc, VIS1); - cpu_src1_64 = gen_load_fpr_D(dc, rs1); - cpu_src2_64 = gen_load_fpr_D(dc, rs2); - gen_helper_fcmple16(cpu_dst, cpu_src1_64, cpu_src2_64); - gen_store_gpr(dc, rd, cpu_dst); - break; case 0x022: /* VIS I fcmpne16 */ - CHECK_FPU_FEATURE(dc, VIS1); - cpu_src1_64 = gen_load_fpr_D(dc, rs1); - cpu_src2_64 = gen_load_fpr_D(dc, rs2); - gen_helper_fcmpne16(cpu_dst, cpu_src1_64, cpu_src2_64); - gen_store_gpr(dc, rd, cpu_dst); - break; case 0x024: /* VIS I fcmple32 */ - CHECK_FPU_FEATURE(dc, VIS1); - cpu_src1_64 = gen_load_fpr_D(dc, rs1); - cpu_src2_64 = gen_load_fpr_D(dc, rs2); - gen_helper_fcmple32(cpu_dst, cpu_src1_64, cpu_src2_64); - gen_store_gpr(dc, rd, cpu_dst); - break; case 0x026: /* VIS I fcmpne32 */ - CHECK_FPU_FEATURE(dc, VIS1); - cpu_src1_64 = gen_load_fpr_D(dc, rs1); - cpu_src2_64 = gen_load_fpr_D(dc, rs2); - gen_helper_fcmpne32(cpu_dst, cpu_src1_64, cpu_src2_64); - gen_store_gpr(dc, rd, cpu_dst); - break; case 0x028: /* VIS I fcmpgt16 */ - CHECK_FPU_FEATURE(dc, VIS1); - cpu_src1_64 = gen_load_fpr_D(dc, rs1); - cpu_src2_64 = gen_load_fpr_D(dc, rs2); - gen_helper_fcmpgt16(cpu_dst, cpu_src1_64, cpu_src2_64); - gen_store_gpr(dc, rd, cpu_dst); - break; case 0x02a: /* VIS I fcmpeq16 */ - CHECK_FPU_FEATURE(dc, VIS1); - cpu_src1_64 = gen_load_fpr_D(dc, rs1); - cpu_src2_64 = gen_load_fpr_D(dc, rs2); - gen_helper_fcmpeq16(cpu_dst, cpu_src1_64, cpu_src2_64); - gen_store_gpr(dc, rd, cpu_dst); - break; case 0x02c: /* VIS I fcmpgt32 */ - CHECK_FPU_FEATURE(dc, VIS1); - cpu_src1_64 = gen_load_fpr_D(dc, rs1); - cpu_src2_64 = gen_load_fpr_D(dc, rs2); - gen_helper_fcmpgt32(cpu_dst, cpu_src1_64, cpu_src2_64); - gen_store_gpr(dc, rd, cpu_dst); - break; case 0x02e: /* VIS I fcmpeq32 */ - CHECK_FPU_FEATURE(dc, VIS1); - cpu_src1_64 = gen_load_fpr_D(dc, rs1); - cpu_src2_64 = gen_load_fpr_D(dc, rs2); - gen_helper_fcmpeq32(cpu_dst, cpu_src1_64, cpu_src2_64); - gen_store_gpr(dc, rd, cpu_dst); - break; + g_assert_not_reached(); /* in decodetree */ case 0x03b: /* VIS I fpack16 */ CHECK_FPU_FEATURE(dc, VIS1); cpu_src1_64 = gen_load_fpr_D(dc, rs2); From patchwork Sun Oct 22 06:00:29 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 736964 Delivered-To: patch@linaro.org Received: by 2002:adf:dd81:0:b0:32d:baff:b0ca with SMTP id x1csp1005797wrl; Sat, 21 Oct 2023 23:12:27 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFAjlYL4TI2F/U5/lfONplAlWunBvbHD3cM9VFo486kRkW5dmvqgq5qI5qijusQlydld028 X-Received: by 2002:a05:620a:28c6:b0:777:5120:d5ba with SMTP id l6-20020a05620a28c600b007775120d5bamr6485149qkp.8.1697955147190; Sat, 21 Oct 2023 23:12:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697955147; cv=none; d=google.com; s=arc-20160816; b=TcJVQ/q5tiqoz1yd98EDxLDXyHk4LDJ62Sqp0xWBgZ392GTJIrQLhD8JKQgLUWtCk3 wiVBFcRQm70rg/ZMdU1bzwrEw+HV0t3gMnQA92mcUqZS3RZsJNlr6Lnao8BV88G/y0y2 ZjhdNsay882JqNlgeXNqshk7rXjEN4EC9LmbsZfZdwivgvoDYIezHJAsgZM7izHyYMmX IbN3qeI1sf8eaZ0/ef57IGD6xF20hEgV8gD9XRicqIWgjjORr+34e3hZ1YqOn4prvyc1 wv8npt6z74Y3Id2B//s/nI09CWaiRIdwgQJUS9mGaIqYpzCpisUbxF80TBmCse/GIKB5 g71A== 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=pCRY2J/deckmDlj0QfEqXFX5UP12wnEnJ1cgBJhM2hU=; fh=TYrED6TOMxGX0VC4GtjviASLbYyJe19+7/tKWjN44KQ=; b=rMcMis1fMF0m1fW8GMSjzpwfJ3SY9T6Du2Y/uStla2Lcjq9504Znj0ZLfwLvHtKLy7 rwQScun0AFzcdz+OYUED6SOfXgW9ZQ+DPPUyq4XZPurZ5+0ejY5TkQF7g96ggyY7SLnV H4YJ9KyJA2/9wcxQcb+FlupfIzrx3DvQYSY5dEXr/JN36hvxxDNJote7jo8T+/55O1PG WZndJWX+ximp4IvR5zbxDGmp/EwkdPan9WbbMJcpBW8WQqorBX9Dsw3Jx6o37yLjZPPW Glh3IYNb8iK5j5NbPSQBz8o24m+8GH+nJC4cqxtPILOw/nxZ4aRaCC8vAuzRVjK6AAYy hMAg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=WULRPvLr; 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 vv23-20020a05620a563700b00774182478b5si3703289qkn.11.2023.10.21.23.12.27 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sat, 21 Oct 2023 23:12:27 -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=WULRPvLr; 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 1quRdW-0006tI-N2; Sun, 22 Oct 2023 02:08:30 -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 1quRdR-0006O9-FN for qemu-devel@nongnu.org; Sun, 22 Oct 2023 02:08:25 -0400 Received: from mail-pf1-x431.google.com ([2607:f8b0:4864:20::431]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1quRdN-000386-7j for qemu-devel@nongnu.org; Sun, 22 Oct 2023 02:08:25 -0400 Received: by mail-pf1-x431.google.com with SMTP id d2e1a72fcca58-6bd0e1b1890so1591571b3a.3 for ; Sat, 21 Oct 2023 23:08:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1697954896; x=1698559696; 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=pCRY2J/deckmDlj0QfEqXFX5UP12wnEnJ1cgBJhM2hU=; b=WULRPvLrkDWxaAgM84dg4lkATz25RybACs1zq1Z55X9XKQvt6hYpWuHWDi7NjTotwK CRaU685ft7xwnRcT2qE2AzT13Km21fWrFUtImEdfXuXOt7d22DTwZY4jBQ3QUaaJESxz GOPawGQY0Y4hJUcOxf3Jc+8LhckTng1esRam5hmssO15QxdjMBifDtZn6PAmemPofzyI 5gYxJBkkyq0j+S3eiXvUIGZAQimP0bEErGAS1TmPcJfIuU3InilImzt75uterNfs4p/5 wpLOqEsZTGwwRstS92GWbrLq6q27XsCRHzb6/RZ78DbZIPyU/e68BM1080X2TKFyAbJX wuNQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697954896; x=1698559696; 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=pCRY2J/deckmDlj0QfEqXFX5UP12wnEnJ1cgBJhM2hU=; b=FKlEOLGs3Gsg2Vb+S+aeyfVpZkYjiv82UiEYJT1qTOM4X3XPiDd/gZXQfD1CdJJL+H 4pcsXOoP7Y5oMQKUTVoUD1Z19Cbn9Bz7nUEKk5kph/FOhOP9HWnVADRLt3AoHGmvLRnF rEbult8VbLbShaaerKGKA+f+Pir7CWkRrpdOh6dVys4umwDiG2MQLldFwY/6rVVUsrlQ l9OBa0iObd3VtSLhAXHyXY3E2RynbzhIBSKmNPbfrtCdB/xUzI2mO92RMODKZQRLxEFm 8daPHrjGtRlFjZsZFX1mu5fr3OruO1J5ni0iKKTxh9fS+rYCOneTW1LuPHhW4w8enr59 XWFA== X-Gm-Message-State: AOJu0YyiN4LG8REOPLMataa0HPaDv02AlkghDAb8Fhb4mbyRUF1ih7pi FNs9/86d1lm6xfpgYb/w+YbWzT4TUis+GeSJ3c4= X-Received: by 2002:a05:6a21:8188:b0:14d:abc:73dc with SMTP id pd8-20020a056a21818800b0014d0abc73dcmr4193611pzb.32.1697954896109; Sat, 21 Oct 2023 23:08:16 -0700 (PDT) Received: from stoup.. ([71.212.149.95]) by smtp.gmail.com with ESMTPSA id li11-20020a170903294b00b001c444106bcasm3962919plb.46.2023.10.21.23.08.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 21 Oct 2023 23:08:15 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: mark.cave-ayland@ilande.co.uk Subject: [PATCH v4 88/90] target/sparc: Move FPACK16, FPACKFIX to decodetree Date: Sat, 21 Oct 2023 23:00:29 -0700 Message-Id: <20231022060031.490251-89-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231022060031.490251-1-richard.henderson@linaro.org> References: <20231022060031.490251-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::431; envelope-from=richard.henderson@linaro.org; helo=mail-pf1-x431.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 | 2 ++ target/sparc/translate.c | 55 ++++++++++++++++++++++++++++----------- 2 files changed, 42 insertions(+), 15 deletions(-) diff --git a/target/sparc/insns.decode b/target/sparc/insns.decode index 781c3cd7f7..18a840709f 100644 --- a/target/sparc/insns.decode +++ b/target/sparc/insns.decode @@ -344,6 +344,8 @@ FCMPEq 10 000 cc:2 110101 rs1:5 0 0101 0111 rs2:5 FMULD8SUx16 10 ..... 110110 ..... 0 0011 1000 ..... @r_r_r FMULD8ULx16 10 ..... 110110 ..... 0 0011 1001 ..... @r_r_r FPACK32 10 ..... 110110 ..... 0 0011 1010 ..... @r_r_r + FPACK16 10 ..... 110110 00000 0 0011 1011 ..... @r_r2 + FPACKFIX 10 ..... 110110 00000 0 0011 1101 ..... @r_r2 PDIST 10 ..... 110110 ..... 0 0011 1110 ..... @r_r_r FALIGNDATAg 10 ..... 110110 ..... 0 0100 1000 ..... @r_r_r diff --git a/target/sparc/translate.c b/target/sparc/translate.c index ff849f33e4..286ae7fd42 100644 --- a/target/sparc/translate.c +++ b/target/sparc/translate.c @@ -752,6 +752,24 @@ static void gen_op_array32(TCGv dst, TCGv src1, TCGv src2) tcg_gen_shli_tl(dst, dst, 2); } +static void gen_op_fpack16(TCGv_i32 dst, TCGv_i64 src) +{ +#ifdef TARGET_SPARC64 + gen_helper_fpack16(dst, cpu_gsr, src); +#else + g_assert_not_reached(); +#endif +} + +static void gen_op_fpackfix(TCGv_i32 dst, TCGv_i64 src) +{ +#ifdef TARGET_SPARC64 + gen_helper_fpackfix(dst, cpu_gsr, src); +#else + g_assert_not_reached(); +#endif +} + static void gen_op_fpack32(TCGv_i64 dst, TCGv_i64 src1, TCGv_i64 src2) { #ifdef TARGET_SPARC64 @@ -4749,6 +4767,26 @@ TRANS(FABSs, ALL, do_ff, a, gen_op_fabss) TRANS(FSRCs, VIS1, do_ff, a, tcg_gen_mov_i32) TRANS(FNOTs, VIS1, do_ff, a, tcg_gen_not_i32) +static bool do_fd(DisasContext *dc, arg_r_r *a, + void (*func)(TCGv_i32, TCGv_i64)) +{ + TCGv_i32 dst; + TCGv_i64 src; + + if (gen_trap_ifnofpu(dc)) { + return true; + } + + dst = gen_dest_fpr_F(dc); + src = gen_load_fpr_D(dc, a->rs); + func(dst, src); + gen_store_fpr_F(dc, a->rd, dst); + return advance_pc(dc); +} + +TRANS(FPACK16, VIS1, do_fd, a, gen_op_fpack16) +TRANS(FPACKFIX, VIS1, do_fd, a, gen_op_fpackfix) + static bool do_env_ff(DisasContext *dc, arg_r_r *a, void (*func)(TCGv_i32, TCGv_env, TCGv_i32)) { @@ -5428,10 +5466,9 @@ static void disas_sparc_legacy(DisasContext *dc, unsigned int insn) } else if (xop == 0x36) { #ifdef TARGET_SPARC64 /* VIS */ - TCGv_i64 cpu_src1_64, cpu_dst_64; + TCGv_i64 cpu_dst_64; TCGv_i32 cpu_dst_32; int opf = GET_FIELD_SP(insn, 5, 13); - int rs2 = GET_FIELD(insn, 27, 31); int rd = GET_FIELD(insn, 2, 6); if (gen_trap_ifnofpu(dc)) { @@ -5514,21 +5551,9 @@ static void disas_sparc_legacy(DisasContext *dc, unsigned int insn) case 0x02a: /* VIS I fcmpeq16 */ case 0x02c: /* VIS I fcmpgt32 */ case 0x02e: /* VIS I fcmpeq32 */ - g_assert_not_reached(); /* in decodetree */ case 0x03b: /* VIS I fpack16 */ - CHECK_FPU_FEATURE(dc, VIS1); - cpu_src1_64 = gen_load_fpr_D(dc, rs2); - cpu_dst_32 = gen_dest_fpr_F(dc); - gen_helper_fpack16(cpu_dst_32, cpu_gsr, cpu_src1_64); - gen_store_fpr_F(dc, rd, cpu_dst_32); - break; case 0x03d: /* VIS I fpackfix */ - CHECK_FPU_FEATURE(dc, VIS1); - cpu_src1_64 = gen_load_fpr_D(dc, rs2); - cpu_dst_32 = gen_dest_fpr_F(dc); - gen_helper_fpackfix(cpu_dst_32, cpu_gsr, cpu_src1_64); - gen_store_fpr_F(dc, rd, cpu_dst_32); - break; + g_assert_not_reached(); /* in decodetree */ case 0x060: /* VIS I fzero */ CHECK_FPU_FEATURE(dc, VIS1); cpu_dst_64 = gen_dest_fpr_D(dc, rd); From patchwork Sun Oct 22 06:00:30 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 737011 Delivered-To: patch@linaro.org Received: by 2002:adf:dd81:0:b0:32d:baff:b0ca with SMTP id x1csp1006751wrl; Sat, 21 Oct 2023 23:16:35 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGkKt2sW6cQgRMl7Wmd56PYZ90lwtUO3RniaKQY2nsAYMhZJ3eQeU8rw6mrNhlRdUxdQQMj X-Received: by 2002:ad4:5bc3:0:b0:66d:a1f6:644e with SMTP id t3-20020ad45bc3000000b0066da1f6644emr3479319qvt.27.1697955395606; Sat, 21 Oct 2023 23:16:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697955395; cv=none; d=google.com; s=arc-20160816; b=IRepcnxuy9lSe+DipbKeo9bMzAjUIZEiPhElo5tSStSoUoOxGMslI7Ucx2b4MwXIec Su67Yja3zd/mGx336Eo3R22YJp52CMLfb29VK7Nv9YY2XDL21EQUIaN5KFmMBGEH1XrN 0Zo6Y6M+0uD01PwM0ZnFLYpq64I8S1duaSMjuzdQXatT1escp9ROKUOGhRQNlkm5E6Fi RDVfGBt78GqLAH9QR5laxbO9Ychc2oJghM6MzHamfwkMGDXDV8K739RmoNciuR/LYYdB v76kx+H7v2ObxNkX6ks35ogw7u6OwDJ4JqECQSnKgEDjHTRZ/1PHVmWoAid9BFh86sL3 rgZQ== 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=SBrTE3szdTliNMriMX1nfsISvxX2VppII5zGbDLPDys=; fh=TYrED6TOMxGX0VC4GtjviASLbYyJe19+7/tKWjN44KQ=; b=mHqw4zlwuD1SFyauc1u3/t7ixBw86jD0i7urvD4Xsthj7Whv4XH9nwBH5kAviJ96J7 j65mKtbgUD5ecV8ENDFKhtjUt+d8Kup8bV0gl1nu2DBOhNC9x1mkMI/PGOvxRYbF79YN Py+PXSqROpdcITe7GK+B5/fRYzIlQARDKj93Z8L1SmIMjiDjQBImz5mblW1XuRDmr2as hxbZR2h7/gceJqBh1nOnUoI979MBW8/X3LNcsjfDyrGMoTHwWmbOF9tOC8CzUS27Ep1q lxm7y24F8bY8NUF+sGikMFNJ3o6t5kkJJ+Ee3Oqir9zq6pMaTHzrhIadxVBG9CNdrVkN tVJg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=fiM7bJN2; 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 bu12-20020ad455ec000000b0066d14c995e7si3881259qvb.359.2023.10.21.23.16.35 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sat, 21 Oct 2023 23:16:35 -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=fiM7bJN2; 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 1quRdX-000737-TU; Sun, 22 Oct 2023 02:08:31 -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 1quRdT-0006Wm-94 for qemu-devel@nongnu.org; Sun, 22 Oct 2023 02:08:27 -0400 Received: from mail-pj1-x1033.google.com ([2607:f8b0:4864:20::1033]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1quRdN-00038C-82 for qemu-devel@nongnu.org; Sun, 22 Oct 2023 02:08:26 -0400 Received: by mail-pj1-x1033.google.com with SMTP id 98e67ed59e1d1-27cfb8bc7eeso1763987a91.0 for ; Sat, 21 Oct 2023 23:08:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1697954897; x=1698559697; 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=SBrTE3szdTliNMriMX1nfsISvxX2VppII5zGbDLPDys=; b=fiM7bJN2QShjEh69Vgb0iV1aHi9y8AX5B5etNfnd82Kl/J+v0mckeEDrUj/FzBRVpa Ftlhudxa3H3j5DKErNfgyX0I/XmzQaVgCtrcqeDe46RxK25xsO7oJztkhtwvmQcvAJ3v 5nzJa6/kppnBpTzcW/GZEzmJTOda1xFVOoVYE0VDSaJiRuFEbNokakX+ceVGvh3wAFEb ECwnp/+W0qBqPO3/DgNyFZoi+P6da0scyznAmN5EcdD1UiGdSve0R2yBDsysCRgEqwRo 8xZ2Q8U4Ei6bM/h5IL/ApUlUIuuW449g6+FshmnqFxk2gHxhdqLWVQciG2D3zXxG+D62 G0Fg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697954897; x=1698559697; 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=SBrTE3szdTliNMriMX1nfsISvxX2VppII5zGbDLPDys=; b=FIy5UaMgjz0st36J3avZNTcGvF5OkKXVED6VM5ADiMh5vJYXTnfafLHgJOqmp/D3aj j2CFm3ysWHw4zYyYNzV+NlfX7RcUbAhVh1K5ld/MtizgPzy5q9EPdmrckq/lLHqr46jg CA1Unwmltiw2Cy2eMxcEvIwNDm48BHe87LN7QZ2lA85eGW7txm6NvjUW4R+wkPsyfWLD GglKkb61uIFqhksC2oVYohqotVXzz5pTukGUh2L8BN4bYvSMm0RukseLZs4HwOZEcRQt FrCdBM51puSbkLL3sU6/mqdgcy2FmBnVWiY8PdalfTq1bD3QCEWN3E8t4b0UH8O1FXZR 8NUA== X-Gm-Message-State: AOJu0YxDv8uLR3lkSMvcJS/t4sTnPiXxrRk/sPWqR1ows6krnh2pOamX n7Hb+Jvd1WNdXdGmhH0R3e+b9FFd2JNQpncmxwg= X-Received: by 2002:a17:90b:1d09:b0:27d:48e1:d1e8 with SMTP id on9-20020a17090b1d0900b0027d48e1d1e8mr5575647pjb.13.1697954896802; Sat, 21 Oct 2023 23:08:16 -0700 (PDT) Received: from stoup.. ([71.212.149.95]) by smtp.gmail.com with ESMTPSA id li11-20020a170903294b00b001c444106bcasm3962919plb.46.2023.10.21.23.08.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 21 Oct 2023 23:08:16 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: mark.cave-ayland@ilande.co.uk Subject: [PATCH v4 89/90] target/sparc: Convert FZERO, FONE to decodetree Date: Sat, 21 Oct 2023 23:00:30 -0700 Message-Id: <20231022060031.490251-90-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231022060031.490251-1-richard.henderson@linaro.org> References: <20231022060031.490251-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::1033; envelope-from=richard.henderson@linaro.org; helo=mail-pj1-x1033.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 | 5 +++ target/sparc/translate.c | 69 +++++++++++++++++++++++---------------- 2 files changed, 45 insertions(+), 29 deletions(-) diff --git a/target/sparc/insns.decode b/target/sparc/insns.decode index 18a840709f..0552f1447d 100644 --- a/target/sparc/insns.decode +++ b/target/sparc/insns.decode @@ -391,6 +391,11 @@ FCMPEq 10 000 cc:2 110101 rs1:5 0 0101 0111 rs2:5 FORNOTs 10 ..... 110110 ..... 0 0111 1011 ..... @r_r_r_swap # ... 1s FORd 10 ..... 110110 ..... 0 0111 1100 ..... @r_r_r FORs 10 ..... 110110 ..... 0 0111 1101 ..... @r_r_r + + FZEROd 10 rd:5 110110 00000 0 0110 0000 00000 + FZEROs 10 rd:5 110110 00000 0 0110 0001 00000 + FONEd 10 rd:5 110110 00000 0 0111 1110 00000 + FONEs 10 rd:5 110110 00000 0 0111 1111 00000 ] NCP 10 ----- 110110 ----- --------- ----- # v8 CPop1 } diff --git a/target/sparc/translate.c b/target/sparc/translate.c index 286ae7fd42..a3815619fe 100644 --- a/target/sparc/translate.c +++ b/target/sparc/translate.c @@ -4746,6 +4746,45 @@ static bool do_stfsr(DisasContext *dc, arg_r_r_ri *a, MemOp mop) TRANS(STFSR, ALL, do_stfsr, a, MO_TEUL) TRANS(STXFSR, 64, do_stfsr, a, MO_TEUQ) +static bool do_fc(DisasContext *dc, int rd, bool c) +{ + uint64_t mask; + + if (gen_trap_ifnofpu(dc)) { + return true; + } + + if (rd & 1) { + mask = MAKE_64BIT_MASK(0, 32); + } else { + mask = MAKE_64BIT_MASK(32, 32); + } + if (c) { + tcg_gen_ori_i64(cpu_fpr[rd / 2], cpu_fpr[rd / 2], mask); + } else { + tcg_gen_andi_i64(cpu_fpr[rd / 2], cpu_fpr[rd / 2], ~mask); + } + gen_update_fprs_dirty(dc, rd); + return advance_pc(dc); +} + +TRANS(FZEROs, VIS1, do_fc, a->rd, 0) +TRANS(FONEs, VIS1, do_fc, a->rd, 1) + +static bool do_dc(DisasContext *dc, int rd, int64_t c) +{ + if (gen_trap_ifnofpu(dc)) { + return true; + } + + tcg_gen_movi_i64(cpu_fpr[rd / 2], c); + gen_update_fprs_dirty(dc, rd); + return advance_pc(dc); +} + +TRANS(FZEROd, VIS1, do_dc, a->rd, 0) +TRANS(FONEd, VIS1, do_dc, a->rd, -1) + static bool do_ff(DisasContext *dc, arg_r_r *a, void (*func)(TCGv_i32, TCGv_i32)) { @@ -5466,10 +5505,7 @@ static void disas_sparc_legacy(DisasContext *dc, unsigned int insn) } else if (xop == 0x36) { #ifdef TARGET_SPARC64 /* VIS */ - TCGv_i64 cpu_dst_64; - TCGv_i32 cpu_dst_32; int opf = GET_FIELD_SP(insn, 5, 13); - int rd = GET_FIELD(insn, 2, 6); if (gen_trap_ifnofpu(dc)) { goto jmp_insn; @@ -5553,31 +5589,11 @@ static void disas_sparc_legacy(DisasContext *dc, unsigned int insn) case 0x02e: /* VIS I fcmpeq32 */ case 0x03b: /* VIS I fpack16 */ case 0x03d: /* VIS I fpackfix */ - g_assert_not_reached(); /* in decodetree */ case 0x060: /* VIS I fzero */ - CHECK_FPU_FEATURE(dc, VIS1); - cpu_dst_64 = gen_dest_fpr_D(dc, rd); - tcg_gen_movi_i64(cpu_dst_64, 0); - gen_store_fpr_D(dc, rd, cpu_dst_64); - break; case 0x061: /* VIS I fzeros */ - CHECK_FPU_FEATURE(dc, VIS1); - cpu_dst_32 = gen_dest_fpr_F(dc); - tcg_gen_movi_i32(cpu_dst_32, 0); - gen_store_fpr_F(dc, rd, cpu_dst_32); - break; case 0x07e: /* VIS I fone */ - CHECK_FPU_FEATURE(dc, VIS1); - cpu_dst_64 = gen_dest_fpr_D(dc, rd); - tcg_gen_movi_i64(cpu_dst_64, -1); - gen_store_fpr_D(dc, rd, cpu_dst_64); - break; case 0x07f: /* VIS I fones */ - CHECK_FPU_FEATURE(dc, VIS1); - cpu_dst_32 = gen_dest_fpr_F(dc); - tcg_gen_movi_i32(cpu_dst_32, -1); - gen_store_fpr_F(dc, rd, cpu_dst_32); - break; + g_assert_not_reached(); /* in decodetree */ case 0x080: /* VIS I shutdown */ case 0x081: /* VIS II siam */ // XXX @@ -5602,11 +5618,6 @@ static void disas_sparc_legacy(DisasContext *dc, unsigned int insn) illegal_insn: gen_exception(dc, TT_ILL_INSN); return; -#ifdef TARGET_SPARC64 - nfpu_insn: - gen_op_fpexception_im(dc, FSR_FTT_UNIMPFPOP); - return; -#endif } static void sparc_tr_init_disas_context(DisasContextBase *dcbase, CPUState *cs) From patchwork Sun Oct 22 06:00:31 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 737012 Delivered-To: patch@linaro.org Received: by 2002:adf:dd81:0:b0:32d:baff:b0ca with SMTP id x1csp1006759wrl; Sat, 21 Oct 2023 23:16:37 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEN7iyu9I25v4D2dl/OHxBO0ZJhgziUyJzEP+xcO9OHUVJNguLDDBLmyALPSG37fcVynIb5 X-Received: by 2002:ac8:5989:0:b0:403:b12b:908d with SMTP id e9-20020ac85989000000b00403b12b908dmr7516520qte.8.1697955397575; Sat, 21 Oct 2023 23:16:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697955397; cv=none; d=google.com; s=arc-20160816; b=DP/wrkDBQ29W0l9YNSOpQ8Kjk4CclufOL/JxSLNRVtk3BOLF3hEcmVMeMbulXidY0j cGXfvDLlFBI0t+Vb14LpQcE7GpxvBXjNJEBGBJChtCwTlnZ+FJ7qjxQH/AUtUZDmKCll Q+oewmAXLgt2E8pVQQ+PgWRhSMujNihrfhb1zSZSm8B2MVr1GxmxK3C8N0ccnzKN2PJs pSrYsKzHJP538ZKz9bImnufghiZ8aqhNDCw6IawJkPvquvcZ14YWrT4OG4mqKns4b7sP 4XCz7VnRHhjJuaQgnAddni4S9fPuVsq3VtzWXqPbvLSvvKroqcrWaSKyh5zsJ/HQOg/Z jLig== 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=LusnAoRsYKsmYONuAznksrKN7X9ceydDlN1qlDp2nBE=; fh=TYrED6TOMxGX0VC4GtjviASLbYyJe19+7/tKWjN44KQ=; b=ywYek4eoqLiYvhEd6vfQ8iIPhtNCOujCB8x2mL8QQGkG056phoONz8/Ty+iZrwO3Eo OhnCX0sqrWYm2xpRlHu6IMzzGMVgVv5LsyaCIH5v2H6+yqL1P1rtokE31zanHwCZC5of GBpxo0urW9upsb4puXZPJvETxHVJ1kIMbBMZ6qelFevy6FqHdQPT5yVClRvEfeyfUSqh Qz5tKgQwl59wP/y//O354kH9zF5q2PxPGE7Wdm0TMlqR2lF11t6pgRgEOn2zCUTA5bUz AcTKsajiw/AANTFMwRtwfUZlQ579i1KK/C96GGPcVQvvZP9AojCUH+6A5YYo+z3/OVv5 H+pA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=ffA1strt; 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 o9-20020a05622a138900b00417d78906c7si3862191qtk.292.2023.10.21.23.16.37 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sat, 21 Oct 2023 23:16:37 -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=ffA1strt; 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 1quRdT-0006VN-5T; Sun, 22 Oct 2023 02:08:27 -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 1quRdQ-0006IY-1k for qemu-devel@nongnu.org; Sun, 22 Oct 2023 02:08:24 -0400 Received: from mail-oi1-x22a.google.com ([2607:f8b0:4864:20::22a]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1quRdN-00038Q-7m for qemu-devel@nongnu.org; Sun, 22 Oct 2023 02:08:23 -0400 Received: by mail-oi1-x22a.google.com with SMTP id 5614622812f47-3b40d5ea323so71120b6e.0 for ; Sat, 21 Oct 2023 23:08:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1697954897; x=1698559697; 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=LusnAoRsYKsmYONuAznksrKN7X9ceydDlN1qlDp2nBE=; b=ffA1strt0g0ey4M+xzSKdjNKS/hwzn2T+C3ma+muuXJkMGPV2qHThYSM/EdSTPm8ph GTA1nBV9zP/fJwRvn06shZAJQcqXiB2nAecuyYkmI864LEt7HhacihKi1Z494/jFc+jW UeZX6XZWg9t97VAZvUTTqwqQVFdNY8Cy4cRajm8XIGKSpYqfWsLt8XmrBGbgY9EyxRFB r8oTKwYKLvhVIXSNEKBubKEOgU4CkjqQkLJSGEUpKNjg2XHRxSInFBhCP4a1i7eFkzLx R71wWbNLCyVedXWk70TJRFJY09VVxy8rBS/BTECz+Qy8FPqJe9krGPWcLXVJBCODEjD2 mP8A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697954898; x=1698559698; 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=LusnAoRsYKsmYONuAznksrKN7X9ceydDlN1qlDp2nBE=; b=dLuetmVa9fU+PO/nfoP/GUFrIiuAPDyTwQLz6/YE0RgfQWjf/64m0tEON4Opq5VhcK gsQNyBrg7JxrginxevE0gVbynz0v2QlKHUlIdqUvC/MXm58Kb9EJGDN68jrD86FJs8hE UpiUruagEHgnKePwMIGFPbS9a+KG6Ox8D6FeMRhEtrdmKbTv2dMQpp7Sd60HojdskiUE Y7/DOwiul5EITjlFsjPC0eyW/jOkNYfzyGhAXga0eNEEdBWQEl6toFZi5VMfjgihBKCm 2/5Utdvo+wpY8QatFqfnZn0vsrBIZfPJNI0NqzSTp4K1nMyCiKvJXwGpsQB3qP4l1PMC TYaQ== X-Gm-Message-State: AOJu0YxbA1bwBEuGHOICS06MZzLUEWh8W6l1bWr/GxUSB7+U4Np1pHKG 0+DqbqGNlA+EK5qXY8TQ9ICIyVNaI1/LqdTom9o= X-Received: by 2002:a05:6808:1a01:b0:3b2:e25d:9768 with SMTP id bk1-20020a0568081a0100b003b2e25d9768mr7998690oib.53.1697954897628; Sat, 21 Oct 2023 23:08:17 -0700 (PDT) Received: from stoup.. ([71.212.149.95]) by smtp.gmail.com with ESMTPSA id li11-20020a170903294b00b001c444106bcasm3962919plb.46.2023.10.21.23.08.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 21 Oct 2023 23:08:17 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: mark.cave-ayland@ilande.co.uk Subject: [PATCH v4 90/90] target/sparc: Remove disas_sparc_legacy Date: Sat, 21 Oct 2023 23:00:31 -0700 Message-Id: <20231022060031.490251-91-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231022060031.490251-1-richard.henderson@linaro.org> References: <20231022060031.490251-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::22a; envelope-from=richard.henderson@linaro.org; helo=mail-oi1-x22a.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 All instructions are now converted. Signed-off-by: Richard Henderson --- target/sparc/translate.c | 145 +-------------------------------------- 1 file changed, 1 insertion(+), 144 deletions(-) diff --git a/target/sparc/translate.c b/target/sparc/translate.c index a3815619fe..d4468f6673 100644 --- a/target/sparc/translate.c +++ b/target/sparc/translate.c @@ -5477,149 +5477,6 @@ static bool do_fcmpq(DisasContext *dc, arg_FCMPq *a, bool e) TRANS(FCMPq, ALL, do_fcmpq, a, false) TRANS(FCMPEq, ALL, do_fcmpq, a, true) -#define CHECK_IU_FEATURE(dc, FEATURE) \ - if (!((dc)->def->features & CPU_FEATURE_ ## FEATURE)) \ - goto illegal_insn; -#define CHECK_FPU_FEATURE(dc, FEATURE) \ - if (!((dc)->def->features & CPU_FEATURE_ ## FEATURE)) \ - goto nfpu_insn; - -/* before an instruction, dc->pc must be static */ -static void disas_sparc_legacy(DisasContext *dc, unsigned int insn) -{ - unsigned int opc = GET_FIELD(insn, 0, 1); - - switch (opc) { - case 0: - goto illegal_insn; /* in decodetree */ - case 1: - g_assert_not_reached(); /* in decodetree */ - case 2: /* FPU & Logical Operations */ - { - unsigned int xop = GET_FIELD(insn, 7, 12); - - if (xop == 0x34) { /* FPU Operations */ - goto illegal_insn; /* in decodetree */ - } else if (xop == 0x35) { /* FPU Operations */ - goto illegal_insn; /* in decodetree */ - } else if (xop == 0x36) { -#ifdef TARGET_SPARC64 - /* VIS */ - int opf = GET_FIELD_SP(insn, 5, 13); - - if (gen_trap_ifnofpu(dc)) { - goto jmp_insn; - } - - switch (opf) { - case 0x000: /* VIS I edge8cc */ - case 0x001: /* VIS II edge8n */ - case 0x002: /* VIS I edge8lcc */ - case 0x003: /* VIS II edge8ln */ - case 0x004: /* VIS I edge16cc */ - case 0x005: /* VIS II edge16n */ - case 0x006: /* VIS I edge16lcc */ - case 0x007: /* VIS II edge16ln */ - case 0x008: /* VIS I edge32cc */ - case 0x009: /* VIS II edge32n */ - case 0x00a: /* VIS I edge32lcc */ - case 0x00b: /* VIS II edge32ln */ - case 0x010: /* VIS I array8 */ - case 0x012: /* VIS I array16 */ - case 0x014: /* VIS I array32 */ - case 0x018: /* VIS I alignaddr */ - case 0x01a: /* VIS I alignaddrl */ - case 0x019: /* VIS II bmask */ - case 0x067: /* VIS I fnot2s */ - case 0x06b: /* VIS I fnot1s */ - case 0x075: /* VIS I fsrc1s */ - case 0x079: /* VIS I fsrc2s */ - case 0x066: /* VIS I fnot2 */ - case 0x06a: /* VIS I fnot1 */ - case 0x074: /* VIS I fsrc1 */ - case 0x078: /* VIS I fsrc2 */ - case 0x051: /* VIS I fpadd16s */ - case 0x053: /* VIS I fpadd32s */ - case 0x055: /* VIS I fpsub16s */ - case 0x057: /* VIS I fpsub32s */ - case 0x063: /* VIS I fnors */ - case 0x065: /* VIS I fandnot2s */ - case 0x069: /* VIS I fandnot1s */ - case 0x06d: /* VIS I fxors */ - case 0x06f: /* VIS I fnands */ - case 0x071: /* VIS I fands */ - case 0x073: /* VIS I fxnors */ - case 0x077: /* VIS I fornot2s */ - case 0x07b: /* VIS I fornot1s */ - case 0x07d: /* VIS I fors */ - case 0x050: /* VIS I fpadd16 */ - case 0x052: /* VIS I fpadd32 */ - case 0x054: /* VIS I fpsub16 */ - case 0x056: /* VIS I fpsub32 */ - case 0x062: /* VIS I fnor */ - case 0x064: /* VIS I fandnot2 */ - case 0x068: /* VIS I fandnot1 */ - case 0x06c: /* VIS I fxor */ - case 0x06e: /* VIS I fnand */ - case 0x070: /* VIS I fand */ - case 0x072: /* VIS I fxnor */ - case 0x076: /* VIS I fornot2 */ - case 0x07a: /* VIS I fornot1 */ - case 0x07c: /* VIS I for */ - case 0x031: /* VIS I fmul8x16 */ - case 0x033: /* VIS I fmul8x16au */ - case 0x035: /* VIS I fmul8x16al */ - case 0x036: /* VIS I fmul8sux16 */ - case 0x037: /* VIS I fmul8ulx16 */ - case 0x038: /* VIS I fmuld8sux16 */ - case 0x039: /* VIS I fmuld8ulx16 */ - case 0x04b: /* VIS I fpmerge */ - case 0x04d: /* VIS I fexpand */ - case 0x03e: /* VIS I pdist */ - case 0x03a: /* VIS I fpack32 */ - case 0x048: /* VIS I faligndata */ - case 0x04c: /* VIS II bshuffle */ - case 0x020: /* VIS I fcmple16 */ - case 0x022: /* VIS I fcmpne16 */ - case 0x024: /* VIS I fcmple32 */ - case 0x026: /* VIS I fcmpne32 */ - case 0x028: /* VIS I fcmpgt16 */ - case 0x02a: /* VIS I fcmpeq16 */ - case 0x02c: /* VIS I fcmpgt32 */ - case 0x02e: /* VIS I fcmpeq32 */ - case 0x03b: /* VIS I fpack16 */ - case 0x03d: /* VIS I fpackfix */ - case 0x060: /* VIS I fzero */ - case 0x061: /* VIS I fzeros */ - case 0x07e: /* VIS I fone */ - case 0x07f: /* VIS I fones */ - g_assert_not_reached(); /* in decodetree */ - case 0x080: /* VIS I shutdown */ - case 0x081: /* VIS II siam */ - // XXX - goto illegal_insn; - default: - goto illegal_insn; - } -#endif - } else { - goto illegal_insn; /* in decodetree */ - } - } - break; - case 3: /* load/store instructions */ - goto illegal_insn; /* in decodetree */ - } - advance_pc(dc); -#ifdef TARGET_SPARC64 - jmp_insn: -#endif - return; - illegal_insn: - gen_exception(dc, TT_ILL_INSN); - return; -} - static void sparc_tr_init_disas_context(DisasContextBase *dcbase, CPUState *cs) { DisasContext *dc = container_of(dcbase, DisasContext, base); @@ -5687,7 +5544,7 @@ static void sparc_tr_translate_insn(DisasContextBase *dcbase, CPUState *cs) dc->base.pc_next += 4; if (!decode(dc, insn)) { - disas_sparc_legacy(dc, insn); + gen_exception(dc, TT_ILL_INSN); } if (dc->base.is_jmp == DISAS_NORETURN) {