From patchwork Sat Oct 21 05:30: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: 736622 Delivered-To: patch@linaro.org Received: by 2002:adf:dd81:0:b0:32d:baff:b0ca with SMTP id x1csp632558wrl; Fri, 20 Oct 2023 22:35:38 -0700 (PDT) X-Google-Smtp-Source: AGHT+IG+SXtZI5LiX2FQUt04ddkT+vptd5aqo2hnazYPh4vU2JbVGkskSD4DRwOxiyFqb/U0xjFT X-Received: by 2002:a05:620a:2606:b0:777:2723:ea77 with SMTP id z6-20020a05620a260600b007772723ea77mr3695680qko.65.1697866538162; Fri, 20 Oct 2023 22:35:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697866538; cv=none; d=google.com; s=arc-20160816; b=TkrMT1tUYxr5Lm89qGiQj9Py/Bpg+DBEnW5xYx3CpfURSSJCa6xORU8itBa597m4wY WhrxhfqivPAQH1bZlrkBP8uMhuR29MSkk/Op4NZmDbSw9sV6SjScEJixxjKZnbA0u/G3 zG0xaPYrpAadfmLQ30Ce7+h6cUnM1EMtLYLuHIYTLuF+h8G4AmcAnkXc2St9xc6nWyiw vyD9AWBui+BwZdTsgKDEncMbGeFrj6DuGXORzuPWkVLBu8eLqM6RrOa+rG9wkzuZiyL6 mvzacHId23kAr0tDe7fSe5OqvFgXTk/L3QuQLMM9QYUC3u7UHHox/H7g99YL26lFDr0w aDig== 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=zlol6X30fEZSgkhK00p7C+1htVj9eDCSnBjYrJFY7V7Wt5VHqQvHs4H9pwpZsZG79j D37iJLQIR2PVh0XNb6YreZtX3MRNQvDO9iieD40tbhiM/hwePR9KKEC9ghuLHiBqV6Ja Vrhm7DdkcdBQNU3M9cv7h5yB9Gk1r4wJ7P3gBiWsH2TPSrk3lnKSXJ/K1HU9Sy/sQdWm H747MYbL5Jm0u1OvKIvTEROCb+cfpGSMtTRYtbbHq6kxSxP9vkLo7Ra49vRnQ9GYASrh FcHbEav0YQiO49GkPZcfwOpBseoMsqbRxxt5Oq/E/sRmXBO2gCOfHKoGJHt0EEcgS3mw tdag== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=JqViEC0E; 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 a14-20020a05620a102e00b007758e5534e7si2295595qkk.781.2023.10.20.22.35.38 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 20 Oct 2023 22:35: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=JqViEC0E; 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 1qu4ai-00074G-Ev; Sat, 21 Oct 2023 01:32: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 1qu4ah-00073w-GA for qemu-devel@nongnu.org; Sat, 21 Oct 2023 01:32:03 -0400 Received: from mail-oa1-x2c.google.com ([2001:4860:4864:20::2c]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qu4af-0008Jy-OD for qemu-devel@nongnu.org; Sat, 21 Oct 2023 01:32:03 -0400 Received: by mail-oa1-x2c.google.com with SMTP id 586e51a60fabf-1e9ac336589so1082081fac.1 for ; Fri, 20 Oct 2023 22:32:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1697866320; x=1698471120; 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=JqViEC0EYu1V826KiMAbbvBls7T6KkCdJKPpmzfHT0gqlxmdA2kLc6myhDFsyA9nIZ dQgkTeLi8KGFfZrDhKae0fy83CsvIYROagWIHX2xEpwbTQm4vQWC4HyXI/HKuVkrvRb1 HkJ37oHnKcyMpnHlIJXOTUJur6M4o9NIsgxGHRncrB8Pp3od0kkJVmrd+TkuRk5o4e8v PDrdV2cl1LNsaTwZtO0uEJgeaUAfwnoDDkyz2268E161VGhDEUl4TQRNDX5AHF/njYxG bBZC05eSfLgGt0tuD+O1BuJpYA3H4lu82TpPBMg0OdotmYVNbyfIU8a4qvnm8JMeQZDf rg9Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697866320; x=1698471120; 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=b8Kbat9eMN3use2EFC83rZYpgAUrm2u3ey/D6Xan7wtktC7YzKJZUmf+L/E2bMTOra sBR7pXdRIWcCIdd1Ozs7alR5ITnh6qZmKuNZHUIlryVW129nHfKVJKytZxqb4bioJhkG SGHdjytLgcvu1hkuw7NOflFLOK4vitVtyX/FPc08vsafFLoRDypULrRLDOyrZj3tS8L6 byCtMTsPcy/5FLkpZHtbMdFL7Unvsfe/hUX8ghsKFPCtkjkFb/aptfcE318DybSGIF0A oy8/SZgh71yqtj/Sjeab2V8Fg5TX6PTsf6PG9VJ6d27J4f6tVWM1Tlb6SfSzN7r4bLXZ dGUg== X-Gm-Message-State: AOJu0Yy4UdrN5O5r5i46m5Urcdu9SL8FCkxId+ZwcGHejLrzhKfyH5fO QjOoS3nWTLx/eaFTT8u/5cLCTgXRQx+XDA/OAzI= X-Received: by 2002:a05:6870:219d:b0:1e9:87c0:a849 with SMTP id l29-20020a056870219d00b001e987c0a849mr4586031oae.22.1697866320456; Fri, 20 Oct 2023 22:32:00 -0700 (PDT) Received: from stoup.. ([71.212.149.95]) by smtp.gmail.com with ESMTPSA id f20-20020a056a001ad400b006b2677d3684sm2434831pfv.206.2023.10.20.22.31.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 20 Oct 2023 22:32:00 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: mark.cave-ayland@ilande.co.uk, qemu-stable@nongnu.org Subject: [PATCH v3 01/90] target/sparc: Clear may_lookup for npc == DYNAMIC_PC Date: Fri, 20 Oct 2023 22:30:29 -0700 Message-Id: <20231021053158.278135-2-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231021053158.278135-1-richard.henderson@linaro.org> References: <20231021053158.278135-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2001:4860:4864:20::2c; envelope-from=richard.henderson@linaro.org; helo=mail-oa1-x2c.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 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 Sat Oct 21 05:30: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: 736603 Delivered-To: patch@linaro.org Received: by 2002:adf:dd81:0:b0:32d:baff:b0ca with SMTP id x1csp631874wrl; Fri, 20 Oct 2023 22:32:49 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGojyTNxUiwynq9MpoGYGf+xZkXhIOJwpnjLkgOx1hgifP83YPkv86XmwqSof2tg1AsgvRs X-Received: by 2002:ac8:5c4d:0:b0:418:19c6:c22c with SMTP id j13-20020ac85c4d000000b0041819c6c22cmr4079829qtj.68.1697866369062; Fri, 20 Oct 2023 22:32:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697866369; cv=none; d=google.com; s=arc-20160816; b=R+vZ3Vbt3bIu9aJvkhsafcl/XgDFwauNBij6M60VRsidMManOcF4t0LI9jBTOb0SJY rl2e2zRSUH6TQP1WQa8lIHuDDBIMOnGxp9n0tOxh/3htbC3kGPJuA5/H6FYBjhgjXp1i rwoch3SJdr0szgX3Q44oUNnAunTZvYthRjMuZR8Ah/9F1CkrqkqpTuL8+ILqmPsJJBx9 aas7lHu7BVBs6kqJojmJ2JLfGpudM1feAzkkIZUeB1o6+LdhhBDKeVPjgzHaST1kMS66 jhCCylI0B/zae/supEeX0z8NNgmYUMYWbv9p+Xv+odLB+4o67RPLA/wUYUtkV0Nhuyg1 T2xw== 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=ew8uplhjFS9I2qi2N2/PQaw1Oxbgkv3Pju+p4UlmX4zKQVYdVdHKY8oOzZxL+VPLxc lJK5zFijdYPCIOtyngm9f17SDzECHpP2L0Tj7R99efz7aMvvJkdo3Eg8041HufztzY4H TF/GpgJdibwDWdOPRhghqj2M9p0/0sWkk470n/wuMDtIyQ/HGLu3/FvdLomsbikboe3Y Ww+N0T6LlETpwhsHsmO4+E0lwBoCJicXL/NI588ASxEOPpNwLsyRjRhPwok10P/zkLwC 1QoVbDXF8lT9YhvZByAmOu5vi2lJx/Szb4A6bYEa4wY3nFo2+uszRqCOD3DtM7JJ95J7 MAUQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=jJqXcvaI; 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 w3-20020a05622a134300b0041b7738953bsi2412564qtk.79.2023.10.20.22.32.48 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 20 Oct 2023 22:32:49 -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=jJqXcvaI; 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 1qu4ak-00075l-Sr; Sat, 21 Oct 2023 01:32: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 1qu4aj-00074d-3B for qemu-devel@nongnu.org; Sat, 21 Oct 2023 01:32:05 -0400 Received: from mail-qk1-x729.google.com ([2607:f8b0:4864:20::729]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qu4ag-0008KT-Q7 for qemu-devel@nongnu.org; Sat, 21 Oct 2023 01:32:04 -0400 Received: by mail-qk1-x729.google.com with SMTP id af79cd13be357-7741b18a06aso111463685a.1 for ; Fri, 20 Oct 2023 22:32:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1697866321; x=1698471121; 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=jJqXcvaIpp7ukY5LuaCRxsi8YVnw3S6nRyVoP73JaK8AYehKt/02BMKv95/qPiHPOY JacerVX+xzhdsnamYEmGRdiElhF9p7JY5IdQYQViIWheY/mz4f7R9DQ6sy4UR3ylbldT ea4LFjXmNIsigYatgRGL4jUPBnoqJxkNZj4BCGCdod3BIPKv5lyetfb1ILi0DFVq8wLB HbB+bFJwY0KNfUi228XaeWPc014Qqu67eg3ANxW/ANuPr+gVcEpjsuWZaWegqs7isHBk vQA2uMkB8baYcuHI6b1C11HI+1KLBZV9i3CpSGoQ2OnZaig21KloGpG179r5B3XdqXG4 4zCw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697866321; x=1698471121; 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=aCEi+1tqPwTvxisE/EJziTprcXCH+boEOXwy+lb1YAOMv0qIiP8Qf+STeq/Uj9NxsC K+V0KxLmFAXYGO+EgmZz/T+JZOMorH50FLbizCui6fn4ku+uX0oWv6aF4WAg0xMSe2/N YKCzWSosAv6W7gZsr8/Oi+QxoQQOvy/YoEBT7s8PwnqIHY0ae0TiK4usKPwQUT0TnhHt GsZ0vR3YzBoSY505+EC0S1a4zUGUcwkpCyA9hbEtz6oGQnUYILxTtl+IJ8N8Osx63M7X 320OLIt0d5IOhz2iuq9tg4LgQFR9OWpHOJ0Be+KZSH6lHLXGRkAr3WpWlL49jNd7HZXh xUYw== X-Gm-Message-State: AOJu0Ywl6HEAkGJniStdKc3A1lMdWNf+rjPdYuCU62tJYaAYCXhRMikM xhbGCvE0klROY2vFtdvVZ1g1/mVX3gSkNPG4IQk= X-Received: by 2002:a05:620a:450c:b0:778:92de:c50 with SMTP id t12-20020a05620a450c00b0077892de0c50mr4209444qkp.34.1697866321473; Fri, 20 Oct 2023 22:32:01 -0700 (PDT) Received: from stoup.. ([71.212.149.95]) by smtp.gmail.com with ESMTPSA id f20-20020a056a001ad400b006b2677d3684sm2434831pfv.206.2023.10.20.22.32.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 20 Oct 2023 22:32:01 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: mark.cave-ayland@ilande.co.uk Subject: [PATCH v3 02/90] target/sparc: Implement check_align inline Date: Fri, 20 Oct 2023 22:30:30 -0700 Message-Id: <20231021053158.278135-3-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231021053158.278135-1-richard.henderson@linaro.org> References: <20231021053158.278135-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::729; envelope-from=richard.henderson@linaro.org; helo=mail-qk1-x729.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 Sat Oct 21 05:30: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: 736601 Delivered-To: patch@linaro.org Received: by 2002:adf:dd81:0:b0:32d:baff:b0ca with SMTP id x1csp631869wrl; Fri, 20 Oct 2023 22:32:49 -0700 (PDT) X-Google-Smtp-Source: AGHT+IH1XCnyQUlTO9aErqQ+cM6B0qWB7YZ7xxiukhuOIYz0DdlrElUOE8ZyrDMRaXp2s6HHPJcS X-Received: by 2002:a05:620a:2686:b0:774:1d2c:c412 with SMTP id c6-20020a05620a268600b007741d2cc412mr3812831qkp.44.1697866368780; Fri, 20 Oct 2023 22:32:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697866368; cv=none; d=google.com; s=arc-20160816; b=Ag8MiCM3ZHdgLD64AzFOAFCd3KEzJgM4EONTz6WwOktyO11PiUnrg0u5vU1cWMGVGx osOQQejnFiQ89te6t9duBSpGkcLxIvYDby9EOhzMlI0T/yqEf/7G7L6clTSHAp/StjG2 GRQZvPAeCy+e34bvqnxlnGXLv43n7BsL+SWYAMNwIwT2hOy+oZlbyfnlGBxfA6ybVHGb jiCUDrlJzXwBiVsfvMj1YFvfpgyALZdPVQ6IaAfDBYcEvjgxFMItiBYFiOvCaPLteT5u jERI7oPi6M84dz7T/bSCZYo2lukuYdqRceDayf/0cJgWxWyXzj17oJXAR4bD2nQJt62r lKzA== 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=WKZLDbr8S6C9dw5Gq7r/PprIOzJ0Vd6wpM2/jcR+//eSKpmq3X27lRlO4F/ilRxKXg /rWlFJG0gc4L09mc/4+7u34UPMGc3JrIozw11EMUwUxYj9gaDGZr8G6LQkbJeDA9M2+U upkoLiatVVOnGvQHEHInt555cD4vsX4QUSSHDtZD1PdpZGEu7eJD94LZwD27FBmraZ3o Hbl4pipOoT432PMgKw0iRgVgbw0poIsDRkTBDDnFj4+Wgbqgo/AIYAb8zz5Gwp4+zeJo Q3XZNgdbp23mrXiJ6+FWJMu9SJGcn0hZBDV5StUZUrbnL2vGWLt8j/I6HmFeXpYzAyCF iRSA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=VQSp9eFc; 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 l18-20020a05620a211200b007765135d85bsi2208280qkl.591.2023.10.20.22.32.48 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 20 Oct 2023 22:32: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=VQSp9eFc; 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 1qu4al-00075s-NV; Sat, 21 Oct 2023 01:32:07 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qu4aj-00074f-9b for qemu-devel@nongnu.org; Sat, 21 Oct 2023 01:32: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 1qu4ah-0008Kc-IQ for qemu-devel@nongnu.org; Sat, 21 Oct 2023 01:32:05 -0400 Received: by mail-oi1-x232.google.com with SMTP id 5614622812f47-3af609c5736so1023087b6e.3 for ; Fri, 20 Oct 2023 22:32:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1697866322; x=1698471122; 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=VQSp9eFcQmDg/0hGE39bZLai9vnV783sa+qxUlTmR8kPT6gYM9LSapIB7Peuv/YYV9 5h9GRV2yKCW5a80MQlgc+lAZ9J2+VyKHUD7rQvibsL0dQkAq38hOSS8rNOTGAJRDRokv rWkbyJ4ABStFHh0eoP1CzxQ4EeTqmbCFzNgqzKkLmBI3LO7cb5iL3WUJw8umNHAKKS08 f8tCLdXukalGxYMFqUjLi/+++n0Sfkx8wgGcSagGKaS6HmoPPx/RnKd+equwzy6Idaiw 7vqg6x98Q+0Cg9EU6hQhJMByLV0+dHlZ9dCjCEeB2lJAwwIbuofbFebHqNVH5GaaOsBc 4m8g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697866322; x=1698471122; 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=SY8az4HUrB3KupMGYdx0RHxFmzEAlWJTsBF0Na6ykh2mh1Bsxjhg9NbxIlDLrS4Dp/ /z2w0M3zVtZdjon6qW52jfpgyaVZGBSfey4qXqWolwVWbgMsKvIHXu6IreV8h0C+8M7C z+QkLyeHnIGdPMKxVj0uIiiZr4fiAnp5phzwluw+9qnPdwssBXY2LnOYnlmxJVRWH2AA chhXD1lZP4u1eFAqJNzFCCQN7YTRCnlaSOqYxyaKl42BeUQT9wn9GYdRic9XilIbzGz2 qU2crj3VFcb93QP79ZmzTbt3DB30TnO0IPoFlj5HmiR6tFcMxVFv3kdZBp1j8Ay4yvPS iVyg== X-Gm-Message-State: AOJu0Yw6yX1bwMjatJQeH2HaqYSAsfviiKbDZDGqI5DKqC3KcEyvPMVN b7CZhQNITTPugjSLi8OQEW8CaYq2m32XUOjGdpQ= X-Received: by 2002:a05:6808:10d1:b0:3ad:f3e6:66f8 with SMTP id s17-20020a05680810d100b003adf3e666f8mr4233940ois.41.1697866322323; Fri, 20 Oct 2023 22:32:02 -0700 (PDT) Received: from stoup.. ([71.212.149.95]) by smtp.gmail.com with ESMTPSA id f20-20020a056a001ad400b006b2677d3684sm2434831pfv.206.2023.10.20.22.32.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 20 Oct 2023 22:32:01 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: mark.cave-ayland@ilande.co.uk Subject: [PATCH v3 03/90] target/sparc: Avoid helper_raise_exception in helper_st_asi Date: Fri, 20 Oct 2023 22:30:31 -0700 Message-Id: <20231021053158.278135-4-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231021053158.278135-1-richard.henderson@linaro.org> References: <20231021053158.278135-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 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 Sat Oct 21 05:30:32 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 736616 Delivered-To: patch@linaro.org Received: by 2002:adf:dd81:0:b0:32d:baff:b0ca with SMTP id x1csp632330wrl; Fri, 20 Oct 2023 22:34:41 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFLGbXPjDXyfA52wiO+/FMgYkeUJ7lrFjD2ThX9frkUk2QcBzdtwgjt+1pRDyhHBhjs8MLn X-Received: by 2002:a05:622a:1b9f:b0:417:bd2c:2683 with SMTP id bp31-20020a05622a1b9f00b00417bd2c2683mr3714444qtb.19.1697866481426; Fri, 20 Oct 2023 22:34:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697866481; cv=none; d=google.com; s=arc-20160816; b=tDHAzEOuJe90XZoWR9bCJX5fm6OJgTiuPqG3aEifcTuOwaoGkB+MWotCB6JKZs19Fm lDBDcGplT7XUtTlLbQaeZ3Hvi+OtGy9iNZMuka1T/uXGS3Y+fIx0cbx/xYtTwrcM5xsO GCPiKtrBKf/DPTHlnDF3ZdS+x//mo9W5S7xQYV+GfSjGEDuK0kE/bJciXZ0E6CAalgI7 EZAzXvqmO1BBHqVXUtwK4PmA+3L04GvnCdEla8e2zbzTl1o/Ohy7ZPH1tlx8mVGL3Zsf 6KQqnAq4Tccf+7N7Gt49olXupZMu6gC9FCN9QnOhLawLYokkiKTPwmrvNn9Mh5Ini7Sk dpjw== 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=rjizfVR7O8/IPQFBJgeF36wXK5a0Gf39ihqNTzHmP4YPr5JpJF5PQhEpP9fgZcb3uD fNhoUmSjJf5mxjmSrqrornr07gKRYNKYPZZ8JtCU/VyEwnKX+qRaJeUOdA3WwAHxlG/e JR6hWTRJJm7kU3qRP4YHqaWNJkt8sGhObfFO43Qx3COXaP4D5E01Aqahtcja2W1d7nEf aV2B7kgS+dks7qVNIEEDXCqoXlNUZjzx7U8Gs8cKQR69FkU+hUqf4UflC3fPdarFO59g KY5qLCbh9vcrcXWglIe6VtmidUs3D1iehKS6ephAr1dgE6c+diENIriovbeMZoV3aJsy 83pQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=xADKhV2V; 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 13-20020ac8590d000000b00419905d39e7si2425195qty.517.2023.10.20.22.34.41 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 20 Oct 2023 22:34: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=xADKhV2V; 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 1qu4am-00076Z-BE; Sat, 21 Oct 2023 01:32: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 1qu4ak-00075Q-EY for qemu-devel@nongnu.org; Sat, 21 Oct 2023 01:32:06 -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 1qu4ai-0008L9-Tb for qemu-devel@nongnu.org; Sat, 21 Oct 2023 01:32:06 -0400 Received: by mail-pf1-x42e.google.com with SMTP id d2e1a72fcca58-6b1ef786b7fso1417887b3a.3 for ; Fri, 20 Oct 2023 22:32:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1697866323; x=1698471123; 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=xADKhV2VxELIpOxFHCoqr4/QenlP+2qUPaSow2rcsfoiD8xwZozUIqsj4YqiAVueMY hHjsmNPV5EX6GhtAbw8siUrNA6OBsqHYx46BQjpP05UWeLnTSOClF9jlJpXR2KUv6dyp sXvXFadZ5ETCC2XUZmwM/xFLyVZ3cEWrVB+txu+kxGIh3ATJMyfYt18NI1rqmAn7vzd4 9nuKWr7am6sDtbEGucWej1vCYWa8d6jR7BxWtF74t2hj0z5XVO0VRsUFEx9o+iwKParD rZJAqHvTnzkxKLSiZOCfGX9MJseAkIi8HCnvvRt/n3jha9quRxjjUH+LVEIbwwn2LQ15 niRA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697866323; x=1698471123; 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=SY4rjRwCrD13KceL1u7mn9xoGM1H9Sae7WWZdkF3BZTZHM2C0mb4yrIh+eX8ZLWIVn 8aqbPOFqYFTelv6Egnt+F/4wXk64ei0tFAOC9bIfAzDNHEc8GkcHoN+miqqyDGPpja74 Ikv6OjL4oidYrVaoslKwI/BJWhQqpi4vXUv/GkbgOwQLrocdu6JKXzVi0ME1v3deMu8D fyJ0oRjpXUYPiu8keGp+0am7F13eZ4054O2sz7fQDSmM/lQvDg8VhXa3CNk67CKXIyXp /qvXAEXjr6Ija61QdugOMh3XaNsNTJ0WThlW/i7WnLJAlHcLtEFrakNJeYucYmk9ObLA Junw== X-Gm-Message-State: AOJu0YyDtZd23v9oNTeX/UZFBK50jrdlo9xeneH9Gp7wtzBR6hS7Tbs5 x68D9m3aggOVEdOmrLizUdrIjqMr0F5YKrUDTjI= X-Received: by 2002:a05:6a21:7882:b0:137:74f8:62ee with SMTP id bf2-20020a056a21788200b0013774f862eemr4712890pzc.18.1697866323366; Fri, 20 Oct 2023 22:32:03 -0700 (PDT) Received: from stoup.. ([71.212.149.95]) by smtp.gmail.com with ESMTPSA id f20-20020a056a001ad400b006b2677d3684sm2434831pfv.206.2023.10.20.22.32.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 20 Oct 2023 22:32:02 -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 v3 04/90] target/sparc: Set TCG_GUEST_DEFAULT_MO Date: Fri, 20 Oct 2023 22:30:32 -0700 Message-Id: <20231021053158.278135-5-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231021053158.278135-1-richard.henderson@linaro.org> References: <20231021053158.278135-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 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 Sat Oct 21 05:30: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: 736618 Delivered-To: patch@linaro.org Received: by 2002:adf:dd81:0:b0:32d:baff:b0ca with SMTP id x1csp632409wrl; Fri, 20 Oct 2023 22:34:57 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEB2B/fPzO5dVO+0GXYm18DKVh5r5gcapO27jGnAOFoynIQBICdgb2ZqEL4aGOq5J4mlnUX X-Received: by 2002:a05:620a:c52:b0:778:b0f5:d4ef with SMTP id u18-20020a05620a0c5200b00778b0f5d4efmr2637519qki.30.1697866497199; Fri, 20 Oct 2023 22:34:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697866497; cv=none; d=google.com; s=arc-20160816; b=ClKBCvUFJLqrP6r66BOjZttMlL0t+kY/UBCbEBTcKm3GktqsAmKMvQSdWDFusEz1jm iRj9EDtMPrsrQ1F2/5036eugTbyZepTC9ReAxJyYmcoyaJwv8hRnO6nlbgn/mUW4VfBB qgLwzq7pcCqF2g2vzij1ujZha0/zmlkLdOYgxSPG9rokatp6UIT01cfIj9LpJ/KDuetn ceeJzBCLgDYYRdJxb7YXVonFUAviEyDFrPt1TNHsos0v2/LZSDiaEmwotiLtj9OqumLi Hz0SDl1j6DQDSBbr/TCk3B8hZmKZpZ6vxK3MHgb95H09sTk+gv6+V+8bXNT2RKEPYvSL GbJQ== 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=vynb5dgIO8gxEzgyWV+tzUqTxjgqh5lJxKyPct55dDfo/qb0s0KHlSThH7X8EtCaol cIw8G2zhJBJZahpuTPZ+8gftIAWnnrGxBauK8cOiSGSSREel/36acvbk4jZcS7nEqQT0 GkODKGSFBv3XOhlXRNE1plR2m7RXS6Dkctaige84S7LLcscavv3n5QYb8ESj0tq74jGS eqF0eLHIJP5j+2e1QBP5rioie48ll0EA1AbFNhAFuSbEMpst/uO4WFBEGzcdqbyja+PC sQmph3jxDdjCmO42rKHOEsWNPunVhErqTt3u6KCfWjVX2WcXQHudNAVudIFOEhKJc5E2 xLgw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="BL0Lq/nw"; 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-20020a05620a0f0c00b007789262de78si2623962qkl.539.2023.10.20.22.34.57 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 20 Oct 2023 22:34: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="BL0Lq/nw"; 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 1qu4an-00076r-QL; Sat, 21 Oct 2023 01:32:09 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qu4am-00076K-28 for qemu-devel@nongnu.org; Sat, 21 Oct 2023 01:32:08 -0400 Received: from mail-oo1-xc2b.google.com ([2607:f8b0:4864:20::c2b]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qu4aj-0008LT-I3 for qemu-devel@nongnu.org; Sat, 21 Oct 2023 01:32:07 -0400 Received: by mail-oo1-xc2b.google.com with SMTP id 006d021491bc7-5840bb16101so921390eaf.3 for ; Fri, 20 Oct 2023 22:32:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1697866324; x=1698471124; 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=BL0Lq/nwJYggoLzWsUm25qPAH5DNXdKYhpdPPjG9Xm1I3IBRq2cNYOQKUN6w8HDsey zt29qB6m8G8PQvGxp2q79HwWotHS+QKAdu+cc5d73b3DknakcjaHJqtTddWByb99TV3T XIjIAds+HmORMkwrZuqiKYO5HUXJvaoRMzHdq1ZspYEXje0uslphvt/0HlUG+T09Rba4 aqjWsAaCYO6g3+4PVAMDnrxyeHaVmAdQZNUHiPLMqU88r/AnhkxBmBGnuCviUTTs9Chn DEjOeJikOR4LHx+HPSkYRvcl/U7RlvfiE8g74AGhBtAbcN9LeHPD2Lw3PjB+yjd1X6jA wK0Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697866324; x=1698471124; 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=jMpeMuT7QUBppBysD8IvuS7rw9RWkclECGMEiUXAiCsAhuUi6JkIDCjqQn+mrjtOer wKywc4qL0BInwdMjjFIFhK4rYHTf3gbsMcsdYU0iIi4xjhQLJryufiTb/8xS2XXhlRxQ 5+wT6KS9gCIeTUoYqwZDVnPe12GSLTBTiI6gG3lm+OX22DUfZCuDukTjdght+zATC1Qk 5W2t9KvvAbOV4ffhtOlm6OePyL+7pBCV/JC0MO20mJ3nTYIdx/Sp5OfL4SbHyNtBSYYS 0cR7NyQLtZE2DN3T3AJnuA8U3Ob1wzsTdS+taOP+CLUjYXTYOt1S/DDMeIh0VQjgMvs6 sa+Q== X-Gm-Message-State: AOJu0YzS8sexn1WEylNW/z3DSBULolS/F568Qi7qjmPmyPFsRuc2y3tG GVXM5jYnViFfZnmMiEb97xdPm8tkEVsroWF75oI= X-Received: by 2002:a05:6870:10c5:b0:1eb:e8b:73cb with SMTP id 5-20020a05687010c500b001eb0e8b73cbmr2050935oar.58.1697866324231; Fri, 20 Oct 2023 22:32:04 -0700 (PDT) Received: from stoup.. ([71.212.149.95]) by smtp.gmail.com with ESMTPSA id f20-20020a056a001ad400b006b2677d3684sm2434831pfv.206.2023.10.20.22.32.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 20 Oct 2023 22:32:03 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: mark.cave-ayland@ilande.co.uk Subject: [PATCH v3 05/90] configs: Enable MTTCG for sparc, sparc64 Date: Fri, 20 Oct 2023 22:30:33 -0700 Message-Id: <20231021053158.278135-6-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231021053158.278135-1-richard.henderson@linaro.org> References: <20231021053158.278135-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::c2b; envelope-from=richard.henderson@linaro.org; helo=mail-oo1-xc2b.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 Sat Oct 21 05:30: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: 736607 Delivered-To: patch@linaro.org Received: by 2002:adf:dd81:0:b0:32d:baff:b0ca with SMTP id x1csp632023wrl; Fri, 20 Oct 2023 22:33:23 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEamSXWbfIXL8uf2G48cPAZHfUUIvrf4eZL1nHYp4Bz8PQFUKW2ecs+oSrzGY2aiwkThmF7 X-Received: by 2002:a05:6214:21ae:b0:66d:23e4:2ce8 with SMTP id t14-20020a05621421ae00b0066d23e42ce8mr4498866qvc.7.1697866403676; Fri, 20 Oct 2023 22:33:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697866403; cv=none; d=google.com; s=arc-20160816; b=Tex5gGQimqFWWhhDBQ6TI27m/OjSZAnLBZV3O0G5xkLInjG6VOJSKDPy6nuFJEL9ND IDq0dZWYOIbFwN/gLzZA4/djZlOLzXRFYgheQLE97dZ3v9E0aAmc+REf3bX3/AkutPNS ZdU8nw0GOEeb6x9bjBrLCPaY0JoNgVQS5oSPk+EL87neH88FRoVi0Is0O26HvCjMsuXs At6T21G9873Dqc1fYiUMQE5Ro5xPYWPb48iTpAcD/Im8sXIbJZtk97KKAPRyvwfXNv7a 7ZjZGyU6hDy5BHd3+eV8CHvIk7Q4N/0vJKr9LNJS0LGypMO1dcJ7VykuZubRk5+Vcr0h MMUQ== 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=cCOKzEnkvsVwDEkOVxfcAxtu19DQfGPo/ibfgb86q/+nM7UUir/5J7iK978/UpWOrL 3JiLf9uJfjKT8Nr9c7JRlBNFICs9N/nuxfgQwLqLFICP0ktd1iwn0Da3U5Ta+64VsmzU dpVsVYHL3BPRBQAaYWFBO6ZT856nV/y6nVcOCH/0QerhxK+xlJaT5bjOfOM110m7Ze5V 374OL/KFbaExB7rwKCVHhrJAqtTMTpVcy81kJ8bD8prs1dyB10OBWelf4TvcIOnfXYEw EaGE/5iEii9mwIuk1V5kRkfnBvSQEFwwuduYgY478xHrlazbOaYun341Z1kfypsAhMcP TrgQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=ij8rdQOA; 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 da18-20020a05621408d200b0065b2d89bd70si2480970qvb.522.2023.10.20.22.33.23 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 20 Oct 2023 22:33: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=ij8rdQOA; 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 1qu4ap-00077V-H9; Sat, 21 Oct 2023 01:32: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 1qu4an-00076b-2R for qemu-devel@nongnu.org; Sat, 21 Oct 2023 01:32:09 -0400 Received: from mail-oa1-x32.google.com ([2001:4860:4864:20::32]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qu4al-0008Lo-Ee for qemu-devel@nongnu.org; Sat, 21 Oct 2023 01:32:08 -0400 Received: by mail-oa1-x32.google.com with SMTP id 586e51a60fabf-1e10507a4d6so1163526fac.1 for ; Fri, 20 Oct 2023 22:32:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1697866325; x=1698471125; 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=ij8rdQOAwfQjGACFLc3zle9MFKSnmk3bnbPrIn1OhKNuSr5rqYljagaFgiwpIWo2fJ O7nnxNHJqkm9p05GOCD27q3MTAIZsT6sSyGIIBFDigO9GgZJb5izelSUiG44bBcUvoLI aW31tJ4igWzdIAMBkIAZ3ohfd7hQTWw+iNHPgWNlaf2GDi3vYw0NlA6TOSvZF8u0BtvQ 32zNOr2kjk2gNap+PuamzGt9XOaMQTJ7cEp36aXcYIfrFPIAP7r26poOh4lywyJi9Wr7 nKneAYgm7DrG8+/pQT/L1la088RmLQXqHFNMaaBTXeM2QstwA7/v0VMGsGV6aYnhdOms Hwbw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697866325; x=1698471125; 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=iIxAGPkcJpM6Xo3ojLk+3fFC61vdjgZ8PRZty665uBu2F69TL9LowKKEsGAxUVkoS0 kB7/zD+3i30KtH2aYUcQG69gxMFXTY+vNQkDdEu/SrDoEiflV1wOpRQuBKolH2xa/c6p jdnE1ew989f97yPuBO+DuWmgqSsvh9idWxZQVV96f1qr4ExHQ2XMBAncazS8V0dIDmNC Sj80pBQ00eTjL/BsndbRe2XdnFRvYn+S86Oh0hLoRn9bY1siH7UEd8Ou8tnk4VY44MOc oDVmJfz1NRh1qzKskS9qWNfYUPTC/rufrWxavgtmTzs8eyRgPvb7IU9PkS/eA186zjxW MkjA== X-Gm-Message-State: AOJu0Yzw5CAAudy1hqfPOBcU90ursSYvQqvyEqX7Cu/QJ9m726Lg5PLn NA7vgLI55LcGN1lwKs/B5mwdKzWb2qoUCkmlaDg= X-Received: by 2002:a05:6870:9d8e:b0:1ea:d76b:1457 with SMTP id pv14-20020a0568709d8e00b001ead76b1457mr5184006oab.7.1697866325070; Fri, 20 Oct 2023 22:32:05 -0700 (PDT) Received: from stoup.. ([71.212.149.95]) by smtp.gmail.com with ESMTPSA id f20-20020a056a001ad400b006b2677d3684sm2434831pfv.206.2023.10.20.22.32.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 20 Oct 2023 22:32:04 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: mark.cave-ayland@ilande.co.uk Subject: [PATCH v3 06/90] target/sparc: Define features via cpu-feature.h.inc Date: Fri, 20 Oct 2023 22:30:34 -0700 Message-Id: <20231021053158.278135-7-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231021053158.278135-1-richard.henderson@linaro.org> References: <20231021053158.278135-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2001:4860:4864:20::32; envelope-from=richard.henderson@linaro.org; helo=mail-oa1-x32.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 Sat Oct 21 05:30: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: 736610 Delivered-To: patch@linaro.org Received: by 2002:adf:dd81:0:b0:32d:baff:b0ca with SMTP id x1csp632134wrl; Fri, 20 Oct 2023 22:33:45 -0700 (PDT) X-Google-Smtp-Source: AGHT+IG4QJ5+BVmlwIlUb7viVCuJTRXtLHePC982WTFRhnbDt5GW2g99297PuK/M+MrrGFtGrFZk X-Received: by 2002:ac8:5888:0:b0:415:14bb:5632 with SMTP id t8-20020ac85888000000b0041514bb5632mr4813665qta.28.1697866425180; Fri, 20 Oct 2023 22:33:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697866425; cv=none; d=google.com; s=arc-20160816; b=rsFa8opDKQS+UU9AmBRNYWMej+3pUhEpb4dqsNQ311B4fv9ewrV/W0dMUqhsK0513k W10M1bX6TEkVKF3XDRmVEj6s//JSVrxJv/CW2Lnr8fdgL3VjSyzmieYMsHx/LSyz285w q0+WskTB6AvvzA9WX7TCvpqBQJX1tnzZMS0ivZsG5VSHZCSNUrr5JLpyX31wj1iur6qY h5/Vt+DhYRJPMG7uXG2Yf6SXOHXAFyKXcAq/ESZlNZbPqqR5LsM7aM6hLdrwJxte3/41 kOHhB5vNIdYbMNiup25UC2rb6fqfkFIFQdU9T5vcX2c48OYgdNdluMb2fQpOoeCKCF6G lVuA== 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=p6qc1eCuAZAWN5KYbuEhlztqpL5foCGI4fQDynFekhXN3+KH8H8Qv0bZssUmjrk+Il u69GZLSuknoIrf9qD5zwHtoGwVp4EAoZ2+O23SzgM9/k20YVaUhp+w+wrZdHL7EsAZeO anu3kP6Zn2Wwd2809tH2oBBkW1aQxwuBGssEyh1QJKeNWZ5zFSJ7ObZKWs9xayTwnS38 l+BKFFV36JsXuu5ro+GEdycgBRnhmKmqvKUbXbx6Ovi7npXz8aufdDllk9WPmu4r3B6f UGIp4uylwarVAgcRSRG6hz/qEA7/R1xGMRUkJMVubw/Cn/WVPDzTYCiUO20NwAfnnISP ZPew== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=kehuPPz8; 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 m1-20020a05622a118100b0041cbf9f976esi2338528qtk.753.2023.10.20.22.33.45 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 20 Oct 2023 22:33: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=kehuPPz8; 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 1qu4aq-00077z-O5; Sat, 21 Oct 2023 01:32: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 1qu4an-00076e-Du for qemu-devel@nongnu.org; Sat, 21 Oct 2023 01:32:09 -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 1qu4al-0008Lv-Ea for qemu-devel@nongnu.org; Sat, 21 Oct 2023 01:32:09 -0400 Received: by mail-pf1-x434.google.com with SMTP id d2e1a72fcca58-6b6f4c118b7so1358558b3a.0 for ; Fri, 20 Oct 2023 22:32:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1697866326; x=1698471126; 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=kehuPPz890doaD6tNxYtoGmtGmNO6MDu32dfGKwcxPRaxuTkJNxd1m8zd4ScWBMmsO QPrTmA9WHJdkLzkOThg3dj9cmOhM09VZfaSQ2Vbwzsb3QJ1btqJlcUDTZ8i16UfBnG7l j3UIl5O8YMWBTK255nCWphYTRQ+B9K/kh9YBvTmv6ciFoKHVF/hB1PXpzhOPd0gbaX5Y xFEdpYJ901sw57Ms3taIU+WzHLdtYl2v2kQxvwwepEJWKKWLq9BTqE963YPqlOnfRSKb pn0TTQAgrMvlT3/2yDXTM5fveNLQvxRFAOIqwvVUCHZEpc85A9vHwJ3863sBi+MFNIp1 z4BA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697866326; x=1698471126; 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=LQGZLW0g7H8Dbd00vGZNorsa6buSrIUxBz5Bwg+As/jtClZjOW53WBO3LLkab2pvgt Tuc5OYyRK9Ybl8eRbkO/bXM2WXrbl+//dss0YRhUcnQh8XVCAgqlyLrdyMrIhEZz5jR3 uyetA1QvLCgaHd1u78PYVlURLESjkMBhU+H/XWYtsRSHupNw6+WHubIMSfmbay55Niss 8N/91/eR0hAP0VPiLUjwOxjf3L4NgvNCqfOA8Pf3iZ9WchOnuT2CYkdrL3mqhakhek8y alMQCJjhJrvl5yQwigMdl8QnS+Pkf7Z4mbbtN8pepOYdn0mA9mZrR5BOnP75kg6PD3H5 4H0Q== X-Gm-Message-State: AOJu0YxMyqxhGdtbJmj/7/D1kOCnqFjqMsNvEGFsynfNCgF/nX1uOnJq NWGu+3iGp1hzyUGazsrpEmyZGuceezwLSr9JxlI= X-Received: by 2002:a05:6a00:1788:b0:6b5:86c3:ccaf with SMTP id s8-20020a056a00178800b006b586c3ccafmr4124196pfg.22.1697866325888; Fri, 20 Oct 2023 22:32:05 -0700 (PDT) Received: from stoup.. ([71.212.149.95]) by smtp.gmail.com with ESMTPSA id f20-20020a056a001ad400b006b2677d3684sm2434831pfv.206.2023.10.20.22.32.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 20 Oct 2023 22:32:05 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: mark.cave-ayland@ilande.co.uk Subject: [PATCH v3 07/90] target/sparc: Use CPU_FEATURE_BIT_* for cpu properties Date: Fri, 20 Oct 2023 22:30:35 -0700 Message-Id: <20231021053158.278135-8-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231021053158.278135-1-richard.henderson@linaro.org> References: <20231021053158.278135-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 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 Sat Oct 21 05:30: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: 736632 Delivered-To: patch@linaro.org Received: by 2002:adf:dd81:0:b0:32d:baff:b0ca with SMTP id x1csp633548wrl; Fri, 20 Oct 2023 22:40:24 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGN1vjJUCJkExwkSLbWW9FGq592NPa1KWFfHc95S7pbh1aA3S8fvN7kk7/cy9Ah04KFDsRh X-Received: by 2002:a05:6214:1c41:b0:66d:9d84:611a with SMTP id if1-20020a0562141c4100b0066d9d84611amr3590209qvb.8.1697866824437; Fri, 20 Oct 2023 22:40:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697866824; cv=none; d=google.com; s=arc-20160816; b=eJbMo9BqnxQKVGy+pcIr/zH52ibqXfxDQYIQ8dbtIIxbz3ULv6f10zaGI01UfeYd3n pMT9a6MxKCW39xstNJtgkQAyud7yYit+lziTNxvlE52awy4eNPncnfG9bZbb8psm0QzI wGa8NRDhAFC7HkQj8B4tHx0bel8kuB+UW+kGYVvl0Q6Z5244YHMxg2LJjsF9uBnvdTUI HKn0lT9IoRqmkUGd3IBcKX4DWDWpxGHO0ZLei2EfwQRG8Ijkka0PWdQ9Z5gMiXJPwLd9 FYqQpiRx641YED1CYZU/cMOlcvTjqjADiezKzXZxzrXDXgAsrr6NjOvi3Fhwd1RVS3lx fmbA== 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=jiSS8neh1hvql1wxkPiTuqLwTab6qyXQhgTdHF+GXPMm+p8Aaz56wyX/Tha9dNvyQc 7u418QVwFaYpU0uEfrB+f4G8mTZp/3ffB/4c9UzyHtep2Vqjjin8oRweEZGEWmcN1MjY CVeiMioQ8iaHwUREzTe2xUUH9y8UBpWyaYMYEZDYgwwXpNCuWaB0UJ+Dbm416uAqvlfS bRH3jb8hBo+zraROhXNjx6OO/yYpMDHEjndc3G3TjI7lup50CEtdY9wBSrW7ykF52CU6 tfNDqBVfE1gfIhoi5Yd3b9Y1f3YkJu9bWRVTxuoeUoc42g7dC2/eWBq42Fz77dY5ohSQ Q95A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=H77ow5Z+; 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 e19-20020a05620a209300b0076cb682f501si2470336qka.777.2023.10.20.22.40.24 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 20 Oct 2023 22:40:24 -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=H77ow5Z+; 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 1qu4as-000799-DN; Sat, 21 Oct 2023 01:32: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 1qu4ao-00077C-JZ for qemu-devel@nongnu.org; Sat, 21 Oct 2023 01:32:10 -0400 Received: from mail-pf1-x42c.google.com ([2607:f8b0:4864:20::42c]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qu4am-0008M7-DI for qemu-devel@nongnu.org; Sat, 21 Oct 2023 01:32:10 -0400 Received: by mail-pf1-x42c.google.com with SMTP id d2e1a72fcca58-694ed847889so1438853b3a.2 for ; Fri, 20 Oct 2023 22:32:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1697866327; x=1698471127; 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=H77ow5Z+ihgShvHDl1IBfLcZ6r/0iXk8TdG8LFH20cGJBAiuQk2OwArGJd2gVH5XGq cjBOtaO6ULbUGbP1quP62W0ByIpMRzGQjJmD/YpJxwmS+EWt21sJoLLMvHiR24xuWk64 0JL+jXYgWa6GrUkyzEbrfo3DtlJNnwWeroLGQiuwBgq21ZDfXVwXmI8ngHpQCSuwB+MT xDIQrdCkpBPRUQJbIkihbkfvjJznLbc6GKkMIaokC9IkbykBgdRHMVlWJqqAc/oXonU/ fapWj9Y2Rw8emTvBvJW3P7wRJNXZHCsBmcgccjaVuAjxSk1RBUj9fo5ma0fya9K4n0wt fbyA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697866327; x=1698471127; 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=aijSNzQ2QuKbXUCmhm07uxKp5QgSQepqeqTzj1srqF/tj/Q6xP7FL9/3p2aF+B2jGU P6UnbCNH9pJgiTZ2puROYTVAFJNus9w1sblOYcq3OnD+F0314+HTufvpfMBu8yHVGppp R2Cr9QF7NjUpBG671MPUvDCTYmq7B7cUfwtL7aNcvFzZRmviDGAwVRDcba7NVANDvO8M SP+JZDpP1O66mLMXONBCkaq1zAIj7vY6GXTcFbZ/B/3ZOwJENo/BuUJY96JjDEheyWfb ac0adfq7ZhjidkPEeWOeqN94W3xc9qf/CqimUHg35m9YY+NWEtx5eDOo3sIA43disxye fvkA== X-Gm-Message-State: AOJu0YwmKdPfVUoMdtHfx8jgx/1qEX/q4kZWbNWOfdm+N0M9Gfn0lOJC Trlgqn3Q6RLWRjITTyHrbG+TqmEmq0yvnsda4iQ= X-Received: by 2002:a05:6a00:194c:b0:6bb:8982:411c with SMTP id s12-20020a056a00194c00b006bb8982411cmr3503317pfk.8.1697866326853; Fri, 20 Oct 2023 22:32:06 -0700 (PDT) Received: from stoup.. ([71.212.149.95]) by smtp.gmail.com with ESMTPSA id f20-20020a056a001ad400b006b2677d3684sm2434831pfv.206.2023.10.20.22.32.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 20 Oct 2023 22:32:06 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: mark.cave-ayland@ilande.co.uk Subject: [PATCH v3 08/90] target/sparc: Remove sparcv7 cpu features Date: Fri, 20 Oct 2023 22:30:36 -0700 Message-Id: <20231021053158.278135-9-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231021053158.278135-1-richard.henderson@linaro.org> References: <20231021053158.278135-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::42c; envelope-from=richard.henderson@linaro.org; helo=mail-pf1-x42c.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 Sat Oct 21 05:30: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: 736655 Delivered-To: patch@linaro.org Received: by 2002:adf:dd81:0:b0:32d:baff:b0ca with SMTP id x1csp634456wrl; Fri, 20 Oct 2023 22:45:26 -0700 (PDT) X-Google-Smtp-Source: AGHT+IERUavt8RfM0E6FWtyPngkBAIw07silsBks6a/obckTHwByYrWYdg49Fr2HQ7iweHMY6W0a X-Received: by 2002:ad4:5966:0:b0:66d:3f76:c626 with SMTP id eq6-20020ad45966000000b0066d3f76c626mr4691829qvb.11.1697867126102; Fri, 20 Oct 2023 22:45:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697867126; cv=none; d=google.com; s=arc-20160816; b=UEaxnAXlNiDY2ROYH3VS9cFO3t9SjsHlZnCHB6tU2TzwOkFrZkY9r3OL72UWDNaUej 8E64yLcc1ojfXFzgPnuUxgYcG0vrjqbJMXFlyd8nJjttgCFzabUNeT2wrxvV/7GoclmT msL9cNqRtYb4Jb1QO4JB5MkGUK3zQsg1OgiuncuUoV4r1dbEMEzanAHLnMsYnlrNglTn T83egTcQijmygPGrUKyDcQorX0VBmrlgj3TPusKgFJpHLnIk41dNiZOrzAHqGkrrSR/b uKSHmsWojYW1E/LNQyStcBbNZbn4/l98OSyNWFb7VRogRULjGIBwn0WD95tr/LTKwlTT PAbA== 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=cI0rtbOUmXZUS6WkfEitc9PrhoRitB4jxZ7uZm4aqU8MDJ9LvK35FrD2uAob9ZmZC6 NjI5hDG8/M0J+EaDNbqUbMEUECCQ1NAJn2d4iLy66pp2KMjAK6mf313WyAdcyqWLBbav R1tei6QNeXMLs3EPjdT9Eocl1UGidgJ/0bGifYf5rdsptoWfcUYtmDOnohEgDLSCIjjR t4k8BTeS/BoqwC6w0WjOWkOEWhd88q52Fd4xbNZTXdYYxr16pAToBsnOe32WlJBQB+eS A3f/83BaCmAHwn2FCI5oTFnLglqISSgjfEALWRW8SXBsjGeOys9xS46RqPWwvuSWBvsK 95ww== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=wQEXyh1J; 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 kj23-20020a056214529700b0066d2004c2besi2677606qvb.427.2023.10.20.22.45.25 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 20 Oct 2023 22:45: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=wQEXyh1J; 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 1qu4as-00079I-FN; Sat, 21 Oct 2023 01:32: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 1qu4ao-00077D-KP for qemu-devel@nongnu.org; Sat, 21 Oct 2023 01:32:10 -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 1qu4am-0008MI-WC for qemu-devel@nongnu.org; Sat, 21 Oct 2023 01:32:10 -0400 Received: by mail-pf1-x42d.google.com with SMTP id d2e1a72fcca58-6b7f0170d7bso1416303b3a.2 for ; Fri, 20 Oct 2023 22:32:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1697866327; x=1698471127; 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=wQEXyh1JB0/ZM5CfI2JY4tIzp9aeHCAXzZxIN1HFdMHXhGrrFjfpq+EIbS4xUYG2aF IHZta2batqozw47OBd3pyneqUJhsFHAqZdGEG/lpBPFxIdGuBhZet2whsLo6RUIywhbO MQhwcothiMMN8v+YAmfHtJkQLKaGGb/zADrutiGeWxuN2uzl7AgVwnB2pQc0SNnwI2Nu ceg06d+xtxzRvpCFWThqT9Od4RrViw29R68blndBJ7+pMdSbV3AfLLQvaarOdtbVXMd/ FCIKJiWyMNEI6M7xDBGswSWOHVQOZfwKSHnyMJGHzkyZ+MYDcLHADUo33OsBLPYIzh+c +mYA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697866327; x=1698471127; 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=VgSJTU1TqMephGG01A9yiwoTpRZRb1DPX2ePNFe9dCflfmZlKH9qG1PIP90lfk9Isk Gv12cE2iOpxpFF2bLmWY26+7ojBeIVJXX4oxAzEgdjUgPuSFUp6oxlHdfx01xtyY9xSm XJUbkQlyDi6YI95XJqXVjgN4ixpwuzZUvVht8IQ6q1CjEvNg/fxrG2HdqAfWsA8zbWcc yTsqFqJ4pHs1OyZAUMGtcGl3JuUp8cCvTVpshsj6h58BexaC/8IsiIRIMyokmVsRxCRf 3gdKqrsV+08ALX7vAimEXHvM8v6S1OY121B22BSiSjvVCPPVnsNyYs+/YZ9tlIRX1vcT hsgg== X-Gm-Message-State: AOJu0Yy/RYLlPSH5dwXH0mqkRC4gd1luCmvxVOWGSb/ikyZuknX2Nvef bFtaLzq0y9s1BgAE+SCk/tWkPdkug0r+g1jaF4g= X-Received: by 2002:a05:6a00:21c4:b0:6bf:50df:2df5 with SMTP id t4-20020a056a0021c400b006bf50df2df5mr1291085pfj.13.1697866327652; Fri, 20 Oct 2023 22:32:07 -0700 (PDT) Received: from stoup.. ([71.212.149.95]) by smtp.gmail.com with ESMTPSA id f20-20020a056a001ad400b006b2677d3684sm2434831pfv.206.2023.10.20.22.32.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 20 Oct 2023 22:32:07 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: mark.cave-ayland@ilande.co.uk Subject: [PATCH v3 09/90] target/sparc: Add decodetree infrastructure Date: Fri, 20 Oct 2023 22:30:37 -0700 Message-Id: <20231021053158.278135-10-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231021053158.278135-1-richard.henderson@linaro.org> References: <20231021053158.278135-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 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 Sat Oct 21 05:30: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: 736647 Delivered-To: patch@linaro.org Received: by 2002:adf:dd81:0:b0:32d:baff:b0ca with SMTP id x1csp633904wrl; Fri, 20 Oct 2023 22:42:21 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGaQPoYWEB6ACcuRubdrw4Zix/PeGphMTXaGws2vPTzRqKD/ERTLSijL7QtUbw8xGyYeSDC X-Received: by 2002:a05:6214:1d21:b0:66d:19b5:9a3 with SMTP id f1-20020a0562141d2100b0066d19b509a3mr4697313qvd.29.1697866941769; Fri, 20 Oct 2023 22:42:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697866941; cv=none; d=google.com; s=arc-20160816; b=Fk8XbpdNdgK9Ad+VeKmJt4qqGk3GROhxFyAtKhhUy8rhJb2guzbsGMVmbLHzbZtP7i XXH92w5+aRQMnFBRz5OqLj2brdpdpmaOV3Th8WrcYlzTLqptW1vpwyXVkVdaIr68g3Uf n7to865PNqEQ9IX3SV8JTZmFlAYugR4h1rIXKert3TWXyxDL7Na9toO2eyO+lD5y9VQF I/QsVAo0l6WupDqIF47kQaQqsiuLVErRldxiGFH7hucai5MjbZ+vU55oo3/yCu3kd8lO x8zt+IGuKEPvb1mzUSMCOx1RUe4U/mF+o3QjzkFFuW0EsJYk64Z3XLVQj6Xf/pcPon45 CFIg== 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=pCLqemKl5cJBBSBM8pQjTxD4FVACJGCfBCBDvrzRWVCRL1VZgyRl24kCGoOWKaJVxs Y5IKQG32WEIXqAMQ5ieHT7OcNIAi1Ax9ND2q920PvcgPFXmWDxneCiVmEoaAINF8RW4n k2KP6h2GPWF78SB0i4hryvSKasUv5Zdar2FRbjFqErCWlvWXT2aZDnNn051bpOAryz3Q SmyY9nbOButCh7m1du8PJCHWOPm7o+SqMMMegi67daxP5y2m5uK9AQOOrugqQOHBYR/P QTzHMXGm7Z+7sFaEjCKbq+qGFKcTeGja3fvk6D59azjhnsW23DNm6jMSDLvHzNX9HBjX HEDA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=uskYM7bQ; 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 cu15-20020a05621417cf00b0065b0b5600fcsi2426508qvb.41.2023.10.20.22.42.21 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 20 Oct 2023 22:42: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=uskYM7bQ; 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 1qu4as-000792-AB; Sat, 21 Oct 2023 01:32: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 1qu4ap-00077a-Hu for qemu-devel@nongnu.org; Sat, 21 Oct 2023 01:32:11 -0400 Received: from mail-pf1-x429.google.com ([2607:f8b0:4864:20::429]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qu4an-0008MS-L2 for qemu-devel@nongnu.org; Sat, 21 Oct 2023 01:32:10 -0400 Received: by mail-pf1-x429.google.com with SMTP id d2e1a72fcca58-6be840283ceso1340270b3a.3 for ; Fri, 20 Oct 2023 22:32:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1697866328; x=1698471128; 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=uskYM7bQHYsPX5xXV592Hqtrcs7inHZdqs8Y6BLLEHmkGX3yAjhCV2Vj47uDyyOHKN tBdXkYsrBElH/Cz1rpu6sI+zP/AfO4OhMWXG51Zi3WLEo05B3jIGJ6TN/ETMCcDKGkTb uO2U61Q5wC+S1d9+Cb8X6aq/bgkwu/eke/0/Mysu4VHMl7mmutNFSs0Y4FjANwPKdFbT pir/c/PE/kxzgy7IH8URA+AvqHaA+sTuIoj03s8UXCLUsNEPNoytGB90w4SI3GmTMZMD wtt9UaIU3e1RH2lCvejZKB7aoF9pzI0vMDLgg2BFp6nbJKO8xsjWZa6JNbwX9i6bqGnF MVAg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697866328; x=1698471128; 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=V013ovxLxSXqfFcfKKD2fj7UXLdue5eDMtrYlz2jykeeXd/4zouWmTiWuAM3LMCrl5 IYx5mB7XOYSfbVOJ0vJNNBSqY5lwEXtjUescfweQfo3iyCXUIZYzP8JmE1c/zR0f4lKF aEsc1NMj4YJ1j0y8XFKvDp1GE8NwsJwvb2ghFMmznXZuZurWUohLT5Ow+gIpet/y2GBq Xq9vIiNByl/1XxckO1azygMypXJPESIMGwMc9HUgGylzkxVrvB1M6uMl43+ard5hbRNx cd25mU4G47lEIsZSKZwVqoo0VzF2u914sg9qdgfvKZEoIGJcvBitFEnUPf98WtbyxX8i YNgg== X-Gm-Message-State: AOJu0Yw6fL/v5oPYwX2NOjIWJMUJCuXRlTXkDoVgVeoOaVyV6B+88rjr N5Wp8+Rwja0l+xkq/MMo03aGqB35KuDDs42tbxQ= X-Received: by 2002:a05:6a00:a10:b0:6b7:b42f:e438 with SMTP id p16-20020a056a000a1000b006b7b42fe438mr3289912pfh.8.1697866328369; Fri, 20 Oct 2023 22:32:08 -0700 (PDT) Received: from stoup.. ([71.212.149.95]) by smtp.gmail.com with ESMTPSA id f20-20020a056a001ad400b006b2677d3684sm2434831pfv.206.2023.10.20.22.32.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 20 Oct 2023 22:32:07 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: mark.cave-ayland@ilande.co.uk Subject: [PATCH v3 10/90] target/sparc: Define AM_CHECK for sparc32 Date: Fri, 20 Oct 2023 22:30:38 -0700 Message-Id: <20231021053158.278135-11-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231021053158.278135-1-richard.henderson@linaro.org> References: <20231021053158.278135-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::429; envelope-from=richard.henderson@linaro.org; helo=mail-pf1-x429.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org 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 Sat Oct 21 05:30: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: 736600 Delivered-To: patch@linaro.org Received: by 2002:adf:dd81:0:b0:32d:baff:b0ca with SMTP id x1csp631870wrl; Fri, 20 Oct 2023 22:32:49 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGFQ3CKArB5cZ+3VIxfAtfhAS6rbAdMfZ+YGe+t8wrN6zpNE3NbrF+tikX9IsOnerXAPX/p X-Received: by 2002:a05:622a:10e:b0:412:c81:efe2 with SMTP id u14-20020a05622a010e00b004120c81efe2mr5290418qtw.31.1697866368785; Fri, 20 Oct 2023 22:32:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697866368; cv=none; d=google.com; s=arc-20160816; b=cVaC61Y7vUcODm/v2viRJGTAXA/JHfLZMv4LfENWjaBzrzZD9Jsftl6NTKmPvOqsUO qHNybN5Vvc7uU6cf9yuQMAvoVOiXM3CBd0/wR3dHRX6Dn19GbszR2WjyA/lxZXpyk0Zm /FO06FmqsWIzWUa+qjmcqBLevvl50FXQRVAdyhpYoVHTNfSAZxqHtYnbioyvFiRC96Vg Lx99v3wHmc0zD5RdnkoM/Kr7BvvQSw5w0UuBbQWNwekwM85g6s+7qS1wCUfrfnzxWsSv NaJK4Ur2DL2oZoQLBO5Sv2v79M7t/pqDSlPC9tMQucVLr8bl2Z49mxWcvetI7eEpCY7u gkag== 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=gcdlT+8vBTLJCLU/joHpCJJuCmMeSxc/JpOraRlX8m5mCcNdqMjszob6iSV7LR2jB1 yZGcdVGFEjTJuqJF9885OE52UGK/20Ud6R78Ss5mQKiKbJphPq4reVql8r3+9RHy7vhF bf3E/aspadB7uU7v1tw8K3fwV8+rvILKWcocuo8Q6X7vIqOf13GS+5EXvcWV89TxzpYS krswIi7pSYLUJDmZRas75zy95t42y82rspcBAYY2Z+M1eLwApO8S1b2b0EQOD8J/xQ8T 9pa88GOAOTn6aIX+ZMP/w2cpaCsjCl7gngnkOLBTMX5N/D2pX7dpDp2q5xc9uv5qKuGX YG2A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=zyb2EHc2; 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 w17-20020ac857d1000000b00419661397bfsi2558095qta.699.2023.10.20.22.32.48 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 20 Oct 2023 22:32: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=zyb2EHc2; 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 1qu4at-0007A4-VD; Sat, 21 Oct 2023 01:32:15 -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 1qu4as-000797-Aw for qemu-devel@nongnu.org; Sat, 21 Oct 2023 01:32: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 1qu4ao-0008Mi-M1 for qemu-devel@nongnu.org; Sat, 21 Oct 2023 01:32:14 -0400 Received: by mail-pf1-x42d.google.com with SMTP id d2e1a72fcca58-6b77ab73c6fso1172059b3a.1 for ; Fri, 20 Oct 2023 22:32:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1697866329; x=1698471129; 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=zyb2EHc2K7iEOhmkOk8EcYOeATrvVgYuSWlTpP00Iz8yfqDgiK6Jw1Hn5FOlBkjiza PJYw4e0VKxA2xkXYxE61U4HUsiPjE6hz+H8XsG5z/j/GlRC4XvPs5XlwZffiCWyysvVK /eWuaxLABsmvoIK5vDfxtwQfmqblUKaMIs1o7SJyn9qm4+Mqru4FUtN9XbCfj0Y0Z2rK lfwScfHHbxdm2ocSSi6Nsw0N4Gko21UjVkXN/Pq5Sq/KgGdjMNkvqKgJ6w43RZBtg8pK 2+2G2FyUJBrWEHXVJKjt+ZCTQnYN5qDH6y2MG6mwRvZjPpQyNA3/8tRlFkTN5ozYalPP OtyQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697866329; x=1698471129; 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=FELoJuekyKm3QDcOmkIWEyYaKbujh00Et3Dd1jy3h0WzwssF2/zybxtoTHR0pHiz4U tyvi2f5oInPT6omnUEWIedb9Dd4IVeftYlpq2g4mTTJMi34asC0rQ8Qr3ipeNx+4wvdZ svB7JOcJo2ffaUG1OKxZwWkQt9QWG+UGza8cMdgq1G8SgtbL7G0E7tVECvpBaty5B9z9 XeFYY9BNEXtQhdtMSjZvoPzcqUlmdBdvpoKtrHirC2rKdiLjGiU9kigIfmQf2SzPliBm rwclpRWwjHoWHBQvtJC1lHzRlbz9VDnvTqCoDXTfrwPb5P5Z6pLKTH+rMm3atCxqXyit WySQ== X-Gm-Message-State: AOJu0YxJxaFuyhK6dZYyFl7LzM6eGtflBZq6x6J61c2rs2YhzooRJ2UU 8zdeSdz35JLd4ldOc1c8LRkTwdHkHuy2xDOWQbE= X-Received: by 2002:a05:6a00:1817:b0:68e:3616:604a with SMTP id y23-20020a056a00181700b0068e3616604amr5699524pfa.8.1697866329088; Fri, 20 Oct 2023 22:32:09 -0700 (PDT) Received: from stoup.. ([71.212.149.95]) by smtp.gmail.com with ESMTPSA id f20-20020a056a001ad400b006b2677d3684sm2434831pfv.206.2023.10.20.22.32.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 20 Oct 2023 22:32:08 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: mark.cave-ayland@ilande.co.uk Subject: [PATCH v3 11/90] target/sparc: Move CALL to decodetree Date: Fri, 20 Oct 2023 22:30:39 -0700 Message-Id: <20231021053158.278135-12-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231021053158.278135-1-richard.henderson@linaro.org> References: <20231021053158.278135-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 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 Sat Oct 21 05:30: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: 736682 Delivered-To: patch@linaro.org Received: by 2002:adf:dd81:0:b0:32d:baff:b0ca with SMTP id x1csp635250wrl; Fri, 20 Oct 2023 22:48:53 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEnqmdgLx0nSeK1u9sZMlS+97iNxln0N4GHkUoTvyosSlQq4srYxk6UqNXOleMsp0I9FJbc X-Received: by 2002:a0d:fd06:0:b0:5a2:15bc:b32c with SMTP id n6-20020a0dfd06000000b005a215bcb32cmr4435934ywf.42.1697867332881; Fri, 20 Oct 2023 22:48:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697867332; cv=none; d=google.com; s=arc-20160816; b=h49zpmm8S24Ila8hxzdNvvXESoEzlPz/QlxzFP4gbJv7sqrHCtvGaVT6A2caEpLen6 dvdBO4LTe9a3I9qGvBv67Sg8XuBzV2BZFUMRAyyvU596GO0QotD41QxfVbfa2px8VY3v wxLFrOa4mgonsJk1NJUjKYR4nW5azy5n0nqhcHVDG8fRr5ehj3F/tJRfmvaIf5wAYuWD dCr4pX2D2Z5D9CVwW2KNqyzPdAU7kqH6o8wwWufDUMRud6NytdYptwuzEdaKkfGUzf50 ydgZuLEDXY5FssubwQmPKp+g1SzrBDDEtlJ/xEcScgMs272f7AU/bMBiQgW44PTPj1Cj u/7A== 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=Andyd/JdiHhsQFR4OH7nbrtZ1HQXS0yeJHe4QbdKrbmAAF5G3PgRHlWTA9sUCKRHGa esuI7GSHcEyQmtJRw8bf3A6hlTgEel3gEFiiPU93PE5xbu+qFXimmrfww69rhDakt1j2 LWoQhAiL5szIR9mFKoxw3tsXSorzaFwrGRfZHoPlTT8aCfw+4uJlMFIzN8RSKU38i6+w HY49ZUtfstjXpjIxomxo7CcA8OYZNFeLDv6df2E8pw6rocUMmln2iYlvut6Z2L/9DnCo CG1hKobih4L+SM1gkx3zhXiEhzkVXLOflyEg7RSuNAaAWrxdR7ii0JycQmEOifqDlg6Z V8hw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=t2n9J9rR; 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 g21-20020ac85d55000000b0041953bee755si2466146qtx.441.2023.10.20.22.48.52 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 20 Oct 2023 22:48:52 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=t2n9J9rR; 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 1qu4au-0007AB-5i; Sat, 21 Oct 2023 01:32: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 1qu4as-00079b-KP for qemu-devel@nongnu.org; Sat, 21 Oct 2023 01:32:14 -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 1qu4ap-0008Mq-RY for qemu-devel@nongnu.org; Sat, 21 Oct 2023 01:32:14 -0400 Received: by mail-pg1-x529.google.com with SMTP id 41be03b00d2f7-5b856d73a12so1126528a12.1 for ; Fri, 20 Oct 2023 22:32:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1697866330; x=1698471130; 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=t2n9J9rRtDwD73bljFOvXSnYs5XVjq8JE04adIFfA/hTEzcuRM2yl9r6dx/JhHIhcz E9533y1mrGnPbRaXNuWU1l5li9tBnhJmp5xh0MuQjzByZLrzCjwZ5JRSZChmxLUnz+c2 WIFw9Yh2TqrUa1TGkmmabOmMhSuT24OT3l/MKUAzlgxeIanpVBNLvui/806ZhAOophzy 9TbLBRLs1pwiqebr86inRwwiYBnf4LtiB5zpqCTCFczrYKK9nSaqqmuGNJ7/NfQyh+YD 5CI1V08DMYSewTO35aWM3qGxEaGVTpcMTUqEx5Z2QYKd8KrI2dLsnaBtefs2hprM1jeb d6Rg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697866330; x=1698471130; 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=M/lcsvKjpTyWZu91uS0KfNiZmZ+u9qXmb3Zhsjj1Oob0OrOmhOry5eFcZBpfLjnzxP qKY6n7t4r8QazfxZyZ57DIZT9ro5Pur3RSnOzma5/XuCS3fCE4CIaj0/u836ydYXIKzA YVBuI+ebnefVmHWn6R+5IiKbTI+H0l53YMIjj36CPTIAo3P5XWrBBEt1hIjaRmv/uv8Z nWDIWOQoTXORAhzoZesFsT5F/nuQJYRkjuHdlp+6VNlmgy1zN5as6sJm+cjFFYp93kf5 XnK6x3nNWhn0JbL9G6rysf2rKJW9jBlYCNYBnL14MZ8cIiywTsfDXK9qPhHGdJbZSMZh HYEw== X-Gm-Message-State: AOJu0YyVsV6PpKDMK31ny23xDaNHL5M5CQOHG2sPoQ5rs6N/UeQjQ4zZ yp6iGhNDWijk5qCVcHBJCUYZxZ402jUTLseFisA= X-Received: by 2002:a05:6a21:998d:b0:17b:129b:1818 with SMTP id ve13-20020a056a21998d00b0017b129b1818mr4856121pzb.37.1697866329948; Fri, 20 Oct 2023 22:32:09 -0700 (PDT) Received: from stoup.. ([71.212.149.95]) by smtp.gmail.com with ESMTPSA id f20-20020a056a001ad400b006b2677d3684sm2434831pfv.206.2023.10.20.22.32.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 20 Oct 2023 22:32:09 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: mark.cave-ayland@ilande.co.uk Subject: [PATCH v3 12/90] target/sparc: Move BPcc and Bicc to decodetree Date: Fri, 20 Oct 2023 22:30:40 -0700 Message-Id: <20231021053158.278135-13-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231021053158.278135-1-richard.henderson@linaro.org> References: <20231021053158.278135-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 | 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 Sat Oct 21 05:30: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: 736680 Delivered-To: patch@linaro.org Received: by 2002:adf:dd81:0:b0:32d:baff:b0ca with SMTP id x1csp635121wrl; Fri, 20 Oct 2023 22:48:12 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEsBNvv2ax7n1vUEfvL3Mb5LikTxwxhv4nrL7lQlmO5Ohyzw9r1RwmO6ZJk2VCCIMxqlBdG X-Received: by 2002:a05:622a:1a2a:b0:412:1c5f:4783 with SMTP id f42-20020a05622a1a2a00b004121c5f4783mr3318524qtb.10.1697867292106; Fri, 20 Oct 2023 22:48:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697867292; cv=none; d=google.com; s=arc-20160816; b=dEGIDDQKtlB3ZnO2X4TNQgp4PNzOV9Z6sY5DJozwlMq6zq7YRHqZgaqveg6vwn9PdD RWuLXQUKl0iVTtg6PiDjEN3Ng48VnvMWfZebWSW2+tblrebThJx3iUHp104dZGCClZ4h GgHd2YHpFDb7+CjrkKeLStjURijo1Uavoj/8RUCox8f3aLL/AZuoh+hcyutAIORxFGKo OOV5BEdke3XucFOyRISaBf9gKh7W26q9GBxzvY4VfIPD5wfatXC4cvvCTw+Soeta+5xe LoTAx0wftcMD8D1NjYpBEKzefW0u8cH1cJZwevuA4YwiIsFleo2IjKImAD109RUGkBy+ GPEQ== 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=KvdFjYCGRaPLJ0S/WuhkwAld9KlBNODZjtIMg9D5TdlO2CMLZ5qimjtcxGEDI3btdh B4BhndnPIbXAsYqvPYAYrb5FCFsDl1qFDwO0DDafITOoZsR9/sk/w+hXdIL1Yt298x5Q jrDNqoIDuuLzRwESETI3tZ1m4YZjH4ghzlwcNsIXdNKJH16og/F0mx2fjEELCY0KQmg0 iESpocNA9ncBirg6wsryyIH/Etv8qlAXjcnxSvfjKIWHtMS6KscM6nwijMFpeOX3t3qz HNBPVIf8Khl6sC7hJcCg/0WqSRCh/rvwJnIQqSJYNPQZA4Iff4SdKqhIy6iGVJlxa7mw cH3g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=S5AruiEW; 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-20020a05622a025300b004108cbf61cfsi2517705qtx.175.2023.10.20.22.48.11 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 20 Oct 2023 22:48: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=S5AruiEW; 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 1qu4au-0007BG-Sm; Sat, 21 Oct 2023 01:32: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 1qu4at-00079s-5C for qemu-devel@nongnu.org; Sat, 21 Oct 2023 01:32:15 -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 1qu4ar-0008NB-HC for qemu-devel@nongnu.org; Sat, 21 Oct 2023 01:32:14 -0400 Received: by mail-pf1-x431.google.com with SMTP id d2e1a72fcca58-692c02adeefso1259297b3a.3 for ; Fri, 20 Oct 2023 22:32:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1697866331; x=1698471131; 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=S5AruiEWN/15ANWzKWRsuIE/ffSNRSPeHfJMU6BPU6QN/Y4ntEV2UTOvuAAGl1Dr0k qAOm5JdVqkX4ycJAF+cAfujscuv48IvEF2P/Yl/3SVaSj/FRl82ZK4JHA2JEBmaSgy69 B/hS1RTx7c5w/3QfN7wW65Sch26AniJLYfc2nGezGKMnPj49vCp216svRfweiOk4Ky7F 5EzQJMdCpUKc9j7Kpnn7jGuiKb+Qdeac1ksSUhhVjyln6STM0eV9gE85VX4U4XgIZkHl j+eX3pCahb52JNVDFaupA0ZRHpsrAn3airFFOqEvsB6gXUvoS21FXgzWcAUhXB30L9XO AV6Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697866331; x=1698471131; 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=PbghHSI6/Dbb2MCPCy8c/HMgdt7bXD19SN2AyvH4DGpnJeSg4gVf7lC/WIvzCfMWWV WIP36f4vS1fr60LXfPuKA4EVqhQGOIz4ctQd6SAS2UVQXtOl2fHDUsB4EqCoksv9n0l9 RgasH6VCHmtwovXj9c+1hXOxIm2F9IYPDNFf2Xn0UDX5Gnu1WAcm4z3CM7ilUAhu/hum z5FXaAfy5AU8xn+gz/etCEnwJFvzo1cectTZ4p8n80ds0xDWbq1yPG5BxPnl1zwI5O2L 6alP6pR8Z6tHRy65VLPjzHFN82knwFQ1ZfVvosnrFb54+AfRHKLYy5+iRP5oIHVI3Wn7 EuLA== X-Gm-Message-State: AOJu0YxwKCJxfmRk5i70b7WonM10jTqnrLsmMaAevX5FWrl6SqAPPmG6 abBNolaVftw+BSg15UkrhuLOnFVmFkwlZmZEjqg= X-Received: by 2002:a05:6a00:99e:b0:6be:265:1bf5 with SMTP id u30-20020a056a00099e00b006be02651bf5mr4005461pfg.24.1697866330706; Fri, 20 Oct 2023 22:32:10 -0700 (PDT) Received: from stoup.. ([71.212.149.95]) by smtp.gmail.com with ESMTPSA id f20-20020a056a001ad400b006b2677d3684sm2434831pfv.206.2023.10.20.22.32.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 20 Oct 2023 22:32:10 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: mark.cave-ayland@ilande.co.uk Subject: [PATCH v3 13/90] target/sparc: Move BPr to decodetree Date: Fri, 20 Oct 2023 22:30:41 -0700 Message-Id: <20231021053158.278135-14-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231021053158.278135-1-richard.henderson@linaro.org> References: <20231021053158.278135-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 | 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 Sat Oct 21 05:30: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: 736681 Delivered-To: patch@linaro.org Received: by 2002:adf:dd81:0:b0:32d:baff:b0ca with SMTP id x1csp635144wrl; Fri, 20 Oct 2023 22:48:15 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEc3mJ+9eFWvNK9np/aCkS+mqpWVAAXX7b766haDYbEIEzCssjL5j4lU3LQc3986bgrBh3S X-Received: by 2002:a05:620a:3a44:b0:775:8040:edf6 with SMTP id sk4-20020a05620a3a4400b007758040edf6mr3531340qkn.48.1697867295005; Fri, 20 Oct 2023 22:48:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697867294; cv=none; d=google.com; s=arc-20160816; b=I8yC9zJwFcGCq6Llhy1bxyu5yhRvmq1SbHNVRoh94GRdLxD3xjAUl7efPn5fRumvpe VLKpwj2fjTXuT82VuT39SqEwIPKsjnP3d3kaNil1eVwQDCNt0d7QVx0Szue4XisSee17 3U7cdga9wHIBpwSpMk4FJ+ys1UBSCOzw7VFeydLEhioi7OvpZZbGFguTAGspmmeFcgVD pJvvZhBu/xJiM4QzdcRl2QjG8RlClTh9OAF2dzeAI/UOVYyQ1T5EzzD59Qqsa6UQ/3t7 5Q39EVcn0qFVwL2ZeI6XrzT+VDYvKHXKTowiOA1WNf6OeQfmgv/nCHXAoykH3jFlyaK8 GKow== 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=0xchaPvTfKtyPXX7nCwKfSuvDaTCv+hVJTwEWoIIbJAHkLAW7gMlrjeXXvab4NInjg E8zJJFIRT0hvRAdk8mHXeh0AOoFxGzvGkQXDdpSUaMlRO01fFulB83jE9EBt2HjJmJ6n JzThkzQPXB54jSWouRtSa+EHMvmU7VYuSS5a3zeeb07xFAtDbhJUklO9GopsBRyTQuTX md853D6H7V07NPiYgj9x4iPpGi6zubikB1iGElkRbOB6Wht/Si/LvKUTPQtLpAGxhxDM Y/tx8rAjgn0eREdqLpbMpSxtk58UpeBWxB39dY6eKkOuVpYmfpkH+/OUCOTihr1gqq7t VG6A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=zl5M9xg7; 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 p17-20020a05620a057100b007758709cfefsi2425809qkp.215.2023.10.20.22.48.14 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 20 Oct 2023 22:48: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=zl5M9xg7; 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 1qu4au-0007AA-4i; Sat, 21 Oct 2023 01:32: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 1qu4as-00079N-FS for qemu-devel@nongnu.org; Sat, 21 Oct 2023 01:32:14 -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 1qu4aq-0008NJ-PZ for qemu-devel@nongnu.org; Sat, 21 Oct 2023 01:32:14 -0400 Received: by mail-ot1-x333.google.com with SMTP id 46e09a7af769-6ce2bcb131fso1009013a34.1 for ; Fri, 20 Oct 2023 22:32:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1697866331; x=1698471131; 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=zl5M9xg71jrC9xf67X4wDskVVWdRVxPw37v4VECT9FO0DwtLjT9y9goJdWDp81nIcj TlqBrxya6MrFOqOMEdbb2qFv2MCqiYz9GT/9WqRPTHfNFozLEBbos7/ftLTW2db9fmQg wtrXOxBjXny4ck34EEvGmGFLgUiUfZWQyyunD21sUpD30LaE3X47sg4MOJCSm5as0o5t TeVAqcq0rbeqCMcwO8w7l/oUyf0BeZzB6McrkmCu6ymJWB2bS5GCVOSf0RGse+WR5m/y vjeo+o5bBrl5YoPe61RY9XMWj/InDSglBADuUEbdacGQ4/VKwbw5QsNBVzPRF97lLdik 6jZA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697866331; x=1698471131; 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=hH7sOQU+9qdgExawucUTaAqrdHITbDJYSnsrmd1rPLHB66CCOPkMMWjXkq3aNBMBXj GRIQkZ5qelgZ7ASwfhVZai8rjHCdowWpY17It+JI0xKSFPb9I8/GPtE3RzfqBsWNfqVT W9CPY1dzJ2RcIgmAPIvqWUKz0rhmXWZHHnKvQEnDqN/1+Our/IaiEmF7pb4agEkaRZOw JKghgTvbNKHSr5qL0WSJTOv6+8nMvwfi3OL3VGoEd1QY5KvufosTzLz+VfvHD3l00LWB JmLOeEGvgks/PuD4iXTq98ShB7Cm9lVRxqF3MpwaK70kwteoa8kGzXs0gR1wr0xnKOOP wFRA== X-Gm-Message-State: AOJu0Ywgl86jWIbAAa8owWyt5XjOqmpbTXVLbks7GImvn+wxNl+7earm H1Ly0BERWtbTzsSTyibrrgTsfUSccarV2e3yuXc= X-Received: by 2002:a05:6830:9:b0:6bc:f999:a544 with SMTP id c9-20020a056830000900b006bcf999a544mr3923730otp.15.1697866331473; Fri, 20 Oct 2023 22:32:11 -0700 (PDT) Received: from stoup.. ([71.212.149.95]) by smtp.gmail.com with ESMTPSA id f20-20020a056a001ad400b006b2677d3684sm2434831pfv.206.2023.10.20.22.32.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 20 Oct 2023 22:32:11 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: mark.cave-ayland@ilande.co.uk Subject: [PATCH v3 14/90] target/sparc: Move FBPfcc and FBfcc to decodetree Date: Fri, 20 Oct 2023 22:30:42 -0700 Message-Id: <20231021053158.278135-15-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231021053158.278135-1-richard.henderson@linaro.org> References: <20231021053158.278135-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 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 Sat Oct 21 05:30:43 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 736621 Delivered-To: patch@linaro.org Received: by 2002:adf:dd81:0:b0:32d:baff:b0ca with SMTP id x1csp632476wrl; Fri, 20 Oct 2023 22:35:14 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEv6jIzF8Qzx7bOQT8mQlUpqZoPty4ucoFbx0GEfGlxrlTeZKF+9GH8+Iyp2/A2d7c//1/z X-Received: by 2002:a05:620a:410c:b0:767:f1de:293c with SMTP id j12-20020a05620a410c00b00767f1de293cmr4106099qko.59.1697866514736; Fri, 20 Oct 2023 22:35:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697866514; cv=none; d=google.com; s=arc-20160816; b=KmVfhGVLU8z7K5XuctJ0n7sk8K1jGifXkYulDpvS2UrMDLurFyyu+uCa+YJUkwo+uy F+gfn+A1J5Z3AXXE6kJVw0MUhcc74Io5NQx2Dt2Kablk69EmfzZwI9rDN72dwmO5aIN5 akA4rWz72j7/DJjWcZLpQFmQxo531dkep5G2zU4iTny8BxUDnN4rGRopkx3Bp3qARLoY aU0Mejg5H4BO6w1oGgySvLUBqBq7Cc32idzCI4kfDP1D8oNj+n2TVgmKsUVUFISzt6PO iyxcZ0PyV0c7l8j1RlqjbT1hjh1b19Z2u8r+4l+/MwS+gDMhdFeFlFXTaUHtZi8fSLQd OfLQ== 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=rAPR3X5Caym0mSFsEFjQ8fDdSbVNT7MxIg0BpwEgTOlptX/7lLw9YaXhsuSSeZX+Gk +h8V4/jGg24e5WCRq/19EMUP0SX9oyb2jPo1tICM7qnZw1mzDHEndeeLmGWbx8iUKuHl Ix9ySIQYQvj/37zl951+1V2epbG28mADmSZQOmsiMl7l5Kvf3JMzDKRlWoI5fWaCsq7w ATKW0rPB23FJrBVFjbXX25Acs+SBW/0Cq47AayHqsuu+g0AhoBELPTW3d20aLXJHOBxN GSrbbcKTJ2Ilh08rLuurbAwi0Glkg96vnYA+uzasdvyCoo4Tt6TxN3uaii/fxjs9YULb bYhQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=cme65L8C; 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-20020a05620a1a8b00b007740257b80esi404711qkb.311.2023.10.20.22.35.14 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 20 Oct 2023 22:35: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=cme65L8C; 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 1qu4b3-0007D3-D9; Sat, 21 Oct 2023 01:32: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 1qu4au-0007AC-5x for qemu-devel@nongnu.org; Sat, 21 Oct 2023 01:32:16 -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 1qu4as-0008Oo-Kl for qemu-devel@nongnu.org; Sat, 21 Oct 2023 01:32:15 -0400 Received: by mail-oo1-xc32.google.com with SMTP id 006d021491bc7-581cb88f645so915775eaf.1 for ; Fri, 20 Oct 2023 22:32:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1697866332; x=1698471132; 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=cme65L8CywUh/lM8pRoWt2CXiZ9mCCnW2QYd8Fnh3kj/mtWoa2fsLkaLJTrdsviaoE /6UU8NcyTk8SUVETg7goBLpE9fPW9hafl187CV4AlYbEFfTBjB8wJAXKuC7Gef5Ch3gT cgGAxdnnnl0W8GvN4vxxRemiDM/YmNK0r6E5iPouYFeg/zgG8exh7h5/ziporJD5V8AQ 7n7azV4uaoIi+b+etJ3WwmKimcxJZe66nBTyQcUNFFTCSrgaPKwlFNYA8U+DUmNIOc7+ FJG+pZ94181fIlDt84vWodEIL7nS4Z5GazY8pM/h2e1GsJbqTbZ3W5KvZnz8TGn+o+N3 NqaQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697866332; x=1698471132; 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=ux/jIUOkNGPp5Gtf4hXS/jtXlUO3mFF4uPSSZKqARXPGr5fvPzosngS8XZ773VUQOi gyS4qGM2C+wjdGxJ7XKscYmQhO6PkU1p/R3gJE9S7n39tSmcAB84n3L+Eod1otHgdXIz mA3gY5giufyC71bWjQVoGgOcHK3y+W45hMHuoC8FIVBbsi13jow3nBJU06khehReKufD DPHuAvAV22YTccmbEqwtqRgesl2RXtdnikDga9P9VuJUknd2ciRL0n/K8vJ+jbDIUdm/ xAbhUkaKNtI23Eglz8aGEmBInUWYCZ+phbIS5g2/YvkqpoEQbk/AJoF4Ydj51IFcEHVl Fuzw== X-Gm-Message-State: AOJu0YxpDv7hpVR2AQk6SRx4mtjaykY0Pz+aMyXORNBpWPsc5eibHIXZ Ee2kOhTyQw51OyfEWb4vgVOfBZ+UADgZCZeL55M= X-Received: by 2002:a05:6870:a105:b0:1ea:d8bb:411a with SMTP id m5-20020a056870a10500b001ead8bb411amr4786944oae.6.1697866332219; Fri, 20 Oct 2023 22:32:12 -0700 (PDT) Received: from stoup.. ([71.212.149.95]) by smtp.gmail.com with ESMTPSA id f20-20020a056a001ad400b006b2677d3684sm2434831pfv.206.2023.10.20.22.32.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 20 Oct 2023 22:32:11 -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 v3 15/90] target/sparc: Merge gen_cond with only caller Date: Fri, 20 Oct 2023 22:30:43 -0700 Message-Id: <20231021053158.278135-16-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231021053158.278135-1-richard.henderson@linaro.org> References: <20231021053158.278135-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 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 Sat Oct 21 05:30:44 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 736605 Delivered-To: patch@linaro.org Received: by 2002:adf:dd81:0:b0:32d:baff:b0ca with SMTP id x1csp631982wrl; Fri, 20 Oct 2023 22:33:15 -0700 (PDT) X-Google-Smtp-Source: AGHT+IE+Kg7EnEZ9rrMlBKD8bverdJEASoLcg1rZ5mhtfwncUhGJrFaImevDwKX/bYkaegWaxi0H X-Received: by 2002:ac8:5c04:0:b0:3f9:d1c3:cc45 with SMTP id i4-20020ac85c04000000b003f9d1c3cc45mr9167432qti.28.1697866394962; Fri, 20 Oct 2023 22:33:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697866394; cv=none; d=google.com; s=arc-20160816; b=vHSTaBq7Dd9KUa5TvW7AX01ws7Gl82Ekx5KK/oIbFP8Eh+Qr1f80Cdx6eA4KAM99Eu k588qbcqJ21yKYiOJuN4YzhaLjCGqeIPgCLjxPo24UDuvKsXBJxo6/bvwYCY+7kBNcV1 3B7g0jqrTiLgGLXmXUzjZE2+0VD3SEER/XfxJVr4M5GwDSP8DyOGs0QEV5iuyHOHgAEV +JjswWuBdpWLj+IilabxUMNbHG7ZM39TJTkR2u0R9BMrbi0C2e2EswFazT2y6EeJCmn0 +AbxlMZMkAbZJ7LtK8MrVQZSlBWqHn5GNDTy7pzrnK1MlW4PoUfPFdJPFAjizt7CRzz2 1e4Q== 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=xGsAEe94nIt2T1Win45Q3zhXZT2OQ5h7tw7pzWPn3ovzIH16U5p8mAcKe5g0SqEB3d l5jC+ZcLuF6RGRywdl/JXh3/Yqt1DYOy2vnEkVM7gNY6sl2lB0KM00vQPGN8WxAg2P9D vVNeWyJJZWvtNP2m+RqCRyYY/ezkfd6+SsOOdQFU86DPfYBTX+dOyX7e99/YUfvJxPlv yj6a8garGSAkRJcIbz0boPbuSQRA1053xQiGRpHtOh3HAB2jyqkZvdNS49b8Gd+JI4JG WK8bABjFFN76A7iGWYW7/N/M2k2mODf5K5aLZi73+elnJJ0/8cZ3f5JgxNkWjxpZcHrx +uRg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="B/utY966"; 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 i11-20020ac85e4b000000b0041962bf1693si2363006qtx.762.2023.10.20.22.33.14 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 20 Oct 2023 22:33: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="B/utY966"; 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 1qu4aw-0007Bp-VP; Sat, 21 Oct 2023 01:32: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 1qu4au-0007A7-2a for qemu-devel@nongnu.org; Sat, 21 Oct 2023 01:32:16 -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 1qu4as-0008Ov-FK for qemu-devel@nongnu.org; Sat, 21 Oct 2023 01:32:15 -0400 Received: by mail-pf1-x42e.google.com with SMTP id d2e1a72fcca58-6bf03b98b9bso1675038b3a.1 for ; Fri, 20 Oct 2023 22:32:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1697866333; x=1698471133; 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=B/utY96650aNFsj48teI+n7ofj+ivT4P2GH4iyuoOBB0rzbTrQpw6AJ4RpGF1vTAyg RYXIIrQJBQaRSktow+cU4FjOg6PXbVH8ytAlKvFSHELw/Q/+YYxtf08KBkoPGCAcR/no WUFFYuvmjzQ5NlNB1yIMnTihPv2qasttEtDi4ppcS6XZzULBA8sODf6EV4jcZJZCsNAY oAoyNqa6z7PrN4Xsitft5tBlGphx6dCaWq6G6I5m89HRTcGa3KaAWlvJiOITOv3GlMek fDLi8cdb0aGYGjc2/QXfN1CDjBfy6Bbwg4eWSNnOvR5yW2MQ/Zz33a0mRMDRx0q1ucX7 HE0Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697866333; x=1698471133; 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=l84ghE3iiOIRooF69BSi2zRmr51qHC6Y7CNwUvQ/Q+iCfgTD25GkPt/PHIILfvJ1wG Gx8gG/Z29Ea8Z1HaPwrH0DB836jOr+l6xlBwXBE0j8ed/i98W0N5Esd0nOqp2Oy5h8Do H05FF52GHYaX7jJNvR93j9s+FJBnj9iVrzsiGbhcRZU3L1L4n9HCcIYdj8d+AmzMnCJS z5gFadY/WAiBBap2TLo6h2NV9OO3PLFzitagdOmodu5co+y81v3fzIfCAFDceLABxXpb ffwOVhoMKJH+gTNSUIwvnBs1lhAiyqM/CWuWpTEbcwgTzPBgOcQ0ga5rP9dP23NKaYpd srKQ== X-Gm-Message-State: AOJu0YxIoG3TiG1l/ED0KNLFUGzel/Pg9dBenANKqXmn72eyqSTJ8vWl OCzgEx0KkPE13I9DckuJKUoBNeUKSWDAMdmODco= X-Received: by 2002:a05:6a20:8e23:b0:15a:4c23:870b with SMTP id y35-20020a056a208e2300b0015a4c23870bmr4682658pzj.23.1697866333106; Fri, 20 Oct 2023 22:32:13 -0700 (PDT) Received: from stoup.. ([71.212.149.95]) by smtp.gmail.com with ESMTPSA id f20-20020a056a001ad400b006b2677d3684sm2434831pfv.206.2023.10.20.22.32.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 20 Oct 2023 22:32:12 -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 v3 16/90] target/sparc: Merge gen_fcond with only caller Date: Fri, 20 Oct 2023 22:30:44 -0700 Message-Id: <20231021053158.278135-17-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231021053158.278135-1-richard.henderson@linaro.org> References: <20231021053158.278135-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 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 Sat Oct 21 05:30: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: 736608 Delivered-To: patch@linaro.org Received: by 2002:adf:dd81:0:b0:32d:baff:b0ca with SMTP id x1csp632026wrl; Fri, 20 Oct 2023 22:33:25 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFjelM2Dm8ZB3TqTNBn8Pj22LzZNpliKhuE7Kf9ionFcS+X02L8Tn/VI3bgHCsxFx3ZTpaP X-Received: by 2002:a05:620a:28c3:b0:774:16fc:65e0 with SMTP id l3-20020a05620a28c300b0077416fc65e0mr4009217qkp.12.1697866404850; Fri, 20 Oct 2023 22:33:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697866404; cv=none; d=google.com; s=arc-20160816; b=l2vf05uznT4Fl9Sh1D4jHBT6sJmyoa5LRPXyXqWQRttE+5MsquuFqCm59z9YcyekrP cSbJtEuQ5sTn9akDce0AapkJX+y8nKttnesQ9M2pelmSe5R8C944c33mKVWEvQRcx0w5 1UBRdGYEL1CrvyAAS5mE+/DI3DFdGlTXeDsJMJw1QyRNGBS+fIitzleCDAbZwexhe6Nl FD2VivoLtoGAKXpuAyuW65wXMyMxDsgvuL/Gcamx2alBgMMgIsU5x4dh3/e5rGn5mDWI Zl0lI3c4z2KQeuBBG+VQ+/+Szm50WN+bLNrwXtaKI8q5jGDgVaxMftH+O+NCB16ieX05 nwcw== 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=0MpjSEFfHuzfoWKCOMuh7dwx3IwqBorGEqJ4QZDa9I7OtNbH4P33EAKGX4MYnR0XyH YX9uFqXg5xr2B+Lvgbj85T+YmXFMX6vj45sAhcU/L3YTD8g7sev/kqchJHhItEgKFsA2 XTYrvU4+Vf53LC3zK0b4lPxt5+WDleJF9ThgX8cc4nROixjqLMeKjJlqhahZYWknmkdP A+lfqgW3ijqfVhCnBnnkTD2ykXKS87ztPI/0Q+rG1iT0tSOnXx8CSDbYHXYINGPzH1SU 7J0M4u7HHl2rPbbVmjBl+GqINRxaJefr1n4J3DVFIQ/HEK71dbqOqvkMkVbFk5eTf8cB A9oA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=k6ByhLGI; 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 q15-20020ae9e40f000000b0077742712562si2345264qkc.335.2023.10.20.22.33.24 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 20 Oct 2023 22:33:24 -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=k6ByhLGI; 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 1qu4bD-0007Hr-Ab; Sat, 21 Oct 2023 01:32: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 1qu4av-0007BQ-2K for qemu-devel@nongnu.org; Sat, 21 Oct 2023 01:32:17 -0400 Received: from mail-oa1-x31.google.com ([2001:4860:4864:20::31]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qu4at-0008PH-GH for qemu-devel@nongnu.org; Sat, 21 Oct 2023 01:32:16 -0400 Received: by mail-oa1-x31.google.com with SMTP id 586e51a60fabf-1e9c9d181d6so1103903fac.0 for ; Fri, 20 Oct 2023 22:32:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1697866334; x=1698471134; 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=k6ByhLGIJjfbJV9LVDTIeMPrOyFVYGUchUGylXo8xSRjs2T5zfIxkOq2CBVqZtmc/U ScB0SdEcU67zIUUrON/k0BXmCg+CpCbBPNpnJpBDZ+4oOJ5gJFbPjRASuewI7E2MsnGN v9oGAx58ebna1Cha8PPM2yieBekKGkzLzlldDQyYgYMfqUQQ/vgvLMjVqmxKsCmBrOAD QjYC8yUIfXZ0V4g3/cZVIt/7U+aqmelMqPVFCDVXHiKC86m5lpNIdkUHc0/sKt5782w2 TMUCuFiw1ChnfVlh4eCcEjBDH1a1MDwZYFnyyVtpe9CRAoy+MRj6Zg5Jm5AbXcnCQObo Cckg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697866334; x=1698471134; 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=tN7sznl8lG3hoDBRjcI0UCLj8dp79E7OJJDgIQHQpaX30gCiG8rUskhLqKGgKc9arG HfmLaLzc/rjBsKD4fMyVwg9HZlRRPax/5wKGQLf7+rwGV8V8qZavDcGiXS0hlxAgXHP5 7xLRVLb1Wb71vGcTTI7OXHtQG4AqT3Mw2+UUQC09KSzGApaQ+ROmeZRBqzh5RkniEIXS pD4Ok0MvU5XnDJcxiRPTLyaD6DoSZ8ItUIikXZWv/yTNSlijSI+MD5sIb5aHRnWW6IZb PueqcnWbuzY1njIPPxTAAgC81/+06gtmC5khxYK0U9FLJjvFL6hgTzx+ndmLTdH30Srh GjZg== X-Gm-Message-State: AOJu0Yw1LAMuaBCFbXtqR5DFqs5ann7kfVmAdfyQrFwf9begDHSlnWfq C/9tT11Cj1zeI1RxY007UMA38eFMFm8kIgfpUjM= X-Received: by 2002:a05:6870:1254:b0:1e9:dd69:2fc1 with SMTP id 20-20020a056870125400b001e9dd692fc1mr3952699oao.7.1697866334116; Fri, 20 Oct 2023 22:32:14 -0700 (PDT) Received: from stoup.. ([71.212.149.95]) by smtp.gmail.com with ESMTPSA id f20-20020a056a001ad400b006b2677d3684sm2434831pfv.206.2023.10.20.22.32.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 20 Oct 2023 22:32:13 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: mark.cave-ayland@ilande.co.uk Subject: [PATCH v3 17/90] target/sparc: Merge gen_branch_[an] with only caller Date: Fri, 20 Oct 2023 22:30:45 -0700 Message-Id: <20231021053158.278135-18-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231021053158.278135-1-richard.henderson@linaro.org> References: <20231021053158.278135-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2001:4860:4864:20::31; envelope-from=richard.henderson@linaro.org; helo=mail-oa1-x31.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 Sat Oct 21 05:30: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: 736609 Delivered-To: patch@linaro.org Received: by 2002:adf:dd81:0:b0:32d:baff:b0ca with SMTP id x1csp632052wrl; Fri, 20 Oct 2023 22:33:29 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEJo44nLPx1DipZ8qAUrjDYLQv3mUzzJxIwonKokjl9IbBmViwLHBzzBqZYX5Hqndb3lRiA X-Received: by 2002:ad4:5fcd:0:b0:66d:9f57:a45e with SMTP id jq13-20020ad45fcd000000b0066d9f57a45emr2002616qvb.7.1697866408895; Fri, 20 Oct 2023 22:33:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697866408; cv=none; d=google.com; s=arc-20160816; b=T6484LGwwHdLKTSqAeV9G2AnuW1BnvzKNy/Xzi+rBeUHkrN2GFIoanaFDT79I91nPM +Aze/OxAVLc6G+2t3OeYaR9vQfA1d2sY6bHxUJIXDRQK5wx+jYeJ77U7mT7y8wIvJoaQ mXSCiIv3xXBAb4ctwmNXfsf0VmP0BS50f3AeZjcCb7qjbjj1w7Tbw9YR2mJZwtWrGHB/ JkbVu8eUR8wh8rYE3x0d3xf9QmQQylr/ftNJT3KgNyeUKlEAJROY+J3Gr+sAZyqfUC+E YAXKW6ICj1VHilqebtyevXbanGQGJPk+Y/fpZ5Cl8Q+uX/hfILvN51LOcIBXJ053XOrW ez5A== 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=TqP/EVkKvzbtMBVmDYCTa4W+B1vmRSr5aVBU0G5dJo0tvJG1ApcnLUumKNl57RnyPs PJFz0D6KTErJEeQnyLr0L6bocgNBjrKbgxy/rXcJ2cZhM2Mv93ooniboIaOxLrzhlZHu TYXf0aF691O5HB35bcx2Vs1TT6EcaZcOi0xgtYgfwfo99UBnEOJGQkBntnZcI8gomsVo kTaQNMal+Zkzn5runOr/3CJf6DNUALGOYVkXD51r9DZaKs3RI+I2+neut9XinUB14X+G j+eeMtRWwnzfQjM2HLes0tABo4YRZH8KQX7nrvY5uk43w+DMTCA5zhWaUMz6lu8CAMMK MoCQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=vbE4E1Ud; 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 y20-20020a05620a44d400b007789159c524si2625775qkp.519.2023.10.20.22.33.28 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 20 Oct 2023 22:33:28 -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=vbE4E1Ud; 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 1qu4bA-0007Da-W6; Sat, 21 Oct 2023 01:32:34 -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 1qu4av-0007BZ-Iv for qemu-devel@nongnu.org; Sat, 21 Oct 2023 01:32:17 -0400 Received: from mail-ot1-x334.google.com ([2607:f8b0:4864:20::334]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qu4at-0008Ph-UL for qemu-devel@nongnu.org; Sat, 21 Oct 2023 01:32:17 -0400 Received: by mail-ot1-x334.google.com with SMTP id 46e09a7af769-6cd33d51852so1006650a34.2 for ; Fri, 20 Oct 2023 22:32:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1697866335; x=1698471135; 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=vbE4E1UdZKUO1BrBxRO8g94jIhTa8FizzPxg04GHF1CFBVM0L1dLajn/HY5ZxpEIPW LQAmB/1eJYdg81SD4F+BCo8cwXZ2A0OG3xWKeFOBVL1DgTZSDBZgNUiOBfDPJhJN4yi7 d46TRhLy6oGqjNbUIusCo8/8pI9XrUdXhH0kXpugdDe6CmVBaLFuL6kQb26IR4RQwHRN UxrH05v0LrLW6US8qPdro7py+joWBFjjKhIXHoyqdpEQY69UVDxEy4po0/W7DHnSyAGg g1ktLnaKSs3Nh5qrFMj6cpJOGVq/noZdTtXJwnHga8yJfsGuUhHzDOCGqcQZvMCiSp+3 ek/A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697866335; x=1698471135; 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=EBi6QH3YeU1Ex/P3/J/OrTFqyhvBp34yTruROR/8qdafuWWnU9+WPqYcMeEV1r7e/z +25hnGut4PKVlsWBer7HucQNczmEm5W2f4DKzjKWWfsxh0S1jz2dhXTkkO8w2vgNTGD7 UZu7oI8ds9HtwkcFfKJ+x+qU5gX3qwrVD3qKKgjJDZ14lDeBJb02rQRVEmz7BGNku9Ow kMJc6Hly2pf6rXtxJSfvBZ+1NC1HBjDMD/C8IGRFaWUyb1BWjBxYar8Dy+1f6miFYMZS S9eR/Jfy4M4dTdbjD4N9H+JlkVOVJNfXWMZ99fBSh75z6TxiZCMpNf3rmq0E8UCVg2HD ZN4Q== X-Gm-Message-State: AOJu0YxSlbCJN3yElVV237SMKO5z4hKi/Ub1n8xC/chS+3Q7iY84LVv2 bB8QDQo2je2tBGOFtNZ14a7N1SIN5CuReL7ocXk= X-Received: by 2002:a05:6830:10c2:b0:6cd:a989:c7ea with SMTP id z2-20020a05683010c200b006cda989c7eamr4308359oto.16.1697866334849; Fri, 20 Oct 2023 22:32:14 -0700 (PDT) Received: from stoup.. ([71.212.149.95]) by smtp.gmail.com with ESMTPSA id f20-20020a056a001ad400b006b2677d3684sm2434831pfv.206.2023.10.20.22.32.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 20 Oct 2023 22:32:14 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: mark.cave-ayland@ilande.co.uk Subject: [PATCH v3 18/90] target/sparc: Pass DisasCompare to advance_jump_cond Date: Fri, 20 Oct 2023 22:30:46 -0700 Message-Id: <20231021053158.278135-19-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231021053158.278135-1-richard.henderson@linaro.org> References: <20231021053158.278135-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::334; envelope-from=richard.henderson@linaro.org; helo=mail-ot1-x334.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 Sat Oct 21 05:30: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: 736642 Delivered-To: patch@linaro.org Received: by 2002:adf:dd81:0:b0:32d:baff:b0ca with SMTP id x1csp633664wrl; Fri, 20 Oct 2023 22:41:08 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGsjau/aBPQpillDXyYeW4JYBt5UVD0wbCjj1umFIhSKAu+yjLEl59SEoOZRLBJpd0sRXmL X-Received: by 2002:a05:620a:2889:b0:778:9ac2:5a9f with SMTP id j9-20020a05620a288900b007789ac25a9fmr4158906qkp.11.1697866868044; Fri, 20 Oct 2023 22:41:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697866868; cv=none; d=google.com; s=arc-20160816; b=HtgneCHmk2Vh25xNALl4LAIv+6AcqWLOGVfQ9UsY0W5tZlJD1w9x3U649uMwrikwCe bZHqkbybas267jnKh3LEYdkpc385avKVlXddoRQ08Xr5oi5Uug29KVwNDqdMt6VYMkDv ReHhQEzf+cx7Ql5lAMWr5DkDGr6sVYnI0NOlTDW0/XJ9SM/XJw2XABp5RNsusOI6sgpb 5Pmy5aSSc9mxKUa2GytGvzrlfJ2AKkcIqJho/osANY18FKwHPfjsi01yHZAL+cARHLY1 3CmeXEYPuiKlhxVKcc7Bay2GSSYiRa/hCiErUJdVvr9O6YQ2kKBoO2slZ3MlKXj8adCl 32kg== 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=x3U91TnS8D2SOpjNvfhPBrO6cM0ZNlgG/vH7QVw6DdkEU66NCZrbzXplKAOInZmO6l B46VuYrMlPEtTTahE/VzhFxsyz569HYjPFxoaHgDWW8fMiw9E5LtwIKH1ggnxlmRLBEf 7Mkyuy4Oh4QwHGbjEdD96GjMXNJrYvPIlCC+RX9+81k01c7+D3201FG1m9Cgf2z250SP 8TLm8wxkGYsA3c69lTLGyCiqoSvXzr2FFdWic2lHbRb9Sg0Eqxj07YMSeGpkCcEOw9CP Ewh3yXf93rR2gJXTQM+yaIdxOTVAFU7JzGVett8XLmZ7qCoo1hnOmIlAsAUoVjJxZYEa lLvA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=RVX8MxnH; 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 n7-20020a05620a294700b00775cab41f38si2446000qkp.79.2023.10.20.22.41.07 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 20 Oct 2023 22:41:08 -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=RVX8MxnH; 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 1qu4bH-0007IR-C3; Sat, 21 Oct 2023 01:32: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 1qu4aw-0007Bq-IB for qemu-devel@nongnu.org; Sat, 21 Oct 2023 01:32:18 -0400 Received: from mail-oi1-x235.google.com ([2607:f8b0:4864:20::235]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qu4av-0008Pz-08 for qemu-devel@nongnu.org; Sat, 21 Oct 2023 01:32:18 -0400 Received: by mail-oi1-x235.google.com with SMTP id 5614622812f47-3b3ec45d6e9so1048275b6e.0 for ; Fri, 20 Oct 2023 22:32:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1697866335; x=1698471135; 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=RVX8MxnHNC2M2+2OJTsTlYEo97k6p1ETF9XmBN+5T6qOvsVfsuM3stfArs8hiQ2sFr wN+F1MGMlHgG4FALATEcktGXfAJfyxrsHhAg+QbqZLFPVzX9ktqfzUOvQmfs4PJ8L70F OF28XxNwAcLGdmG6Zn7vmJu03PzsCluM43M3WAtf4acct4FDXGZzynK8fV8efQ0JN1/6 yKsjW/7Pet5cFSeu5KvwWIup0C4HWSEuz7fv6xHOK+DGSysPS+Y8Cd0eZTByJ8XGvDbR Gls24IVHx7mRRUJtlJ3LxGXtZVbSyi1+nkwk0OFja88V1KQMXeZh4UZtCNMOYzq992G8 o7lg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697866335; x=1698471135; 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=TnXUSTPKorAjdfz1nEL7Tc9CwuCMin93Vs4amOCkAlOji8HqfDzIJb10m/F15QKpCD +TwBfPC1qbjTzw2S/cHWyGZ95vAiPlbQJ0GZekh2L7puvrJUjg1l6/PerIfT3uF1pf3h qRFP2/vet/QShA780otakfmIkLatYtvwKIQjebuHfFC8e5QNtvApwrXksPXia/BeN+Xk FqdaAye7noe/rHDQOcMm0ePY4TXyKsu2CGQTa35m09+/WBH4x8hfCbs12D4+5wyvm0uv i3hM6VRE5JwfEANRCia9HmsF5lbBwWOVdLaXUhSgLNuoS8AYlsaEEZeLIP9QiIIRth9u iWBA== X-Gm-Message-State: AOJu0Yy2KcaOu+FpgoWZM2KkRW3QgZHaga1ZUEwlk68fvSC3z1Gc5XZ8 VW6w3aFws2Z6fRQdT5Y7t5qToOkE51WOTjB96wI= X-Received: by 2002:a54:4e84:0:b0:3af:75e2:4c34 with SMTP id c4-20020a544e84000000b003af75e24c34mr3696457oiy.50.1697866335724; Fri, 20 Oct 2023 22:32:15 -0700 (PDT) Received: from stoup.. ([71.212.149.95]) by smtp.gmail.com with ESMTPSA id f20-20020a056a001ad400b006b2677d3684sm2434831pfv.206.2023.10.20.22.32.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 20 Oct 2023 22:32:15 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: mark.cave-ayland@ilande.co.uk Subject: [PATCH v3 19/90] target/sparc: Move SETHI to decodetree Date: Fri, 20 Oct 2023 22:30:47 -0700 Message-Id: <20231021053158.278135-20-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231021053158.278135-1-richard.henderson@linaro.org> References: <20231021053158.278135-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::235; envelope-from=richard.henderson@linaro.org; helo=mail-oi1-x235.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 Sat Oct 21 05:30: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: 736620 Delivered-To: patch@linaro.org Received: by 2002:adf:dd81:0:b0:32d:baff:b0ca with SMTP id x1csp632467wrl; Fri, 20 Oct 2023 22:35:13 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHPRCl4xIrwCgcyOPtlX6CfTsS0zCowgitJ3GL3sZUPxS3sjVJunkldIG0zdnrvMWsjdi+c X-Received: by 2002:ad4:4eed:0:b0:66d:2e59:4fca with SMTP id dv13-20020ad44eed000000b0066d2e594fcamr5217703qvb.35.1697866513284; Fri, 20 Oct 2023 22:35:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697866513; cv=none; d=google.com; s=arc-20160816; b=SuoTz902o9MDTaZM9LhSWBJlCmT7vmxkiJ2Q41tixitomHi2WYt0Pi56IoEBIlDnfY U21HV8rw8vlV7i31UmnubdBtKqcxhT98NpfTxQIfkBE6DkaN2W9GwBgn8XQX/ut0eRly 5mpqYlLO26GYxXvl+jQRTBVn29uj0HX3gqn7k8/M608BNS1l/B5ep/9/UQYb1yiT79KE cnq61XFgzmWSPLuWgWEq4eObR8WrJZOjIHMAr38vDNM2WEMXB8odE+osudsq+YOkBJX2 aRm6FqjRkuf6YJ9jfSfrW9XoUv97dd09zpaPlkkf5TQ89MuyU+ia+c8n3blUPI9BpIAE txgw== 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=BYTmFrskIneu3p1Rb87sHfuqrDf6tg4nHqCid63q4WpthsSQTataKaUyt0fFOZL4Ji Wsv+wXAYB0Y1/HOaZKPyjZS+vdC53CZuiGpeF6uAaBtbGdOOTO48X8tTAEr4Fb5hyWBX f4u/P3soVt7iVYu9dyquJc6rAfnSBaItf27GMIAUOv4wcqnrwuX2t9wYDRn5A3wvCVLv 5OguJxJAotxghGQ6ldvwup6C/43KQP3pZBO0plsvgKosmeshpvmf6WBzRmND/ekoubT7 8Z6SI6fmem75DJY8ESCNqwtr/628GAgL/EgNqmdpWVqekFc8pANV+g3kRXfHmr46WJe8 Kt6w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=yp5TqNYg; 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 l17-20020ad44bd1000000b0065b16b39ce6si2407253qvw.207.2023.10.20.22.35.13 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 20 Oct 2023 22:35:13 -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=yp5TqNYg; 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 1qu4bI-0007JC-3v; Sat, 21 Oct 2023 01:32:40 -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 1qu4ax-0007CK-HS for qemu-devel@nongnu.org; Sat, 21 Oct 2023 01:32:20 -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 1qu4av-0008QI-Nq for qemu-devel@nongnu.org; Sat, 21 Oct 2023 01:32:19 -0400 Received: by mail-oi1-x22c.google.com with SMTP id 5614622812f47-3b2e22a4004so1095656b6e.3 for ; Fri, 20 Oct 2023 22:32:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1697866336; x=1698471136; 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=yp5TqNYgHHvMElL8hN71YSWinOQhDOCiKfkX1emoShmUL7DF07nv/3oN12M5LAJpKe cm30cB4cLtL46+4TCdDQLqivUeT1UD9+QN2kS7ifbl/9lVZkWhEEFy8m0VR64Bff/WyX 8AoZ7IfbyIpLie7Xm6RNt/nDXKkg6SVOxDHMNK39wouMBQNxtkMuh3ZECSvTsH8eHzKd e1yPpecld1Huv5ULpkfnNwhR5IbzNk3D8iGen1EK3pRVEWHqVAditu+mpTgNhyjWx35B ruAb/6rjcMib5CvCom/QiKkrm1BIVNvx6ACdeLAavT7kZZVYACwFUJKtLriHffyDQ7hk 42WA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697866336; x=1698471136; 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=Gzk3prX9MoMZ2HKN46Z10GtwxjgYh2jq8N2/bjixQBlzsd+mcz0rltv66bRxGF6eCe NgRPGUSjaIQh2XiFd7y+srHE8uwQVAsXsFYGHxCXVC7XjWHUy31p1uSM7Jyz1awN0dL9 4XMDbNZ9O8E2me/mweQlGqbdv79xH/V/KfdQTzY6FLLGhjvdoXnHQm9gg1MhILA70zyi uUSCfJB46hkkdZB9lFXa0QShaZ02p6hyjth08SXrEM5ZVn5wOmlwJsCs4IwDXDadGTZn c6/ehbOTl+i8YN9hXZY4NdHO61pPRewK5pttgVXd6CjWfgLQGUA9gP+GG45vL9Ps2MZ+ mvzQ== X-Gm-Message-State: AOJu0YwVVjAMs8tTS/o6JOBt0G12PgUwKV0Acq3sfLlDGdtbMCjM0okY u+fT5cjcSjaWyeOJSyce/I+vt8Q+pJconvLFUOE= X-Received: by 2002:a05:6808:219e:b0:3b2:dd7d:fc5e with SMTP id be30-20020a056808219e00b003b2dd7dfc5emr4721188oib.10.1697866336638; Fri, 20 Oct 2023 22:32:16 -0700 (PDT) Received: from stoup.. ([71.212.149.95]) by smtp.gmail.com with ESMTPSA id f20-20020a056a001ad400b006b2677d3684sm2434831pfv.206.2023.10.20.22.32.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 20 Oct 2023 22:32:16 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: mark.cave-ayland@ilande.co.uk Subject: [PATCH v3 20/90] target/sparc: Move Tcc to decodetree Date: Fri, 20 Oct 2023 22:30:48 -0700 Message-Id: <20231021053158.278135-21-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231021053158.278135-1-richard.henderson@linaro.org> References: <20231021053158.278135-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 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 Sat Oct 21 05:30: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: 736623 Delivered-To: patch@linaro.org Received: by 2002:adf:dd81:0:b0:32d:baff:b0ca with SMTP id x1csp632748wrl; Fri, 20 Oct 2023 22:36:27 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEaAv52Cr5bHwIpBLzIgmSgZEwb1j3TvcW7S5QeEm51tzSX3Z5lChA8X0aC5qqrzcr6SIBI X-Received: by 2002:a05:622a:83:b0:412:3092:feab with SMTP id o3-20020a05622a008300b004123092feabmr4779996qtw.50.1697866587057; Fri, 20 Oct 2023 22:36:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697866587; cv=none; d=google.com; s=arc-20160816; b=RiBiIk+rGp187dEDuOgMPbZQ8f8bB5uPvVK9r0c7tXVLi3EAj1tui0KG4z2BcYLSCY bijwJVmRGz4V/W9JnrJM34wvsYYopyI3EqnBL5nKSdZdAa3Ket82/rsv/uIJG16qhbIh BbQFvOGMoiVBHKxM87GlxjdhGdjMEzxtU2XN2+4b9Zy7oJjo67YWT4ux4+1BGKCbBVX7 j1uadE+wrnFuGL4l+5bjCnMG7VZP5ErbQRKbBIqqDImTE+CcEBFFVOq8X478SKLwGlS8 K9yAGnFfxwLVO1vmgR+zAPQ90SwT5ZTxI+ANkNhm6fSPQ4/WdwsDqYGTtLhBDOVwh/9M 8VmQ== 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=Zm6HwolN9CqeO2jzxRf9opQfa4YAcoLzXlW3tB0v0gSUvlRBfnC9dCnodN7NFRw7em KUlabFhiJbqMHQ5foLje7XnQPyHe/ma3UHledYUkaU13l5FeizI6JbHYSSTGvU26d9EL I4TobR3keWd4Wc7cpjfIp6SCEr7d8HfJCtxuu3U8VQeiQ9BatUdXpes00yfjkBGcq/O8 wG3GRk2dLFEw+EiPriFn0RdrR/4GowAx482yWqRjmc+/ltyd1a6ukpbGOE4JNtD69x87 uWkHHrDv3rZY2hAidbNvPOVG1hWKZKGCxOsz50+GbD656S/NUK5d/bU3D42bq8eWKv41 l8ww== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=jzV81E+j; 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 g21-20020ac87f55000000b0041cbc899cf6si2375001qtk.180.2023.10.20.22.36.26 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 20 Oct 2023 22:36: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=jzV81E+j; 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 1qu4bH-0007Ij-Lw; Sat, 21 Oct 2023 01:32: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 1qu4az-0007CX-BV for qemu-devel@nongnu.org; Sat, 21 Oct 2023 01:32:21 -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 1qu4aw-0008QV-Vl for qemu-devel@nongnu.org; Sat, 21 Oct 2023 01:32:21 -0400 Received: by mail-pf1-x430.google.com with SMTP id d2e1a72fcca58-6b1e46ca282so1483204b3a.2 for ; Fri, 20 Oct 2023 22:32:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1697866337; x=1698471137; 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=jzV81E+jAq4no52vB/650HuGcdTuiy6VNoJRzmck6NIYpIr127TMFoHyiSoyE1sTmu DDRxhJBV4APXJZKEZeojFlVFeJFzYHlwBO0bO9ZK+5R1Wj0ysR4wRp6oM5mxMSFVDmuI fifnXVgrobyAJ+UvF1RgCaZNbkH0MAFGGiVTxDyN25QvdMyapRAz0bE43K+To9YloLsa 1W+A4PmxjxiNVEuzhBpXryPZhCOgv7D3uxU2d3+u6y67OB3tOAAE7qZ+AWa84KO9tEWY nLJbmmPEraDe5p9Q79OBF7BlD4vbrQ5PlItvk+5GrR6N4j/KGnSPZIg1hEYbQJIQdNJV ZOIw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697866337; x=1698471137; 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=rBUdJ5N8qCNUV5AwjEd5efLBMlbmx7VKvWq9PlaHln/UhojKjRAmMo/09x9/gQaAg5 C4o5TeGF/+3Z4QICDlIIXidrzMsKMGMsvscxYT1wedvnrVdotwiZdUTl/Qv37uefJAKb e6fudSP/owSXLaOYqRJjmlLOsTbuArvZpO1sRvQbn2Paq4nXUs2rHeBGJon8bgFwfkwH 2jIWos8B9c+Vca0o8t02cHKiPxiAnQ+SClnC0O3ysbiidkwrqlgG3Y7BQkQHyg1SjQqk cfPG4T/NzMLLBMSHowHUi1dj+8LvIwrWoZILoBqyLjHjSAjRIHayf8DTZ0ljbLYc2g89 bn+g== X-Gm-Message-State: AOJu0YzJUIPUz3KjEumCfSm57jEFAqQURy18aomcqkFY3hakbBwAU2Gw PfT6S6Le7wnuPD7wz4688fZptWk81tj1/kRVTn0= X-Received: by 2002:a05:6a00:84f:b0:6bd:b3b9:649f with SMTP id q15-20020a056a00084f00b006bdb3b9649fmr4323948pfk.7.1697866337404; Fri, 20 Oct 2023 22:32:17 -0700 (PDT) Received: from stoup.. ([71.212.149.95]) by smtp.gmail.com with ESMTPSA id f20-20020a056a001ad400b006b2677d3684sm2434831pfv.206.2023.10.20.22.32.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 20 Oct 2023 22:32:17 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: mark.cave-ayland@ilande.co.uk Subject: [PATCH v3 21/90] target/sparc: Move RDASR, STBAR, MEMBAR to decodetree Date: Fri, 20 Oct 2023 22:30:49 -0700 Message-Id: <20231021053158.278135-22-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231021053158.278135-1-richard.henderson@linaro.org> References: <20231021053158.278135-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 | 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 Sat Oct 21 05:30: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: 736675 Delivered-To: patch@linaro.org Received: by 2002:adf:dd81:0:b0:32d:baff:b0ca with SMTP id x1csp634961wrl; Fri, 20 Oct 2023 22:47:36 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGTpbNtH8xhzv3P0uEErChmfNtmFJRVP60YDtY0Ok/6q4tLd7hhYL6nna2Y+2EnexAKuyxU X-Received: by 2002:a05:620a:1991:b0:777:457:34be with SMTP id bm17-20020a05620a199100b00777045734bemr4334795qkb.24.1697867255879; Fri, 20 Oct 2023 22:47:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697867255; cv=none; d=google.com; s=arc-20160816; b=yZbMSltiAea6k+qiazQKoPMx0FRNhyUWiiwRij+pyQ+uJFvWG/pOM4U+UgzZ7B53ig mu3k46wBBaNuIHvHQyZ8/e0wfdSpTACgxuem6PvwKwqhYoN84ITKn7W1//0VXb6D4XX/ 7S6g2PxYhUCb/wmfKrBq9J9SYMQvqa7LEC6euFIj2Y5rY4x5F9nA+H49ChvkwWpoLRQj Uc3nqZL/fhhrkB/Hh5w4FW/p78ExZSROGLOkvv7qEXBAomwxemJmQPYW9soyeQhhVHcz a53oxJSou5SnnudVYXBXLL/tZt7fuZjUO+TxnpJyuR6KqQ9oMRCNe4BFiynsKYg7TX3j R5FQ== 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=npycK8wu5R5OLbJFhSwcX1YA44oEJe9mrbGlIxuK8uM=; fh=TYrED6TOMxGX0VC4GtjviASLbYyJe19+7/tKWjN44KQ=; b=GIvN4f4Yt3j/ZxfDdTjagseKGhUTuHRMi6wx3UgGFooyKVQIs7pgJyOgmM59gVGDxr K3IhiNz6pxIqGHqyNy/uzFG06RpVOzfek9tOg1HAt9VIXtOmM6Ws8hLFs7j90uzsE6KN 4gMIachEjtbnFsoJUIJCNtzdEt1W8d32IoYNQdbhc+qiCHpVETSF3RBY9S3ziSwitdY6 CpBmXqo1ApqQrNli08ep2lkCAnW+TB5JkVdlmsd6NjrzLFzlhyrDnlHEEt3H8rg7t3LM GePwoauTOt3SUu/V4IOq/Rgm7Ybwn1i21ulaUZIWMr7Qyd4N79rn+jOYNVb1p79T6Z7P 6vlg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=oyIY166D; 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-20020a05620a22a900b0076f39f669desi2438510qkh.51.2023.10.20.22.47.35 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 20 Oct 2023 22:47: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=oyIY166D; 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 1qu4bK-0007Kq-Pq; Sat, 21 Oct 2023 01:32: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 1qu4az-0007Ci-Mn for qemu-devel@nongnu.org; Sat, 21 Oct 2023 01:32:23 -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 1qu4ax-0008Qf-H4 for qemu-devel@nongnu.org; Sat, 21 Oct 2023 01:32:21 -0400 Received: by mail-pf1-x42d.google.com with SMTP id d2e1a72fcca58-6ba54c3ed97so1445926b3a.2 for ; Fri, 20 Oct 2023 22:32:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1697866338; x=1698471138; 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=npycK8wu5R5OLbJFhSwcX1YA44oEJe9mrbGlIxuK8uM=; b=oyIY166DD0CEc84c6bQWkU/x0ZEeW/9dVah1f+yE/BcFd1x94m599htovt2nl+qQI/ 0d4iklNZaI1vJqQbNL7N9/6ulB2ZDwajEyVPYRq0cmMCd/zJyis5QEmUBV0YfkvXVmku ccdwbRLbNKf6f0hu3h114ex7/eyuHKuBm7eqyMmi7YP5Th9U1AWiULzJj/RTsdlmjpx4 qRZARKmC3QwJgbgh8mjFulW8hSzHkFhENNYamPbixEJ/ACVDnN/5iUWChDyfmfYx8SUb eMM2MrzuVP6NqRtjtiUX70RFfrf71S74e3K6rcnrVNBsmKqSLYsz1JqzBCGG5A8Y/iU9 Uimg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697866338; x=1698471138; 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=npycK8wu5R5OLbJFhSwcX1YA44oEJe9mrbGlIxuK8uM=; b=u1DIFL2RkgnTOAUsqDdy2vtLugzabR28oVAkezjBiygy6LT1eA/Ry40c1KlwyI1sHz d2BbwArnvwg8QMM1oB2P5G8amuuPlPxKwaVK3LJFyfYr+w0d5J6e9mJzOXiPhQQydznv PMcPvNIPXZ3sUDQsEcimdqmCngFD+fBLXWFGuYrAhJfUAXH+MS1mov7Z2IvfOB1APM+P HgZ9Rgyz6CkdiPXHtR2G9fCMVHwCKelMfo72hbhRsVlJRCBp26zLNzz4UChRNy0oaGwo M+DLkj9Ouy2EXSAdRGa61hKQDFAV/ydt8I0cTnOgN4cNb7urBcJ2oyIoXKYlZdv2AikU 4E+g== X-Gm-Message-State: AOJu0YwfAFkbYNBn5MFOH7al/2/30o8296tArAAIpqsOdgVhQ0TSgyHp hWNGUirUh3HUJC/GqzFDhfhXI7eoU6qNwf6Qo/g= X-Received: by 2002:aa7:97b9:0:b0:6be:334c:6fd1 with SMTP id d25-20020aa797b9000000b006be334c6fd1mr3354108pfq.26.1697866338335; Fri, 20 Oct 2023 22:32:18 -0700 (PDT) Received: from stoup.. ([71.212.149.95]) by smtp.gmail.com with ESMTPSA id f20-20020a056a001ad400b006b2677d3684sm2434831pfv.206.2023.10.20.22.32.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 20 Oct 2023 22:32:17 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: mark.cave-ayland@ilande.co.uk Subject: [PATCH v3 22/90] target/sparc: Move RDPSR, RDHPR to decodetree Date: Fri, 20 Oct 2023 22:30:50 -0700 Message-Id: <20231021053158.278135-23-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231021053158.278135-1-richard.henderson@linaro.org> References: <20231021053158.278135-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 Signed-off-by: Richard Henderson --- target/sparc/insns.decode | 10 ++++ target/sparc/translate.c | 112 ++++++++++++++++++++++++-------------- 2 files changed, 80 insertions(+), 42 deletions(-) diff --git a/target/sparc/insns.decode b/target/sparc/insns.decode index 1b084c5b97..ac545c6821 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_tstate +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..c6e137a235 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,72 @@ 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_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 +3432,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 Sat Oct 21 05:30: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: 736678 Delivered-To: patch@linaro.org Received: by 2002:adf:dd81:0:b0:32d:baff:b0ca with SMTP id x1csp635039wrl; Fri, 20 Oct 2023 22:47:54 -0700 (PDT) X-Google-Smtp-Source: AGHT+IG6mexHYjmWNbLuYlOH9w9yPNqKruUE7tObdydaXAhoLdWZy+hk2LQMKbsZl3IkM0SVHPaf X-Received: by 2002:a05:6214:2602:b0:66d:44b6:8aa7 with SMTP id gu2-20020a056214260200b0066d44b68aa7mr4376339qvb.24.1697867274531; Fri, 20 Oct 2023 22:47:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697867274; cv=none; d=google.com; s=arc-20160816; b=URhwjtqVOfjS8UzrCD2pgP4AHY4Am4OUGWh9+8pOvDCygV7q9Iv9M859T1sgs52n9B AwvAHfCwwTs0/+YqSAmcps0xU4kdiyINWYxTlk1pAmGggUO4Fyb3dimcATr+83+Pcx3o zj0lbQ+niw8jxI+XJPc9ui+b1zxLBjSQJrW6haObcVijhxjcZi3LD5LlksLJFLqstOQr KQ6y8cPgYjOZ7twrr+7fCrfy1TmEkbEEsoBvKX9OB/qhfT8ShdktBdfM28YyFlTHZ4j0 QMgHu2J/Bf+Xmes2WpwZbfd+1lsKFzHzgOFWgqA2bdAAz87B+iMIQp43J546i35PzLnG iOCg== 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=ASRa8wMWV96U2/i2GLXe1foxbBGwkDXetJQtGFBSBJ4=; fh=TYrED6TOMxGX0VC4GtjviASLbYyJe19+7/tKWjN44KQ=; b=kO36FGXlQ8E++BVy81KGElt93URVvNCBuqN/kQHoTD0PbuEBghW9de66hogMiKFwff AmpvFYY0o/B9ujtVt5OahXZDxhn8PCOvQgbxxDyZCvBCBSEEHMeenJ9B6disptB4Kkvf 4bRO7x0c3q0EyF1HsgflBbmwzCngZStO2nj1ba0kyqj4/2N7zGNwSAsiO7++AV8ZrnuJ eBeYkaYZS/XPhn1xW5fYm90tPGmGsXr5Ai3K6IiySfWujReN1gixpof5FZFo0sVSH0Yr 2WWMhmOAzTEl0oFZjwVg2240g3yuD3rKLU+Xb6UP2tCjAa4Nn00V9WvBVUvqCUlA0Dy7 ky/w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=KVu71d45; 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-20020a0cd641000000b00647290d544bsi2519866qvj.296.2023.10.20.22.47.54 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 20 Oct 2023 22:47: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=KVu71d45; 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 1qu4bK-0007KW-54; Sat, 21 Oct 2023 01:32: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 1qu4b0-0007Cp-Qf for qemu-devel@nongnu.org; Sat, 21 Oct 2023 01:32: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 1qu4ay-0008Qu-Hy for qemu-devel@nongnu.org; Sat, 21 Oct 2023 01:32:22 -0400 Received: by mail-pf1-x431.google.com with SMTP id d2e1a72fcca58-6b497c8575aso1490551b3a.1 for ; Fri, 20 Oct 2023 22:32:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1697866339; x=1698471139; 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=ASRa8wMWV96U2/i2GLXe1foxbBGwkDXetJQtGFBSBJ4=; b=KVu71d45Km267csw2yBZog3GEBbkRLbwV54YJBWwDkoBDp/rNYnA5jdkiLzdFQVEXe wRjWxWJMiEAC1U/dSVE1WB/j/r9TP2TYjBjhewKGmPyY6OKxXI0zHUBSOu3PIoUfESNZ YxtVjWYxGFZIP0iTH7k5ls7pgOHfkC4srz3da1uAz/hmyX1Qjl+WiWUirvJ6uNOgkBpI 5TzhSDSqZN6zgfDC1p5FRobooTUz7n7W4XSjs3p0SHJEFrmPEG8B6XkKYtS/TGmDt0V5 1fYEmu35VvYZ8lL7qcV+2Q/0+iSigXcss3mlrcqByScxP8BRbZe9gHP8+uXnSKHRGYSx FqdQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697866339; x=1698471139; 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=ASRa8wMWV96U2/i2GLXe1foxbBGwkDXetJQtGFBSBJ4=; b=CKhgAp/jaPBNW5kO7TCKshPn3Tq954zkPJX2sdu82i0P7lb0BYBHYJk1vd4kDbTvYa Xpfb2O4jGgqyeCbpW0c/UhiBVFo/X99epjxQ1C2tACvnZiv+jonn8ymeNaUUmOyr/mwY nCDvvYUImP+4mmg6D+NOikwAsj9rjvGtVFOhchKZPCBVIVO1qEHT+Uasuv2b/YV0dtdc rT0dHXisXIeORF3Ha8vp9TlPyB3QiT4I4E0uek1KG9GxKJQ6GjUnAaxHUHh1ZJUSKyQv 5V7UoYNshBNkvNdRr+t6yX7ZGleBbE2uL2aee48eU8+jiiWJtffQ8MBDcayJoY6gBgKG tL6A== X-Gm-Message-State: AOJu0YzhuhhGiGIvhKEJKFHykilaVgoUNTPe7pA50Fr1I1wlkQ7BMPNF rYjTPmjcT+TE5wR8dhHpleRf9RTJIk9gb8M8iEE= X-Received: by 2002:a05:6a00:1789:b0:6ba:4f2e:33ca with SMTP id s9-20020a056a00178900b006ba4f2e33camr4883835pfg.2.1697866339135; Fri, 20 Oct 2023 22:32:19 -0700 (PDT) Received: from stoup.. ([71.212.149.95]) by smtp.gmail.com with ESMTPSA id f20-20020a056a001ad400b006b2677d3684sm2434831pfv.206.2023.10.20.22.32.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 20 Oct 2023 22:32:18 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: mark.cave-ayland@ilande.co.uk Subject: [PATCH v3 23/90] target/sparc: Move RDWIM, RDPR to decodetree Date: Fri, 20 Oct 2023 22:30:51 -0700 Message-Id: <20231021053158.278135-24-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231021053158.278135-1-richard.henderson@linaro.org> References: <20231021053158.278135-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 | 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 ac545c6821..99e4f8f671 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 c6e137a235..70ebf3cf79 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. */ @@ -3401,6 +3399,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; @@ -3431,133 +3644,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 @@ -4403,7 +4489,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)); } @@ -4413,7 +4499,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)); } @@ -4423,7 +4509,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)); @@ -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_st32_tl(cpu_tmp0, r_tsptr, offsetof(trap_state, tt)); } @@ -5863,9 +5949,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 Sat Oct 21 05:30: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: 736613 Delivered-To: patch@linaro.org Received: by 2002:adf:dd81:0:b0:32d:baff:b0ca with SMTP id x1csp632195wrl; Fri, 20 Oct 2023 22:33:59 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFT9osAssFXXIEgS/50zS5D+lFGZGejy4mx0A1spWTxniakqXawlst6NynzYSudqDg53m6v X-Received: by 2002:a05:622a:1790:b0:41c:c27e:f8f6 with SMTP id s16-20020a05622a179000b0041cc27ef8f6mr9145063qtk.23.1697866439375; Fri, 20 Oct 2023 22:33:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697866439; cv=none; d=google.com; s=arc-20160816; b=iOeutLMopFc6kGvlBik9CF6DIH9xkFdDP1/Dj8gdxHKDQQxpOoqs0RiOVW/Cm9u3Yv 0O2T16dzhPbB1TvD+WpLSL+aVYiDRuyJsqv3hjLUnkeaPYvQLVWGh9xXD+mfuIqoU4jx St/MTHkHA29SL8VCLzF2P5dunvsvEoMtn5J2dIiCawIEbN8xua4KYp4A6ExKpgaaNDS4 KpN2ZfuQQwSeqqdUO8C2SxTWGEaAY5zDpMyF5GYthZxz0F8S42YfJjllKrBpp7qFZqer xiBxWzr7BpqB6KFJeFs7TFgbv+en9XkDiD+6ObGwfy9RKMK7twvSzvrerQhegZoJelSi 0EmA== 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=EtxjKXMcGsD5n0K7UcFblBkmcaT4TjEmnLQE1OFn+DY=; fh=TYrED6TOMxGX0VC4GtjviASLbYyJe19+7/tKWjN44KQ=; b=w6a4ZmALkvkqPz97hQ3wfX0/SfteFkKfxOgu5AQ7D6CACEammqVvdEofPk/Rnyl1LD jfDyLOPiFAXa7A2LxYGw96VHr9cNAOHJRQ1lXsCt1KuanvBrcMTp4mNwueme1T5y3CMw ZU6osdbrVxLViJQYZpufjhE+E3IhJDNhXe8YT2NXudPYEZohz92mof9Blkc+M5AGaSna jZcmEoECjdeAHs6DcmhHbHKVSzFqMwilHkBNUab+vU50sMHWr2YGmg+W54oCh7HQPi/b Mdz6LAWQLP22us1REyIwbcLgMrLInRbmR9rZLLpknT4W85Dd9V3j2zcEYVsBE9Ayzkax tFZg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=wYjDLyQ2; 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 y12-20020a05622a120c00b0041987850ceesi2331253qtx.480.2023.10.20.22.33.59 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 20 Oct 2023 22:33: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=wYjDLyQ2; 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 1qu4bJ-0007KU-Lq; Sat, 21 Oct 2023 01:32:41 -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 1qu4b0-0007Cu-VN for qemu-devel@nongnu.org; Sat, 21 Oct 2023 01:32:25 -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 1qu4az-0008Qz-56 for qemu-devel@nongnu.org; Sat, 21 Oct 2023 01:32:22 -0400 Received: by mail-pf1-x436.google.com with SMTP id d2e1a72fcca58-6bd73395bceso1196418b3a.0 for ; Fri, 20 Oct 2023 22:32:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1697866340; x=1698471140; 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=EtxjKXMcGsD5n0K7UcFblBkmcaT4TjEmnLQE1OFn+DY=; b=wYjDLyQ26ioUCIm3kO915lNizdOel+qZL2Voa216D7ZxkhOwy8LesXOV5qh4jq8Uy7 UKdim6ueJnEZnOs4USIvLW6xWG9M/w6zozkRcA3A3PVXia6kRWea30oojX7BURACfC25 nhLziiTSAVotE8sZYbx2Vk9IqylJGtrUXwzP36WvuaLHrv2QjOzpPBFHw6HnwE8kXK2Z In/jMXa28YQeNodAnksYo7g/dvyXDntPEpQlO6CE81TWEeZ7fJ6T575ITqXTxo0WhN7O l0RZF8kPwLdIh9JifJi26m3WQfbWweF/tO7Y63+lcwIlY7VOsh8ZuvNSVu+JyhlrZq8J iBvw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697866340; x=1698471140; 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=EtxjKXMcGsD5n0K7UcFblBkmcaT4TjEmnLQE1OFn+DY=; b=qRz5l5p+UKazmzbF151UoTRlwtRLeCDkseqmciHIl0t6JMSyACXV3/0bo4VKPn9YmN 9FzQyo8iCGqZ70BCafvVIkJTFHK1j5NE5+B9UUhAt0S/nh3o3IdHi6SDxbqb6LKdgrNn Pws8qCbkMPbCEJjcDjNmBiauRvY/SMgjbFcxC0RSlFLqjxTxQNjWA0vw4KPVLRRZZQHz QA6DxfVaXmxeARCHJzggKy3TawfI4GUykB7lsns2OIeUurNDJBmNoTfOOZCujeABaVgm g9kzilBWN+WXWgJGbeKO58gnotHdjCVxc6TeaLw+kIqXgkAnIAORiu9GyoB58G4iMSpK B+nA== X-Gm-Message-State: AOJu0YzSzS1S1ZAH5nD9Y80/t9y8roteXa72xeUtGw2PRWJzTq6LTlHd Vq0WKdxQe33bObz/1mmKySlrcdWLkS7DekycuR8= X-Received: by 2002:a05:6a00:80f7:b0:68a:48e7:9deb with SMTP id ei55-20020a056a0080f700b0068a48e79debmr9169816pfb.2.1697866339936; Fri, 20 Oct 2023 22:32:19 -0700 (PDT) Received: from stoup.. ([71.212.149.95]) by smtp.gmail.com with ESMTPSA id f20-20020a056a001ad400b006b2677d3684sm2434831pfv.206.2023.10.20.22.32.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 20 Oct 2023 22:32:19 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: mark.cave-ayland@ilande.co.uk Subject: [PATCH v3 24/90] target/sparc: Move RDTBR, FLUSHW to decodetree Date: Fri, 20 Oct 2023 22:30:52 -0700 Message-Id: <20231021053158.278135-25-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231021053158.278135-1-richard.henderson@linaro.org> References: <20231021053158.278135-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 | 23 +++++++++++------------ 2 files changed, 16 insertions(+), 12 deletions(-) diff --git a/target/sparc/insns.decode b/target/sparc/insns.decode index 99e4f8f671..7fb5fa3b3a 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 70ebf3cf79..4c9079d598 100644 --- a/target/sparc/translate.c +++ b/target/sparc/translate.c @@ -3476,6 +3476,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) @@ -3614,6 +3615,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; @@ -3644,18 +3655,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 Sat Oct 21 05:30: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: 736612 Delivered-To: patch@linaro.org Received: by 2002:adf:dd81:0:b0:32d:baff:b0ca with SMTP id x1csp632136wrl; Fri, 20 Oct 2023 22:33:45 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFR4SJQt2ZjIrOj7ZeXdqzy0CIc8Cgbcq4g25xkrkX/8pkzybYtcZUqCo4eQ9hqgp4vT1eu X-Received: by 2002:a05:6870:1083:b0:1e9:c2bd:f2e9 with SMTP id 3-20020a056870108300b001e9c2bdf2e9mr3396697oaq.25.1697866425455; Fri, 20 Oct 2023 22:33:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697866425; cv=none; d=google.com; s=arc-20160816; b=jjakNI5yRf5rnt5wXeLX4tO3cLjRVqqy64qs/Zn6JOvXGIgNFOkbVnWNiZj18Sb8xn ALKLn8ipre0sq95u2WVgdGYCd9WkopGAaLyyjWGBs6VJsAF3Vw17sngDL+tkmj/AaeoZ rKnKfoqE0l6MrCm+EQr2qqwGSamgzXlyaPSgg2iwXV+LdDCd0LMf0rzDJLWSkO8p31gb Dw7nkR7MktcYXfef/dvFNL+77WnFcwaxqpsljwJfw2SMdnjCUXpxhRCKzYGsExSDf6v0 kqkAv3SejNTDXcG+VVxIaVmStiYYdEqg2FYmho394CK5MdLWwfhvhre6+vmXmw4YsI+n Bkxg== 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=MS6cxWaSJ2KoteTVsixgiHalh9261DsIaACUEbMqoVs=; fh=TYrED6TOMxGX0VC4GtjviASLbYyJe19+7/tKWjN44KQ=; b=S/4TZLw4vVsrgJCgvAmI6xhwjl2l1T1rqt8B0imdh4KBOkwiFMW9NqSTPxr1wfLTy7 A0waf1/vSpufM5MQeS0wdQqS4bRyOOTLPY7L/HVWO2k82ACpDSShoQd1OnF5Q9btyFr1 5tLOjR8c6Ur44bUCryJclIhCofx39ilLRv+SHNd0Pe5ZU+kgPn/7HsAcQwmnVLyvhCw2 BHWeJI4wDfs9d2r3X2AY/YHHNkjFSch8VZpHMux9gYcQzC32VKkpS1rfGeJc9a3z8KlY ZOYPj4ASHtCUXpBpRHsHwHBjRCK1XOpR+ATGSj97xak+7u22iasCE7QqubdwwspdDC2B yfYg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=MBAKv32w; 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 l15-20020ad4452f000000b0065b08b01660si2479380qvu.240.2023.10.20.22.33.45 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 20 Oct 2023 22:33: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=MBAKv32w; 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 1qu4bI-0007Jz-Ng; Sat, 21 Oct 2023 01:32:40 -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 1qu4b2-0007Cy-Ce for qemu-devel@nongnu.org; Sat, 21 Oct 2023 01:32: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 1qu4az-0008R8-Ug for qemu-devel@nongnu.org; Sat, 21 Oct 2023 01:32:24 -0400 Received: by mail-pf1-x431.google.com with SMTP id d2e1a72fcca58-6b7f0170d7bso1416387b3a.2 for ; Fri, 20 Oct 2023 22:32:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1697866341; x=1698471141; 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=MS6cxWaSJ2KoteTVsixgiHalh9261DsIaACUEbMqoVs=; b=MBAKv32wHzitjaT62/KRqyxvkFg1VG643OJ63Dli55FJXj7UEJX+C2ke7NJcoCHMCW GevNbv/e5f5WnGGkbAgKrwZVAp1MR7LF0UhuKUUlp1M0BEFGtD/3dyvTuR10jGBAoYNC 6UNmAEup6OVcOcxK49Mn7A/hzpl7RiE463eGUSJEVJQMxFO1Rsa95YeRwiyohObE838s C5uY0C9+WeWg7jDko3NoWgCM7qootlIDwnFs5tZ0ydxNyxJMqlNpVFgRTo2Eilsfw0ZJ fFKbv7VJLhz6RSSoP+KKhdG32KJGiqmGkschHHIhJU3ZeOwQ50amAAgqbVhKgRkx4ZYC LNtw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697866341; x=1698471141; 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=MS6cxWaSJ2KoteTVsixgiHalh9261DsIaACUEbMqoVs=; b=rAvbhhYZciEdigB7EVqp11OqzdtY5QTfwfYH096PxKZdawnUEoWPJ1V8MHp2H0pH/H tmIqBUaV+S6QjqJVLWDctJMLR1w1mEZY3QChrKAYoloe0w1bgv9mz9t0dU69QuY7agAk YYgscRudQbH/mgUoYHXbuRsSnlA0KA5Fj9ogD98g+r8hOfvLCEsUSWDjT8fGWW7jj2fk 7jViZLAPWpcb9L8klZCqEQqsEpDH7yyZBDkxqsdmsQPi1nXq/EsUiFfkIG+Jlxtal73/ Lo7aZMIEjTylkOzx3QFP+m8YqKsKxwAjYe8MBHRw9eME7C4YNDXLHH8t6zyDEtZYqxTi xT5A== X-Gm-Message-State: AOJu0Yypuu9/zjJdZHlnTxg+I36mEdUPdsHS7WUYIbk3y7tO2kBSF72C yPc0zf+GZTKyfKl7C6APxS033TFW4Kb/++aAWX4= X-Received: by 2002:a05:6a20:2451:b0:14d:f41c:435a with SMTP id t17-20020a056a20245100b0014df41c435amr4426503pzc.39.1697866340674; Fri, 20 Oct 2023 22:32:20 -0700 (PDT) Received: from stoup.. ([71.212.149.95]) by smtp.gmail.com with ESMTPSA id f20-20020a056a001ad400b006b2677d3684sm2434831pfv.206.2023.10.20.22.32.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 20 Oct 2023 22:32:20 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: mark.cave-ayland@ilande.co.uk Subject: [PATCH v3 25/90] target/sparc: Move WRASR to decodetree Date: Fri, 20 Oct 2023 22:30:53 -0700 Message-Id: <20231021053158.278135-26-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231021053158.278135-1-richard.henderson@linaro.org> References: <20231021053158.278135-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 | 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 7fb5fa3b3a..d7e7f0c577 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 4c9079d598..c34602df80 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) { @@ -3625,6 +3635,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; @@ -4285,162 +4475,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 Sat Oct 21 05:30: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: 736614 Delivered-To: patch@linaro.org Received: by 2002:adf:dd81:0:b0:32d:baff:b0ca with SMTP id x1csp632196wrl; Fri, 20 Oct 2023 22:33:59 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFjPrNifRB2lvzLUqSg/JHVsg3ROo2mPwzVbZTAs5yPEzd5bm3KljCtKmMXfmcddvXQigGE X-Received: by 2002:ac8:58c9:0:b0:41b:7773:ee56 with SMTP id u9-20020ac858c9000000b0041b7773ee56mr3713324qta.50.1697866439494; Fri, 20 Oct 2023 22:33:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697866439; cv=none; d=google.com; s=arc-20160816; b=iHjBgQIDFNHTlRLOkU62tXz63wfmWBrgvOTwIxaoY9XX8yipMwwh36V840fs0/kihx aR3AnxIR0Vp9slx3mFOO9c6n4wsNSJ7UuyHDZss10g/okj8Doth0y8VywPmp4ByD1AHC 0NY+mFXxrYL9gkhyg6MBCUWDWvgMGJD2kM/Ru4wzHNNze9USy39bYHdt9AykC0Rsnncv vBUdSRyTf8DDtqAJQAZf3EQ4Aarxf9EZS8vHs7K7oEB7TkQTsGamGCTzx3B/zI+k33zG L5jDlbCF8eENXQLqiTTdajR1GsegyVY+Svd7HCDbjy/YiOzMKLvI9AQ6hn3WUchLM51a EnBw== 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=RNQs2YRR9hL9glz9QxZViAw2f/+tKFV4Vsaoa8u9uVA=; fh=TYrED6TOMxGX0VC4GtjviASLbYyJe19+7/tKWjN44KQ=; b=Tz4wV2NgJkyy6w9pOwuZ2F9kOjsWq2LLXNLufPEii/zf1mCX+tq09Irm2F+I8fQ6Zn 3U/b7zb9tS8Z1Krnta4+ut3i9Xom4q0MkUGY3Xvyf5k/dDOzGlMCgQIiL+oNm77QCYJk 1D0/+Oy/SxkJ8Bli9+wwuC09n0eaQHRQ6lvDr6N5vQ34VKDSjgxbzg9M3dcIr8gcFPzE NH4J7boJNyGD4slqMJ0sS2tZnnPKQlZK9Cf2byEbrUOkKbff/9sWq6P2QziWa4xHqdrU +hHYl0kzgM/LkBGy4YiSgdr+XMrnbYjbABIZS9bekf6rBDrr1+Ug7fLVGd7OlySVLmOR nr4Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=LhX6MflT; 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 y12-20020a05622a120c00b00412083895d8si2396431qtx.461.2023.10.20.22.33.59 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 20 Oct 2023 22:33: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=LhX6MflT; 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 1qu4bF-0007ID-OU; Sat, 21 Oct 2023 01:32: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 1qu4b2-0007Cx-C7 for qemu-devel@nongnu.org; Sat, 21 Oct 2023 01:32: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 1qu4b0-0008RQ-Ik for qemu-devel@nongnu.org; Sat, 21 Oct 2023 01:32:24 -0400 Received: by mail-pf1-x434.google.com with SMTP id d2e1a72fcca58-6934202b8bdso1455957b3a.1 for ; Fri, 20 Oct 2023 22:32:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1697866341; x=1698471141; 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=RNQs2YRR9hL9glz9QxZViAw2f/+tKFV4Vsaoa8u9uVA=; b=LhX6MflToDqpdq1axS5cDzYO9XcpcH+hhZ0TAWsuSeLYTqbpXZCJMlvPG+01EhvHl3 Of/Z10V/e7eCqP+Z1BV7GvnG5SpE/7BLOph/mV3KwhzJX+nGCVcZqG8Jx6QNo7l5CtNo lmaIejcej2yqfun7h6syBisgwWAx9Vljrw6OmvM2iNl5pJbBd5VObAoFNDC2PQ/OwDBM chkhyWsMlhqNYhlXQHbeUTlcaBSw1yVacGliiJoVRnSFQ0eaIaTw32mKcJuaOcFjdFpz 3A5t+9wFpkYKKMyYEn2vDCH0HGlFgSGgN8JxBNqhUOqYZqSV0iXTg57DuKZCypKUJucR 2lBQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697866341; x=1698471141; 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=RNQs2YRR9hL9glz9QxZViAw2f/+tKFV4Vsaoa8u9uVA=; b=aGu5Y3kJVNSHk6xZSDhvpxOFyqW+8XQdJPsJgSchzS4QrqnYsaI72A8vShmbzrOaOz PrT4iX6aSJYnptbAiqQ8DUpocCBpwIHKIWjD1W9qcMpV15lP7z+cmMHyACMBkrvAfHPE OolecSD82wyV2TG2MZMdD4zMFQYlzeX/WnYdkHsh8wF7aYTTDK/df0JROXyIMUFt3Qu6 cTqri7tXz2vtDnmt4A1lnvPasFF0swJNIUukAgrrNrmJH9DDA26TIIzqtGXjVXyIAdJH d5WoUTc/InhsnMdsRF9J608w+rkW3TTrlR+OivD3V+DfRxp5KJKJ5f5sF5sqQVEn6LxN iy8w== X-Gm-Message-State: AOJu0YyhtwZ23KQKhb4reeNUGUCv5vMqbq0puqMI7vKqI4Ysd/5i5+53 eLTXId2LdDCrqf4JHCkKdFDbSP+rr1UvZQW/lqA= X-Received: by 2002:a05:6a00:1747:b0:6b1:c1c4:ae98 with SMTP id j7-20020a056a00174700b006b1c1c4ae98mr4500092pfc.18.1697866341354; Fri, 20 Oct 2023 22:32:21 -0700 (PDT) Received: from stoup.. ([71.212.149.95]) by smtp.gmail.com with ESMTPSA id f20-20020a056a001ad400b006b2677d3684sm2434831pfv.206.2023.10.20.22.32.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 20 Oct 2023 22:32:20 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: mark.cave-ayland@ilande.co.uk Subject: [PATCH v3 26/90] target/sparc: Move WRPSR, SAVED, RESTORED to decodetree Date: Fri, 20 Oct 2023 22:30:54 -0700 Message-Id: <20231021053158.278135-27-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231021053158.278135-1-richard.henderson@linaro.org> References: <20231021053158.278135-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 | 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 d7e7f0c577..5ba71c3d84 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 c34602df80..7358a59fda 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. */ @@ -3803,6 +3806,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) { /* @@ -4477,39 +4505,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 Sat Oct 21 05:30: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: 736606 Delivered-To: patch@linaro.org Received: by 2002:adf:dd81:0:b0:32d:baff:b0ca with SMTP id x1csp632016wrl; Fri, 20 Oct 2023 22:33:21 -0700 (PDT) X-Google-Smtp-Source: AGHT+IESiBjcUisYj6Izrx9gSsWvmlIwz0rQpoQDNkLX5RxJu6Q5Xlijio+H8uIUG3dLbeXx50XA X-Received: by 2002:a05:620a:40c4:b0:774:7a9:9997 with SMTP id g4-20020a05620a40c400b0077407a99997mr4646957qko.63.1697866401612; Fri, 20 Oct 2023 22:33:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697866401; cv=none; d=google.com; s=arc-20160816; b=NeRbO+97rfZnHRRnsjCg/4JD3D+Ix9064twtqWimuQAwSnCnFiVBALGM4zYikPv0Z9 bYZmQQV4j08/zhnaOvwx92GT1GGcOncUl+EefnQ0EhRMVWIweu1EGmtF5Z9VB+yPr8dx DREyhYlU5siUBMTxglmrpbsWEAsLP5qsKgmDfszACiwk7oop8Ih930/8LztVopM7vkRZ tdtw3qZQReBoc3bin5O8+EthAnHr3lfRInhpYv55gzssSlxX4wcyIntI3OAicwHEhnyh N1ZtD/7B3u3uYrvcMlPOyT1ool0uKkAK6fovuUOj7IdahdPkbcg44UBLbHlwRA3LlD3w iA+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=sd34bxbBDnhUgqRgre4CcyCMV/h3RS5mYG7VLcPbHfg=; fh=TYrED6TOMxGX0VC4GtjviASLbYyJe19+7/tKWjN44KQ=; b=ItVEGKCMOb5BRt/baw0MmR1Oo0IGkFcjVRDlj/lb+QBuG8+07NOIC++JTIYq4/RrQ4 7Yc9ICDZ2bGFjFGsdWL9MlZF2XsqJPVvEWvyAB6fjTeWZ7z4QioZejOeu3o+3vC/8+hQ tOnzZhaaDWUraaNF6bZAyCrCps/44PTkHghoHRcTvAjxC/TWE80+aiRf/KGcAdRfL4CM rIwQxawjDkDfOY5HVIPOMvXCD/KqDxoI57cNKbaKXOBb7wuTM8k5NWlXPsmUCE7x+feS 3nVOfGwYVVmzFzx6FKIXEkhdmzp8XTQOSbN5kgejrU5fHb7CQ9rHdDDCFySkLaS3li9+ hfaA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=dIUYx0ug; 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 h15-20020a05620a13ef00b007757acf4889si2260148qkl.1.2023.10.20.22.33.21 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 20 Oct 2023 22:33: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=dIUYx0ug; 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 1qu4bJ-0007KT-Do; Sat, 21 Oct 2023 01:32:41 -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 1qu4b4-0007Dc-2u for qemu-devel@nongnu.org; Sat, 21 Oct 2023 01:32:29 -0400 Received: from mail-pf1-x42c.google.com ([2607:f8b0:4864:20::42c]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qu4b1-0008Rb-EG for qemu-devel@nongnu.org; Sat, 21 Oct 2023 01:32:25 -0400 Received: by mail-pf1-x42c.google.com with SMTP id d2e1a72fcca58-6b36e1fcea0so1266618b3a.1 for ; Fri, 20 Oct 2023 22:32:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1697866342; x=1698471142; 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=sd34bxbBDnhUgqRgre4CcyCMV/h3RS5mYG7VLcPbHfg=; b=dIUYx0ugZVNdsPRFcM8ZyXeDRQWKZ1Qlr+o7aZeNy7efcc7Q5CNrx8HQ/3ug5X0JZQ 9Ec5tdLx0c1XK0sQ+7WKqnoaccl1IUI745DhITrTawwZn5NPtLhvC3U5/R/8WR/IA6gx 4pcVpcs62iZSY++gIBcIoXvBkscxZ47k3L3OIqUTDHNz/c/kCBShE5SmpsGZVvCkBh3K aA7r6oy2MG34oQKAmCV6VRfuDLm/vfibdImHtHOiQ65i680NtGbt4Ii9bhQXE5HC7lq+ nEl3lMAf1utNwUQhlyKHvwgf1ikkcouHuBhcnHde+qsmu59XJpkpvPioBkjDzaebQ9g2 do2Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697866342; x=1698471142; 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=sd34bxbBDnhUgqRgre4CcyCMV/h3RS5mYG7VLcPbHfg=; b=UxBj6KA5bXAIQdoGwNs0NDJTSktRs7kq5ATRA5fAaSIbCo0dJ11YLewrKy97JDw9m7 uNAaIdwIi4l1jK3Hvxza57x/BixLFghj2jjHgWJbMQ3diTG1MjmcheSrHsMPJ/+nlLB8 4iuMPBAUcA4eXo+fjQ9c1VqKLRhKo6NpL+L/oAwPPMUJYJChB1d1YdTIqtHy1yGo3foz oUd3G5os1ynXKWcrfGginuki6QlbGMs4cpUN46nAS6p2ZCzfW/YxoowVfdmG2eAa3TeH vdvhGdKAe81RarwDKtfYe5viulWVU8dAh4jcmDbwHe597KPlfj4lmfyiUC9133HrFg6X HLVQ== X-Gm-Message-State: AOJu0YwQhJJSKQ0geWrSHce/Kea81s0jwL0nDPVuXEKGrUC8Hai/iaNt 0ynYLv4jSDZhnqijRtmyHyFjlTJDxRxsAjKDpKg= X-Received: by 2002:a05:6a00:2d9d:b0:6be:3fbc:763f with SMTP id fb29-20020a056a002d9d00b006be3fbc763fmr3888444pfb.13.1697866342200; Fri, 20 Oct 2023 22:32:22 -0700 (PDT) Received: from stoup.. ([71.212.149.95]) by smtp.gmail.com with ESMTPSA id f20-20020a056a001ad400b006b2677d3684sm2434831pfv.206.2023.10.20.22.32.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 20 Oct 2023 22:32:21 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: mark.cave-ayland@ilande.co.uk Subject: [PATCH v3 27/90] target/sparc: Move WRWIM, WRPR to decodetree Date: Fri, 20 Oct 2023 22:30:55 -0700 Message-Id: <20231021053158.278135-28-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231021053158.278135-1-richard.henderson@linaro.org> References: <20231021053158.278135-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::42c; envelope-from=richard.henderson@linaro.org; helo=mail-pf1-x42c.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 5ba71c3d84..d7bd6cd718 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 7358a59fda..2a0a9b0341 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() @@ -3819,6 +3823,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)) { @@ -4505,142 +4717,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 Sat Oct 21 05:30: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: 736617 Delivered-To: patch@linaro.org Received: by 2002:adf:dd81:0:b0:32d:baff:b0ca with SMTP id x1csp632357wrl; Fri, 20 Oct 2023 22:34:46 -0700 (PDT) X-Google-Smtp-Source: AGHT+IG/xxbBS89nKiDhbUn5SKIjILK9NxLqIXru89bRTgLpv4D9db1sQO9L4rgfYQFbfxUXHBdy X-Received: by 2002:ac8:7f55:0:b0:419:51d1:5456 with SMTP id g21-20020ac87f55000000b0041951d15456mr3637705qtk.22.1697866486031; Fri, 20 Oct 2023 22:34:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697866486; cv=none; d=google.com; s=arc-20160816; b=qzMYpuXsL8gpLvpE6g0JoxhG8j6BRTMWZ77wAgTtTMu4jRW1eAGEe398/QTmdJJ/S7 p/Be8ZdKqXkooFdU+kg4cOMVdiT+wOsxRqPxiyFQudhLnTMPFkpemC0sOqYotopx+BRg j71zB8wpG7LFRFVGeW0XFML7bgwYk4RFwZH2fcDViBImvyNK1Y6TqsSaf4LMd8H1khjc 4F2PQTaT6FqDNMbjtAo8ZpQ/jKJtlRHsIDigvvoyNKegOAopfzC7QHeRUsN8hgWOE1ln sAhObnMwot0m5mCi6x3vjttBz+75ER1tvNujH3dBJV5pf8wB0PNkGCfjRy0Sc7Dkvr9M 1B/g== 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=exVJ0xUg4TmQE2v5QVwO9952p+33As4o43E61S8eBHM=; fh=TYrED6TOMxGX0VC4GtjviASLbYyJe19+7/tKWjN44KQ=; b=P3tTENWLykcAFiJwWefETZqMFhRorx3hCc1vKA6ngtyql0rKQCNLXyChg0EGlqupWO juSiEAZdfIRyoIv4mwdwRTBCmnjdubAn1N+c9lGLNl4IzJrpCo56lDQnFYwtyp0FQNUo HoW6xaEvEye0H7Ps3g0OxgbuaPwxDzVFmprdxRABn/3iSSmN22ljAJuJ7i/gUu0DiWDF VesFKHryP2srvqqllt/mLng8331t1UVv8LxDcTCRSis7jPpBrqJZ5AcfJgzSC5Li2IBa WOWWbW/jxNOXuUmFmfg1kzSTaRzkvCpW8uGh33nuFeLfXMeQ2CQrxVI1ych2SsM8UnJm WHUA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=JyezHoky; 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 k9-20020a05622a03c900b0041991ffde0dsi2401171qtx.574.2023.10.20.22.34.45 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 20 Oct 2023 22:34:46 -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=JyezHoky; 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 1qu4bI-0007JU-Bu; Sat, 21 Oct 2023 01:32:40 -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 1qu4b4-0007Db-2b for qemu-devel@nongnu.org; Sat, 21 Oct 2023 01:32:29 -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 1qu4b2-0008Rm-8C for qemu-devel@nongnu.org; Sat, 21 Oct 2023 01:32:25 -0400 Received: by mail-pf1-x430.google.com with SMTP id d2e1a72fcca58-6b201a93c9cso1285096b3a.0 for ; Fri, 20 Oct 2023 22:32:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1697866343; x=1698471143; 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=exVJ0xUg4TmQE2v5QVwO9952p+33As4o43E61S8eBHM=; b=JyezHoky/SYqsmNWqVrLL+FPzBrdLOHLEPAJsmFwXTL6xo7gZ3EbQdOqOacTncgVkq L13Aw40isUwgzY3zRfqeBEUTXrOqa3CmDq+BWnmFQtx8VFgf1a681ULnMb4sbr3w/X1+ RsGMOgb5TmHG3Dj2CkEO2NTcZcKLzpricX3n2jm6Fbj/LHUkAiPDtvW0gcLShqaETVBd NItXRDX9ueM/lqqE/U+DxAfxCqO5MUCyW30K8bLQrxzioIQQ0GENFG2pSoqPyFbCu3Eo B8M3ni1/udWaE997KldZ8ITeEcN2+c0dnpAKxSd4Aq+3CBa7ad7F9hh45RfSfyIrtj+O cuTg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697866343; x=1698471143; 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=exVJ0xUg4TmQE2v5QVwO9952p+33As4o43E61S8eBHM=; b=Aq1dguJpbVf3mDZ35yf7ThCGfxZkGhR2lM1tEJKdrRjEMnko/Oq688RvRRgTdCiIQF 7pAIKyrZTFM6IJb0cUCxCk+w1iTcX7vFO0uJeTefRPkqky7oArNTjI4Wko0PK5xkNAWQ VFWIAy4DhZ0LlfFDmNsqhAZX3Oc1uyZTdnlr7OPC1kYwN6EMhhcIn8YyT4HOMOLFXi+d rBT8E6sPmCUZKfUgIijetK7XUzfnEc5wA3PEImsgwVndquVgbGE1p2HF9IUJJ1TmTx0n 4bAODAiWqqJ5p+BtQKNjhyo0+CMIZZXdyGbgukZItFwohUSGNP0xiwCofuMZEGdcKkjP /SYA== X-Gm-Message-State: AOJu0YxNUGOjuwa6zzzPo8HO5M5B0dlJ5LNOFCpV5v/QF5qIu3prHMtz K0Z8QRui+yNNP0ZVVKVktUthcpUV//fNNsDrGDk= X-Received: by 2002:a05:6a00:248e:b0:6bd:b7c5:f776 with SMTP id c14-20020a056a00248e00b006bdb7c5f776mr3797770pfv.8.1697866342916; Fri, 20 Oct 2023 22:32:22 -0700 (PDT) Received: from stoup.. ([71.212.149.95]) by smtp.gmail.com with ESMTPSA id f20-20020a056a001ad400b006b2677d3684sm2434831pfv.206.2023.10.20.22.32.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 20 Oct 2023 22:32:22 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: mark.cave-ayland@ilande.co.uk Subject: [PATCH v3 28/90] target/sparc: Move WRTBR, WRHPR to decodetree Date: Fri, 20 Oct 2023 22:30:56 -0700 Message-Id: <20231021053158.278135-29-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231021053158.278135-1-richard.henderson@linaro.org> References: <20231021053158.278135-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 | 9 ++++ target/sparc/translate.c | 110 +++++++++++++++++++------------------- 2 files changed, 65 insertions(+), 54 deletions(-) diff --git a/target/sparc/insns.decode b/target/sparc/insns.decode index d7bd6cd718..0c02a269e2 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 +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 2a0a9b0341..b1918da68a 100644 --- a/target/sparc/translate.c +++ b/target/sparc/translate.c @@ -4031,6 +4031,61 @@ 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_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)) { @@ -4716,63 +4771,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 Sat Oct 21 05:30: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: 736611 Delivered-To: patch@linaro.org Received: by 2002:adf:dd81:0:b0:32d:baff:b0ca with SMTP id x1csp632135wrl; Fri, 20 Oct 2023 22:33:45 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHqeG9VZwF8ccORK041kfmSepfIzRWwYP2l0rfpPtTYzL3TqQzKUCTGCY8m3VGVOoeE6dZE X-Received: by 2002:a05:622a:452:b0:410:9836:8066 with SMTP id o18-20020a05622a045200b0041098368066mr3867261qtx.43.1697866425391; Fri, 20 Oct 2023 22:33:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697866425; cv=none; d=google.com; s=arc-20160816; b=WnFUNg6/Nx+N1h2reyxyoIi2yFpzqGaa1tcuP4C0F7IJkdL8jId07ihH4BhsvxRZlf u8Q1CViWw+Qt+xDGSICKj1i57olKQ4sAclk+CVRVNY9tAgWKlzWRZHSk4XV1O53rgNuV Vt+/ljb+/cYm2I10DfjkImf6c9eOIu8ynFJ7GZKbX8jjcB9BkGr+bTFb+4AydrUDdDhL RVSdDVoFKLdYKg8Rm5FggP6m5ZuxdZX5vH0UkSGDYi9l6WJOTk4dmOP9WbwnZt4M+Njk VM+IKMd5SFbjPLUAt08eEdm8W0lmC6K/JklN7F7op8xc5quaAdSic4cwpte8AkzriRKH hnPQ== 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=6d8rlF7SQcCwaFMFwjdgdpbzMnRnq+iMMfw9KhtlrVc=; fh=TYrED6TOMxGX0VC4GtjviASLbYyJe19+7/tKWjN44KQ=; b=zUAbe2IJ12tewHRdg+/Y5Ze9KyMX5dG5L8Q0064fjlh3BPZQk0V4mqN+5Dn0+GOt5S pq9cnUvy17VidquNxgTk6b57zpd8SoUg4QS4fod/gBja7e67OzKHau8SspYZNX4ytJfe zx6pNaJs1pl8QbF2r8xTFqRZQpLzWzprjok/Bo4Z3Yk/VS6yqorq4eDe0awszYeC+fyI DTaYxH9QjUvqV0pJDqaDdWzaGsrJXFPRMIviPY42eh2YZ/CfU61XnCFZBUneb7HCcFdC Fr+kt0X4k29bG1xIu1zRPj5jVQjd89msKfcm4lK5IAlEHe0bJB2p+euhfPfA1/avc2YK Z8+g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=do6+KV9R; 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 bp37-20020a05622a1ba500b004197160f92esi2317647qtb.63.2023.10.20.22.33.45 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 20 Oct 2023 22:33: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=do6+KV9R; 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 1qu4bG-0007IN-OW; Sat, 21 Oct 2023 01:32:38 -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 1qu4b5-0007F4-2i for qemu-devel@nongnu.org; Sat, 21 Oct 2023 01:32:29 -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 1qu4b3-0008Rv-2Q for qemu-devel@nongnu.org; Sat, 21 Oct 2023 01:32:26 -0400 Received: by mail-pf1-x42a.google.com with SMTP id d2e1a72fcca58-6b5e6301a19so1430019b3a.0 for ; Fri, 20 Oct 2023 22:32:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1697866343; x=1698471143; 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=6d8rlF7SQcCwaFMFwjdgdpbzMnRnq+iMMfw9KhtlrVc=; b=do6+KV9RP+QoBKGkFbQCT7Bsg6U5T+e+op03GEeTSDXrytleQNpyICNhvsOJc4KnAn WuEdvQG2R3cr5Y6Rg+GPUXLNMotGYAFLNv3QVd1kcsMK0hEw3zBJk9seU0dMH4a9VpRX 4BeWo3gzW/6LBU2EG0Gf4XkqsmzUyPqYP+FlX6R9mZ0FJtDyPRPoOtVrO9BYoPbsQvjC ifR9YQ4RlTxRA6TaiA63+xKfZ+Z3JZ+kdEUl8nIWxS9K6LbN5ixOelK5RHX7VHfQtc+z 5BHKGnxvHa4PzkAu3400B9Zgi/7WMfa0hqAKyV0NgzxMWhkjNwouFefXEVsKn5L7Hqjx k8nw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697866343; x=1698471143; 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=6d8rlF7SQcCwaFMFwjdgdpbzMnRnq+iMMfw9KhtlrVc=; b=gpt3KuwP8awKz0OD+JY8hoEbEHUcwlTFZgztFNHLa7JlWtyRKxkS3jvtMZhVfA08OW ZcJMSneA0X0Qw1DXKcJdNOD2Cjc82UnZx22O5/7kppmzWZFZXtyjT6Y5ejobZ8JVyjs9 vmXhJyB9H5ePGYrPH3hLIGOsJYowFj2FPKuAB/XK1ZhwWZYWcQHG0EBYQR5Xfa2POwe2 l5nzfDy6bDwd9hDvRnPjgbOgwRSMytLGyeGF5AppLf+UmpZHMI3CY8EnXJXEIgiVnSyp vJazjJyeILlckk8JJSDY59qKnR9I6l7EgujGUWej3TUC+KsuS6BDPyCJhVhLluOELvFr 6tcA== X-Gm-Message-State: AOJu0Ywkg/CqjOs72u4hohUJI1p92ehKAz/v5lo8TNTwOL5o7l0Jptw3 hBCEXmd3mQhv20qZXk/IqDbZxdh+N5Opl1cu5cM= X-Received: by 2002:a05:6a00:812:b0:6b5:6c95:4671 with SMTP id m18-20020a056a00081200b006b56c954671mr4288923pfk.34.1697866343628; Fri, 20 Oct 2023 22:32:23 -0700 (PDT) Received: from stoup.. ([71.212.149.95]) by smtp.gmail.com with ESMTPSA id f20-20020a056a001ad400b006b2677d3684sm2434831pfv.206.2023.10.20.22.32.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 20 Oct 2023 22:32:23 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: mark.cave-ayland@ilande.co.uk Subject: [PATCH v3 29/90] target/sparc: Move basic arithmetic to decodetree Date: Fri, 20 Oct 2023 22:30:57 -0700 Message-Id: <20231021053158.278135-30-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231021053158.278135-1-richard.henderson@linaro.org> References: <20231021053158.278135-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 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 0c02a269e2..abfcaeb692 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 b1918da68a..ac72fb7d0d 100644 --- a/target/sparc/translate.c +++ b/target/sparc/translate.c @@ -4110,6 +4110,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; @@ -4458,43 +4533,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); @@ -4571,72 +4609,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 Sat Oct 21 05:30: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: 736683 Delivered-To: patch@linaro.org Received: by 2002:adf:dd81:0:b0:32d:baff:b0ca with SMTP id x1csp635362wrl; Fri, 20 Oct 2023 22:49:25 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFYUqIKkqgJoskTVsJtsvc88pJth4FicPWih2A7sbTPXlrbs/h+bJojU///vdof7FEozEYh X-Received: by 2002:a05:6830:168d:b0:6c0:7bab:3457 with SMTP id k13-20020a056830168d00b006c07bab3457mr4103773otr.20.1697867365617; Fri, 20 Oct 2023 22:49:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697867365; cv=none; d=google.com; s=arc-20160816; b=vOIvmr3X2bFt6oVGBPR8mBDL4/Z2r9B/WsMIUcDw08nwHWl/zqhbLWj3etQQXlbEMz x93m5tp7uGzb8wTocLboW4ohPps9CTDMI4XBgUiNfEXCs6aRvxX3PhDOMdKmnD+h2ZgW h1ow+1VjO9CS7/gPVztft2RHoa6ATc+gHCQpOOdrgGbrR8Zq5iq00touJkFVxFdoKR/S +nSNgFWEZKHist8ell7AEcokyib3HwLKrg1gB/iq4adx5OBeZkO68VpaliKoR8Z2edES KOlPmpYibVa4Q9isdEb56lJ12P0AURL+gWmbKJB4V4DcgHin8sAU6ESbdk0HA0kLrl6g KymQ== 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=jlGUcpyMuqLxu8BTPX1lWRrtKe0+ojjXPoCWAq8Re84=; fh=TYrED6TOMxGX0VC4GtjviASLbYyJe19+7/tKWjN44KQ=; b=vxyIlbfjQDLtljDpmk8rAiMoM4Fl0r/ICeAAYYGmU0csI5trqBl95SLf1pqcS6l+he d/4rAZsubuOZt8mDkAv1zyXObjZ6nfKViD17t5prgjwD7DfUt6z6C9oLrfOBg7Rgagqx ytNNIHl0qZ6qmxIjA5fcx6QTe8uVcLndnEfuMqkKAy6hwT+tUGuLey9Ryi8qeUvo3/Z1 EoZT/7LkrXeu+NSllbVBSNg143htBBA61dVZ1xrMBjMT5jlfXHyw9N8fwnRjNPmxaPZ/ D/QPv67BzuBfqOqMuCz7HGB8uyumzinLRpIJx/DoXjLC87EJkJeHVwHapL7rVdJMNwzZ w5Zg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=tl9SdBst; 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 k18-20020a05620a415200b00773a681104csi2535436qko.684.2023.10.20.22.49.25 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 20 Oct 2023 22:49: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=tl9SdBst; 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 1qu4bK-0007KV-5C; Sat, 21 Oct 2023 01:32: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 1qu4b5-0007F6-QD for qemu-devel@nongnu.org; Sat, 21 Oct 2023 01:32:29 -0400 Received: from mail-pf1-x429.google.com ([2607:f8b0:4864:20::429]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qu4b3-0008SA-TJ for qemu-devel@nongnu.org; Sat, 21 Oct 2023 01:32:27 -0400 Received: by mail-pf1-x429.google.com with SMTP id d2e1a72fcca58-6b1ef786b7fso1418028b3a.3 for ; Fri, 20 Oct 2023 22:32:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1697866344; x=1698471144; 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=jlGUcpyMuqLxu8BTPX1lWRrtKe0+ojjXPoCWAq8Re84=; b=tl9SdBstbIXmY1/Og3Gd10m6ckp+eCwiOKAA746psiV6lqfidY8XOI6UhE/ge/TNhu XMsgPxBU/429o1M3FO1jTyY/cqmbCqf1x/ntRCoXmiNFSYuxpycM4Zz9O0r/DgRb/F4n tk7aVouWanhyDaN4+uVv4FhEhs/vVeQ6aLiCsDxm2TkHyutqVvotcgxPPG3sP9MdLfnR NE+nf1BUw3GmYjwIZxkzLa/xigZi+f7UUr64Ac3A81uW11BpvmPONIerQkmRxBrGdvqV BgxSN7uZCaXmTKfShYREvhrpObVj6UxjKz+vS7+qoeCMcQEStpJz7nZVkfFg0WEWpiva 4WuA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697866344; x=1698471144; 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=jlGUcpyMuqLxu8BTPX1lWRrtKe0+ojjXPoCWAq8Re84=; b=q0M3hGJ6N2cy/710Ohdufkh9AhHTsLPT/FY5GTVzpFGMfN3rg13A0EwQ5GsJNcKQYf 4/f26Mid1PvPjrPX7d9r9ZdZxxDs45zy+UfROlmFUP2s8LE1hc/06c4eztki7WAYSnYr vcXVCfDCBEUfbcqmZS/z3c5KZTu569yRWdBKVg/n169jmr2gf/duTzewBMJ2h+u770RD p0qL5RrlJMPCAhT2OV3MDhFAl0Q3XIX9cZhHmjaDVROD+QB3WKccJJPBqiYFNAVOk4dD rfbWJfsn9yPQwBF/7HXlJVGP/FMkGaetzRexbzZkGSAPEnsLYmHCSPli4k+0v9N3hNkD uIDg== X-Gm-Message-State: AOJu0YxVn3tDYkxx/hbghSVET75XHHmX9LIEHOEt6dI/HkT6ilBvvwPU YX43UACVrZqgC5P55O7NFD8fYhpvzE36KwgJwv8= X-Received: by 2002:a05:6a20:258f:b0:15f:faab:1be1 with SMTP id k15-20020a056a20258f00b0015ffaab1be1mr4634515pzd.20.1697866344335; Fri, 20 Oct 2023 22:32:24 -0700 (PDT) Received: from stoup.. ([71.212.149.95]) by smtp.gmail.com with ESMTPSA id f20-20020a056a001ad400b006b2677d3684sm2434831pfv.206.2023.10.20.22.32.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 20 Oct 2023 22:32:23 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: mark.cave-ayland@ilande.co.uk Subject: [PATCH v3 30/90] target/sparc: Move ADDC to decodetree Date: Fri, 20 Oct 2023 22:30:58 -0700 Message-Id: <20231021053158.278135-31-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231021053158.278135-1-richard.henderson@linaro.org> References: <20231021053158.278135-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::429; envelope-from=richard.henderson@linaro.org; helo=mail-pf1-x429.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org Signed-off-by: Richard Henderson --- target/sparc/insns.decode | 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 abfcaeb692..959397e62f 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 ac72fb7d0d..bf41047f66 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); @@ -4185,6 +4203,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; @@ -4609,10 +4659,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 Sat Oct 21 05:30: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: 736626 Delivered-To: patch@linaro.org Received: by 2002:adf:dd81:0:b0:32d:baff:b0ca with SMTP id x1csp633269wrl; Fri, 20 Oct 2023 22:38:55 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEV+YA4AIPdeo+zCbayQT5voAX4aOEYHH9ETS0b544s01QTPp2DIIg795eIemABFMCLBQgJ X-Received: by 2002:ad4:5aa3:0:b0:66d:6526:d605 with SMTP id u3-20020ad45aa3000000b0066d6526d605mr4866794qvg.63.1697866734943; Fri, 20 Oct 2023 22:38:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697866734; cv=none; d=google.com; s=arc-20160816; b=Zg4Vq/7JmfFFgP+ttjKYADv5iprrhiyYRWWQ+h1LaCt+zyXZ67uPSC2Tv23OS3AOtF 8wco4u5JubitK+uJ/uDkRr84nZy5tpNRZGvrLqQpM33hYqm1WYBWXyI/TJB2RSiNJiqF aOIoqmUOQoaIaGVXzugt22n4IvKU/FA5WW41G3G0PnvQdigBkf+jiV6LFiz5we8VY1oD aF8tpuAvB4gI3sLroqiKu2AjzjP9VU4o3L3/6Cji+X3uIVvB7ZDFcwpGbuXLt7kjN1IK nFQp56HYS50YO5Ue83Orb1HBLFbn70p81YmriCSr8sd0plA9WvLJb5Zw5rnokW00LGWH pblA== 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=A1mRozPLloATOsE1zPRn/KSGBk/VdF2/1IvPJmxRsR8=; fh=TYrED6TOMxGX0VC4GtjviASLbYyJe19+7/tKWjN44KQ=; b=ZUAS6deosuOOfbQJrj+0d1GJKoS2vo0ubCCpLQlrPg5LDPbGFiNOBNUmLzEgM6jYlc 3+1GDfPH983V51kWSuMetg/UyutzNR/roG4YaTMTXZZOk+c3SgsHad0YNYHSiKTXtNay zpjf4oHhKVx64QtJDhFwucw2kRsuSfSTXoMvjv8O8dBw+eRGNTh/8TMYokVq+nE0K3TQ HLfvjeDSDmWlGzPsaAWCc264NQbnkrid7b+aMXL1eVZl4iBxTzlGXwRQywZv6ybFYFJY V4AeFRUzYIfh/5rjosaQh4IkV8GBGFmtA1jiMUWW9SRuQ8Xgin4zAHaE40EbnqFQivl1 SWBg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=VYCERwMd; 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 dk9-20020a056214092900b0066ad5dda80csi2531742qvb.138.2023.10.20.22.38.54 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 20 Oct 2023 22:38: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=VYCERwMd; 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 1qu4bH-0007IQ-CW; Sat, 21 Oct 2023 01:32: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 1qu4b6-0007FC-8j for qemu-devel@nongnu.org; Sat, 21 Oct 2023 01:32:29 -0400 Received: from mail-pf1-x42c.google.com ([2607:f8b0:4864:20::42c]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qu4b4-0008SN-FF for qemu-devel@nongnu.org; Sat, 21 Oct 2023 01:32:28 -0400 Received: by mail-pf1-x42c.google.com with SMTP id d2e1a72fcca58-68fb85afef4so1445897b3a.1 for ; Fri, 20 Oct 2023 22:32:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1697866345; x=1698471145; 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=A1mRozPLloATOsE1zPRn/KSGBk/VdF2/1IvPJmxRsR8=; b=VYCERwMdVdi54xWwzgaY+jdzWqZPohvt043LY9WiR2WyqAGVKaqWbHpP2Oo+gIGUtb 9k5N+FqPZlzP7f7SeahetwV8T4eNXbK0yOizMtuAluZqzbbSZZ+MIpBt7+Mbb0kBt4KW UPDzVMSVcnLY4/Sqi+veETAVpQIZG7EvYsyn9cU/oL/6tMzl8Kx3yloToKovz0BeiiFq M4H4UmmIlHI8xlWw6br9Rb8eS9hxPgPs83b5Pd7El/ER+0MJKRBeVv8mOG05f5YMH2uj +vpG3uAQobezV70nMDQjj/J4kEoDaLBO/MXrrpLtA6mCNQCU7ozZSCea5N3DGgp2ojlq hB+w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697866345; x=1698471145; 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=A1mRozPLloATOsE1zPRn/KSGBk/VdF2/1IvPJmxRsR8=; b=A46ykN1pJQ04VoahqzF25WrONLmf+LnsC59zzL3vEzkcJ9ufYZsL5dLnFMIq88SHUu QOxh5KNkDLTVu5HU84Wy+YjX6DLET3fQddydpM8o5OvMmw1hyQqVgiIHbZqQ8e5PhusZ krbPQ0aViSIalI31xshqSWZdobk5xN0rd6lcwCnNV53K0FdVIPQbMhUVhG1y1NVixKmy cajIBvAYMxFjN1IqMYcohO5JPUVkkuRSRg5j8paZxwRnznuZwMfLUDJCb89yCaXt8KwC gzapuxQ49W4cLhc5AEiSQo/MgNz1gzmPrnR37cpikShJYmj9Z0CC0PoD2SWB1azaRdt6 VQtQ== X-Gm-Message-State: AOJu0YzFzgMamqaEmN8CACzjSMqYn5DTGC0fSDntZ5TThirZZdGObbCm Yf91lUCcoqE/Il4IEJAGo8IAn7raXPJiVHsWtNE= X-Received: by 2002:aa7:988c:0:b0:6b5:ec98:427d with SMTP id r12-20020aa7988c000000b006b5ec98427dmr2983434pfl.17.1697866345241; Fri, 20 Oct 2023 22:32:25 -0700 (PDT) Received: from stoup.. ([71.212.149.95]) by smtp.gmail.com with ESMTPSA id f20-20020a056a001ad400b006b2677d3684sm2434831pfv.206.2023.10.20.22.32.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 20 Oct 2023 22:32:24 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: mark.cave-ayland@ilande.co.uk Subject: [PATCH v3 31/90] target/sparc: Move MULX to decodetree Date: Fri, 20 Oct 2023 22:30:59 -0700 Message-Id: <20231021053158.278135-32-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231021053158.278135-1-richard.henderson@linaro.org> References: <20231021053158.278135-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::42c; envelope-from=richard.henderson@linaro.org; helo=mail-pf1-x42c.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 959397e62f..694d2c3648 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 bf41047f66..4ce87f59b9 100644 --- a/target/sparc/translate.c +++ b/target/sparc/translate.c @@ -4169,6 +4169,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) { @@ -4659,11 +4660,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 Sat Oct 21 05:31: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: 736674 Delivered-To: patch@linaro.org Received: by 2002:adf:dd81:0:b0:32d:baff:b0ca with SMTP id x1csp634957wrl; Fri, 20 Oct 2023 22:47:35 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGTNXi8igkThT4mFmQYMm3N7HGcSf2WDsgbSoG5YXvT8j0hHIa8W/xiosRP/wWARgoOv0cq X-Received: by 2002:a05:622a:304:b0:412:2ad4:da05 with SMTP id q4-20020a05622a030400b004122ad4da05mr4145605qtw.38.1697867255029; Fri, 20 Oct 2023 22:47:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697867255; cv=none; d=google.com; s=arc-20160816; b=WNFZ0akwRrSe/byKcwnMxqtt+Cz6R/T83tY3xLjsWBQx7+PUtI8ABcBQBTrBqKrEv1 zXnNm1lwvR38nDXGU8h+OLi+mYOOIvnU0xU9DKWzDA9KFx3vsDkBP1XvQuLLa5vNTuY9 7KgHu7HmFYpvGuZ5MR6VU9EhWnyaWBHiWCYG1BzB5cW+U7EfHqFGtJG1Q39h5In1YgOI 024y/WbHMw1LnTQ5A5Bgyzfgl1p4SmHx1oE2aIFv0019ztibHoeF1HVibuRE+xvkkqz4 UXjDoEMMyeE+lZ5fSjbUrHSh3vDQ50aAWs+iG7+dEnHNA3ckxwEkZZRoekV9NVcfaDCV i1wA== 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=foC8PXJXHiVmCLdzU9Kncpr4frxu6s3Go8QawovY8VU=; fh=TYrED6TOMxGX0VC4GtjviASLbYyJe19+7/tKWjN44KQ=; b=eq0n2Eu+6JjpJxKZHVkQTXwsY/UsUffKg40tOxZW2V7jvNQmszIAzEUaBoVHtCAT4S GpOCeu4yAze7E2UNdFwnCRMcqWnuYGf8nRGwIZCtLpoYcqZHqYxOMV//vCGJJs06FIo7 Ety8eopRDULN/FNyshEqTSLhO1YxCy7Rm+vgL3VUToxIoK6vgDpv2KD7UA2Rcpmj+MKB MAe2CD5zBR1B6oY3DdqEnmZ7o9Qbl5IzMes4Z9maMosMyjzDzbdc44bCHxYDyX612ZUd NBMQxAzDRuhM46Rpzkzmq3SX9HKB5cpSfFkzOldrvLZ1xzIUmHyCDbmq8rO0ijnk4Fid QQCg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=bNqLZ1KM; 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 n14-20020a05622a040e00b00419856ea1casi2414338qtx.123.2023.10.20.22.47.34 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 20 Oct 2023 22:47: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=bNqLZ1KM; 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 1qu4bL-0007Lg-Et; Sat, 21 Oct 2023 01:32: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 1qu4b7-0007FN-UG for qemu-devel@nongnu.org; Sat, 21 Oct 2023 01:32:32 -0400 Received: from mail-oi1-x231.google.com ([2607:f8b0:4864:20::231]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qu4b5-0008Sf-CP for qemu-devel@nongnu.org; Sat, 21 Oct 2023 01:32:29 -0400 Received: by mail-oi1-x231.google.com with SMTP id 5614622812f47-3af604c3f8fso1115558b6e.1 for ; Fri, 20 Oct 2023 22:32:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1697866346; x=1698471146; 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=foC8PXJXHiVmCLdzU9Kncpr4frxu6s3Go8QawovY8VU=; b=bNqLZ1KM9gmaU422Z8/PVRnEK0MBAm48wHn2oJiwScyXIRtmUMc8T30QqHmzfySkqL qWRMROFObh/Ni0pNJYj6UP3l9FJCO3vur+inPDlLcR/VgzglSbzmrHgLuSd2tyG2dPNE umo89vqgQmrMtBL9F2yrKIOhKm4r93CghwBnGVyxklmIYXBiO7l+LOLJwn6Nqk6c9GJR UT/CfqfV6D4itPjviA0lmP0DE38a3JJGNUNpJbwmQmy+UHmvEcnocfHu9GmcgiQdLD1j D/CmjVaC3WB1vr2r0ajqzfcJsjORop9WP3NUzY+15Sx7zzdOtAfXhSPP6rBCbitzlVRE kjmw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697866346; x=1698471146; 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=foC8PXJXHiVmCLdzU9Kncpr4frxu6s3Go8QawovY8VU=; b=XRARgp7c4bZahEUz1HJE7dmGOn5eWYlBI+UjL0FYgl5SOOYtRpy6oxrwvWZ3Ri2lAj xP2+O6fgX913aFGSoITFC3J5qj8pcnAalRB/3VSwqYu1JlzmApmd9IcG3A9/6u9UHBZl 7pR7ZIBx21oHRfoViWS9o2g57IieLwJMpN668Qi/OilnIvshv8SpbVCaq5lhIHZBo1ZC lfDRxds2pFnWpUeL9utbsYqGex/GE/RzEgnvkisErVLZgK6wWTmzN77so9+LMD16Limr pB63zWeOqJjWShk/ZihhKRkTD1m590kTTdAs3ploNwklVqciR64du2xRaf2I3XZpaBfA nG5A== X-Gm-Message-State: AOJu0YxVfLTKott80axBXHXSfk2pPHOsrJfkLHm722IgHDe28q2pTT6n btp3WyEnn6BP4OW8DDE+U9e0rxbhnsEU/iejng0= X-Received: by 2002:a54:4e8c:0:b0:3b2:e624:43a0 with SMTP id c12-20020a544e8c000000b003b2e62443a0mr4204559oiy.15.1697866346206; Fri, 20 Oct 2023 22:32:26 -0700 (PDT) Received: from stoup.. ([71.212.149.95]) by smtp.gmail.com with ESMTPSA id f20-20020a056a001ad400b006b2677d3684sm2434831pfv.206.2023.10.20.22.32.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 20 Oct 2023 22:32:25 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: mark.cave-ayland@ilande.co.uk Subject: [PATCH v3 32/90] target/sparc: Move UMUL, SMUL to decodetree Date: Fri, 20 Oct 2023 22:31:00 -0700 Message-Id: <20231021053158.278135-33-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231021053158.278135-1-richard.henderson@linaro.org> References: <20231021053158.278135-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::231; envelope-from=richard.henderson@linaro.org; helo=mail-oi1-x231.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 694d2c3648..f214baf465 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 4ce87f59b9..4744e8caca 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. */ @@ -4170,6 +4171,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) { @@ -4660,24 +4663,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 Sat Oct 21 05:31: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: 736670 Delivered-To: patch@linaro.org Received: by 2002:adf:dd81:0:b0:32d:baff:b0ca with SMTP id x1csp634739wrl; Fri, 20 Oct 2023 22:46:34 -0700 (PDT) X-Google-Smtp-Source: AGHT+IH7YqdSxaZUnIXioVqfieib4vV0NzDZeC2y/c+dTxweVvVsudH0klKa/dGf6FPSPbB47+hm X-Received: by 2002:a05:6214:2602:b0:66d:44b6:8aa7 with SMTP id gu2-20020a056214260200b0066d44b68aa7mr4374339qvb.24.1697867194597; Fri, 20 Oct 2023 22:46:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697867194; cv=none; d=google.com; s=arc-20160816; b=jus/7cqSBCqD99vxxG8cczJmuy52RfEw+X0V3KdWvaPBrihNxcuB1wgGT9X7gOY6Yt ENvT6FkUTa7mI9svbP13TJ23IWFvJ0nvDbnn8ZoTgQ/nb1QoXtL5h83CKvaJxi2v6buI NBO2wMkuQNtEuUJ/AHJoVzbL2E3j9n4hcBYDVy5a9dOKlU5oNm/nzN6onFpsrnpZClMu CdwSOfPVPbCMgoBCT3KPRIvrrJb0UcIhlTUS3jVWnsUzwpWkZsQEto/zsyUP0bfVJKAN KNt4G7T3WR4rVHefPT1CxPbXaJ2mGaUTZqKqM2Q7miIuZPH4oZjA3rbiPiVZnJrpA3t/ EW3g== 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=7iOpxPC6VqGVqOgY76rdiLh5ZrmtpZH6A2OROv484R0=; fh=TYrED6TOMxGX0VC4GtjviASLbYyJe19+7/tKWjN44KQ=; b=sq81fTzGcy3r0sL1DInbp5Xo/CzYj07o4sgADF9QrTTFIbB9X7eFAvYQMjSC4qUYNn fhNWQ1Jdat6N/XYURl9S6vHFXsGlN+EGSTJsKY+Crebm6SyJSIjCINBJ5PAae/mC9Rd3 OTakueiuIvCEUgSvOoiuZlqaTRmFTxcaYTPTZvdyOCKAxCd0mpJdybw62XnhTdGCw5dD r2DL5XhlsgucXnjKCoWA9lCBzgizHSfuGijUsrYDisms/T0eUSCC6tc9cnx2oqoLXohz isI3AnN34uh6nUYZ4OVNBA9wzOPttw7NkWU83UiHiXVGcENMHrmS5KL7/TC/IOz5OUWb PsGg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=dSDGBwLs; 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 u13-20020a0cf88d000000b00668de23041bsi2493794qvn.160.2023.10.20.22.46.34 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 20 Oct 2023 22:46: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=dSDGBwLs; 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 1qu4bK-0007Ku-Qz; Sat, 21 Oct 2023 01:32: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 1qu4b9-0007FQ-9f for qemu-devel@nongnu.org; Sat, 21 Oct 2023 01:32:32 -0400 Received: from mail-pg1-x535.google.com ([2607:f8b0:4864:20::535]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qu4b7-0008St-Fd for qemu-devel@nongnu.org; Sat, 21 Oct 2023 01:32:30 -0400 Received: by mail-pg1-x535.google.com with SMTP id 41be03b00d2f7-517ab9a4a13so1187187a12.1 for ; Fri, 20 Oct 2023 22:32:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1697866347; x=1698471147; 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=7iOpxPC6VqGVqOgY76rdiLh5ZrmtpZH6A2OROv484R0=; b=dSDGBwLsTX/KBnAQRNIr2RVdetARgh8W7O8le4rCb9+HL5yxeiF1flBWJetqMvhLEr ql1o69SCRAIM+qVF3iMbeEvyWTgahRvkDtd4aR/Grfuwbcgr64Zq3KdyCtMzaA36QN2j /kBhRO/Az+7ytwOzhbOWGyZSoaJIhXOqMzWFmUJPt9nhXpV/2+FQ47FdQ1Vn3GHa1D9f ODaE0SOKWHgIM6b8TiH5dqZftLmNTonqaYvEf/+FvXhqSdbrbsZde2LcLPHqJW/A7MiX 0U8BjMQ7sqYoyretHMekJEh3dmYqnQq1SEbwA0k0KnRB1vpXJV+KUXf/Tl2B/WolECDT F6KA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697866347; x=1698471147; 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=7iOpxPC6VqGVqOgY76rdiLh5ZrmtpZH6A2OROv484R0=; b=u29SLjMMwBZJzwv7N06890qj7ttrvXmzoaMBK+lndCGQyC88c5YHKvY0BNIXxJgbcO n/hiywiOTxrZ2X7h4cQZuW8UzGf9CsgAWDWdIqcF8un2MngWyyvmp6aY8/41LBhVxFCj I53eH6sTWaLrK+RzqBxnXYGVv6a2x30Wno4zIA4QkXmxge9TGJNv4gw+ldFWElZfOXUd trTXJnzNhz+2SjEwnvh7pX8i+1r8Da3E+uCuxJuaFYJ1dz58TcrpL5w0apSEvsVcNuKe iSLYkQAfeEFdZuvh1OakMTNKFJCEscTKmkylD15d3McqiDtWnaPB3sC9QnrBr6Vnuh6c LGLA== X-Gm-Message-State: AOJu0Yx89z/6ZuQVZCTLOOzeBLqbb7L+Lrf7jPmyYWQaWwQiEq0tmGuB ytUHBzb/PbXBoAmXf5yb0peX7GfmY1mOIygmCss= X-Received: by 2002:a05:6a20:3d83:b0:174:2d20:5404 with SMTP id s3-20020a056a203d8300b001742d205404mr4889449pzi.37.1697866347019; Fri, 20 Oct 2023 22:32:27 -0700 (PDT) Received: from stoup.. ([71.212.149.95]) by smtp.gmail.com with ESMTPSA id f20-20020a056a001ad400b006b2677d3684sm2434831pfv.206.2023.10.20.22.32.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 20 Oct 2023 22:32:26 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: mark.cave-ayland@ilande.co.uk Subject: [PATCH v3 33/90] target/sparc: Move SUBC to decodetree Date: Fri, 20 Oct 2023 22:31:01 -0700 Message-Id: <20231021053158.278135-34-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231021053158.278135-1-richard.henderson@linaro.org> References: <20231021053158.278135-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::535; envelope-from=richard.henderson@linaro.org; helo=mail-pg1-x535.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 f214baf465..ca54a090a3 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 4744e8caca..2c9f5ec317 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; @@ -4239,6 +4258,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; @@ -4663,10 +4714,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 Sat Oct 21 05:31: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: 736684 Delivered-To: patch@linaro.org Received: by 2002:adf:dd81:0:b0:32d:baff:b0ca with SMTP id x1csp635543wrl; Fri, 20 Oct 2023 22:50:20 -0700 (PDT) X-Google-Smtp-Source: AGHT+IES5rwgbkgUUD/3bJVEWx7nIf00YpAeX0ewo9/7aZPjwFuSGZ+xs4wNRFKbEMWQ6e56vi9D X-Received: by 2002:a05:620a:24cb:b0:775:9f94:1a7b with SMTP id m11-20020a05620a24cb00b007759f941a7bmr4611604qkn.0.1697867420598; Fri, 20 Oct 2023 22:50:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697867420; cv=none; d=google.com; s=arc-20160816; b=tNvq0Cfm4l08tPqdNitNLjuAfBxNJnReiU1TT8ohQ2ErciT7ytbHkijaY3YSDaIIbL QK82E++XJV2q/ntTuu9kKon+QFEsMecHf3K9eban050qQ/MEXKwTizx46YSPAzpJcMgW gIUoXpJhv128c7jVyAsJjZmdHWU6gWsfRVi+kocpqmjZ0x6SxLR+whSzRqNZtANt2/js LXU/6666Bu35TXJTM6YViinlFwdqIxyRSZLuu1p0q55EFvLVnNLhd09GNbqOy1pr849l zd0UJdOFoLSLn0ffQ6EXskz0QOR9YIamNk8o+6585QzL8EcApqNlgHMTD4a91rMrsaCg PKEA== 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=zCddgK7z8uallbPSoWf9fgqngcXvdNDUOKMBy07dabs=; fh=TYrED6TOMxGX0VC4GtjviASLbYyJe19+7/tKWjN44KQ=; b=GORO/MPrPGid/RsVLJvhE5I51WQjnFqXG/r5BS4hl2a9cq4ZIq5cy41rQh8q6DQgtS PqtYDCrs/u+0hHaS1UhKwlKBcMA09dO49bYthhBw8AprpNMgo5ZdFP8MTQal3A45/ick 4BTuyIDgd9mxC9vJ4R92ZRT9zAlucytC6l1+8zm+YBwMRw+4dXI0jGP7EjtJHwT6EM4l l5/1QYPtyfPgV+4Q4av2MOlua28O/35O9Lte7HzUkg6fWwo1qFJHKKDs5lT/HTRIyVGF Z6h6f5HHQQOSFLgOh+197lvnrtBAXzz6lbGETLbwYf+NEoUa5AjRowrgkH/Bylp19J7K tDzA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=DxC0kLCd; 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-20020a05620a560700b007759bc3be67si2402169qkn.91.2023.10.20.22.50.20 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 20 Oct 2023 22:50:20 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=DxC0kLCd; 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 1qu4bK-0007KX-Bp; Sat, 21 Oct 2023 01:32: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 1qu4bC-0007Gb-E0 for qemu-devel@nongnu.org; Sat, 21 Oct 2023 01:32:34 -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 1qu4b9-0008TF-1l for qemu-devel@nongnu.org; Sat, 21 Oct 2023 01:32:34 -0400 Received: by mail-oi1-x233.google.com with SMTP id 5614622812f47-3b2d9ac9926so1044328b6e.2 for ; Fri, 20 Oct 2023 22:32:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1697866347; x=1698471147; 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=zCddgK7z8uallbPSoWf9fgqngcXvdNDUOKMBy07dabs=; b=DxC0kLCdWE8xI3Yg3r1CzmR6sWugRJcN/tApWGCxU0brecaea2hCa4ceNql4WFLPgJ k7YMFK2GQLmUR409FTy15LcZPWiPT/CbuPtfOO81lzxEFegeYLsXA3OI0IYPMzdxEDT2 IZd9OMJ0irf8kU0DXzE1h8e+uR6Xz56rZYmOtMGYMhmKAVFMkvupGnDn1CvApwCDdjSV iULC8j3SEXaKRFJ+ST6pXWevhfQPCelNkFJ/N63vXx6E96F9aOymyCF2Vs9C9BvzUyS4 nrIW7HviTgbvYtsBO7NY71oO30xuNXN1r2VHth7yrV5AY+OQLKy1Hxydnv53i+FKsnqs fr/w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697866347; x=1698471147; 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=zCddgK7z8uallbPSoWf9fgqngcXvdNDUOKMBy07dabs=; b=adqsHlug+YPvP+23wTKAcJ+k/N5eYAsBjMQ61fZSq5ejHPLDr48RhdC/Z5fMz4tN3o uNQpbzarHWCMgspTWD3DwQSRyvNzr5AV5DaJXd8rFu4t9yDISpm1jQ9Svf1IMnfM0cz+ g2thkA789x945TW6wW8KZg9UToYPkxasOABxvOnully9lawPRbziDzwxBuUzj6uTNz0a 8f888TqRpckcASRoe4JFpvaciIvDUGl3R8ITj4ckxmT+uEYWA9a/gYmGIfTLy3ilRlQd jB8Xl5W5Te1YRBxhl1eWQjouLKDk3qozplspleObs5mJ4+6CqKjtn2Dd13aGCzEtFWuT nRCg== X-Gm-Message-State: AOJu0Yy/Q6UQFGOD64Rg98WINpBcj22HS9ufTDGaaFny104rHm+6h8mV vUIz8h5wL7ExgGY/KRNYsvl31fI5V7mmbLzABlU= X-Received: by 2002:a05:6808:150a:b0:3a7:6213:6899 with SMTP id u10-20020a056808150a00b003a762136899mr4923188oiw.24.1697866347705; Fri, 20 Oct 2023 22:32:27 -0700 (PDT) Received: from stoup.. ([71.212.149.95]) by smtp.gmail.com with ESMTPSA id f20-20020a056a001ad400b006b2677d3684sm2434831pfv.206.2023.10.20.22.32.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 20 Oct 2023 22:32:27 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: mark.cave-ayland@ilande.co.uk Subject: [PATCH v3 34/90] target/sparc: Move UDIVX, SDIVX to decodetree Date: Fri, 20 Oct 2023 22:31:02 -0700 Message-Id: <20231021053158.278135-35-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231021053158.278135-1-richard.henderson@linaro.org> References: <20231021053158.278135-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 | 23 ++++++++++++++--------- 2 files changed, 17 insertions(+), 9 deletions(-) diff --git a/target/sparc/insns.decode b/target/sparc/insns.decode index ca54a090a3..94a85e488a 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 2c9f5ec317..d0b570eb08 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) { @@ -4192,6 +4204,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) { @@ -4714,11 +4728,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) { @@ -4856,10 +4865,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 Sat Oct 21 05:31: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: 736669 Delivered-To: patch@linaro.org Received: by 2002:adf:dd81:0:b0:32d:baff:b0ca with SMTP id x1csp634695wrl; Fri, 20 Oct 2023 22:46:27 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGVyslOmplvCKH4vXefwHbys8jT2Ea97qKblp2nqgUcUIqWh/OeNwNZIkkid4i/qSHTqrp3 X-Received: by 2002:a05:6808:210f:b0:3b2:ddc0:ac9c with SMTP id r15-20020a056808210f00b003b2ddc0ac9cmr4304492oiw.39.1697867186749; Fri, 20 Oct 2023 22:46:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697867186; cv=none; d=google.com; s=arc-20160816; b=GPNhmGIeBqgR0z7M0r0ixjfH+Xksh+qD/rYY9E09KkgglcIGN6zbQixIjvGnvdusL8 smOYcaRU0k5qgMPlQl7OnMHc43X7G/t7ZeggvAVmFTvPfpUneQI6NzIVymkjQlfvxo0Z agnxb6xprzVuEqWPQimZODhiRKL7R696jtbeHLqRaxLlDWsFW9IaTFB23UW1X98YQjrx IO1vYyZ6zc5LU5G9RoGYgZcDZeQUPzttFxsNNgUmSuDX78VerY86fuseut4GtpdyKdaV x/Si882DVSMkO3F3G/frcH5Ycz68VEhNzf/zmc3a5VVm8GM1rw3W2Ksx8Npwq4jBlrm9 ibFA== 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=asHYFIMl02Ap9CWeIMRQpLgGhTjZEgqjZo/ha03h7qg=; fh=TYrED6TOMxGX0VC4GtjviASLbYyJe19+7/tKWjN44KQ=; b=PyboZNn6vSxdGZSzeWQ6g+hNFiYB2HFh72SpjdwUK20ZGWkOy5/jnU76BpBXlS/vhc xjTu5IA+dgAw+iZhbn/vbnmFO3zj5lZE4sJdZsTzKGxGAvhkPBMknze4uKv3MTnEk3LX bUfcCaeLBhXLfahxCdndJnj4yBR5EKuPqwwcRQ14mehJAZ7DySMZ5LERLRN15xkvs2Nu 8aDP451ygVjAM2qeA3sMxddTjZBoaii6XniOYW8hQ299N7iEn07e9xQfqeyfy4dihUvc SsAhbxGZZ8k62Xw8M83L7yj1/4wn1wccpnYNnyrK9sj07qWtCF05UE0KaOujofLoUBCW LGiQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=PgAmNRT6; 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 n19-20020a05622a11d300b0041972cd4d48si2501669qtk.45.2023.10.20.22.46.26 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 20 Oct 2023 22:46: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=PgAmNRT6; 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 1qu4bL-0007Lj-Ed; Sat, 21 Oct 2023 01:32: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 1qu4bA-0007Fm-V4 for qemu-devel@nongnu.org; Sat, 21 Oct 2023 01:32:34 -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 1qu4b9-0008TX-23 for qemu-devel@nongnu.org; Sat, 21 Oct 2023 01:32:32 -0400 Received: by mail-oa1-x30.google.com with SMTP id 586e51a60fabf-1ea48ef2cbfso1236449fac.2 for ; Fri, 20 Oct 2023 22:32:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1697866348; x=1698471148; 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=asHYFIMl02Ap9CWeIMRQpLgGhTjZEgqjZo/ha03h7qg=; b=PgAmNRT6xlcUiVlAUvprfdaFp2NfKSs8U4Jmfn54CBrMeQOFYyBQVKXJwyA2OmIvka ku+xYkAA371fQ3skjjYGI28t/rnvDbRQsHwq2NMQ1hXWvdbzMXcl9blfMWwzLYoPgoy7 8bfQ3qfDMdlzT+Iu6LMoiptQ5rhDSIVu76jqYQE8ebu72LYfFSbXo4pn4nYWwdfS24Uk jzRenuPkj3CWfeD1XwNaGuz6uDtOQnT59Pw6JKFQOFCDTUjoS83FP3N05Mqf5Cwke5g+ BQ4Fx1KXQa0WC8Qd30l7tFF3uuskWa/RZkJdh9NmVlPEXGJFE+e/C7xgFe1hAnZubEjb uZdQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697866348; x=1698471148; 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=asHYFIMl02Ap9CWeIMRQpLgGhTjZEgqjZo/ha03h7qg=; b=tK3E6KPKR3VMw1cVPK819JJ0JACIf9/0yQWNfinybCSubmDscy+J34+fS2zPauTyda XmWVJ8II+2URJgW2Mhpdxgr/VQo8xLCdpKqSJNUv2QmnpdqRn/T6c9aFKKsB1bgS5nQF VRpFWCQAREAe6jPoe51qOnS4cMDj7qGZNwtDmUo4MqX2dbon24lVOJMihayDZ+0UQ1LF rGScLK71Gn8KZRNSKRWvN4maqTAcDSwxnubuSAAF9QTbKAdgi9E3AWyoBjqPLBZJUEiA TAtQgwtgjKSXeNJq9eOapnKnO+xGrrPUtvpGygj1lcuqh4VFM4ojgQaye6LN5Jo1Hi6S OFhQ== X-Gm-Message-State: AOJu0YyRsCYPqimeYw0KAeY5aLLDWgLlVnbBLKwyefulluO+oDMHeSMw 4TbmH7M0JLM7XyDS/qfRr55Lt1iG6vxgyWBR8pM= X-Received: by 2002:a05:6870:a714:b0:1e9:a248:b1b6 with SMTP id g20-20020a056870a71400b001e9a248b1b6mr4451576oam.35.1697866348445; Fri, 20 Oct 2023 22:32:28 -0700 (PDT) Received: from stoup.. ([71.212.149.95]) by smtp.gmail.com with ESMTPSA id f20-20020a056a001ad400b006b2677d3684sm2434831pfv.206.2023.10.20.22.32.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 20 Oct 2023 22:32:28 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: mark.cave-ayland@ilande.co.uk Subject: [PATCH v3 35/90] target/sparc: Move UDIV, SDIV to decodetree Date: Fri, 20 Oct 2023 22:31:03 -0700 Message-Id: <20231021053158.278135-36-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231021053158.278135-1-richard.henderson@linaro.org> References: <20231021053158.278135-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 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 94a85e488a..74bf3760e9 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 d0b570eb08..e8d904d565 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) @@ -4206,6 +4227,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) { @@ -4725,35 +4750,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 Sat Oct 21 05:31: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: 736615 Delivered-To: patch@linaro.org Received: by 2002:adf:dd81:0:b0:32d:baff:b0ca with SMTP id x1csp632297wrl; Fri, 20 Oct 2023 22:34:29 -0700 (PDT) X-Google-Smtp-Source: AGHT+IETTYR28jzSnpwAUZmo1XkeYkC6E3HDpmEVbjTQIO2m1yTwMcwyjhXMDU3h7/vUWMIuctzy X-Received: by 2002:ad4:5ba6:0:b0:66d:f91:fa33 with SMTP id 6-20020ad45ba6000000b0066d0f91fa33mr4464794qvq.29.1697866468990; Fri, 20 Oct 2023 22:34:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697866468; cv=none; d=google.com; s=arc-20160816; b=Fhd9bEHPIrES2v8WRJDjNS7MArf5lXYCNVd0C4aI+t25W7FjXiQBUhftx9vmP9bjzj YUZSi61bMSXdBoVln84FRhh09tJRoElkz8fDhgjjV4T+tPAG60jwMA/TY5veuMK8s3dt xkIaIQenWcOn/Qv64vQHkHO6Af0dz4HlnSbgECo3hMCei0XOlRwksL4AJHcStilvhs+u RujJ3oj9vS9G1eUWI7iS2aE0XGGal0tiyyD2zsDPLte/dgeNiuM18V/y+CP8Al0HBJ+P dVl1jtNE6Cal0wilQ7EISTdAIC9874rrlAGgXotb2K1Io9DpqKASORcv32t1cU+bNSp2 HBQA== 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=2UcYIxKtjHYsj8AaxTVb8axIcBlRLqYqK/EKXSopODs=; fh=TYrED6TOMxGX0VC4GtjviASLbYyJe19+7/tKWjN44KQ=; b=vsZjOnuiyICaZzdgjRtZicN039oef21/tCAl9RDmcEVnWqVNmn4wPqP1eTBxJKkL6v S6iCe0Yat51TT7OYEazUeOgK6zt76gdbBM5dg6Zs1pmJToE65YqfNPNYDsjCmjaj6fmq a8/JMKekAcS0r75RjpyXB8waSLvl5HCt7cFXWIKR6iSpIRLK0O8h9H1ikIbBirYziGpU Rvys9OOsB9SkcN6/SqXTWk6KanGb73Idh95U8B+gf0EtyZorGwdk19Qj5qSCZe8vrQvE UmY0ay1fuuXpSMuDTrYRWv71xGeFLe5imzC9Glu9ZL9DBDX0dmsLWhgI9YKhOjJRJ/nI AIzg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=FhlcyKtt; 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 t21-20020a05622a01d500b00417b2074a0esi2523268qtw.457.2023.10.20.22.34.28 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 20 Oct 2023 22:34:28 -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=FhlcyKtt; 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 1qu4bM-0007Mf-4b; Sat, 21 Oct 2023 01:32: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 1qu4bA-0007Fk-Tt for qemu-devel@nongnu.org; Sat, 21 Oct 2023 01:32:32 -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 1qu4b9-0008Tf-2R for qemu-devel@nongnu.org; Sat, 21 Oct 2023 01:32:32 -0400 Received: by mail-oa1-x36.google.com with SMTP id 586e51a60fabf-1ea45b07c59so1144190fac.0 for ; Fri, 20 Oct 2023 22:32:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1697866349; x=1698471149; 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=2UcYIxKtjHYsj8AaxTVb8axIcBlRLqYqK/EKXSopODs=; b=FhlcyKttLB196DfwXQdJ9ii2YYsV9LXLhmVht4oNrIL8hxQX4MiCX3JR7f292Ku6Hu gE/X3qWzAG+fEo2GqTgDKS+bvV42KXMALT2DZmEG03l8T5v07C1ddbUjwhsHRbY/V+Q6 gbvPC29r8kGFcQh3tZNWu514tnUH+x+QKwwa8ENtJocqBl2YhD7XHw082RYivNblxPj9 WG+2FT+DHEMQl61nVTrIIIl5LX1xw6o8ZiLeyZ9xtONabVS5cbpyfmWCGOtRbveUL5xU 4OYx2Gu89jVzYqMtyHUZ9NRZ6xIICftXmYRjqPTcUr7aqKuxq55Zlske5bkk68s4g9+L dzPg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697866349; x=1698471149; 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=2UcYIxKtjHYsj8AaxTVb8axIcBlRLqYqK/EKXSopODs=; b=DZb2XsqjobjRXj2JwXFbvgd+oJ8q2mDF8KUNM6aWrdd9lPj71JZZrt4nSXlF0tj1GR 1W83OwdPrfcp5MW+YWipzhHHCPjInTvvN5woY9W1eLVM8XHCvIGLLOFJ/LVl8+GEArUf FqnIPP7kCOl364gxwpJEwPDHOT1ojqURYriWTyKawHQ4suftmlvA4iDTt/0i11TX+WpI TdGz2g7V3h01Q7vJWaU5EK7SsvfnFzJv5imEhRbF/BOYbZkuKx9eWMHzp7B3PDx7HDUM 0SgF6nNw0rNHUEzzJEX7F1cpx+WzS3O4vDon4Yd5qeG4SFeUD5BjEjPpPAcCWgrkZknN 1/Bg== X-Gm-Message-State: AOJu0YxP/6iIzigNnznbAAGy2PzTA3jR9JzliH2/eSG2J0xVR5q9l4j9 mERM67sZH3TbtClEp7Fkt9mxrvZyrb5nYz1FlnQ= X-Received: by 2002:a05:6871:a693:b0:1e9:9f9b:eb80 with SMTP id wh19-20020a056871a69300b001e99f9beb80mr4197030oab.46.1697866349293; Fri, 20 Oct 2023 22:32:29 -0700 (PDT) Received: from stoup.. ([71.212.149.95]) by smtp.gmail.com with ESMTPSA id f20-20020a056a001ad400b006b2677d3684sm2434831pfv.206.2023.10.20.22.32.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 20 Oct 2023 22:32:28 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: mark.cave-ayland@ilande.co.uk Subject: [PATCH v3 36/90] target/sparc: Move TADD, TSUB, MULS to decodetree Date: Fri, 20 Oct 2023 22:31:04 -0700 Message-Id: <20231021053158.278135-37-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231021053158.278135-1-richard.henderson@linaro.org> References: <20231021053158.278135-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 | 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 74bf3760e9..39099ae14b 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 e8d904d565..cb86afb825 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) { @@ -4232,6 +4242,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. */ @@ -4329,6 +4344,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; @@ -4756,36 +4777,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 Sat Oct 21 05:31: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: 736619 Delivered-To: patch@linaro.org Received: by 2002:adf:dd81:0:b0:32d:baff:b0ca with SMTP id x1csp632455wrl; Fri, 20 Oct 2023 22:35:10 -0700 (PDT) X-Google-Smtp-Source: AGHT+IG+hkALph8F+nyfi8/kEeleeBKgm2p0tjd4iZqyp/hHqgUTb/REUVxcnX5koNlWXUye7xfJ X-Received: by 2002:a05:622a:15cb:b0:418:bdf:f4b with SMTP id d11-20020a05622a15cb00b004180bdf0f4bmr4427439qty.6.1697866510186; Fri, 20 Oct 2023 22:35:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697866510; cv=none; d=google.com; s=arc-20160816; b=evOM66mf+1BQ78yo8HctARPTb1rNgFa6M9bjwusE5WFT8QhVlzNssbW+H+EUokpcbE JJTLarcD/0vZZxxHm1O3WVBZ4EjdcoZOzPMzznRAL/FmiCKLgyi+3fXx5bc7SXmJggBM CdfwrebJqJ3PeTwEEirBwo+2uWJBS7sPknpcAisMUn09sihCunFVoAu8hsfwKNK8hEiV tnVzQLQZdux2mr7OIawnav8+VV10K79KjDC9oT7qIFCVlXdZaNz8KIDrkjs/LZZfD9Oy u9SL8t+S+OXWSkeOuM48BMiXY8rbNnS7vF6aIhgjX8XRABLmPnXbewKjjaCqVCKp8zcO JSxQ== 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=wslfR0GqF3cOjpIHepb2ompyfjkVYc9/hjo7Upyjkh4=; fh=TYrED6TOMxGX0VC4GtjviASLbYyJe19+7/tKWjN44KQ=; b=1E/g+1WfPspeFM9jiWqK0jtDtnPvpVerjAWPoZUN+fSWrjvp6LmkOMghS0kU4MMlek L4XO3w58B01Us1/sScCYQcopcK+Gu9yaewY5KxUsujBYfDjTddHtgBLV34d6YF5nEQlM iXN9BNUPzyc+/GEdrER7obD5VAU3QaKKF/FCTLuabKbvCBxRbu/ZEkhPG3iGyDDXqhlf QPYD3tVI5Punq0sIlLiKKCN6Swe3IfqhiZumdFVTfSXfmMVEdHTSPwPhI/b2oPSWBhNN rI69925f5MPaWssUysBfp32RexlRBe392VktpgzZlsjg2VgM3oK6v3NRe/bG1lKvsu/G AAqw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=h9OxAz1z; 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 fy24-20020a05622a5a1800b00418e6893fcasi2418485qtb.614.2023.10.20.22.35.10 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 20 Oct 2023 22:35: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=h9OxAz1z; 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 1qu4bN-0007NL-4r; Sat, 21 Oct 2023 01:32: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 1qu4bC-0007Gj-Rr for qemu-devel@nongnu.org; Sat, 21 Oct 2023 01:32:34 -0400 Received: from mail-ot1-x334.google.com ([2607:f8b0:4864:20::334]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qu4b9-0008Tt-Bv for qemu-devel@nongnu.org; Sat, 21 Oct 2023 01:32:34 -0400 Received: by mail-ot1-x334.google.com with SMTP id 46e09a7af769-6ce2cc39d12so1049997a34.1 for ; Fri, 20 Oct 2023 22:32:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1697866350; x=1698471150; 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=wslfR0GqF3cOjpIHepb2ompyfjkVYc9/hjo7Upyjkh4=; b=h9OxAz1zTmL7x4PksMcBB+QjFYLqw9HH9fEby+XAguFm1YGF8qCXzGsmvraP+RAQGx fcT9Yzwgf20ulolz6C80kJiJ57AwbyQvNOk9Uo0kU8iSgPTtoCsT1nqk3k81TdsCKIZR /eOS7o+l89cDt297YUDq3JeIU76dW5yXLJwxMAPvQBGPLQYbJ3SFqWMC+w8TTNnONQxj 1vPg1MlewWuBywwNGSgosgIsh1QU6F5iPUhmPiz0v7Ix9Hm1kL+TrbtfPtsu8WV/aiYE 4z+qh6FS9DqhRqOuZfM2pMiMZFo8jIenSMIjt9bv0uQVchdydX29Boidh69E/FUhFZYw H+KQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697866350; x=1698471150; 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=wslfR0GqF3cOjpIHepb2ompyfjkVYc9/hjo7Upyjkh4=; b=qzbwsbeHVz/7sEEL4Jn9PD+TBVK7CqzSNbgMCmgUpfVB7n8bPj0ExqBcJmG/3c1mof PWwPEQCKd7qTrGdUXFUuhh2i6WLZmdZO9UJS5AWsx8nwY/bGH5g0d3ztGpmS6PtjOAID h68t4RWpdZQkcHsnDFuNojnuP/YNwwkahy4/vzaczeYZ4sMQTiWbTJ0eY+0xLpFl7uWh qYLPddHRI4uj/8UPxH9amHCOfBW3Gopf0CTvfBPCGNU56EzWPC3pMWh7hlCB03q1+tIG cLL0+t5wMjrEQI4pxPn0VFkllbBWxj3plQn3/ezMas9PNEeYkrskIkuPf7uwEgjlQZl7 26Yw== X-Gm-Message-State: AOJu0YzL1+zxA5rgMek74q23ObZaBrME51kQiMPDv7qoI7Aye65FMrWk U+IHLwNAKd+kYZTrCVY0KkdNxJqv6jg2Tqxv/mQ= X-Received: by 2002:a05:6830:44a1:b0:6c4:d08c:6a2 with SMTP id r33-20020a05683044a100b006c4d08c06a2mr5489237otv.9.1697866350186; Fri, 20 Oct 2023 22:32:30 -0700 (PDT) Received: from stoup.. ([71.212.149.95]) by smtp.gmail.com with ESMTPSA id f20-20020a056a001ad400b006b2677d3684sm2434831pfv.206.2023.10.20.22.32.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 20 Oct 2023 22:32:29 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: mark.cave-ayland@ilande.co.uk Subject: [PATCH v3 37/90] target/sparc: Move SLL, SRL, SRA to decodetree Date: Fri, 20 Oct 2023 22:31:05 -0700 Message-Id: <20231021053158.278135-38-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231021053158.278135-1-richard.henderson@linaro.org> References: <20231021053158.278135-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::334; envelope-from=richard.henderson@linaro.org; helo=mail-ot1-x334.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 39099ae14b..c2a44e0130 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 cb86afb825..a8e40b4220 100644 --- a/target/sparc/translate.c +++ b/target/sparc/translate.c @@ -4350,6 +4350,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; @@ -4698,77 +4775,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; @@ -4781,42 +4787,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 Sat Oct 21 05:31: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: 736604 Delivered-To: patch@linaro.org Received: by 2002:adf:dd81:0:b0:32d:baff:b0ca with SMTP id x1csp631919wrl; Fri, 20 Oct 2023 22:33:01 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFxdLbyD0nvOf0IHHQqsMvoQpHpmNcDSqAXyg3uS/aGHS/gk+IS6GpgHw6/BTmdngoFjtxs X-Received: by 2002:a05:6214:501b:b0:66d:81bb:5234 with SMTP id jo27-20020a056214501b00b0066d81bb5234mr5871261qvb.11.1697866381319; Fri, 20 Oct 2023 22:33:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697866381; cv=none; d=google.com; s=arc-20160816; b=FADXRfUMFbpWpmNVJ2h9sGpILugBTKQXhT1N5JLeKbAt2sXSO6olPqTJFksd1D4eoi 3Jf4qvxUUal111qH2h7yT9BA/7a6LEEPUJIR+rGhDFVklqm5/KRLZeLPXuyNfLibtv0E H5zWC90AU3IXRpr9r1/H1Jw91JpSyEuiH0ABSpQ/O5mTDAbK2Ti+I0bmZWJdJ+FKqwpu 6NFTCELWwU8LfshSEdmxb+F5I2f5VNKGRlEM6Bg3GcuiVe8Dm8vsQradnrtPTczdin1o SlYhXJCsTvBw40VcHupav9WyygBDcOwE6XPl/JRAAHw+/e8Vgey4N7q8WLlI/WC8mIR5 qBSg== 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=ORY1MtfkCQ/FjAIJeZWLQDWTp62fZzv9t9iYddHpplM=; fh=TYrED6TOMxGX0VC4GtjviASLbYyJe19+7/tKWjN44KQ=; b=i2DRylGI2+LBaAYxVd1F/IiEpNHwD1MBtnCvCzwoYAYRazB0DYn3X8DaTRdV6QQ2pW m3einsnLTT+/8VcxSzlnpOI+mxsaGZzxiAx9yiYc2740cmxj6RKjx0us3Koa08YdmjTO YVKELLXT6f8Fa4F6UCu/HfHbiDpy19Sr9vOOsQ5Kf4w1Snks0aoKiTkFu3vNIHVLnhsC v8cCKml3pepzt/d5FGECRYWQCx2j6zQNOTocN74bYU6gJ61S/NMWLw8nLBWy4YLuPGGJ g7VyuZt8BROAySrpDDX/n1r8RgkN7QyPkWd9tmSDS8f+xRCDe1OMMXL9uBMYzpBJMO/G HiiA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=dozeJgnD; 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 v28-20020a05622a189c00b00419544d5883si2517122qtc.134.2023.10.20.22.33.01 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 20 Oct 2023 22:33: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=dozeJgnD; 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 1qu4bI-0007KI-W8; Sat, 21 Oct 2023 01:32:41 -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 1qu4bC-0007Gf-HQ for qemu-devel@nongnu.org; Sat, 21 Oct 2023 01:32:34 -0400 Received: from mail-pg1-x531.google.com ([2607:f8b0:4864:20::531]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qu4bA-0008UB-KA for qemu-devel@nongnu.org; Sat, 21 Oct 2023 01:32:34 -0400 Received: by mail-pg1-x531.google.com with SMTP id 41be03b00d2f7-577fff1cae6so1106814a12.1 for ; Fri, 20 Oct 2023 22:32:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1697866351; x=1698471151; 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=ORY1MtfkCQ/FjAIJeZWLQDWTp62fZzv9t9iYddHpplM=; b=dozeJgnDmDC7/SDCJ+ZWYZr9JNBHq904LXILDiFphJ3aFRNApInv/QkHklbv+Fc9rd wMlQTvNs6W7Butxe3v5zl/F6OcAGFybJOgpMmq9OB3Wi26CZ/QUnozPl8tFMGn2I9qif vxg8RXZjSxjtpHtPbetBcaIaRTYm0AX1MdRbaw1zBVq0NkD0X7YupLIbwQtRHhiJe1oS /PnCUdpm8hxPPFDaB6bJ0a3VGfkaUNQGn67TduPCXIptFUdTVakxzf2HefdCiUssBUUw kET8o/6OUpUwDUL2GVfXdAK9E3ku/QzDVuIybYUbo8o9dpP/t1SosUKPMSN9V1wzHM6m ge9w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697866351; x=1698471151; 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=ORY1MtfkCQ/FjAIJeZWLQDWTp62fZzv9t9iYddHpplM=; b=L1gQRnb1eFCozMBLwW86VLXDVvgxr1eV3Vi8T5EOXdSX9AvC5O01Fkgr9Cqmd8Opcb fk6miZiJJrDnN1+eTbLlFrKtw+xDMYYTCtJlPdVBiyazJVA2+CUcNWbxotz3KDA71rdK skxUUCtaQYNg67IIKVtaTBh2HpNFNyA3HNaNdu9gRzzEyDAA18sKCQzcsbOLTNCdAjlj bwlMa4+kPlewTGftVMbh8rjHWEQNwPkA0mx9yJB333bljaJpn9P7iEjQoZffICR8HY8n IyYjVWseh7WBkPWfAi1DJMudanEuFNRXraLOs73jLcL6v59IwV9VFwEhJRYrIMpMxWOz DxVQ== X-Gm-Message-State: AOJu0Yw4wxVRv8ScyPdcdfsZZY+q64iFmSidhAg+dVqhRwO8/0SM0tyT iYi3tYcUdP6OVVOZgPyx7Xcjj71rZ9I0b3sWkfA= X-Received: by 2002:a05:6a21:a595:b0:155:1710:664a with SMTP id gd21-20020a056a21a59500b001551710664amr5248970pzc.18.1697866351017; Fri, 20 Oct 2023 22:32:31 -0700 (PDT) Received: from stoup.. ([71.212.149.95]) by smtp.gmail.com with ESMTPSA id f20-20020a056a001ad400b006b2677d3684sm2434831pfv.206.2023.10.20.22.32.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 20 Oct 2023 22:32:30 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: mark.cave-ayland@ilande.co.uk Subject: [PATCH v3 38/90] target/sparc: Move MOVcc, MOVR to decodetree Date: Fri, 20 Oct 2023 22:31:06 -0700 Message-Id: <20231021053158.278135-39-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231021053158.278135-1-richard.henderson@linaro.org> References: <20231021053158.278135-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::531; envelope-from=richard.henderson@linaro.org; helo=mail-pg1-x531.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 c2a44e0130..8f4881a776 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 a8e40b4220..feeaebae93 100644 --- a/target/sparc/translate.c +++ b/target/sparc/translate.c @@ -4427,6 +4427,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; @@ -4799,66 +4857,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 Sat Oct 21 05:31: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: 736641 Delivered-To: patch@linaro.org Received: by 2002:adf:dd81:0:b0:32d:baff:b0ca with SMTP id x1csp633690wrl; Fri, 20 Oct 2023 22:41:13 -0700 (PDT) X-Google-Smtp-Source: AGHT+IF4BPnec0vOMj+mwf6aIjpIJakvjFQsR4rWq32lA1NCVohJMbNH89yKrQQdgHet9+JpvQrv X-Received: by 2002:a05:622a:44f:b0:3f8:71aa:f11d with SMTP id o15-20020a05622a044f00b003f871aaf11dmr4142757qtx.37.1697866872937; Fri, 20 Oct 2023 22:41:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697866872; cv=none; d=google.com; s=arc-20160816; b=lzxpJMHLBhWnSgrSFsj7Rz7noLsviZYl9rdsyFga0iXrBy3M648h4Xg/3MHgL0aVz6 ZDlq0Mti8hZuk4FlJJ0IJDz/oiFakCSjKVoE5gYcffEQSX1/W/4c2l9SnX3KlUBG5jER vj0V5OvJ7bpHS83YzgDr7yQR+xV+eQCaNe57FnphFD3jEHWcPx0lTAMaZ+mHY3elZwRj nvtlrUDx/DFbs+zrcRqhHCUdEXiJekPdd16gnEdVdacSHThcAD8esN/eUWz55PGweFs6 eNxcUYXtZJLWByGh1PyfjzVhQuRwykJPMULHdyf/pjmxnQF6Iiob6eJIj6A1bKS9Md5N Ylyg== 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=XnJgyiV19sDiLGIzPT4ho6uw+aKTIF7hpKly+eWnlQw=; fh=TYrED6TOMxGX0VC4GtjviASLbYyJe19+7/tKWjN44KQ=; b=MlYhtlAyJ0mSXPFauXXrcEOvc4gD4+SIUEfNt3PEmeS98AXTyw5sDeY45pN3oHTOhr uNpDLDGSX7bDIVrk2mEFLYyHTNXwvAqnX81a3e3+vJzCjy6efvjIPzl8BTvwRwk42Sg8 GK2MR6DlidGo2wFSczXiWRjLuNrE1F3qLh089GAWymP479nFkzqqUMrFb6zYj/Hp3UQ0 4f7CTK0DLNhP785xmcNWlVVcyK3gIVW0fjY85N/yLGDJyfj01xOaO8yI8L97jJmdL5jW FFWRx9hLdfqybVbiwkFpSdbtHz1OvdPAlMZs24myOWe1Ahouvqa7amdWSrD561xPaW8I UFpQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=HeG+LSCp; 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 k9-20020a05622a03c900b00417fd10f758si2383291qtx.448.2023.10.20.22.41.12 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 20 Oct 2023 22:41: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=HeG+LSCp; 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 1qu4bN-0007NX-4v; Sat, 21 Oct 2023 01:32: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 1qu4bE-0007I6-9o for qemu-devel@nongnu.org; Sat, 21 Oct 2023 01:32:37 -0400 Received: from mail-ot1-x329.google.com ([2607:f8b0:4864:20::329]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qu4bC-0008UE-B0 for qemu-devel@nongnu.org; Sat, 21 Oct 2023 01:32:35 -0400 Received: by mail-ot1-x329.google.com with SMTP id 46e09a7af769-6ce2b6b3cb6so989873a34.3 for ; Fri, 20 Oct 2023 22:32:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1697866352; x=1698471152; 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=XnJgyiV19sDiLGIzPT4ho6uw+aKTIF7hpKly+eWnlQw=; b=HeG+LSCpCoyEieL6DlpU1Z1U91I/SeF3Cso1Ma5H5hc+6M0kATL5lgd1wAO+i36bHo BUdFIlnknGymKqWLMfIYNSEdngtIl5UsSnr7/Hsi/bt+xmwd482SiCUx+gbO5qNXuDW7 jGABSYCzPEUJwERha3u0t6nQSaeH3X/XSmsdnFGkvz5BIjSpk16+u0nBuDJ6qmTifv1v SoZBUE5Ubf0kx0LkywS9P8w3gOBxJgi8/UFiSsHjyrz6riJJuQz/DWUzW4pVJdJuNaBn HNnQ65AsKq1bcZwRim2seJYOATV2s3QEhgkT0s/gkRLSot7trPGhSsCKNrkrUQr1yd3f WG+Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697866352; x=1698471152; 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=XnJgyiV19sDiLGIzPT4ho6uw+aKTIF7hpKly+eWnlQw=; b=C8cHeVLABtuLqQF5iRuNKfVlMop6xuMovOPvriYAsWuVDHWOrPLmwC6biPgMKjkLcg 29YBsZjM7gSK/Kp9rsXf8xjz+YME5vXP1WTwqDYRq3q/Ai2q8q6o5pYdbyGOb3SDztSh x/ybeYDZIeBFLO0x2+8TWObRS2Qods4mSFSSmXxZuZ8SnJlVJn+UaTk4dAHOFxi5s1LX hfwddZayi1r4/f4n7xAew+NqpN2oBDtwkEPiF08XIrgePp6iXKY57OPsB47PplVaNMda lFgRxrdNZ78vTyHkFb2YhBRSgwJt9KQpv2aUoyOPymO8h8YGQRPDrg63aSeA/I819bys FM/A== X-Gm-Message-State: AOJu0Yzl/0mgESglxUuwJ7kPA5wbSXIJo4/SyWXglXMvXBd6Sp5YCeWf opDnRrWEiuOm3gjxIy4vbqujCBWTOOcuZ4yojlE= X-Received: by 2002:a05:6830:2693:b0:6b9:14bf:7097 with SMTP id l19-20020a056830269300b006b914bf7097mr4365873otu.9.1697866351812; Fri, 20 Oct 2023 22:32:31 -0700 (PDT) Received: from stoup.. ([71.212.149.95]) by smtp.gmail.com with ESMTPSA id f20-20020a056a001ad400b006b2677d3684sm2434831pfv.206.2023.10.20.22.32.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 20 Oct 2023 22:32:31 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: mark.cave-ayland@ilande.co.uk Subject: [PATCH v3 39/90] target/sparc: Move POPC to decodetree Date: Fri, 20 Oct 2023 22:31:07 -0700 Message-Id: <20231021053158.278135-40-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231021053158.278135-1-richard.henderson@linaro.org> References: <20231021053158.278135-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::329; envelope-from=richard.henderson@linaro.org; helo=mail-ot1-x329.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 8f4881a776..667067822f 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 feeaebae93..7fd19ff5ee 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) { @@ -4247,6 +4239,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. */ @@ -4834,40 +4829,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 Sat Oct 21 05:31: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: 736624 Delivered-To: patch@linaro.org Received: by 2002:adf:dd81:0:b0:32d:baff:b0ca with SMTP id x1csp633146wrl; Fri, 20 Oct 2023 22:38:22 -0700 (PDT) X-Google-Smtp-Source: AGHT+IF/XFlg5Ij11+E2a1dgOTLqkfvnfz9ZDI2lvlCvWoXeQr4xD8lNH7phtprHDkFaiNJj3UhB X-Received: by 2002:a05:6214:e6c:b0:66d:9d6:633a with SMTP id jz12-20020a0562140e6c00b0066d09d6633amr3902473qvb.33.1697866702020; Fri, 20 Oct 2023 22:38:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697866702; cv=none; d=google.com; s=arc-20160816; b=Ae2I3KdpXQ/KsFam/nLE817QAb+oiP3Gz/oNbcQQOiTS525e0GuCLei+xDTWGJ2WJj irH9UWY/sUv47DlnKIanItWMCBzWbJIFwaaHPVqXOHRrrnOCkjZpNMbWyk/cSvUGQQuV K30n+KunqZjI9pAomixE2yeaYTwLpAIJd5hUGI2Y8LJAZPnIgytugQDnx1TX8s9kAMli iGBUFFze4DkA3kLQFTPUmTNcd1E9rxInObWWdZFq9tnHJ7SKV2AbV9XqLOhbrMZI/iy7 JuTVSTejwfEh8PNmV3PCrCdq9gEK72KCOXiZdfOciJHSEXYgrZRkUXDVs9++vQi1BPTG WQVQ== 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=hPSGcQVowKCmfcGp+EPHz4OvzjcKg1TIvpNZBqc/ZJU=; fh=TYrED6TOMxGX0VC4GtjviASLbYyJe19+7/tKWjN44KQ=; b=t0CGQqM/5f63xFv+UgNEV68kLFz/V9q995yucfi0V8KC76PKQTzCtGWEXJPqTbf85S Ij9KP/MC4FFNL7bINtzTUjL6h3lwvhFLOLbrUJY7/cRtENB8XGTFajSEbRiWp+T6OodR CyJv/N1Rr7AqW3oGyKBCk7fEVHXj68Z6mmoqhEImXiqq1SJ2wb0Evlp3Ay1zE6ZczRbH E/HBYrUjQCssw1s35P+OjVypagSyG9baMzmLEv0fRfKmK+tDrYV5fVcaUwl3ZR4oU4Vb Eimiwnnid11quThf6fS8R1OPrS1uKis3h7QomS5XDdWacAhgguoWUx63GxSKJXDMVAom 3q6Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=y1Oj3qkt; 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 vu2-20020a05620a560200b00773fa79ce55si2268059qkn.483.2023.10.20.22.38.21 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 20 Oct 2023 22:38:22 -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=y1Oj3qkt; 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 1qu4eC-0002BB-9A; Sat, 21 Oct 2023 01:35:40 -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 1qu4e8-0001xh-EP for qemu-devel@nongnu.org; Sat, 21 Oct 2023 01:35:36 -0400 Received: from mail-qk1-x736.google.com ([2607:f8b0:4864:20::736]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qu4e6-00014d-2x for qemu-devel@nongnu.org; Sat, 21 Oct 2023 01:35:35 -0400 Received: by mail-qk1-x736.google.com with SMTP id af79cd13be357-77784edc2edso93008185a.1 for ; Fri, 20 Oct 2023 22:35:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1697866533; x=1698471333; 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=hPSGcQVowKCmfcGp+EPHz4OvzjcKg1TIvpNZBqc/ZJU=; b=y1Oj3qkty5+euVIvHeBeTjfr0Ih7vWP84baccF/zt42A0b4SesL0BS2LuM/7NHqYIZ BEl9kn5SGuKtDUngvgwzLby9+kFfBhMyv9/CqUS4KtZ69kcU9d9TCgddyJTeTWb47aBz ZpAO5/oen1HLdRyLe6UWhwJPyh3zpAWvguosm3BduQLvE3yPBzPvZhi10CiWPkwbNhNT bcmESslLJ8MSQ+SNWzPEXmVJoBm9jwZUEEHtW23HcqNrleNUOtJuyOEat54uEygIGsWO 6IS39WaNNZmX3weKZd7JjD+PCH/Ztxc+3orLwsU2LfSHcnRf9G++hbzbaQuEFombh76U eaYA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697866533; x=1698471333; 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=hPSGcQVowKCmfcGp+EPHz4OvzjcKg1TIvpNZBqc/ZJU=; b=vgg5PJDMpyti4RJLUiBRv3iXuVNcZpko42WEri67SDkagHgTMnmz7NoqJQGFKM9nSy 5JlWxvm/QKbGBOE0uvJ7wcB8JxO28I5sBpz+fyh8Wdp1hkaC59xk9/6bn2f9+tiYhS7z qC27Zzn884nejv9it2PDe8zPQgKIt7c5tY9TdkO/pC8UCaj1ngu2pTqNjfzaGpAXFQCC 5G6fwww3Wvuy/c/OINpAoYvozNVH6x6SAv7swMybOJgWA8xYJarmxuNO8dzZotPvIMRv oEcATZiCS8Ejr+7a5GV2UD//Bp+4zmmIqmdRozGjZV67eBNztteok3vsuqIPtVjnAzwY Dp4A== X-Gm-Message-State: AOJu0Yxz8+8AyDbWK8nFlv0qRnFFYz8jhcDhOhhD1MZP5bXfQ/ZbgypG tDW0B8j+sseRfgHuKlyIjbcJR6fs3wpveoz4POI= X-Received: by 2002:a05:620a:4047:b0:76f:135d:ce08 with SMTP id i7-20020a05620a404700b0076f135dce08mr4083390qko.57.1697866533005; Fri, 20 Oct 2023 22:35:33 -0700 (PDT) Received: from stoup.. ([71.212.149.95]) by smtp.gmail.com with ESMTPSA id h1-20020a62b401000000b00690d255b5a1sm2427978pfn.217.2023.10.20.22.35.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 20 Oct 2023 22:35:32 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: mark.cave-ayland@ilande.co.uk Subject: [PATCH v3 40/90] target/sparc: Convert remaining v8 coproc insns to decodetree Date: Fri, 20 Oct 2023 22:31:08 -0700 Message-Id: <20231021053158.278135-41-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231021053158.278135-1-richard.henderson@linaro.org> References: <20231021053158.278135-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::736; envelope-from=richard.henderson@linaro.org; helo=mail-qk1-x736.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 667067822f..1303df92a7 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 7fd19ff5ee..edd9211572 100644 --- a/target/sparc/translate.c +++ b/target/sparc/translate.c @@ -4830,8 +4830,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); @@ -5271,14 +5272,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); @@ -5494,13 +5492,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 */ @@ -5761,12 +5752,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 */ @@ -5806,11 +5791,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 Sat Oct 21 05:31: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: 736631 Delivered-To: patch@linaro.org Received: by 2002:adf:dd81:0:b0:32d:baff:b0ca with SMTP id x1csp633545wrl; Fri, 20 Oct 2023 22:40:24 -0700 (PDT) X-Google-Smtp-Source: AGHT+IG/uzWUXRO76bhnE5LSDjew+f8YL+qq7Pm6rLf35OSGNLWW7+3M88SDZlIscG63oCDjIVUp X-Received: by 2002:a05:6214:2629:b0:658:708c:4d56 with SMTP id gv9-20020a056214262900b00658708c4d56mr5873638qvb.17.1697866824030; Fri, 20 Oct 2023 22:40:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697866824; cv=none; d=google.com; s=arc-20160816; b=ePVADlEvXOcQSGctaatieMXLpyeeFYQYeCZ5LcQQlVhVC3T+Nc0Wa+CX/sVuat5AWe ddYs9qyjGHd95y+s7gJ09kHPqjFMVnpl8gcm0LfnVLRikjCbLyGNRd+g0+WOCOEXzVVx qhkrGxbM79jCn1FVu0ZYQMJ9qA33sMLNl/3/HDM0GsIvEjSBWetTbm0KF2brvYnQVNm4 1dPpSYK5BIbAjeCJC9AsJNF40GWbX5QGwq1UmcWVIwnpj8G9mfOomTYSVjA5v87Syary aOuGvMSHMCTjuJqdEBIPMnOGhiSOqu8VBuLT+x0G+P0Jh+Z7giYdhvl7gERiGIfZ2OHz KmPw== 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=5oloSKqPa4uKUpAROBAkURcXE2SWvCw2Bc9j/aFyVWY=; fh=TYrED6TOMxGX0VC4GtjviASLbYyJe19+7/tKWjN44KQ=; b=biLL1a5egETsczB7ylFaEQ/Kcn3eRC5wDn5J4kTW4Pjaa2TYyv6l2QH/GPA3/PZ5Wj KnWRxVL8X4BvNKV/KmX60xpeDyX42LNeLgO7uRCP8F3WJy6Yj5ZVX3ZSmc+jLcWkQzV2 HVn3xSJ0Lg5XrMvNQVvAIJC/l98K/MjiZjYQJdEsCEpZXzgXbpVIZDRNEZbexH2l8uT/ yMBEXBDFw2A1kJ+Y4wNLWZcJrjYCgcjwCidqqpTwIIjEaWLdhJlPZXUam0v84Ph+SnHw a8L5Z/Pfu8ptFM101w+uVxauS8cWfl8TJUOFTyOcvb78eyUo20UQcYrA0RJV3o5RlOgs 0C9A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=ONec+FU2; 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 s6-20020ad45246000000b00658963f9a37si2547586qvq.270.2023.10.20.22.40.23 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 20 Oct 2023 22:40:24 -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=ONec+FU2; 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 1qu4eF-0002UM-JT; Sat, 21 Oct 2023 01:35: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 1qu4eA-0002Ac-O4 for qemu-devel@nongnu.org; Sat, 21 Oct 2023 01:35:39 -0400 Received: from mail-oi1-x236.google.com ([2607:f8b0:4864:20::236]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qu4e7-00014j-II for qemu-devel@nongnu.org; Sat, 21 Oct 2023 01:35:37 -0400 Received: by mail-oi1-x236.google.com with SMTP id 5614622812f47-3b3e13fc1f7so1103950b6e.0 for ; Fri, 20 Oct 2023 22:35:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1697866534; x=1698471334; 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=5oloSKqPa4uKUpAROBAkURcXE2SWvCw2Bc9j/aFyVWY=; b=ONec+FU2SST0ob7+s0Ow4WH9xAXTpqZAggIzhCS1FfjrSxd9r4t4ioNcZCKHXPaNMP Vy5uhdFyhNBPgVUxjyTQ/kB8btRBeizNgkw/dKohDVqavnJjPWbJNaFbCA3zMVAv4QY6 TsJxFlEJiI7/cdRyF/EMi2cF+NN3ucr6wF+eCJku/OCKgx4gj8VWuM9aqZhGG1INwxFz SHrFMS+NjwGr+yUp3UcIoj2t4JhsLua9U3SZcANCiamaACYXW1XlS4p1v8bWY8XEmyax rUP0kPHU99vLh9vlV5GRw6QZjAIr+yjFHrCEncY//x+ulD4dr1UpLM9Oajhn++AHUZmL M7KQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697866534; x=1698471334; 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=5oloSKqPa4uKUpAROBAkURcXE2SWvCw2Bc9j/aFyVWY=; b=oTFpblgjd3DG6uBKwT6jfqhRw4SrygbDb2GIsg7S5Ar12idi/KXsaHFdQfUQixKsYH kVyq2wW7ACjWYlcOkIOFuKO4VWJT486jsh765diigNRhpqFpHXEf8K/Jzyfr2IlPPO7P Xa65JPlIvEedEnx1a4eiMnHHQPTF4jbB+ES9Nh0K9p9MzxnojcMFiSx4AmBkhv14um8l XYosfVtNZxE9tePyrc/tKcmBByJgKGci6nTHuHjcVjrMHnNKS4Dyxpod08+ncK/l+C3R Y22V7lnzjNn4nPE61rbiQTA9YUY6HdhkXcvs0Am2EBhDuQMcV6QY5yEIKjZy3Pb6tqvl 16ng== X-Gm-Message-State: AOJu0YzdnCrAMwzkxM9O4A3bzwyF2XSW5ThM8Rm4I9s7R8cpn1UsHMPj VHHK+Jy5lamQvNnrJ3qROG7RUzZgrFdzPytQveU= X-Received: by 2002:aca:2410:0:b0:3ad:ffa4:e003 with SMTP id n16-20020aca2410000000b003adffa4e003mr3604087oic.33.1697866533730; Fri, 20 Oct 2023 22:35:33 -0700 (PDT) Received: from stoup.. ([71.212.149.95]) by smtp.gmail.com with ESMTPSA id h1-20020a62b401000000b00690d255b5a1sm2427978pfn.217.2023.10.20.22.35.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 20 Oct 2023 22:35:33 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: mark.cave-ayland@ilande.co.uk Subject: [PATCH v3 41/90] target/sparc: Move JMPL, RETT, RETURN to decodetree Date: Fri, 20 Oct 2023 22:31:09 -0700 Message-Id: <20231021053158.278135-42-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231021053158.278135-1-richard.henderson@linaro.org> References: <20231021053158.278135-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::236; envelope-from=richard.henderson@linaro.org; helo=mail-oi1-x236.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 1303df92a7..c2bf5f78e3 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 edd9211572..51c267f019 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() @@ -4480,6 +4481,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; @@ -5277,30 +5357,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(); @@ -5318,28 +5374,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 Sat Oct 21 05:31: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: 736627 Delivered-To: patch@linaro.org Received: by 2002:adf:dd81:0:b0:32d:baff:b0ca with SMTP id x1csp633270wrl; Fri, 20 Oct 2023 22:38:55 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGFSmOen54ZUn24iFa6G4uDHxVCu57ziIg4zarjR+3ALX2IF51yC0+bOqWOBAPBPYB1miUM X-Received: by 2002:a05:6214:23c9:b0:66d:2064:c7ee with SMTP id hr9-20020a05621423c900b0066d2064c7eemr4816040qvb.20.1697866735383; Fri, 20 Oct 2023 22:38:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697866735; cv=none; d=google.com; s=arc-20160816; b=zvcMEKZibL1EMS0JOd2dN8ljDDOIVBJL5NsvnA9QMlWnUrokx1DXpYY9Tb2QaLCgxw IsFDKVExX6p1kTRSWP6iWjHai90UevZgePE6/JCnVjJo2CF/8qZymzsVxvFIIrgS/aho hl9n+tnQSuTWGwkExLWVBeUv/ypddlX/yq4WbLG3TntGhlqPAjybyjslKmmnf5vNCXTq IYQJXBk7l8dilg8Uv1abPimZYt20pRuX8Me25zi/49cfgCsKda6UShBpNdystLJ2zxlM j62PCAbKzcpEEoQWW2wsGLUuRxdYTw5n6zuBrjzfgb9tYSSHs6R0Fv2/ucONmMZkBkB6 /mKA== 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=hlXxtBQuyDJO+Ok229Ry7qRy9usRtj5AVUqWicQKQlE=; fh=TYrED6TOMxGX0VC4GtjviASLbYyJe19+7/tKWjN44KQ=; b=Iaj6ccpz+fT1Kyx8TwUOKSCgsz3I+DXvfadASHyqS0TOVmW92Vp6Gobczeo1sQhbpt Tj9CVmlXVIY0KwSYsPuk4l37cIzjkC5InEhV0BS0P2Ei4uXgbz9S9by8i16chRWkuwJ1 lIGMZSy2JR5DiHkFfZCPhoXE8Qc5ZbN5t3nKvYQSrp3/k2yr3KLN918gmIX66uygdFOC r4N5yoUoj8wv7iXYz/iL4xhkJ714gSrngdnyJrs/x2TS4nJnyYn3VoC4lpU5NTHGwu8I QB8AO0ueQLlW9ywgT/D2+uvfuA1g7094Vi7qSErffba1ToSC611Ul3a6giZjOCLLlUfb HJ2Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=fb8vpmIq; 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 cp18-20020ad44af2000000b0066d145b6646si2423198qvb.102.2023.10.20.22.38.55 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 20 Oct 2023 22:38: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=fb8vpmIq; 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 1qu4eE-0002SP-TW; Sat, 21 Oct 2023 01:35: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 1qu4eA-0002AW-OH for qemu-devel@nongnu.org; Sat, 21 Oct 2023 01:35:40 -0400 Received: from mail-ot1-x330.google.com ([2607:f8b0:4864:20::330]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qu4e8-00014n-4s for qemu-devel@nongnu.org; Sat, 21 Oct 2023 01:35:37 -0400 Received: by mail-ot1-x330.google.com with SMTP id 46e09a7af769-6c7b3adbeb6so1080977a34.0 for ; Fri, 20 Oct 2023 22:35:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1697866534; x=1698471334; 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=hlXxtBQuyDJO+Ok229Ry7qRy9usRtj5AVUqWicQKQlE=; b=fb8vpmIqvBJ5fMxK1FeXlHdhhBKutxAmT6g8L1KrEWjpjhAjiHWkG+6yhaZWtQxu5r g2x+EZQgLIUFiB4CJNPIoYoPGQp+WJMekLCEEGsxuyd5nplQUJywk0cQitfZsCDHh7H9 Qg/PlkNsYbcYN9HW7Zsav3p7W3WHRwqEZUcnaMx7Tmb5svjawTZS7npOz5r17/uQWoYt R3sVuTtHTq7m3WMdyAmzepRdeiOjtTOevCX3bYc0/0YYFa4NV64fZjvegFQXgo8rKe2E OvDzeNgFfcZro81cKTvmd623ZuudokLtlJs0P3QaHOtvX7R3RBye2P3kITSNQf3JPBjT p1bg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697866534; x=1698471334; 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=hlXxtBQuyDJO+Ok229Ry7qRy9usRtj5AVUqWicQKQlE=; b=n9c02wCoaoKEkF+nTXaUHsszB8g50zTGZr+T2nU/U6xqxkV9hiqGdYJPqbWIbIgOP2 pvu74uJuKSeWrJgrHoLbNsIK7DqAeyXSmYY6it6KrKE601vFzrPOQF3mJU1MwOdMkMjn AORTze/9hPv7RJ29BHvnBlgkQKXIxEcOWBCLHRY3hCM4GYjsxFM/inwjFASscKFb2PFQ 5MVN2H0RfgOThG7qy/Rp9JxWCcMNdDLrUwqicHVWwXT3FH0Es/eJBbwDjeHdhoMSuO5t GqMERPXpc5V8OBqemwwDeWXd1Jo/Byrbjeoz4C05MQJZ71gSwPfHp52NpzssesEm+AHd DdAA== X-Gm-Message-State: AOJu0YyIvH/g0sHxnmbzKk1FdNZcIl+mdkXOHh/7ydZqFu9cjc0a1iXT 6wGisaZcZx0nhtqjcUsKr6cwcdxsOo1zdg4jG8M= X-Received: by 2002:a05:6830:2693:b0:6c4:9852:a498 with SMTP id l19-20020a056830269300b006c49852a498mr4613215otu.4.1697866534506; Fri, 20 Oct 2023 22:35:34 -0700 (PDT) Received: from stoup.. ([71.212.149.95]) by smtp.gmail.com with ESMTPSA id h1-20020a62b401000000b00690d255b5a1sm2427978pfn.217.2023.10.20.22.35.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 20 Oct 2023 22:35:34 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: mark.cave-ayland@ilande.co.uk Subject: [PATCH v3 42/90] target/sparc: Move FLUSH, SAVE, RESTORE to decodetree Date: Fri, 20 Oct 2023 22:31:10 -0700 Message-Id: <20231021053158.278135-43-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231021053158.278135-1-richard.henderson@linaro.org> References: <20231021053158.278135-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::330; envelope-from=richard.henderson@linaro.org; helo=mail-ot1-x330.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 c2bf5f78e3..629547326b 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 51c267f019..a3ac95fba2 100644 --- a/target/sparc/translate.c +++ b/target/sparc/translate.c @@ -4172,6 +4172,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) { /* @@ -4560,6 +4565,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; @@ -5375,18 +5398,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 Sat Oct 21 05:31: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: 736671 Delivered-To: patch@linaro.org Received: by 2002:adf:dd81:0:b0:32d:baff:b0ca with SMTP id x1csp634913wrl; Fri, 20 Oct 2023 22:47:23 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGH3i+j08eZA6KvhnNTi+Pjuy1uZ0oT6LnPmzQ4JaLbXArwH24zCodCLUSe8q8AxkaFGtZq X-Received: by 2002:a05:620a:269b:b0:775:77a5:f20b with SMTP id c27-20020a05620a269b00b0077577a5f20bmr3770639qkp.59.1697867243119; Fri, 20 Oct 2023 22:47:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697867243; cv=none; d=google.com; s=arc-20160816; b=sqmo7rdPgwUefRJDu5KZzZGx8RHgRXRnW+UHJwsG6uOsLJvcmRhJNA1LtUUpxttQAR XAkWmKvvr/PLsrh4JJo/fvbUIfSQqQEJRmNQGTtPyng+j0rTU0UIfaO/WGK1vgqz3x6E 6BmvAspposzc9YIJCRKPao8fnzxkAxQUMsBLdME4ZIM4g1397W92GBdyLiIVBbjL7QYN d6+Vw9qYf3kUkiEsmrICfDaG1R+F7W7V/r1ZcX8Nm3avZmCvQPO484brxLHdtS1w6Wjn rGZ7IVXzfhrg0CyMvZW2W67nQNB/I7Qjag8dN67G9qIh7cP2c/AxDI33dDTVFMLFfzMu 9new== 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=OUrjYU4NIaAG6pXgwHd63vF7dRkwDh1BGfEGIDP+tXI=; fh=TYrED6TOMxGX0VC4GtjviASLbYyJe19+7/tKWjN44KQ=; b=f93LiSMVA5Dyy5CdCsFwkEiP/Keh5hg1PnyRGX8Ef1WkmJwfPo802dA+/gSA2LY5Gc iVJRgbl1Zk1u2SpNbpLeFMx3310EoeWh5AurXLZ8zpEsZ7oXoZfVQF/jCNyqCWF1+W+S yvLzAHG+DcoOIgTz0dnlHIOtkvVDk10ixyZF+tFPRCrWf6iDf8pcf1oiqFE562FBDxu6 UTUE6iBlHYsoV3NkEY+wMU2Tqe2qy4oi/A3Jli1TZSrhs6enb3gdqwUe/dz62YtYY8/0 XgIaBLUEr9zceaDdZBtFdQAJc0aYyYbQiCCkyrwZwVRpEE/4cDUShydKoV+gZnVs7a56 uXkQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Grey5a8B; 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 l14-20020a05620a0c0e00b0076dbb867d4dsi2362511qki.372.2023.10.20.22.47.22 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 20 Oct 2023 22:47: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=Grey5a8B; 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 1qu4eR-0002uE-0v; Sat, 21 Oct 2023 01:35: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 1qu4eC-0002Ci-DD for qemu-devel@nongnu.org; Sat, 21 Oct 2023 01:35:40 -0400 Received: from mail-oa1-x32.google.com ([2001:4860:4864:20::32]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qu4e8-000155-OM for qemu-devel@nongnu.org; Sat, 21 Oct 2023 01:35:40 -0400 Received: by mail-oa1-x32.google.com with SMTP id 586e51a60fabf-1e12f41e496so1131112fac.3 for ; Fri, 20 Oct 2023 22:35:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1697866535; x=1698471335; 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=OUrjYU4NIaAG6pXgwHd63vF7dRkwDh1BGfEGIDP+tXI=; b=Grey5a8BumEgb4aPKp+LCbK5zmL+/BxDjwkAcJz8aGoRA+n+Lq2OSw10XOZPNrrIp0 qqBqI3I6jEOWsfB2mIK1oAthkFN5RJwgYyI2fZGxu6xqpbxL1wRHp2yspapx1Ip/lM3j CIsjqeSx5kPWRjcUMk3k5SKPzhaZmZ0PRbv+A7NJKa7USt+CqHtxhBve8pZAuZN8D55G pQQyBn0N2lZWPosQXLFcavnfi2tQjn0J/LF1i5ZkkCPq9YMwDTpHkaroKe5Ju6dE8G8u tDpsxgPPp0pcxDgnuhi2EOk8ydVF7bhdarwBoT45D02kq5nhtu9Zyx8QZzvQv9LuppJH ZCTw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697866535; x=1698471335; 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=OUrjYU4NIaAG6pXgwHd63vF7dRkwDh1BGfEGIDP+tXI=; b=KhCgiLc2Wp0iGU4uxed3R4H8BvlftwgGxMz3r3EkQLFNMrPJwGfqdTgoMId+eIrusL 1BSAcXIGu5nBd/+8fe2L9G8AMPO7D6k0QQztSyuW4UQUfxgTYftZLjRQEi7yXBedqxyD YhEIQxEKcOPczuK6/DfEG6G3Pc2p3jt1oyYfmzMBX+BLx8QELOrHs4wpIQRdzwqonuPx 9qlMWflxKCNTmEkXmzeE/BnltXGLLZham6txycUX/hOKitLG36AJfvZm7nlGLSptwXyZ 5fEG4IiVLFetbZf+YI1CYGcgGoL1LM+iK3moFRNFIvFtN7vNjmYm9cpWcod9dHmk89k/ KSIg== X-Gm-Message-State: AOJu0YwYPzvx9TeF9GxfFMyK5JnOZsHmTeGWtsb4fVUEkC6PTFwt+Vlf Q3mezQXr1IPg1bCqZmfE8tCgg/P23as/2t0qAqw= X-Received: by 2002:a05:6870:530e:b0:1e9:e0f3:d716 with SMTP id j14-20020a056870530e00b001e9e0f3d716mr5378558oan.37.1697866535351; Fri, 20 Oct 2023 22:35:35 -0700 (PDT) Received: from stoup.. ([71.212.149.95]) by smtp.gmail.com with ESMTPSA id h1-20020a62b401000000b00690d255b5a1sm2427978pfn.217.2023.10.20.22.35.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 20 Oct 2023 22:35:34 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: mark.cave-ayland@ilande.co.uk Subject: [PATCH v3 43/90] target/sparc: Move DONE, RETRY to decodetree Date: Fri, 20 Oct 2023 22:31:11 -0700 Message-Id: <20231021053158.278135-44-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231021053158.278135-1-richard.henderson@linaro.org> References: <20231021053158.278135-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2001:4860:4864:20::32; envelope-from=richard.henderson@linaro.org; helo=mail-oa1-x32.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 629547326b..bbddae6ce0 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 a3ac95fba2..2e2df42c53 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 @@ -4583,6 +4585,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; @@ -4594,7 +4626,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; @@ -4609,9 +4642,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)) { @@ -4931,8 +4963,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 */ @@ -5374,65 +5404,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 */ @@ -5829,7 +5804,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 Sat Oct 21 05:31: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: 736654 Delivered-To: patch@linaro.org Received: by 2002:adf:dd81:0:b0:32d:baff:b0ca with SMTP id x1csp634284wrl; Fri, 20 Oct 2023 22:44:23 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFaeJgqdcJehwVTDU2DhkTBnoWrnEKI9quw2c8LJOv3Pej0D8ZXZ92DuDJuVY3br+dJL4vF X-Received: by 2002:ac8:58d1:0:b0:417:a469:1680 with SMTP id u17-20020ac858d1000000b00417a4691680mr4344120qta.38.1697867063426; Fri, 20 Oct 2023 22:44:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697867063; cv=none; d=google.com; s=arc-20160816; b=adIjSoA2D9aEcesASbQz/g8zD3hp5Xq2D8Edj9gEdIkju5eDxwj/ySSBJpcBASrM+8 tafm16diFv27jk/zl9WaGfODn30t4Dbiy6CGwR5QgOk1jXfRv2cHp3Ot3D9Abns3Wiae 0iUp3b8TonnWGgWmWmMcKZ1tepPUAf6c7ZJrq6Pl+yqQN8XD9IDYD4+iBzeapOFt6xyJ SyZspqT5yvPf2pvHdyalKKqhoonI6bXZR+FhQNWAt+eBHUUn2WDyyn6GBwStP8OOLTyO 1IUpxWdjsXjj0yWXdEjX/YJXHNA37ck+HqfRf+jFSD9vaWd7vAnbnVdAk7dVlfuxpKP0 GQ4w== 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=dqcfeNJ9wzGAGV7oxUL/7nZeKmkczdhN3f+SdC8Dc8c=; fh=TYrED6TOMxGX0VC4GtjviASLbYyJe19+7/tKWjN44KQ=; b=k7kcOlZwZMAvl+CvO7f7t51PgYDdZMt95nDpDeBKBhDK+EwgMb7z1RwZdogwWrEEqP tO0McLes8zIMJ1u4VntQO3JEgfPlU2gbZ7Iy9xDOwvBFS4sfo1Uk0NKo6DQ75K2tfl1A 4BAA+a/1Tmc5aPuxXzDpDqsgMyfgem/eWxFcfpfHNiE4EP8nY6LX2idY/sytynQMUxzq 5+R4PTIJRlravqz5u4xDE2eAzIHHpIbPtFiM5vf3k0DRcdJY1SYIYbBh0CsMs7YCrJUF LYiugd0tW36KlIM7OngWucq8wfRo70Rk97lYXrB/xEZjq96a2SdhTCgiYIqiHfkKeKMd c01g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=UTl6KukJ; 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-20020ac8574e000000b0041980065908si2463503qtx.506.2023.10.20.22.44.23 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 20 Oct 2023 22:44: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=UTl6KukJ; 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 1qu4eN-0002en-2J; Sat, 21 Oct 2023 01:35: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 1qu4eC-0002CQ-Bb for qemu-devel@nongnu.org; Sat, 21 Oct 2023 01:35:40 -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 1qu4e9-00015E-JQ for qemu-devel@nongnu.org; Sat, 21 Oct 2023 01:35:40 -0400 Received: by mail-oa1-x36.google.com with SMTP id 586e51a60fabf-1e0ee4e777bso1082436fac.3 for ; Fri, 20 Oct 2023 22:35:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1697866536; x=1698471336; 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=dqcfeNJ9wzGAGV7oxUL/7nZeKmkczdhN3f+SdC8Dc8c=; b=UTl6KukJjtirXIvslns2KHu/ThbgHTARIxrkpJT4vX2APojqQOzCT5+RIxUqrw0odF OZbxZ5Djz/uPyXE5jRTzlkrJIvyfL6/cnRYzZZUzgfbIOGb+w6JP5oqi9lmr/PrcrwTW VmC+5CdJCuYHLWP7Ev4GwdOLcOxPoSh9pGpdR7aCo++ZzvkJ/1AByvroC5HnHwskqXfV cgoDjXMx0N8DCnxg3+F2eY/ZKl1wNobqQcCknw1tDUJ3XV0MFMZhlcxv596HnJkuJoq8 GYmkz/aZ8TUSV+MyVVTaXafNLnemFBE5P7okvSjY7RMAQfvk+80vdDkGcdE9YzvjF+BY Ox0Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697866536; x=1698471336; 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=dqcfeNJ9wzGAGV7oxUL/7nZeKmkczdhN3f+SdC8Dc8c=; b=SLJywaQw1YAIJQtu71L9qo/fjRUWDTHa9JAgb+1pE3qpHMDk2vwyN0rCc1oftqq0x9 MHhCQoxPcUFKKfChCjwRoRXvQBtxgV0u7BbyZEJHwWhdu/PMBjGjD0YflhkpD5bLzakQ /ZQvis8Q4EV7gIO1FPwivxzBi8FFsVLGpMjVyJXk/Za9JuUZoiWSt5AM7gAR8IbJ+g+q 9yt611sjQPlsQ7gVbhMp5jNpHwIf4EMHnX7tfk8QIHJmPxgSdiIep4JX41pB5hDuURyF QSS4EeKnQ3pzEzlJtYBdY5Pxoj3zq6NC9GoKnc5s4cGsuDpwnEAEvxqUMMDBf+qbcehZ GzUg== X-Gm-Message-State: AOJu0YxqEu9KA82IOZ69xAkOE/8bDZX6hMIAMKWOVxuc6Vcg+0tuHaVo CMKRTzvpR4pi7UTj3FleX7o1V13ueLMP6Nxx2NE= X-Received: by 2002:a05:6870:888:b0:1bf:b863:b6d with SMTP id fx8-20020a056870088800b001bfb8630b6dmr4271513oab.1.1697866536154; Fri, 20 Oct 2023 22:35:36 -0700 (PDT) Received: from stoup.. ([71.212.149.95]) by smtp.gmail.com with ESMTPSA id h1-20020a62b401000000b00690d255b5a1sm2427978pfn.217.2023.10.20.22.35.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 20 Oct 2023 22:35:35 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: mark.cave-ayland@ilande.co.uk Subject: [PATCH v3 44/90] target/sparc: Split out resolve_asi Date: Fri, 20 Oct 2023 22:31:12 -0700 Message-Id: <20231021053158.278135-45-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231021053158.278135-1-richard.henderson@linaro.org> References: <20231021053158.278135-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/translate.c | 25 +++++++++++++++++++++---- 1 file changed, 21 insertions(+), 4 deletions(-) diff --git a/target/sparc/translate.c b/target/sparc/translate.c index 2e2df42c53..f71c70a897 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 Sat Oct 21 05:31: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: 736628 Delivered-To: patch@linaro.org Received: by 2002:adf:dd81:0:b0:32d:baff:b0ca with SMTP id x1csp633488wrl; Fri, 20 Oct 2023 22:40:06 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGh98UhYz7LxnDoGFTUTq05HflRoENm71wuLhb5cmSbjf9m2xQP42pISkFaIHIYAyi5LyAk X-Received: by 2002:a05:622a:1447:b0:417:fe21:b254 with SMTP id v7-20020a05622a144700b00417fe21b254mr8311528qtx.18.1697866805815; Fri, 20 Oct 2023 22:40:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697866805; cv=none; d=google.com; s=arc-20160816; b=rgbT9ifbzf1qX6V8HytqlA3QmZ5gXmZro968vzCMup83fV6mEhKG/buOaV9CC7Zeru rNmeOvIcORXJRHvNXHjXe78dV7uoazzip983kTBXM6WvXfwm10WpONfXINanV+6tDIlE kpZwcN3X+fipu8lTii0IlIyMUxRTh+L6CRiRhWAetLrMHcuLtbfzC+MOKs0tpMRZsLI8 HtXLSmnwgxof8nUXaRsz78ZXWNz2ZS0Cke4bnOE77CkHRCSjUpoBxhyr6c40iPmQrtoB fGy5huXJbPJPE3S2yxTiiwC+Irxg80Ol/8j/lGpxIeo5QEo3qN3Hl/CgHB941/Rm/Jkn NYWg== 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=DlBy9AJUnYDybp2M77FwFq/pHwaxmpAeSASwG/yFgSM=; fh=TYrED6TOMxGX0VC4GtjviASLbYyJe19+7/tKWjN44KQ=; b=UU0MPbMxnInE/bXQ7TzXNKKNRIiBR7qlwvDNYbD0rxowgd48tiFH4kYe/+4dbDLZNC 50YVQadWM3h+DNKexfrBrlqPEyquf3OAHUDji+Km6h5vM+9HseuJK00P9/269XSpRQwx LDAcCgC9r3OtZf8Ny4slPTvJHDH2GpP3Xiqqc50zWvQ6DwL0zWyV2RT8/z5uMtnt+Z9b mZa8rnRO0QeLbmoslGW6J8CM0qgaft7/Pd1WQcCcgqCHmZ00Mh3z3MWb3OWUYXFiubB/ ZJ3MYw42jSSBMN3Q9pyQ4Z7mtlBCNXoG8KmZuwS2DkCZCtRGkY2+bKQnH8UqCh0XhbaD 54kg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=sglDnuPx; 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 b2-20020a05622a020200b004181c32dccasi2300130qtx.265.2023.10.20.22.40.05 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 20 Oct 2023 22:40: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=sglDnuPx; 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 1qu4eP-0002oA-VP; Sat, 21 Oct 2023 01:35: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 1qu4eE-0002Pw-7A for qemu-devel@nongnu.org; Sat, 21 Oct 2023 01:35:42 -0400 Received: from mail-pg1-x52a.google.com ([2607:f8b0:4864:20::52a]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qu4eA-00015T-MF for qemu-devel@nongnu.org; Sat, 21 Oct 2023 01:35:40 -0400 Received: by mail-pg1-x52a.google.com with SMTP id 41be03b00d2f7-577fff1cae6so1107558a12.1 for ; Fri, 20 Oct 2023 22:35:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1697866537; x=1698471337; 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=DlBy9AJUnYDybp2M77FwFq/pHwaxmpAeSASwG/yFgSM=; b=sglDnuPxEyvvj1sNKVPk8uoqy6Eghc9wYqE5tzQzcp2R034wtFm3+xt/ewwmg81iRG gPEwP2RU6Z2O93T6//PF29gw6RZruoEywf4keVKDUJJ3qjKIWMju8iS41TzYQuBF9G0x SwMfD2NB9MVFMuoxbSO1fzoRhCHtAj6DklqAzPzcmCX+N1CoL6cw0nLoWnj7jYil5Bnr XLU3YeEtR74OSUZncidzBRJ71Lr/83er1UJthsIJzzq4u0LRhpanHI5uTEv15tPX/REs 0a+PJe9MI+z0V4iBeE481H4lM8ZoJKiWWWDa82ayVH3ngOqwXs9oJDHV8yM5V43ShkUF JhIg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697866537; x=1698471337; 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=DlBy9AJUnYDybp2M77FwFq/pHwaxmpAeSASwG/yFgSM=; b=blZaUap2bSG0g/SSoy7sl1nehLVUFALFtvVdKqmWZEy7SeimCvdU9xT+isSaLRl1pf M+nb6QSzknUCnv4AI4ZRddEuqbyyW17aTHB87Ith6JdUHp2DiUQf8L0dJFYgX8BA2sF2 9ZKRbIoNeVLGCzogp2jFn/pvcoh6luqlwJm5HQ+Eey0m7qetIdAlkfmMbJ31Q8sS75sD nDFkf7h/cSelA/09GiHdnL0zRHcpKWfb7itsti04Wlfi0hkkCNoM11b6BdJy4Res8/EM Pwb3tNMr8T055RvNsLBRi3zCPhq4VZwPv/Iu0lc+wPeF4zQrOozYzLB5q2k0fcAAmOy+ SWZQ== X-Gm-Message-State: AOJu0YxgsCGT+i4AH8oHEG/8rvGnxJk3DaOj80VSIbO1rN8gUwP5Q12p VLlUY+PXC5r7TCN4BwYXGcydopVTv7IuBtPjlMw= X-Received: by 2002:a05:6a20:144c:b0:159:e4ab:15ce with SMTP id a12-20020a056a20144c00b00159e4ab15cemr5210624pzi.15.1697866537169; Fri, 20 Oct 2023 22:35:37 -0700 (PDT) Received: from stoup.. ([71.212.149.95]) by smtp.gmail.com with ESMTPSA id h1-20020a62b401000000b00690d255b5a1sm2427978pfn.217.2023.10.20.22.35.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 20 Oct 2023 22:35:36 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: mark.cave-ayland@ilande.co.uk Subject: [PATCH v3 45/90] target/sparc: Drop ifdef around get_asi and friends Date: Fri, 20 Oct 2023 22:31:13 -0700 Message-Id: <20231021053158.278135-46-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231021053158.278135-1-richard.henderson@linaro.org> References: <20231021053158.278135-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::52a; envelope-from=richard.henderson@linaro.org; helo=mail-pg1-x52a.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 f71c70a897..23defa0a77 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 Sat Oct 21 05:31: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: 736633 Delivered-To: patch@linaro.org Received: by 2002:adf:dd81:0:b0:32d:baff:b0ca with SMTP id x1csp633638wrl; Fri, 20 Oct 2023 22:41:02 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEoXLV0d+MxH+I06kYG/kD69GeXLQTRES+A71BNW7OG99mhaiXfEoEQe8H463DCUmLH7GYM X-Received: by 2002:a05:620a:3d04:b0:777:72a1:efae with SMTP id tq4-20020a05620a3d0400b0077772a1efaemr3250571qkn.67.1697866862145; Fri, 20 Oct 2023 22:41:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697866862; cv=none; d=google.com; s=arc-20160816; b=zN+4W3JPIXNNDK4A5iadlL24BwbnbEXREeEItZk+CzczCJbbndgHOn/1Dk0cKJUBrN zEh1ErEnclpHlQBOCKdJwglO7xVnA/XUVY70ZoeGvbSlSErzGo4RKPyx1dk0QRv69j6+ eElcIb/CD63I9JVBTWiPoYvk3jyYUB/NyXUqCY/bZRcGCX6nsLhkoYBAiGBiQmwIcYwR FeKIDTZyZWylDwcAeoJJICqMK6rtl04nkmIbI9j92SwlYk5pMOi9vg9QnAnB941i7wfX mkqMG3SxDPTYzCVdjFXGdfi2RiZsQcxd/WesNAJB6EBhcGL1HoRJlPG8BBR6dzQgfBJP +1CA== 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=nXY7V3h9raI68oJ0bwO74lPlv1+miZkxPjaYiDiOh6s=; fh=TYrED6TOMxGX0VC4GtjviASLbYyJe19+7/tKWjN44KQ=; b=pcRCKE0pu1gEdlNNYrFIjS5+7k493ozeqwdh+xXmuxc3s9jpTRT9drmlz/8p4JrfkT hC8+GppqmnXmwSzFE82AjbjW3/9tIUtTJvvnJFXwXsywWUlj/3ErG5n4A7mHmtkuVYnU oYtCLPPuKU49iscSFvjlWWVGbH/bItErA4ndPbOWkxLH1Kt4K5UEuKhpatcZyyu83LvZ CNnsjAymyyLh23z1DSkZxkmmg0HimWGcrYsUEu7iuM9CHImkM4XOmx7ucO4fCBiWutao 1O0ilTgzWKuCFFWTUkcUApPcHUraYVKa7blQA+Io0cEQqhHpdgbK2npTyXtSrHRn4K7C SfTw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=c9VpH5nP; 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 x5-20020a05620a098500b00775a3ea8651si2213117qkx.167.2023.10.20.22.41.01 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 20 Oct 2023 22:41: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=c9VpH5nP; 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 1qu4eQ-0002pX-7N; Sat, 21 Oct 2023 01:35: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 1qu4eE-0002S9-Ij for qemu-devel@nongnu.org; Sat, 21 Oct 2023 01:35:42 -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 1qu4eC-00015k-2i for qemu-devel@nongnu.org; Sat, 21 Oct 2023 01:35:42 -0400 Received: by mail-pg1-x529.google.com with SMTP id 41be03b00d2f7-5a9bf4fbd3fso1094274a12.1 for ; Fri, 20 Oct 2023 22:35:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1697866538; x=1698471338; 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=nXY7V3h9raI68oJ0bwO74lPlv1+miZkxPjaYiDiOh6s=; b=c9VpH5nP7urcU95yrEJF9dqNL9EJyyAYHc1b75eVfxUdLMC1vMSPdxCO/uu4UNCqnT KJsQGlpQ30hRFlJYSSM53er3z7P2cayd4HU5zqZY0wMGG5nm+B7tiOL/KOt99hh/FqdE 21jMhsJAu4Dgfzz9+JX1P2yWWBlcSegMNsyAwXxJUz+XEAHrR9jWVcMFw/4RSPXpgFxh uN25BsygOuvW++VKforoSbxQfEY3kCGf2cb7S0UTee2L3ko1e7eaI5PjGW77R4mk3WKy ItI3H7ceEf6zwE0lpmlBG7ZViWV2FYO8br6mjFE4F4HyNlKrVByvw/TTOJjPGeqr7JXQ r4CA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697866538; x=1698471338; 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=nXY7V3h9raI68oJ0bwO74lPlv1+miZkxPjaYiDiOh6s=; b=uTNLq7BsDbSTT4uvFU0tguUgh99FZDGMIIxgmtwYisim+UfUciF6IeiTHiCbQWGW4l Skarnl6Lts39cqSvCwhBIOrcqUHWdpu0nwMfg292xHt0p16tVOf2WaktSH1YgX5ULbKJ RpsSlZ/KNsN1fWMpMJh/rjgjZFRjXAeZ6KNN0SKbabpr5UAjqwgjLqgYOQgJZwPXnQZX xkepabM0mHe6sA8kKux+B9nU+IOTbJf6PkQY1cY1Qdjsh8GbAvJrAy+zbOjG7oVkF9Dt NSnLMsSESHTo6x9GZdfQ4QmjULKMYNqlMcrZ52brhMGsih1uBe3qZY8G3PMQBcTFE+x7 kFuA== X-Gm-Message-State: AOJu0Yx4nWBuWusBrlU8If710+85LUubxszBybU+lTWcUprIz+2CoQmE 8COABf946xzUmXfMuXixJQ505+nKL22vS9UGyeg= X-Received: by 2002:a05:6a20:1451:b0:17d:1337:cfc5 with SMTP id a17-20020a056a20145100b0017d1337cfc5mr1663417pzi.29.1697866538222; Fri, 20 Oct 2023 22:35:38 -0700 (PDT) Received: from stoup.. ([71.212.149.95]) by smtp.gmail.com with ESMTPSA id h1-20020a62b401000000b00690d255b5a1sm2427978pfn.217.2023.10.20.22.35.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 20 Oct 2023 22:35:37 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: mark.cave-ayland@ilande.co.uk Subject: [PATCH v3 46/90] target/sparc: Split out ldst functions with asi pre-computed Date: Fri, 20 Oct 2023 22:31:14 -0700 Message-Id: <20231021053158.278135-47-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231021053158.278135-1-richard.henderson@linaro.org> References: <20231021053158.278135-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 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 23defa0a77..7d834ae8a0 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 Sat Oct 21 05:31: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: 736625 Delivered-To: patch@linaro.org Received: by 2002:adf:dd81:0:b0:32d:baff:b0ca with SMTP id x1csp633265wrl; Fri, 20 Oct 2023 22:38:54 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGg/tk1mbxF+hNUvUKjLMlgGCc4epZzttcy+Urv6WeZoprVxD9v3SDEmC6sHT3De0D03eew X-Received: by 2002:a05:620a:27cc:b0:778:8b53:cda2 with SMTP id i12-20020a05620a27cc00b007788b53cda2mr3910578qkp.23.1697866734711; Fri, 20 Oct 2023 22:38:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697866734; cv=none; d=google.com; s=arc-20160816; b=rIsyoQ5r7TS5iX7Z0PrO5RnvaW0ikEnCFQJdQCJ8pwm0SUn2xn4N5Vp7E+Ax074DL0 tzTaxvfzi5+SUsNdAwQwkhma1/BIPCSTKbnvcQlb8RzB2A3bVpX2naAyXDHh6tAmDKvq XgnbfryxlEUTVUZ+wIhpNlPp0E9xPsEs7RCwiC/abCW6n6lNSUMS9rfMtzK78Dsz56WA j31nRZWCNwwNHGHn5t87pRNBb364GwTESVqbQE2wrHQ/0QRzGuVMzKTLl/9VrnhI8xes DU2IamAO1q0g+J3Bmz1I8g1+aMt6VYvs9V+ATijgGkCLGeTsDLlzwa3j1IwdLZSkOLMT tYLw== 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=1/wGFAbPufE9eZO30bcVplOZLJm6CdeBX9tGD3Qp0uA=; fh=TYrED6TOMxGX0VC4GtjviASLbYyJe19+7/tKWjN44KQ=; b=y82WI0JihpxGfVMgw5H92Wnly1N5CgkClLin0kAxzzU0yAsQx4UZg8bX8Nq4MtFz9s QXdCFwbWUz2YNLV1X8CZecb0q5t9xltWOS1O+iiE0+gwFXDdL3HbOEVQAf2fyXBoOMs0 zYDBdwvMbYb9CSjTd6OR9BIFE/ua1dLzU94CICpWuu+noV9pkLM8HCgnSyTNNZESae26 eTX6QoxhwwzNkVEEGoEKVdV9pY8Bv1ltYBaasABml3ZDCU/CmRcSC/z6lNoj40gXBT7d 0QL6RTqWD9VB8SxnGOJ/qWMab7MUlTKiGgaRWhGenRbbqiqazJPwlA3ZThgphzt+lKE+ hnbQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=G5uNBH1R; 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 z22-20020a05620a08d600b00777449886basi2459629qkz.572.2023.10.20.22.38.54 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 20 Oct 2023 22:38: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=fail header.i=@linaro.org header.s=google header.b=G5uNBH1R; 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 1qu4eN-0002hj-En; Sat, 21 Oct 2023 01:35: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 1qu4eF-0002Uu-Gm for qemu-devel@nongnu.org; Sat, 21 Oct 2023 01:35:43 -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 1qu4eC-00015u-K2 for qemu-devel@nongnu.org; Sat, 21 Oct 2023 01:35:43 -0400 Received: by mail-pf1-x431.google.com with SMTP id d2e1a72fcca58-6b36e1fcea0so1267215b3a.1 for ; Fri, 20 Oct 2023 22:35:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1697866539; x=1698471339; 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=1/wGFAbPufE9eZO30bcVplOZLJm6CdeBX9tGD3Qp0uA=; b=G5uNBH1RsUttr30ysje2H3aEYHai6niLXECRdK7PWMEdBeRmL9AXgnieoFe2Hv+W7V potC6nVzE7M18VzsR4ux2hV4mKxYXncnQT8R7kSEgyO6+0B3pvG3HuVYm+PKZbJMfbBx gZetXtRB1TZ7LSyG4degUxW6yOAhiesJdHfc7ZOnJdz1k/V+p0pyO/tX6WMYSG4HMb3S BrjjebO+yLOLBZpxo2kN/4ubyPlUatAREaiTV0tN/CQnPtwWmG0mdyNnjzj9U53Pi5Rl tEgOAVROtuGqvq5Rv4Tf6Cic3hMOK+a4aY/mc4oXXoQtgt3wyjORrxpIB32OumwWlpkK FWhQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697866539; x=1698471339; 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=1/wGFAbPufE9eZO30bcVplOZLJm6CdeBX9tGD3Qp0uA=; b=sRamfEjLUmOBCcHceyfUcAcuFy0TVrJKNCDLbU7sGSpPUEGuyy9O+8djIvm3aTW8Us PH963fqN2129XYYjvlnZesndm5DoB+LHrcpIao9v9pOS6OJLKwYN3Ws7OOmyBCiJfIZy 72Za4VpQgFkEK4MsmZ1tr1a1Z98HDfCO+/7p60Q0iOA9TnlpQ8LcDLZG/3kODRwAG0Ld XBSb1hbei8iKs1+ExV88VvEi97XTidpNv7g2voh1D6ICJ16Xc0Shok2AKiMvpr42+O4h 2Mk1xenoRHfBU7NJ7wPPoKqem6UBDa6gJH57ctrTba6BPjahfRURMIMeUHtsjAk4qunQ mJwQ== X-Gm-Message-State: AOJu0YxrIf6jLJm6Tio/xDc1Xa1qF+XE/BMgKDAno7cN/T90h9q66Bsp LpDSYAggazwJoNMBhAzREGLX8b6Hmr2yjHzwH/o= X-Received: by 2002:a62:f245:0:b0:6bd:b4f1:49e8 with SMTP id y5-20020a62f245000000b006bdb4f149e8mr3104339pfl.2.1697866539088; Fri, 20 Oct 2023 22:35:39 -0700 (PDT) Received: from stoup.. ([71.212.149.95]) by smtp.gmail.com with ESMTPSA id h1-20020a62b401000000b00690d255b5a1sm2427978pfn.217.2023.10.20.22.35.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 20 Oct 2023 22:35:38 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: mark.cave-ayland@ilande.co.uk Subject: [PATCH v3 47/90] target/sparc: Use tcg_gen_qemu_{ld, st}_i128 for GET_ASI_DTWINX Date: Fri, 20 Oct 2023 22:31:15 -0700 Message-Id: <20231021053158.278135-48-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231021053158.278135-1-richard.henderson@linaro.org> References: <20231021053158.278135-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 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 7d834ae8a0..6f8f279508 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 Sat Oct 21 05:31: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: 736644 Delivered-To: patch@linaro.org Received: by 2002:adf:dd81:0:b0:32d:baff:b0ca with SMTP id x1csp633868wrl; Fri, 20 Oct 2023 22:42:10 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHAwESIX/bqcAZTi1ic1qONSOTS8t2W1QINwJIc/ZCcCt0zW8V6tfQ6pd85IT1cfNMfWUGN X-Received: by 2002:a05:620a:2481:b0:775:d4a5:9c18 with SMTP id i1-20020a05620a248100b00775d4a59c18mr3544486qkn.56.1697866930160; Fri, 20 Oct 2023 22:42:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697866930; cv=none; d=google.com; s=arc-20160816; b=WcdoF+g0cmr1xoG3BxislX4hNNe7Mw+R87OGpVTWEWBoMFdiXYljX8Q64lOpJ0kPul YnSbifxxG8BuV7xCTh9AsyvKH16IwJVPSvaSeMYNrRt2Tqoay/BmZo0HjfWKQydNJYHu oPRVeIYI44Te3wSKAZjjnsB2/Hz4ERpGIoLOCIZtuhNyTwQE3y3lZ+0ndIoaGmQUmzIT 9mIch0pehWTuVTBCaTeU68xfRKOsCldPi9NLgfNpyVp5T5iVxY5JEAME+rha04/Vn8LC QkQhpc7r7tt2caFA7qX8bOsmzk/uQKmBjfSJmXbINk1gptc96WrZUIRgxDbnKgJLgh6q h2bg== 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=QfDb+unIm1+7QmjDoXPDwhvDEAwPeBrO/ad5/mnwy80=; fh=TYrED6TOMxGX0VC4GtjviASLbYyJe19+7/tKWjN44KQ=; b=dW6AGKoM0WV8BRZNLNfR9FsUiw04Rp/+4B5wT3NtyOgJhA58AvtxnyqkFRsif8tLLZ Capi+ifmIRahR1MqM4bHs8zi9TbCeUpB87Dy9yYk+YrYMvLGDKj/TEseHqiouFf/+k80 PqArScUkIJygpk95/tDfKHAKk/J7Erqu7j4cFtiLhM+xTowEV/7OmvDxrRoGtTUJUNXA L2TJm04faU8kWC9u68cBRD/Wpe0NQTWXyl8tYE7GLQ51LukmYCeUnTRin3dNIu3WTbxV 9FiqC6yDBW142IPbOlkEFy9+DIms+szmJVMEft9GzdSiQF7qU9hMKw11MuHZ+w4TRzxp hHEw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Jue1kPSy; 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 p8-20020a05620a22a800b0077435815875si2224641qkh.49.2023.10.20.22.42.09 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 20 Oct 2023 22:42: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=Jue1kPSy; 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 1qu4eS-0002yf-5e; Sat, 21 Oct 2023 01:35: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 1qu4eG-0002Vv-KA for qemu-devel@nongnu.org; Sat, 21 Oct 2023 01:35:46 -0400 Received: from mail-pg1-x52d.google.com ([2607:f8b0:4864:20::52d]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qu4eE-000167-Fk for qemu-devel@nongnu.org; Sat, 21 Oct 2023 01:35:44 -0400 Received: by mail-pg1-x52d.google.com with SMTP id 41be03b00d2f7-53fbf2c42bfso1122161a12.3 for ; Fri, 20 Oct 2023 22:35:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1697866540; x=1698471340; 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=QfDb+unIm1+7QmjDoXPDwhvDEAwPeBrO/ad5/mnwy80=; b=Jue1kPSyyASvH8M5VjSYUFSRSUl46Qa1xwIACu911LdxKdXFZO1utMT95UHmfjIv+M uBq5mlcCmyClGqR31LuJ+/njLIL+Uco2pnPVQD2Jh86Lg6UCUYsKFoErt60zcpCI6Fg6 opvJrZXx9OVQGxOZdwQn3Y1CFApFsMpUufk/47hF9tgF/noL93a7gjBvHk8AnbvYLoVP jSkPwVvJhu+mQomwmisB7pWOcHMnt5iRErBjSN1jG9lLQUCjG1KSDcW19ydVeO+YXfkY +MxNxlH1zzMD5ysmer5rWVAQHpCuwwFTtCGRbfPdxv0zsBL2RBitjO2S9AqqCSvZOSE6 YwBg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697866540; x=1698471340; 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=QfDb+unIm1+7QmjDoXPDwhvDEAwPeBrO/ad5/mnwy80=; b=GphSHX55PIdKCrKm3VPGwIVWYIrLln/dwYzrZopllYjwlGsq5ysc38/bC6cnHUdTVm 81VgZUB/1kfsqoPs0rBFkQKGsfH2ljF50srpXnWZ3rvonpkBo6z3QJueeCl8oJ2+GfxK JN8xqxBjBZ+JGmjSfzJk2qRaZZ+trMmxtgMABbUPP+Ov1PDHDj+bXQexzqFKEnHy2Zxj cqNV+mzVlg8icnpbJUmIpH2nEMT4f3qTeLYUk9QX5rPVcCdtjhP5mjG0RIVPriLLWNah HqhaPedV974bYnnHz8m/Kc8hKCX+PLXpFgCLRa7AkxVQy40BaGWvnneaDdosT9UnINd8 Raog== X-Gm-Message-State: AOJu0YxwCnXHxDmQCni131HMRyUu8buOuqaKiDfyXNQqQdSqQxDrXKUw yptKrvWp7G8uMMOd2VJ0/+naIF7iiAajecwH4tw= X-Received: by 2002:a05:6a20:3955:b0:151:577:32d1 with SMTP id r21-20020a056a20395500b00151057732d1mr4822724pzg.22.1697866539917; Fri, 20 Oct 2023 22:35:39 -0700 (PDT) Received: from stoup.. ([71.212.149.95]) by smtp.gmail.com with ESMTPSA id h1-20020a62b401000000b00690d255b5a1sm2427978pfn.217.2023.10.20.22.35.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 20 Oct 2023 22:35:39 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: mark.cave-ayland@ilande.co.uk Subject: [PATCH v3 48/90] target/sparc: Move simple integer load/store to decodetree Date: Fri, 20 Oct 2023 22:31:16 -0700 Message-Id: <20231021053158.278135-49-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231021053158.278135-1-richard.henderson@linaro.org> References: <20231021053158.278135-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::52d; envelope-from=richard.henderson@linaro.org; helo=mail-pg1-x52d.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 bbddae6ce0..edacd2043f 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 6f8f279508..af9f58aa53 100644 --- a/target/sparc/translate.c +++ b/target/sparc/translate.c @@ -4648,6 +4648,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; @@ -5471,47 +5582,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; @@ -5553,16 +5632,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; @@ -5655,38 +5724,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); @@ -5705,11 +5754,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 Sat Oct 21 05:31: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: 736651 Delivered-To: patch@linaro.org Received: by 2002:adf:dd81:0:b0:32d:baff:b0ca with SMTP id x1csp634015wrl; Fri, 20 Oct 2023 22:42:55 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFMyUmuCmEVv62q52xUJeScZLgfJJXen1AaN7hbL7WCEWPVcMO2heOMeQytg+HWIPFwxAzN X-Received: by 2002:a05:620a:bc2:b0:774:186f:4d82 with SMTP id s2-20020a05620a0bc200b00774186f4d82mr3603053qki.50.1697866975019; Fri, 20 Oct 2023 22:42:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697866975; cv=none; d=google.com; s=arc-20160816; b=oUquebzkTPvcd3csYi9B2p+tY0NTDxnOUX1tWtOm/Rc9PDp8EIw0kSeuTUtTcvQZ8I bpZ4qZndTwg4T735FCyoBaTGKqQ6LUIhTEyIJmXAGoGl++qYdRiIvt3KomgIdj5NyfjS NqzXA8vwEpyD9iLkOfiLfXheTQHqryqyIVaimaSNXyK80McimgIHIsQ4/QlqJv/eAj9B iUZaP6AXg/a99riNlHaYSsgph3ltn5Rns2M91QpBMxxfsV8rtTXAOE70knssjWlDTCPr Vm+sHkZPC5qjwaxFVORMxnVhqdhcTXDEk3WMgVWoAunQgvD6omxbNSyG8G82vIPHIzGs rD3g== 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=VL98R3bvW/9B8nlgH8aInnJrXhHMqcEGmBIp1ntwRN8=; fh=TYrED6TOMxGX0VC4GtjviASLbYyJe19+7/tKWjN44KQ=; b=e1+r7Jx8hpsgdof9bqgbRw0K+7raubitg+jUJ6YBGuaWgCmwjxxoxrpHMR3jZTrEJ2 n3zzUqyHuf+KSTpavFOmVSYMYXZeIFFk71pZaoyhketWhgNu83TJ3J1tKBEE5qyk5ROr lEj0gqqSHfzq4Zz79U4FdmPih7mPa1Cb1+wacnQ53RwJXAR+dTXDafwVWXvSrs7fUpjh Eia13VO3PuQ8PhC1U+p0yS5f2fMIclBwWh5tmRsC3ObcijsAon3ygLu4JLmRJcbuucHc C506pdtd8fzCIHUJ/dJT4z97FBmm2Myhk9Z4JnDsqLSAc7Exg4+gwvZd8tzKf+5VS51K jq3Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="ITSVVV/B"; 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 h3-20020a05620a21c300b007672b5d6f96si2392753qka.17.2023.10.20.22.42.54 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 20 Oct 2023 22:42: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="ITSVVV/B"; 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 1qu4eU-00038w-Pi; Sat, 21 Oct 2023 01:35: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 1qu4eG-0002Vx-R1 for qemu-devel@nongnu.org; Sat, 21 Oct 2023 01:35:48 -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 1qu4eE-00016J-FR for qemu-devel@nongnu.org; Sat, 21 Oct 2023 01:35:44 -0400 Received: by mail-pf1-x430.google.com with SMTP id d2e1a72fcca58-6ba54c3ed97so1447419b3a.2 for ; Fri, 20 Oct 2023 22:35:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1697866540; x=1698471340; 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=VL98R3bvW/9B8nlgH8aInnJrXhHMqcEGmBIp1ntwRN8=; b=ITSVVV/Bo/wD0tdQYP8eoXVWXJjukkFh6RCFyH0WKy1V9Z2ruw6cGboryb6o3a/XUr BzwsrBju08fooVED/yjCQqxEy8lkWTyiqIknE3c+lUymOWHia9KGDm5X+cQLKmaJHxEI nASQNzA71fft+8pniEUGEyHv5VeTfn01j6U63fHweaRoDoUPkawam1u69dxg9zzQ9O7k FJBkvjL6zDdzw+Db641R0x5c0znwEDqJ0yV2fC+UEOBlwObNFwbnfOd3gL0TZX/AhCZj QwFddG5xszqJu6ZhOdWHjDecsbElb8k+kTj+WOOXs+Y6vrwT5irGJCpg86vjMhaXnqZT azrQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697866540; x=1698471340; 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=VL98R3bvW/9B8nlgH8aInnJrXhHMqcEGmBIp1ntwRN8=; b=xNHEl/GQXpFgfYFNi32c96MgA3z7HM8rF5JFboYmxaa6rJbo0M5bX93Hg0UBZptIVl t4+9wbQxrYQbvA5Cf4n6W2XhUoqOwB6Yk/IzISFOQrGBlRWyeUVLKr8DBgd0HNBGvvYo NqmhnvoHrA/q1+m6yabmNARO7wdT84zJ8sUBLhldUEMZ1UvTgbHSjglB1HdAi0iGlTPK Nr8K0BHVzGpSw+qc1wgJdSc5mfz+4LSSKL19GAQAHXdZpUCryX21N2EbCtq0Y/g1qFei fnKWf1CZ9vj6q0KnR0SOITKOo5InkSqlUlOmhmH/mz7ljOw6N6QwXoO4BsNjvjX+48Hi 6ztA== X-Gm-Message-State: AOJu0YwrktYWKudP05Wx0D5Son+s0bgdMFbdsW8QBbp4QtIZuZvRbD2M 7oiJH9rEw6kDlm0nr/f8zG/im2uRRAwPEt6BoWg= X-Received: by 2002:a05:6a20:3d8c:b0:15e:bb88:b76e with SMTP id s12-20020a056a203d8c00b0015ebb88b76emr4539341pzi.14.1697866540664; Fri, 20 Oct 2023 22:35:40 -0700 (PDT) Received: from stoup.. ([71.212.149.95]) by smtp.gmail.com with ESMTPSA id h1-20020a62b401000000b00690d255b5a1sm2427978pfn.217.2023.10.20.22.35.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 20 Oct 2023 22:35:40 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: mark.cave-ayland@ilande.co.uk Subject: [PATCH v3 49/90] target/sparc: Move asi integer load/store to decodetree Date: Fri, 20 Oct 2023 22:31:17 -0700 Message-Id: <20231021053158.278135-50-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231021053158.278135-1-richard.henderson@linaro.org> References: <20231021053158.278135-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 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 edacd2043f..76e812cc74 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 af9f58aa53..dc3586853b 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); @@ -4692,7 +4656,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); } @@ -4716,7 +4680,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); } @@ -4738,7 +4702,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); } @@ -4755,7 +4719,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); } @@ -5587,9 +5551,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); @@ -5601,27 +5573,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; @@ -5632,12 +5583,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 */ @@ -5669,7 +5614,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) { @@ -5722,45 +5667,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 Sat Oct 21 05:31: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: 736677 Delivered-To: patch@linaro.org Received: by 2002:adf:dd81:0:b0:32d:baff:b0ca with SMTP id x1csp635012wrl; Fri, 20 Oct 2023 22:47:47 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEdkaEhkL3cEzHcWrWnVrEyjHn0tUQM9wvbjfZHRWeHKgqMx3sQruwJPxMkGVrZSHPzQg7O X-Received: by 2002:ac8:698d:0:b0:410:a249:bee6 with SMTP id o13-20020ac8698d000000b00410a249bee6mr3405260qtq.14.1697867267250; Fri, 20 Oct 2023 22:47:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697867267; cv=none; d=google.com; s=arc-20160816; b=wAZv+BhvGErN1NuX715QHQDW2Dokjp55hh/q9TJFXdSEMybxVZa0jW6xo4SuQDyIz+ L66Tvj9o3hR/SG+OXSB8P9BpZU/vfZjSQBCcP/IGo7Hk88QfU50K5f9SImWHU/4XYC1t y2Mr9BRDdh4puZQPn7GmIZw4gpB9aEU7FFQ8joflTY0uC/xbmmEfO7Nu00whKoGUqbV2 OqlO3AazKoe+02ipgjEj9D+7YiZIESvmNx4vAoC+UXJx5eJZfxvpgik/akG+IruYV599 qSoBgWgnGDR/iEVhLT6f1vdnVPiaoAE0QDdhwgDG8KsG4m8kjvvPxt8w2JcIr1m/fTcn 0xrQ== 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=DfUVH6Lh/sNQC/NJIdQQI2T73mQYEQ3627njcWIRFV4=; fh=TYrED6TOMxGX0VC4GtjviASLbYyJe19+7/tKWjN44KQ=; b=v1J7fTb0qjg7zm56aTS2zMERBV8t92DSpuPknvaK2eolYKDlD2tf5hYlkUXX2b4B8d wkS5dp2XTIhHZLx1FVMdgyTiwU6N36wLQvWQPG+ALOayxIcAJS4nxhZLyFsblrLApk1P +5vYL3P/6kvTUtLU1kfLLxtm5KgzSgwJHKYEb+FxU7UIR2tEgYr3uIU2Co4jk421Tumd FJgBezRIy7Du2hFxGMmSfBTaUSBdrINBZ0mciqYn/MHDQMPSBafzToKKru+5NFwBiLNM 1XWAQXNSd1F/PO7CuDY0jHbXHPZwbNUiq/RF3vuVgtAYvdb/sFr+yyYeJe6Ws2X4Wxvg d7yw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=jWEdv6NT; 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 p8-20020a05622a13c800b0041820c4f419si2450292qtk.782.2023.10.20.22.47.47 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 20 Oct 2023 22:47: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=jWEdv6NT; 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 1qu4eR-0002vE-7b; Sat, 21 Oct 2023 01:35: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 1qu4eG-0002Vw-Q1 for qemu-devel@nongnu.org; Sat, 21 Oct 2023 01:35:48 -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 1qu4eE-00016M-LW for qemu-devel@nongnu.org; Sat, 21 Oct 2023 01:35:44 -0400 Received: by mail-pf1-x431.google.com with SMTP id d2e1a72fcca58-6934202b8bdso1457429b3a.1 for ; Fri, 20 Oct 2023 22:35:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1697866541; x=1698471341; 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=DfUVH6Lh/sNQC/NJIdQQI2T73mQYEQ3627njcWIRFV4=; b=jWEdv6NTnjAIsNcplO0XmidDUkg069vJ1IXVO089mooRQrIJphdsoCsXfbMItievhj 5RixEwLkr3pCgsmIiAe7FOfN/HIkcDlDgUrDiArrK3EtGGy/yxIqCdHVEzPQjmPB/wBv MHQh7P+hubd7g0XB9jkqqgLHG9g0ey1t2eGT6G+Xe6y/wYibwmOPhptS/MbH5r80VC42 p8l+eEckdQVXXHpgKKdq+bV5NFI7rrFYrcI0QeyM2v/nZbuAgladosVrNA7480d9l8kV TfIz4ic6MSj3O8DwuCEAxAxe7ZFXRAxWTNFITjZAVIAtULEwlUZo4HNETqqkX2WmSeAe 9ZpA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697866541; x=1698471341; 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=DfUVH6Lh/sNQC/NJIdQQI2T73mQYEQ3627njcWIRFV4=; b=RN6OtYtu+UxSUz+5tdVzM9kaoxcmS/BQB+oKIj83ZU1Zx6+vWCYjHme9zKSC86dOLh v5ieOXXQedGXQh8yGXesjn4N+vTRx9vL/qXHszvIuinX+nGp3eSnwwyS8heDLrmAYJBX i4i/Jgki7WjDEzqUdtKMv0l17h5CKpAgnMqRwzU7vPeK887JjW/fS/TpdeCXGWc+eKJe h7p+ov51as9d53K4z2fkBaQrz1Sl4vEm4He07+U5/oBuaHnbhNiI0G29yVUy3FudPDlg 5oOTiK4VkUq9q78k/7QbKe9qwX9edjo4q8MQk0gBHB+YrEEIrZlo3bogQrOpJlCqw7pL 6Wug== X-Gm-Message-State: AOJu0YzzhMsGC/62ZhlgeRw11CAmOg6GVkSrSUfMeSsXFbSj/WE7wrOf gyGkDtCjf3j7yLhiZneag3YH+FvcQ2vWY3/I6p8= X-Received: by 2002:a05:6300:8088:b0:161:3013:b499 with SMTP id ap8-20020a056300808800b001613013b499mr3825600pzc.60.1697866541351; Fri, 20 Oct 2023 22:35:41 -0700 (PDT) Received: from stoup.. ([71.212.149.95]) by smtp.gmail.com with ESMTPSA id h1-20020a62b401000000b00690d255b5a1sm2427978pfn.217.2023.10.20.22.35.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 20 Oct 2023 22:35:40 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: mark.cave-ayland@ilande.co.uk Subject: [PATCH v3 50/90] target/sparc: Move LDSTUB, LDSTUBA to decodetree Date: Fri, 20 Oct 2023 22:31:18 -0700 Message-Id: <20231021053158.278135-51-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231021053158.278135-1-richard.henderson@linaro.org> References: <20231021053158.278135-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 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 76e812cc74..818ac33f2f 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 dc3586853b..70d0ed3db3 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) { @@ -4723,6 +4708,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; @@ -5551,21 +5553,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); @@ -5573,9 +5574,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 Sat Oct 21 05:31: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: 736665 Delivered-To: patch@linaro.org Received: by 2002:adf:dd81:0:b0:32d:baff:b0ca with SMTP id x1csp634625wrl; Fri, 20 Oct 2023 22:46:06 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFF5BnY865M7VsgbCJ30TnU2QkY33GD7TwvN2XKWR9JhC1+AA+2uGh8NdHLFTgdIxV1QeIw X-Received: by 2002:a05:620a:1108:b0:76e:fea2:cc79 with SMTP id o8-20020a05620a110800b0076efea2cc79mr3410354qkk.67.1697867166017; Fri, 20 Oct 2023 22:46:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697867166; cv=none; d=google.com; s=arc-20160816; b=bvwr6OakgeV37FOkBsqYoG4cMUFj1Yi/vy1/aX/1ZrvZInBbODNu7JWg/XIIVorhyk zXkHbLM8uNfgIMG+epwW+eK6zmk72PwKpQpH62y8JUUEtZW+Jo40NSFuHHqybQQRa95H 41oO2f0I0X3fuoA0JH3MNxCoAEPmtniOV8+H/D7Sm9LFYxc9aAbArrwCJL06N20+pzAp EsSU7X3qe3L2HMpXMaB2IFtF66VKn8ENtdmjw81WQWOmygAOLkTpocDeOR7DofYrC+Na cLMQnD3zdqjM+MvU1VpN4Ugmn/buXDPvcEbot/9MCYUMS4TsW5+4uTpYrhcQ0FTfNlOH wk2A== 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=oYhZ5h6y1sX5qhFTzMtfi7bhQk1LvgzZSBf+UyyWnvk=; fh=TYrED6TOMxGX0VC4GtjviASLbYyJe19+7/tKWjN44KQ=; b=tNv33dv/Dl/GW9M2VCfo6mM4KgMJ1taLmXLcNcpSvLTCjxusb8xwXmz52KpzxLM022 IkVjCap0l1fRPNhbWpt++buvf7UJqdqKDT6AXryFqIXtpBH3HF2tRv6XlIdV+WGhSwPf R2C8HBW+3qJRlNNho5nwDVTp7A6etgm1IJy5RkbeYegXuqJM6iHbsxfJCliC2jQFLwtW sRiF82KeYLDWwVcCGnyAzbe3Rk4zzkPEpxeXOS6RqQMK2f/sNMzeZmHdr8zS8zkrDoVi Q5ZI/C0ME+qhS1fZCaTf+V8sGHAgncouyQ1gDvncvZCHZnoVS9hpQAn2WYKa4kazOVek SS3A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=mlxruulg; 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 qr21-20020a05620a391500b00778b0f5d4c0si1434176qkn.566.2023.10.20.22.46.05 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 20 Oct 2023 22:46:06 -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=mlxruulg; 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 1qu4eZ-0003Km-CW; Sat, 21 Oct 2023 01:36:03 -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 1qu4eH-0002WR-Rf for qemu-devel@nongnu.org; Sat, 21 Oct 2023 01:35:48 -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 1qu4eF-00016e-V4 for qemu-devel@nongnu.org; Sat, 21 Oct 2023 01:35:45 -0400 Received: by mail-pg1-x530.google.com with SMTP id 41be03b00d2f7-53fbf2c42bfso1122175a12.3 for ; Fri, 20 Oct 2023 22:35:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1697866542; x=1698471342; 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=oYhZ5h6y1sX5qhFTzMtfi7bhQk1LvgzZSBf+UyyWnvk=; b=mlxruulgCnui90T3m6Dhg5B4CxWarsraBq+RLPa6k1zUhWEKmawLP6RSRum8qVw0dL wdWSunkoQ5HRE77Hp742Vdp4ISCTSkrQ+VapVYe7XFfCQewEq35NADZgveSdSb81NDf9 EWxOSMeSmOQ8ZtRC9gNyp9b3ZaSJoQ1OlkUbruTnT3eqKfObEWDg/LNnhSsKZ4PzjiLC nmv7XbIYg5RMgCFuTJKZZ5lieH96ijisRbBNv0EFNnjrNlGEKVyCZbmSzomwxquRG+na vEh2GEzkSeFKwCpWP5RHrGrSuiUfVD4RKTw/Ip8BBqf582VoFr0B2jcJXR2eT1VQyvWU otRg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697866542; x=1698471342; 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=oYhZ5h6y1sX5qhFTzMtfi7bhQk1LvgzZSBf+UyyWnvk=; b=hBMkXxVlmlmsnEzRFbhxhJfWhh2gDdqZ72UwnByLzgoDkxPlT9O0ne0lhpvbHka+rb IAatWEHvubdokCVWYIWtfBjfprTI8BAzovsJiduVlyLBxoJ+8aiR9gvv+65ke4EO/GiI h5l43Z49k4rIH5yqhxwqbGeL06HfZsMBaj9NHF5BmB4GjcCedmYVSbuewcNYh0KiI0ne mjwTKtgyyA4Vf1X5VD5/9TI8QK4sPNhKli+Wub0ELvMmIISeg0LOkXzl+f2cbMm6C4hG 3P9CUROw1lCP1FBFsutUhmckg+JqLgh5ww3Y8sqYe6AqrUZrjgBIxeqGqogi2Su5mTe9 ORSw== X-Gm-Message-State: AOJu0YwSsO9zqJQyjlyziIFOe5vlf5w6lVvQgX2KGMmEq3IRdoWZFJig Iq+wG76izqcP+1QhCCJAShKPQBfKSxCxxLz3O+0= X-Received: by 2002:a05:6a20:7d9d:b0:161:2607:d815 with SMTP id v29-20020a056a207d9d00b001612607d815mr5020360pzj.24.1697866542413; Fri, 20 Oct 2023 22:35:42 -0700 (PDT) Received: from stoup.. ([71.212.149.95]) by smtp.gmail.com with ESMTPSA id h1-20020a62b401000000b00690d255b5a1sm2427978pfn.217.2023.10.20.22.35.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 20 Oct 2023 22:35:41 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: mark.cave-ayland@ilande.co.uk Subject: [PATCH v3 51/90] target/sparc: Move SWAP, SWAPA to decodetree Date: Fri, 20 Oct 2023 22:31:19 -0700 Message-Id: <20231021053158.278135-52-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231021053158.278135-1-richard.henderson@linaro.org> References: <20231021053158.278135-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 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 818ac33f2f..f3d02a3564 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 70d0ed3db3..2dd50a38f2 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) { @@ -4725,6 +4710,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; @@ -4736,7 +4739,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; @@ -5554,6 +5557,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 */ @@ -5561,25 +5565,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 Sat Oct 21 05:31: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: 736653 Delivered-To: patch@linaro.org Received: by 2002:adf:dd81:0:b0:32d:baff:b0ca with SMTP id x1csp634159wrl; Fri, 20 Oct 2023 22:43:44 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHTJ5UmcKHHpebmR3FHwyk3MQFOU7VjnrAaS3igwmBqxH5bWWAsJxSSNFN3FO6zAvKaMup5 X-Received: by 2002:a05:622a:1aa9:b0:41c:e028:7254 with SMTP id s41-20020a05622a1aa900b0041ce0287254mr2901280qtc.34.1697867024492; Fri, 20 Oct 2023 22:43:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697867024; cv=none; d=google.com; s=arc-20160816; b=hEzS9kQxKX15g8UZ1qAEJ55rPb8Umt5liLffuySoUmvHaJxSCpTbcRTkbQZgA27Dtg WjCC0bv01ut0MK04vU4lt7T9RnvByUUCMu3HJ7flbIxNy2D9YaAznSrykzbovtmX8z4i DmuFhLCJRrb09/9pZQWOffe5eiMdlLST0Y3fN9mO91JQunLkdlGxrjH/COrWtBNEl9Sp YhZhOS6B3Wt1aSK4/4JCreYujLcdtJZ64K6mN4K93V63UWGVKlK9wlaToKmzdkRItJSd zpP2eNoilEEhA+v61ZTrup4pYiSUHS7BxZlaqmIoYJsPE4HpFqlgfnlS5XYb+WlcY6Lb /0FA== 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=JxEpruIm3SICz789muQH2A5aymvQNo5GfdzE0R3VZP4=; fh=TYrED6TOMxGX0VC4GtjviASLbYyJe19+7/tKWjN44KQ=; b=llRs3LMGMuoPxOdCGRscW8m6Yl6qCUzrrEoAxPWpXmDw7fTi2E+FVBcFHuInukXtwS ho2prC+Ti9+5Wbj8ubnnBYtpzU6/tMQ5vA19YkfXImyafvWWxNvUplnIFmeqz8kVgmWd pmmWxpxsLEkuRZ4IxyGoFg/7pJJMSVVfNJZHp7kGhp3NSRGVOEqepfJA7XT+3+8HlCqY L2Q1Xvt7GA3CbHPg2sHQ+fV/9xzv41WtAZ69W6nohSOLi+bw5JDv3/5FPfGhGNwWgUUR kgK0y4REucaB3rVuaiDgvCLfZXKrarhc3Kp5y0ClCKp5X9YRGgjVdcL8bo0QP+7RLUed EMAQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=KxY20i2N; 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 e9-20020a05622a110900b004181244b348si2437270qty.432.2023.10.20.22.43.44 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 20 Oct 2023 22:43: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=KxY20i2N; 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 1qu4eU-00037H-8V; Sat, 21 Oct 2023 01:35: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 1qu4eI-0002WS-9U for qemu-devel@nongnu.org; Sat, 21 Oct 2023 01:35:48 -0400 Received: from mail-oa1-x33.google.com ([2001:4860:4864:20::33]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qu4eG-00016n-G6 for qemu-devel@nongnu.org; Sat, 21 Oct 2023 01:35:46 -0400 Received: by mail-oa1-x33.google.com with SMTP id 586e51a60fabf-1dcfb2a3282so1086472fac.2 for ; Fri, 20 Oct 2023 22:35:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1697866543; x=1698471343; 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=JxEpruIm3SICz789muQH2A5aymvQNo5GfdzE0R3VZP4=; b=KxY20i2N/PD6skOGwAdvlxXNaYIqPz3xqGJIu+dpElDtyUxV+PeOh8ajhdb9h2sbnE O7Z3ZLP8NZvjXKTCHgHgcsWnmfsqm0fONq7yWI+JnjVKo7NalsEyMMzr5nQXR3ZFVFpW PsFfJGMRMessSr4QBwnrnYqQ4T212cSehIZ4LsejnagRT2e8LhaQMZ+eI5Ng9rWXKFJn 4OoRgfYofMixVARXJKWkIit/zl9qyHs65eHjzVAG06aqbfmveBzaPBpC0itbDfEeNhgb raBgrTkudNn/lexl9poG3JtSABgEtnK6Z/jgryFYXCkhG2LDjFd+X6OCo5STmnV3V26V LBoA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697866543; x=1698471343; 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=JxEpruIm3SICz789muQH2A5aymvQNo5GfdzE0R3VZP4=; b=VGUVRpO9aCpaSTdh1d2s/riWKxlTMFSQOxAB5huNFyPXRIvyi0VVNHbtTTCNzfOW7I JzJbl3fxbERk8/gQLrdFuMa9neoRnKg/ar6KC0IRe/esk/OLLkHWrRp0zwoO+kW7syCW hJ6CDKOFwQepfdecZLxB51kT9LKbmPRtK3hLGFMcJy12RhiFwrtOts3g7w8sXspdLhsk gakK0WQg5v/izJfELmjnRfGecOzuOoqMgSCY6TNcuyEHhwH98mZjMoEchYm+HviODalQ +dwVTWi/oGq0BXKePYD9KeFWOH5odF1OPyZXoiqhff+lRDEdHek86XMeJX8KbZzuJEU1 wjQA== X-Gm-Message-State: AOJu0Yw9GCkTmqMkmfl9L2OeR0MiV1DNMMxTKSJxTvMvZdTL2NOi19z/ bgYv4VTum2P5gHdQSrVHPB4w9Oeq0c65OVrq3To= X-Received: by 2002:a05:6870:e0c7:b0:1e9:9715:3cc5 with SMTP id a7-20020a056870e0c700b001e997153cc5mr4714226oab.25.1697866543217; Fri, 20 Oct 2023 22:35:43 -0700 (PDT) Received: from stoup.. ([71.212.149.95]) by smtp.gmail.com with ESMTPSA id h1-20020a62b401000000b00690d255b5a1sm2427978pfn.217.2023.10.20.22.35.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 20 Oct 2023 22:35:42 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: mark.cave-ayland@ilande.co.uk Subject: [PATCH v3 52/90] target/sparc: Move CASA, CASXA to decodetree Date: Fri, 20 Oct 2023 22:31:20 -0700 Message-Id: <20231021053158.278135-53-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231021053158.278135-1-richard.henderson@linaro.org> References: <20231021053158.278135-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2001:4860:4864:20::33; envelope-from=richard.henderson@linaro.org; helo=mail-oa1-x33.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 f3d02a3564..f4c55db313 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 2dd50a38f2..e1749ec12c 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) @@ -4728,6 +4705,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; @@ -5531,9 +5530,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); @@ -5746,22 +5743,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 Sat Oct 21 05:31: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: 736634 Delivered-To: patch@linaro.org Received: by 2002:adf:dd81:0:b0:32d:baff:b0ca with SMTP id x1csp633648wrl; Fri, 20 Oct 2023 22:41:05 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFqrhYux9FWxD/EszWf7FzK1nOpvn1VkyKmzgYfH9kW+dQdrjfb4r1C3vw/7DLWKE6j/Ljq X-Received: by 2002:a05:6871:8909:b0:1e9:b550:c05a with SMTP id ti9-20020a056871890900b001e9b550c05amr5156603oab.53.1697866865187; Fri, 20 Oct 2023 22:41:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697866865; cv=none; d=google.com; s=arc-20160816; b=1FOwKsU7b1RPoTHGPH9d9I3N+WXrOz2RBvpwwCWxiH8DGVhaOdDWZgxkpwr7KqWiv3 Ro08ev7YoAaxncLpC2boqVvgoSx3oS8tXJcXdAf8TXCzdbcvtRsYeVdCLMmqXjoGu2aX JW8y6MePff/lDKsuIIQrPn3Dp/gZwrSq5xgBwqgolOzVV5TJTGZpKzEOtzd+UPD7BLMl 6mfmtG0ToRwe27qkz+dc9vqZnXiLb93ydg31RY+ttSlGupNlOE5cJ/2kjjdPQI7sE+nt 5oEH0i7om798z/GIOcKrjD1UADbbzrAcXI+dgwY828q5Pj8vx8EgCJSGosQxzRbz6nUH YIdg== 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=cQauA42ukOEfv4/p0Y5GO/oTAcUVJILosfHC4tqX3BU=; fh=TYrED6TOMxGX0VC4GtjviASLbYyJe19+7/tKWjN44KQ=; b=l3Zfe5i9DYmTWQSkq/0cnV4XTogBIN8kJWO8LSWDboU7x7Ne7U1V2f/8o14xELCohL oRM8MJm1ZzXGP2hRkyvs6wKjJmXs6mIYgHdC/QIOUsQWm5M+Pr3mLi2k6qXEqBS0K0YC M+PaSQIRZxIxFr70TPB0koapa1GvTC1Oq24r1X3lndgaZP6QinGk2A5hSOdl92LxJbHN Zsp/O3y8wSokaIwaY2ufcqSuwTCUKJCgD5VcXVDu+oUwOCbSKu2eTYvmf445vloVLjvx RcHznDxe4+bb/yxcgDzopgHunyt+DPMtJ3M1hChe5ufCeHUhNX8DlzEuqfnrgzD2Cnmk 7XJw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=VP4+C3Is; 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 cp9-20020ad44ae9000000b00658976d69e1si2362871qvb.443.2023.10.20.22.41.05 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 20 Oct 2023 22:41: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=VP4+C3Is; 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 1qu4eV-0003AW-62; Sat, 21 Oct 2023 01:35:59 -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 1qu4eN-0002fP-2t for qemu-devel@nongnu.org; Sat, 21 Oct 2023 01:35:51 -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 1qu4eH-00016x-J4 for qemu-devel@nongnu.org; Sat, 21 Oct 2023 01:35:50 -0400 Received: by mail-pg1-x533.google.com with SMTP id 41be03b00d2f7-565334377d0so1123588a12.2 for ; Fri, 20 Oct 2023 22:35:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1697866544; x=1698471344; 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=cQauA42ukOEfv4/p0Y5GO/oTAcUVJILosfHC4tqX3BU=; b=VP4+C3IsR8efYerz5UElu/stmKoLDDBCPZYsgHlW2uNs8H38tNvAEEETZR0MlrgfWz 8BqO8cJDI88uaPdePpjhiOTQ+yLXipIy3BXJ7fwAYIqQrnkkpNr8sng+DzkPxW9UEMab hiF0E5OXGAFwHaWVqLlwhjEXZiJ679dF9Kg57Yz0os7tQvfdvXSZ6Lh7LeYTsvjp/ffq QFNTcaalKZ3uN6/GYercXRq5A7O/4yVXNT4JTfR/rKgnZc6e686Hh5MTds0yVRKVExvc x1PJBVrGp9XkMS5UJCuE36qU2hEJ1OWu6PbhyEe9zPuLNc/61npJr6Puiv3bHOfxGlPP HrQQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697866544; x=1698471344; 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=cQauA42ukOEfv4/p0Y5GO/oTAcUVJILosfHC4tqX3BU=; b=jqQ69iaF/Pdyzd/ByEAX3zHNCJvDB5OlIR/Y5REEw8kcCNY2yyAzCpUFbOIWxmR679 HUv7Ltr94K2EGoL7YEkDPoyaYzrb+k3PPefUgUyuoXuRE1ODgf47q21a5iCmsTSaowai sUCrhic446CpuZVA9XoB9OfK3TgJB7jG0D2l0ehORphdRnQELQwtD4OXdxkajOEdcDp1 3sbb92RPV468dQMWFh+G1tOVhLSv7/03gbJHQINPYz6NULVpNvAh9mS9f6E22LkDLFwg upR8hS2AuDYG+5P5BNg2qnoXTDTQsoxTF7/9wQEeSZ1nmgOUGRzH1enZwFx2vMZ3dBeG pZKg== X-Gm-Message-State: AOJu0YwpIy3DYRuhZdwWTNpWK7XZvSilqL8GS5h84NREHXsC8KIatG2N TzrQU0quEDfg0UwY/7e+OnhXFDt8F+N68bLD2vc= X-Received: by 2002:a05:6a20:6a28:b0:155:2359:2194 with SMTP id p40-20020a056a206a2800b0015523592194mr4693521pzk.46.1697866543980; Fri, 20 Oct 2023 22:35:43 -0700 (PDT) Received: from stoup.. ([71.212.149.95]) by smtp.gmail.com with ESMTPSA id h1-20020a62b401000000b00690d255b5a1sm2427978pfn.217.2023.10.20.22.35.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 20 Oct 2023 22:35:43 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: mark.cave-ayland@ilande.co.uk Subject: [PATCH v3 53/90] target/sparc: Move PREFETCH, PREFETCHA to decodetree Date: Fri, 20 Oct 2023 22:31:21 -0700 Message-Id: <20231021053158.278135-54-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231021053158.278135-1-richard.henderson@linaro.org> References: <20231021053158.278135-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, 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 | 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 f4c55db313..96c6e19fc9 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 e1749ec12c..9053cafd47 100644 --- a/target/sparc/translate.c +++ b/target/sparc/translate.c @@ -4135,6 +4135,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)) @@ -5568,10 +5576,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; @@ -5586,8 +5594,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 Sat Oct 21 05:31: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: 736636 Delivered-To: patch@linaro.org Received: by 2002:adf:dd81:0:b0:32d:baff:b0ca with SMTP id x1csp633652wrl; Fri, 20 Oct 2023 22:41:05 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHXF4rxGt89aepatA9ABH/W7nYwL0JtD0mnGF1qOXv809K/dJwHZ7bDueEkP+dGe6vJfVzx X-Received: by 2002:ad4:5dcb:0:b0:66d:368e:24f5 with SMTP id m11-20020ad45dcb000000b0066d368e24f5mr5059270qvh.46.1697866865574; Fri, 20 Oct 2023 22:41:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697866865; cv=none; d=google.com; s=arc-20160816; b=QKC4+zO+VSSqUA9tcOf5F6+miaXmzNhHSKq0q4ixNuhAtQNz/cyQHxrWCdL1wQImtp wuDoQmksfMVON5QUHiL+iwDmp0CWeP+aaYmIv9xEF40LrgITDlNOtoIjZSDGNO6v2phg RU714IeBp0Ls7d9aFnSSWAb49oDxQ44XSQJllUOWcK4PHg5GNEhmFBdO7iiKmAOQkurK I8AEu0l9/h0WgVleYt4LsodWUn7WEZZoIwQaRwfQ/EdtqAH+LRkFnDUeSXqITi1DpJT9 pwngyQbVTTXH8XrD5UzaWyhUfnydUDbrHqn0cmqHVqCI+zlEDf2pJ0d81HP6RWIRMPCV PBGA== 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=K2PQEuxq+yQBrL7qoakVAwsA2K0bUEaLhrg1z7qMIJ8=; fh=TYrED6TOMxGX0VC4GtjviASLbYyJe19+7/tKWjN44KQ=; b=H+orBslfUNgKNlIBSjk67SjJumQ08xf6Zqr5UqvCyWVqnazFfWEInJltYK5fbKe9Yf 73GeBgS/d0O9CjFHM8IPzYPqiIDbUFzeo05L0tQElufzDegy/zU3KW1Yli/SydJ9H0DW hyvk7xZCD0Rdy+Yoikrp1ouTw+KAK/YoQ0dbFwrHoh8YlC/RlCTLsQIsvKzqme4MXPqM 0kGjMdhKjT7rSR+I+IsZY8SAX788yrzemBZK9fBlVCSCCWmH+d/Sb57bB8PrBnoh5xwS FtTp9qmL1ddZqZFQ8ilHzqseREAQ3bcNViDVkCp2sbL57JJBKFCVf/jigCgZU5HpSiH1 uI1g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=ymQfKfaR; 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 k8-20020a0cd688000000b0065b2e9cee3fsi2487166qvi.492.2023.10.20.22.41.05 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 20 Oct 2023 22:41: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=ymQfKfaR; 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 1qu4ea-0003LX-6K; Sat, 21 Oct 2023 01:36: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 1qu4eK-0002Xw-Hw for qemu-devel@nongnu.org; Sat, 21 Oct 2023 01:35:48 -0400 Received: from mail-oi1-x234.google.com ([2607:f8b0:4864:20::234]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qu4eH-00017C-VE for qemu-devel@nongnu.org; Sat, 21 Oct 2023 01:35:47 -0400 Received: by mail-oi1-x234.google.com with SMTP id 5614622812f47-3af609c4dfeso1054084b6e.1 for ; Fri, 20 Oct 2023 22:35:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1697866545; x=1698471345; 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=K2PQEuxq+yQBrL7qoakVAwsA2K0bUEaLhrg1z7qMIJ8=; b=ymQfKfaRrET4Yxh5OqhcZ0fNiWnZ/YjGeOsvmi2pBvbcH3qmO9rOp8IyDv6zYrjNPT h0N+5fojeEu0YQrmd5f/HV2HdP1DZyxN531Li7/8+WeEiEc6ewaepFqa+QGlATXnkNZy DijGLvHtd3gV4niV0ud27f4tTTeZdv4kL+SRtQaEQyX+tR8lPX0wnIIjrHpaFeS2MYjG 6sXx8S4DG6s32QD3qN71aplgiISGS8NzIWOQrbnhp+ofrg9NxndAZ5/FUDTVVQcoS/pO i/xMgLRgpiXE4/dCE/wS8yplM61JKt0n+XMHY/X5uinqpjINjf2rJSxjsDezD639eS1p u6Kg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697866545; x=1698471345; 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=K2PQEuxq+yQBrL7qoakVAwsA2K0bUEaLhrg1z7qMIJ8=; b=sWKFW1l76GrDnTpKhzHD8YxsGQCP869agk2IfbEQX6qFzmcTd/s7Fsdl2t32b6+irb CjIKE7sNcx/AqVrDAg+E07An1PEWrPLGHE0sExz/Rxtj/0j493HBNMNzo7ho5aCteGCF dRqiezdxCHn+mDTHqmZRW5hX3kuDwo2m4052Qys+3+CVoaFgFiU6RNc6wzomXHh7UJ0r r0HhT3PUzrEoSTdCc9GZS+LhG6y40HFH53v9geBZnUo8WphnffQWn4pK/no2HbXZwe78 8EkedjEwDd+ePjIgCvo2Fr9Fs7/+vUBurKddlWhWc5y/nP2ADmGFk9pHcZiiKie0WchP JaKg== X-Gm-Message-State: AOJu0Yy44t3LKVkcShunQYRfM8SNDReTvuKomSQBr37Kju8051iI6PUN d4svzYWebD/B223sNdpfh9mnVslAGBTUvxXhqeY= X-Received: by 2002:a05:6808:15a3:b0:3ae:4ca9:cae5 with SMTP id t35-20020a05680815a300b003ae4ca9cae5mr4935644oiw.21.1697866544767; Fri, 20 Oct 2023 22:35:44 -0700 (PDT) Received: from stoup.. ([71.212.149.95]) by smtp.gmail.com with ESMTPSA id h1-20020a62b401000000b00690d255b5a1sm2427978pfn.217.2023.10.20.22.35.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 20 Oct 2023 22:35:44 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: mark.cave-ayland@ilande.co.uk Subject: [PATCH v3 54/90] target/sparc: Split out fp ldst functions with asi precomputed Date: Fri, 20 Oct 2023 22:31:22 -0700 Message-Id: <20231021053158.278135-55-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231021053158.278135-1-richard.henderson@linaro.org> References: <20231021053158.278135-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::234; envelope-from=richard.henderson@linaro.org; helo=mail-oi1-x234.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 | 136 ++++++++++++++++++++++----------------- 1 file changed, 78 insertions(+), 58 deletions(-) diff --git a/target/sparc/translate.c b/target/sparc/translate.c index 9053cafd47..df4a22eb04 100644 --- a/target/sparc/translate.c +++ b/target/sparc/translate.c @@ -2305,35 +2305,40 @@ 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, 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 +2348,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 (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 +2369,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 (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 +2379,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 +2388,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 +2416,51 @@ 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)); + DisasASI da = get_asi(dc, insn, (size == 4 ? MO_TEUL : + size == 8 ? MO_TEUQ : MO_TE | MO_128)); + + gen_address_mask(dc, addr); + gen_ldf_asi0(dc, &da, addr, rd); +} + +static void gen_stf_asi0(DisasContext *dc, DisasASI *da, 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 +2469,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 (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 +2490,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 (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 +2507,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) +{ + DisasASI da = get_asi(dc, insn, (size == 4 ? MO_TEUL : + size == 8 ? MO_TEUQ : MO_TE | MO_128)); + + gen_address_mask(dc, addr); + gen_stf_asi0(dc, &da, addr, rd); +} + static void gen_ldda_asi(DisasContext *dc, DisasASI *da, TCGv addr, int rd) { TCGv hi = gen_dest_gpr(dc, rd); From patchwork Sat Oct 21 05:31: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: 736637 Delivered-To: patch@linaro.org Received: by 2002:adf:dd81:0:b0:32d:baff:b0ca with SMTP id x1csp633658wrl; Fri, 20 Oct 2023 22:41:07 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGopbnHfciork0lpo94mQT0LgW8P8EZXr/6W6vkUWUlrUXVanHd/sLrR3rP+qobgYr68iUT X-Received: by 2002:a05:620a:f04:b0:773:e488:320a with SMTP id v4-20020a05620a0f0400b00773e488320amr3940447qkl.59.1697866866787; Fri, 20 Oct 2023 22:41:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697866866; cv=none; d=google.com; s=arc-20160816; b=qLAHsXUGpVVIU3RSRZHi1paH//VmrEAh3rdKCWS353ZZhdoUvWUN1I0q6wNBy7sd05 E24YodSUlzppmxMyCeshlhR5AVwT/vwsiezla9UIMQWe0y+ib7ha8OMk9CjesAqrpl6M 0AnF70K9dL85rCbqiooYSj0ZzR2ISG9C21RjgyT5vqOzFwQwqmZanSbGY4otTqPjRn3D LJnl5IWNgfsEJIyrgN88kKWqw1484qoliF6eR/3je4qr7R7TKo1JgJE9NCNLhPfMVyya k2dtQqcAzaBOrg26y75WHEpFPvCa5SBfDFkhulv14UB06ekS2zQIr9hRMDiUXXyeS5c5 KdwQ== 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=/UP3k7WCRkmPRh6bZlNkIAfN70TBHmuOR5dGifrhqeU=; fh=TYrED6TOMxGX0VC4GtjviASLbYyJe19+7/tKWjN44KQ=; b=GWfcXvUn08srDXrvkTt7HNKEezr32gcizczMIBa637gDu4Hj6RnvtQ7JNzndRKdfCv fFicAw5LjDDjuhZ0yhKWlnTD0cV3+DMcQ8GheFE22n3MsqcVxjC7eundZTZnDD9wJFTJ SQj03RDJYLindPvkqgNx3xcObVOfdpWoKVAROuRb+XIIbTAUX+0l/N0mQ6KsC+0waYyp ZAKTlID6eBr6O88N9tTs90RJCATkTS5pMLUJxE34SpXbZke/O81+MVDjPYG0ks+gomqS JLS1mLvS3cKiGkzo4Z5Q5v112GVLR6Y6BQ+Vc51kuoOjk1lUmv/U8shLVynN3UR4g01X DK1g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=gEELT3y3; 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 u8-20020a05620a454800b007742dc43698si2462129qkp.246.2023.10.20.22.41.06 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 20 Oct 2023 22:41:06 -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=gEELT3y3; 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 1qu4eR-0002vH-7y; Sat, 21 Oct 2023 01:35: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 1qu4eN-0002fJ-2V for qemu-devel@nongnu.org; Sat, 21 Oct 2023 01:35:51 -0400 Received: from mail-qk1-x735.google.com ([2607:f8b0:4864:20::735]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qu4eK-00017O-AP for qemu-devel@nongnu.org; Sat, 21 Oct 2023 01:35:50 -0400 Received: by mail-qk1-x735.google.com with SMTP id af79cd13be357-7788ebea620so92859285a.3 for ; Fri, 20 Oct 2023 22:35:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1697866545; x=1698471345; 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=/UP3k7WCRkmPRh6bZlNkIAfN70TBHmuOR5dGifrhqeU=; b=gEELT3y3tblW+v2jQtobojH2njxrT7yAM2taslv8QFWlERESKI2W9dkdE3RD2vopGl or3qBmWnbSPH50RGDCaKE8Jcxrv4Nxbnt+DFIqsMynguBOnlbcy/cclPV07XTdS3geCy sWO9mQ3c02RD0sLXwrujX+PKKG9f3j3GrFjFqjfUmpV0MpeyrUtlFe4IoaAyS9YIL1Hm hO/DF7s74k3al7ddKvacs3AxOlRJerbMbsW2jIJJtF9ajLGYo4D6HC1q28PgO7fxuuij pE8q+gA0nkM+k5gCAfz5/c+2Yr+eUxWVyzQe9WKB5zCNbf4wRCUVT0xgGfubVpOiDERF zJgw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697866545; x=1698471345; 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=/UP3k7WCRkmPRh6bZlNkIAfN70TBHmuOR5dGifrhqeU=; b=CFGxt9UKd9FlDh52xLkulTgcQ/J1Q4JSA6O9sNQaQnSmvwHFPn9VFP7vTZDguHnewA EmVqf9KsdOT2iTakkmIsUnFA7m583767XseFCeO1eGKsRmgQAjySa4eABYjoRUD8/mWW fZYM9sySTo+ScPwQnQAmYJML735ELs9Qmzoc+Kh/uW7WVINhL38lEKqJ84qztHQ/SPPt GNcmC9jknQ9in/pDMJCdeq7TSwdMwRLRo6G9DNp1yZu4o9xbbMo1j7DJ+Jkoodb43gM7 JsP+QGeMKxoLhE/jmKGUzJxHJe6k6nIi5Myi5Ce8C087VPRByNd0WdWRhP8C197I9SEM tVtA== X-Gm-Message-State: AOJu0YwpbyxpxlDnJyRu2M4ylgxA6FfTlQoC24vri5oUYr788W8/nbvq QDRh3pxC9gu8hJdEH9ZqQWMe9Ki5BY0V3CJnaKA= X-Received: by 2002:a05:620a:bcb:b0:76e:f496:1930 with SMTP id s11-20020a05620a0bcb00b0076ef4961930mr4123912qki.43.1697866545581; Fri, 20 Oct 2023 22:35:45 -0700 (PDT) Received: from stoup.. ([71.212.149.95]) by smtp.gmail.com with ESMTPSA id h1-20020a62b401000000b00690d255b5a1sm2427978pfn.217.2023.10.20.22.35.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 20 Oct 2023 22:35:45 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: mark.cave-ayland@ilande.co.uk Subject: [PATCH v3 55/90] target/sparc: Move simple fp load/store to decodetree Date: Fri, 20 Oct 2023 22:31:23 -0700 Message-Id: <20231021053158.278135-56-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231021053158.278135-1-richard.henderson@linaro.org> References: <20231021053158.278135-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::735; envelope-from=richard.henderson@linaro.org; helo=mail-qk1-x735.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 96c6e19fc9..30eeed84c2 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 df4a22eb04..e08cb8f0ff 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); @@ -2883,6 +2861,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" @@ -3011,6 +2999,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); @@ -4755,6 +4757,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 mop) +{ + 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 ((mop & MO_SIZE) == MO_128 && gen_trap_float128(dc)) { + return true; + } + da = resolve_asi(dc, a->asi, mop); + gen_ldf_asi0(dc, &da, addr, a->rd); + gen_update_fprs_dirty(dc, a->rd); + return advance_pc(dc); +} + +TRANS(LDF, ALL, do_ld_fpr, a, MO_TEUL) +TRANS(LDDF, ALL, do_ld_fpr, a, MO_TEUQ) +TRANS(LDQF, ALL, do_ld_fpr, a, MO_TE | MO_128) + +static bool do_st_fpr(DisasContext *dc, arg_r_r_ri_asi *a, MemOp mop) +{ + 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 ((mop & MO_SIZE) == MO_128 && gen_trap_float128(dc)) { + return true; + } + da = resolve_asi(dc, a->asi, mop); + gen_stf_asi0(dc, &da, addr, a->rd); + return advance_pc(dc); +} + +TRANS(STF, ALL, do_st_fpr, a, MO_TEUL) +TRANS(STDF, ALL, do_st_fpr, a, MO_TEUQ) +TRANS(STQF, ALL, do_st_fpr, a, MO_TE | 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; @@ -4769,7 +4833,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); @@ -5636,12 +5701,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); @@ -5658,25 +5720,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; } @@ -5686,11 +5729,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 @@ -5705,43 +5746,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; } @@ -5788,19 +5792,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 Sat Oct 21 05:31: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: 736649 Delivered-To: patch@linaro.org Received: by 2002:adf:dd81:0:b0:32d:baff:b0ca with SMTP id x1csp633905wrl; Fri, 20 Oct 2023 22:42:22 -0700 (PDT) X-Google-Smtp-Source: AGHT+IE6eMLL0u/6xV4P2IcBfxF7ALJWQN6PBiLjHDrUzLMAI3Zhjn4YDUpJNUHEYlgWyOli2JlZ X-Received: by 2002:a05:6214:240a:b0:66d:139f:34cd with SMTP id fv10-20020a056214240a00b0066d139f34cdmr4594477qvb.13.1697866941792; Fri, 20 Oct 2023 22:42:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697866941; cv=none; d=google.com; s=arc-20160816; b=SJkoRg5I6zYfpCoOphZf96e1vCjyiFGo4RMM8lVreyvWVMbtzOLxVxsBleS5uYHw2K ASq2301oq2S8bmi0LDu4hMh2GslVq4CqsNwa8sKUXljEa2jfM8o83+CFRigVAgFpB0zh cHJXbM8fpkDrh80n1XCGHbZFFAAqaUpz1iiZ01k5PER4ir2jj0LA+ffEcVCA4hS9gjrb 4SKEy9vXFMcmHHcRaOcpe13omw/tBPSxaIN1rwvKv7E1AJn2jKGjr/AkXzuxUj511419 +VqYi6KHL04D+fFF2zuHl8rOQGQiJUEE0l7A8+huVsHsx+mb0rUc0ibOEKBNHBpOz8kz JGXA== 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=C8lbuymrsVSWZjHY05NloNpAzWLNg9x/vDv1u7Euf2I=; fh=TYrED6TOMxGX0VC4GtjviASLbYyJe19+7/tKWjN44KQ=; b=MItuZrnndX0+dOrg6MsDISVdPlypOU+zFAUzX9VMSzSzN9uRMPy58M0FU6uUX/Z4Zl RZrQjPIZcXbWXKriMjhHrzEGP72xhrc31Ra9E/Opat9q5NStY/8jBr1XmtzFzdNNE+kS EtIlh+sOnsG51jS4oxKjwCFDc9vUGH/aZrd4DrLtRs05gWW7Zvvn0w2kjQszokVLFxRF I7a1B1116Hz8CJDpkS/+v1T5bh1EsTQ0T+zpZA79H1xQEYypRW8pMEQpSMHxVw7YGy2z /LotFNwX0WrRrYx11QKo9b5IvwWJ9DMGAMxgR48XSkQTYUUmceIKbrPeUdV+emjS6de8 XCkA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=i664y3vV; 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 l15-20020ad4452f000000b0066d0865a7a8si2559854qvu.353.2023.10.20.22.42.21 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 20 Oct 2023 22:42: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=i664y3vV; 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 1qu4eU-00038B-Ky; Sat, 21 Oct 2023 01:35: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 1qu4eN-0002j0-JD for qemu-devel@nongnu.org; Sat, 21 Oct 2023 01:35:53 -0400 Received: from mail-ot1-x331.google.com ([2607:f8b0:4864:20::331]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qu4eK-00017Y-Ld for qemu-devel@nongnu.org; Sat, 21 Oct 2023 01:35:51 -0400 Received: by mail-ot1-x331.google.com with SMTP id 46e09a7af769-6ce291b5df9so976856a34.2 for ; Fri, 20 Oct 2023 22:35:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1697866546; x=1698471346; 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=C8lbuymrsVSWZjHY05NloNpAzWLNg9x/vDv1u7Euf2I=; b=i664y3vVZk4eQKixLIFdpDMJsmCNMVB7JAHYb6JJTPRDt5ueiw54+ezlHDeTM5VI77 YjlePtTzQCfZO6C1coIp/75qp3o94wy8zl9BbATauQL5BnQsEdBSg5Ymev8ttz4GR5tA 9gUkVKhO/Me5rf2HPreXQKTDaYrc8qbrIvWgCb6q46B+7w9Yb97DB2avpUYfh4KQCBGg Hv3olGpvPfF0r6cZTjaUOXZLWteoL78PWaqA8cLaTYzKm8HxDUgLs/YDU/rZ+xHwlVIx 2yPd+dncPM7Web7oONUBZ9Z6uj9OFobo11tep5DIGeYAC/Eizu+0qW2hlnUF+vtYjEAl U0fQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697866546; x=1698471346; 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=C8lbuymrsVSWZjHY05NloNpAzWLNg9x/vDv1u7Euf2I=; b=e1H76dHTY2fcjgFpvYvAB0gDnF6wp9p6TnospIqLDNkWNBckxKHvOGwK39R2TBRPB8 JsJtPccS0+V7lz/Ft2UppwUdcDnXftbaHS4130y3iu9yH9q0heyCBKg2jivTOVgP21sx nN4wMLWLA2DTSIoDv+nxctqeGZOQBUpEMFhrWRw8vEg+PSoiTvShpVtVN6i+4VTxWyDE 5yl1xPXZosqC3JesNll+IgV2NOkTVw5vRXYhp9R2lX1Npxx9XRNA/nItDe9qDwevrcmA mr20bX0CPLNIbyjm3HTrNARUFsav6qMES4EbpYSQDA8BiZDteS4vFqT9t2bG8MGU1xzp fp8Q== X-Gm-Message-State: AOJu0YxDAL3doyzOp4my+r3gjdS04kifKFo0E+uNNW24srmVM7mHF9IS k2/+yZRJSTBQrFNj2q5klQZhky09ZGnLniqtPpo= X-Received: by 2002:a9d:4f09:0:b0:6cd:4fc8:3efc with SMTP id d9-20020a9d4f09000000b006cd4fc83efcmr3748981otl.19.1697866546422; Fri, 20 Oct 2023 22:35:46 -0700 (PDT) Received: from stoup.. ([71.212.149.95]) by smtp.gmail.com with ESMTPSA id h1-20020a62b401000000b00690d255b5a1sm2427978pfn.217.2023.10.20.22.35.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 20 Oct 2023 22:35:46 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: mark.cave-ayland@ilande.co.uk Subject: [PATCH v3 56/90] target/sparc: Move asi fp load/store to decodetree Date: Fri, 20 Oct 2023 22:31:24 -0700 Message-Id: <20231021053158.278135-57-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231021053158.278135-1-richard.henderson@linaro.org> References: <20231021053158.278135-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::331; envelope-from=richard.henderson@linaro.org; helo=mail-ot1-x331.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 | 169 ++++++++------------------------------ 2 files changed, 79 insertions(+), 141 deletions(-) diff --git a/target/sparc/insns.decode b/target/sparc/insns.decode index 30eeed84c2..6e8416520a 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 e08cb8f0ff..46448fb5c5 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,12 +2277,13 @@ static void gen_ldstub_asi(DisasContext *dc, DisasASI *da, TCGv dst, TCGv addr) } } -static void gen_ldf_asi0(DisasContext *dc, DisasASI *da, TCGv addr, int rd) +static void gen_ldf_asi(DisasContext *dc, DisasASI *da, 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) { @@ -2315,8 +2310,9 @@ static void gen_ldf_asi0(DisasContext *dc, DisasASI *da, TCGv addr, int rd) 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: @@ -2327,18 +2323,16 @@ static void gen_ldf_asi0(DisasContext *dc, DisasASI *da, TCGv addr, int rd) case GET_ASI_BLOCK: /* Valid for lddfa on aligned registers only. */ if (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); @@ -2380,8 +2374,9 @@ static void gen_ldf_asi0(DisasContext *dc, DisasASI *da, TCGv addr, int rd) 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; @@ -2393,21 +2388,12 @@ static void gen_ldf_asi0(DisasContext *dc, DisasASI *da, TCGv addr, 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 : - size == 8 ? MO_TEUQ : MO_TE | MO_128)); - - gen_address_mask(dc, addr); - gen_ldf_asi0(dc, &da, addr, rd); -} - -static void gen_stf_asi0(DisasContext *dc, DisasASI *da, TCGv addr, int rd) +static void gen_stf_asi(DisasContext *dc, DisasASI *da, 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) { @@ -2437,8 +2423,9 @@ static void gen_stf_asi0(DisasContext *dc, DisasASI *da, TCGv addr, int rd) 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(); @@ -2448,18 +2435,16 @@ static void gen_stf_asi0(DisasContext *dc, DisasASI *da, TCGv addr, int rd) case GET_ASI_BLOCK: /* Valid for stdfa on aligned registers only. */ if (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); @@ -2485,16 +2470,6 @@ static void gen_stf_asi0(DisasContext *dc, DisasASI *da, TCGv addr, 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 : - size == 8 ? MO_TEUQ : MO_TE | MO_128)); - - gen_address_mask(dc, addr); - gen_stf_asi0(dc, &da, addr, rd); -} - static void gen_ldda_asi(DisasContext *dc, DisasASI *da, TCGv addr, int rd) { TCGv hi = gen_dest_gpr(dc, rd); @@ -4772,7 +4747,7 @@ static bool do_ld_fpr(DisasContext *dc, arg_r_r_ri_asi *a, MemOp mop) return true; } da = resolve_asi(dc, a->asi, mop); - gen_ldf_asi0(dc, &da, addr, a->rd); + gen_ldf_asi(dc, &da, addr, a->rd); gen_update_fprs_dirty(dc, a->rd); return advance_pc(dc); } @@ -4781,6 +4756,10 @@ TRANS(LDF, ALL, do_ld_fpr, a, MO_TEUL) TRANS(LDDF, ALL, do_ld_fpr, a, MO_TEUQ) TRANS(LDQF, ALL, do_ld_fpr, a, MO_TE | MO_128) +TRANS(LDFA, 64, do_ld_fpr, a, MO_TEUL) +TRANS(LDDFA, 64, do_ld_fpr, a, MO_TEUQ) +TRANS(LDQFA, 64, do_ld_fpr, a, MO_TE | MO_128) + static bool do_st_fpr(DisasContext *dc, arg_r_r_ri_asi *a, MemOp mop) { TCGv addr = gen_ldst_addr(dc, a->rs1, a->imm, a->rs2_or_imm); @@ -4796,7 +4775,7 @@ static bool do_st_fpr(DisasContext *dc, arg_r_r_ri_asi *a, MemOp mop) return true; } da = resolve_asi(dc, a->asi, mop); - gen_stf_asi0(dc, &da, addr, a->rd); + gen_stf_asi(dc, &da, addr, a->rd); return advance_pc(dc); } @@ -4804,6 +4783,10 @@ TRANS(STF, ALL, do_st_fpr, a, MO_TEUL) TRANS(STDF, ALL, do_st_fpr, a, MO_TEUQ) TRANS(STQF, ALL, do_st_fpr, a, MO_TE | MO_128) +TRANS(STFA, 64, do_st_fpr, a, MO_TEUL) +TRANS(STDFA, 64, do_st_fpr, a, MO_TEUQ) +TRANS(STQFA, 64, do_st_fpr, a, MO_TE | MO_128) + static bool trans_STDFQ(DisasContext *dc, arg_STDFQ *a) { if (!avail_32(dc)) { @@ -5637,64 +5620,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; @@ -5750,36 +5676,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 Sat Oct 21 05:31: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: 736657 Delivered-To: patch@linaro.org Received: by 2002:adf:dd81:0:b0:32d:baff:b0ca with SMTP id x1csp634556wrl; Fri, 20 Oct 2023 22:45:50 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGFWUiv/4YQr/dIxQnDF2djjAQekBtWMD6m2sRDdERVtRKDQS9iNCiA2XkuSXQWOoDUzUjP X-Received: by 2002:ac8:46c7:0:b0:41c:d62b:fb51 with SMTP id h7-20020ac846c7000000b0041cd62bfb51mr4216720qto.26.1697867150276; Fri, 20 Oct 2023 22:45:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697867150; cv=none; d=google.com; s=arc-20160816; b=Unofs6lA573L1cyYwB7gCD1LupTLNw9fzM+O9NnQ2nSoUiRwLr9XlutjqqXx+PZR1I GaGh5cD0OS47Y9c7OHC4M8+W89URQyM5XlijlxM4chnEabpGEdqYscL5jxxUh3TxkxlU XFDJQBerc+lrMsGx1WY+LSvDxLHwKnAsz2o+b5lRWw4F5MhcEKh8nrPbUcrH/0lK3I11 4TMSzSdj9zZPxvQn0lrv5J0xBeL8F/UtpJjEvyz+me+MU+U/og8k/d3wBp5Po2quyzlX BwViyqrUmhXVoNgL3LrYeHFZlFrWdHT2IB3omzuBiu+iM95ebziymy75LYqvy1+5+6cP Nfew== 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=yWRJfF+GNQJEKbetIqJQA0wahH6aOWwJd5gm2Mh/bWU=; fh=TYrED6TOMxGX0VC4GtjviASLbYyJe19+7/tKWjN44KQ=; b=JonfelMH9NKj/nnC1PUJBBL+4xWzcFt3IXSgUNlT5vAI5YxaGv2siQSGGRKkz8N1CB GU0EC8HRxosJTmR2UiboJYb2R08OBuhsjCNiemwxRfHoiW+ccTavQHvgx2k7dT7Ta1NA 39OBz+9osmtPD1lCucYspy3wslDzZUD2es5boJGYIwej/TCoUHyhRROnElUl4n5I65LV j+QAg3mxhAqW19MBmm7gjbZYOk1jadwK+CQaxVYMQglqRP/FedWSoIz0Uh7EOjPSwLCT Tfj8qRRHAv2Px6KqMgdxrStY2Ysi3Y69jLWjGIuZkR4CJtZUgmgRVfwKRptBkkNn79n7 sY7g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=wNpq3Fbi; 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-20020a05622a001200b0041821adfb01si2385626qtw.632.2023.10.20.22.45.50 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 20 Oct 2023 22:45: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=wNpq3Fbi; 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 1qu4eX-0003JT-Ni; Sat, 21 Oct 2023 01:36:01 -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 1qu4eO-0002kb-0E for qemu-devel@nongnu.org; Sat, 21 Oct 2023 01:35:53 -0400 Received: from mail-pf1-x42c.google.com ([2607:f8b0:4864:20::42c]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qu4eK-00017c-PU for qemu-devel@nongnu.org; Sat, 21 Oct 2023 01:35:51 -0400 Received: by mail-pf1-x42c.google.com with SMTP id d2e1a72fcca58-6bf03b98b9bso1675859b3a.1 for ; Fri, 20 Oct 2023 22:35:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1697866547; x=1698471347; 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=yWRJfF+GNQJEKbetIqJQA0wahH6aOWwJd5gm2Mh/bWU=; b=wNpq3FbiGskx38M3H6CQFKhfU20FvpR24DTOfr/eiwHsSQ0VvxywTYZrnhdLJ6/jlH ztyUraMmA9Z3dLeuRYXyyX/PJh8ksuxAhIwE1bwOH6JgEgbT4NW2Tm5Czl2JvdbNf9HW 8u4qsOf03JfziHN+z0YVg3uW+y03WYIEyOGfWpF7IAwOgqYZEI9EDfF/eypxdlG5RdWi dkJdfGS0y6Bt2Y5tl3cuc0SyZ+jER23jDIzCInehZlbiemXdf2vfV2hROfyvdgCnXORf sTmQdRuRnjglGoUyS1APM75cDg25+I7adq1h3pwmM19l1Vzr6EJxRZ3gjVQc2GhdkodY p37A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697866547; x=1698471347; 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=yWRJfF+GNQJEKbetIqJQA0wahH6aOWwJd5gm2Mh/bWU=; b=t35c5iGjSYO/eOffm2mXT4aatuWWGo/A15+NAWLev+XiKVXRL8A7/XX5vezGCuBR1u Z5fZKhrIv78APeDtLmcFpEsZnZZx+zah9UfN+Km0JQ2zAKcMReTFX55gPpKd0U/OzRC2 s+58zUFy99S8KU04F7oJ5nYooKy/eJYJWJkmLG/RRP8ZEw/ermS/CLKhCW+Fwdx2vxHe 6R8D37u64dEWWRJwhCDJYUNDVYjMdnpmfL2V4n5ITVe5RUsd44VMme5qfZD55i43as3w zWIemPk+075/+mUW/abgqMu06QbALqKxWPvp8Z8F3kkM5B567MVh5m2ea6mhI2FGzAeC NFvA== X-Gm-Message-State: AOJu0YwXEsls3ZxMNXe4V/GNs0yzkCVnooKaFOCA1VVPMwKAR2y1CIi8 I1BQUN0NwYEVgNI3tDb10RUdqrpLCEXvjp7ZFpY= X-Received: by 2002:a05:6a20:3d07:b0:159:c07d:66f0 with SMTP id y7-20020a056a203d0700b00159c07d66f0mr5620078pzi.6.1697866547199; Fri, 20 Oct 2023 22:35:47 -0700 (PDT) Received: from stoup.. ([71.212.149.95]) by smtp.gmail.com with ESMTPSA id h1-20020a62b401000000b00690d255b5a1sm2427978pfn.217.2023.10.20.22.35.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 20 Oct 2023 22:35:46 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: mark.cave-ayland@ilande.co.uk Subject: [PATCH v3 57/90] target/sparc: Move LDFSR, STFSR to decodetree Date: Fri, 20 Oct 2023 22:31:25 -0700 Message-Id: <20231021053158.278135-58-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231021053158.278135-1-richard.henderson@linaro.org> References: <20231021053158.278135-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::42c; envelope-from=richard.henderson@linaro.org; helo=mail-pf1-x42c.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 6e8416520a..850b1a3845 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 46448fb5c5..8ac9ef2e12 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) @@ -2638,13 +2633,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; @@ -4802,6 +4797,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; @@ -4815,10 +4865,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); @@ -5599,89 +5649,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 Sat Oct 21 05:31: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: 736638 Delivered-To: patch@linaro.org Received: by 2002:adf:dd81:0:b0:32d:baff:b0ca with SMTP id x1csp633660wrl; Fri, 20 Oct 2023 22:41:07 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGF3rrBnWzYt/J2bPJXPtasCCo0RcFLpmUWll7MIJeCH5KopOkbA9ALYbnvJexryf5aJD9r X-Received: by 2002:a05:622a:2c4:b0:418:1365:9b4e with SMTP id a4-20020a05622a02c400b0041813659b4emr5066600qtx.20.1697866867123; Fri, 20 Oct 2023 22:41:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697866867; cv=none; d=google.com; s=arc-20160816; b=D39OTCOvQ8UlGh/Y5iHy8Maaxa5ZhB3WYmK/iVykqEnbuOFiXt3MQtrql15mgK54O+ QHy+h3WkdxxATssVhW7DTyvUUD7Y34/ROb6MSWB7bc00FO/dnrjEQ9/qJSG3dAHWPxK9 ZSz6Rl9qAC0L5EpOwTA9V6m0QFk+0K8BtB4HWv2ED/JKfM/QcIj/dL1DJR918r6rJokh WXnxDGNhresqyHFFQKo/lCpi71PvwdmwOzNxXASW5y2ZZ+2sPvDl8+7UWQ0+5UNXcz8w NfEIvblB35ItyMmCGwJPS81qxoiIS8iKmLtGwoz8SCY79qy9iAAQhPHm+LzPskY8d+0g 1HqQ== 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=NfkUJwcD3UlJPNgPGqdmmi12msrrgZ0GHrBj/wiCyt0=; fh=TYrED6TOMxGX0VC4GtjviASLbYyJe19+7/tKWjN44KQ=; b=ehK/bEgT+gN9xqzE83wBwaCYCNugnmrZSCxvJPTkenUNMmtvJbZv/p0N4z1vB3FOyJ Miu6RtZWalUB0qKuZOc/fQHFFy0V+wEUFpNFOo3UKTmCeqcbfUGpaNufTLOkx6iA+QOM TAuMVFGtT7B//5qjHdTPC71MFcUBKKebzcrBnGCvJmOrSV/EwI7myjX6pRGZNCBJQc5r 9/8cMontONLzvsO6p/2xTj1i242Jb+SnJFOWgraBkEiUt0e2shzz4lh82EN1MTCYABW6 prsPzZrKTls3TKZJu2RMz2MHbJU7WPIRfYX4356oZsu1rWx/UBgB9L/QhCiLivaeMDz+ pPHg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=qC1cANgr; 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-20020ac85dcc000000b004195e83ec9esi2321238qtx.325.2023.10.20.22.41.06 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 20 Oct 2023 22:41: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=qC1cANgr; 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 1qu4eT-00033T-2z; Sat, 21 Oct 2023 01:35:57 -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 1qu4eN-0002jm-Tw for qemu-devel@nongnu.org; Sat, 21 Oct 2023 01:35:53 -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 1qu4eL-000181-EN for qemu-devel@nongnu.org; Sat, 21 Oct 2023 01:35:51 -0400 Received: by mail-pf1-x42e.google.com with SMTP id d2e1a72fcca58-6b5e6301a19so1431292b3a.0 for ; Fri, 20 Oct 2023 22:35:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1697866548; x=1698471348; 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=NfkUJwcD3UlJPNgPGqdmmi12msrrgZ0GHrBj/wiCyt0=; b=qC1cANgrk19d/TmOfdPqCD+frs/r80OkHoctPMmMijK8LMpIa0877ClQTzCEB/d3UR u9vAbJMzeJMNU4fjuL5/qcBoN1TPX3YL/MTQuJrUrnOOqgYnU+332BH4huVQbohkm9/t Hbg4Lr1/E1qreivtJp4CM7pQxbt4bQhEDPTh5h8zjj+WsnPesIGbfysSOM06ekDDJVY6 iCcQNHRqMQBuONbXHekH9beOvGTWN6dxJni8bVNXXOyf8ZLjns/md6KSeSBzjjqgWSE0 DjvPWKn7Bc6imVa5RtCnSKMIBURULblnlXcUtKwQNgD9dkL2HT632sEjcbNwmAO+FtCi MQ+A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697866548; x=1698471348; 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=NfkUJwcD3UlJPNgPGqdmmi12msrrgZ0GHrBj/wiCyt0=; b=fveMgccN6SSnI6+MAFkROGQqrBMgcYrO60tmP3uKJIZG0zEkd90Ct1hF3VTlv2vzFX iKGWtnJgjeMQL9iY1FSO/ZY4daW1pJspDnEr+DrCrfehmuzVf0jDiCxsj7Hdt1ShrU6p sVedSnESb8+eAguoOmqKVIFBl0UwmHtv/9K1zLQ5Z3IIx2hV/QVu1iWqm49EbHuFaCLL ewp18PHOZfrYpTysYCDzCXdgdVSelhhWPPyqwbV82rUH0ZziHWu2T5oZ1QpN+jlut7rL dbfeWHT0JOgCBjmlC8Ud1UdvmPlsLRfbfwIO5r5TW+kMEIAK8SZrF6ThV2iwysaq54yu w1Xg== X-Gm-Message-State: AOJu0Yz1Yf53ndH+spdlFIoZgcErW0MIHsR/bp3I6e/rZP7V1SbrH9BP ZzkG9I8oY3eWWizwOPiNFNP65Fd1UrYRQxt9PwE= X-Received: by 2002:a05:6a00:1ad1:b0:6bd:a7ea:5c7e with SMTP id f17-20020a056a001ad100b006bda7ea5c7emr4206018pfv.11.1697866548096; Fri, 20 Oct 2023 22:35:48 -0700 (PDT) Received: from stoup.. ([71.212.149.95]) by smtp.gmail.com with ESMTPSA id h1-20020a62b401000000b00690d255b5a1sm2427978pfn.217.2023.10.20.22.35.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 20 Oct 2023 22:35:47 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: mark.cave-ayland@ilande.co.uk Subject: [PATCH v3 58/90] target/sparc: Merge LDFSR, LDXFSR implementations Date: Fri, 20 Oct 2023 22:31:26 -0700 Message-Id: <20231021053158.278135-59-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231021053158.278135-1-richard.henderson@linaro.org> References: <20231021053158.278135-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 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 8ac9ef2e12..f1f43b4e14 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) @@ -4797,44 +4798,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 Sat Oct 21 05:31: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: 736629 Delivered-To: patch@linaro.org Received: by 2002:adf:dd81:0:b0:32d:baff:b0ca with SMTP id x1csp633535wrl; Fri, 20 Oct 2023 22:40:22 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEgRxmjPtRNEUulAgejk6qQMSPTDwXPZwDZTCiVGrX+37a07wUauF+hN5R6EyfO/uucu0No X-Received: by 2002:a05:6214:5287:b0:66d:4986:3420 with SMTP id kj7-20020a056214528700b0066d49863420mr4176012qvb.36.1697866822489; Fri, 20 Oct 2023 22:40:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697866822; cv=none; d=google.com; s=arc-20160816; b=TDZ0iIY5gtLDB96Lf3oq5VgwscBWXka8pW1aoJNTNhjwevpLLPoIwrP+7yWi8NvMep 8SwkplNciX15v59/a57/lcEILcyruwGG3yvE8spcB33/ZxzRjoIHmytGySrMS4EOs9Tf LVskn4TgC4N81o1O1HViPXPtgC2sStiiSFuKCDCZcBFp2jZLTCVyePrLfuQ1rEkVT7t3 qpNc/MfMdHGOBBD0LWomdUGoyLVzuSVGUkirpARhp+Kj54u3MO846GejadcuJGIK0nAt TErcTjidrYu5l4fRtWxwP2hb5IcV3vro4nmsRwo6BmnbXzDWzarLjwKRaS68xB3kbH7r Welw== 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=0XkbW87uh2PM072scHNiJ2t4hiLJFMC9cFTN6ugQ6bs=; fh=TYrED6TOMxGX0VC4GtjviASLbYyJe19+7/tKWjN44KQ=; b=JzPSTy7LgBWvFhhj6e88g1oAJ96zZSmd+AC6JARRtT0kUiwRv28S4bZbUpQz9IB5tB sN7Jy3SZipTb5kddMHMYL9/x1ALalI9DU6W+DcVOYbGhUM14G2vlAJy5Fj0nrpCkPqGs CuJI0/GZ2x5wYlclG5nQQa7wH/+9pncSlz0xnIE+Z+K/6Vibckiw484dolzGKQxEytP8 10ZX5ZoZiwwamgsaeICsoTNClUsEL/hajzTAoIITm3RYau76MSE5Mz8kUE71YIM4KFrm K3EeT1SKsVeQCI4b2NRQgUd4p1lXFjU7HoZ+Dwm6HBIgegCjnkUYwaLHi74tud9C0rqR s+Fw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=aJCSHwKs; 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 do8-20020a056214096800b0066cefcfe53dsi2371958qvb.524.2023.10.20.22.40.22 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 20 Oct 2023 22:40:22 -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=aJCSHwKs; 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 1qu4eS-0002yy-An; Sat, 21 Oct 2023 01:35: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 1qu4eP-0002m3-1A for qemu-devel@nongnu.org; Sat, 21 Oct 2023 01:35:53 -0400 Received: from mail-qk1-x72e.google.com ([2607:f8b0:4864:20::72e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qu4eM-00018B-O0 for qemu-devel@nongnu.org; Sat, 21 Oct 2023 01:35:52 -0400 Received: by mail-qk1-x72e.google.com with SMTP id af79cd13be357-77784edc2edso93018685a.1 for ; Fri, 20 Oct 2023 22:35:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1697866549; x=1698471349; 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=0XkbW87uh2PM072scHNiJ2t4hiLJFMC9cFTN6ugQ6bs=; b=aJCSHwKsriwddwsf3rYVuEoFL62heNahp4A4AD+A+JAy/IIIQ+7jbXI18SFQ0TLzRb YZXpJpUGlFSBCL5Prx+FSYUJsg6vzPwx6Rp1hpha80AfSt1r7seTk8ihpe3uHkEVVYGP /wmJZ726odaypEL+X3fLtqsEuFnrE81E78GUE5n29PTjpNHJ2cGQYItsNECaYRfjRAer 0iwP8GzMuWat0NeCuVqvMAp47eoYGgGK0g8edkDLib/0va859+zI7mGboW2hGY/hzuWM H0d3Ws77FeFUz46yBmSu8MC8UTOA15u1NObBT5ZEwSZdoc/8483xQxOA40Qez0zosUg3 bFAA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697866549; x=1698471349; 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=0XkbW87uh2PM072scHNiJ2t4hiLJFMC9cFTN6ugQ6bs=; b=UAC2VZ69Pn/JxTrCRGidOu+lp14yK5ysRAJB0VydwvXrVIfNy84ibq3oLw2XIlIVF8 BJALemNY/TIHEjWJP4HWgQsyClLpl+Mb5Nfm1a65ulirfA/Yxvt1sHSBnPnHjloplGB9 0Mk8RxHqsrplfG9eXcgW2gC0M6PnX3x141O8ivN+1rs0+R6cXU2z5+9r85RS0VHCWHzi u3U8ToWh3ym1ozttzBAuA3l5CsYzDO2Cqr6EEplx1ljlTLiCWwviG6vo69TSeInAgGAF UJC4QoMY8zd38KHlpXQs7KCzAkxu4CD+8TG2/V71RCa9J/O5W+0rcnlH+LVvwJXPGS6e 7v0w== X-Gm-Message-State: AOJu0Yycmb76qctlkCUwoA41tDwQky3rhUrprFA9pvmW6LxgrtanNGtB usQ15q5E8YdSJprcCCDaILeXYbgqikg26q+3r4w= X-Received: by 2002:a05:620a:6405:b0:76e:e352:667a with SMTP id pz5-20020a05620a640500b0076ee352667amr3433506qkn.35.1697866548870; Fri, 20 Oct 2023 22:35:48 -0700 (PDT) Received: from stoup.. ([71.212.149.95]) by smtp.gmail.com with ESMTPSA id h1-20020a62b401000000b00690d255b5a1sm2427978pfn.217.2023.10.20.22.35.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 20 Oct 2023 22:35:48 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: mark.cave-ayland@ilande.co.uk Subject: [PATCH v3 59/90] target/sparc: Move EDGE* to decodetree Date: Fri, 20 Oct 2023 22:31:27 -0700 Message-Id: <20231021053158.278135-60-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231021053158.278135-1-richard.henderson@linaro.org> References: <20231021053158.278135-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::72e; envelope-from=richard.henderson@linaro.org; helo=mail-qk1-x72e.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 850b1a3845..04715cf068 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 f1f43b4e14..5c76933970 100644 --- a/target/sparc/translate.c +++ b/target/sparc/translate.c @@ -2711,93 +2711,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(); @@ -2864,6 +2777,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) @@ -4298,6 +4213,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; @@ -5197,89 +5219,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 Sat Oct 21 05:31: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: 736643 Delivered-To: patch@linaro.org Received: by 2002:adf:dd81:0:b0:32d:baff:b0ca with SMTP id x1csp633762wrl; Fri, 20 Oct 2023 22:41:31 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGSpYUpk8rEoPIx9aCd8cGCfHjMnBkNAJoe5qDnv3Owh7vv8W4FY7gTGdgDnYm77f4z4mxN X-Received: by 2002:a05:622a:5d1:b0:418:1f20:5522 with SMTP id d17-20020a05622a05d100b004181f205522mr4055560qtb.43.1697866890743; Fri, 20 Oct 2023 22:41:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697866890; cv=none; d=google.com; s=arc-20160816; b=e+Ihn95d+kJnosZ2tgYhK/umLqKcvRcCss55BXq+Rrt+osJtceY3Ow2MjizkjPFbHP gW+b1a37j/lnlG/gwtcexeaGFlAXW2Eg0gexVufaPOwZIJ2fyPxKjYy5yFnzDyKbTPwd 6wyihqBGF1sYg05v69S1E4msIcok+Y7G5AEGZjwKt7YRLHEJsiKWmk37L4AIEqhHumCT 2fFs79thbR4/Vs3XW+VlRaK3pLMqgW7V9UYVo1of9q4qC6Czd3/Zra/p1nMmTviK//yE SzkN2l4RpZSYNSIMn2p/dcaOJJUBwjYDNZ1ho8vNn16eik/OIrIfBSEwmryOiB6bzE89 5/nA== 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=obVN/oM2bXVamnLyb5ISYem5fSyUtTRzscsV4QjvQeg=; fh=TYrED6TOMxGX0VC4GtjviASLbYyJe19+7/tKWjN44KQ=; b=PasvPD4mhr7m5M7nH1eAQxREA9zPqSflOA0vNVps98+CvuSx7JwDNdty+gPW2xyUzT OkcU+MeVzwD6V5zLMf0qhTRIYm4+Bku1075vvZCoC52Vj6lqjnjDUmAlyzexlXpd2HVg SuXPLaNjruOYpjn+1XFvDuSMZn8rG+3nGZPaccwKu8NEbcCho6ipM1jAEX2irly8F2OI rCoIeAxMjcAWRodKPHFSyxMCJKSg1tAKcyI8xzwI0aoRK+rNnV2aX0/DOPANrnWf/ZbK 9W7TIVZF0SR4I0m/clBAkKdrgApSaLbUQ1XvxwU3JE2AdQm97m9GVQGwqP3An0VVCkeb idXQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=EZcE7Bm5; 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-20020a05622a034600b0041cc53aac18si2226375qtw.644.2023.10.20.22.41.30 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 20 Oct 2023 22:41: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=EZcE7Bm5; 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 1qu4eT-00033d-6w; Sat, 21 Oct 2023 01:35:57 -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 1qu4eO-0002m1-La for qemu-devel@nongnu.org; Sat, 21 Oct 2023 01:35:53 -0400 Received: from mail-ot1-x334.google.com ([2607:f8b0:4864:20::334]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qu4eM-00018G-P8 for qemu-devel@nongnu.org; Sat, 21 Oct 2023 01:35:52 -0400 Received: by mail-ot1-x334.google.com with SMTP id 46e09a7af769-6c7b3adbeb6so1081086a34.0 for ; Fri, 20 Oct 2023 22:35:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1697866549; x=1698471349; 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=obVN/oM2bXVamnLyb5ISYem5fSyUtTRzscsV4QjvQeg=; b=EZcE7Bm5ILIRmi9vQqShbhrO2HytUwCrqjHuNOdhMRuyPWz/a8YWT9++txVt3NZRot 16HMvVaPKWGrqpMm0x+u2OpqgEsU2/r/ioiBggpG3MpDkFGTND6HgpDh9RCJdkeeocsJ 59bZ35ZyCgbU0wju0C30zuUxkhPF6BUCTeZkjwZumTrdyBJxo3gOnKamRJMxOx2NwjEN qnt/vR9ZDWq8GCpYptpbfzQxiwbYJvUwdvZsknE4CY+cAvWKIwNtBIhBk1hlxwRKtQpC 5FEk5nvnfR8cgwvDWIyGkkUI1Xf1GZ+N/ok18TjWfmxx0t9Ao0yYD7azWW3xaDwNtqtc glLQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697866549; x=1698471349; 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=obVN/oM2bXVamnLyb5ISYem5fSyUtTRzscsV4QjvQeg=; b=TKblLzI59+Y0TPRhTnJCTch/EEzFE4bHglVPymH0ToFLRHDY3IyGJDkjYusnOuz4d/ NPMvvDveT07mCIO3ClTg7rOVBYlzA05s33YsAtFN6xv/vM2QnPgmmRlBLEyQpKwZ/geM UpsFp5oFtIWBZzs+uDVMI3TxJewch0j5mDI4qj6FgdujDy5Nz0xbR3uEPl2iSb6X2Uca /0EX92c1N2SV79CSvnN9rMHVpXEiPiPqc9E5FJDJsJAyK78GaiDcsTzdKPQg3PGtSHN5 CiMCpPcRh2ualvt3rDunm6N3lwirbTYRs0WiclLp4Ke6eEX2uDs02tI249UAkbIKHL0q 5CtQ== X-Gm-Message-State: AOJu0Yywl2qACQFF82AThOcDKbBgaFfAbXJVCRV0DUDxWci5j27Jmm1t Tp/u+QEu8Q5Kp+94feimE9Cd4A6+NV2cnMz9F7s= X-Received: by 2002:a9d:74ca:0:b0:6cd:a4f:3dab with SMTP id a10-20020a9d74ca000000b006cd0a4f3dabmr3299959otl.29.1697866549745; Fri, 20 Oct 2023 22:35:49 -0700 (PDT) Received: from stoup.. ([71.212.149.95]) by smtp.gmail.com with ESMTPSA id h1-20020a62b401000000b00690d255b5a1sm2427978pfn.217.2023.10.20.22.35.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 20 Oct 2023 22:35:49 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: mark.cave-ayland@ilande.co.uk Subject: [PATCH v3 60/90] target/sparc: Move ARRAY* to decodetree Date: Fri, 20 Oct 2023 22:31:28 -0700 Message-Id: <20231021053158.278135-61-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231021053158.278135-1-richard.henderson@linaro.org> References: <20231021053158.278135-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::334; envelope-from=richard.henderson@linaro.org; helo=mail-ot1-x334.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 04715cf068..1262b5c7bb 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 5c76933970..73c9806119 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) { @@ -4320,6 +4336,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; @@ -5230,30 +5262,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 Sat Oct 21 05:31: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: 736630 Delivered-To: patch@linaro.org Received: by 2002:adf:dd81:0:b0:32d:baff:b0ca with SMTP id x1csp633539wrl; Fri, 20 Oct 2023 22:40:23 -0700 (PDT) X-Google-Smtp-Source: AGHT+IH6GRVlqXwBPSb/PT/s2Lz/bdYrM0kgS9Zea36+exJFbOWKVB/JT3WOuzGdNeM0F+kwHrmP X-Received: by 2002:ac8:7d50:0:b0:411:f5c0:5db with SMTP id h16-20020ac87d50000000b00411f5c005dbmr4329877qtb.26.1697866823331; Fri, 20 Oct 2023 22:40:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697866823; cv=none; d=google.com; s=arc-20160816; b=YrJlXRDKeluXebSuh4dqPanxULDIBeZXZ0EaV2MLQuKoDAWEKv5Bq55dn5iueB01KJ jlKoh/hakC5PQULFiRfDqhO44bEFTWQEnOSP5VMp0HlyPZIs0pQ7ScOTcf8K0B2F3T/P oujQ31VOYM9nvhvlVrEZ5v9JKP4RiiaGsfD66dSOLOtbHvI9gTnHRiwzmVgx8jZ2mVfF 7/7YB3wj2qWJJ5CRkM5fMS3kyTA3e4AMsNvzEns8oe+TxGPpYUVnBXMedjaj5xt+6RUk r1V5mtO7v9SntIHzqdDkpO9AbNUI9yf2IDHnkdp3LNXPH3VoCnpbo7LIs3s1SCW5Eti+ poaA== 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=Tb+DvB0lLnt7NappAJ/SRfdu6K3CtLmlY5bIBc8m9M8=; fh=TYrED6TOMxGX0VC4GtjviASLbYyJe19+7/tKWjN44KQ=; b=rN9lQI/0ACjyoMfrfKg3ovWgg2Nc8CXSqbvqdAR0F8ddkTkqs1I+3Kbv0RC6XtbF6I TM0EqgVO0s7mE1EI67DnpCFrnRxI/RlSvp1f4leqoQtSFsvHPUWX9pmi5rIN8SIj+tOH oHBkM2O6BNnxut31zrInGbCbKECtigYth+zeGg3QbdkU3I8TH32OkabHleZC2V/GDyL8 F83zmvvPLgH80qITRwhyPSxEa0P5B0G9iFAqyTRwPuDPCO0SjnXkEFvLDG3X/8qG68J/ 1j6EsNbk+nlbjXrz1iaQQPB4coDYoB4IbMQk1hVct2OHsUpeTK7jTwYhkKZpxfZbnrpI AIlQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=k7msuq3a; 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 y14-20020a05622a004e00b00417979ae590si2504901qtw.539.2023.10.20.22.40.23 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 20 Oct 2023 22:40: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=k7msuq3a; 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 1qu4eT-00036R-UW; Sat, 21 Oct 2023 01:35:57 -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 1qu4eP-0002ow-IF for qemu-devel@nongnu.org; Sat, 21 Oct 2023 01:35:53 -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 1qu4eN-00018X-RR for qemu-devel@nongnu.org; Sat, 21 Oct 2023 01:35:53 -0400 Received: by mail-pf1-x42a.google.com with SMTP id d2e1a72fcca58-6b497c8575aso1492093b3a.1 for ; Fri, 20 Oct 2023 22:35:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1697866550; x=1698471350; 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=Tb+DvB0lLnt7NappAJ/SRfdu6K3CtLmlY5bIBc8m9M8=; b=k7msuq3aa/qSxlCBzAF2U4LxES5NH85y3LVTZE9VSjM9KaMI7shX94fEEeX202xKew 94+lswDYTiAclmI5ClCNVxekrNUBKCNusiY5KeP+hBid1QVbH1DuU0qufP546UCdY2rW wkD0S870OlgxFGTQAIx/zYrkuKMVInUFMWhwz2VVqRAslmcqUVJMGmVjJZZ29g4+wg3f FusJ8Chy6HjipmJ4ESjAei5sI34mFswWDeXZhK7cyLadghrb1X5PfLsHPdw/rj9zMOJL I+5yq7/wLWOE/IVI2Lnp/XnwfqaTLQtTX1OHjmpnZPji2I1OItRwd7O3KYZJB+Z+1k/h dgQA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697866550; x=1698471350; 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=Tb+DvB0lLnt7NappAJ/SRfdu6K3CtLmlY5bIBc8m9M8=; b=G49kYagyjjENBzVVCElM0uerJJ5DM5dFw9+jSctfyeSS5lG/+L+trN/GrnQHnqSI5J qvfdIORXcUzSF6OKopkhXepNCT4p0vMdnRWYm1UoRYaK5/hNVcgnZZ4ElG1fofQJh0PP DNTJ8GKzPZHihaEqs7Bd9PYkwxu5N4oXrMHFt6lKDjzwljYnNeS/QbJZ7XJcljv6LHMg qoO3AKGxtNNtriL0vyblh2iN+Tn4jTJ9NrYZ8rvYOvzMe9uTPmDjJwJq3lKcVIdiQmXf Vf0elDH+30KAjaQr/XT9o1qSpDnjiGRJABLTTz++aitfW1MJsemuAxtfpxSU937Ys1Rc kcTg== X-Gm-Message-State: AOJu0Yy5DA5Xp3aV8Cx96+voOzEjcEE38KwcDrLCWoP7ziDuIKTS5i+W 6l1NMP6R7mtyXHV4mjGeLsh+judeVJBfzdBz9eM= X-Received: by 2002:a05:6a20:5481:b0:173:e36c:6d03 with SMTP id i1-20020a056a20548100b00173e36c6d03mr4829260pzk.22.1697866550466; Fri, 20 Oct 2023 22:35:50 -0700 (PDT) Received: from stoup.. ([71.212.149.95]) by smtp.gmail.com with ESMTPSA id h1-20020a62b401000000b00690d255b5a1sm2427978pfn.217.2023.10.20.22.35.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 20 Oct 2023 22:35:50 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: mark.cave-ayland@ilande.co.uk Subject: [PATCH v3 61/90] target/sparc: Move ADDRALIGN* to decodetree Date: Fri, 20 Oct 2023 22:31:29 -0700 Message-Id: <20231021053158.278135-62-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231021053158.278135-1-richard.henderson@linaro.org> References: <20231021053158.278135-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 | 56 ++++++++++++++++++++++----------------- 2 files changed, 34 insertions(+), 25 deletions(-) diff --git a/target/sparc/insns.decode b/target/sparc/insns.decode index 1262b5c7bb..855627b55e 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 73c9806119..92a6988fae 100644 --- a/target/sparc/translate.c +++ b/target/sparc/translate.c @@ -2727,18 +2727,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; @@ -4352,6 +4340,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; @@ -5265,21 +5283,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 Sat Oct 21 05:31: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: 736668 Delivered-To: patch@linaro.org Received: by 2002:adf:dd81:0:b0:32d:baff:b0ca with SMTP id x1csp634653wrl; Fri, 20 Oct 2023 22:46:14 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFT0sgsFwOvzsvFBfdk5iBXZNPNz/pN1AoYwVybDjqqE58fni01wa8la+Xq8MllbjFAoQ9E X-Received: by 2002:ad4:5763:0:b0:658:65ed:7e8 with SMTP id r3-20020ad45763000000b0065865ed07e8mr5074796qvx.57.1697867174179; Fri, 20 Oct 2023 22:46:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697867174; cv=none; d=google.com; s=arc-20160816; b=MGD3uqvRPmDSIcqga9o+IZ/JUvpoXU6G/PMSQxQxw8nGHfZ40FjFzBhjbOv6BbelmQ KjAWPljbfjB4AJLqCU9W4lddwUOHLdnpxx6Fmv7+yrtJAiEQQJB/CS9HppAVtigmqDgM KRtEMu/5vjaYsuqKygOQ1BB0qEf2Sd34xpAStMM8ucpvJK5XYOiC1mjH2qCViH8MCXz9 VqjhLNGYRy42esd8O+JJlDK4Ofn0n0AK4crAvQUX0AlklFP2FZxmpBoyVvTyHbJtHoAy XK8A55iK5TtHRN08DGEdT/yo3a2vZjK3FR/wTKt7obUXVV6Q4+61U3Hl/hebxRa8m7KJ xZZQ== 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=rCBYXApxSIdghuI/qlMU2hqEbFXCl70ucXr5x/f3RzQ=; fh=TYrED6TOMxGX0VC4GtjviASLbYyJe19+7/tKWjN44KQ=; b=VWCPwaHQx//dj2iydi1rSkVWOKwGZbPe4EbqyeuJ3WnNCdOLS1L07Efp1kY03omXop uIAZj6ea8RUWf1WwZdAWEnqh4q0uFJQ3reebRIZXke6QUDPofeCD/oq/HYuIg/fXPHTX haRsNqav+CzjnaBe7MECf514YZx+6wVInMPEy2mdr+otilrVo5/bksCK0/k6hnJ5Zfhk nG9TV/+xuOoRKGnzl/TDvxG1hOCBJL8zWPRY4oSblq6c51FoTdLfUl8Cc8zxlJpJP1Kq NbX22uQMc6VqlAp2UxCtgs/x6wEDfWzZ4ycnSHs3jxUHkFNT9bE74aS/CXl7B6bT/+go nv9w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=zpp+lWm1; 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-20020a05620a24d400b0077894fa3885si2392224qkn.268.2023.10.20.22.46.14 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 20 Oct 2023 22:46: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=zpp+lWm1; 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 1qu4eZ-0003Kk-AL; Sat, 21 Oct 2023 01:36:03 -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 1qu4eQ-0002qD-9n for qemu-devel@nongnu.org; Sat, 21 Oct 2023 01:35:54 -0400 Received: from mail-oo1-xc2f.google.com ([2607:f8b0:4864:20::c2f]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qu4eO-00018p-Kw for qemu-devel@nongnu.org; Sat, 21 Oct 2023 01:35:54 -0400 Received: by mail-oo1-xc2f.google.com with SMTP id 006d021491bc7-57de6e502fcso906994eaf.3 for ; Fri, 20 Oct 2023 22:35:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1697866551; x=1698471351; 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=rCBYXApxSIdghuI/qlMU2hqEbFXCl70ucXr5x/f3RzQ=; b=zpp+lWm1DkDRjSXa+YrRCb8c8quq093lIGNDRSr/zrUYsxVEuB8zSN5dIxBZxn6s4N MtceZYDadGoTeteKVj9XCDCUtfqSqJwSRhdqgDrlFnGj0eTlOdAwu8Wbo+IScBOKLpr7 y+gtZJjPTO6Mq73Y4c3J8eutupd5YVDQIC718cOsMk/X4Idq2CPQvmQAnXRFLfVLmGlk MaJ/LXcUH0w60CXu10V2JM9Q8tKYBJGOnjs48L4cFQP/H1JbKSvI1vdsdpoiv17ioH0w Dvx8Usg1jDdKJF583+vYReIS8ft9IOvJLzT/o2KawRCHmB1BFLxaMbiB2SPDxhFqFcik G/oQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697866551; x=1698471351; 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=rCBYXApxSIdghuI/qlMU2hqEbFXCl70ucXr5x/f3RzQ=; b=RiH1NzXGgj+MwO4VwbVBkdlOtSKbfOYcjP0Wr3GA76vLnrbKaYYyEGEbYIjjSv5gQJ W+eofVCRG9YaG2JhYtctQaUGJouRWpnUQ1O7lMGEr1mBG3DTSrDPN3O86GjWuDe2bcwh zjxFFs4tcx/hfXD/U+F8Y2uHM94ZqhU3+FHgRE2SDJaps7lnYR70H46ytb3Hs4jqctnC PZgGtdtTOn8+/8l5dm+nAYu11xBHw2uYuup7BzO3P8BxsX1q2XRhdcbswpGStFWyXPSm K2ADBmzBQpGB0BMYARiXTzcGrpPZdk2gJLSq618/zomxzAgmzaRDRsHdIQO489esUpLW 69Tg== X-Gm-Message-State: AOJu0YysE007El0Ty16GNFGkWpQExtwnmcfog4/bQJqwFn5jrhI0+jhj pkO+aJK1S4vHVNi0U/25xuwCymAM0voTjEqzmhY= X-Received: by 2002:a05:6870:2893:b0:1e9:da6f:a161 with SMTP id gy19-20020a056870289300b001e9da6fa161mr4749040oab.3.1697866551284; Fri, 20 Oct 2023 22:35:51 -0700 (PDT) Received: from stoup.. ([71.212.149.95]) by smtp.gmail.com with ESMTPSA id h1-20020a62b401000000b00690d255b5a1sm2427978pfn.217.2023.10.20.22.35.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 20 Oct 2023 22:35:50 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: mark.cave-ayland@ilande.co.uk Subject: [PATCH v3 62/90] target/sparc: Move BMASK to decodetree Date: Fri, 20 Oct 2023 22:31:30 -0700 Message-Id: <20231021053158.278135-63-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231021053158.278135-1-richard.henderson@linaro.org> References: <20231021053158.278135-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::c2f; envelope-from=richard.henderson@linaro.org; helo=mail-oo1-xc2f.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 855627b55e..9ea5e09dfc 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 92a6988fae..bccebfc953 100644 --- a/target/sparc/translate.c +++ b/target/sparc/translate.c @@ -4370,6 +4370,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; @@ -4920,7 +4932,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)); @@ -5285,15 +5296,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 Sat Oct 21 05:31: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: 736662 Delivered-To: patch@linaro.org Received: by 2002:adf:dd81:0:b0:32d:baff:b0ca with SMTP id x1csp634581wrl; Fri, 20 Oct 2023 22:45:53 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFdakm2mOGwwFpe5NsDSNRZ18bOv/VuZRjuLcKN5C2Vmr2TMmqqkMNKKaBhkgwpz8V1jSrt X-Received: by 2002:a05:620a:2941:b0:76d:aa23:f8e1 with SMTP id n1-20020a05620a294100b0076daa23f8e1mr4673600qkp.27.1697867153690; Fri, 20 Oct 2023 22:45:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697867153; cv=none; d=google.com; s=arc-20160816; b=P5MLLVzyOOrXSgu9mAXIHiibLuf2W4JO5Ly3+5el3dfh2qo/6d4j/1gu3uaZ6f+LzV o73D501MAnPCaxbo8/+pnpzwFCz/+XLpZrqfcR/9LeAGgWz8xYPOesygxUlp46Z6crm4 WAYFOr0E3zLpBwEXIeRE7ShccmK5MHksBA5uVFP3Dk9DfKaOeTtJPjXD6BII+rqU1HOP DfeXNFEcukdTKZ7oVocw6LqJj2QACiYxIlUZc5npzJi5zZwGV6lvYfU+ZzUd+ROYdlTn /9pDApXmqkxV6fmX+DaC4NmCOYXS2fc3Ych29xbGwGj5vYOrdrAMa6B+61h6PByWbAtW 2Iqg== 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=b8dGhFnSwGD+IVCD+Tds1f4W8LU5kAw2CBFihjzH7f4=; fh=TYrED6TOMxGX0VC4GtjviASLbYyJe19+7/tKWjN44KQ=; b=M4nQWKeKOg9gwcHBwNUJEw3pCxPoQIUEvVCzpA1ZfA73zvyzIK5JmQBHjIXCtCbrJG y2dBd7vyJrZ2QRsIAWzClYpdwpCsLrDAIGYqSnZCvER3GpZoBa26NYox6GvnuRGzZ1wj xEiKqyNmwtgACjs6vzEYw8BbVtJBPlA4HARGOfpfnmE0fbpegDXaHW4MJTiPCGOf9pRS hb6zxlIubLq7Uy4jsUKLrL1zWNNlgcmzK5pdGHtRD528/vecQOkLUIVRmrpaR9Dp2hYo iCxXMEkuzKls+OqAEC5OPany423kf4sQk5UmYgVmixq34k9TKNKdEv6JSPyullp8ZJ3h Mn3A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=hoVNzPlL; 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-20020a05620a0f0c00b007789262de78si2631217qkl.539.2023.10.20.22.45.53 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 20 Oct 2023 22:45:53 -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=hoVNzPlL; 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 1qu4ea-0003La-Ap; Sat, 21 Oct 2023 01:36: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 1qu4eR-0002xd-Ni for qemu-devel@nongnu.org; Sat, 21 Oct 2023 01:35:55 -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 1qu4eP-000196-KJ for qemu-devel@nongnu.org; Sat, 21 Oct 2023 01:35:55 -0400 Received: by mail-oo1-xc30.google.com with SMTP id 006d021491bc7-584042a01eeso911565eaf.2 for ; Fri, 20 Oct 2023 22:35:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1697866552; x=1698471352; 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=b8dGhFnSwGD+IVCD+Tds1f4W8LU5kAw2CBFihjzH7f4=; b=hoVNzPlLfTkk3f4QEKvytshXqoWAcRVm6tD999WntlUw9wcCDSzqX8pdqpHhmPPLy/ KZL5gUo6wD48920lzsH9xrxIeBsqN9ccJVG7HV0K8MkZZlvklfX1L2jWzRfLsrVF8hii la39mvYdP2XIc5FXSsR56bWGeNhqEXjseqdz1KXmPzZOeI7a6FEsVXosQBY8fuFtlJP1 fkBK23gTse1Te96hvI+SqLBlCAN7paUb8QZIpfeWNaU9oPTOVZBkdLD/4hdqdTk+XWEp KMUgI9XQ8wktqbsu3YP6X6z5X/x0cZguWMFJGVqrzuLLNUL58yoGx9lHR0YsHeGpdz3V u/ow== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697866552; x=1698471352; 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=b8dGhFnSwGD+IVCD+Tds1f4W8LU5kAw2CBFihjzH7f4=; b=YdqPKQeCYaLjhLHl7mI1tFxHjbqKuHdoaxNByMEXoxUunPqEpXbOb+jXn//jWbtRE3 R5n0zcs+vkBP5cV6jgL+o2sZCy2o1FDVGJ1QBdOd02zoewTS7feECQhf4G796a7Qu8D0 c4gWecryKE6eQjdpPCbzqnD8MD+iTLqf6Axx79A2orUf1Fc0GTcxp2/Dfb87OuM1+s5F XMQI1990xtJuFKsxVCQ7N+aOP39k/VFnXw77jbQ0jpLIkKOdFCzv5CS6+tstbcRDir/4 TqVM+nfnnPw6XcGPiyiF8l8WTOLvQp0lnZQ1K3xpFrVUrwrxpbxFhLh1WEhlvA6Pilng dVYQ== X-Gm-Message-State: AOJu0YyrUvaajKFcSeZGROqYS23LderH7EEeWiRpPoVWTyEgeweG3942 mESKr++mHidIHgMefAIvMcq3nFuM9vIdVg4qbTA= X-Received: by 2002:a05:6870:a550:b0:1d6:5b09:1584 with SMTP id p16-20020a056870a55000b001d65b091584mr4609322oal.5.1697866552222; Fri, 20 Oct 2023 22:35:52 -0700 (PDT) Received: from stoup.. ([71.212.149.95]) by smtp.gmail.com with ESMTPSA id h1-20020a62b401000000b00690d255b5a1sm2427978pfn.217.2023.10.20.22.35.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 20 Oct 2023 22:35:51 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: mark.cave-ayland@ilande.co.uk Subject: [PATCH v3 63/90] target/sparc: Move FMOVS, FNEGS, FABSS, FSRC*S, FNOT*S to decodetree Date: Fri, 20 Oct 2023 22:31:31 -0700 Message-Id: <20231021053158.278135-64-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231021053158.278135-1-richard.henderson@linaro.org> References: <20231021053158.278135-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 | 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 9ea5e09dfc..63fbc19fc9 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 bccebfc953..fb44c5ad73 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)) { @@ -4920,6 +4925,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; @@ -4961,15 +4987,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; @@ -5297,6 +5317,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); @@ -5484,10 +5508,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); @@ -5500,10 +5520,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); @@ -5541,11 +5557,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); @@ -5559,11 +5570,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 Sat Oct 21 05:31: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: 736656 Delivered-To: patch@linaro.org Received: by 2002:adf:dd81:0:b0:32d:baff:b0ca with SMTP id x1csp634457wrl; Fri, 20 Oct 2023 22:45:26 -0700 (PDT) X-Google-Smtp-Source: AGHT+IF8qUlXt2Uw3hiI2oYEd2NdsGipIfgn9JmCv5rc5yJwESnVLPsSFPSB4lbtdkXKLFrbHzYp X-Received: by 2002:ac8:5cc4:0:b0:403:f438:1803 with SMTP id s4-20020ac85cc4000000b00403f4381803mr5300146qta.3.1697867126133; Fri, 20 Oct 2023 22:45:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697867126; cv=none; d=google.com; s=arc-20160816; b=0eYLlTaJDth5ERKI97neCyu+UFdzqilqMBCed0H2MNCZ3t6XxjD64oGERCboWHseuL 5of/vsf9M4Gx/FgltRyeAOLmx1VFiuitPX48YLtHc/KNZSxA5yxecRpzaalXjUxjOHzn b+jk7INZe+8JGhVu4rh9Fnv0OvWMPHH/+cpLMxsp2R3WhftnJ6AvTInO9dQbKTZ+12e0 xzQAtdmFEWRFz5j0yKNRImPXMbkq+MqJidX40KHnplOg5FqcjjuANyaXDZCLPy29WCXc ejsM2cI5Ul+hBZrmD88xIdV1jasa/43pVojaarosT9gmTaMNWkiOgZHGynkEcwiFxrJ4 aJKA== 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=FCdwEa7knbftX9PRssf7B4b7jq791Tj+GrBaP1bRs8M=; fh=TYrED6TOMxGX0VC4GtjviASLbYyJe19+7/tKWjN44KQ=; b=fEJ4scv4/z61MSISrKeN0O3bocjPM77ufCDNYUW9G0ff3aWgpniPKCrP1eWIZArPwY 3rAwcckOSiNSndRZ2BWC7uP4IPabM7cAmfXGn0rUwBTZeJ49P483lmllx4XGa+0IX4fz zd34HTaIG5Mqchr6YI41KbHUZTEa+mwIP2A5Q50RV2FTout+5CxiPKCR2FTEJ9Pk35lj HqKdtZSmWwaCT2gEF59YNGJ5YkvIHjadPga7Yo1TwET3IcYqkP+pyOwxRsm3Zg7i0vCE G2QpzX1tHRBSrvad/VtFiFmFk06ibM1xUfs2DRL0FRoR52VowoWtF83kQDxQVn531XxD iARA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=wQqyUTh6; 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 p5-20020a05622a00c500b00417ce695031si2544437qtw.258.2023.10.20.22.45.25 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 20 Oct 2023 22:45: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=wQqyUTh6; 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 1qu4eW-0003Bi-Ga; Sat, 21 Oct 2023 01:36:00 -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 1qu4eS-0002zG-Eg for qemu-devel@nongnu.org; Sat, 21 Oct 2023 01:35:56 -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 1qu4eQ-00019Q-B0 for qemu-devel@nongnu.org; Sat, 21 Oct 2023 01:35:56 -0400 Received: by mail-pf1-x42d.google.com with SMTP id d2e1a72fcca58-6b44befac59so2040679b3a.0 for ; Fri, 20 Oct 2023 22:35:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1697866553; x=1698471353; 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=FCdwEa7knbftX9PRssf7B4b7jq791Tj+GrBaP1bRs8M=; b=wQqyUTh6OdHApn+xLwfIC9Kyzo7OAImItgFlNHqhTfzRYS0HJ3+0K8zcHfbidOdshH dQ7dGhM2EO4cdTot+gJYEhvp7tcKSLx59u6qfrb9RY2TN+jqIIlfv3h8KNt0whN9TTyQ KChoPEZtqS2g9mtkpIgCFqKVLGcVNo5tjW/w9ogsb/wFa26axWgTXpyDMzaRKq+blVA8 95NcqEQwbkXf/l1AOAwS4uO26vip2fkhXjECMrcC+oGowuS/w6h533SDY/Dqr4K69cgn FqBnObKfmVSwZOhbGCZW7mhrBmubgZY7dNscgjQQrzd0LwcsHR3tLYx+HRR4717Lj8qR cg2A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697866553; x=1698471353; 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=FCdwEa7knbftX9PRssf7B4b7jq791Tj+GrBaP1bRs8M=; b=DzLWbz5vNqILC2zXlCwzv7gJykbiu6rGmTX0zOWz8KEU/rmBJjayalOfU+uxiJqSaH ryfprcXTT65h6XuzcTCQ7XjOrb8CWiaO4gTvC3gstojTkxs9FoFe/+3YqMHRyRDvH2Dh xYFNtWFxeOnyzQ2mXkDY45vJoVw45Tdw290l/03ebMDKzD9RF6LQ6LttA/DNMYygO4yL Gcl/vTktdm+DsRMqOeODxGbWeh9BHV4NTkNLgU3wabMyKqpq3hX2sCxVDkeIsRnmhxaj pqiXc1E4P7RELHzvUJEDBZck1J8FV3B9P7rYujv/L+/UILUmLcx8pXQBoyze7XeLI8AK Y2+w== X-Gm-Message-State: AOJu0YzSWUy+tiHCqPoKeIX8jz3mc7tuXghQ6AYydbpoHbbH9W1otRTa hSioY2nsCEBnR2gkuM0EVeXQB8j1NQxjUq0MKIg= X-Received: by 2002:aa7:8e4c:0:b0:68f:c1e0:a2c4 with SMTP id d12-20020aa78e4c000000b0068fc1e0a2c4mr8908696pfr.3.1697866553005; Fri, 20 Oct 2023 22:35:53 -0700 (PDT) Received: from stoup.. ([71.212.149.95]) by smtp.gmail.com with ESMTPSA id h1-20020a62b401000000b00690d255b5a1sm2427978pfn.217.2023.10.20.22.35.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 20 Oct 2023 22:35:52 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: mark.cave-ayland@ilande.co.uk Subject: [PATCH v3 64/90] target/sparc: Move FMOVD, FNEGD, FABSD, FSRC*D, FNOT*D to decodetree Date: Fri, 20 Oct 2023 22:31:32 -0700 Message-Id: <20231021053158.278135-65-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231021053158.278135-1-richard.henderson@linaro.org> References: <20231021053158.278135-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 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 63fbc19fc9..4e4336a4c5 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 fb44c5ad73..5cb8edfaa6 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)) { @@ -4946,6 +4951,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; @@ -4989,6 +5016,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); @@ -5091,24 +5121,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); @@ -5321,6 +5341,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); @@ -5504,10 +5528,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); @@ -5516,10 +5536,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); @@ -5552,10 +5568,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); @@ -5565,11 +5577,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 Sat Oct 21 05:31: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: 736652 Delivered-To: patch@linaro.org Received: by 2002:adf:dd81:0:b0:32d:baff:b0ca with SMTP id x1csp634142wrl; Fri, 20 Oct 2023 22:43:42 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGoNr9q52q+CrWjZHi8gvTvmJgxPIU/5MF24Y3tQdUbtDtoeDTUaSLdbxWVQ/2YMZ46oiTH X-Received: by 2002:a05:620a:24cb:b0:774:ebd:9f8c with SMTP id m11-20020a05620a24cb00b007740ebd9f8cmr3551240qkn.60.1697867022271; Fri, 20 Oct 2023 22:43:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697867022; cv=none; d=google.com; s=arc-20160816; b=rbwk8IfJjee/vw1tnmlkCPTsL4rgJHgZE0M+rdLkJFIVTtAuABiW/vpU0WavatI1M6 vqDUrp8dn4gCj+7cYMhE+++6EFrdSjrLVgqMGN/aCPmXTKT91BwZc8qdP8ElhJkdko2K vwlhfFRoIekAl1u7hu5L/91sRahvrdqXtkl5WmH02RjFao7nz9bVM71v6IjlRi0qQmKz LtN7SxRLPFbHImpZqIY37/JU3zhiYBtSpt484nZltL7yRMsOQKOVhwecMDg+AJU7j8wf boBkH2IhuP5JgEIrRvZS3zoA3tS7icBUp91dt1neP/QjiwFDg39dsC+1rR2Ztyu3Eqcc opbA== 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=/Qe94okp9qWU5ibV1SGRQ+D/OhPCIVc+ZR4AAM+QG2U=; fh=TYrED6TOMxGX0VC4GtjviASLbYyJe19+7/tKWjN44KQ=; b=jG8tkmQZSpDf5kv+HHfYJaA50b/HV1Rv0MfKamCmbLjjrsAfE1Q8fgW6CB1cfLw2gx P8PqH5HlW/k6DQD3cJFce2uCsj7uAX1QMV6RNJdLekDtwJWgI8cr9ubPR9S0fZrj1v5C SnVFnyNCTkzT/Gd36LF8UXvY2Psg4ylD/rzo7Ago3oUZng5rCNHHGPOiHqmgNSX92W9a Bf9hLR7pTZcwPLm+Uz1N4EWS53M2wjtKWzEKJw9SV91ExPFGzFWMpSwHM8ZqZwNqUqyU KMmChSzPBwI3IHPCR3s7EuflfjQjSPyBPNeVYf+5rtNjRjeYby15dpjPpelsRHJRplZz 6YAw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=rhfXRCCb; 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 bs17-20020a05620a471100b00773fa71cbb8si2497566qkb.512.2023.10.20.22.43.41 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 20 Oct 2023 22:43: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=rhfXRCCb; 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 1qu4eW-0003HQ-QF; Sat, 21 Oct 2023 01:36:00 -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 1qu4eS-00032W-S1 for qemu-devel@nongnu.org; Sat, 21 Oct 2023 01:35:56 -0400 Received: from mail-pf1-x42c.google.com ([2607:f8b0:4864:20::42c]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qu4eR-00019f-0t for qemu-devel@nongnu.org; Sat, 21 Oct 2023 01:35:56 -0400 Received: by mail-pf1-x42c.google.com with SMTP id d2e1a72fcca58-6b1ef786b7fso1419273b3a.3 for ; Fri, 20 Oct 2023 22:35:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1697866554; x=1698471354; 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=/Qe94okp9qWU5ibV1SGRQ+D/OhPCIVc+ZR4AAM+QG2U=; b=rhfXRCCbZRKW/qILEA0zxKpA36Ilqa5UAApVv2mGhr25Ca34ShNb+dJ2dCA3WHl3XD aYRx6ytRwwuA10VkjNjNFDkcF9b2PepbuZc6ay49q6thMjHxxVYtihmETz+C+isDw+JG 0/gbZRI+ZqUHlrOJJ948A/derwmXshP+a2Isd/g1h1TGOlAFy7J4QBHHuNV1edEQQ+s+ Hjg7M0v3WTIQy0MNTj1zvyWaaNsqvw/lwg9SHXSEH0VPeBbi2EsAb3YZarAVFJtuIp9o xQnyQ2dgRpoIk/55strVq+B4AP661w/RGBTyg79gK0jazrPvUQ/nBE4IfgCcmXc+fIfb WJgQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697866554; x=1698471354; 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=/Qe94okp9qWU5ibV1SGRQ+D/OhPCIVc+ZR4AAM+QG2U=; b=uXbtsd/KPqTrvY7hwzUppNX0qNBDDNCcfiIF1UxvZIcpFfeVc4Fqa8VFW/uFF3Pw/q sW1wHs3tk6WMo31xti09ZmyREBcgEfDcLrwrsPd0oTKLZuZF+bwPMabrAielMK+HP4i3 gkSQsrWLNfyN6yEXV4+szz4X4JCf2wcJr/w9TfIEoQ2VB+V9VpHBpCMUBAi93n3PLytx m6ULzD58aAbbY5dsBEDRTfVwqPRUm9b8qrOpcsYZ03C2GeUY+iC7vQmW1SF1d0upbI8H OVbOSeRnTK+G6d/u4xujNMGcr9bDdWEr1QazmJquhorVgZ7nfmujm3Z1plFtRe4bRjXa J0NA== X-Gm-Message-State: AOJu0YzdgOMducGO7NdxjjwUiMWQx2kD2y51GGEe2WETqrVKyRIkGxHS 2sgiT+4Vl2xRcfic8Kc91pblHPmSYgdUZOlSVPQ= X-Received: by 2002:aa7:88cd:0:b0:6b8:a6d6:f51a with SMTP id k13-20020aa788cd000000b006b8a6d6f51amr4663853pff.31.1697866553773; Fri, 20 Oct 2023 22:35:53 -0700 (PDT) Received: from stoup.. ([71.212.149.95]) by smtp.gmail.com with ESMTPSA id h1-20020a62b401000000b00690d255b5a1sm2427978pfn.217.2023.10.20.22.35.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 20 Oct 2023 22:35:53 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: mark.cave-ayland@ilande.co.uk Subject: [PATCH v3 65/90] target/sparc: Use tcg_gen_vec_{add,sub}* Date: Fri, 20 Oct 2023 22:31:33 -0700 Message-Id: <20231021053158.278135-66-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231021053158.278135-1-richard.henderson@linaro.org> References: <20231021053158.278135-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::42c; envelope-from=richard.henderson@linaro.org; helo=mail-pf1-x42c.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 5cb8edfaa6..0ee93b8ae2 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" @@ -5470,15 +5469,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); @@ -5486,15 +5485,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 Sat Oct 21 05:31: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: 736663 Delivered-To: patch@linaro.org Received: by 2002:adf:dd81:0:b0:32d:baff:b0ca with SMTP id x1csp634589wrl; Fri, 20 Oct 2023 22:45:55 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEHpQ1LJWwqi7c3tIEArpoKmVOnHSoSCStllOBbNffZJZ9YuQGEtQM68W2JVmtfNmTGYmeg X-Received: by 2002:a05:620a:4482:b0:773:b543:5989 with SMTP id x2-20020a05620a448200b00773b5435989mr4412116qkp.2.1697867155159; Fri, 20 Oct 2023 22:45:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697867155; cv=none; d=google.com; s=arc-20160816; b=LzeG9ahPkJ4VLOXQ0TOv96QJwg3zYi4KiSSbP5oMTqW59t+J0klr0ETcaCBQYNfXJu LwKnD/ykb/xHdX/PybSZ/d1NdHi8IVCQSpjf7addAidAtGSd58UxtdKEMkRqfrGbYPWU a2q07eKUBeXAxIo/Bm+jQMeZhi2RENV/HXvBvlkODlhMw7YAy/Hyi8sYlz2XA6xZLeJi QSC9h85g933n9rU9vGZ4YnA9wMM5i1BU6822aWCVwpqW3NP/Ar84ahnVxU1R+5PU1Axx c2NXxUnx08A5L1EGfbotl693+P9L8wU6ojoThNTth6nQsko9hm0YQ+jYh2V2BdcB21zF CRcw== 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=pZRYSTpbwAyV/c8svo3LDl4rNTlu/CFIMkP5i3x5ydI=; fh=TYrED6TOMxGX0VC4GtjviASLbYyJe19+7/tKWjN44KQ=; b=ltIi9QQALvL34wouH7UkRhjz5HrEWzckPkNpJhO/tz8XV2atzlB8A2BdU9xkgDD2TZ 0by1dq8H4QUgHuY/mQtjlO3CJ8F2FYfwShNwzFmGGw8kbT+LAC6FLn2GvlaNSKj/gBk7 4dRNqDQvXziRbXk9ZNyvEzBHwKCFriDQyfgDteBOI2G2a23mAVrxI9QCAbKthToWoaWb sWbQquFDBTDvpe1uT27AMYbtoiTqiaGr6ewazNnjBY4SSicxzjfHfFyiJYlIqQOKUFib 2Zo9S6RcabB4LYIaD8IMPcY43XW8i6YwtPUCcwDeWDXoJ5PHEGA1yKuWyPDX4BT2LZjS efCA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=D8HihFkF; 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 qs21-20020a05620a395500b0076d40ceedd8si2413004qkn.722.2023.10.20.22.45.54 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 20 Oct 2023 22:45: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=D8HihFkF; 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 1qu4ee-0003Oa-0J; Sat, 21 Oct 2023 01:36: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 1qu4eU-00037Y-9Z for qemu-devel@nongnu.org; Sat, 21 Oct 2023 01:35:58 -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 1qu4eS-00019m-2e for qemu-devel@nongnu.org; Sat, 21 Oct 2023 01:35:58 -0400 Received: by mail-pf1-x432.google.com with SMTP id d2e1a72fcca58-6b20577ef7bso1295847b3a.3 for ; Fri, 20 Oct 2023 22:35:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1697866554; x=1698471354; 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=pZRYSTpbwAyV/c8svo3LDl4rNTlu/CFIMkP5i3x5ydI=; b=D8HihFkFkZZw8EnrGggTHmjKqq15iJTsfPHDIp1a/9klRI8cKnnURTwT57S2lzoLv4 BZ7ryBH69DBr1VZt3N3kZw6xrFFR6FyzyWk3qKOE+vc/qDk9LXeg7BjY0t9A38yJ5g4/ XpbrbBCWMhyayAWf/TRxEjo2oARQH0pQLj5QHRsU2BBTpWcCu5OypCsFP12YL1biaTZ9 ORWVkWmgG6dzssgJQdWgzwWiAxhEK1fJV1sdI/Q2UlMF+qq7gM1bFFA9IC1x5LwWLY/b loAzvOP2CJF2Laj+Mnh3+Xk++bSB7lYaag+109VUG7j7QqDLaCnouLln5macKPsDzof1 ihUw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697866554; x=1698471354; 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=pZRYSTpbwAyV/c8svo3LDl4rNTlu/CFIMkP5i3x5ydI=; b=V4q2oVwNJlzsCVicdcrL0yok4uNZZBRK9OSgULV8l1R+VSal8ffHRbFzMGf9NrqZ5j zvAHVjsnlAMGOOfQ4KhPpE5gxubm0hwzur1aGPeXhau3zDiJr9rhYW+snEBZ6imIEDf3 lfIC3htNwQ5st5GqOcHaM1eykNp0wEOvCImPr0AytLVs9aSJdu2LhcWHkbMlo5hcN+/5 WAdjJy5P/srnWopiGHVagqZ9CrkfgTB2I0CTB29S22f7bSEo9I9uTvdJ4xMDiuSizFZf MihK9vI1iYei3/56W2QWTYi5fB942CcMhIh4Do0iRKchrRRlkstesQnxmcO1NYm1DrKL MFSw== X-Gm-Message-State: AOJu0YwR9jLaYP8ebdi3DLVczym+14fd+hrtF1y75xGClsVo8gGWIkE1 Pw/fOQMa/+dalvC/wz4u5yqDlwCb3DaVMlmwhnQ= X-Received: by 2002:a05:6a00:2387:b0:6bd:f760:6ab1 with SMTP id f7-20020a056a00238700b006bdf7606ab1mr3316364pfc.14.1697866554484; Fri, 20 Oct 2023 22:35:54 -0700 (PDT) Received: from stoup.. ([71.212.149.95]) by smtp.gmail.com with ESMTPSA id h1-20020a62b401000000b00690d255b5a1sm2427978pfn.217.2023.10.20.22.35.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 20 Oct 2023 22:35:54 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: mark.cave-ayland@ilande.co.uk Subject: [PATCH v3 66/90] target/sparc: Move gen_ne_fop_FFF insns to decodetree Date: Fri, 20 Oct 2023 22:31:34 -0700 Message-Id: <20231021053158.278135-67-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231021053158.278135-1-richard.henderson@linaro.org> References: <20231021053158.278135-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 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 4e4336a4c5..8142fbdb8a 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 0ee93b8ae2..5b984fab7d 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)) { @@ -4972,6 +4956,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; @@ -5344,6 +5357,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); @@ -5471,34 +5498,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); @@ -5515,83 +5526,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 Sat Oct 21 05:31: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: 736645 Delivered-To: patch@linaro.org Received: by 2002:adf:dd81:0:b0:32d:baff:b0ca with SMTP id x1csp633878wrl; Fri, 20 Oct 2023 22:42:15 -0700 (PDT) X-Google-Smtp-Source: AGHT+IH860cHOZRhSn0mm8vtMeoZhmpUXrcSyxd3MGCArClMQmstezYfIBNc9Tp5P0mfE4ENZ6s/ X-Received: by 2002:a05:6214:d0f:b0:66d:d01:40a with SMTP id 15-20020a0562140d0f00b0066d0d01040amr4155185qvh.33.1697866934879; Fri, 20 Oct 2023 22:42:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697866934; cv=none; d=google.com; s=arc-20160816; b=ejZDhyOsqh05ilCSvISOvusoOfxWw1u4tUwQE7OA2cz3Jpz0rZiOms7nS42Hzqn9pX tNjwUzSJueW8VHEhx5WXRb4B4AOMDPhmDjVo5WicDXdSSJ9LhBK71AYKpSzrgC5fxc+6 WS4cyWmZN4sOLYhlm8xFT/X4JL2tmV8VU/74RpIVmVmsqPPp3ElvRsL1vsVVhw2PGDgZ Z/goqLsExjQG2ArDFh2jVHyNNYvNzMaf3waZSCVKL35vnAs+dIMMNJtOI45tLsH7YKQn zdL/78LrOuPLrXGOtTlCsD/XGYgrbiVMu3LWJ3YDszm/urWb+4+RqN66aFkYNok3vH4u JrUQ== 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=X3XLl9fvJjq7Qe2bmoLZfCkTuFprHVjONC5+sd3Vp3A=; fh=TYrED6TOMxGX0VC4GtjviASLbYyJe19+7/tKWjN44KQ=; b=i62/GXxcznn/er+u8hi92c19iX6kKcjxoMcIjPhXZEebSn/DglrzC8aKU4WZnyYVcf nZwrMnQ/qG51e2VciEka2/QJkT7RKVWva37XNoLlYtpz01JgEfmZeFSLV3jejcQSqdFd umLITUVab+DCWaD0xHrQj+ttzs2bnkgYd4uhc291txpjqVn9YqRR5OWQ54jVz8FrGucJ MD+wFG6zOE6n0tWOJta0zB3df15JjtY2BtON7hWGIcPlZIBTQep7KagGEGJyV1fBPPII cV7FneSRrglKr3gkpef4ewEp+3e4FDFhHb5Pa/BS3AID7cNnpiUPhyPZaGseVuyYDOJC F+aQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=EY8CtUQv; 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 pg2-20020a0562144a0200b0066cfc2c8139si2727240qvb.377.2023.10.20.22.42.14 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 20 Oct 2023 22:42: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=EY8CtUQv; 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 1qu4eb-0003MB-Bo; Sat, 21 Oct 2023 01:36:05 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qu4eW-0003HE-Le for qemu-devel@nongnu.org; Sat, 21 Oct 2023 01:36:00 -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 1qu4eS-00019x-Qw for qemu-devel@nongnu.org; Sat, 21 Oct 2023 01:36:00 -0400 Received: by mail-pf1-x42b.google.com with SMTP id d2e1a72fcca58-6b6f4c118b7so1359233b3a.0 for ; Fri, 20 Oct 2023 22:35:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1697866555; x=1698471355; 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=X3XLl9fvJjq7Qe2bmoLZfCkTuFprHVjONC5+sd3Vp3A=; b=EY8CtUQvd4lj7unyBVcM8WNRQOq5uFxxVonNtsUosA+lOPZLWkESkuVvMFPtV/TLgR /7aTERSgDva4rEp+qeT3rf1ovZnXWGFpMbIjO+p69tXcmRD/nGbH10+YzBALfH8Uu9y0 BOD5UneWQaZlMSGWso01bpzePSsU3Hy867sTG89Lb/GkExhQ8qBVIZxDegbqu7m6TcaT 94iV64lf+EJg3jIyB/fUOofaprHm3pH3afpaiMSpjf22cSQnLJ4tMSCD48vtfQAkuFTA IIltL9hzrnL8BzBhWcVWgnuvNRynH8/Nj9mkEvCZsqEBxXMqMbjFB3nmn+U712+gbeS2 sUIw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697866555; x=1698471355; 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=X3XLl9fvJjq7Qe2bmoLZfCkTuFprHVjONC5+sd3Vp3A=; b=W7801A6hnB+ns9oRWpFI1heZHQ9rQz1YnDOOzzQ79oJCmD0Q22TiG8y8wJlru/C0IJ nG0hTnXeyA4x78ClkOaWSsdRT9glD2CiilDzmsfDA5+SgKa19QELy9SREz8dnK6RfJ+P 6x63fml7ySUln7dE5tNE9Y0ZWUpTf4yM8H6XQkIFY8qrAJhrAT1TLZAelVKY8UnkKX9h CF5zNUOHSSVdlYeFBzxzvX/fiCWYCjTyMDh35KJ6QMt3r/vDm7ho4DZ5oGeXSjQdWdFn uGXsOYYIy24CezaDgxNLZPi10pFLbIMbLU/FzQjHFZo4KphhuTRIHfap0DsEcHjJb/fc 1cuw== X-Gm-Message-State: AOJu0YyH2c/xoM7QOtbRWCP+W0cTCzP3Q6R6bxcR1FcpScvyG6RFU35S 2hlq/0ZaQM9joYx+i4xoDtiJt67a7XLvif+Iiz0= X-Received: by 2002:a05:6a00:1a15:b0:693:4a43:1c7e with SMTP id g21-20020a056a001a1500b006934a431c7emr3622271pfv.29.1697866555443; Fri, 20 Oct 2023 22:35:55 -0700 (PDT) Received: from stoup.. ([71.212.149.95]) by smtp.gmail.com with ESMTPSA id h1-20020a62b401000000b00690d255b5a1sm2427978pfn.217.2023.10.20.22.35.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 20 Oct 2023 22:35:55 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: mark.cave-ayland@ilande.co.uk Subject: [PATCH v3 67/90] target/sparc: Move gen_ne_fop_DDD insns to decodetree Date: Fri, 20 Oct 2023 22:31:35 -0700 Message-Id: <20231021053158.278135-68-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231021053158.278135-1-richard.henderson@linaro.org> References: <20231021053158.278135-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 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 8142fbdb8a..75832ea503 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 5b984fab7d..e80a902c8d 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)) { @@ -4985,6 +4980,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; @@ -5371,6 +5406,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); @@ -5428,34 +5486,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); @@ -5482,34 +5512,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); @@ -5522,46 +5528,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 Sat Oct 21 05:31: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: 736640 Delivered-To: patch@linaro.org Received: by 2002:adf:dd81:0:b0:32d:baff:b0ca with SMTP id x1csp633670wrl; Fri, 20 Oct 2023 22:41:09 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEnH2Ci34wbJTXF7NHo6+g0lniQe/oSNBxSfh1htTThA6nPkODZaK24TSUZhqX9Oao3luRs X-Received: by 2002:ac8:5fc1:0:b0:412:24e6:a492 with SMTP id k1-20020ac85fc1000000b0041224e6a492mr4011698qta.60.1697866869114; Fri, 20 Oct 2023 22:41:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697866869; cv=none; d=google.com; s=arc-20160816; b=kdfdQ6RaOvZcpXt5I4r044NWBWX6fN057P+TBtBv42Elz8MEKw9i/tdSRCct52ztKS H2/LJYVxl2xHF04gvBUXQFY4KFK3lbZ9p1zUkg50DGq9O+uAx3mhbQecE2beGlimodCY krQrr4J8WE+YX1h2YsMtGD5jOk3zF822aaQe+tUQYyRkxSS2C3aPqRH/1iGa0mnA2gTK 5fKwNBh1jRRezRpHbnZNAQgyNPdmwEznsVrYMW5mYcT0ZFgQD1edHMJ3iFAKJsdfBtae EuRtzF7eh9y9fq0TiXSX0GCE7ETvWurpozqyltdl6nP00VnFwcY35ZKkLDP9ZbC1xnY/ RrSQ== 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=gX1Xk9WxJkRM5EeOMgATFcD8wFIWGwle7B65OdBVJTA=; fh=TYrED6TOMxGX0VC4GtjviASLbYyJe19+7/tKWjN44KQ=; b=IpHIiXanIWMKsUzsYLzkC+s01/yuzfhf1cQPnZg9LVHTiecWawsHV+HFT4xjIMLLQy +MlMWFgCFmeZ0GiE8FmEkmC7SZ4js5J+WBMZkW4KNsELIpigZWoHjZpcL7OP/EEmwuMt lTdjYT8G3KmmOwphvLaCvjFhqCTTMyKlfWJOc6m/FOinmS/2UZ5a6ZUXQC4j3JWxHf99 BaxaB3ip0VGCwNQpps2nv/YjxBy51lipxMx5b7upPUVfOqGnkV+HbBP5YHNhdw7/pHbc jF6pe6QMokkhoQ6UIbrL1BvjZ7pMuJ+KzHWalV/WFgE9+bHSYRFuJA7821XB1tLVKO49 tdTg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=mYvvNAo0; 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 t12-20020a05622a148c00b00417f199f9e5si2538848qtx.738.2023.10.20.22.41.08 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 20 Oct 2023 22:41:09 -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=mYvvNAo0; 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 1qu4eb-0003M6-2C; Sat, 21 Oct 2023 01:36:05 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qu4eY-0003KC-Mv for qemu-devel@nongnu.org; Sat, 21 Oct 2023 01:36:02 -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 1qu4eT-0001A7-8w for qemu-devel@nongnu.org; Sat, 21 Oct 2023 01:36:02 -0400 Received: by mail-oi1-x233.google.com with SMTP id 5614622812f47-3b3ec45d6e9so1049588b6e.0 for ; Fri, 20 Oct 2023 22:35:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1697866556; x=1698471356; 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=gX1Xk9WxJkRM5EeOMgATFcD8wFIWGwle7B65OdBVJTA=; b=mYvvNAo0y43kJXZtZ4zRsbbF6n3hNrE1aKTv14j2XAe0VMfV940lz3z8aavBJz/urM GW12KgFiS9uAxEmHOnJPOJkJOj8Mx1iV4WZrRs7QPXZIduNQsdB2ffdgMfcocveHPjvm rbP5ugzphTASpYV8VGdlayqy6wuIbNNnWlXDIUF7hhZ3lF6ZoMF5VlkrBFVvWPlpVH4H Yx1EkfKOdzBMGMZERp1DXCJ46qjc3IQkLdg9kbG5YdYdYoKoWEYWPZ51jdbEF038wpHT fHc9fHlERzMhw6HgmrOqGZkzbWQSTq5tDMkrKBcOXGJYQfrV52E8kINb56QeCD52KzZw L15w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697866556; x=1698471356; 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=gX1Xk9WxJkRM5EeOMgATFcD8wFIWGwle7B65OdBVJTA=; b=g/H7VB3pBSVCGZ2gThdZfPoSSOc3MiTQ+XP/Ih+wwkGIMiUEjOlNAs7aimRV6FsqNC M2bvpL/Sj+8QZTKVp8oHD5YHcHcKDr6ogullNyOgt9JkWnnTBgdAdbTvl5mR8PagR9Xw 4Ij1cfiPWCiD6iSkLDC5pfMmw3y47LrxHg4QgxWIJvSKDYxW4hczNBldgfYiz0K/Uuqp GOe1gN0XT2W4ddEYC1nFOS5b4HIqt5MC/gAfgb/8GimpIBsPqizZ4ZS8JO6SgbR/zQUx DAwqyabeZZg/xOHd4bLkdK6AEwdEq+3U1JHA+F+qLCj+Ub9jn/gfMxhw5qeqZEEBDAeE 3vgA== X-Gm-Message-State: AOJu0YxeuuQDQ7mX1xewGvmNObSPIWZATe3qtOHLjjweR3PvRM55wBYI VE9X9DByJpe0W44JnuTKmcIC+xxdZsFxUDiEFR8= X-Received: by 2002:a54:4e84:0:b0:3af:75e2:4c34 with SMTP id c4-20020a544e84000000b003af75e24c34mr3702287oiy.50.1697866556223; Fri, 20 Oct 2023 22:35:56 -0700 (PDT) Received: from stoup.. ([71.212.149.95]) by smtp.gmail.com with ESMTPSA id h1-20020a62b401000000b00690d255b5a1sm2427978pfn.217.2023.10.20.22.35.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 20 Oct 2023 22:35:55 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: mark.cave-ayland@ilande.co.uk Subject: [PATCH v3 68/90] target/sparc: Move PDIST to decodetree Date: Fri, 20 Oct 2023 22:31:36 -0700 Message-Id: <20231021053158.278135-69-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231021053158.278135-1-richard.henderson@linaro.org> References: <20231021053158.278135-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 | 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 75832ea503..9ac2a715c0 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 e80a902c8d..0c5ad342bc 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, @@ -5020,6 +5006,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; @@ -5429,6 +5435,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); @@ -5504,10 +5511,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 Sat Oct 21 05:31: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: 736661 Delivered-To: patch@linaro.org Received: by 2002:adf:dd81:0:b0:32d:baff:b0ca with SMTP id x1csp634582wrl; Fri, 20 Oct 2023 22:45:53 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFdf+A3n2BzLlWl3jxeIyGVBq7XZKLqU/D6CSjmbpNOioNgJOnPGXmoD1uYhkDBmxwz3Jqs X-Received: by 2002:a05:622a:1a0a:b0:419:5775:7d6a with SMTP id f10-20020a05622a1a0a00b0041957757d6amr4623873qtb.16.1697867153685; Fri, 20 Oct 2023 22:45:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697867153; cv=none; d=google.com; s=arc-20160816; b=0GyKCPBXO/HaQgvmBSHoHU2NDwiMsosg9QeQIKP2F4HmpRc0D7bRNDokwtZAQM8g3k TXjuWR8I0L9bI6W5w3y9OLeMEQ2bGd47f0s1Uamln/WI8of6wbAC0nSnMMOO7+jMir42 lpFZDMNdIMuxLOQIa6EvOSatI/K6l//6LUy6U6bp/nvyTUDy4A2P0FiS3ooo9V/KWtMF p+0F9ZtKEQYGhcFaTkNItE0qremrVIvzko/rN06LlXjgN8tZEPVXZyvuN/YppztY+XDF uGGrsev9dAj+0BQYUGgnnPVKVYKLqXEDM7Maxn8TBeZJESh/5UEHOxWOexAagSJI/WfK VSZA== 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=trW8XG5V4/V6fd/2AQRK/eDftcQRMXs5LdjOUsdQ8Zo=; fh=TYrED6TOMxGX0VC4GtjviASLbYyJe19+7/tKWjN44KQ=; b=XmCXwEQ3oeCbeUH4q+JMOwja0WlYTFHdO6FAN6Oml4lnPFxAeP4HPUiQJN0NowDyMK YbrX2bHL5izPTJkgN7D7EUUTtVfTv9SR4jYQL3vdbYeYM/B2YPHxRGJAsmL9iGqzfuAD w6Y9PxbfzfMvhYkg0b6iBSr6UJTlrYVb3UFArTfqhiUM2JlfV5RzoRbszpAT4XXY1t9f gvtnw4n5aMNiqZAPMa7pGXfOBUZdfCVhRN/bYaaDRiErZG1ysr1YeG/y6nLgHchstyeb cCaSavMFSzOhmmUmtq4Vljj1AsJPMAiv4tsZERwSyOGBGENShb72CXSP7jXJedNQ6+iH uM6w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="Pza4/LaY"; 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 a15-20020ac85b8f000000b0041cba17e38fsi2414247qta.276.2023.10.20.22.45.53 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 20 Oct 2023 22:45:53 -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="Pza4/LaY"; 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 1qu4eZ-0003KX-67; Sat, 21 Oct 2023 01:36:03 -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 1qu4eX-0003JH-E7 for qemu-devel@nongnu.org; Sat, 21 Oct 2023 01:36:01 -0400 Received: from mail-yw1-x1133.google.com ([2607:f8b0:4864:20::1133]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qu4eU-0001AK-B1 for qemu-devel@nongnu.org; Sat, 21 Oct 2023 01:36:01 -0400 Received: by mail-yw1-x1133.google.com with SMTP id 00721157ae682-5a92782615dso176727b3.2 for ; Fri, 20 Oct 2023 22:35:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1697866557; x=1698471357; 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=trW8XG5V4/V6fd/2AQRK/eDftcQRMXs5LdjOUsdQ8Zo=; b=Pza4/LaYGk8pwiiUQep9llfVUYUUEyp8uJRujwkfQRLqhtB5yjLjVVlEdAfh35B070 RTbuRsHBm7uP9I+Do8jmgnso1M3bMzRKUs7/JB2QH+h7pfvaLIbIDGkWR6NOLp6D2bGM JaoEbIGL7+h4f+wqKI+hMc8391Co0ibQmNIcf+l9uBXsAnXKTGzaBm6N3SqFhtI1ri8I V0tEnYLKwxOgJKtSjFLrTtM2ViAcJqakHEloS3qGvLMeMPNB1fojewQw+k8Y8ImmVzn9 ul5NKovFzmFfMg/jwy8xFp/vei7hNdTrrBhg51ziJC8zqV2fB/+9/jxT7usrkIPezkWp rZvQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697866557; x=1698471357; 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=trW8XG5V4/V6fd/2AQRK/eDftcQRMXs5LdjOUsdQ8Zo=; b=ejVA3v7nbLKmFQzvG1J18wWZ5OjI7PD08LBkctBTy89jMzFkTuWC+f2yzUhXlmKEEC mY4EOmjzgu0XNykfOZz0iTWKQU2HlTDie5P+YE5z04K2xOYK0hgMk80PDRy4Q04Ref4f BZmZd7LSxww5v4VRmgnXlFgWk1rsPChJ3Qpam3GtMQg6JTZXytp1nEu6h1guFtQ2WYj0 0TqDFgoUCW9DZtUt/ix+3P7EYXiwt2Bo2GHrvtcH7heJd/sqtSysZ5rfcHtmvSbB+E0q TwQTEfVTB8VHS7ztJdf3CMVpoPpD+d9/HFaRg4BvcCnLh4KXM95e/GjOo4uhrIwNmX3U N4hQ== X-Gm-Message-State: AOJu0YxA2FIKE08Nh6ZWndbpKUm+XerE5xYrVerSzBQ+jfB05q9uSlf3 8bvQV1tkN5nKRI+5/caw2GC4I4ZR8SP6gU9ZOKQ= X-Received: by 2002:a0d:d6c9:0:b0:59b:f8da:ffdb with SMTP id y192-20020a0dd6c9000000b0059bf8daffdbmr3801943ywd.29.1697866557049; Fri, 20 Oct 2023 22:35:57 -0700 (PDT) Received: from stoup.. ([71.212.149.95]) by smtp.gmail.com with ESMTPSA id h1-20020a62b401000000b00690d255b5a1sm2427978pfn.217.2023.10.20.22.35.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 20 Oct 2023 22:35:56 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: mark.cave-ayland@ilande.co.uk Subject: [PATCH v3 69/90] target/sparc: Move gen_gsr_fop_DDD insns to decodetree Date: Fri, 20 Oct 2023 22:31:37 -0700 Message-Id: <20231021053158.278135-70-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231021053158.278135-1-richard.henderson@linaro.org> References: <20231021053158.278135-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::1133; envelope-from=richard.henderson@linaro.org; helo=mail-yw1-x1133.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 9ac2a715c0..4e15bfacfb 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 0c5ad342bc..fccfe1d53e 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)) { @@ -2700,27 +2729,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) @@ -5006,6 +5014,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)) { @@ -5436,6 +5448,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); @@ -5493,10 +5508,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); @@ -5511,14 +5522,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 Sat Oct 21 05:31: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: 736659 Delivered-To: patch@linaro.org Received: by 2002:adf:dd81:0:b0:32d:baff:b0ca with SMTP id x1csp634565wrl; Fri, 20 Oct 2023 22:45:51 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEEJNBrYBzOEhKjo9y+oyU5RfXBmNFGcZ9iWNQCO5U4bMLXCnVt8Cp2cT1VlZVFILiZnfwn X-Received: by 2002:a05:6214:486:b0:66d:33e1:e480 with SMTP id pt6-20020a056214048600b0066d33e1e480mr4743556qvb.59.1697867151717; Fri, 20 Oct 2023 22:45:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697867151; cv=none; d=google.com; s=arc-20160816; b=NkJ0vmXYdQbUI1KoxJR34SjT5EsUJNZ7onYsB+aP+uu0xDKtZqTPIw5NkuMVrhia0P k4S44M9YPjmSOVz8duaWEXXwX61UrqGAtpRTZBxB5OSrohOlgtiNhoe9qdd0IVQixFr8 Iqmpc5mfCZbF++kJDiK/ylJ3Og/LB5lN1GVPJNOdtNR9tKs44oZOtwQxqgXnbAObfH4M zfWcHRzTBQu7fCbXygrrxU/VOqZ2gtbqo3NKY+F/Rayc5Yj7xbhLZ2fRalL/qmM8Xcvm Rikcm0/nQy57AH5Pnw6StEUBpnLGgxAECaA98J8tuTLdWUhAzXNGCXL3Nu9TeooZsyQ/ /MUA== 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=q9RlYjd39ntouf7hPUOdyU/Qywc9Z9jeRpzjr/dBnsc=; fh=TYrED6TOMxGX0VC4GtjviASLbYyJe19+7/tKWjN44KQ=; b=fUglRiONv7h2/Lpp+ncyRsARPHbfbQXuwGQ3pK2V7L/hA4bVMsFTT0XWnoYXLTYU2n lp0owSr+cS3wRkXDRzX59jQQmSWmpbUNY35LKT6P0yqrr9hHoC2RsppU+k+qLtC4ll9c I6lq1MhTddBzBF+gLJhnWcg0heuvREVpyg9RKeomOnw/vUmGQtriicPuhk/qzlo1GeqT qh6o4YDjPIKNAQs+NnpfgMhht3b4upHeOS5Vrdb4AOt6LlYaOohDkwbFUb5kJBMvjKmE AaqRQXTSa9ltGaFxnYmNWwFk/Y58mQtSFmtTbnPdiYOfEKhWajs/Wilp6yCMAZ/cYWi/ +p+w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="MYWhB/fJ"; 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 eh14-20020a056214186e00b0064cd41b2cf3si2481261qvb.25.2023.10.20.22.45.51 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 20 Oct 2023 22:45: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="MYWhB/fJ"; 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 1qu4ec-0003Mw-Pk; Sat, 21 Oct 2023 01:36: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 1qu4eY-0003KE-Ps for qemu-devel@nongnu.org; Sat, 21 Oct 2023 01:36: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 1qu4eW-0001AW-BS for qemu-devel@nongnu.org; Sat, 21 Oct 2023 01:36:02 -0400 Received: by mail-oi1-x22c.google.com with SMTP id 5614622812f47-3af609c4dfeso1054178b6e.1 for ; Fri, 20 Oct 2023 22:35:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1697866558; x=1698471358; 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=q9RlYjd39ntouf7hPUOdyU/Qywc9Z9jeRpzjr/dBnsc=; b=MYWhB/fJfXEiRMpfby7j2V6ECBEMxV3MT4rQU+zgKRQx2XvjdanKY1Murkk/UnflhP bvdi5odMObkjR1hzjjcNptqp0EvIjaO9hbadnw4LlqAxva4uUO7XX/ZmT6H0N6XNh5/a +hd+qxPWLsdo59LPT8NyiSz/zvtd773uveUah9w2EMa9xxIWx3DWnxMR0LHVxWA8QEuQ tIyr7WiBefwAwWYJQQFxXsnj/49R927zaplv8uYa8x5Fq//rPnStdSdwlBppcqPkNNJ9 o9q9e0A8erCCdkKe3HkEjBfnTtU5GCMYpt/IFXJewNOHIL27c7h7Qg0+DDx+di9HvGu9 uBEw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697866558; x=1698471358; 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=q9RlYjd39ntouf7hPUOdyU/Qywc9Z9jeRpzjr/dBnsc=; b=M8fLoZtb6LN4sgfmNXtVrZgHLtAiI7KVHDmnM9ZA7kdWEYHZyAlwcTYYEPGZFNO4p0 GE1L0E/fmLE5HVtLgST4h6l5jo4iN5OtuStDoZV5W/9TNHnoIEk235qIlqFAXpnO3r2k gPGneXpSYjHK5VboHobU5SiwRtEJAstJYa6GgDtvB0eAUOWoxGSxuJ9/ONnGpxTX+8Vt P2OTRDj3sXnIcIqahGatrk4e2mrPyb07HAK/EMkhgzZaDmkxlY5HUKD4nvGpN9AOkeR3 S8zIwNtoIM0xyzIEcHqPqZ2CnqLNICRp68WU8tWzzLYnP1b71Cl3gQLRypmY0RZTjOBa 9LWQ== X-Gm-Message-State: AOJu0Yz8LPuqDgPHO6X2r0dAG5b87sgKFXHNCAAY9vZSkDsqtH86Omyq rEjrCEsjAfYmbrRQfz6J38rEhjEQWa63qbJeDko= X-Received: by 2002:a05:6808:1141:b0:3ab:870d:2d49 with SMTP id u1-20020a056808114100b003ab870d2d49mr5342120oiu.8.1697866557976; Fri, 20 Oct 2023 22:35:57 -0700 (PDT) Received: from stoup.. ([71.212.149.95]) by smtp.gmail.com with ESMTPSA id h1-20020a62b401000000b00690d255b5a1sm2427978pfn.217.2023.10.20.22.35.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 20 Oct 2023 22:35:57 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: mark.cave-ayland@ilande.co.uk Subject: [PATCH v3 70/90] target/sparc: Move gen_fop_FF insns to decodetree Date: Fri, 20 Oct 2023 22:31:38 -0700 Message-Id: <20231021053158.278135-71-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231021053158.278135-1-richard.henderson@linaro.org> References: <20231021053158.278135-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 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 4e15bfacfb..76186bddf0 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 fccfe1d53e..f6d6e8b746 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)) { @@ -4923,6 +4909,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)) { @@ -5084,10 +5091,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; @@ -5143,9 +5150,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; @@ -5175,9 +5179,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 Sat Oct 21 05:31: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: 736639 Delivered-To: patch@linaro.org Received: by 2002:adf:dd81:0:b0:32d:baff:b0ca with SMTP id x1csp633663wrl; Fri, 20 Oct 2023 22:41:08 -0700 (PDT) X-Google-Smtp-Source: AGHT+IE8uZQUreTktBTs9FWPtUj3gz2Z0W5SUAtjzz8MMeJvF3tUwH87OklUxfJukYxLSn4W3lQ0 X-Received: by 2002:a0c:aa5c:0:b0:66d:2090:d23 with SMTP id e28-20020a0caa5c000000b0066d20900d23mr3184200qvb.38.1697866867978; Fri, 20 Oct 2023 22:41:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697866867; cv=none; d=google.com; s=arc-20160816; b=eIJkHtAemNeuf+oNvi+jqJaLmIuBdODmP7o+SIKoclV29PT6s0lZI5yjZVyk6RtQyc ozqeyiNjSO5bNmKsY/dhEWboqTA2jUibS+KV7YjqVERSwBSrow1n0YBOUa2woMbC5E9m UEDJ9AjaPQqAe4DAqVN4tB+Ays0hvqPW82ufesFnvoMU6KsJ7u6xwTLmMfHiIGvKzrjm M69g5L5KRXWdaXA1oku2QZN4eJgb2djJXnE4HYUe7ZhWwyOhTUI8uLXiKDtbGg0B8J4/ vxmxB6rBuabajzZ7Qe7uHTm2UYbv4iYj5zkzqy6fdKTjXj2oLpcXQXYbgHhPOKYby1Vf XfJw== 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=PSTynkYrGd+b+TlAqlMoO6TITVEsT/0JIz0Gl8KiF5M=; fh=TYrED6TOMxGX0VC4GtjviASLbYyJe19+7/tKWjN44KQ=; b=t5jm3vpFOLRtQSAHjAk7YlR0hyWLufVMnMlIcN+F4Owmwa7G0TE2IFT4wRWrdq27rw Do8X0e1g8BSyyfhzmlE3QfI/Sq/Wdp4WbPm40w7zMsvp2MZ3cTpqNeRkR/tAOuF95f4m Uf7jvwab4KIHEaJlZJh5yG+6V6nDwGSzplFLKZQ4VBY5xYPFm2Yll+E0MhnrGOH1F1G3 I1ypFV1fhLX+XKJXNDEjP0e8KBr+J701AYUNrSFQClUXM57/yHjGGQnGBId6LO5XhXsH u4EbwSuA68tDsGdA99DKKc44VUzwAEImMRNP8RhWr4W1E4Wkkh7RvKfE1pHqJYwcQyn8 6rCw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=ezqu2osK; 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 y13-20020ac85f4d000000b0041b83bbd0eesi2375833qta.43.2023.10.20.22.41.07 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 20 Oct 2023 22:41: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=ezqu2osK; 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 1qu4eb-0003M9-79; Sat, 21 Oct 2023 01:36:05 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qu4eY-0003K0-1H for qemu-devel@nongnu.org; Sat, 21 Oct 2023 01:36:02 -0400 Received: from mail-ot1-x332.google.com ([2607:f8b0:4864:20::332]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qu4eW-0001Ae-9i for qemu-devel@nongnu.org; Sat, 21 Oct 2023 01:36:01 -0400 Received: by mail-ot1-x332.google.com with SMTP id 46e09a7af769-6ce2988d62eso978458a34.1 for ; Fri, 20 Oct 2023 22:35:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1697866559; x=1698471359; 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=PSTynkYrGd+b+TlAqlMoO6TITVEsT/0JIz0Gl8KiF5M=; b=ezqu2osKVrNm8+a5MIo8ycgxlpBrPpZpZY7C/EuTES4bj5EzFlLvyYN+610WyFVhUw tk+jCeCAq4IwBGW/b+lFzcjXhVxksFV54wbPimBOOpzV7ZEqAYCDL9YF3c3t8IBGC+c7 NCItsjYweEZkEupwOobYminESquPQhFYto5F9h/blGPtHcSNhzjWw0J5nw7eLX2CauiI n31vsV5+vnpVzhPGzZdn1bN1RQwH0Yj1+Da2GhFV/uIu/Nx6EjKdSvZ1JPMfXswkjcOO 81zizJpzY4ur2fGSC1sk4qjLgsZg4NLYXZuURTHcNT+9eQ2Xw9Vb/9xC5YNaYhJrc8+/ zN2w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697866559; x=1698471359; 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=PSTynkYrGd+b+TlAqlMoO6TITVEsT/0JIz0Gl8KiF5M=; b=GdafPVG5uWL5xbcLVNtxjs6RuWeDBeKT0aQQQjCkql/fv+ua+PSTRq2qA/A6Uuw+Nv UTUBGqVxecX2O1n7KKmcL8DSvLFAFU7LQgcQAcLcPbYBjiCyff2fVV0vQqeq5hhAO3Nr S66c6AqkADiXX8FyGsqXlGyJ54cXHn/JAxz8yiiu5qfpyeS6eNKrUbkOQklIC8vDNS8S kxDutYIRM1TayHmnOX6HxB/q5kiXTu1o6ziSvch9qBY43vpyqR9IPvd5Mjh3LG1pTyL2 XthcbS+6SIGlJIxsqm7PVj1/h7PCNiZdKIsgiiji+G5zeITY15cET1dG5It8wKFmJyTD RJlA== X-Gm-Message-State: AOJu0YwQMHL6H2d1nYPjDyBR/z4hGDNU5Uq1m9VYjiQn+Y4j+klKtEiA 92Bbl2r/r/UriIE8gC49icYObXwif6Ug7f8TM6o= X-Received: by 2002:a05:6808:2c8:b0:3a7:44da:d5e4 with SMTP id a8-20020a05680802c800b003a744dad5e4mr3746863oid.51.1697866558868; Fri, 20 Oct 2023 22:35:58 -0700 (PDT) Received: from stoup.. ([71.212.149.95]) by smtp.gmail.com with ESMTPSA id h1-20020a62b401000000b00690d255b5a1sm2427978pfn.217.2023.10.20.22.35.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 20 Oct 2023 22:35:58 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: mark.cave-ayland@ilande.co.uk Subject: [PATCH v3 71/90] target/sparc: Move gen_fop_DD insns to decodetree Date: Fri, 20 Oct 2023 22:31:39 -0700 Message-Id: <20231021053158.278135-72-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231021053158.278135-1-richard.henderson@linaro.org> References: <20231021053158.278135-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::332; envelope-from=richard.henderson@linaro.org; helo=mail-ot1-x332.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 76186bddf0..d8a49838a0 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 f6d6e8b746..38ad2034eb 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)) { @@ -4952,6 +4940,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)) { @@ -5094,10 +5104,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); @@ -5202,9 +5212,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); @@ -5212,9 +5219,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 Sat Oct 21 05:31: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: 736635 Delivered-To: patch@linaro.org Received: by 2002:adf:dd81:0:b0:32d:baff:b0ca with SMTP id x1csp633654wrl; Fri, 20 Oct 2023 22:41:05 -0700 (PDT) X-Google-Smtp-Source: AGHT+IERg4X1S9nrWoI4iKUsG/6UpLevh/P32cbBcveM03ZiOG1jWB8VR91ik1vYhyaLQ147RZyB X-Received: by 2002:a05:622a:118e:b0:41c:b6cf:a49e with SMTP id m14-20020a05622a118e00b0041cb6cfa49emr4044388qtk.10.1697866865594; Fri, 20 Oct 2023 22:41:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697866865; cv=none; d=google.com; s=arc-20160816; b=Vu92pVYb1JaaUNcybKWd0+CBzM9FBjZ+bZvf22KhH9ZrRh707F/zV0qqFFeiWCPWQy RV0BjnxMaGrdBHr4GVG/sY1ja3YoNpeEZYKKbYxdDngi/69gPJVY9iQmEVwtJOhru8cr X+jO9ebASafP9D8KqrApo6qWnoTaGuq4sFBwFB1Gt9KGL0SnnQo+j+h5iFbhBBSmWyzE w/u7PZJABCk5+9/UROjRyHfbOYDRNMTFkcKZhcyZkXzsdNpk8fH89Jl5pScV8Ga2FY6I o4cjvnVE1bTBz/LoSe3AIYWkoW8qBSyHQ/Gmlkw1hfLDvoTulNk4G4xOjn8yKf4vPSIr 5e/w== 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=4DAJAtz1OX7RgBPpkaJPdRDiqx2t3tyR4Ljt1FBy6I4=; fh=TYrED6TOMxGX0VC4GtjviASLbYyJe19+7/tKWjN44KQ=; b=mHLzKCpF0zf/3PsS/za2jYA7MFRK8nupUb3Vv6rjnUcNQk1YbJMM0t6XFgtz5vNhte XaSFHf3zlaZocVET5kAMWDanfbj7wXAdXqzkhQJzon6F1RkoCiTP1nZX5TmHhv/xs+SE EcUeLXT3NLB7ddWfCrtZzEeeODLnmr0r0hB9UNjPvPARCI+GPNmbuPoqVQLG1KxZyakJ otbEoob45f6zlv4+XWkmA9XcwpU1hOQ0C1uAANQi/xVVXL0sgSmCrsnFDKLZThDTGGFD VOkfVD5sT7+ek4y8Qn0/aKBFSXsRRfLfOf+Y/HDxmW3wjBuIWeJkXT0Co7/4p20Lna8z GhIg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=oKH3vb5d; 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 h12-20020ac8584c000000b0041ccdd2519esi2417352qth.687.2023.10.20.22.41.05 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 20 Oct 2023 22:41: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=oKH3vb5d; 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 1qu4ec-0003Mu-Dz; Sat, 21 Oct 2023 01:36: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 1qu4eZ-0003KS-1C for qemu-devel@nongnu.org; Sat, 21 Oct 2023 01:36:03 -0400 Received: from mail-qk1-x72a.google.com ([2607:f8b0:4864:20::72a]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qu4eW-0001Al-U1 for qemu-devel@nongnu.org; Sat, 21 Oct 2023 01:36:02 -0400 Received: by mail-qk1-x72a.google.com with SMTP id af79cd13be357-7789cb322deso100883785a.3 for ; Fri, 20 Oct 2023 22:36:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1697866560; x=1698471360; 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=4DAJAtz1OX7RgBPpkaJPdRDiqx2t3tyR4Ljt1FBy6I4=; b=oKH3vb5d2POZz3rEm8MJnKv8JYrJB4cETJTETLm+V3n/QF/Y5WU82+hcAQre6ZujS1 WVa8DUQ3YjbvcQLXTyQB876DwGFmQk8/ELy7yEhQVBKnTG722gBxGy0YvGAocuF9Qs0I Y4Pe1ErdBsWe6fpEhoNwbBn4oKXBISTZamMfpCrxRg7IDMbuV1Fo4+w10cGC1AW4lVmN GKpIr22UEa0Mg/knIXmTX5LI6PTdiXTFexqcvfBYDzBwL/Tmcv8yuaC7SxA9XhlVh/22 6mX8q9Rt+M9NdWOMT9+rdhrmaJWZrF/Qhr6FVGcC31UwcOxN2wmgcuWU9ai+cC9MT5M2 rrpQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697866560; x=1698471360; 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=4DAJAtz1OX7RgBPpkaJPdRDiqx2t3tyR4Ljt1FBy6I4=; b=v+wYLJ6jvJIJN2mF4n+oeKSEjEfvQQGuSqZswBbliH9qsuw8JxpObTtcFKHoWdcjdT XU552E3s8DEbrEUX2YmsQlNfQyRRhi9Ko2oyMdv5mU5WskjLAxLWOYF6DcAVCvudFxcX 517ZBFif/fOrix6QEYZFqziqXvQsFrtCebhKAib0ab0AESb2EeNmF9IweYVOkzAARGoD N493cPx6IErhfSuA4WqxSibLRBsa3qHF0G4iWfpJD6I4at+0/CrxFtDUOmDLP0ONDoZi reImC7mz4eGb2HPq5V2nUd2eTtTc5e4d8+SdLFtnzV5gaNx4x0JkZpOfclX3W5b2+ngN Dzjg== X-Gm-Message-State: AOJu0YyfZ/EsFPyb/+ZxJJgmwp6GdZsM9kj2hcYm+zA3a40yA1HRuWbt 8wda1gxZOJ97gcUf41nmPbZXKCrxIPjORbDq6bI= X-Received: by 2002:a05:620a:2941:b0:76d:aa23:f8e1 with SMTP id n1-20020a05620a294100b0076daa23f8e1mr4658959qkp.27.1697866559793; Fri, 20 Oct 2023 22:35:59 -0700 (PDT) Received: from stoup.. ([71.212.149.95]) by smtp.gmail.com with ESMTPSA id h1-20020a62b401000000b00690d255b5a1sm2427978pfn.217.2023.10.20.22.35.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 20 Oct 2023 22:35:59 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: mark.cave-ayland@ilande.co.uk Subject: [PATCH v3 72/90] target/sparc: Move FSQRTq to decodetree Date: Fri, 20 Oct 2023 22:31:40 -0700 Message-Id: <20231021053158.278135-73-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231021053158.278135-1-richard.henderson@linaro.org> References: <20231021053158.278135-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::72a; envelope-from=richard.henderson@linaro.org; helo=mail-qk1-x72a.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 d8a49838a0..6994312909 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 38ad2034eb..2d594ddc9f 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)) @@ -4962,6 +4951,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)) { @@ -5107,11 +5117,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 Sat Oct 21 05:31: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: 736667 Delivered-To: patch@linaro.org Received: by 2002:adf:dd81:0:b0:32d:baff:b0ca with SMTP id x1csp634651wrl; Fri, 20 Oct 2023 22:46:14 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHvbUK3Opanb5Km+yo3FwyLiTD4jZjDAI1rrhhpApgFqd4KfM542lO2vbsdPl9OungpdIaa X-Received: by 2002:a05:622a:13c9:b0:41c:c631:3fab with SMTP id p9-20020a05622a13c900b0041cc6313fabmr4758720qtk.20.1697867173794; Fri, 20 Oct 2023 22:46:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697867173; cv=none; d=google.com; s=arc-20160816; b=Uno2TSatbOWTRd8LammJxagJLTghoOQ3A+X4Yc9sarsXY7l/4BMJrEvSY58mQ33hIB w5dhzKIQomt/yZwUWGLV/jSULx5u2mWALF4zHpI+XhFPWnHr/3WfglXVTLcrs2RV4VUy DHAuQerNVJgntHMd98WrLS8/ndTaN9aqVm9Fj8/hKgu6Jy0AyZ/bRaICoYGlnzH01uCo rDPgSkZz2fmzmbhIbT1kN06bYUbPnc49AFYJ6fSNSq6OPD+UuZ1sqBKoHl3PRFGxBfuz P7UD8SQZO/tV5fzuyficclZhFLOTXzgrpbOe2N4WUG9R+ZItde4TxLDyo2WIqH6PZOn4 ZIlQ== 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=QfLo+7ZDRLKxzXXYaZdB7Dw9olKqF5tLqEZN44Lhu3I=; fh=TYrED6TOMxGX0VC4GtjviASLbYyJe19+7/tKWjN44KQ=; b=07xlK0ft8fnWAQvCbaBXJ03Z0ki0LRaoG2i+E5AkrSbumv88b/7AEdYtMy/OkzB8qJ vSM3VDnamTM7km+OP5wVdXlpNBWIJ3LVjLx5JuB2eUHlZ0l0Cg8L8pFph+F9k5X10faX iDo14/9Y6O/ZUspImex1DzY2rqyuDhg07Fuv5CO1cj/QLMfs5qZKFYoO5fA8lR8SfY5M P0s+LptrTHbGxKLMQJ1jGc/F70C9nBZv/LwNM8EMeTXez4/7uup69m72ss/v1nv7XKjx HFv8ik4UNtGiG/f+Btu7gy7qU/V5x9bqXNKU1aIeF/+UcBo+XH1AE4OtWzGVyudvQQUQ mvfw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=ahC2ms4V; 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-20020a05622a11c200b004197ed64cf6si2384304qtk.623.2023.10.20.22.46.13 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 20 Oct 2023 22:46:13 -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=ahC2ms4V; 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 1qu4ec-0003Mr-5R; Sat, 21 Oct 2023 01:36: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 1qu4eZ-0003LF-RL for qemu-devel@nongnu.org; Sat, 21 Oct 2023 01:36:03 -0400 Received: from mail-oi1-x230.google.com ([2607:f8b0:4864:20::230]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qu4eY-0001B3-3k for qemu-devel@nongnu.org; Sat, 21 Oct 2023 01:36:03 -0400 Received: by mail-oi1-x230.google.com with SMTP id 5614622812f47-3b2ec5ee2e4so1055532b6e.3 for ; Fri, 20 Oct 2023 22:36:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1697866561; x=1698471361; 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=QfLo+7ZDRLKxzXXYaZdB7Dw9olKqF5tLqEZN44Lhu3I=; b=ahC2ms4VQ6ZdiayhhOOQv35SAMhBJJ6TbvpI18Piusidn5dQJoRjdcNY1etfELOJwx enR4UH3v36SsuSNEvSxBeH3W2B7TMLoe0O2lgKa6z+d/EyfdURCRB4xQVCG5Htebv58P dbL5rC0zvKXthJ45QmcmToufw/gLGe5tibaZ8z2BN0yuIwBz7zulFovNzFmdHJuCRZdr YqXGMEOwHaO5nIwj9PaxTkxePAOgiM4/aRJ9+d8ZkbmCphNihoOOsCXPWRCkSgJ2RCad NkwuItRYCP2QmLbZNwrCLgAAmLM3Y6/P3XOwgu6hF6Bs21T+GLdTfNs3sO5ufaknaFCV RQQw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697866561; x=1698471361; 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=QfLo+7ZDRLKxzXXYaZdB7Dw9olKqF5tLqEZN44Lhu3I=; b=But+yg4CZfzt57Dkz8zqC8LXu9QXn+PUKWUeztPNBUjmZWFJjHvzeO8GDNYPR3oZZV rz86N4U71zv8kSyoFyZn1w41QquuDG/8QA6wVLVG7YRnDFplfSsYbUOeKj1gMMZm++K5 2LakiwewAvwZjRyz//d/dGvhtQvkaDhYwvqsE8YhUXfNxpiVsm7KN04N5LFYST98Xk/x Rf0MJlRYXut7QG2dHQ/P6KI4BCkh7WlG+ZK5TRZlndJeyfTjlU1Z5J5nmIixhcuWAmmB ySRoKlgH8hXz4qCTC+9EwN4ST8PWHrWIn/37vq+KSNaP1H187+X643Fz6dfJ15xmWhzI tcGw== X-Gm-Message-State: AOJu0YxJ619HdwdyEgGedf9FE/SxBMKd7wICtb5Dp1jGGBWapCWOoJCz L4lnTNF7FkYC1M1VAV71JTpLudHdy79tpmD3S3k= X-Received: by 2002:a05:6808:10a:b0:3b2:e6a4:e177 with SMTP id b10-20020a056808010a00b003b2e6a4e177mr3667169oie.51.1697866560907; Fri, 20 Oct 2023 22:36:00 -0700 (PDT) Received: from stoup.. ([71.212.149.95]) by smtp.gmail.com with ESMTPSA id h1-20020a62b401000000b00690d255b5a1sm2427978pfn.217.2023.10.20.22.36.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 20 Oct 2023 22:36:00 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: mark.cave-ayland@ilande.co.uk Subject: [PATCH v3 73/90] target/sparc: Move gen_fop_FFF insns to decodetree Date: Fri, 20 Oct 2023 22:31:41 -0700 Message-Id: <20231021053158.278135-74-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231021053158.278135-1-richard.henderson@linaro.org> References: <20231021053158.278135-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::230; envelope-from=richard.henderson@linaro.org; helo=mail-oi1-x230.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 6994312909..06cab099d8 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 2d594ddc9f..8a0de0803b 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)) { @@ -5001,6 +4986,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)) { @@ -5118,10 +5126,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; @@ -5129,9 +5138,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; @@ -5139,9 +5145,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; @@ -5149,9 +5152,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 Sat Oct 21 05:31: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: 736688 Delivered-To: patch@linaro.org Received: by 2002:adf:dd81:0:b0:32d:baff:b0ca with SMTP id x1csp636063wrl; Fri, 20 Oct 2023 22:53:08 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGMN7ZB3IGEB3CU4eLAD5il5DuDpAoIJlSe1MJDPesFafrbAcIkyuBcnxGFzpKakavZgqU0 X-Received: by 2002:ac8:7d8c:0:b0:412:395c:e794 with SMTP id c12-20020ac87d8c000000b00412395ce794mr4475608qtd.50.1697867588222; Fri, 20 Oct 2023 22:53:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697867588; cv=none; d=google.com; s=arc-20160816; b=Pvws4nmME22yY49Iuv+uagKs116DwTYNQcumXyDLr6aLhQUdwHifb8ExESzoqzku5O gcMKZFp6ziA73H42dTa6jN0x5PfZ698CDn1Xz89TVnYe9Btk5xnKE5zYTDp2gzOJAkZ8 MTYmG0opJOQbUK38mFan1fhazF15fNDfuRyqhb/xalXfuhMqzxAwkeh+9mUPPpb6HJBy +VvmSYlKGIstuap4djfbKYYc9MtV4TAFO+tyRY/I4LMuwWBJaCTb1VLpAMw4jVEOmt0w Y6+1xHnf9NYe5xVSX/kO5EVSINCY79+AsvgiEzFaGHcb5fRB9aXhrSUH6xLe5yyJW5BW P6TA== 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=yN7O1LFTcycPQWVuYFGE8dpxCvObaSUOlYTzTZK79/o=; fh=TYrED6TOMxGX0VC4GtjviASLbYyJe19+7/tKWjN44KQ=; b=RVKeksSTlVBii6ogrlonTPY7tqGfaMd1IKGuLUcxzQrpQ3NGBbZ2UKnsBS/mMdhbJ3 7rgg8qfsuKP/M1W7zwKFEx8Mj5kXjvhnYmWRFoYiTsVO9+LxcDN/sGGj3qZDle+3lHAl 6WljlYDf02bHKCMq1wDTGIgM8WBUgdVh5wvf5uWN1MGpQLuX3X6ZnLAkYGQUTFg/s0QK ztkdyjfJfpUNZukZHeBYuwlBAQrbmUrqTe1K/n5+1QvPTtCdCowd1bvRen7+vgdA+JdG f+G0zaF45t1QuYUGTUC/UZ8a6GMwR660e5NvkNUzzOBLgLZwiblfKjEpX6BR1hlwPZ3n BHCA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=w10ndp1f; 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 g18-20020ac87f52000000b004179da82083si2456894qtk.681.2023.10.20.22.53.08 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 20 Oct 2023 22:53:08 -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=w10ndp1f; 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 1qu4ed-0003NK-Bq; Sat, 21 Oct 2023 01:36:07 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qu4ea-0003Lo-HS for qemu-devel@nongnu.org; Sat, 21 Oct 2023 01:36:04 -0400 Received: from mail-qk1-x72b.google.com ([2607:f8b0:4864:20::72b]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qu4eY-0001BT-S3 for qemu-devel@nongnu.org; Sat, 21 Oct 2023 01:36:04 -0400 Received: by mail-qk1-x72b.google.com with SMTP id af79cd13be357-77386822cfbso93746785a.0 for ; Fri, 20 Oct 2023 22:36:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1697866562; x=1698471362; 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=yN7O1LFTcycPQWVuYFGE8dpxCvObaSUOlYTzTZK79/o=; b=w10ndp1fSx/S4rkvagpcNDr3HXOCCO+su5Iu8INc6HNN45OHx0gpZaW21NNgOtjok3 2RJ9mkAZBYcv3pzmzzaZhbWMWgNQckyNL3YxxwjCuIuIA81DKNMYH8MWKr2pyfJXKBEb XXEAMBSCYg0Ui5g7eKM89rni7KwncApIReQOhAs4Y9vLOifYYAU6z/t1HSrvD4kb0+a2 0gqPkHnW/nye5N8sMF9/6JSZP7GVypl23ENv7/3gSWZHyntrv3Qlzf8fkMnf9aRyW7wx +x6q/NDII9OPmQWV4iApvqv02EPxvfmzAyT3SKxyIWeajNsKxtUTOszQ1GZ67ky7R/qK Bw7g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697866562; x=1698471362; 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=yN7O1LFTcycPQWVuYFGE8dpxCvObaSUOlYTzTZK79/o=; b=DFhevMlgWEW2O0kr3ZCOwgNEa3EjvuPrJnuAOFDZprNJ62xgNlv1CqgpZafn/sWhV4 YsvlDxfBl2zMqRB5eK2dUou3Q9s+emhj+33NqmK4WhG5jfj1JQnmROpmY65zI+C5ESee 6IN8u5/D1OxjXUmdtykw0NYoa2rGN89rL6EBaibkavu9+XIhnhUEswNDkv2cHvJroetQ EEfpwh9mRq+W00Ujxk1SH0dVSUfDWq82knML05SIm1syCN4FHt1jkHtLWmhKozPJycOR IZwoFr6DHX4lhg2rxW/dE+2vf50a1jrvqIZeKO0ilq662ylmd07II5pgEMsa4GJBf2bs zr/A== X-Gm-Message-State: AOJu0Yz0A9ac+jEHLk454Kqq1hADHf8ve/SkD75Of1/verJ3oYZAsZUZ ngsMn+dwyjnv7bXkxdkTth//ScAHbb9mIiS1kEI= X-Received: by 2002:a05:620a:462b:b0:774:2afe:97c1 with SMTP id br43-20020a05620a462b00b007742afe97c1mr4725746qkb.27.1697866561859; Fri, 20 Oct 2023 22:36:01 -0700 (PDT) Received: from stoup.. ([71.212.149.95]) by smtp.gmail.com with ESMTPSA id h1-20020a62b401000000b00690d255b5a1sm2427978pfn.217.2023.10.20.22.36.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 20 Oct 2023 22:36:01 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: mark.cave-ayland@ilande.co.uk Subject: [PATCH v3 74/90] target/sparc: Move gen_fop_DDD insns to decodetree Date: Fri, 20 Oct 2023 22:31:42 -0700 Message-Id: <20231021053158.278135-75-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231021053158.278135-1-richard.henderson@linaro.org> References: <20231021053158.278135-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::72b; envelope-from=richard.henderson@linaro.org; helo=mail-qk1-x72b.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 06cab099d8..e616cb1e69 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 8a0de0803b..53a42fe1a5 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)) @@ -5053,6 +5038,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)) { @@ -5130,31 +5139,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 Sat Oct 21 05:31: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: 736690 Delivered-To: patch@linaro.org Received: by 2002:adf:dd81:0:b0:32d:baff:b0ca with SMTP id x1csp636103wrl; Fri, 20 Oct 2023 22:53:19 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHDA4C9vRjeh26h4+e+BhdWNY02Nqh7MG+bQi2yUfhb2ujovszNF+WfK8kqWcln8Odc4I2j X-Received: by 2002:a05:6214:5004:b0:66d:9d4d:683 with SMTP id jo4-20020a056214500400b0066d9d4d0683mr3106619qvb.57.1697867599804; Fri, 20 Oct 2023 22:53:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697867599; cv=none; d=google.com; s=arc-20160816; b=Z/fq+gP/e9Ef7to75+aJ1+5Ywh1UT2dNXYApE8MCiw1CVLPyhXkuAHKwZjoAM2KEDx JCslgZ5kcSDqcH/mtH4Rna0QjR8sgLHxVhJSVNcgCEXoQ5VaAhTHyWSM7EG+G2+FoCH1 Jl6nemUEVc8uYVnMAs1YdsfYw837H41sEh6Eqcgk2VNpX4LCSLlJhfNOLA6oJKD+N4AC 60ZDeWEjawh9DlyQchYfp9874XSq9XK+gdYDUje773v2NRV6F7oWlTN1ZoVFpk4gbdIM pp8UsUBcTZmKBYal20V9MEX6WLyMiJVbaJNvSNHWr6RqSg67vaKMnOOskmX8TiTQQzhB 7DnQ== 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=wWQPa1xkvAE0evkU5c5okd/SkRFosIL5vzLP7/DZtnE=; fh=TYrED6TOMxGX0VC4GtjviASLbYyJe19+7/tKWjN44KQ=; b=wtADfUF+YufaqFDMgBov4GlULggk5y1l2Ruj8X94HWx5mfSbUUCcpvhlolb83cvqXu G1q2fAp+pW7tjlSBD22IA+UioiDuXzazB32gs+7V0Fgk207qsxabybklR3l8WWtQIphs SkbHZC8D4XxORvzt7DUuBo8MRAojobpZACWUoXbokah/23jPwJaRbikpujndaMYTHVMr eGr2MmFr6yALUsuH3KZ/JCi3KCSho9i98yxEqX6YZ1dk/RmsIcv8i+jk4tHdwyQkToo/ EWdvgFfF1g83R8vc4JptLXkPg/lhu4wPtP2FZZPqyPeMabCyCurS1dJFFS2ES1foKbNs 60RQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=m181vhPt; 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 t11-20020a0cea2b000000b0066d00c0d65asi2472822qvp.595.2023.10.20.22.53.19 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 20 Oct 2023 22:53: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=m181vhPt; 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 1qu4ed-0003NL-CJ; Sat, 21 Oct 2023 01:36:07 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qu4eb-0003ME-Ho for qemu-devel@nongnu.org; Sat, 21 Oct 2023 01:36:05 -0400 Received: from mail-oi1-x236.google.com ([2607:f8b0:4864:20::236]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qu4eZ-0001Bs-R2 for qemu-devel@nongnu.org; Sat, 21 Oct 2023 01:36:05 -0400 Received: by mail-oi1-x236.google.com with SMTP id 5614622812f47-3b3ec45d6e9so1049637b6e.0 for ; Fri, 20 Oct 2023 22:36:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1697866563; x=1698471363; 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=wWQPa1xkvAE0evkU5c5okd/SkRFosIL5vzLP7/DZtnE=; b=m181vhPtxuGR3U/rkEuqVOH5QWbc1k7074csyoGd5+qLwrtZlg8dJZuLB9NXzV1Nb8 JyW2GPX7lbufgtCZQUL4FLaT4+BYh9eOv34JM3DAR/6I/KAIjQLCOr6dtmadXrJyOQCr gpkOP9qXHip2oyrh2YNNKxvTu/HqvboYr1IIViTahebG+Lg87gBuXSSkFsRBXwjCixnN XpTqC+0AtoixHsqN+vlhrMN5g/RD+kCdMjhQbWP4TU4UNk/KOIc+HbR7EBrbftvqcytG iuRqzc1d+bRUHwRgY3gGxC+Qn1N/Y6Fjdnxq/HbqZXhrLK06RkgJXQbuTJCKmLqzPcf2 IZYQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697866563; x=1698471363; 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=wWQPa1xkvAE0evkU5c5okd/SkRFosIL5vzLP7/DZtnE=; b=iLvLMpWX/bg0CwW55eOhF67Sv4b9pXZPKCVvs1xKoMkqiOLIrD6OZBRoIDyirweG7z ORS0Y9bQFPyLszwyJ22wGyM5LUMWdcery/40CsKxZYlTNk2unPUnBi1UNzyzJg0zjnrk 6RDxh0LJqoE+KnNpYnbvXp5dJuyywHEPrznMUZRlm5Dq9L4g323IxoWdtjE78LQZAiVA yOoSAIv1Z6bcaC0NxhHXzqDz1HjheDFMoDO1mnRtzccZq9zP99t+v2Rcnb3jbEpULHQH ZmctqvV1PSEu6wOOyw0ggKOdZ08VueNIqgSU+zwlyuBkMY4nwwpcP9f2uJxkbvmH9I+6 89fw== X-Gm-Message-State: AOJu0YxV2YVkuF3tbDKrGvFH5B/Imj33HXKWtNTGU6I5Kt2HXrNU/0+9 q7i4M9cw7JUeVE+seLm5M47LwLf0ssN1lhURDeg= X-Received: by 2002:a05:6808:291:b0:3a8:29a9:e4d0 with SMTP id z17-20020a056808029100b003a829a9e4d0mr4112224oic.34.1697866562855; Fri, 20 Oct 2023 22:36:02 -0700 (PDT) Received: from stoup.. ([71.212.149.95]) by smtp.gmail.com with ESMTPSA id h1-20020a62b401000000b00690d255b5a1sm2427978pfn.217.2023.10.20.22.36.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 20 Oct 2023 22:36:02 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: mark.cave-ayland@ilande.co.uk Subject: [PATCH v3 75/90] target/sparc: Move gen_fop_QQQ insns to decodetree Date: Fri, 20 Oct 2023 22:31:43 -0700 Message-Id: <20231021053158.278135-76-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231021053158.278135-1-richard.henderson@linaro.org> References: <20231021053158.278135-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::236; envelope-from=richard.henderson@linaro.org; helo=mail-oi1-x236.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 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 e616cb1e69..0753bbef2d 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 53a42fe1a5..8ce0282e2b 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)) { @@ -5082,6 +5069,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; @@ -5143,23 +5155,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 Sat Oct 21 05:31: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: 736648 Delivered-To: patch@linaro.org Received: by 2002:adf:dd81:0:b0:32d:baff:b0ca with SMTP id x1csp633906wrl; Fri, 20 Oct 2023 22:42:22 -0700 (PDT) X-Google-Smtp-Source: AGHT+IF8QmxpFWd+Kipmh7Bb28RhqVEkFIZpO4fk4zM4tJgY6OP0y0fhZEiBwPg9q8uu/MSRorgz X-Received: by 2002:ac8:5fc9:0:b0:41c:c2db:217e with SMTP id k9-20020ac85fc9000000b0041cc2db217emr4551188qta.46.1697866941969; Fri, 20 Oct 2023 22:42:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697866941; cv=none; d=google.com; s=arc-20160816; b=nkxokw3nheIw+/M8a1cvmNevV2sFKpUva2qtgvQa6FPy6pqJ6pNmNYD6T0CtAPQd/Q XX4tqR4wvtx8FcHPejyzRFBlpPvcFyFruCiRi5yVzCz3NRIacyUBh4IWZQ2Y/cBZQDsc b4nmn34zCEbrqND9+ePwrNXtwmeinN5KWZoakTl0GNfDd/HxXsOKvM9zX3r5q+7iT/Ma 6e3Gc1Es7av+h2K1F7G6QoCsw+hWEK7n4B7yf/MUR2RYL7ybo04wgkBbpoIF8flRE2Hu 9E3VPbW0TYCn1RA3n+6F6s3RNE4Jc0xjcQWO0UTmXgUu5m+/Wl8/xAtCuPWZwGAea1dS Y7vQ== 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=F3dFbMPBfErSyYzkRLjzl07OW9e6RTTV25K8JcLqjoo=; fh=TYrED6TOMxGX0VC4GtjviASLbYyJe19+7/tKWjN44KQ=; b=lg5x2KF5L1gf0iVfo5oVxerBhIpieMqGS3IKLcq2TglMesQHUtoSXvZbGRN7IBYJOX kVullLKKmLQeGtnfwP1f+QtnO1C+JU1DrAtlyxXjmHTtgR6+DMUVkKdgzpvzXg0wIzMH acQqOig7i/yUPSAJui/Img75I5jbHkvYsbY91MY/D5EQoutvN/FrJ1L2LVy1ayz+N7GD auKk62vSmaZ3hu595633H/z3qmyQyjQ7JcHoGAVKAeHTu5nUqVdhuwK3GCm0nyoAT7qr vTw3h8ZoK6l3e2N5+F4Cdck2ZTQ0ZUDfPSeqVLwVqvMKhr61xpy7isK/P5RN7srIHdIV W/DQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=eQgNqnfP; 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 y15-20020a05622a164f00b00419818167easi2558325qtj.131.2023.10.20.22.42.21 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 20 Oct 2023 22:42: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=eQgNqnfP; 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 1qu4ee-0003Sh-OX; Sat, 21 Oct 2023 01:36: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 1qu4ec-0003Mv-LG for qemu-devel@nongnu.org; Sat, 21 Oct 2023 01:36:06 -0400 Received: from mail-oa1-x2a.google.com ([2001:4860:4864:20::2a]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qu4ea-0001C5-V7 for qemu-devel@nongnu.org; Sat, 21 Oct 2023 01:36:06 -0400 Received: by mail-oa1-x2a.google.com with SMTP id 586e51a60fabf-1e9ac336589so1083321fac.1 for ; Fri, 20 Oct 2023 22:36:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1697866563; x=1698471363; 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=F3dFbMPBfErSyYzkRLjzl07OW9e6RTTV25K8JcLqjoo=; b=eQgNqnfPZn5fQSV62LOq707TfmZQUOhxmnvHwJIK4DQtbkBMeRBed7CyyRiWsPG5fl RwU0KXkIIyeUQ8RSjNeKAyzCLPfoi6043eMHQ7B9Lnmbj0PbNvhSDk67t/L1SzkZ3eSH iezRn69lucQKHRubyy/8Y3yQmsCyMl/0eGLG2ARHsWUPHbBPefjZ+foKTuMW+uHoRVNT TOR4+3PqphL88Boy8Xanc/WpLPbfGln3/A23BbtTEfK4tv/ziqAGlPZPUxkdFIV8G9KW UtbepssET+9CHrr9woZ+Hhlf74159UwFixkpqWs2HcRX0iY3PUyHYiU17ldp3UUzgJ9G rs0w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697866563; x=1698471363; 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=F3dFbMPBfErSyYzkRLjzl07OW9e6RTTV25K8JcLqjoo=; b=l5wJq7cIChoHX/Hz94JrDLU4sJCa4RliCcS2kp6YvPpFgBcjzhH4MsSR3dacqyvWae Tth7j9A2FbZBVgFfPHWsv1/nXAPANzDs/KIaYp892Fo3QGuBP5kNC14Xe4kgNdnY0U7j pvJHHarNY13tj0LFj2UYuGz4H1Ed/4GiCCC4HW2Urf3gp3FnXiEcEBC73zoSCDzJex9F GkjHw6vfJsFTR2roj2RorTI9nlK04TMWjvFftTlQStIhjm6MCzI4NabbhqzCl0rRDMyH guOefYyFcdvNpui7/XlRsK+4uDC3v+gJkPzGcCr65LZc3Ew3Rg+P1SHUyz0IgXMkM+KR idxg== X-Gm-Message-State: AOJu0YwTP7GwVTUN08dox49VfhVnZC2IhHG3gSt6BK5N7RFswlJrvA1q a1jNj8xwCds/Crky1pvVlZdtQ9To86kyHuAOlXo= X-Received: by 2002:a05:6870:ed94:b0:1e9:b2a7:9a38 with SMTP id fz20-20020a056870ed9400b001e9b2a79a38mr5150665oab.43.1697866563678; Fri, 20 Oct 2023 22:36:03 -0700 (PDT) Received: from stoup.. ([71.212.149.95]) by smtp.gmail.com with ESMTPSA id h1-20020a62b401000000b00690d255b5a1sm2427978pfn.217.2023.10.20.22.36.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 20 Oct 2023 22:36:03 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: mark.cave-ayland@ilande.co.uk Subject: [PATCH v3 76/90] target/sparc: Move FSMULD to decodetree Date: Fri, 20 Oct 2023 22:31:44 -0700 Message-Id: <20231021053158.278135-77-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231021053158.278135-1-richard.henderson@linaro.org> References: <20231021053158.278135-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2001:4860:4864:20::2a; envelope-from=richard.henderson@linaro.org; helo=mail-oa1-x2a.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 | 43 +++++++++++++++++++++------------------ 2 files changed, 24 insertions(+), 20 deletions(-) diff --git a/target/sparc/insns.decode b/target/sparc/insns.decode index 0753bbef2d..54c9c38736 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 8ce0282e2b..8a3ee221e9 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)) { @@ -5049,6 +5033,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)) { @@ -5159,11 +5165,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 Sat Oct 21 05:31: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: 736676 Delivered-To: patch@linaro.org Received: by 2002:adf:dd81:0:b0:32d:baff:b0ca with SMTP id x1csp635004wrl; Fri, 20 Oct 2023 22:47:45 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEIWraWji35Omb7bHXG28RUQp3+BukxVTYqn9R7L2vGSDwhFpXGwPGHiyNpITqbusyMfPbZ X-Received: by 2002:a05:620a:454d:b0:76f:2899:3a96 with SMTP id u13-20020a05620a454d00b0076f28993a96mr4861672qkp.0.1697867265626; Fri, 20 Oct 2023 22:47:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697867265; cv=none; d=google.com; s=arc-20160816; b=EQcSR2QqZdKsl5NuVHIZkOWtSITkd8P//fjh0yujDdvcn1eporjCvUPPhFejex5Sxi KfAgxyf9plGevy3Spk+Smu4qhQh1r9EjiByaXCjIk0p8kv3PTeNhXCl5y7ys+aaa0lY7 UyAfk+bb6f04mSoodapm9jU2Q9wFh19WgfR4yGIoTQ1EOtz9UJM+15/uoCcnVfcLjAJW qr6eJvSQUveBgoGgFO0F7vwS8+DiK1rktIYhRm2VUpwBR00AEjgQ9qNDwfJ9RLkDg1w1 RFlr/qTJoLKyPmEEAoFLt1iI+x/BbeEIYGBsvc8poZoE5VPNQL56WqPfkNfloYdSKgwG xL1A== 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=NzRw3IXH2U5Pvhy9Syv54cdvqoHUoy4tZ7btkPmAyBg=; fh=TYrED6TOMxGX0VC4GtjviASLbYyJe19+7/tKWjN44KQ=; b=Db79x6XIU1g05g0BPJnv1s+ofDVHdQWlEw5enmRoxuq2j3HE7+xUPx1YSJff1F3oS5 PDXl7i0Av6GInlYMBAeQNqTXQDap7zUVvDJReuVmaDEImhF09PRV2hWnN+rNjDxU09qC 9GW1ROOQ9EBtT7sV9pHX/wJGmQtVDC+HPxu/FP2r3km0BVOoIYKpB0QkITTGEY661eqV lhqXdpVm9OWV60fA352CQ8HGbnB5gMbopdug5bAduV86uKOY0Kk81o0llsra7C11q0kH 8ZOnjwJp/UMAHWZW5BUYTHYdy76+T+pZ7X6+5FX2n+BUaJ+VW/9JL0ILrGPkXw2JG4h9 4yAw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=LsqLDfMt; 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 g22-20020ae9e116000000b0076f1622297esi2273850qkm.558.2023.10.20.22.47.45 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 20 Oct 2023 22:47: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=LsqLDfMt; 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 1qu4ef-0003TO-2J; Sat, 21 Oct 2023 01:36:09 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qu4ed-0003NA-87 for qemu-devel@nongnu.org; Sat, 21 Oct 2023 01:36:07 -0400 Received: from mail-oa1-x2e.google.com ([2001:4860:4864:20::2e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qu4eb-0001CR-IV for qemu-devel@nongnu.org; Sat, 21 Oct 2023 01:36:06 -0400 Received: by mail-oa1-x2e.google.com with SMTP id 586e51a60fabf-1e0ee4e777bso1082598fac.3 for ; Fri, 20 Oct 2023 22:36:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1697866564; x=1698471364; 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=NzRw3IXH2U5Pvhy9Syv54cdvqoHUoy4tZ7btkPmAyBg=; b=LsqLDfMtRYY6eOMI4CLWiPTQo5slyCjiPeMGYar6ErpUWp57gLTbA+DfCPbNjwf+WA 7MEpE25y6r1jHsrMAata5qZsWo46psGMavavuyAUssK6xEKq/bstq4Ett+jnFlNbgzkA VTuWkGXN2pE+pE3b6FQ+0R2edO5KzMMI4LJHliMrvsUq2GgonY/2g4nl05bfoZ/yhMaO GDKVBg10zI3YSdLbQ4/VEvxDEj60wrHWQZSNUwFUzbFyzA4Co9mPVPIelDWh3yAGTq8b 9a5a6eFhMJmYbxBVg5wiP28UZNj0YblUpiU/TQIU0snd5kpabWa8UqvYZycYHZMn1Jav SMZg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697866564; x=1698471364; 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=NzRw3IXH2U5Pvhy9Syv54cdvqoHUoy4tZ7btkPmAyBg=; b=voJrjGyvLFiGhJK0yiXTz1/XSjX2pSpOQI7Zft2f1E5UwbA5lBZBhZYcZz6H+uLOrS NIS9Y+p532KNJlImYyOcxQEqdCwXbl9Ipn91uZxwq73em6h5r2m2mIvFMoyKIf9X/7KT N3OL4SPwA0BBhWr9K01I53rSCgm0pEzii0xaWwsiq+z8G/yfMjASLUNTbnzicqAB2K1g 1woLwR/Ji6ldoxX30EPU7wN+wUb0zitlAKvtRbGTBo+ViJYwPEjZ6XV7CRxzwHyBaGSp vaGH2Ls2pWDS4KQwNvvZ4YcGPQDdSpFV5jPqhl2MNq7DgZ+3uWpXLHp+tmtPyJWQnk7a lJyQ== X-Gm-Message-State: AOJu0YwHDJoNCHd3/vW26L5Wot4mQVN7N/Cp+s3T8A10qnDcLQNCzM4v hI2NOf38qI1fd2cG5/WTeqfMt7eQOituf8C+4yY= X-Received: by 2002:a05:6870:6ec9:b0:1ea:1667:6c8f with SMTP id qv9-20020a0568706ec900b001ea16676c8fmr4515231oab.50.1697866564414; Fri, 20 Oct 2023 22:36:04 -0700 (PDT) Received: from stoup.. ([71.212.149.95]) by smtp.gmail.com with ESMTPSA id h1-20020a62b401000000b00690d255b5a1sm2427978pfn.217.2023.10.20.22.36.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 20 Oct 2023 22:36:04 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: mark.cave-ayland@ilande.co.uk Subject: [PATCH v3 77/90] target/sparc: Move FDMULQ to decodetree Date: Fri, 20 Oct 2023 22:31:45 -0700 Message-Id: <20231021053158.278135-78-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231021053158.278135-1-richard.henderson@linaro.org> References: <20231021053158.278135-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2001:4860:4864:20::2e; envelope-from=richard.henderson@linaro.org; helo=mail-oa1-x2e.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 54c9c38736..aafbd68867 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 8a3ee221e9..26126467d9 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)) @@ -5100,6 +5085,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; @@ -5166,11 +5172,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 Sat Oct 21 05:31: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: 736686 Delivered-To: patch@linaro.org Received: by 2002:adf:dd81:0:b0:32d:baff:b0ca with SMTP id x1csp635704wrl; Fri, 20 Oct 2023 22:51:06 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEQkVcCBDo0Nd43X4JdyyHeRrRdmSNNX0PHLLVtoY8vLnhOB9wRU60QtwxpybbxEcyCgkY6 X-Received: by 2002:a05:6214:212c:b0:66d:5b9:9276 with SMTP id r12-20020a056214212c00b0066d05b99276mr5484946qvc.25.1697867466198; Fri, 20 Oct 2023 22:51:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697867466; cv=none; d=google.com; s=arc-20160816; b=V8KSTpWbJ5NhUBhTw6T9kEar7ZZEQgXpXwDOxOT/0rxL/UZMj0jp3WYy45uTl3JhO1 SR4CxNasUJfwti3WFqE+ltfplFdlbrBYqqbr6b9oN2X5Lv+4M9jyXNvYv7JBinK8UpHc tz6FD/NIdWlq/Y3pndM5mIE9cYHbSqdQCMFU0W0Qnn+MbpHYSB13Phk4SIUKcmocUaXX 81y36weZzaQI2gSc5MRt8Z83IQbBcc6DpHUIn7XPcSbpYi40d+cyhlKugeXeQO53kb3m RE9xx616VLdnzkxrjOa+EEYyrIyj48B/zjKHFuVAiSjHZQLsooYLaYiT1TUV4q380Vkt J42Q== 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=uX1QKkh2g86B30ME+zMrugrJxBElODzFo4hMq8mZ/LA=; fh=TYrED6TOMxGX0VC4GtjviASLbYyJe19+7/tKWjN44KQ=; b=sBZg2+Z7DKSv+Nhbt0yr30MYIgHr8u/nAWHBD7Lt4iS86j7mC7jfp779nJRVxGwa1r QD+RUdzK0FhH8uIAMhRHlcfPNBJMKeF0YDeNeaIJUXxhYFC/tc9Pkb5o3CsaXNy0iPdo uEQa15CDnAP4QnBNNSEh3A89UWNBko42alw7a7qzAlT4Fkp6TNUb6OoFShjtTAAqUjxM VYy3xtkZze5mojG3jCadY5Uu/rSdOf14lftlCWbvGiM1Ei125Escn6AvCa+1k+kjTYfq 1VuOIEqJyRxR4cqcDlYLyMaiGDlRL4r0dNN7ufW+AT2iMDUj6JuluADBhofll9NWttPx aXAQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=pTK8rl1V; 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 eh14-20020a056214186e00b0064cd41b2cf3si2484573qvb.25.2023.10.20.22.51.06 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 20 Oct 2023 22:51:06 -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=pTK8rl1V; 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 1qu4ej-0003f7-7l; Sat, 21 Oct 2023 01:36: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 1qu4ee-0003RA-AI for qemu-devel@nongnu.org; Sat, 21 Oct 2023 01:36:08 -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 1qu4ec-0001Cp-Hi for qemu-devel@nongnu.org; Sat, 21 Oct 2023 01:36:08 -0400 Received: by mail-pf1-x431.google.com with SMTP id d2e1a72fcca58-6b36e1fcee9so1438084b3a.3 for ; Fri, 20 Oct 2023 22:36:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1697866565; x=1698471365; 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=uX1QKkh2g86B30ME+zMrugrJxBElODzFo4hMq8mZ/LA=; b=pTK8rl1VCnBwzrmkxgJB32Tb6WHE6VudI620gH2m806VieuGdeyoN8kf3Ii104isU3 bk1IzHXTMR2TLNMNcBaVf1sXYp9+1dc3/6zGQbwQbO7qPudVPRNAPUibURelOXSb6ZKR 6xDpM+iMMqNxWLQ3srnlS+KG6+bhG8MV1qS5PiTeMOLYaMGveF6qJNr+lcaj4qt/0asd I0PiDepEDG34w8kEaSR14AuFrgKdOdOGl9jNSmgDJqm3+eJbAGPsoO1ieBqc2OSoAn+/ eZv+SpugOJUazPY9p7Rd3YEj3NbtiHRbN+meexnNrUpmzttP+7OqUHvDTQf0lmz8bh0i w7Nw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697866565; x=1698471365; 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=uX1QKkh2g86B30ME+zMrugrJxBElODzFo4hMq8mZ/LA=; b=PR15+TW9YU3J/nRl2b7q/1X8JQeN4fpCFkMv6bnjMq2d9Y6tU2CQqEyTPzZZTsLzQb 47tr7pAOEoFRIcc26qZkBkI0ntIV10WqqoH3q8nw4Kxi+MCfaA3VTHRMgFuRNE2EuGvO BAJzDoVNezlvT3gydlQMw19SaNLo5ibXmXaguHRR1/rd3Oxz1QeAPEGkT/MN2Pruxiuy x0++wv86zyt77JP+95vovdF9yAOdMH4t3GcDzy7HL0JiTu0sUi8nLF9Av5K5m/TNYza6 djIFXdWwUrMCt3V1b0A+WN31xE84N0369pQexRBfDTdYO4y2QsYljSasKnsWaBbudMvw AiKg== X-Gm-Message-State: AOJu0YxvS0cuh3EZyig8SIC1fCw4249mkM84f+oCcDDokFTYINPeJybR nCQKIhpCbCl0h+29t3h9n/28KA4xOM72lJ4EAPU= X-Received: by 2002:a05:6a00:c92:b0:6bd:ca1d:c51e with SMTP id a18-20020a056a000c9200b006bdca1dc51emr3721577pfv.16.1697866565321; Fri, 20 Oct 2023 22:36:05 -0700 (PDT) Received: from stoup.. ([71.212.149.95]) by smtp.gmail.com with ESMTPSA id h1-20020a62b401000000b00690d255b5a1sm2427978pfn.217.2023.10.20.22.36.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 20 Oct 2023 22:36:04 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: mark.cave-ayland@ilande.co.uk Subject: [PATCH v3 78/90] target/sparc: Move gen_fop_FD insns to decodetree Date: Fri, 20 Oct 2023 22:31:46 -0700 Message-Id: <20231021053158.278135-79-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231021053158.278135-1-richard.henderson@linaro.org> References: <20231021053158.278135-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 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 aafbd68867..5777e142df 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 26126467d9..9f686a9995 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)) { @@ -4833,6 +4819,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)) { @@ -5173,10 +5182,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); @@ -5203,9 +5212,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); @@ -5230,9 +5236,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 Sat Oct 21 05:31: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: 736689 Delivered-To: patch@linaro.org Received: by 2002:adf:dd81:0:b0:32d:baff:b0ca with SMTP id x1csp636067wrl; Fri, 20 Oct 2023 22:53:09 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEtM+1zNG4q3ngaZVIIBgFdoxfvOo3h8uGd+EvnJkzOET44Lqq8aZCLaYA4Zo+ZvJoB3Dp5 X-Received: by 2002:a05:6358:998d:b0:143:4909:729b with SMTP id j13-20020a056358998d00b001434909729bmr4255706rwb.32.1697867588981; Fri, 20 Oct 2023 22:53:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697867588; cv=none; d=google.com; s=arc-20160816; b=lkzAKjc46rD8+EnxanvnYCgiCBen2xzsYyNcDlNI9KFy/z6NTj5gLTnymcWD59zsnW nHkK/k8gO94DvBxabUQpHlnQ17n0fVQAoknXzVa9pgFsvgLUAlkixKk3WuXY/9lQt7a5 YAwyd7M4dIF7+T//MQAYeGCDDZTNnqUw/l5wuhbBls/+w0Bv8NsIGNJ1SSE6GZmfOz4Y ocQSXW1iecsmxNkmHblh2wDQ1zrbVBNl+6tcUifxnw6LLV8MQFieG319azjHvfidKT3t R3QX0P2qbOFphd8MGm27MxJkxVa7lQl2iEu/zK8WRI/lH1AywLSI6EcpCLEhjl75vnRy CXjQ== 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=6UCx7G6xXInkBQRxZhBdyJBzDLdL126Uv8HJlOHmi98=; fh=TYrED6TOMxGX0VC4GtjviASLbYyJe19+7/tKWjN44KQ=; b=OuuSgEBRfdVREE3tKuq9BTPDXkGmMPLagZYPxbbQ3CqGScc2XGV6db7Toj6S26pulg s5n+iZv4uJin0UyBFcCVFDWqtyoktq3HUa8djBMVdvRrLdxgXn+4T4vs01RhsN4Q5aaB O3wSl/gw5/xVAPYCazqn4/4HSLFIaVFq1SBXczC0D1IhG5j979nNPiv1WM3KEllnQBHy R9f2/fNt9K9AzIrFtMmBMD0X2nGLAY15KOwd1tyNkP1nzB+0mRpG5DjTwH6vScPJcfyy YmwpOP2rbHfQSh6Ei4qvO/SDKcVmy7unT5GjHZYsnYdrh9JE8jL+Ibic4C6qnKnScmbY f9IQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=v08xtNyT; 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 a4-20020ac85b84000000b00417b4502615si2341919qta.473.2023.10.20.22.53.08 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 20 Oct 2023 22:53:08 -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=v08xtNyT; 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 1qu4ej-0003fX-Fa; Sat, 21 Oct 2023 01:36: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 1qu4ef-0003UF-7C for qemu-devel@nongnu.org; Sat, 21 Oct 2023 01:36:09 -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 1qu4ed-0001Cz-DD for qemu-devel@nongnu.org; Sat, 21 Oct 2023 01:36:08 -0400 Received: by mail-pf1-x431.google.com with SMTP id d2e1a72fcca58-6b5e6301a19so1431393b3a.0 for ; Fri, 20 Oct 2023 22:36:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1697866566; x=1698471366; 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=6UCx7G6xXInkBQRxZhBdyJBzDLdL126Uv8HJlOHmi98=; b=v08xtNyTNPEMr0rVYNt+c4oyQgz9G47luTIXrG4y7lf7nA5thn0UOz1PTMWGQoY633 jIi04k6DWYYL2EtM3jDmv8oZvAX8IJPimh3dIYN4oXb2Y22dXd3WR2J/lnfJgtmKa2UC umuCyDsCbJV5hLjeEIhrD7209Ydqp3GShSG1KYIjkGpAp6YocQUllVec2DzX4I6TxCD3 YVJ03k1uqoziHCOlVwZFjWour9WcyJ2BqsEmg8XdtBo/UDWLnXdx60x+ho3foe4NCx2x EonaHEpQ1bpNUnS5CHCoAjxPpPKCmgkmEGmJj5qy2cbA2nP/AuNa9xwtmubA+NuzF0hb 7lmQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697866566; x=1698471366; 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=6UCx7G6xXInkBQRxZhBdyJBzDLdL126Uv8HJlOHmi98=; b=dNS2g7QjE+iU9mtUukJz4stKSYRauMzy0Yy8ku0OZtbxMzdvbuWV8YlTrg1d2Aqil+ TkwhlilbZjkVnVEBPuWg6+m5L0e6LQW0RdVfsVwIpLUgos+3ygi0LXUMejctfz0ZYI0b gz3GYjDuk/MOtB071uN1szo7LzLHqCkfg9gZmU/aGcVkjEHtrUIMWvJBY4Y0ydGRSj68 CHz83HMGqiTy5ebUmlWOxJkjbnIa3d9FhRwDVynfyztLiAjZKsEEI9wP9TZgYIctY1kJ O5JWJfqmF9YCRFWmUNnW74jnDOpMMs/6JZ+xpNoFUUOH9SG3SQ755GkQHiOPF1cMcZm6 yO4w== X-Gm-Message-State: AOJu0Yz/6BiveKsuu/B/sGUcppsabvmI82fjiYWLZcyEPu98jMt3b7mn vKQbpXbuq/AhvqI+c5Nb+xElMInLNMqwAawzLm0= X-Received: by 2002:a05:6a00:13a5:b0:6bb:4360:159e with SMTP id t37-20020a056a0013a500b006bb4360159emr4355979pfg.17.1697866566126; Fri, 20 Oct 2023 22:36:06 -0700 (PDT) Received: from stoup.. ([71.212.149.95]) by smtp.gmail.com with ESMTPSA id h1-20020a62b401000000b00690d255b5a1sm2427978pfn.217.2023.10.20.22.36.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 20 Oct 2023 22:36:05 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: mark.cave-ayland@ilande.co.uk Subject: [PATCH v3 79/90] target/sparc: Move FiTOd, FsTOd, FsTOx to decodetree Date: Fri, 20 Oct 2023 22:31:47 -0700 Message-Id: <20231021053158.278135-80-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231021053158.278135-1-richard.henderson@linaro.org> References: <20231021053158.278135-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 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 5777e142df..3ad598a08b 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 9f686a9995..0eb56f5fac 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)) { @@ -4886,6 +4856,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)) { @@ -5185,17 +5178,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); @@ -5229,9 +5219,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 Sat Oct 21 05:31: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: 736650 Delivered-To: patch@linaro.org Received: by 2002:adf:dd81:0:b0:32d:baff:b0ca with SMTP id x1csp633979wrl; Fri, 20 Oct 2023 22:42:43 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHfGNG4FINPCbyydUMnSk4FVwA8+sNnILl+H6VNj6EsppLK5Vt26CLUrUzGcEz63rf4qD4h X-Received: by 2002:a05:6214:e82:b0:66d:25cb:43ba with SMTP id hf2-20020a0562140e8200b0066d25cb43bamr5354032qvb.20.1697866963565; Fri, 20 Oct 2023 22:42:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697866963; cv=none; d=google.com; s=arc-20160816; b=NQjkGgROl2z8lV6s7V+x6+f95Rl7w6gZEaIPfUSMliSaB1CP9PmaPjwRN4XsdBUNWq 2Bha9JY+VHbsvyBonL5CSBZsDJUWv9hRRXXE/joLvhpmzwr+h92Tui8MirvvnudvLjgt FN8oBQoYgQ72nUs3gLl+j4twDsz2c39z8U2e7/D9iUCfBelzOPpkQIdoQAUlOth6jpWw CancdGCed+TinrGXIZyDW+kNokkJ+yHD2EQ+7CT2/WIpup2O5wj/PFwk8dtFlUwCTYBV MGbfabHOABPpK2luLAij22kQ1RU4368YJ0ay6sJbGMTl5qCvfxpwoQTxTp48UTaYDAya MKlg== 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=XMTzCeY/hmemmPG/93ZlWXDpgu2CM2QZlX18OaCfFAI=; fh=TYrED6TOMxGX0VC4GtjviASLbYyJe19+7/tKWjN44KQ=; b=PNHB/yjL46cmeMTfPderrT2jcejKnVu7dQF0Iai+vzufsIKPD71WgebbdqIb0P0IX5 ei7fL3NXIhXYE142g0a+kxt6jS/Iudu4yJNOqqQJs6RnnBKGIPGhSoEuz5b08N029gPc cOP4ICQL5YTilJFEo6BgaEb8FS4qpPQDjrvPfqgPKEYiwSS1XZdJTbPj6/+ZRH5u1UVU RlcR5DDPXXW1QTZvHTuGrZ/bpfyZvtm190341Es2XYPZj4dcYCU1EHSeUH+8cAgcCtzG mEH8A0dA2qJc0TKTKI33pJ/sMj/gtZJki3V5531632gE8igtKlt0moRWqBi+MJ06zJvE owHQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=RRXjurXA; 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 o8-20020a0cecc8000000b0065d057151f4si2516302qvq.436.2023.10.20.22.42.43 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 20 Oct 2023 22:42: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=RRXjurXA; 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 1qu4hm-0007Fe-Ts; Sat, 21 Oct 2023 01:39: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 1qu4ha-00076s-7r for qemu-devel@nongnu.org; Sat, 21 Oct 2023 01:39:12 -0400 Received: from mail-qt1-x829.google.com ([2607:f8b0:4864:20::829]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qu4hY-0001W1-Hz for qemu-devel@nongnu.org; Sat, 21 Oct 2023 01:39:09 -0400 Received: by mail-qt1-x829.google.com with SMTP id d75a77b69052e-419787a43ebso8145651cf.1 for ; Fri, 20 Oct 2023 22:39:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1697866747; x=1698471547; 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=XMTzCeY/hmemmPG/93ZlWXDpgu2CM2QZlX18OaCfFAI=; b=RRXjurXAE4wbEKjTaQOUaGcB3aIn1rDUs8XWifRgzP0T+bjBj8OUtSZ+Yxrh/RRJsR 24zdo84W2chsKzZ3x01c08AHH5qp8Pl+1XYX4jbIhKQsaU0jQVfckuQAAjUm/zv6phSG aX0tIsnGVKPQId01WwGFtNo3wxAsuAzcAOxoAYz9K52ktWtbscdx/vawhxRSYVJM6FQz 13tcqjjXohEZyeqvp4Q5yl4bIEw8g+q0YsveAgAnUwk8RhHlezf+KfON5CMSPSTrYQMt 4SQsyCgqVxm7Xp2CjbdoDyuPD7yRbn/j0PgfLnGzigPT04G9pL0H2zzdbDzbRcOq4HeP n7Vw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697866747; x=1698471547; 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=XMTzCeY/hmemmPG/93ZlWXDpgu2CM2QZlX18OaCfFAI=; b=QPy0+29Ab4kvq1tqamseL1q/1haWonyLEkcCjlpi4VEuRE/WfMxVThDEn93zoRsNVU vLdE2AD/gxQL2mVNI0fgFTw65MZPDEEIiQKTvUIKAg2w2RTxCL2E0izKdFTLIbO988VO lYslmB54bBM7pHhrDmF7CsxFcUGyoCqDlGp9E9zyYIQU9CEVSgApLX1NlPNSCtee6o4M NCakatU3abkcPXM8FHaAd8TpW8aInliWHMvyfh2bti7UcTbJjTgAPTlwiwe+JTuGeJ8b rM7DElSS1qVkI4AVNdgDZNSF9kbanAMSANHbT51sD+zq6IZzRVL3NAV5uWt/ZS1FIBrT Cn6Q== X-Gm-Message-State: AOJu0YwDIX+L2ml8L/cic2i8r/Ge+E0St+SgTz0bW9+WFgnq7hwsVpGl 2u8nBGKT1s1QoMZJKc4sNCrh9t6kYXXjm17Iueg= X-Received: by 2002:a05:622a:86:b0:41c:cf78:a9df with SMTP id o6-20020a05622a008600b0041ccf78a9dfmr4013490qtw.46.1697866747528; Fri, 20 Oct 2023 22:39:07 -0700 (PDT) Received: from stoup.. ([71.212.149.95]) by smtp.gmail.com with ESMTPSA id s15-20020a170902ea0f00b001c60a2b5c61sm2397298plg.134.2023.10.20.22.39.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 20 Oct 2023 22:39:07 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: mark.cave-ayland@ilande.co.uk Subject: [PATCH v3 80/90] target/sparc: Move FqTOs, FqTOi to decodetree Date: Fri, 20 Oct 2023 22:31:48 -0700 Message-Id: <20231021053158.278135-81-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231021053158.278135-1-richard.henderson@linaro.org> References: <20231021053158.278135-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::829; envelope-from=richard.henderson@linaro.org; helo=mail-qt1-x829.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 3ad598a08b..431152dde9 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 0eb56f5fac..fd3ffa1b96 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)) { @@ -4900,6 +4886,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)) { @@ -5181,11 +5191,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); @@ -5202,10 +5210,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 Sat Oct 21 05:31: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: 736673 Delivered-To: patch@linaro.org Received: by 2002:adf:dd81:0:b0:32d:baff:b0ca with SMTP id x1csp634948wrl; Fri, 20 Oct 2023 22:47:32 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGDNqHBbtXaiY9g/Wd7s+o39B2kdQ3xcDTxNcq+WQM5zOKcx2ypoDueKImO5X+WImIfx7O9 X-Received: by 2002:a0c:f60a:0:b0:66c:fa89:a894 with SMTP id r10-20020a0cf60a000000b0066cfa89a894mr10337152qvm.10.1697867252152; Fri, 20 Oct 2023 22:47:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697867252; cv=none; d=google.com; s=arc-20160816; b=y2MNFjTw03oKS8+NUossUKM5YPrlT6o5De7xP5b9dftAlSIuwvW2lLxbhp4hR+ql3a 8dTxpafqrlSW5Xh4Yqv8I8A/gaGC9UI3h5E43Mwifv43RAjBIEQghVTJfl3ifkZqhTHr woZU3TMCuJfuOz/naVYXBnDP5nQhgHkFIA5/g4WbkKQoa3QNFmha9TmUmvX6kj3nWG23 nLWeBogNn+MfCcad/bifwSBQX+DUImZEkYntS5o3XisRB8OOD6lp0qucJHImB97GKfds VPdr6uzD8L+PG+zVsGHEPSzvHeZl8AkTZXY0iY00GHxchQcmmd7Rs/ll3QjTKOvo0dQm so3w== 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=kzXDIm+XB6/+J2teHXfrkX/njJ++UKPy0u9EIz6nhBs=; fh=TYrED6TOMxGX0VC4GtjviASLbYyJe19+7/tKWjN44KQ=; b=QmloRmcEZVhBg5/Wv6HeV8rD4RULtKboYuIqkr+1XDgbi2TLTkSZHNjpt967M6ElqW LDdHKnvNWRzvKfAK/op5nvSkuwBT1mROiPnd8RYykkYkmfL5BOuT2JMov3j8Vri58zfw A0AhZ7D0BTdHbXGuz5o4NM7Qhv4wkabrgxYAuoknTw5lpuHLMREr5/6jbk4rtd7JIi7j iF29LsJulSmQRaJn1aMYcihnqDOAOhuyRo799YPxFo6vMf1n69XBWZsn6QWLMnM2MXq8 dWnyGR229egQclVCWs3GtpYekNhfOupfACDu3aZP5ZvfjSrSrR78gF60m2mzMpb7itFS 0HcA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="EyP/PD+W"; 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 q6-20020a05620a038600b007742286b280si2476996qkm.457.2023.10.20.22.47.31 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 20 Oct 2023 22:47: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="EyP/PD+W"; 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 1qu4hr-0007UT-IY; Sat, 21 Oct 2023 01:39: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 1qu4hb-00077E-RL for qemu-devel@nongnu.org; Sat, 21 Oct 2023 01:39:13 -0400 Received: from mail-pg1-x52c.google.com ([2607:f8b0:4864:20::52c]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qu4hZ-0001W6-Pr for qemu-devel@nongnu.org; Sat, 21 Oct 2023 01:39:11 -0400 Received: by mail-pg1-x52c.google.com with SMTP id 41be03b00d2f7-5b837dc2855so1121507a12.0 for ; Fri, 20 Oct 2023 22:39:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1697866748; x=1698471548; 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=kzXDIm+XB6/+J2teHXfrkX/njJ++UKPy0u9EIz6nhBs=; b=EyP/PD+W2NiAlIoqzlXr0m3+KfRtzHwg6x94oNTFdPf65N5i7EmuHbCe/zObLzEBJS +FVlv13EroJ4+gyJ3/e1olHSKOphwIUCR4ioZqqxH5NBuovxQCR0IitOPmigS3NSaCZu 1E+h4l/pYvCLrh8E6D0zm89/8S0WeTc9pkoEs/7617UPDXIXL2ES0oHzGZG+Pqb5U3W2 HytF6R1ybQxAtfRU+EI5f+P6tfsQBXGvL+7f0nJ62xMXvaYtvCSziFyvn4wbBuyBtTt3 3J29x1lq/ABnh6AB7ZNxeXiPN0F96+4OtfYYOrnP5+1LmZxPcEHsmPYA9z8IKqMNC9cM MhuA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697866748; x=1698471548; 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=kzXDIm+XB6/+J2teHXfrkX/njJ++UKPy0u9EIz6nhBs=; b=wKWiSikd2UXioN/y21xYlfAC9WrbStWnbvqg5Xn/16/tPFXHpKTD30DD4arFM92UyM zGfDsFTpAeOLFoCXGyL12hL7bBmtO0d60ioDcj3Z+ABYDSPc9vkJuu3+g9ywmfyzMSGI EeExTYa4/m48EGn/b9kHTAuhGmBZKFhsvZAzeWkYaHrFAOHoQmhgrikbgVBD0hOTCnJV F5p8EfSIcnatxkK4ckCEuy27+8Vz9kZN/LnLFfbuE4C6hHsEbGIFPltC126vJmlF5jD0 woAZ9P+FKE/oSaZD23KFV7FNBRw0Tk0muVyEThy+vYXSXrSC1ShaN5bIR+CsRM7Y0/8o 2ptg== X-Gm-Message-State: AOJu0Yxb/fv9PAAiHVnwyVEpqeWlfCmCTSsq38PSfpGdfxll7vAfp5Qt /gfMEotiOeG5gSv0M6twXGaSQcMc/356W0b/dPM= X-Received: by 2002:a17:902:d4c7:b0:1ca:3cd7:eadb with SMTP id o7-20020a170902d4c700b001ca3cd7eadbmr4408586plg.9.1697866748414; Fri, 20 Oct 2023 22:39:08 -0700 (PDT) Received: from stoup.. ([71.212.149.95]) by smtp.gmail.com with ESMTPSA id s15-20020a170902ea0f00b001c60a2b5c61sm2397298plg.134.2023.10.20.22.39.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 20 Oct 2023 22:39:08 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: mark.cave-ayland@ilande.co.uk Subject: [PATCH v3 81/90] target/sparc: Move FqTOd, FqTOx to decodetree Date: Fri, 20 Oct 2023 22:31:49 -0700 Message-Id: <20231021053158.278135-82-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231021053158.278135-1-richard.henderson@linaro.org> References: <20231021053158.278135-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::52c; envelope-from=richard.henderson@linaro.org; helo=mail-pg1-x52c.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 431152dde9..908b2ba408 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 fd3ffa1b96..def29dd4b8 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)) { @@ -4910,6 +4897,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)) { @@ -5193,11 +5204,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); @@ -5223,10 +5232,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 Sat Oct 21 05:31: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: 736658 Delivered-To: patch@linaro.org Received: by 2002:adf:dd81:0:b0:32d:baff:b0ca with SMTP id x1csp634564wrl; Fri, 20 Oct 2023 22:45:51 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEcYr1C43pgR2aY81vdDioZj1yEqcshI9Wgyk19h0kvV23xyj4GOjv3MGXQAyb+GGIU6bBL X-Received: by 2002:a05:620a:688d:b0:76c:572e:8de4 with SMTP id rv13-20020a05620a688d00b0076c572e8de4mr3621633qkn.54.1697867151523; Fri, 20 Oct 2023 22:45:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697867151; cv=none; d=google.com; s=arc-20160816; b=DMe+53Bbm8gZ923eNr9oQ55AgoD0draeV+x+gje76R00AjDTLs0emAQ81Qy2d9D0BU jMl8qeCVHaXkWHBIwFBnvUQWyDajSbWzFv6Z9whkAoCMIpVVQl9iRQgaSehLLtnglDgi 2Vf7LmZKetWZQC2VduLJf8+e+9GHPM2EDCglJx789hfXCcndDKuFy6yCI/TQhvkahqD0 oVCm3V/JEZ3HFQHFktiEFaNRUWv+6+fthxk6WWym2sKN+NWcWlU/YA66YoB8Q1CtcSvF uu+4JXisoV/kOaeoMYeGFGlzs85sfUzuMBIIyTzsWIAUU6uuG946QbiRrUq6kgjsTN/C 710w== 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=0HHLpF3OVuW1DDKSYABmjOz0eUOo6D7/qnjKtalhCCY=; fh=TYrED6TOMxGX0VC4GtjviASLbYyJe19+7/tKWjN44KQ=; b=jSc4fIyF6kjenGEQWuNiMPbikYZkbOnLfz3MMMp8XQZ+yETnHYZ5j3K/w5t/4re3zw rxnyd+gKJrvrjHvSX372cOhn3Z2+w0q5mUpqpjJ1iettcoOfmPNJwy5Bq1A9/f1d3SuH 1uT8gtKVs0+spy0KPdisrZOG2kzQuQxVLimWfsD6yrxUgsKArj8VRojxZWpmDp8GNS70 4UAQCcVOi63dS0+k3RVACjO0OIqwtBy3Mbxm7bblTKp33ZXsE/rS8TCve23MQB60LX3O HEL9PPxtRLiWN9nI0LSH+zbMSVHFWi8HMwq+GCXsTf1OydlNL2LfL8rh7OKfBVHiTcya Yduw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=pQogtzJd; 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 l8-20020a05620a28c800b00773db595cccsi1021185qkp.672.2023.10.20.22.45.51 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 20 Oct 2023 22:45: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=pQogtzJd; 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 1qu4i8-0008Bu-Jw; Sat, 21 Oct 2023 01:39: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 1qu4hc-00077F-7T for qemu-devel@nongnu.org; Sat, 21 Oct 2023 01:39:13 -0400 Received: from mail-oi1-x234.google.com ([2607:f8b0:4864:20::234]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qu4ha-0001WD-JF for qemu-devel@nongnu.org; Sat, 21 Oct 2023 01:39:11 -0400 Received: by mail-oi1-x234.google.com with SMTP id 5614622812f47-3b2e4107f47so1111396b6e.2 for ; Fri, 20 Oct 2023 22:39:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1697866749; x=1698471549; 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=0HHLpF3OVuW1DDKSYABmjOz0eUOo6D7/qnjKtalhCCY=; b=pQogtzJdYQ5gE20uWJgC8Rn7w3Tgnd5R3X1C1o4/FIv25xoaCSJmGeMwi4uxUV1YBE IcdgbwkejV0SUxTEyE3iExsN0g8fytL1jN//8xKicR2urY3M0oF71mRKFU1nYaazOFgR EaeFtlVkCLqWupLGW8lvXCPT/+9Wdhi4CCjSAZVUqsTt540vGAqCf6XyPRKu/O2XmeB/ VnIW1MIRYC+ZJhNbtNzCYiMeS2bFDpwws3Ku7RHq1iFIvbRQR8d+NlQRBj2ezXnHx/n8 mbitR28M8mMP3JuhBguhjRy1+cTRLmh7n+Cao/67GBDVvIvlWhQp+jL70oxh4T5YvAai Hhxw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697866749; x=1698471549; 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=0HHLpF3OVuW1DDKSYABmjOz0eUOo6D7/qnjKtalhCCY=; b=AuoZx9eSGqIlqdRpX2u4gbeRolTLwmGEkb7tOf+qf5YT28M7FdastoS5cfQAk+Wz4U 2cX//m8NkND1GrbHdmwPqcJlPqbz1Z3o6y6z4rM5PuhSZHlni2KzN026iUekqePeUtJC kARHiizA9kH/bfVMX6fZ/ZCdtVDaAXjrPsiRqTt0pQNBAdeh4oKtwFuOw6sg8hrsgT6K jlhbk8dYDcwCoBrb1iW9BOn1j0uetD4p3uRUen1fbolaNNYzKOhHrzkFpQBo7Gtg71/s SdCQuxbJVybe8uVF+tNRPZH/g4MOWsWej7Ech10Kn0QY1eeNPLIbp1xwoOGTQPZ9qBEr Cf2Q== X-Gm-Message-State: AOJu0YyyzZWBGk0UjOwxIMW5w37wDhGSepdJUbbLtJn0LAcJTJHNBtho uU39LQ1nFGVpysDMY1tVD10Tuzf/vp7ZNNZ+pzM= X-Received: by 2002:a05:6808:309a:b0:3b2:e5cb:8e53 with SMTP id bl26-20020a056808309a00b003b2e5cb8e53mr4951796oib.10.1697866749291; Fri, 20 Oct 2023 22:39:09 -0700 (PDT) Received: from stoup.. ([71.212.149.95]) by smtp.gmail.com with ESMTPSA id s15-20020a170902ea0f00b001c60a2b5c61sm2397298plg.134.2023.10.20.22.39.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 20 Oct 2023 22:39:08 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: mark.cave-ayland@ilande.co.uk Subject: [PATCH v3 82/90] target/sparc: Move FiTOq, FsTOq to decodetree Date: Fri, 20 Oct 2023 22:31:50 -0700 Message-Id: <20231021053158.278135-83-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231021053158.278135-1-richard.henderson@linaro.org> References: <20231021053158.278135-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::234; envelope-from=richard.henderson@linaro.org; helo=mail-oi1-x234.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 908b2ba408..a444819d6c 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 def29dd4b8..39598514c0 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)) { @@ -4921,6 +4908,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)) { @@ -5206,15 +5216,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 Sat Oct 21 05:31: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: 736646 Delivered-To: patch@linaro.org Received: by 2002:adf:dd81:0:b0:32d:baff:b0ca with SMTP id x1csp633897wrl; Fri, 20 Oct 2023 22:42:20 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEJQt6AIswh1bLOZqhkxbBDknAbl7A0x/3wIgZugbdFnejKXQN39uJBM1Ut8nXXcD85AUBZ X-Received: by 2002:a37:c20a:0:b0:777:ee89:c03a with SMTP id i10-20020a37c20a000000b00777ee89c03amr3721410qkm.77.1697866940607; Fri, 20 Oct 2023 22:42:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697866940; cv=none; d=google.com; s=arc-20160816; b=bSeIjw01B8qXiZUtbOj6e1XvngNysc74fUWBgEDf8AqHRuqvOvyakmwUGqnOxK80gX JmOK5LcAn6IGAZmTzlMwcs8yQ6pV8FNO3Jzg3sNUm/WlPkeKWGS83N3Xte0p4bONJSo+ Dms957KSh+OR1X0WaC7UlLigS7QSoPG7XV4PD1KNr6a5LtnvkzLXK34QyS6KQ2VU+OG9 rQbzrVYcx2ceXa1APxb/RmpLWwECH22jjmB93ro9zmrvQ7fKUvItqMPrB5wUFRsb9Ne/ 2EQ3SUSgtksdUaIZQwkgmywVapfBlbHqhMls2cvmOvB86zPSkWDi9JIVLV5W9KIj+TmB /wWw== 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=OpzCpTAfXMeNZscs008Ujd7Y40lT8n7ROAIAfLgRoYg=; fh=TYrED6TOMxGX0VC4GtjviASLbYyJe19+7/tKWjN44KQ=; b=QLK+8xlA6UwuBaSwk8htecSooxAhpevqTBaxk4E3jXtrOrQiq1fbqsEAXXbM5lEvV9 14kUHbUK+9YfGqodABjKnfa15zEJpqhe6jzgzjXAJxT39fS2LHTH2iKWHt8k7RS04TuL A8C/ndsrXLr5JZGij6j4VQcoC8BY7S9dHi73R7NDUmGn88Nz8jhvri179RmnYQyp7VQW b9f5XOK8dxUR81hWmgmhzmQyXhE98rlhrN1F/Jnst7m42Ks0EMGz+XHghEvK0Xc3xrdC P5lyOpthj+gjOWvkJDXbW+/yOBdUIy35mhblHvHTaQSVitQd8yc+lGg5LAGRewxxIe4X +HIQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=bRH8c3HB; 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-20020a05620a144700b007749dc7ce32si2326382qkl.123.2023.10.20.22.42.20 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 20 Oct 2023 22:42:20 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=bRH8c3HB; 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 1qu4ht-0007bg-5U; Sat, 21 Oct 2023 01:39:29 -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 1qu4hd-00077R-93 for qemu-devel@nongnu.org; Sat, 21 Oct 2023 01:39:16 -0400 Received: from mail-pg1-x52b.google.com ([2607:f8b0:4864:20::52b]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qu4hb-0001WN-KU for qemu-devel@nongnu.org; Sat, 21 Oct 2023 01:39:13 -0400 Received: by mail-pg1-x52b.google.com with SMTP id 41be03b00d2f7-5ac88d2cfaaso1177803a12.2 for ; Fri, 20 Oct 2023 22:39:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1697866750; x=1698471550; 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=OpzCpTAfXMeNZscs008Ujd7Y40lT8n7ROAIAfLgRoYg=; b=bRH8c3HB4ODSPIKta1dkGlNyC8VSplk214fcrRP7MlBqtlqfVl0jCPRy2RjLlMFQya pmZWa82QSvziwupo4hRpSigpWdqN/7V2dVVC6CP+bfHl/ZoEem6P5l2ZUbepItQ3o+Bl 7Ny9EmKlbqLyJt9mUZfMo6F8lb07AlF9bpysheVvG+3gcX7GEqVoXdjW0SYvOlkWxVgp BCBB1foDVytGRKusUfmuMFcnh0cuBUO39WSY2QCQ2TYaDO0bY3TCgg5p0enBlVke4oW7 pu/umdEyWNch2cw/1tOCcboh90jqFKhISDdUJ160T/ytj+s+/hbx96w1QtYOGHNuR/Kb rb+w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697866750; x=1698471550; 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=OpzCpTAfXMeNZscs008Ujd7Y40lT8n7ROAIAfLgRoYg=; b=dGVV6eDk/6CAZRfOwsXrd0ivVzFY62BbPzQXPXRlKVjWQPqZXuy9wA6uoqisOClR1d rj3hoyP+K8k5jc4eTORZMebrCN0fF2Vi0Fyb/jhuCuECmWAUKFCHNVEt1KzXhJ2kBw+C /uH/Jz/dm7zpfe0lV38UWV++xd2VXnvv5+K6kd2GKDULG7cSIh3YjixULc+Ah4cWvYit m1oCum0ATFdGbOqJ3pkhzonF4KIi6WsQRuNAV48l5RtRpCmzCza4yDgFN+S+MhZ/Pk2P Qt2YhF/XVUBWqyu4veOxflrN/DKSza1GKtZYyCRt7HjS10q4XRD86vJXWltx+Ohw399t DkSg== X-Gm-Message-State: AOJu0Yz9WQik999KwWnXjtgkhbE5QJC+aDMECzAhj4B3uBpcn7HKMbCh Nf7rYVyj86g64Gb3GDjCYZPZ8hd4jPwpfV04lPA= X-Received: by 2002:a17:90a:f30d:b0:27d:427f:1bf4 with SMTP id ca13-20020a17090af30d00b0027d427f1bf4mr3554816pjb.19.1697866750225; Fri, 20 Oct 2023 22:39:10 -0700 (PDT) Received: from stoup.. ([71.212.149.95]) by smtp.gmail.com with ESMTPSA id s15-20020a170902ea0f00b001c60a2b5c61sm2397298plg.134.2023.10.20.22.39.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 20 Oct 2023 22:39:09 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: mark.cave-ayland@ilande.co.uk Subject: [PATCH v3 83/90] target/sparc: Move FdTOq, FxTOq to decodetree Date: Fri, 20 Oct 2023 22:31:51 -0700 Message-Id: <20231021053158.278135-84-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231021053158.278135-1-richard.henderson@linaro.org> References: <20231021053158.278135-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::52b; envelope-from=richard.henderson@linaro.org; helo=mail-pg1-x52b.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 a444819d6c..41bf7a2a33 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 39598514c0..05887f37d1 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, @@ -4931,6 +4919,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)) { @@ -5218,11 +5229,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); @@ -5236,10 +5245,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 Sat Oct 21 05:31: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: 736687 Delivered-To: patch@linaro.org Received: by 2002:adf:dd81:0:b0:32d:baff:b0ca with SMTP id x1csp636048wrl; Fri, 20 Oct 2023 22:53:06 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFxOTzBz0GQ5pqlz6+AIH6xHCU/6jWD1y2J3WVgubHAaWL1xrcAmzWN+8txui25y7Usb1oC X-Received: by 2002:a05:622a:40f:b0:418:12d4:c096 with SMTP id n15-20020a05622a040f00b0041812d4c096mr4460887qtx.2.1697867586523; Fri, 20 Oct 2023 22:53:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697867586; cv=none; d=google.com; s=arc-20160816; b=bpVoeu25wlgRH+VXGhuOZ76zRseOsOyGnTXnMYeHzGnUHEPKRme+qC0GEMpa36pl9n wf5WbeEzr5CxWM5heOBM2YRwA9+zBIyTV4qfgLQhbLSDQ6qjzb2UqP6zuaZtTqJh4aAb FLUrvOIEuNmCvjH23ImoLlgQBRCvzJ0LMbB8cAZd6LDrGkB6IfnoD6ubGPT4kQ3XbiqN Ga44+o4gylY3FIPTRwp0ywS/qWsHafn5ue8K5z/EKA+fr6oKwowPE0X/QXCE0HFGZU20 ZmcobgwMCFlI2FazGN1XYkgFmcBGAMC2LX+j6gj5cZVj3ATCZbhP9KPvOVvGI9uh02U8 6JhA== 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=VEqVu0Hj0xGJHwQ4jxavqV52VeJx1CP8Hc3sSSbMfq0=; fh=TYrED6TOMxGX0VC4GtjviASLbYyJe19+7/tKWjN44KQ=; b=r7eNY15HZKh6Wfvx8joH7ubkNQTlrxKAxECa11ei6ewj5dPkb0ohyltDnABx4gyIOS LHSeSpcif0xy65TZB27HQFgIoxr539yu6mB/kowmd0JcfPSVdyCYTNDO8NIl2c+z24F8 DlX/9mXn766Ev32ekoIQGkkRq8z0qztmYyi/xNAxnTYd456O2pgMdiw6gUb6QW2Ex+06 nkX04tYfDaQ41INk0TTEqEj7LdnVKICJUFYqFvA65OhJPjgTMB46Ul786xjU/ZQkCAvQ M8V1/AJoyI17fZ01LrqtKTXXe5UQTKRb1uC4tf1wSIkGQYoBUOZ1eUUrSPpRHZwKOq4F er0Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=IFtjrwEf; 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 d11-20020ac85acb000000b0040eb9b330d5si2540426qtd.492.2023.10.20.22.53.06 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 20 Oct 2023 22:53:06 -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=IFtjrwEf; 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 1qu4ht-0007bW-5O; Sat, 21 Oct 2023 01:39:29 -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 1qu4he-0007AR-Cz for qemu-devel@nongnu.org; Sat, 21 Oct 2023 01:39:17 -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 1qu4hc-0001WU-DY for qemu-devel@nongnu.org; Sat, 21 Oct 2023 01:39:14 -0400 Received: by mail-oi1-x22b.google.com with SMTP id 5614622812f47-3b2ea7cc821so1100826b6e.1 for ; Fri, 20 Oct 2023 22:39:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1697866751; x=1698471551; 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=VEqVu0Hj0xGJHwQ4jxavqV52VeJx1CP8Hc3sSSbMfq0=; b=IFtjrwEfGtyoVgWHQI+PZwIWg8AvFNLK7SwOOthgRNBd7SZmEIZWDLLjcou7zW6Raa TiIjOr8MmlVKpY7b2rZMVgkZYkyfW/ZHofh0SJHzah2dMKg8zli/9dV1Kq+htMik7rEr uP0aph2FkM8RL2OD6PlHU8D2B4U4n8NV6cREKFFn2AgW/3EISSg9VprZJSz7txI+YtUT S7tmANk84zoNfxppJvAOnxZ/JLdn36IDQ3t+dnvX4xzXe9c5xCvAs6p7cw46YCiElrJX TKl48Vg0IyByudgtHW8v2s5Lj1PcTl4pZ/A2prezLHX6d7v66Ghykef1t5ZZ5i3SO4BT w5CQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697866751; x=1698471551; 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=VEqVu0Hj0xGJHwQ4jxavqV52VeJx1CP8Hc3sSSbMfq0=; b=Wnvixd929SZEhETengD9nHwlU0GYEu/pVqC0NaCq+xI1q1hIUfve96dvDB51RnhZv/ P2WrChsEqGA4o0jqzcyxhWrurLYA45FAt8ALLzseChWT0oqnAHVWFGzeiQdE8SASu/GO dUSCypkjxJ0XqU/unq36S2QPvp1yAmObyJjECabXHQ9T+sUQoYHJDQBInEUkv937dE/+ o/TRW84PMMZBtGDyXDFb9aEU1BgdTzDXmfnEEMN1O5/LGNCz/j1Mo9eWCDHXBYUpfEG/ 03vnQkHZLaOokMsWYk4arP2ATjSmWIWiQuUBHGv4BvxyU1esqTjXKuZTB3IvwlSqPWbT JiJA== X-Gm-Message-State: AOJu0YyeEqC0o6Oxb7IJp66V+eHYz62otzA2dbh+lR41sV8fStsFg6fl ikWNuRTuorlIPQXC7dNN16Ps1nnEB5kYv5ie0iE= X-Received: by 2002:a05:6808:181:b0:3ab:8574:e8ab with SMTP id w1-20020a056808018100b003ab8574e8abmr4159043oic.21.1697866751172; Fri, 20 Oct 2023 22:39:11 -0700 (PDT) Received: from stoup.. ([71.212.149.95]) by smtp.gmail.com with ESMTPSA id s15-20020a170902ea0f00b001c60a2b5c61sm2397298plg.134.2023.10.20.22.39.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 20 Oct 2023 22:39:10 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: mark.cave-ayland@ilande.co.uk Subject: [PATCH v3 84/90] target/sparc: Move FMOVq, FNEGq, FABSq to decodetree Date: Fri, 20 Oct 2023 22:31:52 -0700 Message-Id: <20231021053158.278135-85-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231021053158.278135-1-richard.henderson@linaro.org> References: <20231021053158.278135-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 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 41bf7a2a33..1b14a49850 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 05887f37d1..1e506e8366 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, @@ -4827,6 +4804,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)) { @@ -5181,74 +5202,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 Sat Oct 21 05:31: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: 736664 Delivered-To: patch@linaro.org Received: by 2002:adf:dd81:0:b0:32d:baff:b0ca with SMTP id x1csp634600wrl; Fri, 20 Oct 2023 22:45:58 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFdvcegMVeGMzH0GRirZAPEvCm2c/3vvcfidHycVYS8skYockMovsC0HKVhhUk013tUe8iY X-Received: by 2002:ad4:5de4:0:b0:66d:696b:db75 with SMTP id jn4-20020ad45de4000000b0066d696bdb75mr4268944qvb.32.1697867158542; Fri, 20 Oct 2023 22:45:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697867158; cv=none; d=google.com; s=arc-20160816; b=kz6PlziE79kiQO/L2Q6Q6DJDEybZpHplqNY8YSoxI5FNWRNvbKxI4J0L8KAqRg67P6 w5HxJuLImDoop3D7Ls3xjZLKtgenl3hX8D5Ve66XB3tXYsChsgCpQMKxiMG7ujairrdf L21f+1uVjbfnQdZIiA8kA2V9/pABnXDq2QtnD4Ca/nSc/SoWb3X1oe+XVYJcuH/irErq V0xy/Mdy7cKksWIDzFo0qYv1t63nz6AglzMjKuOLZqbleLy1yEXDJgeFIlSm80CYvAos fNEoVzrEXhMiYaLV32XE5xHBgdnAWWsXwjjV7LRVJU7OCUs9utLg4i1cRAOeffyqvmHL nuMw== 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=TDLzFmKpx9RPdY5yOthnlJ1K0cQbHo5GSR5YfqKL4hw=; fh=TYrED6TOMxGX0VC4GtjviASLbYyJe19+7/tKWjN44KQ=; b=X1yl09E4eb3seB/Pk6JWiU6dY8ZxllD00jt3pvTaEhG0GCJJjBI0rhoATYg7FItaPk FONa9EeFGQwJ17n6imJ4IIOkYHMvDIq8afhqLCxj75x5JMBkaMX6FQPk+X1WlPiG0H/L 6ODyI6djB+6GdwPo3gsgx+pQn851EQSIcI09lL6jkZS+GCvc92nXC8XOJ0//B0PR4NAW AECjFNi9pG9w0wmRz7AJLbagto/skI03YNRm0Y6DAthuXvUX7u0ym3py9QMgKkg+ArW3 WSCd32AaL2yb5PuzcZTKFe8ejAQf25tgBd56AvBY844Hy/zZe2AU7p1IfM7DKO+qIxNS 11Eg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=f1hCiQhF; 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 y13-20020a05620a25cd00b007777245a946si2474754qko.41.2023.10.20.22.45.58 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 20 Oct 2023 22:45: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=f1hCiQhF; 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 1qu4hq-0007O2-ID; Sat, 21 Oct 2023 01:39: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 1qu4hf-0007AS-5T for qemu-devel@nongnu.org; Sat, 21 Oct 2023 01:39:17 -0400 Received: from mail-oa1-x33.google.com ([2001:4860:4864:20::33]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qu4hd-0001Xq-6Q for qemu-devel@nongnu.org; Sat, 21 Oct 2023 01:39:14 -0400 Received: by mail-oa1-x33.google.com with SMTP id 586e51a60fabf-1c0fcbf7ae4so1175881fac.0 for ; Fri, 20 Oct 2023 22:39:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1697866752; x=1698471552; 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=TDLzFmKpx9RPdY5yOthnlJ1K0cQbHo5GSR5YfqKL4hw=; b=f1hCiQhFX6GOaDE6LjyAcMPJjWfbCPkHC8JVPowLkxR8Vd7u4UgMTG6/E2qYvprzUy R5ypRtxno0OHOpiEDdaMMCEF3xjba1Nsvo9BEPBtQQkFLwyE/yvA3hSnAgKRPAR2EZP8 qpruqJuIxjs7BP7UUNVpjsc8xLuK/LkAz17Qpv/M6kzRt68TpUJ08eOP3wBmCNTdr6/b f9U/aiHR/lyctVXY9il8SbJmdGnMVQbT+iZjg9INhtm8Yg6De3bJBqV9STuFL7DaB95w JoIPzafYDrkLsnyMgguHRaga4Si/iEiaTPc52a8F8qCSowCTQwRmBzkZbdygsuSOgazm W5rA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697866752; x=1698471552; 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=TDLzFmKpx9RPdY5yOthnlJ1K0cQbHo5GSR5YfqKL4hw=; b=MPmjVb3ulbIHn36DVGK6VHAdm85b3+qAH6zcXOHT1KhLYXXaK2x67GqzytwRv0g+ev O1f1sKciT3qFMnudKt/vrBJxWwhHjtfvzXK2vg5OHdlRWXvQFXdwniuhGSl63nMl7qvA 0+Ytvr474UiqfmIXEO1cIaw75xhZAI8eGfUoVSZ6QXN/jVl9UskusxpfZF/aC3pRE+gh RyQSWPnNTuem/QaKpqrZIN2Mr+iOx1ZzD8+J+u5ZC7YPWfxxW7AAQ096kF2CCgF0S7PE bTyEeKzhJSigFB+Me2aJ1kwDuhluz/MYvh/L1czfRFD/2ls2I1JAIR11JKiQBdxLnbfE /B2g== X-Gm-Message-State: AOJu0Yx6x01uWgU+sLSGXBIgC7US5tYut4JCAyGdbNeQyaSijjU7okq3 JnRlWu7fFLMmVCDA5xjFf3JswgDrPP/UU4Fm/bU= X-Received: by 2002:a05:6870:9d8e:b0:1ea:d76b:1457 with SMTP id pv14-20020a0568709d8e00b001ead76b1457mr5197229oab.7.1697866752132; Fri, 20 Oct 2023 22:39:12 -0700 (PDT) Received: from stoup.. ([71.212.149.95]) by smtp.gmail.com with ESMTPSA id s15-20020a170902ea0f00b001c60a2b5c61sm2397298plg.134.2023.10.20.22.39.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 20 Oct 2023 22:39:11 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: mark.cave-ayland@ilande.co.uk Subject: [PATCH v3 85/90] target/sparc: Move FMOVR, FMOVcc, FMOVfcc to decodetree Date: Fri, 20 Oct 2023 22:31:53 -0700 Message-Id: <20231021053158.278135-86-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231021053158.278135-1-richard.henderson@linaro.org> References: <20231021053158.278135-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2001:4860:4864:20::33; envelope-from=richard.henderson@linaro.org; helo=mail-oa1-x33.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 1b14a49850..646acad75d 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 1e506e8366..4fdfa46f5f 100644 --- a/target/sparc/translate.c +++ b/target/sparc/translate.c @@ -2423,15 +2423,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, @@ -2454,19 +2448,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); @@ -2476,8 +2478,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(); @@ -5171,6 +5177,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; @@ -5204,9 +5276,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; } @@ -5215,110 +5284,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 Sat Oct 21 05:31: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: 736672 Delivered-To: patch@linaro.org Received: by 2002:adf:dd81:0:b0:32d:baff:b0ca with SMTP id x1csp634942wrl; Fri, 20 Oct 2023 22:47:30 -0700 (PDT) X-Google-Smtp-Source: AGHT+IG4E4L1w2bbsH3ycOPXVEC7krmfNQBMzOsLhl42m0bN+xSaCaeLwKXViHJ8BIUTGG/0ho4Z X-Received: by 2002:a05:622a:1116:b0:41c:d1f1:9d10 with SMTP id e22-20020a05622a111600b0041cd1f19d10mr3730617qty.67.1697867250129; Fri, 20 Oct 2023 22:47:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697867250; cv=none; d=google.com; s=arc-20160816; b=QSQL8MTw12uAo4pMF+eC5zWzW4zQbuZvf8DkSjxF+JJSyl9grEPbrn9Vvl+VB9WUaf IZI0zIbuXe8Yux2kf+GfYk77b5ntg0rU5IlZMwoOhitsfYLieVAdtmS6cj06xtt/Mfmw nkoMplpgBO5+HA39ThmPwmHqZhVnXSKQFk9r720BJ4ev2Mj0SvaD6J2xx+SoLuzLsz// M9rkhCwdjQL4qnvCCD7cxxPEhX8KewSV1uoMNR/xR05ZLfvmUMADZ69AAvyA3WjX8wUG n3MbtwSFDO/D6y9b4WEeLWCmcc8gmm/mvJ6kAmr90TT9uuV+HaFIe1K8vA+kqqAXPZ5T pKrw== 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=5gnQAbUS7dR0ErRgJtHGVSnApIFEy5KBMSVT1gkEGbY=; fh=TYrED6TOMxGX0VC4GtjviASLbYyJe19+7/tKWjN44KQ=; b=c/LcEN5dWTfNQKX8F9oLEeTBQpQcdtMqTFMuaUFkoCx92qIwB4QQQKdSrksI/mzu2X 0aXWJJY2ZMxsDaF9vwHuJLmiyvdq61scExyFJSi5bA6Zktl9bHVbJcPKJNQq2oWhfQcY 15iEEbjnPA+zn9MRZhyvgoxOQs33bFDfrqBO5HFFBV+AFGuO4tx8IWrtdbi/9gBJSIWM eRVd7Qp/IP4BRhUTGVnVKfH+bwDOb/lKZeR9jBvP1w+PoQ1UI52UUUQhSITIXBcGxtV2 Hv1kwiIw0NC+8C5mlzTY/N0e0uKePdOart2dtsvYdpef6jilG3io+RPn4KpHzr27APMF qaKA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Pxpit+E6; 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 d12-20020ac85acc000000b004181c820bd5si2446360qtd.490.2023.10.20.22.47.29 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 20 Oct 2023 22:47: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=Pxpit+E6; 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 1qu4hx-0007rt-4k; Sat, 21 Oct 2023 01:39: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 1qu4hg-0007Ab-Fl for qemu-devel@nongnu.org; Sat, 21 Oct 2023 01:39:17 -0400 Received: from mail-pg1-x532.google.com ([2607:f8b0:4864:20::532]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qu4he-0001YK-DV for qemu-devel@nongnu.org; Sat, 21 Oct 2023 01:39:16 -0400 Received: by mail-pg1-x532.google.com with SMTP id 41be03b00d2f7-517ab9a4a13so1189817a12.1 for ; Fri, 20 Oct 2023 22:39:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1697866753; x=1698471553; 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=5gnQAbUS7dR0ErRgJtHGVSnApIFEy5KBMSVT1gkEGbY=; b=Pxpit+E6/wWD3wuj69O0Ep0a0s9paFEvpJkNhyslTd6xTkYkiQWfnojtHEcnk6oNhG J7BJgYqmthr++JXRa388wtx7VuExkoEi8mm5xtW4j54lBnBfxwCrq0FnjR5QqcfSVudj t49mm94Z3uDo74HdkZaKxT7iQo4bk/oK0fM+Z2C51hbwnJI24qT8ZI2/yo/x2K1QP0LX Q6RJRNVZqkVwmJCV+/oW9PhiLPrX9aYdA5VxAniyFazL7Nm8PNWvCMzNWLFx3MDu/dN8 5wA+zAbrYy4J2naxXWeZDbE8YFsoeEyl8kZ2ev5Ru6S4WwROhMpm6VxkeBcHsgHZeoS/ R4dw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697866753; x=1698471553; 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=5gnQAbUS7dR0ErRgJtHGVSnApIFEy5KBMSVT1gkEGbY=; b=W4QuQAnHrqRAIFzLiVza3iqi3eWpvGqOvZYSrEObfYcJ3Tp6fOIkAALo7/XGygbZAT B3wbW82MaVhDS6upBTrKITuZjSVDYadokQtX6pcRDqI8fXtDTwy8yXezRTE2kuP0+bvf s6whY1HWHYJZAzDT/Kp972sZIAo+nyRUNSRmqNwp438RxILFRQdCIl1qU7QNdsh4p5Ef jqnDsOWJ2S7IH2NzDwdm6Guzt6NIKr+YlWmTqgjXAyVIg+RvSvzr3VYPfshaoNGpYDUX JHa7iEoVbfM/KcWp/rtAlutpRZnTwldm3ndweQIMQcHHACraRIiRlIUe3LgbcwZes/Ga 32vw== X-Gm-Message-State: AOJu0YxIHUANby+B7+7GXd9/EolisfdnsGPEfcYDTZZXc8/98yfBxMA0 s08DSQg/rPbh1rLAubi1BNDCMvLAc+6//lyHylY= X-Received: by 2002:a17:902:f283:b0:1c5:ce3c:c399 with SMTP id k3-20020a170902f28300b001c5ce3cc399mr3824590plc.39.1697866753112; Fri, 20 Oct 2023 22:39:13 -0700 (PDT) Received: from stoup.. ([71.212.149.95]) by smtp.gmail.com with ESMTPSA id s15-20020a170902ea0f00b001c60a2b5c61sm2397298plg.134.2023.10.20.22.39.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 20 Oct 2023 22:39:12 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: mark.cave-ayland@ilande.co.uk Subject: [PATCH v3 86/90] target/sparc: Convert FCMP, FCMPE to decodetree Date: Fri, 20 Oct 2023 22:31:54 -0700 Message-Id: <20231021053158.278135-87-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231021053158.278135-1-richard.henderson@linaro.org> References: <20231021053158.278135-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::532; envelope-from=richard.henderson@linaro.org; helo=mail-pg1-x532.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 646acad75d..1af7bb05b3 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 4fdfa46f5f..5f706bce58 100644 --- a/target/sparc/translate.c +++ b/target/sparc/translate.c @@ -5243,6 +5243,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; @@ -5253,15 +5329,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: @@ -5271,61 +5339,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; } @@ -5510,14 +5539,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 Sat Oct 21 05:31: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: 736685 Delivered-To: patch@linaro.org Received: by 2002:adf:dd81:0:b0:32d:baff:b0ca with SMTP id x1csp635686wrl; Fri, 20 Oct 2023 22:51:03 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHWX1l7jaLxozNrPalXCVFYEXfE0+lfNRDrH5FGCDz//67cjjrG6XJ2wk9g+SIZUFYBbKPd X-Received: by 2002:a05:620a:4548:b0:76f:c24:5450 with SMTP id u8-20020a05620a454800b0076f0c245450mr4496971qkp.2.1697867463032; Fri, 20 Oct 2023 22:51:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697867463; cv=none; d=google.com; s=arc-20160816; b=heCisIc+MiIQXyQ8GFRYYcfhDAtNrAxcjkHf257JA+oSoVGYAWLM89z5uDUXsXH6US L2tYq4GybuoBMOKJBQCXhdKmo7crDcah7g1iiYd+muQ4P4QUGlE26pcDHBmxispPMMzH J/P5aajTQKPA8VVA0D7Jmi0ExfEFTchVC5z/dZueS4/9FgpH02Bt/N13gLm5q3P/fe7V s3du+TPPGDsVYrEj6qC/ifQyhf1jOGEdTk1bqMDMZaFXFNApmYtBsB4OoRmdDg5APZKp sQ9H+JRmPuxWoSZsCyrTfJSO+Ynok4Romw3S6fR3bgCVAj21pVvYCc/f0qQ+i0rZJTJe eCpA== 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=LkiYuQnjUm3QFZ8tEmqnGR8pUMxStx7fWDZeLFbpEfY=; fh=TYrED6TOMxGX0VC4GtjviASLbYyJe19+7/tKWjN44KQ=; b=ERte3+dzj9e0rol0ataYuYFG6y4Vs3rExDTt2YMyi7QXF/kFvGnriQ/t44NfQ4/0rw fdoKOl7aF6AH3AwMOc+eBHWHgOIjvAfQvyytyVRqRDrGNmnzjnWwBzlh4P9zakwoyQhi xK67wQkZUCRsxLmDiUEeO4nYWkEJAd4/wFNj4l2TjSFimOTeemjdBDlJ69620qzh3wXI Y+SKERRg35mVHJL0MMjjk3w3IZv/A/DmLmhtjf60r+cx+TKvss1L9g1XZvUDxrt/y1pd ErF9lp95rTp+YadkaUWeqSz4Besodv9idZNo2XdQOYA3kdCWulQNWGiFHwrdKoVbc3At 5umg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=xUOBlpcW; 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-20020a05620a24d400b00773c8bb497fsi2444205qkn.662.2023.10.20.22.51.02 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 20 Oct 2023 22:51: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=xUOBlpcW; 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 1qu4hu-0007ic-MK; Sat, 21 Oct 2023 01:39: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 1qu4hh-0007Ac-86 for qemu-devel@nongnu.org; Sat, 21 Oct 2023 01:39:17 -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 1qu4hf-0001YT-EI for qemu-devel@nongnu.org; Sat, 21 Oct 2023 01:39:17 -0400 Received: by mail-pl1-x634.google.com with SMTP id d9443c01a7336-1c77449a6daso12654015ad.0 for ; Fri, 20 Oct 2023 22:39:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1697866754; x=1698471554; 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=LkiYuQnjUm3QFZ8tEmqnGR8pUMxStx7fWDZeLFbpEfY=; b=xUOBlpcWXPhBwtcqpFsYT/KEaK21LS+A4VYWz8og3UIRiwmoqSB7NxXY9e+kdE4maL 6l/oK3kotGsCtwrjWXrIBwa/03pt20c6sALEkt8VGUcLX/WPP98AbtumFB8+MT7vbCAS 2k+M2XkjahQVsSOmrQeDtny2Xsu7+RRtXhIoCUxdOlugts1XPTmkkEv9vovjqCM6ZdWL OiPbcI86wMjkNWTJiQC8YMo+s/QhHYR47hTL5BaXa1gY1y+YNVL45cqdhLS48+BCaV3H k6oaf4nq+ohlN+yJzBC/CfmDtEuOwLMelJWfDTlwHFOFcZFkIEYqddn0VmiVJs1MdOnv Deiw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697866754; x=1698471554; 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=LkiYuQnjUm3QFZ8tEmqnGR8pUMxStx7fWDZeLFbpEfY=; b=upCXdPB02GuoE8P9FDhmwmszkeBV/Sgp2NrnMntk2wnlu9OC50PPf5VTlKlScshqZE 6aFwXLabKmShdVicAV4YWOFdKPNq3LI9U0IRSgjkB5BQc9BWVniHJufVC4+YJow+aw1q iEC9FYOiM9ZwduK94eJv0RstHzPC9nAzpEvdxxXo9HEUUnklvOnYYOJk2SGtuA94MwLb WitCD4pvuLhSq6viNYLqxYidqsoy8rPJbjn6y3UC7he+PFe2rbkOLzY7KNSmIyqaKCHs 7VOpM2jgFkLel3Df2BIECnbNBCWA/4aoLBqq+oEnR8u2/BIUmRDdRWaoUAaCIdTNg3qp lbHw== X-Gm-Message-State: AOJu0YyyCg/rH6kc8BIquZj6QoJ4rzCYvG3D5qz2faEk2x7s+q2ZuEoh 6/ESjxPBLYb/SOJvIQQoHGi9GhV8ST5zUZ9oAxY= X-Received: by 2002:a17:902:ef8e:b0:1c7:2697:ec0a with SMTP id iz14-20020a170902ef8e00b001c72697ec0amr4153973plb.30.1697866754053; Fri, 20 Oct 2023 22:39:14 -0700 (PDT) Received: from stoup.. ([71.212.149.95]) by smtp.gmail.com with ESMTPSA id s15-20020a170902ea0f00b001c60a2b5c61sm2397298plg.134.2023.10.20.22.39.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 20 Oct 2023 22:39:13 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: mark.cave-ayland@ilande.co.uk Subject: [PATCH v3 87/90] target/sparc: Move FPCMP* to decodetree Date: Fri, 20 Oct 2023 22:31:55 -0700 Message-Id: <20231021053158.278135-88-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231021053158.278135-1-richard.henderson@linaro.org> References: <20231021053158.278135-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 | 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 1af7bb05b3..f557371e56 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 5f706bce58..cf70837e05 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 @@ -5065,6 +5072,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)) { @@ -5347,11 +5385,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); @@ -5427,63 +5463,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 Sat Oct 21 05:31: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: 736666 Delivered-To: patch@linaro.org Received: by 2002:adf:dd81:0:b0:32d:baff:b0ca with SMTP id x1csp634640wrl; Fri, 20 Oct 2023 22:46:08 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFFAamGv8en8oWyfOrH9oeGPBXBiIQFPkciR11Mv7DfFA0WgpQ0U4wLJ+3/zQ+EwnnkkhRj X-Received: by 2002:a05:622a:1701:b0:41c:c85e:a4ac with SMTP id h1-20020a05622a170100b0041cc85ea4acmr5297322qtk.61.1697867168419; Fri, 20 Oct 2023 22:46:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697867168; cv=none; d=google.com; s=arc-20160816; b=uBGBOqQdiTFl5kigE8xS4qp8Qx9lJfMio/A+lubJhyrFUXoPgWvHYfgsFZRk5jwee1 pPDo/IQ0SS52+se80nUrjXxbrS/Lpdmxetpumm2jlgy0exN/qqRTG1QM5bBZlDj8/pBc biAUSpgwrGnxPwFswxb63l/gW0hSoVJ2bkZwesOIfHvcOboBza3M/gQTnRpqVqYDqMkI CJNRY5y4BhBj6y02xIIF5qHHg/Fd79UQbViNy9WnD3CpPu2vRjeP8C3m2DK7EAwEW5cD Y7bsnQgTdxPNavhd8Nwzoqs8DB+UUso49drTs9sf8ZbP29fZOdRgixtpScx7WhyuzH/B Jx4w== 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=5HXRF77ypBGYaTatyquMGFrTMLlLpCipd1xIO1RgxiY=; fh=TYrED6TOMxGX0VC4GtjviASLbYyJe19+7/tKWjN44KQ=; b=G3vkHMh9On/qHWyaMzQHV/Z/xqNUn6wbBrpWRgfyykcIu3qDpibueELT0Ix2H5MJKb DyIKknXI5NffQAoze+CWKz7TcA+MmUhviF5l9C7MKPblRL9CUyQrZu5OkYmHzbKLXt3A lYSDFtgnA8LSXnPinbuzxdToMDBA90rlca5WhS0Hp8FklUCCUq/I+6qz26A7Q14GCDKd O5M6w3x6Fq13hyB+9fxD2vtyEXulk16Vkss/b733YuYeCUncnKy6zleuBHoS7mg272WB oj8r8zZxRwXOcWfwzrgmk9MXrgQ+Y3pxDdexWevqgJ8tsS357i77bWg+dwUWmobP8jGs 0EUA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Z+LlaflV; 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-20020a05622a025300b0041978576d48si2416259qtx.409.2023.10.20.22.46.08 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 20 Oct 2023 22:46:08 -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=Z+LlaflV; 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 1qu4hr-0007Se-F6; Sat, 21 Oct 2023 01:39: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 1qu4hi-0007EY-Bd for qemu-devel@nongnu.org; Sat, 21 Oct 2023 01:39:20 -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 1qu4hg-0001Yc-74 for qemu-devel@nongnu.org; Sat, 21 Oct 2023 01:39:17 -0400 Received: by mail-il1-x12e.google.com with SMTP id e9e14a558f8ab-3573fa82923so6080565ab.1 for ; Fri, 20 Oct 2023 22:39:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1697866755; x=1698471555; 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=5HXRF77ypBGYaTatyquMGFrTMLlLpCipd1xIO1RgxiY=; b=Z+LlaflVxJGIY2U7UewIoDijg62Qoy4CzKEkcNId/QRCGcyaS3xpGPtqXm2qkn0jxM pdMtAigltttu08T+2rGZ3TQn8uhsoAY9K20WenfUop+pjBmmZSPXntqYskGdk3uZb1+T apSJovNeiVUO2bQKynY6+MSuMxnjRpmQ9vu82eORpHqlXYwKFXRF6886IkRCcjnIqgfo MceKjMjxRVUE0pabuq25kD1OJ+F28nIYGyCjSYjlomV8k5IsgNu1v96tpUnfmqvNaWLE LtCws30dwlr8V6pQuxPhQZbRpsJ95V3+drXiVUgDHeJxtSZTNyxYktNytySvvT93Zru6 UHag== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697866755; x=1698471555; 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=5HXRF77ypBGYaTatyquMGFrTMLlLpCipd1xIO1RgxiY=; b=teftX3m9IBEfRC7EDjgpE88yHW5wcVGtjGYo59H1PXpSU5ldeP4bROlH8mxlVE6cQd +Ar7yeWpb9Wra/2MWvjRmeYhwWBXOmn/5a1YwKAAh7kv5KCrq3Cp4544q3L9c+HzeJ8m qOO3Qu1aQDywH6Z5uLWF+i2XfK1LR1KHSyB6Y1cg6nBMMwp+d5Ea8FqZsw/um36aTIZD YrkYeiM9kyAQrzrgHWR7JbNvYpjTaMTVjWwJscx4zLXgyKDBL5dB0qlFOoEQLrA5E/VT ggY1zL7SDV06VK8VHGNKjhnMCf7dAaKKLKiNVb3OYvYKmg2moDbGX7Y3UqTfhsP1Ve1Y yn5A== X-Gm-Message-State: AOJu0YxazL4EhqNhNPkvc5zHmkdo1A6oTy6emTwNUogtr6WL2otaBIxH BwQ9mCKLLwxCBq/obUI6ZNvEDGw0cBAttYrCMVk= X-Received: by 2002:a05:6e02:1bac:b0:352:6251:2364 with SMTP id n12-20020a056e021bac00b0035262512364mr5442845ili.11.1697866755072; Fri, 20 Oct 2023 22:39:15 -0700 (PDT) Received: from stoup.. ([71.212.149.95]) by smtp.gmail.com with ESMTPSA id s15-20020a170902ea0f00b001c60a2b5c61sm2397298plg.134.2023.10.20.22.39.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 20 Oct 2023 22:39:14 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: mark.cave-ayland@ilande.co.uk Subject: [PATCH v3 88/90] target/sparc: Move FPACK16, FPACKFIX to decodetree Date: Fri, 20 Oct 2023 22:31:56 -0700 Message-Id: <20231021053158.278135-89-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231021053158.278135-1-richard.henderson@linaro.org> References: <20231021053158.278135-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 | 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 f557371e56..d03bddc689 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 cf70837e05..39cdcba56e 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 @@ -4706,6 +4724,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)) { @@ -5385,10 +5423,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)) { @@ -5471,21 +5508,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 Sat Oct 21 05:31: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: 736660 Delivered-To: patch@linaro.org Received: by 2002:adf:dd81:0:b0:32d:baff:b0ca with SMTP id x1csp634567wrl; Fri, 20 Oct 2023 22:45:52 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEToHTWUPg4beBCKlFFNMVaNbtlW26aIr7OD6HvDLb0MwcT329HIcI+p+4VDldzpRTmtu92 X-Received: by 2002:a05:6214:4109:b0:66d:1215:6e3 with SMTP id kc9-20020a056214410900b0066d121506e3mr3602267qvb.10.1697867152099; Fri, 20 Oct 2023 22:45:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697867152; cv=none; d=google.com; s=arc-20160816; b=ywx65QXeSG/H4rG7iT2i2I47jVeZgUxUypUhCZU5wSCK8wijz27QMjp8rG3M/Ob8yK WGmYrnHDzWCPDROxhocsPK0E9p+ScqlvS0hr2/cGNbMSDmZPbX3W3Wp3SyxhYlk2zjCE Y2FksRkQtLIJUp5lc1mfIsx2N3G4Q5BIwWBknROnsfBkj3pvDBzfEviPTsgFMdEvl/j/ tglQS56F//ocP4IW3+ieLe0Ik4a3Zf7tew+opunRS/z4O+XKfHkUz71IQWdF9Rcg3eb2 I1vDL/GxLYtBOuKwoFInidZxu+1cxR4m04FkofVQqsRihc0zLvLZ11DbyH4hk1aV7EzO uZjQ== 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=4CsjaUORxr6wN4wOqP3umbaJeBnhGwyvSkeQxJvv0pc=; fh=TYrED6TOMxGX0VC4GtjviASLbYyJe19+7/tKWjN44KQ=; b=nu1LwMXqS59n7ohcSfIT0fAD9BD0KEptDAqdiNzSR0SeU5I1+t2IiZhmmA30pN6v3A k8LRRCNKLarC9GBZaCqORvUMpuslIZMz8pLTVKjmRcZYzXkFRNS3l6CYeTzDuEIoCQ4m jbbP3aEy2t86lKtqTNXikw5Dm1RdaPfPtgDpBrwtOiKYhCeia+uanEmIBzIaTrCci+DO z3w9KSafCRZqgOd2+1448GAnOI4fgqj21rtNLVHx3+A9CK76803BVuWyJ9rYXjCinoLq vuxJoOQ+NkDMW3QiGk52ClUy7OCqOb//GlI9STToL6rbaAWuJVb2mHpSyEdAQ67HgJEG RCQw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=N2oTZ0YE; 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-20020ad44bcc000000b0066d0289954dsi2491153qvw.66.2023.10.20.22.45.51 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 20 Oct 2023 22:45:52 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=N2oTZ0YE; 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 1qu4hs-0007Xq-QA; Sat, 21 Oct 2023 01:39:29 -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 1qu4hq-0007OX-F5 for qemu-devel@nongnu.org; Sat, 21 Oct 2023 01:39:26 -0400 Received: from mail-io1-xd34.google.com ([2607:f8b0:4864:20::d34]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qu4hh-0001Yq-EX for qemu-devel@nongnu.org; Sat, 21 Oct 2023 01:39:20 -0400 Received: by mail-io1-xd34.google.com with SMTP id ca18e2360f4ac-7a66aa8ebb7so56505639f.3 for ; Fri, 20 Oct 2023 22:39:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1697866756; x=1698471556; 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=4CsjaUORxr6wN4wOqP3umbaJeBnhGwyvSkeQxJvv0pc=; b=N2oTZ0YEeeZLFSMzx6lNuyk+8/pdHsOhD1NqIvRwH6qR3K5BBCGMA58Xoh8K9oGAyE Zmzqk0ULBkz5pDZqmA9ae+JC0JODk9fJvZ29ntzk7zRLwz8Iz/ZFD2WRFIqn/Mu+FOfJ vfHLg0qDD/6MkJ8xDlIBXyR7+z9GbAQ6XMNHu3vP3HHwp1jdBS7NeoRi7pPwYCJls3Vr GMFbodMyCmCAaIINDeZrDfV7hZEyFyOEsnyknUVJABM4TgrrZJMb5NWD7fj8ZmXUHbr/ bjHaMMIx8E476JBh0DyRZjnrToCfD1vE6iKGunzSNJqzTrmKpgsq197X6h59463v3zkl 3sHQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697866756; x=1698471556; 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=4CsjaUORxr6wN4wOqP3umbaJeBnhGwyvSkeQxJvv0pc=; b=I5WAZ28CeRvXQzhFco59lRbEUJEJnseAxSZZn/WFePODXVCxS7d8FcdBQ9Ac0aaGs0 k9elYW3Tf0MDf2JryU8VAk0guFbsjWeA4PSKbKnLLP3RA9sNdU6fxyKll8Al6nBO3uzK 73X9C8nzGkt5fss/M07Hzy6DtGatiLiP3saMaxhzsyxuwP8znWU3pwbdfoNzn0WR5FAC P15DCT7gKXBZ46hD9xw6c6XZrU/LLUuwE7HOY36KsCmXYrH5v1Ah+4caKnKxe/hgXnaL T/RjtiLaLPwdLw+KnAExi+/0uqjJTenKGzfVO5I+H76guj7AQycbFK3pBpGuIjBn9TAH pIow== X-Gm-Message-State: AOJu0YzzoIPFmqWtV0U2Sbx41eXGtXHoMabyhkhmKJjpQhGjD2GvFGjy 3+Y9jufrOmmx7VLgE4g6yZa19heU4sigjSfBJwk= X-Received: by 2002:a92:2907:0:b0:357:a5cc:de86 with SMTP id l7-20020a922907000000b00357a5ccde86mr4075990ilg.23.1697866756134; Fri, 20 Oct 2023 22:39:16 -0700 (PDT) Received: from stoup.. ([71.212.149.95]) by smtp.gmail.com with ESMTPSA id s15-20020a170902ea0f00b001c60a2b5c61sm2397298plg.134.2023.10.20.22.39.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 20 Oct 2023 22:39:15 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: mark.cave-ayland@ilande.co.uk Subject: [PATCH v3 89/90] target/sparc: Convert FZERO, FONE to decodetree Date: Fri, 20 Oct 2023 22:31:57 -0700 Message-Id: <20231021053158.278135-90-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231021053158.278135-1-richard.henderson@linaro.org> References: <20231021053158.278135-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::d34; envelope-from=richard.henderson@linaro.org; helo=mail-io1-xd34.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 d03bddc689..955647db71 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 39cdcba56e..922d9e6021 100644 --- a/target/sparc/translate.c +++ b/target/sparc/translate.c @@ -4703,6 +4703,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)) { @@ -5423,10 +5462,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; @@ -5510,31 +5546,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 @@ -5559,11 +5575,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 Sat Oct 21 05:31: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: 736679 Delivered-To: patch@linaro.org Received: by 2002:adf:dd81:0:b0:32d:baff:b0ca with SMTP id x1csp635073wrl; Fri, 20 Oct 2023 22:48:05 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGaIEQvo+DVCd13NO5xVocS9xgowofiHFD6n5hd4VSx7OBmMTE2l5lrwBnAW+zJVhJywBOt X-Received: by 2002:a05:620a:bce:b0:774:215e:2b23 with SMTP id s14-20020a05620a0bce00b00774215e2b23mr4608439qki.41.1697867285055; Fri, 20 Oct 2023 22:48:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697867285; cv=none; d=google.com; s=arc-20160816; b=AVTg2ssyo2cnw0iD8zkaZBF3+RWw91YoKBcmztT25F6UJkjMC3u1JL51O12SjhHc2r PCyXv60WJh9vWxrC0MKWXMOXyDI0+7POAyZ3iaLYA1bJdm1Q3tWXjDFZuaRNrQWP2RLN NBmNiSb8XYEeIL53YyvtLjItCaz/v8COAx8kCvNcDZQvuvaA9UGjux9Cb4eFbWsQGPXR lyvjNaxAAJ/OniPtdZftndL9h8Lb0pebbgMJ1I4BEVhdiZbmEVblIspeyau0iKd9GuBh m7RcJjLfImiUVaGyFPk0+PwNNXNmnkS5jbD7jxRjm3CWJNgsVWFmbfej26pQD/z+4vwy itzg== 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=iPzbDBKYEhqXticPS+fiFajRQtf1I9xJRd4Yi3Qjehk=; fh=TYrED6TOMxGX0VC4GtjviASLbYyJe19+7/tKWjN44KQ=; b=XPrZe3oemCchOvbkDKXJcVHGI49wkeDzMN/H4Uh+9PtkmIIaW/KO8w9En1Gmm9Tuc1 ElHrzvKFEBKNvgMOixp0+hooyLt9HeC/2tIH4oNaA/iN0m2GbqmHhppHPfrCLB+2xtL2 Qh+7hb24grZ8rgqPAqI9k2otl5ElZmWX8fzUIKKKCCdG4Fa1DFeIGjMBhrxctRI94EvV eurS7+nABfuEBoaudqO5kJdzNlMb6ONJ9tLjwX27tTyUR3/tnpgZidutuOAOwUk63JI9 LNYsowFvk01NZEHFTTVjT5wx39DGWqzFUqdGfnwe857BWt7zCCqiZI6bF2EC+g7eaPjl vqKA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=gz5p3Cwc; 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 d18-20020a05620a137200b007742c5c5584si2374229qkl.465.2023.10.20.22.48.04 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 20 Oct 2023 22:48: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=gz5p3Cwc; 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 1qu4i0-0007vl-Np; Sat, 21 Oct 2023 01:39:36 -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 1qu4hs-0007Wz-9V for qemu-devel@nongnu.org; Sat, 21 Oct 2023 01:39:28 -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 1qu4hq-0001ZE-4Z for qemu-devel@nongnu.org; Sat, 21 Oct 2023 01:39:27 -0400 Received: by mail-pg1-x534.google.com with SMTP id 41be03b00d2f7-517ab9a4a13so1189850a12.1 for ; Fri, 20 Oct 2023 22:39:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1697866757; x=1698471557; 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=iPzbDBKYEhqXticPS+fiFajRQtf1I9xJRd4Yi3Qjehk=; b=gz5p3CwcuBu82mfYiqjSBp4Ae1VtHACf+TTzHAxXfPVdAgOa4rJQHcBqSTzllRyrJM L3JFDti3r5qPkLKNLZ6LqiccFOmuv+3iiwJwt9/BgOCiU0E3ioalJrA6XR9BzzOVhyol wrrnmUOVwIObZ1rwXG2tS1rGSysTs9b3ABNffnyuFotOyvEZtOjj9qD/Q3Em4ml7hsre kCIf5AehETxtRLXXpHNkL2NwekxG9EUTKL4a/wtPfhnN/9sao7qTz9k5gIhY52m7KJ6Y tNlq75Xx4wCF5E0L8x6i+6qsLOQiiqctYr4e6xDjt4qU7kEeFZmzuY9fyf2drZObM89j 2LAA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697866757; x=1698471557; 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=iPzbDBKYEhqXticPS+fiFajRQtf1I9xJRd4Yi3Qjehk=; b=Vb0TeGWIqbotJPr788AQBmGdWzed5fJp+GmrMnrohHKzHpzTxbywBIAYIRMzFh29ze DCH/qJEdwLy7Pdm9QRL5FceSnqEDroANzXPYH6VR9Ij4WZO6PBiO0KfPVnS704r4GckK 4OTZcWQtjNPaV7iNaakpqUZM3kwSvcNapNFS/Dl1vATgwpFQzjaXxs6aXmmUDt0wEfjt hg8lOb5Fns59t0Lv6IJArvQjSIxdv+CXgNOl/nqNQBvaIS67ogSrAtaZxeHS5oOu0VLR knWT0cAxX+U2ljvPs7Xl5ObL9FVjrhU5BRFmN7c7kxrF1EiDRwhfn1eHE5Hyisjme3sc 7x+Q== X-Gm-Message-State: AOJu0YxiKdSBETEBy8M/MUNX6sihsqPFG1VISX5OQYTbtaTNjZ7ww1Oj LyC4fzLYOKcze4HpMZhNgA6DrpCzKlOw+0KFG3Y= X-Received: by 2002:a17:902:e1c1:b0:1c9:e774:58dc with SMTP id t1-20020a170902e1c100b001c9e77458dcmr3763825pla.7.1697866757117; Fri, 20 Oct 2023 22:39:17 -0700 (PDT) Received: from stoup.. ([71.212.149.95]) by smtp.gmail.com with ESMTPSA id s15-20020a170902ea0f00b001c60a2b5c61sm2397298plg.134.2023.10.20.22.39.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 20 Oct 2023 22:39:16 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: mark.cave-ayland@ilande.co.uk Subject: [PATCH v3 90/90] target/sparc: Remove disas_sparc_legacy Date: Fri, 20 Oct 2023 22:31:58 -0700 Message-Id: <20231021053158.278135-91-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231021053158.278135-1-richard.henderson@linaro.org> References: <20231021053158.278135-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 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 922d9e6021..c71fb64aaa 100644 --- a/target/sparc/translate.c +++ b/target/sparc/translate.c @@ -5434,149 +5434,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); @@ -5644,7 +5501,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) {