From patchwork Thu Oct 26 00:13: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: 738189 Delivered-To: patch@linaro.org Received: by 2002:adf:f842:0:b0:32d:baff:b0ca with SMTP id d2csp552369wrq; Wed, 25 Oct 2023 17:18:05 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEXGx/NYyDyCHtuRNeFicwH9FKA6sAk7zv1ov8jDVX41F5BXDttNqa4k0oOzKUNEFLcwOuT X-Received: by 2002:a05:600c:310d:b0:405:95ae:4a94 with SMTP id g13-20020a05600c310d00b0040595ae4a94mr12962158wmo.5.1698279485123; Wed, 25 Oct 2023 17:18:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698279485; cv=none; d=google.com; s=arc-20160816; b=ODt5YkUQ4wDK68X7IFnax8wFM3pCQtg2G+/xyyWfPoLywek1h7Ou5c2qxJbNMXlWVv LVAz8GKqI1IS+8XWujLUr35fMfXgY1GG3tbh6/8AHME0x/7GHYz/b7MNOeDUoGfZ1TT8 Wqe14t7dNmkTNLiKWndYXyc2BXfzV/zCPuagSX1l+RmXtbEFL1vg2V3wXF5IY9NAMN7z fpIbEWGK/zXDCZOsuMc9wHchgrpjQJwXGoNQ7K8AST5N40Abn/LP9CuEJgx/Sa9o8bok cuZ9piG6T6MT5XisbwHPp29j+txqwf0u8BDpn7FMcyx0smmTrmgdOP8rlLxMvh5NqE51 QQcQ== 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=XJ6RCYZtqS9hM9/RkJUGxHsAy/nMvqiERtpBq5MiRjQ=; fh=xsxWrrhWuqyVqaFnoQzZZAbpP4oE8jrhwk01t2E8xgo=; b=lrvN5z4YF0Gha8e2eWLjr97gNUfOSq6PObsfIYo9iM86o02nINv6UrPDieyH6PD6rx xNsDuXleIKUXvYoShOji2FrDcxYImXwfcQSi77s5L8J5G349+6/8ua3bex7udNChdXuF g2eNbk9efl1EMmouWm6lVV4eJV2y4VS/NDjOEi37VNQZ1ty8K5T1Ezro+9rwXb5IOVkJ khhz15GBiIHjSi6V8vhQx/5zx1YEKzLoWJLw/mRu1OjdcUtf+s/bpzLx7XKYyo0UeYOg 6ZnRKKpzLDbvOVZob5MrhfJAuvtTElKnhQkyxRwTlpgYR2wUEwFms9+Cpf+0sa347lVK C+Ow== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=PWvk4i4b; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as 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 y3-20020a5d6143000000b0032d850e145csi8077349wrt.207.2023.10.25.17.18.05 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 25 Oct 2023 17:18: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=PWvk4i4b; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as 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 1qvo2i-00070L-QQ; Wed, 25 Oct 2023 20:16: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 1qvo2Q-0006wt-7T for qemu-devel@nongnu.org; Wed, 25 Oct 2023 20:15:50 -0400 Received: from mail-pl1-x629.google.com ([2607:f8b0:4864:20::629]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qvo2M-0004pB-Ag for qemu-devel@nongnu.org; Wed, 25 Oct 2023 20:15:48 -0400 Received: by mail-pl1-x629.google.com with SMTP id d9443c01a7336-1caa7597af9so2153385ad.1 for ; Wed, 25 Oct 2023 17:15:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1698279345; x=1698884145; 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=XJ6RCYZtqS9hM9/RkJUGxHsAy/nMvqiERtpBq5MiRjQ=; b=PWvk4i4bdEw3gTHNM5sVe4vj2PzzZiQZLACV0iiAzSLAWZ9/NHzmQ3AgWl6c+Qy8vU bZ/jL0a5jKeq/Mslm+Yym3RDpfCzoA35QNItEYSfcyabFewdNX/71SiVXVZdg7UROads rA+9tRQpJcHRPUyQSKrNb9vmdTttej+HX95oIQuQ5EHKuQ34h5sqGOjlDVs54pQ6pFx0 m51wLhHCoG+PwlCgqRPT28T4MWOPlgUgc+lIvZcKeWzj708EDFwcle5irLQLxfdemb2c SPd57f75DSgVkYZJyDfjYTP0gVByaRoKnE0ngPz5J8sj3u9OnLCRI1Pf3upT9S8Ed75z Bw6g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1698279345; x=1698884145; 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=XJ6RCYZtqS9hM9/RkJUGxHsAy/nMvqiERtpBq5MiRjQ=; b=CczMlr7usE6IA/4KDDnfzuMTJtGuePbzz2sMOzRhLXoZbxXJjYBJzscARIP3wur2cu N/nn7mfSPVnG9dj3R9MEZeuE6VDAZOyDJ4JKeVvn+ofDpvrGuyeSudLejlxv+nubOkQV Jdw/C8R47Yh4O/G969o7IOOQjgnrMTNAEAkpN6N0RealHAz+JHX0j9Hv1tFdLqWczXXN XE0phicZoId7469QXf8MeI/Kp6IoZ/V/5N8O+EftFEez2oQqchxuRmITyi9IYbfbTyD/ uN6rLBMXewmZbKYNhHzixB3QmpCmbypihK+jXwVVZLCOI2C4FYkHKLGu9Op9iQw/76kr cdJA== X-Gm-Message-State: AOJu0YybhAqaffHrtEN5AE00Gpi9EW42ox7wukZXikBMe9EPx77WtxJ9 ugtnE5hNqDp2rT0jjFhO4517zBVY5vkuHOstNig= X-Received: by 2002:a17:902:f904:b0:1ca:1c89:9adb with SMTP id kw4-20020a170902f90400b001ca1c899adbmr12484141plb.51.1698279344769; Wed, 25 Oct 2023 17:15:44 -0700 (PDT) Received: from stoup.. ([71.212.149.95]) by smtp.gmail.com with ESMTPSA id ij23-20020a170902ab5700b001c582de968dsm10038433plb.72.2023.10.25.17.15.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 25 Oct 2023 17:15:44 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: qemu-stable@nongnu.org, Mark Cave-Ayland Subject: [PULL 01/94] target/sparc: Clear may_lookup for npc == DYNAMIC_PC Date: Wed, 25 Oct 2023 17:13:40 -0700 Message-Id: <20231026001542.1141412-2-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231026001542.1141412-1-richard.henderson@linaro.org> References: <20231026001542.1141412-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::629; envelope-from=richard.henderson@linaro.org; helo=mail-pl1-x629.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org 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 Acked-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 Thu Oct 26 00:13: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: 738185 Delivered-To: patch@linaro.org Received: by 2002:adf:f842:0:b0:32d:baff:b0ca with SMTP id d2csp552247wrq; Wed, 25 Oct 2023 17:17:47 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHCA7SRPspQ2CCa9uz3Oozp4hPHM/d42TSOkOpMQYs4x01nhwGMuPO7cQfSjcBr4YYGCpcg X-Received: by 2002:a5d:5746:0:b0:32d:62e7:8ff9 with SMTP id q6-20020a5d5746000000b0032d62e78ff9mr11564433wrw.34.1698279467842; Wed, 25 Oct 2023 17:17:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698279467; cv=none; d=google.com; s=arc-20160816; b=vUptmMShemIXLms8CyyeBYCU3IPfD30vqo+M+VF/9qPHWqBEP/uJQMazlwb2vMk1jh hnB1sXJ4WwmG+Faugqm4OHZqixFeGbXfwbitgsvPNH76G/VK3rsoUfqyVIJ8ywRkNqBa Nu7xBnGj6WU5KtJjd5hb3RrtSLzLvbqL+7S8hiZ6QfJksdhUll2qM5cmGl0fARQV3quz V4NlGXohBfAtr/db8Z2WuZuI5uuH4yKqUnaCoDmtRuOCZdBLmoTYuHJ8mWhReFWzUG1B GiEq1TnNFHLHqdRI1FDN9p4p0Xe5Iy+Q9+RxHqradmlT2dEdiyKMAxXhNX7ZtcP0hVwd Mrtg== 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=gYhvKxqYq5JV9In/R2ATIQpLZ14hQa9hieJVJfsIFqc=; fh=rYI8DiHAAFX3O5g969KmOAQ7d45Sb8OxQX1+DywGDk4=; b=DRF5/+JROuTx0y+8hfJN4A2R/CiCenHmRpLLEPnlymgzVia1uwiw84pZFiDgaTuJ2a pl4GR486BdeJ+AhoChT5C+hVEQl9E8H2HUeU8e+SYWBY/nbv7sfQV26G/iXz/rjuWkEO 8O0MkDzXmg0kvbkYtoNQnvUaRQw+pHeYsOQ+oMFxyutZ5IUyRM/MmrqsklZBO6zw2v7I pU8qIlrm1Bm/R/kPasRZf4fGG3ZF/pTkQSSxCfLTXg8iPenVZtrCwk4Vp+EY77vF61sd HX6Vz2n6o176z5HcD3JmY7dvpif672SlMFn3c/YfeZyPpvlVNlXmQXV9EcbYYAUWbZe0 FIyA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=c27mi1B5; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as 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 o5-20020a5d6845000000b0032ddc890ba8si7938963wrw.19.2023.10.25.17.17.47 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 25 Oct 2023 17:17: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=c27mi1B5; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as 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 1qvo2n-00072Q-TW; Wed, 25 Oct 2023 20:16: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 1qvo2S-0006y1-AZ for qemu-devel@nongnu.org; Wed, 25 Oct 2023 20:16:06 -0400 Received: from mail-pl1-x631.google.com ([2607:f8b0:4864:20::631]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qvo2N-0004pO-SD for qemu-devel@nongnu.org; Wed, 25 Oct 2023 20:15:50 -0400 Received: by mail-pl1-x631.google.com with SMTP id d9443c01a7336-1c77449a6daso2334705ad.0 for ; Wed, 25 Oct 2023 17:15:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1698279346; x=1698884146; 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=gYhvKxqYq5JV9In/R2ATIQpLZ14hQa9hieJVJfsIFqc=; b=c27mi1B5pvgTHcLemzGBuoJG9gf0taDvwrhe1Xj7FEoQ36hKnHP+EdbhJOlYVHbY8L F8kSipKrMaXihxM4B+3SQLB9B8/5sFAcT/c5JZSjyaRfEb96LAh19+vrnSG9f2eWfMtU /Tw23MAkLh2JeeIJAXnwEcLRbWbXTrbvgHWbbL+ehXo56eBddA0KzkV/jBlT8sR0zzYx e1CQ/U9EGtoFpKylxVr/pNM6kwo7gwfl56wr8BBv1bMfOlOmVpsS15iC9GRevfbVihvK 6sHJlB5NwGTL1Fetxi+QdQjzhnrZcx/0vGvfryh6WAUf87arhH+6a9t70JxatHy6iVaQ E0MQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1698279346; x=1698884146; 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=gYhvKxqYq5JV9In/R2ATIQpLZ14hQa9hieJVJfsIFqc=; b=tiAARDDXpFNALCrCxBaWXCOi1EOvH+pR+sHDKQiBPoT5BlZsR+yyWhwWEgePlKxp2J YEdTL0cybhlWVFyl3NdC/+UlhVka+7jJXYPE+5SjTD0q1f6TBYGEa0h0XdwbN0OH5pqE FETUmPeflBC1uOA0QraMBSAgs6zbgFP15xroVpfa862iddciCGOShyQOAtnjPB2rWcId EkQOvI0sXxCBFac6DKGS5hLQqvNsGE/ocj83w6NkSUOCl9BZen77brxY9ezWiULqv+E6 vlIgj6uB4Tdx5sy+GXM0wBgUoOy+WZmmUyK06DXFi+hfCOnoSlJNmWfGrrH+mQ8zItOJ XN5w== X-Gm-Message-State: AOJu0YwcaK1y3Zx8fcrMw40tJ6Gw2Unj536keFk5IpaoKEQZLHiY/mGa s++mLImTZXLfPJQV5aInuH3jF9+5SFdB3NKAtT0= X-Received: by 2002:a17:902:ce8d:b0:1c7:4ab6:b3cc with SMTP id f13-20020a170902ce8d00b001c74ab6b3ccmr20340206plg.54.1698279346537; Wed, 25 Oct 2023 17:15:46 -0700 (PDT) Received: from stoup.. ([71.212.149.95]) by smtp.gmail.com with ESMTPSA id ij23-20020a170902ab5700b001c582de968dsm10038433plb.72.2023.10.25.17.15.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 25 Oct 2023 17:15:46 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: Mark Cave-Ayland Subject: [PULL 02/94] target/sparc: Implement check_align inline Date: Wed, 25 Oct 2023 17:13:42 -0700 Message-Id: <20231026001542.1141412-4-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231026001542.1141412-1-richard.henderson@linaro.org> References: <20231026001542.1141412-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::631; envelope-from=richard.henderson@linaro.org; helo=mail-pl1-x631.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. Tested-by: Mark Cave-Ayland Acked-by: Mark Cave-Ayland 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 Thu Oct 26 00:13: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: 738184 Delivered-To: patch@linaro.org Received: by 2002:adf:f842:0:b0:32d:baff:b0ca with SMTP id d2csp552158wrq; Wed, 25 Oct 2023 17:17:36 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHTo9Pl7WRtHMkqYzKn3CYG0asvsk9GpmZKAPDdwaqj8kP0lwZ7Q+7m9s/uD837I/kQy0CG X-Received: by 2002:a05:651c:1541:b0:2c5:2fa8:716a with SMTP id y1-20020a05651c154100b002c52fa8716amr17542307ljp.9.1698279456446; Wed, 25 Oct 2023 17:17:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698279456; cv=none; d=google.com; s=arc-20160816; b=BBEy/MRGU6vQ6cgPIyzPNI1HPJ9H61aASf8VvdR2oQuNMvgKZcdDPNeIXXet+zhknu T3csnch+EDVBU+yarJdULEhe+KEm0pnd7lkujuE4dWjP/Ou/c8moqzG7T1RN2WkM4l7S rSaMbdV8wfCO2ODmnOtPPeV6uay8a4xWgzfxijkiVt+0PvE2i6FWHSSQ7QKEf4LIp3K0 9WpbGlvnJf2se0RvbH+WkjKtDB8ogWoN+UBHCHGvBw/Gb5w2svHr3nbv+Y1A32w1Mt1O jMit7S8G92DIOi9fLDeZ2i9C+qldSLlzO/k6drReh3bpU/nUcylFA+RTGj/d9G4T1/ba JzUA== 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:to:from :dkim-signature; bh=9eXocbu34bghBLrSPFKvIsugn7thygfTREC245booiE=; fh=PnYt+qEB9tAfMKoqBm2xjKOFpYyFFGPudh5cVIoieJM=; b=naGbTXYzfP9mIqZUFuqs3XkL6gLCpofbMzDuMSnI6vJJIIZUXOR/aL2it3LpbgkfHI YqTLaCeq+GV3V+6HqT4/uZeDQ5wEr/Ag9rpZAw95lX16s5oHB5Qse1WiTeA7UJa1CAan sxj15oXtEJYS16WwnedfRAAKYlG9wEYycqfJX/5FyZPGCa6IelUL+zFPkKcysCYAV+ek K+RPa5RvxWfXV/PpdsvdQWdFrmW305XHaOHmPKjVYzRB3+11Bn+Dv9aza5gNizZpIk5k 2rc9CPDecorq3vcMN0CeoDFGS/7FIfYlvT0ae+o/VBN5P9dei7B8ge1G9OLFoG3Py/LK p5IQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=ViFPoTpY; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as 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 p33-20020a05600c1da100b0040674f9f514si774780wms.64.2023.10.25.17.17.36 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 25 Oct 2023 17:17:36 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=ViFPoTpY; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as 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 1qvo2q-00074U-0k; Wed, 25 Oct 2023 20:16: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 1qvo2g-0006zb-V8 for qemu-devel@nongnu.org; Wed, 25 Oct 2023 20:16:07 -0400 Received: from mail-pl1-x62b.google.com ([2607:f8b0:4864:20::62b]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qvo2S-0004po-2I for qemu-devel@nongnu.org; Wed, 25 Oct 2023 20:16:05 -0400 Received: by mail-pl1-x62b.google.com with SMTP id d9443c01a7336-1caa7597af9so2153765ad.1 for ; Wed, 25 Oct 2023 17:15:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1698279349; x=1698884149; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=9eXocbu34bghBLrSPFKvIsugn7thygfTREC245booiE=; b=ViFPoTpYbs8TzCeDyeQsbyRwCeKZfUkn+Wue5Tzr/LderAgydYhYiw1BdYQu1qYS6n hBFbb6M/lqMQGPyNWDHgIYr/cfz9mJbQwRWs3+JcvQfZ7f6oOjootgdvAfpIQ4CoMDgJ 2hMRglDA+515UftG6PPJU4iIyPIJHxruCQxhdC1U58uDaRn3prcZM1nLQ6SECx6LtvTe JAz7jkMEhtIBiOJ4/LK/sPMRPr0RXm4H7feROP6/ZEq2KXNc+LjdvOorGRG8Sw+A1oOs mY1N2FF3u4/jUwQYzZ2VcDFBRlWivVHP9XQ48cUKq0GLCrYv/WTE4jgi5lKQEWs2Cxhn gDIg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1698279349; x=1698884149; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=9eXocbu34bghBLrSPFKvIsugn7thygfTREC245booiE=; b=LBa4OLcaE5BFFV/xGVVkwOyrh+LoToGFiEtN/ZIEMwY3GeF+6Z4UMJzWdKISC+gz9F F228i2e//MwjJNX2tkK+m2jPrvnsv0VvN8BbTpBtgYuJB8IslKf77WoVERHM6NCogZDe ZDKMaNBg/kqTt7WhivOl8RdC7AgxmomuI39wueTBM73KP14zXSiMe5kcbfuJBs+jJfnO YwEgdcAaviPM7LvKQQVMA8oC7Cygr7zBo4UjIYp/61mCIl0RVmd9dSqJmdKJ94N1Is6s ioJercjAy2iDXBjiKSieHpnoDzFnMmD6/ZGGpl9++ndpch8f81DzEu6e9Tm1rGMMKJ69 40ZQ== X-Gm-Message-State: AOJu0YwcQLDzCHX5J9donQ7bLwmw7sawuIvvmz3RfFg09q6OHKHFH5xJ N2PiOMAzyWKR4KJLSGh0kic50xN2MU3WA5jz9c8= X-Received: by 2002:a17:903:268c:b0:1c9:b207:d40b with SMTP id jf12-20020a170903268c00b001c9b207d40bmr13726537plb.38.1698279349169; Wed, 25 Oct 2023 17:15:49 -0700 (PDT) Received: from stoup.. ([71.212.149.95]) by smtp.gmail.com with ESMTPSA id ij23-20020a170902ab5700b001c582de968dsm10038433plb.72.2023.10.25.17.15.48 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 25 Oct 2023 17:15:48 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH 03/29] tcg/optimize: Split out do_constant_folding_cond1 Date: Wed, 25 Oct 2023 17:13:45 -0700 Message-Id: <20231026001542.1141412-7-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231026001542.1141412-1-richard.henderson@linaro.org> References: <20231026001542.1141412-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::62b; envelope-from=richard.henderson@linaro.org; helo=mail-pl1-x62b.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org Handle modifications to the arguments and condition in a single place. Signed-off-by: Richard Henderson --- tcg/optimize.c | 57 ++++++++++++++++++++++++-------------------------- 1 file changed, 27 insertions(+), 30 deletions(-) diff --git a/tcg/optimize.c b/tcg/optimize.c index e8a13fedb5..89cc794d24 100644 --- a/tcg/optimize.c +++ b/tcg/optimize.c @@ -672,6 +672,23 @@ static bool swap_commutative2(TCGArg *p1, TCGArg *p2) return false; } +static int do_constant_folding_cond1(OptContext *ctx, TCGArg dest, + TCGArg *p1, TCGArg *p2, TCGArg *pcond) +{ + TCGCond cond; + bool swap; + int r; + + swap = swap_commutative(dest, p1, p2); + cond = *pcond; + if (swap) { + *pcond = cond = tcg_swap_cond(cond); + } + + r = do_constant_folding_cond(ctx->type, *p1, *p2, cond); + return r; +} + static void init_arguments(OptContext *ctx, TCGOp *op, int nb_args) { for (int i = 0; i < nb_args; i++) { @@ -1053,14 +1070,8 @@ static bool fold_andc(OptContext *ctx, TCGOp *op) static bool fold_brcond(OptContext *ctx, TCGOp *op) { - TCGCond cond = op->args[2]; - int i; - - if (swap_commutative(NO_DEST, &op->args[0], &op->args[1])) { - op->args[2] = cond = tcg_swap_cond(cond); - } - - i = do_constant_folding_cond(ctx->type, op->args[0], op->args[1], cond); + int i = do_constant_folding_cond1(ctx, NO_DEST, &op->args[0], + &op->args[1], &op->args[2]); if (i == 0) { tcg_op_remove(ctx->tcg, op); return true; @@ -1550,21 +1561,18 @@ static bool fold_mov(OptContext *ctx, TCGOp *op) static bool fold_movcond(OptContext *ctx, TCGOp *op) { - TCGCond cond = op->args[5]; int i; - if (swap_commutative(NO_DEST, &op->args[1], &op->args[2])) { - op->args[5] = cond = tcg_swap_cond(cond); - } /* * Canonicalize the "false" input reg to match the destination reg so * that the tcg backend can implement a "move if true" operation. */ if (swap_commutative(op->args[0], &op->args[4], &op->args[3])) { - op->args[5] = cond = tcg_invert_cond(cond); + op->args[5] = tcg_invert_cond(op->args[5]); } - i = do_constant_folding_cond(ctx->type, op->args[1], op->args[2], cond); + i = do_constant_folding_cond1(ctx, NO_DEST, &op->args[1], + &op->args[2], &op->args[5]); if (i >= 0) { return tcg_opt_gen_mov(ctx, op, op->args[0], op->args[4 - i]); } @@ -1578,6 +1586,7 @@ static bool fold_movcond(OptContext *ctx, TCGOp *op) uint64_t tv = arg_info(op->args[3])->val; uint64_t fv = arg_info(op->args[4])->val; TCGOpcode opc, negopc = 0; + TCGCond cond = op->args[5]; switch (ctx->type) { case TCG_TYPE_I32: @@ -1805,14 +1814,8 @@ static bool fold_remainder(OptContext *ctx, TCGOp *op) static bool fold_setcond(OptContext *ctx, TCGOp *op) { - TCGCond cond = op->args[3]; - int i; - - if (swap_commutative(op->args[0], &op->args[1], &op->args[2])) { - op->args[3] = cond = tcg_swap_cond(cond); - } - - i = do_constant_folding_cond(ctx->type, op->args[1], op->args[2], cond); + int i = do_constant_folding_cond1(ctx, op->args[0], &op->args[1], + &op->args[2], &op->args[3]); if (i >= 0) { return tcg_opt_gen_movi(ctx, op, op->args[0], i); } @@ -1824,14 +1827,8 @@ static bool fold_setcond(OptContext *ctx, TCGOp *op) static bool fold_negsetcond(OptContext *ctx, TCGOp *op) { - TCGCond cond = op->args[3]; - int i; - - if (swap_commutative(op->args[0], &op->args[1], &op->args[2])) { - op->args[3] = cond = tcg_swap_cond(cond); - } - - i = do_constant_folding_cond(ctx->type, op->args[1], op->args[2], cond); + int i = do_constant_folding_cond1(ctx, op->args[0], &op->args[1], + &op->args[2], &op->args[3]); if (i >= 0) { return tcg_opt_gen_movi(ctx, op, op->args[0], -i); } From patchwork Thu Oct 26 00:13:46 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 738193 Delivered-To: patch@linaro.org Received: by 2002:adf:f842:0:b0:32d:baff:b0ca with SMTP id d2csp552597wrq; Wed, 25 Oct 2023 17:18:42 -0700 (PDT) X-Google-Smtp-Source: AGHT+IH4BYzTKYQ/hNg4zg6sVC9KNvL6pUfZq21iJ9pHlTZtOsDbzweKxlohN01E4ij16F0XuZ/V X-Received: by 2002:a05:600c:4747:b0:403:9b7:a720 with SMTP id w7-20020a05600c474700b0040309b7a720mr13370241wmo.1.1698279522447; Wed, 25 Oct 2023 17:18:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698279522; cv=none; d=google.com; s=arc-20160816; b=0CkDKd/PnpVdoEpBHGqvDIUgIq7evQi/IjV7aKuBge9PA8q6tT7/pxMOYniltDz7DR A7n/xD3okxnHc/1icyq7kc6qMfu8L7uCeTA58AA2pjVRrkCocwjLg96i5qnRTG4ApDYi HorVUKwsW5Y6QAfP3H9K/B0lsAFo0dCdXTD88Ne3tnFBlaT45K8NzYqp4Lhy7qCtFvpm zVfMSuCD2VlYABcXFrkCX8G436qTU5YrpbPv+9YSjQOuEH/fr/LfZClTGtMZijOh6O6U YqCPQmuh8UoPQ5+ennEc7hCeAbVPyJIWS5pJl0zpizUDkI/CMrsgshpKOrLbD0lzqi1t HG3Q== 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=+FzEYXMiYUmAnzQhyJLC08QhIql51EYsnrwBv94uD9o=; fh=J4M4Z4TZxvAT8lkmK1LtxqMjpO7Qiod4IMBL2bk0hxA=; b=ShDcvIgZFuA+f8yoEsl5tT/o/jrW8ceRsvR01YQkeiAGMHR+KHezGKcXBK9Y3mvHbS dXa+i8Dw7NRcrqbIlNx59nGWy0KQfcsIUYIBoydvp/SYHzQVr664wStS7UG9D3m61phg DERxff7bsNyAaK0gLjEO0Q5ldl1Es4lwxNqVkMeRmTp497MlZAaryWztGjzjW9ZXcYA/ SXUrc8VckYnpuEU2c8cjAs8rsL30uaEC+n2ue5utyoO14c3Cu6bR87w4ywhyPubPvzlI TnoVMfwNtHUW/W6w8FnHdLx2mLwdxDJl4vkHRUocSDjs8sR34VJ4RxJAYSzr1OZ1GpdL i1IQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=TwyApiMW; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id h9-20020a05600c314900b0040826870e95si772280wmo.93.2023.10.25.17.18.42 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 25 Oct 2023 17:18: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=TwyApiMW; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as 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 1qvo2n-00072I-DZ; Wed, 25 Oct 2023 20:16: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 1qvo2g-0006zc-Vx for qemu-devel@nongnu.org; Wed, 25 Oct 2023 20:16:07 -0400 Received: from mail-pl1-x633.google.com ([2607:f8b0:4864:20::633]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qvo2S-0004py-2v for qemu-devel@nongnu.org; Wed, 25 Oct 2023 20:16:06 -0400 Received: by mail-pl1-x633.google.com with SMTP id d9443c01a7336-1ca215cc713so2017035ad.3 for ; Wed, 25 Oct 2023 17:15:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1698279350; x=1698884150; 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=+FzEYXMiYUmAnzQhyJLC08QhIql51EYsnrwBv94uD9o=; b=TwyApiMWjqElD1rNs7/DY+fIZlwvakBGmNFSqrv5XY4LuKyYcs+vWuNiT+Ksx19kk1 0/YVUb4FdkZzGj6Gl17xU5Phv9V3eB8QUZ9NeQ7vOTo0OqLeuI5Q38YLG4BjIG7rF3YG TFaIhs4Jiko3vEK88e88inTR+iYEIJWmjQyFfR0AlAGReSbWSq2MAJxK1sopP/xNXuME 5nru8x7r4QH8bzlC5yWX2tfBT0uUHMO/0Bp67DIDcxOiD+VFS4H15hNTl3gTZtcEKNTc odkbeIScK9abROCb8H9V23WRXTGyCup7299jKq38knqywPyjEHBk24S2JcJrpdOugdPz fkGw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1698279350; x=1698884150; 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=+FzEYXMiYUmAnzQhyJLC08QhIql51EYsnrwBv94uD9o=; b=dQHdaqDrmxxo9DwB+4/eBDET+s7WW4sGY3sowQy1oELVAMtNK191E5Js5h/nIbsrMi 4M43SPHj/xszcKIYthGyGMcE4NnpUAPNRRG50nSrd6dTl7GXqhoXqKYkH8EFdLnKaTxg ALvxQIXdapB2I52vA3HtHYrTtFlaniEmDymARZ+IxyuiBkAPMD+HGJzT/lwC8DRl3ige DPuESiJgP6zVmfQHroK7vfLsmOZXw2XakeQbgvq+NS6xHa7eX9bFon/+9WGkXEObP7yC rBb92AG9o/tPTApoU/CQ+rsHeDCK56Yorgo5xXwZV5dOgDyoF7G+58F1VHvdTkOaMm2f p2gg== X-Gm-Message-State: AOJu0YzY7S+rllE6RCwTfDwN8gKCVc8UltA3ORuwGnQJMQUuh+e6B31x a9lRkZ/5Ea1uOHBGg+9sPZcGETkLjIWlm8sKp+c= X-Received: by 2002:a17:902:f0c4:b0:1c8:a132:a00f with SMTP id v4-20020a170902f0c400b001c8a132a00fmr12817707pla.12.1698279349998; Wed, 25 Oct 2023 17:15:49 -0700 (PDT) Received: from stoup.. ([71.212.149.95]) by smtp.gmail.com with ESMTPSA id ij23-20020a170902ab5700b001c582de968dsm10038433plb.72.2023.10.25.17.15.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 25 Oct 2023 17:15:49 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: Mark Cave-Ayland , =?utf-8?q?Philippe_Mat?= =?utf-8?q?hieu-Daud=C3=A9?= Subject: [PULL 04/94] target/sparc: Set TCG_GUEST_DEFAULT_MO Date: Wed, 25 Oct 2023 17:13:46 -0700 Message-Id: <20231026001542.1141412-8-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231026001542.1141412-1-richard.henderson@linaro.org> References: <20231026001542.1141412-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::633; envelope-from=richard.henderson@linaro.org; helo=mail-pl1-x633.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org 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. Tested-by: Mark Cave-Ayland Acked-by: Mark Cave-Ayland 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 Thu Oct 26 00:13: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: 738181 Delivered-To: patch@linaro.org Received: by 2002:adf:f842:0:b0:32d:baff:b0ca with SMTP id d2csp551950wrq; Wed, 25 Oct 2023 17:16:58 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHUdKlNBngeEH/fQsD5ueDWSyWXVeIk4KvcOfUa3B2chzV+I9RA9L0nJVjSKyTHmio0nNVM X-Received: by 2002:a05:600c:4709:b0:408:5a1c:9de7 with SMTP id v9-20020a05600c470900b004085a1c9de7mr10638791wmo.7.1698279418598; Wed, 25 Oct 2023 17:16:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698279418; cv=none; d=google.com; s=arc-20160816; b=CsRXa1PV2xqnNAKPfBlt1dVKTb/ueWtW9AJMYdPoYGyTQW8ZOt/039NIu+Ze20YF1q 8BTIRw0oruJafVO6jTQEPXiQQIeURUeN2LS3lRkzVxxPNIz0j/u90sDWiV9ELMwKh/7Y 05Q2kwZj0ZlYKo/x5HMJcTeZQJYOk3Aem9b1UqV+ndQkDQaEoDLwAkqb2+2Jt6sWK0O0 yOKtaAWscfjj2PCOkh61RxYRro+U42CiKamLwYWYPtgmfBQYV8+Qb9LJ+4SF9geBdmtv WZpz9dKdnFJN90HpZYzcY8zZuWUMoEp0+0K7C4dCnt4xCUBiurASFv0SEE/1yVuuoSvR l1ew== 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=yydutm4GC4YL//fMbFA0uGJAc/KbeYkkAz+lArCCg2s=; fh=rYI8DiHAAFX3O5g969KmOAQ7d45Sb8OxQX1+DywGDk4=; b=GJ+Xn7Y9OgjFPJibGQgfOzP1O5tEjcFOBD9lqHFVn4AHy/bvmx/MYjWVDOt7nRDGvk LdsHVSetBWl1M9/PjvOpkkfVg7amxKD2n3xFA5U0nE1pRb2Z8YQN10W0lEaO5yxaaIod xgaV10x9hWYRlTQXK59WcGBPoX1A7tZzeFF+y8zKpLEGkSwlTgTvhVJ5EsZunN3eqU+o Ipb7BU4SRfdytp0uOKj26S03UarF8KtBWALP9r5rSwOoqivxPhzbxC/tJ7fPsnDsiefA XNs3/4Yfa4/YoWt3a+KlvODf/pwCLlE3bbxBCgsBHLlO+nGTBVDm8D+9Q2XGUVqBlC6f QlIg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=OLg3jWhC; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as 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 d9-20020a05600c34c900b0040644cff4ddsi799466wmq.34.2023.10.25.17.16.58 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 25 Oct 2023 17:16: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=OLg3jWhC; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as 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 1qvo2o-00073d-Qp; Wed, 25 Oct 2023 20:16: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 1qvo2l-00070v-GE for qemu-devel@nongnu.org; Wed, 25 Oct 2023 20:16:12 -0400 Received: from mail-pl1-x62a.google.com ([2607:f8b0:4864:20::62a]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qvo2e-0004q9-Ur for qemu-devel@nongnu.org; Wed, 25 Oct 2023 20:16:11 -0400 Received: by mail-pl1-x62a.google.com with SMTP id d9443c01a7336-1cac925732fso2239585ad.1 for ; Wed, 25 Oct 2023 17:15:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1698279351; x=1698884151; 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=yydutm4GC4YL//fMbFA0uGJAc/KbeYkkAz+lArCCg2s=; b=OLg3jWhCXXwFU7UCxL9P47+pazgnuoxU71LfZg3C90HE5gRLV6FmAzYImSLdokK+wj mAb/k7W67B+g9kby74HQwhUg/1u5tHjJXfA9VRifEG3mKVu9DZ6WFQrh3jDJEdjt/PnX KBpyYCWhYM2yPeQL2eFIoaZ9lqXiooFCnmCX6CC9ylvojglEnWkrR3ScmwswRh01aWiW X/dCUdoikgwB/o++1uKFUEm/5DqEILz+3eD/6k5R4EZWtd+75oRJmUFbiS0uDdVDjLnn 37E14xEtdza6UDgGIqjIg/K31E886vmml3VMeZXZy9l3/3k0HtuiahN6VmooN1gu/ud+ nr2g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1698279351; x=1698884151; 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=yydutm4GC4YL//fMbFA0uGJAc/KbeYkkAz+lArCCg2s=; b=pYLFN/ubecOq/9GykwC11W+TaLwd+CttkiXn1D68ncCLOuZoHEqK1kwjcW5XCpCGoD iQiO2mRr6mX+QcUq1WcMchWXwg7KJzSZRiJ0Bay0JHQpG67+G6jSuQOr0z3M+DTIUF78 +FwojKQWZFOLcpiAeeHgegeO4QXxgrPR8iIC+DGxjtJdJtEpHt2BRSB+j4Ck5DuMbhlm Sqh90RcDEj3s9vjaGq/1JnOwCY88hpM8os6VTeJ2w6/SEBzPq3QImI1Gm3jMdcOTdewb A4LdRongjmAdW1vM8ictUGlG+IBIPcOJUd1O2v+DifeB+0LqirqW4TYDgkB3E9cyFkHa E3Cw== X-Gm-Message-State: AOJu0Yzb82kwf2cCwaFphJcFxQtbZTitwJKzsmyZQSBfTaNZxI59w1n/ IyFLs3ND0n5gMk9SlrvRqFyJgCBEJhPGU9pJiGw= X-Received: by 2002:a17:903:246:b0:1c5:bc83:557b with SMTP id j6-20020a170903024600b001c5bc83557bmr16248766plh.51.1698279351643; Wed, 25 Oct 2023 17:15:51 -0700 (PDT) Received: from stoup.. ([71.212.149.95]) by smtp.gmail.com with ESMTPSA id ij23-20020a170902ab5700b001c582de968dsm10038433plb.72.2023.10.25.17.15.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 25 Oct 2023 17:15:51 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: Mark Cave-Ayland Subject: [PULL 05/94] configs: Enable MTTCG for sparc, sparc64 Date: Wed, 25 Oct 2023 17:13:48 -0700 Message-Id: <20231026001542.1141412-10-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231026001542.1141412-1-richard.henderson@linaro.org> References: <20231026001542.1141412-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::62a; envelope-from=richard.henderson@linaro.org; helo=mail-pl1-x62a.google.com X-Spam_score_int: -16 X-Spam_score: -1.7 X-Spam_bar: - X-Spam_report: (-1.7 / 5.0 requ) BAYES_00=-1.9, DKIM_INVALID=0.1, DKIM_SIGNED=0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no 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. Tested-by: Mark Cave-Ayland Acked-by: Mark Cave-Ayland 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 Thu Oct 26 00:13: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: 738198 Delivered-To: patch@linaro.org Received: by 2002:adf:f842:0:b0:32d:baff:b0ca with SMTP id d2csp553555wrq; Wed, 25 Oct 2023 17:21:35 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGW8KzRqsaKrHhaWNwwWM4oVAbfn/kJiHzvGimfCKO3GQSzQ7kyAle0b4/0whL45nXAopSr X-Received: by 2002:adf:f4ce:0:b0:32d:8094:f4c8 with SMTP id h14-20020adff4ce000000b0032d8094f4c8mr10916593wrp.19.1698279695221; Wed, 25 Oct 2023 17:21:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698279695; cv=none; d=google.com; s=arc-20160816; b=xe3R415ljJIuJvyK7taR2VqB9iqvfA7U3+L3Bx9JO7czTJ4A7qi4WyTkT6MfeMRDe2 720y302wD0QOj7rb3hKRTJBMX1/wrcJjxeN6Av/EjXZFfDGsr5WtuLSJOa8Oy5tqLzlc ljAKyNDLcHwEFuC6EP8iCr6l4qKE4IxkY8o5BL4Qg8CHOJezia6UClKA/vj1yai2Wo18 ADB4mvjihuhDh3UldvhrwZlugU1ycxKju0d2WjRolrd6tEUJcuN/NPdfOqlHjg2ORXI1 bzkt4c3ZF0m6HKAsW0EuKn/iclpzDE+Rfy2I2ibAH2o7FekWT4eZnnPve4mVzAJZhWyt lsCw== 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:to:from :dkim-signature; bh=/3tyPErdBidq6AacxwJD8cDdKu9xx4iNX0WzEVUzfVw=; fh=PnYt+qEB9tAfMKoqBm2xjKOFpYyFFGPudh5cVIoieJM=; b=1FRfKaGzLeFJ03HyTxb0cdpv6wo0gUIhxeq5gEMX8caeWZ1rICiwWMMdsLwtmQbxv3 hTvBJtNauJdRTvMFTXTmQHuUmSbEcPV8CfoOU+9wG77nIKQAVOMA0k15Ezhyj2OtRS6G YeZ1bZnzX1i7pGWlktgRclGKPF4bmfV3teZB+1AvZiTv1rawr+FDHu+DJNmmegDkt0e1 48SpoJlgyag9IKbZXSQrkEofuqOi9+R0i/2q4dMZdCd9QlfZIhbZyBOSCutC5ZrTgQzB Pci1oGbSW+0CRi0rgoGIujG0ghSQ/k47fZhjlDIs3iWzE64HQUG78+Is2bvYbVB4/wUB AL0A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="J/067aru"; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as 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 k3-20020a5d5243000000b0032152f6bdb0si8131423wrc.630.2023.10.25.17.21.35 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 25 Oct 2023 17:21: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="J/067aru"; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as 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 1qvo2w-0007IG-Qp; Wed, 25 Oct 2023 20:16:22 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qvo2m-00071Q-Oq for qemu-devel@nongnu.org; Wed, 25 Oct 2023 20:16:12 -0400 Received: from mail-pl1-x62b.google.com ([2607:f8b0:4864:20::62b]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qvo2h-0004qp-MC for qemu-devel@nongnu.org; Wed, 25 Oct 2023 20:16:12 -0400 Received: by mail-pl1-x62b.google.com with SMTP id d9443c01a7336-1cbf47fa563so2273145ad.2 for ; Wed, 25 Oct 2023 17:15:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1698279354; x=1698884154; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=/3tyPErdBidq6AacxwJD8cDdKu9xx4iNX0WzEVUzfVw=; b=J/067aruZyZvE70TK3ULa+HzCEgXHUXIDP9t7r1Hk11grFDVYkUMT61W/P2yKRmMMG C7D+39SdPz+VoUQ5+Rz+Ubg4/P6c4UiHQ+QjAJji4lGsTyOi0aijQEr7bLUDuvOYLPIl 347IzrJaRkA1hGACsnLsr509sObYiSyckC2yTSl7kJ/babrjo18svpwaPibv+WR30DTn 3c8ruly7GABPlCeFip8H1qIenCIZzuKjZVcA2IpYrTL+hzk3TL5wYpi3y9Qqlg8Pxo5X PVW4a4m+QtRl7UP0xFSBTX39FMnUctuKiCJLh343+tnTk1b2Oy5w3L3AAvp6iGLVZcs3 KRLw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1698279354; x=1698884154; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=/3tyPErdBidq6AacxwJD8cDdKu9xx4iNX0WzEVUzfVw=; b=eTE7k5JzKOEZ9BdC+wB75h9ma8/ELVCK3cH+YM1rWUekXVA/HNtACocYXJ1tnsC2kZ QgHmo02VJppQU/uHPxwyWqNcFKCCRsqgEGihDmO1KwBadepgNqHutGefJByIBR+Iwv9w lyNhWgl+OpuKj4sLGyhIukZxswPdIUGdq+KRVDEH/2LjA+hi1tifAp6R9Zgrp7i0rKYn ccp0FagwSKR+3Era9aQDAGOM3Dv8VmYTM6BzTPB+GgpPY7N0hkGF4ucismwfYwmtkbDE U8PdDQ0gvmoVzFNTIgKouIQKDlQKLRJd5FJ4avJI1f6a9k8RUBPYe68FFTkqqzPNkCtu Mkjw== X-Gm-Message-State: AOJu0YwoWdtsCo+5fn6c/UEhr4dYD2Vw2s3IatcLjG6uYBHiot6BfV3n QFk3gzRzUkZufJl1Yu/z7dD2LDdJZWAH/qg/w7M= X-Received: by 2002:a17:903:1210:b0:1c5:d8a3:8789 with SMTP id l16-20020a170903121000b001c5d8a38789mr17803639plh.4.1698279354218; Wed, 25 Oct 2023 17:15:54 -0700 (PDT) Received: from stoup.. ([71.212.149.95]) by smtp.gmail.com with ESMTPSA id ij23-20020a170902ab5700b001c582de968dsm10038433plb.72.2023.10.25.17.15.53 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 25 Oct 2023 17:15:53 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH 06/29] tcg/optimize: Handle TCG_COND_TST{EQ,NE} Date: Wed, 25 Oct 2023 17:13:51 -0700 Message-Id: <20231026001542.1141412-13-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231026001542.1141412-1-richard.henderson@linaro.org> References: <20231026001542.1141412-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::62b; envelope-from=richard.henderson@linaro.org; helo=mail-pl1-x62b.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org Fold constant comparisons. Canonicalize "tst x,x" to equality vs zero. Canonicalize "tst x,sign" to sign test vs zero. Fold double-word comparisons with zero parts. Fold setcond of "tst x,pow2" to a bit extract. Signed-off-by: Richard Henderson --- tcg/optimize.c | 225 ++++++++++++++++++++++++++++++++++++++++++++----- 1 file changed, 205 insertions(+), 20 deletions(-) diff --git a/tcg/optimize.c b/tcg/optimize.c index 2f2d1c3001..27b1eaaa8d 100644 --- a/tcg/optimize.c +++ b/tcg/optimize.c @@ -508,9 +508,15 @@ static bool do_constant_folding_cond_32(uint32_t x, uint32_t y, TCGCond c) return x <= y; case TCG_COND_GTU: return x > y; - default: - g_assert_not_reached(); + case TCG_COND_TSTEQ: + return (x & y) == 0; + case TCG_COND_TSTNE: + return (x & y) != 0; + case TCG_COND_ALWAYS: + case TCG_COND_NEVER: + break; } + g_assert_not_reached(); } static bool do_constant_folding_cond_64(uint64_t x, uint64_t y, TCGCond c) @@ -536,12 +542,18 @@ static bool do_constant_folding_cond_64(uint64_t x, uint64_t y, TCGCond c) return x <= y; case TCG_COND_GTU: return x > y; - default: - g_assert_not_reached(); + case TCG_COND_TSTEQ: + return (x & y) == 0; + case TCG_COND_TSTNE: + return (x & y) != 0; + case TCG_COND_ALWAYS: + case TCG_COND_NEVER: + break; } + g_assert_not_reached(); } -static bool do_constant_folding_cond_eq(TCGCond c) +static int do_constant_folding_cond_eq(TCGCond c) { switch (c) { case TCG_COND_GT: @@ -556,9 +568,14 @@ static bool do_constant_folding_cond_eq(TCGCond c) case TCG_COND_LEU: case TCG_COND_EQ: return 1; - default: - g_assert_not_reached(); + case TCG_COND_TSTEQ: + case TCG_COND_TSTNE: + return -1; + case TCG_COND_ALWAYS: + case TCG_COND_NEVER: + break; } + g_assert_not_reached(); } /* @@ -660,7 +677,27 @@ static int do_constant_folding_cond1(OptContext *ctx, TCGArg dest, } r = do_constant_folding_cond(ctx->type, *p1, *p2, cond); - return r; + if (r >= 0) { + return r; + } + if (!is_tst_cond(cond)) { + return -1; + } + + /* TSTNE x,x -> NE x,0 */ + if (args_are_copies(*p1, *p2)) { + *p2 = arg_new_constant(ctx, 0); + *pcond = tcg_tst_eqne_cond(cond); + return -1; + } + + /* TSTNE x,sign -> LT x,0 */ + if (arg_is_const_val(*p2, (ctx->type == TCG_TYPE_I32 + ? INT32_MIN : INT64_MIN))) { + *p2 = arg_new_constant(ctx, 0); + *pcond = tcg_tst_ltge_cond(cond); + } + return -1; } static int do_constant_folding_cond2(OptContext *ctx, TCGArg *args) @@ -668,6 +705,7 @@ static int do_constant_folding_cond2(OptContext *ctx, TCGArg *args) TCGArg al, ah, bl, bh; TCGCond c; bool swap; + int r; swap = swap_commutative2(args, args + 2); c = args[4]; @@ -689,8 +727,13 @@ static int do_constant_folding_cond2(OptContext *ctx, TCGArg *args) tcg_target_ulong alv = arg_info(al)->val; tcg_target_ulong ahv = arg_info(ah)->val; uint64_t a = deposit64(alv, 32, 32, ahv); - return do_constant_folding_cond_64(a, b, c); + + r = do_constant_folding_cond_64(a, b, c); + if (r >= 0) { + return r; + } } + if (b == 0) { switch (c) { case TCG_COND_LTU: @@ -701,9 +744,28 @@ static int do_constant_folding_cond2(OptContext *ctx, TCGArg *args) break; } } + + /* TSTNE x,sign -> LT x,0 */ + if (b == INT64_MIN && is_tst_cond(c)) { + /* bl must be 0, so copy that to bh */ + args[3] = bl; + args[4] = tcg_tst_ltge_cond(c); + return -1; + } } + if (args_are_copies(al, bl) && args_are_copies(ah, bh)) { - return do_constant_folding_cond_eq(c); + r = do_constant_folding_cond_eq(c); + if (r >= 0) { + return r; + } + + /* TSTNE x,x -> NE x,0 */ + if (is_tst_cond(c)) { + args[3] = args[2] = arg_new_constant(ctx, 0); + args[4] = tcg_tst_eqne_cond(c); + return -1; + } } return -1; } @@ -1151,17 +1213,30 @@ static bool fold_brcond2(OptContext *ctx, TCGOp *op) case 0: goto do_brcond_const; case 1: - op->opc = INDEX_op_brcond_i32; - op->args[1] = op->args[2]; - op->args[2] = cond; - op->args[3] = label; - break; + goto do_brcond_low; + } + break; + + case TCG_COND_TSTEQ: + case TCG_COND_TSTNE: + if (arg_is_const_val(op->args[2], 0)) { + goto do_brcond_high; + } + if (arg_is_const_val(op->args[3], 0)) { + goto do_brcond_low; } break; default: break; + do_brcond_low: + op->opc = INDEX_op_brcond_i32; + op->args[1] = op->args[2]; + op->args[2] = cond; + op->args[3] = label; + break; + do_brcond_high: op->opc = INDEX_op_brcond_i32; op->args[0] = op->args[1]; @@ -1829,6 +1904,100 @@ static bool fold_remainder(OptContext *ctx, TCGOp *op) return false; } +static void fold_setcond_tst_pow2(OptContext *ctx, TCGOp *op, bool neg) +{ + TCGOpcode and_opc, sub_opc, xor_opc, neg_opc, shr_opc, uext_opc, sext_opc; + TCGCond cond = op->args[3]; + TCGArg ret, src1, src2; + TCGOp *op2; + uint64_t val; + int sh; + bool inv; + + if (!is_tst_cond(cond) || !arg_is_const(op->args[2])) { + return; + } + + src2 = op->args[2]; + val = arg_info(src2)->val; + if (!is_power_of_2(val)) { + return; + } + + switch (ctx->type) { + case TCG_TYPE_I32: + and_opc = INDEX_op_and_i32; + sub_opc = INDEX_op_sub_i32; + xor_opc = INDEX_op_xor_i32; + shr_opc = INDEX_op_shr_i32; + neg_opc = TCG_TARGET_HAS_neg_i32 ? INDEX_op_neg_i32 : 0; + uext_opc = TCG_TARGET_HAS_extract_i32 ? INDEX_op_extract_i32 : 0; + sext_opc = TCG_TARGET_HAS_sextract_i32 ? INDEX_op_sextract_i32 : 0; + break; + case TCG_TYPE_I64: + and_opc = INDEX_op_and_i64; + sub_opc = INDEX_op_sub_i64; + xor_opc = INDEX_op_xor_i64; + shr_opc = INDEX_op_shr_i64; + neg_opc = TCG_TARGET_HAS_neg_i64 ? INDEX_op_neg_i64 : 0; + uext_opc = TCG_TARGET_HAS_extract_i64 ? INDEX_op_extract_i64 : 0; + sext_opc = TCG_TARGET_HAS_sextract_i64 ? INDEX_op_sextract_i64 : 0; + break; + default: + g_assert_not_reached(); + } + + sh = ctz64(val); + ret = op->args[0]; + src1 = op->args[1]; + inv = cond == TCG_COND_TSTEQ; + + if (neg && !inv && sext_opc) { + op->opc = sext_opc; + op->args[1] = src1; + op->args[2] = sh; + op->args[3] = 1; + neg = false; + } else if (uext_opc) { + op->opc = uext_opc; + op->args[1] = src1; + op->args[2] = sh; + op->args[3] = 1; + } else { + if (sh) { + op2 = tcg_op_insert_before(ctx->tcg, op, shr_opc, 3); + op2->args[0] = ret; + op2->args[1] = src1; + op2->args[2] = arg_new_constant(ctx, sh); + src1 = ret; + } + op->opc = and_opc; + op->args[1] = src1; + op->args[2] = arg_new_constant(ctx, 1); + } + + if (neg && inv) { + op2 = tcg_op_insert_after(ctx->tcg, op, sub_opc, 3); + op2->args[0] = ret; + op2->args[1] = ret; + op2->args[2] = arg_new_constant(ctx, 1); + } else if (inv) { + op2 = tcg_op_insert_after(ctx->tcg, op, xor_opc, 3); + op2->args[0] = ret; + op2->args[1] = ret; + op2->args[2] = arg_new_constant(ctx, 1); + } else if (neg && neg_opc) { + op2 = tcg_op_insert_after(ctx->tcg, op, neg_opc, 2); + op2->args[0] = ret; + op2->args[1] = ret; + } else if (neg) { + op2 = tcg_op_insert_after(ctx->tcg, op, sub_opc, 3); + op2->args[0] = ret; + op2->args[1] = arg_new_constant(ctx, 0); + op2->args[2] = ret; + } +} + static bool fold_setcond(OptContext *ctx, TCGOp *op) { int i = do_constant_folding_cond1(ctx, op->args[0], &op->args[1], @@ -1836,6 +2005,7 @@ static bool fold_setcond(OptContext *ctx, TCGOp *op) if (i >= 0) { return tcg_opt_gen_movi(ctx, op, op->args[0], i); } + fold_setcond_tst_pow2(ctx, op, false); ctx->z_mask = 1; ctx->s_mask = smask_from_zmask(1); @@ -1849,13 +2019,13 @@ static bool fold_negsetcond(OptContext *ctx, TCGOp *op) if (i >= 0) { return tcg_opt_gen_movi(ctx, op, op->args[0], -i); } + fold_setcond_tst_pow2(ctx, op, true); /* Value is {0,-1} so all bits are repetitions of the sign. */ ctx->s_mask = -1; return false; } - static bool fold_setcond2(OptContext *ctx, TCGOp *op) { TCGCond cond; @@ -1903,21 +2073,36 @@ static bool fold_setcond2(OptContext *ctx, TCGOp *op) case 0: goto do_setcond_const; case 1: - op->args[2] = op->args[3]; - op->args[3] = cond; - op->opc = INDEX_op_setcond_i32; - break; + goto do_setcond_low; + } + break; + + case TCG_COND_TSTEQ: + case TCG_COND_TSTNE: + if (arg_is_const_val(op->args[2], 0)) { + goto do_setcond_high; + } + if (arg_is_const_val(op->args[4], 0)) { + goto do_setcond_low; } break; default: break; + do_setcond_low: + op->args[2] = op->args[3]; + op->args[3] = cond; + op->opc = INDEX_op_setcond_i32; + fold_setcond_tst_pow2(ctx, op, false); + break; + do_setcond_high: op->args[1] = op->args[2]; op->args[2] = op->args[4]; op->args[3] = cond; op->opc = INDEX_op_setcond_i32; + fold_setcond_tst_pow2(ctx, op, false); break; } From patchwork Thu Oct 26 00:13: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: 738190 Delivered-To: patch@linaro.org Received: by 2002:adf:f842:0:b0:32d:baff:b0ca with SMTP id d2csp552549wrq; Wed, 25 Oct 2023 17:18:37 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFkBmfHbTXy4q7EQBdG8Xb3/iRjLeK53xEzooKRbEIaFIza+/lcDTYtDBI/4DvvuF8k3Nq3 X-Received: by 2002:a5d:4652:0:b0:32d:b051:9a2a with SMTP id j18-20020a5d4652000000b0032db0519a2amr11897322wrs.63.1698279517043; Wed, 25 Oct 2023 17:18:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698279517; cv=none; d=google.com; s=arc-20160816; b=HXcDRN0V6dvFoSzyNG9Uk9np+7UqM5ewEJ4FyJ4im5SL4pyhd6cLqUDCTZJurxVOs2 vC2W8vSjd8BxmIczo5S8iJXA6JBIm0FPN0qzmdkKG7GRU4hVW+Y3ToAIkSneNydMyV5+ rvNCseZANXTlC5diaFpQ2MRV6r+BqsXbtutKvWLmvWDAMqnhYe05yPKyJ97wo7JUbSLx lqm13FLmT3o34rw22QW0X22rgBH6qAfX/EA80Iif9NBZ8WqxIL0DcJrQFVr2EaWQuxNB inOzBZN1S4C6P93eYFAIM02KouNMT13eSxSH2rH0d6jHpc+yKPGdSAOQ05n5uiOYYb59 bGow== 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:to:from :dkim-signature; bh=grrY6KBqyVlmw+Y1FqG6v+fB0Wl2pAJYFymCVdGaSh4=; fh=PnYt+qEB9tAfMKoqBm2xjKOFpYyFFGPudh5cVIoieJM=; b=E4EfKwulhYN8oBH8xvmw1xN3iivGtftJpL3hzbVhAwju8AEAnxC2LMrTfTF9EIt6Ud kz8v/7PpRnpw/xdAfNkQV+WA1u13t4XmN2hNZ4+PEdQynDrGCrQD6hoG+hnxDrR20iMd z02GMuXYh9s57u9xdwnrm53lQ84XRzUWe37oCMG8EUD4jy3FU1Mu9eafmqqBCFYLRILD VM1VlVvKGbpgigk93MeQI7XQ9sNPSwT3x81at/xYjWbcWK5NbROSYv0Y7WiIHd12x+Fp OYoSKP/2JdD+raYI+65wnyuxzcFs72stGorGtV9fCP4kZqfGrHev2bl66lyz/IUDZfR/ Ys7w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=FGePbXHi; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as 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 c17-20020a5d4151000000b00324835356afsi8468095wrq.792.2023.10.25.17.18.36 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 25 Oct 2023 17:18:37 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=FGePbXHi; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as 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 1qvo2p-00074F-SS; Wed, 25 Oct 2023 20:16: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 1qvo2i-00070O-SZ for qemu-devel@nongnu.org; Wed, 25 Oct 2023 20:16:08 -0400 Received: from mail-pl1-x62d.google.com ([2607:f8b0:4864:20::62d]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qvo2g-0004qy-1q for qemu-devel@nongnu.org; Wed, 25 Oct 2023 20:16:08 -0400 Received: by mail-pl1-x62d.google.com with SMTP id d9443c01a7336-1c9b7c234a7so2302255ad.3 for ; Wed, 25 Oct 2023 17:15:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1698279356; x=1698884156; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=grrY6KBqyVlmw+Y1FqG6v+fB0Wl2pAJYFymCVdGaSh4=; b=FGePbXHia/47HrRLGrtndW2+2aY4x623ldIxweBIbNCBhRXrUFa97njwFUwawP8VwU 4R9GNu9Dy5PbjdI6lBtlGZHiNfQHnbfviDcorLMBxhMt2UFEWN3Lmn2l1PXnNGoDXCkM /WS1En6VaFr50Msa3c6LyGib3ldI6m1qt+09ZWNZ3HfCT9sUXYDsuOqsHLO4sUY12fTX caMxGUKAaFSUE/ZfIyCr8p+e84cXdE7HF+QfLT/NDBVtdj83kZplrkvdmu9JGX4y1aHp OBsKIzJZw6uN3peclBjf72OXIQ7x9x3yTRz6R3YIVsdU+g9YR30+psk3vbtjikqHBU23 cfcQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1698279356; x=1698884156; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=grrY6KBqyVlmw+Y1FqG6v+fB0Wl2pAJYFymCVdGaSh4=; b=Wi05zQBZBbTa+ql3BZHkUhhZjodSi5bCNwFqApGgS4udGFKtDQZ9hIx5P38EAXEUpn gZpslRMXeYJ7UAvt1s2MD3m0io4G1mPImegAx8wH9PxZ7zserpGMXv11uCW3nRDm8ZL4 qtg6MvyXBL6doaofoiXbikgTIXiJrIlFaojkpGM0lbe7TJJXeo7UqMOJRL299GbueAT7 pHm43oknUWLhSM0ehNv/n2EKAvWJ5HdGaCf7zZJExWJsN5uW934PNaH6sFTNmNsjwLKx BZXqaS01eMbeUnDb5PnU5z/wGDJiClUXZXQmb8PDgGc+CQoOaHMEXUz/sPRTT+WXISYw 0KLw== X-Gm-Message-State: AOJu0YypVUQWvBLAZbRk/8c7OHY886+BJX76ORPLE5dg4u6IRiOK8Q4X p/5bGHt4W8YvXEpTYLFo/mO4jC4dpU7f72UmUGg= X-Received: by 2002:a17:902:ecce:b0:1ca:3241:c679 with SMTP id a14-20020a170902ecce00b001ca3241c679mr17639665plh.16.1698279356040; Wed, 25 Oct 2023 17:15:56 -0700 (PDT) Received: from stoup.. ([71.212.149.95]) by smtp.gmail.com with ESMTPSA id ij23-20020a170902ab5700b001c582de968dsm10038433plb.72.2023.10.25.17.15.55 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 25 Oct 2023 17:15:55 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH 07/29] tcg/aarch64: Support TCG_COND_TST{EQ,NE} Date: Wed, 25 Oct 2023 17:13:53 -0700 Message-Id: <20231026001542.1141412-15-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231026001542.1141412-1-richard.henderson@linaro.org> References: <20231026001542.1141412-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::62d; envelope-from=richard.henderson@linaro.org; helo=mail-pl1-x62d.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 --- tcg/aarch64/tcg-target-con-set.h | 4 +-- tcg/aarch64/tcg-target.c.inc | 58 +++++++++++++++++++++----------- 2 files changed, 41 insertions(+), 21 deletions(-) diff --git a/tcg/aarch64/tcg-target-con-set.h b/tcg/aarch64/tcg-target-con-set.h index 3fdee26a3d..a927cd11a2 100644 --- a/tcg/aarch64/tcg-target-con-set.h +++ b/tcg/aarch64/tcg-target-con-set.h @@ -10,7 +10,7 @@ * tcg-target-con-str.h; the constraint combination is inclusive or. */ C_O0_I1(r) -C_O0_I2(r, rA) +C_O0_I2(r, rAL) C_O0_I2(rZ, r) C_O0_I2(w, r) C_O0_I3(rZ, rZ, r) @@ -31,6 +31,6 @@ C_O1_I2(w, w, wN) C_O1_I2(w, w, wO) C_O1_I2(w, w, wZ) C_O1_I3(w, w, w, w) -C_O1_I4(r, r, rA, rZ, rZ) +C_O1_I4(r, r, rAL, rZ, rZ) C_O2_I1(r, r, r) C_O2_I4(r, r, rZ, rZ, rA, rMZ) diff --git a/tcg/aarch64/tcg-target.c.inc b/tcg/aarch64/tcg-target.c.inc index a3efa1e67a..2a748b3ee3 100644 --- a/tcg/aarch64/tcg-target.c.inc +++ b/tcg/aarch64/tcg-target.c.inc @@ -344,6 +344,9 @@ static const enum aarch64_cond_code tcg_cond_to_aarch64[] = { [TCG_COND_GTU] = COND_HI, [TCG_COND_GEU] = COND_HS, [TCG_COND_LEU] = COND_LS, + /* bit test */ + [TCG_COND_TSTEQ] = COND_EQ, + [TCG_COND_TSTNE] = COND_NE, }; typedef enum { @@ -1341,20 +1344,35 @@ static inline void tcg_out_dep(TCGContext *s, TCGType ext, TCGReg rd, tcg_out_bfm(s, ext, rd, rn, a, b); } -static void tcg_out_cmp(TCGContext *s, TCGType ext, TCGReg a, +static void tcg_out_cmp(TCGContext *s, TCGType ext, TCGCond cond, TCGReg a, tcg_target_long b, bool const_b) { - if (const_b) { - /* Using CMP or CMN aliases. */ - if (b >= 0) { - tcg_out_insn(s, 3401, SUBSI, ext, TCG_REG_XZR, a, b); - } else { - tcg_out_insn(s, 3401, ADDSI, ext, TCG_REG_XZR, a, -b); + if (is_tst_cond(cond)) { + if (const_b) { + if (is_limm(b)) { + tcg_out_logicali(s, I3404_ANDSI, 0, TCG_REG_XZR, a, b); + return; + } + tcg_out_movi(s, ext, TCG_REG_TMP0, b); + b = TCG_REG_TMP0; } - } else { - /* Using CMP alias SUBS wzr, Wn, Wm */ - tcg_out_insn(s, 3502, SUBS, ext, TCG_REG_XZR, a, b); + tcg_out_insn(s, 3510, ANDS, ext, TCG_REG_XZR, a, b); + return; } + + if (const_b) { + if (is_aimm(b)) { + tcg_out_insn(s, 3401, SUBSI, ext, TCG_REG_XZR, a, b); + return; + } + if (is_aimm(-b)) { + tcg_out_insn(s, 3401, ADDSI, ext, TCG_REG_XZR, a, -b); + return; + } + tcg_out_movi(s, ext, TCG_REG_TMP0, b); + b = TCG_REG_TMP0; + } + tcg_out_insn(s, 3502, SUBS, ext, TCG_REG_XZR, a, b); } static void tcg_out_goto(TCGContext *s, const tcg_insn_unit *target) @@ -1401,7 +1419,7 @@ static void tcg_out_brcond(TCGContext *s, TCGType ext, TCGCond c, TCGArg a, need_cmp = false; } else { need_cmp = true; - tcg_out_cmp(s, ext, a, b, b_const); + tcg_out_cmp(s, ext, c, a, b, b_const); } if (!l->has_value) { @@ -1574,7 +1592,7 @@ static void tcg_out_cltz(TCGContext *s, TCGType ext, TCGReg d, } else { AArch64Insn sel = I3506_CSEL; - tcg_out_cmp(s, ext, a0, 0, 1); + tcg_out_cmp(s, ext, TCG_COND_NE, a0, 0, 1); tcg_out_insn(s, 3507, CLZ, ext, TCG_REG_TMP0, a1); if (const_b) { @@ -1719,7 +1737,7 @@ static TCGLabelQemuLdst *prepare_host_addr(TCGContext *s, HostAddress *h, addr_adj, compare_mask); /* Perform the address comparison. */ - tcg_out_cmp(s, addr_type, TCG_REG_TMP0, TCG_REG_TMP2, 0); + tcg_out_cmp(s, addr_type, TCG_COND_NE, TCG_REG_TMP0, TCG_REG_TMP2, 0); /* If not equal, we jump to the slow path. */ ldst->label_ptr[0] = s->code_ptr; @@ -2275,7 +2293,7 @@ static void tcg_out_op(TCGContext *s, TCGOpcode opc, a2 = (int32_t)a2; /* FALLTHRU */ case INDEX_op_setcond_i64: - tcg_out_cmp(s, ext, a1, a2, c2); + tcg_out_cmp(s, ext, args[3], a1, a2, c2); /* Use CSET alias of CSINC Wd, WZR, WZR, invert(cond). */ tcg_out_insn(s, 3506, CSINC, TCG_TYPE_I32, a0, TCG_REG_XZR, TCG_REG_XZR, tcg_invert_cond(args[3])); @@ -2285,7 +2303,7 @@ static void tcg_out_op(TCGContext *s, TCGOpcode opc, a2 = (int32_t)a2; /* FALLTHRU */ case INDEX_op_negsetcond_i64: - tcg_out_cmp(s, ext, a1, a2, c2); + tcg_out_cmp(s, ext, args[3], a1, a2, c2); /* Use CSETM alias of CSINV Wd, WZR, WZR, invert(cond). */ tcg_out_insn(s, 3506, CSINV, ext, a0, TCG_REG_XZR, TCG_REG_XZR, tcg_invert_cond(args[3])); @@ -2295,7 +2313,7 @@ static void tcg_out_op(TCGContext *s, TCGOpcode opc, a2 = (int32_t)a2; /* FALLTHRU */ case INDEX_op_movcond_i64: - tcg_out_cmp(s, ext, a1, a2, c2); + tcg_out_cmp(s, ext, args[5], a1, a2, c2); tcg_out_insn(s, 3506, CSEL, ext, a0, REG0(3), REG0(4), args[5]); break; @@ -2895,11 +2913,13 @@ static TCGConstraintSetIndex tcg_target_op_def(TCGOpcode op) case INDEX_op_add_i64: case INDEX_op_sub_i32: case INDEX_op_sub_i64: + return C_O1_I2(r, r, rA); + case INDEX_op_setcond_i32: case INDEX_op_setcond_i64: case INDEX_op_negsetcond_i32: case INDEX_op_negsetcond_i64: - return C_O1_I2(r, r, rA); + return C_O1_I2(r, r, rAL); case INDEX_op_mul_i32: case INDEX_op_mul_i64: @@ -2949,11 +2969,11 @@ static TCGConstraintSetIndex tcg_target_op_def(TCGOpcode op) case INDEX_op_brcond_i32: case INDEX_op_brcond_i64: - return C_O0_I2(r, rA); + return C_O0_I2(r, rAL); case INDEX_op_movcond_i32: case INDEX_op_movcond_i64: - return C_O1_I4(r, r, rA, rZ, rZ); + return C_O1_I4(r, r, rAL, rZ, rZ); case INDEX_op_qemu_ld_a32_i32: case INDEX_op_qemu_ld_a64_i32: From patchwork Thu Oct 26 00:13: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: 738187 Delivered-To: patch@linaro.org Received: by 2002:adf:f842:0:b0:32d:baff:b0ca with SMTP id d2csp552276wrq; Wed, 25 Oct 2023 17:17:50 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHuO5kXshNHhtROO+hTQrYyge+4wxyAxJ7WdhY1GC4p4NujVwxqOYOJne7ACy5lcq7PfuwK X-Received: by 2002:adf:f08e:0:b0:32d:8c7d:a135 with SMTP id n14-20020adff08e000000b0032d8c7da135mr12043722wro.6.1698279470756; Wed, 25 Oct 2023 17:17:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698279470; cv=none; d=google.com; s=arc-20160816; b=Kel7rbGhdxrL6TFi1yYf/OiOOXugU1Z7KOPt3ji61aISomzceQzzwn+ly1EchzWRuY 4kRy6abNcAnIVbCcUvchjJTNOnLHVYbAuDtP6RHsJMk91nAGXwZbVWXkpWCtwoghjZLG ioXEX2Qexlw5K/DCPYy92otPIGinPc5DWahgwMCbIW6vXRYDuxC5+1WFjdJxbCJdcj6Q kgVxfrxxPychar+oqLdhUuoNcGqObol0z+UomCcvR0wF6CPD3KaEQCFs4b2poEAYA8Fc dEhf7ng2LdH6BLN8dK9X6ZhZ699eipeoR/JgRuFNLJbB9Mrkv9Q872Z0ywSo7segJ2JF +rtg== 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:to:from :dkim-signature; bh=TM/KRrd2eN3gH2XezGt/xyNTAB3pmf+w8+Xiugmh0j8=; fh=PnYt+qEB9tAfMKoqBm2xjKOFpYyFFGPudh5cVIoieJM=; b=dUuPXBH6rr41/7m/1RpPL8dnzKQxgpptZFAVjG8cHUJHBQYiuqujcH6HuxbkyfTpIf SU7MQJI2yOOhAB+Mr55wY4NSYtqaYSeyaJk2fSB4ogVUNxN1PcaZoZtr5gJYAxzVY67Q 3Sh0ayPEfhkjKkJ2/FhPT/XmkmtThr5GqH2FdmoBCkDmnGCmSILfz/+6l6rS8aE4Wa5w JXIN8yx26haCnzasp/mJao+vzolWpFbzSkrFk9UiADBHpWFd1nzbvr5rs9qCoH1jteqQ gRC/Z8heNjaVUrDH3kANWOfaepm3eHgnrQ0PSsykDluJwlAZVP0i0dVtXUeXx48rHbYd McAA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="bnZ+K/HU"; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as 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 x1-20020adfffc1000000b00317ba646bc0si8085345wrs.8.2023.10.25.17.17.50 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 25 Oct 2023 17:17: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="bnZ+K/HU"; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as 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 1qvo2s-00077K-Dj; Wed, 25 Oct 2023 20:16:18 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qvo2k-00070k-W3 for qemu-devel@nongnu.org; Wed, 25 Oct 2023 20:16:12 -0400 Received: from mail-pl1-x631.google.com ([2607:f8b0:4864:20::631]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qvo2g-0004r5-K8 for qemu-devel@nongnu.org; Wed, 25 Oct 2023 20:16:09 -0400 Received: by mail-pl1-x631.google.com with SMTP id d9443c01a7336-1cab2c24ecdso2241205ad.0 for ; Wed, 25 Oct 2023 17:15:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1698279357; x=1698884157; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=TM/KRrd2eN3gH2XezGt/xyNTAB3pmf+w8+Xiugmh0j8=; b=bnZ+K/HU2vyv/jXoCms993r3lAslmTpDa61ludEN3Je88fislNbytASVpeFynI+ZhY R71qppsYXL/vwGBfHp1VF2GV7Zryg4k5fniXK2uvFn8Sxyqr6WK68zs0KIVHingxA5nZ rP7GZxyg/9wEzxNnGwOblMNB9ivLdOCsb+MxRfy82ggcGYQ76KLD7yGAk3RGCQtyjmy9 5QaxTAjy7is1HCDD9LviSC8gCD500pggbCxeL/IW5ofUhaBz2zZIGv/MXErijn5Tu6n1 ektd99NVVrxp4X5mslelI+jYYq05gtCW/rnrhfyQgBnKk2FSkLL+pJhVKBlxSaLI9jpO BZ4w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1698279357; x=1698884157; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=TM/KRrd2eN3gH2XezGt/xyNTAB3pmf+w8+Xiugmh0j8=; b=WgSZcHMmpcICD+fAMIwKqcf21NJSz+UjkjFiKAM4PulmYmQDg+Qtp9QONlw3O8ejzQ M8sYOw3ItIelL3gh32D3KqQbr9hW/DavmZDEC0t2TndKsPm17fgtZ7vSdLHq8KFoJh5X e7x77A/yaLJZ73RAuIDfrATvQrsTZ8iEYoiPdaklN+V0CbTkvMbqgBxuJDDd8ynRqWpO sSEVWwVCHEbV7I+K90dicNZ2alkTCcrFXcA71fzPCowC9gPc/s4Fzc43UoEgJlqoT1Oz KlvvsJTLr8Dwj+QB0240opG08XC+FocOxkprVcqchlOQ/3m1YGgefhyprUNkfXcZbO0s Qy5w== X-Gm-Message-State: AOJu0Yx95ENYag07Em5ensunowlOIyH3I7N07qQ4a2yPy7C9Ni483bSM 9d8IK2n3w3c60lGXO3DZUgBiovS945hdfaaIsCA= X-Received: by 2002:a17:902:da83:b0:1c7:4973:7b34 with SMTP id j3-20020a170902da8300b001c749737b34mr16822669plx.50.1698279357577; Wed, 25 Oct 2023 17:15:57 -0700 (PDT) Received: from stoup.. ([71.212.149.95]) by smtp.gmail.com with ESMTPSA id ij23-20020a170902ab5700b001c582de968dsm10038433plb.72.2023.10.25.17.15.56 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 25 Oct 2023 17:15:57 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH 08/29] tcg/aarch64: Generate TBZ, TBNZ Date: Wed, 25 Oct 2023 17:13:55 -0700 Message-Id: <20231026001542.1141412-17-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231026001542.1141412-1-richard.henderson@linaro.org> References: <20231026001542.1141412-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::631; envelope-from=richard.henderson@linaro.org; helo=mail-pl1-x631.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 Test the sign bit for LT/GE vs 0, and TSTNE/EQ vs a power of 2. Signed-off-by: Richard Henderson --- tcg/aarch64/tcg-target.c.inc | 100 ++++++++++++++++++++++++++++------- 1 file changed, 81 insertions(+), 19 deletions(-) diff --git a/tcg/aarch64/tcg-target.c.inc b/tcg/aarch64/tcg-target.c.inc index 2a748b3ee3..e65fc415d2 100644 --- a/tcg/aarch64/tcg-target.c.inc +++ b/tcg/aarch64/tcg-target.c.inc @@ -105,6 +105,18 @@ static bool reloc_pc19(tcg_insn_unit *src_rw, const tcg_insn_unit *target) return false; } +static bool reloc_pc14(tcg_insn_unit *src_rw, const tcg_insn_unit *target) +{ + const tcg_insn_unit *src_rx = tcg_splitwx_to_rx(src_rw); + ptrdiff_t offset = target - src_rx; + + if (offset == sextract64(offset, 0, 14)) { + *src_rw = deposit32(*src_rw, 5, 14, offset); + return true; + } + return false; +} + static bool patch_reloc(tcg_insn_unit *code_ptr, int type, intptr_t value, intptr_t addend) { @@ -115,6 +127,8 @@ static bool patch_reloc(tcg_insn_unit *code_ptr, int type, return reloc_pc26(code_ptr, (const tcg_insn_unit *)value); case R_AARCH64_CONDBR19: return reloc_pc19(code_ptr, (const tcg_insn_unit *)value); + case R_AARCH64_TSTBR14: + return reloc_pc14(code_ptr, (const tcg_insn_unit *)value); default: g_assert_not_reached(); } @@ -369,6 +383,10 @@ typedef enum { /* Conditional branch (immediate). */ I3202_B_C = 0x54000000, + /* Test and branch (immediate). */ + I3205_TBZ = 0x36000000, + I3205_TBNZ = 0x37000000, + /* Unconditional branch (immediate). */ I3206_B = 0x14000000, I3206_BL = 0x94000000, @@ -649,6 +667,14 @@ static void tcg_out_insn_3202(TCGContext *s, AArch64Insn insn, tcg_out32(s, insn | tcg_cond_to_aarch64[c] | (imm19 & 0x7ffff) << 5); } +static void tcg_out_insn_3205(TCGContext *s, AArch64Insn insn, + TCGReg rt, int imm6, int imm14) +{ + insn |= (imm6 & 0x20) << (31 - 5); + insn |= (imm6 & 0x1f) << 19; + tcg_out32(s, insn | (imm14 & 0x3fff) << 5 | rt); +} + static void tcg_out_insn_3206(TCGContext *s, AArch64Insn insn, int imm26) { tcg_out32(s, insn | (imm26 & 0x03ffffff)); @@ -1412,30 +1438,66 @@ static inline void tcg_out_goto_label(TCGContext *s, TCGLabel *l) static void tcg_out_brcond(TCGContext *s, TCGType ext, TCGCond c, TCGArg a, TCGArg b, bool b_const, TCGLabel *l) { - intptr_t offset; - bool need_cmp; + int tbit = -1; + bool need_cmp = true; - if (b_const && b == 0 && (c == TCG_COND_EQ || c == TCG_COND_NE)) { - need_cmp = false; - } else { - need_cmp = true; - tcg_out_cmp(s, ext, c, a, b, b_const); - } - - if (!l->has_value) { - tcg_out_reloc(s, s->code_ptr, R_AARCH64_CONDBR19, l, 0); - offset = tcg_in32(s) >> 5; - } else { - offset = tcg_pcrel_diff(s, l->u.value_ptr) >> 2; - tcg_debug_assert(offset == sextract64(offset, 0, 19)); + switch (c) { + case TCG_COND_EQ: + case TCG_COND_NE: + if (b_const && b == 0) { + need_cmp = false; + } + break; + case TCG_COND_LT: + case TCG_COND_GE: + if (b_const && b == 0) { + c = (c == TCG_COND_LT ? TCG_COND_TSTNE : TCG_COND_TSTEQ); + tbit = ext ? 63 : 31; + need_cmp = false; + } + break; + case TCG_COND_TSTEQ: + case TCG_COND_TSTNE: + if (b_const && is_power_of_2(b)) { + tbit = ctz64(b); + need_cmp = false; + } + break; + default: + break; } if (need_cmp) { - tcg_out_insn(s, 3202, B_C, c, offset); - } else if (c == TCG_COND_EQ) { - tcg_out_insn(s, 3201, CBZ, ext, a, offset); + tcg_out_cmp(s, ext, c, a, b, b_const); + tcg_out_reloc(s, s->code_ptr, R_AARCH64_CONDBR19, l, 0); + tcg_out_insn(s, 3202, B_C, c, 0); + return; + } + + if (tbit >= 0) { + tcg_out_reloc(s, s->code_ptr, R_AARCH64_TSTBR14, l, 0); + switch (c) { + case TCG_COND_TSTEQ: + tcg_out_insn(s, 3205, TBZ, a, tbit, 0); + break; + case TCG_COND_TSTNE: + tcg_out_insn(s, 3205, TBNZ, a, tbit, 0); + break; + default: + g_assert_not_reached(); + } } else { - tcg_out_insn(s, 3201, CBNZ, ext, a, offset); + tcg_out_reloc(s, s->code_ptr, R_AARCH64_CONDBR19, l, 0); + switch (c) { + case TCG_COND_EQ: + tcg_out_insn(s, 3201, CBZ, ext, a, 0); + break; + case TCG_COND_NE: + tcg_out_insn(s, 3201, CBNZ, ext, a, 0); + break; + default: + g_assert_not_reached(); + } } } From patchwork Thu Oct 26 00:13: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: 738183 Delivered-To: patch@linaro.org Received: by 2002:adf:f842:0:b0:32d:baff:b0ca with SMTP id d2csp552128wrq; Wed, 25 Oct 2023 17:17:31 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEvsMb78nyzM7sO0n9l/G3JcvW4LnuNBdC8qZdA6z9scgzD7Sq7/7ktACW2WEd8180hgRXs X-Received: by 2002:ac8:5906:0:b0:41c:bd6f:e77f with SMTP id 6-20020ac85906000000b0041cbd6fe77fmr17831906qty.55.1698279450797; Wed, 25 Oct 2023 17:17:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698279450; cv=none; d=google.com; s=arc-20160816; b=eMVIrsFbk5DOYlT+o0d/HxCK7D8MJ3m8RRiP1BqV+1UFUO38AZVY99vWPCly2uR2OU tuxczloeOVgN577JKg04lvPdVLWMUx3EfSCMFr0mclop35yPUCv8dmnaM76F3v1HlJWC BvtlJhkUiBnjPwxs5gfIPvjT7/0ECN4dSm/oqGHCSbgnH+GU/ix4Tg+dtlgvr+7qJGSX CL2grz12xcEusUuWNL8R7l9Ty80hk21XZYPOtPlyD+6XxJqs4VkPnSCm/Bnb661Rfztr WgtcbaNt9Zecb129yHfSli5uMj8yNsGkxwfCP21toLYCiDc+V/eLuwCJAw312MDmCH0P d08A== 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:to:from :dkim-signature; bh=lVqtOTdE26FeikcQeSUZ6gzaDd5J2ZKDmGo0pFRcFos=; fh=PnYt+qEB9tAfMKoqBm2xjKOFpYyFFGPudh5cVIoieJM=; b=dnWPnZ/gKsaPN9OkRzRPQ6aLlTNqbHcaB2KM2EFzKsBHhqtTM2lj8JTmmuee+EwYGN qgDF3TAzgoJNdWlAaFNR8j9eEygZQgPTwYUMyu7W0VaogVkDnDIfuxY1sBy5KlYX8+vq 4Ks2Lc3qYZQDPFx0m6YRJVJnG6W/Hlv43XKArgkvF40YFqN1+6EnvjcPPP4UiYI7Bnp7 hUdN5NsOia6upSuiWF2mZK0T33pXgbYmqkRQFbj0jLHAjNmb5G+vm4GWJv/9Xa6Vib0P uUlJw+XlFflUYk8pz0J3ztzHxafXEMnk3UuA8YstSVTyspGp4rm5i9zLiKexjSsGXzI7 AlWw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=aQWOWJMp; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id v9-20020ac85789000000b00418070c227dsi8755210qta.349.2023.10.25.17.17.30 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 25 Oct 2023 17:17: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=aQWOWJMp; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as 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 1qvo2s-00077E-9I; Wed, 25 Oct 2023 20:16:18 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qvo2o-00072e-1B for qemu-devel@nongnu.org; Wed, 25 Oct 2023 20:16:14 -0400 Received: from mail-pl1-x62d.google.com ([2607:f8b0:4864:20::62d]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qvo2h-0004rA-Lb for qemu-devel@nongnu.org; Wed, 25 Oct 2023 20:16:13 -0400 Received: by mail-pl1-x62d.google.com with SMTP id d9443c01a7336-1c87a85332bso2311445ad.2 for ; Wed, 25 Oct 2023 17:15:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1698279358; x=1698884158; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=lVqtOTdE26FeikcQeSUZ6gzaDd5J2ZKDmGo0pFRcFos=; b=aQWOWJMpzZsMkg3EhGGeBZgGUQJwZox9rkIK6jjHVTyhdcXBo2zPLTYBSKuQJpTYNm nFPrOdEBYmacHsdxjDmz1x5WMSebK89C7YMViBSX5bla28Icex98CbiAdK+acNFQJwip o87xD4ZicZLpyfqcugYR6zqbg3uvWDs1WUlVgwXtdRSPZDeQZCHmBIg1X6PUGcOoPAOa EVOgtyxlJC8gtBlNGbUDAPmFyKGhFGbxTKeEWSVwLSChuMepULvlJmji+hVmihIIsIpN z4YATzl5pQmU3kv+S1s2Q6UKNdVvWs2DHvL0pDMXeA7hdMzWxdjTxSVasceuSdEWTs++ NtUQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1698279358; x=1698884158; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=lVqtOTdE26FeikcQeSUZ6gzaDd5J2ZKDmGo0pFRcFos=; b=MQRVPv9uFJ2heaL6xBKoYIOVUvci14tx3r6qB2ivOodKVwddKLyu5rnYzZXJGYfrN/ 9CrDre5yqIoXAqcsZdh+jayOJ2TjN7GuCuwgWGm3Oi7XcUxN1eQKcJTqwwRPE3SusZWa HOkrL2hUcu84ReZ09+SXsZlazbmh2IJssoNRmmolBEp7ul9HHh+AdMsUsgELEZFtm0/1 eIDIDE1pKOIwjRzgFxU0lrx+dFCPLsEEeg/XNYsnQ/iRUW3LbOZRIEG/JGTS7r/tBeKj iXbcb/CKkJu//w95jCquoVlJBPhGdlgsEkmvxyFbDI/ig3nIOjvipXj6lSeQ7cvRSvXC F/rQ== X-Gm-Message-State: AOJu0YxiyCKa8gT16jSr9WvKsLvTxdtaqyyzALY83prIpgZ1nB8W5G7D ZY+d63rX6nKZrmYnsqR6Gzk0UDgLyEPjRPpCnD8= X-Received: by 2002:a17:902:c602:b0:1c8:7822:e5c3 with SMTP id r2-20020a170902c60200b001c87822e5c3mr14284444plr.47.1698279358399; Wed, 25 Oct 2023 17:15:58 -0700 (PDT) Received: from stoup.. ([71.212.149.95]) by smtp.gmail.com with ESMTPSA id ij23-20020a170902ab5700b001c582de968dsm10038433plb.72.2023.10.25.17.15.57 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 25 Oct 2023 17:15:58 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PULL 09/94] target/sparc: Partition cpu features Date: Wed, 25 Oct 2023 17:13:56 -0700 Message-Id: <20231026001542.1141412-18-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231026001542.1141412-1-richard.henderson@linaro.org> References: <20231026001542.1141412-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::62d; envelope-from=richard.henderson@linaro.org; helo=mail-pl1-x62d.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 In the sparc32 binaries, do not advertise features only available to sparc64, so they cannot be enabled. In the sparc64 binaries, do not advertise features mandatory in v9, so they cannot be disabled. Signed-off-by: Richard Henderson --- target/sparc/cpu.c | 42 ++++++++++++++++++++++++------------------ 1 file changed, 24 insertions(+), 18 deletions(-) diff --git a/target/sparc/cpu.c b/target/sparc/cpu.c index f527244aa4..bb1a155510 100644 --- a/target/sparc/cpu.c +++ b/target/sparc/cpu.c @@ -546,14 +546,17 @@ static const sparc_def_t sparc_defs[] = { /* This must match sparc_cpu_properties[]. */ static const char * const feature_name[] = { [CPU_FEATURE_BIT_FLOAT128] = "float128", - [CPU_FEATURE_BIT_MUL] = "mul", - [CPU_FEATURE_BIT_DIV] = "div", - [CPU_FEATURE_BIT_VIS1] = "vis1", - [CPU_FEATURE_BIT_VIS2] = "vis2", - [CPU_FEATURE_BIT_FSMULD] = "fsmuld", - [CPU_FEATURE_BIT_HYPV] = "hypv", +#ifdef TARGET_SPARC64 [CPU_FEATURE_BIT_CMT] = "cmt", [CPU_FEATURE_BIT_GL] = "gl", + [CPU_FEATURE_BIT_HYPV] = "hypv", + [CPU_FEATURE_BIT_VIS1] = "vis1", + [CPU_FEATURE_BIT_VIS2] = "vis2", +#else + [CPU_FEATURE_BIT_MUL] = "mul", + [CPU_FEATURE_BIT_DIV] = "div", + [CPU_FEATURE_BIT_FSMULD] = "fsmuld", +#endif }; static void print_features(uint32_t features, const char *prefix) @@ -832,22 +835,25 @@ static PropertyInfo qdev_prop_nwindows = { static Property sparc_cpu_properties[] = { DEFINE_PROP_BIT("float128", SPARCCPU, env.def.features, CPU_FEATURE_BIT_FLOAT128, 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("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), +#ifdef TARGET_SPARC64 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_BIT("hypv", SPARCCPU, env.def.features, + CPU_FEATURE_BIT_HYPV, 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), +#else + 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("fsmuld", SPARCCPU, env.def.features, + CPU_FEATURE_BIT_FSMULD, false), +#endif 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 Thu Oct 26 00:13: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: 738186 Delivered-To: patch@linaro.org Received: by 2002:adf:f842:0:b0:32d:baff:b0ca with SMTP id d2csp552262wrq; Wed, 25 Oct 2023 17:17:48 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEmkx2gRMQQ0WiBVjcvftNjMjiuMGK7KsaAwtOUv4ghLMKyJhedG2QPFBLyUnixPX9H2fZ2 X-Received: by 2002:a05:600c:1912:b0:408:3b8d:f7e8 with SMTP id j18-20020a05600c191200b004083b8df7e8mr13665450wmq.33.1698279468720; Wed, 25 Oct 2023 17:17:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698279468; cv=none; d=google.com; s=arc-20160816; b=fgKfipt7Z7fPl9NGbJuex5qjjqz0r5bh0MrtScFnYkDPDabRn+ltOMCtH5IXX+GGQy 1nKR6R47+/bXGiJZg6OzbVKijGaIgYuq0IWK8c6zhFkYsMhCcW3ulb1r9wwIZeQfdeul fHbKOHwoYa95IL1J4hOEGapkF81Iun3LazZlJd4gkd6HTA5CRcxdaiNCvVOJ0jbLmJXV h9Mt2uRuGk8JfGo0kqFR1Thmrsw08phOqQBivPmpcAshAUcWe+VLwVdb6gXcDSsP6+L3 wUmahdjXxFCQb98y+MbLlpzBWiijQ6RhKn3tZpLfonWrToMg6OAN0XrCQDxO5HVDl1HW 6H1A== 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:to:from :dkim-signature; bh=mZENFqh4cY1cxr9SwQWDQ8KTGiGlTUEViewQDnyDP2A=; fh=PnYt+qEB9tAfMKoqBm2xjKOFpYyFFGPudh5cVIoieJM=; b=TAg71ZqxWRQxd/XR59I0WauPM7OWb4y34/2Dva2fLf2Jguvs2zNVMVMSB/YxIhaFdS rGnyz5s7DaIiz5yBhJVSSp/KgavflhoTjPLBP/RgwI6z0gwGEiH9Wqk5hzXj7zK641kE YS5qaKFN7xkW5f/u4S9b+8pteU/nlop8tSX+uRuPvf22gNFzdqtMgEmFBQwwcWxfS7bj y8vUoqgJOaiAiZ+JteSYzMWIvNtySedw1zgyhN0ErCIuKHuMUWYyd2B6oKxxfWCXs61H 7yuLhwOC1KixVWobDs4p+mfyA2NhCDnw4DRAJKITvE+2TPou6giIvASuUCXuTMlZ8bxS pEGg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=DD2gscnK; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as 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 bp6-20020a5d5a86000000b0032316c446b6si8773721wrb.994.2023.10.25.17.17.48 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 25 Oct 2023 17:17: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=DD2gscnK; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as 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 1qvo2p-00073u-Kx; Wed, 25 Oct 2023 20:16: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 1qvo2m-00071e-Rr for qemu-devel@nongnu.org; Wed, 25 Oct 2023 20:16:12 -0400 Received: from mail-pl1-x62d.google.com ([2607:f8b0:4864:20::62d]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qvo2h-0004rO-L1 for qemu-devel@nongnu.org; Wed, 25 Oct 2023 20:16:12 -0400 Received: by mail-pl1-x62d.google.com with SMTP id d9443c01a7336-1bf55a81eeaso2375955ad.0 for ; Wed, 25 Oct 2023 17:16:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1698279360; x=1698884160; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=mZENFqh4cY1cxr9SwQWDQ8KTGiGlTUEViewQDnyDP2A=; b=DD2gscnKqIkrx0u0LZ+eF69R0hdVdAsgKdLrvdafU2t69aAN1babDI3nLAkkCi3/Wu CJwY8o31v6lWdKBiBCcQDLL0UlORiHCOscQPQY8/G0i4L5Ptyq7aDV6aKh9e4zyYyuUg GZWuHk0O1NkNRKHCU2Lbyixb0EB9qDOyQWh2vIow6gWjwMPohSHhyxle+Bsc0cx78Z1Y 5nfF7aIUvtPtRcFSZ3oxN3n366+6Qa6Ud38exCAQAjfMN34V6qorjzjxpbVEhJSlREUa z2CI19TqjiB5fkxtfFqGf2f+aKbQOwPhthqQd9z0dSfqzYk7EAPFVNRFZHQoEj8KcyrF eZtg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1698279360; x=1698884160; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=mZENFqh4cY1cxr9SwQWDQ8KTGiGlTUEViewQDnyDP2A=; b=S0e14iyPkpqLt4p5xAFKbcVR9rRIlLLN6I28/aza4zNU8TizW7fvxKA5NvXUk3fxqK QyFO88ro3/+f0Tv8Jl1MjTAMbbZRvMf1/FgzTGN2q9Pu9Y0Hn2W5EMoXuNAz9MSrIgNQ gCOcRBqEumkYd1wo9vE16OM8ZaWHZGf7DTMPa0wjIcVSO+hjJ1iliyvF6FcZ7B4OmswI 3IXZ6KI8LUYhgLxXsHcPwufno5m9iu4hmLXLb2Y9VeypFEk0CUKgksyE/LYf7TeC3TJO X9rSflhqB/WkgsaGja813lJzw6FSBZ8eK+R/EshkDR360dTVF6i17S/uvBEAfjqTo5LX Qojg== X-Gm-Message-State: AOJu0YyLB+D5lMk3sykUtlgGKs54L6ND5rOe0Qh+cQVL/UusHd3618hB 246p/MsCgRZDIY4B4/hmo4M40rhBl1S2vnRUAj0= X-Received: by 2002:a17:903:32d2:b0:1c0:9d6f:9d28 with SMTP id i18-20020a17090332d200b001c09d6f9d28mr16203303plr.11.1698279360554; Wed, 25 Oct 2023 17:16:00 -0700 (PDT) Received: from stoup.. ([71.212.149.95]) by smtp.gmail.com with ESMTPSA id ij23-20020a170902ab5700b001c582de968dsm10038433plb.72.2023.10.25.17.15.59 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 25 Oct 2023 17:16:00 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH 10/29] tcg/i386: Pass x86 condition codes to tcg_out_cmov Date: Wed, 25 Oct 2023 17:13:59 -0700 Message-Id: <20231026001542.1141412-21-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231026001542.1141412-1-richard.henderson@linaro.org> References: <20231026001542.1141412-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::62d; envelope-from=richard.henderson@linaro.org; helo=mail-pl1-x62d.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 Hoist the tcg_cond_to_jcc index outside the function. Signed-off-by: Richard Henderson --- tcg/i386/tcg-target.c.inc | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/tcg/i386/tcg-target.c.inc b/tcg/i386/tcg-target.c.inc index a83f8aab30..0daffb0e70 100644 --- a/tcg/i386/tcg-target.c.inc +++ b/tcg/i386/tcg-target.c.inc @@ -1668,14 +1668,14 @@ static void tcg_out_setcond2(TCGContext *s, const TCGArg *args, } #endif -static void tcg_out_cmov(TCGContext *s, TCGCond cond, int rexw, +static void tcg_out_cmov(TCGContext *s, int jcc, int rexw, TCGReg dest, TCGReg v1) { if (have_cmov) { - tcg_out_modrm(s, OPC_CMOVCC | tcg_cond_to_jcc[cond] | rexw, dest, v1); + tcg_out_modrm(s, OPC_CMOVCC | jcc | rexw, dest, v1); } else { TCGLabel *over = gen_new_label(); - tcg_out_jxx(s, tcg_cond_to_jcc[tcg_invert_cond(cond)], over, 1); + tcg_out_jxx(s, jcc ^ 1, over, 1); tcg_out_mov(s, TCG_TYPE_I32, dest, v1); tcg_out_label(s, over); } @@ -1686,7 +1686,7 @@ static void tcg_out_movcond(TCGContext *s, int rexw, TCGCond cond, TCGReg v1) { tcg_out_cmp(s, c1, c2, const_c2, rexw); - tcg_out_cmov(s, cond, rexw, dest, v1); + tcg_out_cmov(s, tcg_cond_to_jcc[cond], rexw, dest, v1); } static void tcg_out_ctz(TCGContext *s, int rexw, TCGReg dest, TCGReg arg1, @@ -1698,12 +1698,12 @@ static void tcg_out_ctz(TCGContext *s, int rexw, TCGReg dest, TCGReg arg1, tcg_debug_assert(arg2 == (rexw ? 64 : 32)); } else { tcg_debug_assert(dest != arg2); - tcg_out_cmov(s, TCG_COND_LTU, rexw, dest, arg2); + tcg_out_cmov(s, JCC_JB, rexw, dest, arg2); } } else { tcg_debug_assert(dest != arg2); tcg_out_modrm(s, OPC_BSF + rexw, dest, arg1); - tcg_out_cmov(s, TCG_COND_EQ, rexw, dest, arg2); + tcg_out_cmov(s, JCC_JE, rexw, dest, arg2); } } @@ -1716,7 +1716,7 @@ static void tcg_out_clz(TCGContext *s, int rexw, TCGReg dest, TCGReg arg1, tcg_debug_assert(arg2 == (rexw ? 64 : 32)); } else { tcg_debug_assert(dest != arg2); - tcg_out_cmov(s, TCG_COND_LTU, rexw, dest, arg2); + tcg_out_cmov(s, JCC_JB, rexw, dest, arg2); } } else { tcg_debug_assert(!const_a2); @@ -1729,7 +1729,7 @@ static void tcg_out_clz(TCGContext *s, int rexw, TCGReg dest, TCGReg arg1, /* Since we have destroyed the flags from BSR, we have to re-test. */ tcg_out_cmp(s, arg1, 0, 1, rexw); - tcg_out_cmov(s, TCG_COND_EQ, rexw, dest, arg2); + tcg_out_cmov(s, JCC_JE, rexw, dest, arg2); } } From patchwork Thu Oct 26 00:14: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: 738235 Delivered-To: patch@linaro.org Received: by 2002:adf:f842:0:b0:32d:baff:b0ca with SMTP id d2csp555501wrq; Wed, 25 Oct 2023 17:27:32 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGK8kl0qMV4rBC6Yc4wYZAepbXndgoz89IcBvnd2S4S4NZVfT6x/gkA71Ho934Qd2/kdODZ X-Received: by 2002:a05:6000:ac9:b0:31a:e8e6:8a96 with SMTP id di9-20020a0560000ac900b0031ae8e68a96mr12527586wrb.67.1698280052721; Wed, 25 Oct 2023 17:27:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698280052; cv=none; d=google.com; s=arc-20160816; b=gphqnwXcb5bmuPfhjIRWKoDf4pkqV7hmFTEYXVr0RVUswd7+e46yyYsHE4Vjdh/goP wta7OE335nN2zl6Yd8qgnohkkZpjaYltd5HqgtTPn/rXD1bvK5jVpft4E9C12aw9haP7 T4sjOs4Cam6yGQZYZeVWRYlbIfaGqrGjmrQoK8j+1dY2BpfYArSnqX4+TvNclklqf4ZZ QzsZ22b3p9Dsr0qvuM558WstszKwM2yYZN94bfARn5avltSsrpq6q8Gr0VP1O3E7tBXt ngUYLX1LNE0+1CL1OgYcpdEjEEB2tz5eVul25nfta0X79uQLJpBtcF8oKSbWHuNddR49 JbVA== 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:to:from :dkim-signature; bh=KAuC6MuCUKIHHBxqGTcvXulP9OV1zIYTQIpMzlqMLcg=; fh=PnYt+qEB9tAfMKoqBm2xjKOFpYyFFGPudh5cVIoieJM=; b=FvHi+iXYnmW0ebu09FEGjaqgBHyFAz97YOJfh4nIkOH5SfVUAhtyObvAC+cCwDGkmP Nu/0zXbNF4wL48GIzkSKa2Y9QKlds3LqBaSUSgdZb8S/B0DOHMcM+osZs+iXDoYLx4Hl Q21VQYEMdHlJajtI2GJmFL2fvhr/Kuh8c171ggZGUQ2Q3Eqb+ZAFezrSrZoy0uM6T4eE VMd7I8p6ggnADtVJdXPFEGfvmsPBqWpTfS7UXOHuq7OsuUzSiE4aJbTtGCG0opBqdlni ojqOBBJ1Oi0Aw6dQ9fdvPrFjz3dQcBU6y1rsog1c+lbWcrqFLCCPtu6gHwtOCju2heBd moMg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=a5HtLAIX; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as 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 g14-20020a5d46ce000000b003176fea0c60si8213574wrs.617.2023.10.25.17.27.32 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 25 Oct 2023 17:27: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=a5HtLAIX; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as 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 1qvo2r-00076f-Ju; Wed, 25 Oct 2023 20:16:17 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qvo2k-00070l-W9 for qemu-devel@nongnu.org; Wed, 25 Oct 2023 20:16:12 -0400 Received: from mail-pl1-x62e.google.com ([2607:f8b0:4864:20::62e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qvo2g-0004rY-Ji for qemu-devel@nongnu.org; Wed, 25 Oct 2023 20:16:08 -0400 Received: by mail-pl1-x62e.google.com with SMTP id d9443c01a7336-1c434c33ec0so2266925ad.3 for ; Wed, 25 Oct 2023 17:16:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1698279362; x=1698884162; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=KAuC6MuCUKIHHBxqGTcvXulP9OV1zIYTQIpMzlqMLcg=; b=a5HtLAIX+A3bemenxWauITQK4CD+rNKOTw1hp0u4LCVGqkOetaWQ26OWanHJcuArjV fJi4MbqDVzjzXtl839Cz9z6r6+3n0DjhJXoMQiqtLF9DqUGMVpaVoK8APkaVeM7ErlTY 1SKROH6BHdd/xYgZj2NzI+QcqnnsPBgRdWeyBllJ0Ky8hPUnu0oFnuwrJoZXMknvXYEa GXZstrsa3g8YxHImuKqmuibpj8Mx+Wm2c9r8CJC4YYWnVwUn4bUporHGZcEy/10q+zzW npmwtj+9+AIq5GvPwvplOOlNcHSOpETiyj1hkgqA87Bn/5GMC6BfadiS4uJT+iuj4lOq YBhQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1698279362; x=1698884162; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=KAuC6MuCUKIHHBxqGTcvXulP9OV1zIYTQIpMzlqMLcg=; b=NApVGFBV1cCVMsBuOb4nvdV5WwN6kO7pKxY0Rsb5VAztMzjS44KjX9XvrNNtAlzsht WKtDgx6Cpwr2yn28GK10waQI3Ds2q80VMGNm0j9+t57iNxoWP/7uX4Cdt835M5acVX06 Ffprn5tQt+LC9EI+bPRWy6pPUww7lYu+MqROfzswBaY7/ysWZzMKJ1SvPJDXQh/xV+ZE bKdvtEfBkOOrKEpnwRCysAMn8l8q4R5BKn24/0xQI/uNwq++peOvBYye3IeRuuGxjy5z 20pVCgU/wA2gPLThVIO0CRZKVlIA9P0xaB3rAwzu9HBbf2b4IVAAXxGYGUeKrBhnfmTo QXbw== X-Gm-Message-State: AOJu0Yxj+UfCyGi+03kaTR3B6HOUfItA97fR27L8SQCPGJIlD2bMPX56 o+pbiv/2Ajo7VxeDRCDTUAkBV18WY0LfIohM/3A= X-Received: by 2002:a17:902:cec6:b0:1c5:cbfb:c16f with SMTP id d6-20020a170902cec600b001c5cbfbc16fmr16385499plg.25.1698279362200; Wed, 25 Oct 2023 17:16:02 -0700 (PDT) Received: from stoup.. ([71.212.149.95]) by smtp.gmail.com with ESMTPSA id ij23-20020a170902ab5700b001c582de968dsm10038433plb.72.2023.10.25.17.16.01 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 25 Oct 2023 17:16:01 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH 11/29] tcg/i386: Move tcg_cond_to_jcc[] into tcg_out_cmp Date: Wed, 25 Oct 2023 17:14:01 -0700 Message-Id: <20231026001542.1141412-23-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231026001542.1141412-1-richard.henderson@linaro.org> References: <20231026001542.1141412-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::62e; envelope-from=richard.henderson@linaro.org; helo=mail-pl1-x62e.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org Return the x86 condition codes to use after the compare. Signed-off-by: Richard Henderson --- tcg/i386/tcg-target.c.inc | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/tcg/i386/tcg-target.c.inc b/tcg/i386/tcg-target.c.inc index 0daffb0e70..6e8af1fcf6 100644 --- a/tcg/i386/tcg-target.c.inc +++ b/tcg/i386/tcg-target.c.inc @@ -1418,8 +1418,8 @@ static void tcg_out_jxx(TCGContext *s, int opc, TCGLabel *l, bool small) } } -static void tcg_out_cmp(TCGContext *s, TCGArg arg1, TCGArg arg2, - int const_arg2, int rexw) +static int tcg_out_cmp(TCGContext *s, TCGCond cond, TCGArg arg1, + TCGArg arg2, int const_arg2, int rexw) { if (const_arg2) { if (arg2 == 0) { @@ -1431,14 +1431,15 @@ static void tcg_out_cmp(TCGContext *s, TCGArg arg1, TCGArg arg2, } else { tgen_arithr(s, ARITH_CMP + rexw, arg1, arg2); } + return tcg_cond_to_jcc[cond]; } static void tcg_out_brcond(TCGContext *s, int rexw, TCGCond cond, TCGArg arg1, TCGArg arg2, int const_arg2, TCGLabel *label, bool small) { - tcg_out_cmp(s, arg1, arg2, const_arg2, rexw); - tcg_out_jxx(s, tcg_cond_to_jcc[cond], label, small); + int jcc = tcg_out_cmp(s, cond, arg1, arg2, const_arg2, rexw); + tcg_out_jxx(s, jcc, label, small); } #if TCG_TARGET_REG_BITS == 32 @@ -1530,6 +1531,7 @@ static void tcg_out_setcond(TCGContext *s, int rexw, TCGCond cond, { bool inv = false; bool cleared; + int jcc; switch (cond) { case TCG_COND_NE: @@ -1566,7 +1568,7 @@ static void tcg_out_setcond(TCGContext *s, int rexw, TCGCond cond, * We can then use NEG or INC to produce the desired result. * This is always smaller than the SETCC expansion. */ - tcg_out_cmp(s, arg1, arg2, const_arg2, rexw); + tcg_out_cmp(s, TCG_COND_LTU, arg1, arg2, const_arg2, rexw); /* X - X - C = -C = (C ? -1 : 0) */ tgen_arithr(s, ARITH_SBB + (neg ? rexw : 0), dest, dest); @@ -1613,8 +1615,8 @@ static void tcg_out_setcond(TCGContext *s, int rexw, TCGCond cond, cleared = true; } - tcg_out_cmp(s, arg1, arg2, const_arg2, rexw); - tcg_out_modrm(s, OPC_SETCC | tcg_cond_to_jcc[cond], 0, dest); + jcc = tcg_out_cmp(s, cond, arg1, arg2, const_arg2, rexw); + tcg_out_modrm(s, OPC_SETCC | jcc, 0, dest); if (!cleared) { tcg_out_ext8u(s, dest, dest); @@ -1685,8 +1687,8 @@ static void tcg_out_movcond(TCGContext *s, int rexw, TCGCond cond, TCGReg dest, TCGReg c1, TCGArg c2, int const_c2, TCGReg v1) { - tcg_out_cmp(s, c1, c2, const_c2, rexw); - tcg_out_cmov(s, tcg_cond_to_jcc[cond], rexw, dest, v1); + int jcc = tcg_out_cmp(s, cond, c1, c2, const_c2, rexw); + tcg_out_cmov(s, jcc, rexw, dest, v1); } static void tcg_out_ctz(TCGContext *s, int rexw, TCGReg dest, TCGReg arg1, @@ -1728,8 +1730,8 @@ static void tcg_out_clz(TCGContext *s, int rexw, TCGReg dest, TCGReg arg1, tgen_arithi(s, ARITH_XOR + rexw, dest, rexw ? 63 : 31, 0); /* Since we have destroyed the flags from BSR, we have to re-test. */ - tcg_out_cmp(s, arg1, 0, 1, rexw); - tcg_out_cmov(s, JCC_JE, rexw, dest, arg2); + int jcc = tcg_out_cmp(s, TCG_COND_EQ, arg1, 0, 1, rexw); + tcg_out_cmov(s, jcc, rexw, dest, arg2); } } From patchwork Thu Oct 26 00:14: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: 738204 Delivered-To: patch@linaro.org Received: by 2002:adf:f842:0:b0:32d:baff:b0ca with SMTP id d2csp553765wrq; Wed, 25 Oct 2023 17:22:11 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHBfrosAa26AoRk84rhKgq10WlKcXOK90LcTVkO3Ank4H9uw80X343UVZWo395WPAeYc6wv X-Received: by 2002:a05:600c:3146:b0:409:677:31e7 with SMTP id h6-20020a05600c314600b00409067731e7mr6976235wmo.11.1698279730986; Wed, 25 Oct 2023 17:22:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698279730; cv=none; d=google.com; s=arc-20160816; b=VaNffXKYE/gkQdUAfTvZbI9Y0qU1mY9I4P7WgX3Vw/zUP83U1oVPctiG+75yGV8TYS OzYBg8lDM60WjJmhkb+IeTUF2K2AyUq12or+pdkcLHOgpRWdfRNq07Rhel+eo67aYtpb 5QmRtKdLr2eC9gb3TjcVQr5K368CBlnONI22Iw5Kt6nnSDvQZaA94d+OFO/2KK/M09Z6 tS3351saLc2xs8hE76aXwHOEjfXnHyPKHHdTLgR8oMSqxcU2QNdhvogGjVt72MTbT0bU 3Sb26shhToH4ZAKrtgkWbexylnJJUScQjSh2vVQZD9AP+U3Gxg93aMRE8zAH9+XaF4yx DRmg== 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:to:from :dkim-signature; bh=pWAF8Yy1Ybd5ENfcMHYAo9tgOERLXXMk37OKNqP6zdk=; fh=PnYt+qEB9tAfMKoqBm2xjKOFpYyFFGPudh5cVIoieJM=; b=AFlsryWgegIu4Q1NhkW7qyQnWIocsC9JGMSjsmZx5o5iqZ402Td27QoFTe0+nfDET3 hn0uRddK+L2ePdQpmI/GuymidfvYSQR405D5OqmDw2lZqjBNYWrKywDw4bZn+i2bQqaF njZIktMkeOK25x68xSUpDx5pjcq/f0lkW2cJlxdkSE4/Qd/oN+QMPhcjHUclRR04m2gV Kg3UCIKuiDva2yj/tdsbgym00KtbmSRLIcKkXBvwvVbdCvZSiKzdBdqzMLXGrPs6FN2o dLj8JKlrnZ6jM8N4EhGwfGHtrMuAVXqCPTisGOGf7B9ApV6tjvJv8X5Q1USydATwDj7B Qdzg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=G4K8gPGS; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as 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 m10-20020a7bce0a000000b003fddcb1a385si754952wmc.128.2023.10.25.17.22.10 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 25 Oct 2023 17:22: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=G4K8gPGS; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as 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 1qvo2t-0007A5-8m; Wed, 25 Oct 2023 20:16: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 1qvo2o-000737-9F for qemu-devel@nongnu.org; Wed, 25 Oct 2023 20:16:14 -0400 Received: from mail-pl1-x629.google.com ([2607:f8b0:4864:20::629]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qvo2h-0004rh-Ln for qemu-devel@nongnu.org; Wed, 25 Oct 2023 20:16:13 -0400 Received: by mail-pl1-x629.google.com with SMTP id d9443c01a7336-1ca052ec63bso2381745ad.1 for ; Wed, 25 Oct 2023 17:16:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1698279363; x=1698884163; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=pWAF8Yy1Ybd5ENfcMHYAo9tgOERLXXMk37OKNqP6zdk=; b=G4K8gPGSkpMJ3HklLnruYNFKAXek6Aa4XwFjngdG1ctEkRum3UD+ozZl6w03TM+mHx ec7jM2lZIJRwzuUzGfLchOX1hwZ4dCslOcG5bZxJq9QcfMso+u75udlQmCVXBVqwshaw gIv2mD5vHyd8z9f/U3j+6KMm3l7v99e5pJTxRUGa3UO8uL6aFDcHTmVgtzWP2XpFApkp k9yeZnAkZPdlthsXGbzxQMTxvffieZQejqIs8AF9eCxRcLT4jILAiEcdRwq8U4+WwDKD fiSQJsIY4XQ1Aq5BvZEePIgoDJeJBy009v6RmVJ1qvm2zMuQswrqPJramLIcUQdAbPTt H/QQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1698279363; x=1698884163; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=pWAF8Yy1Ybd5ENfcMHYAo9tgOERLXXMk37OKNqP6zdk=; b=IajFDYR8gaL1bcdeZ33p4fCt71WuEPsa0Bm5njF56EbE5jXOb5xyCfZJjn2UoA1xca X52BtVKpNFzpTX6hvtTQzd23apd4nAZR75760b1I2D5TU3HMxU2SeJF5i8UlEG7o4EfV ln1oxMwk93PbowmFJGBmLTJTFinc7iYet4fxaHaEA1xvAYmBichxHaspLFIJyEVvdu5g p9etr9os/66S/CR3bNXEhglUyDVpB/0khdXQfxNYeh6VapTv4ipaEtUiVuTmZAICxPDH gM54wFfGk0M1fbCNWzC/SkVDqybX/Ne+oWvhLqqtpCYolCKsxHQvRAYyu0ww63QdXsZw I9jA== X-Gm-Message-State: AOJu0YwMxuKamU3O6UfwunE+BPXT9IpS0JUCXqknsNPYApY9GrLwjXok 1fJsVJzAPUAoy37ptrV0Q5aYbRBnRvPPEpnOO+Q= X-Received: by 2002:a17:903:1252:b0:1c9:e774:58d9 with SMTP id u18-20020a170903125200b001c9e77458d9mr19621895plh.34.1698279363686; Wed, 25 Oct 2023 17:16:03 -0700 (PDT) Received: from stoup.. ([71.212.149.95]) by smtp.gmail.com with ESMTPSA id ij23-20020a170902ab5700b001c582de968dsm10038433plb.72.2023.10.25.17.16.03 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 25 Oct 2023 17:16:03 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH 12/29] tcg/i386: Add rexw argument to tcg_out_testi Date: Wed, 25 Oct 2023 17:14:03 -0700 Message-Id: <20231026001542.1141412-25-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231026001542.1141412-1-richard.henderson@linaro.org> References: <20231026001542.1141412-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::629; envelope-from=richard.henderson@linaro.org; helo=mail-pl1-x629.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org Move up above tcg_out_cmp, where it will be used. Signed-off-by: Richard Henderson --- tcg/i386/tcg-target.c.inc | 36 ++++++++++++++++-------------------- 1 file changed, 16 insertions(+), 20 deletions(-) diff --git a/tcg/i386/tcg-target.c.inc b/tcg/i386/tcg-target.c.inc index 6e8af1fcf6..f4f456a2c0 100644 --- a/tcg/i386/tcg-target.c.inc +++ b/tcg/i386/tcg-target.c.inc @@ -1418,6 +1418,19 @@ static void tcg_out_jxx(TCGContext *s, int opc, TCGLabel *l, bool small) } } +/* Test register R vs immediate bits I, setting Z flag for EQ/NE. */ +static void __attribute__((unused)) +tcg_out_testi(TCGContext *s, TCGReg r, uint32_t i, int rexw) +{ + if (i <= 0xff && (TCG_TARGET_REG_BITS == 64 || r < 4)) { + tcg_out_modrm(s, OPC_GRP3_Eb | P_REXB_RM, EXT3_TESTi, r); + tcg_out8(s, i); + } else { + tcg_out_modrm(s, OPC_GRP3_Ev + rexw, EXT3_TESTi, r); + tcg_out32(s, i); + } +} + static int tcg_out_cmp(TCGContext *s, TCGCond cond, TCGArg arg1, TCGArg arg2, int const_arg2, int rexw) { @@ -1796,23 +1809,6 @@ static void tcg_out_nopn(TCGContext *s, int n) tcg_out8(s, 0x90); } -/* Test register R vs immediate bits I, setting Z flag for EQ/NE. */ -static void __attribute__((unused)) -tcg_out_testi(TCGContext *s, TCGReg r, uint32_t i) -{ - /* - * This is used for testing alignment, so we can usually use testb. - * For i686, we have to use testl for %esi/%edi. - */ - if (i <= 0xff && (TCG_TARGET_REG_BITS == 64 || r < 4)) { - tcg_out_modrm(s, OPC_GRP3_Eb | P_REXB_RM, EXT3_TESTi, r); - tcg_out8(s, i); - } else { - tcg_out_modrm(s, OPC_GRP3_Ev, EXT3_TESTi, r); - tcg_out32(s, i); - } -} - typedef struct { TCGReg base; int index; @@ -2080,7 +2076,7 @@ static TCGLabelQemuLdst *prepare_host_addr(TCGContext *s, HostAddress *h, ldst->addrlo_reg = addrlo; ldst->addrhi_reg = addrhi; - tcg_out_testi(s, addrlo, a_mask); + tcg_out_testi(s, addrlo, a_mask, false); /* jne slow_path */ tcg_out_opc(s, OPC_JCC_long + JCC_JNE, 0, 0, 0); ldst->label_ptr[0] = s->code_ptr; @@ -2229,7 +2225,7 @@ static void tcg_out_qemu_ld_direct(TCGContext *s, TCGReg datalo, TCGReg datahi, TCGLabel *l1 = gen_new_label(); TCGLabel *l2 = gen_new_label(); - tcg_out_testi(s, h.base, 15); + tcg_out_testi(s, h.base, 15, false); tcg_out_jxx(s, JCC_JNE, l1, true); tcg_out_vex_modrm_sib_offset(s, OPC_MOVDQA_VxWx + h.seg, @@ -2357,7 +2353,7 @@ static void tcg_out_qemu_st_direct(TCGContext *s, TCGReg datalo, TCGReg datahi, TCGLabel *l1 = gen_new_label(); TCGLabel *l2 = gen_new_label(); - tcg_out_testi(s, h.base, 15); + tcg_out_testi(s, h.base, 15, false); tcg_out_jxx(s, JCC_JNE, l1, true); tcg_out_vex_modrm_sib_offset(s, OPC_MOVDQA_WxVx + h.seg, From patchwork Thu Oct 26 00:14: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: 738211 Delivered-To: patch@linaro.org Received: by 2002:adf:f842:0:b0:32d:baff:b0ca with SMTP id d2csp554153wrq; Wed, 25 Oct 2023 17:23:17 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHR8oON4sNaJw5Y25Hg8AlsMlJJYRlo+bKHfJQ16YJeiZ7SWG4tz7kYc/zKxrqRY/9uD1S8 X-Received: by 2002:a05:6214:2401:b0:66d:a50a:2c6 with SMTP id fv1-20020a056214240100b0066da50a02c6mr17136931qvb.63.1698279796970; Wed, 25 Oct 2023 17:23:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698279796; cv=none; d=google.com; s=arc-20160816; b=jdsG0N6Krxgo1Kuu+p9z5rbLV8jgYzSan+NJSa8tlGTqQZQAjNN+brh/3n80uwxc+p hiEWkmnXDaEWQc2moTQGbd+W7pSg2kJHHGRamyaIVMBZGuW1PEMmMgH97aacXRa6B+ZF RTHX4UE5g4T7pbKRA6Qey4P/GvWU97cfW80fms0Gm7hEOCPXEgJb84wUO1vIQVu9Tlfb LeNpUS7Fx+15BLmIq+eALjo32/ETSLmEiSmGgloZIKw+M73wVu3w7xe9YkE0Mhm95L/Q nhjbdUT4UcpgwpPudrtniRHe4WjTh/2Ia7cx9aco7yRysEH/Wao1nH4hunr0LXTbaoKG Az2w== 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:to:from :dkim-signature; bh=KUL+P8NrKSp/2wsdRODDHeKdHM6SlkUdqF+vGMepqTA=; fh=PnYt+qEB9tAfMKoqBm2xjKOFpYyFFGPudh5cVIoieJM=; b=MNa7tHTt/RKUk99GjD2G+/EzlrsCCqFgEke54f8qu/gMat53LDq5H0yhWqqRy1U7QJ dXoG5gNlByxvUjU4Y7obvrfz78mNzW0yqdtl6TYDjNiYk2ZOCNR9Na//1Tr3GlFbArge rHiNBQ2ofE+VR3Kl5+UaZ+LqqssKDlaEgqqCAP++r1dAohNpaNKObmLXnnP0UUaGc17E UA0X1rr3RhzExnPbFGv5In7KpAK9rA47K5VPbop6IUkSe1/oIPiogwXNRZ0ACTFsfVQ5 nCHsaAS2h5kXHBQukoT6oTr5zZVZBdOA9+N1UHSHg1uySdzZfqVglkHjEvZESNJEBY0u KhpA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=PQGsmS+0; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as 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 ol13-20020a0562143d0d00b0066cfb07ef92si9501308qvb.179.2023.10.25.17.23.16 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 25 Oct 2023 17:23:16 -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=PQGsmS+0; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as 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 1qvo2t-0007B5-U3; Wed, 25 Oct 2023 20:16: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 1qvo2p-00073s-Ic for qemu-devel@nongnu.org; Wed, 25 Oct 2023 20:16:15 -0400 Received: from mail-pl1-x630.google.com ([2607:f8b0:4864:20::630]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qvo2i-0004rz-JI for qemu-devel@nongnu.org; Wed, 25 Oct 2023 20:16:15 -0400 Received: by mail-pl1-x630.google.com with SMTP id d9443c01a7336-1bf55a81eeaso2376285ad.0 for ; Wed, 25 Oct 2023 17:16:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1698279365; x=1698884165; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=KUL+P8NrKSp/2wsdRODDHeKdHM6SlkUdqF+vGMepqTA=; b=PQGsmS+03OmJLtFyQ/eE3XmOxzRV1op/pePko97hx87PGNY0Dp5xLMjc2baTCx99tY Kv0zJfREZl089d6ZsLx2pSybzYFUIkFGJN1IPkAoWoIbSd4V25dLJROumGYv8ndOKVwf zyoFRRwiB8qtqjELTuDtHJCe063esrYdkeZSnwZIXiUlEYzwQXSxKRMIvBweDSZGxSGq sARKRcnr6ZpX5Goii/xSwGy/DESoMjG+gVoQC9ZNX/gpdtYqieRWS9otIE2lSYBcz2TM tOg6UZH4zBdKHcW5YhS1Z2vB/bbOw9XzF9IgpuUmOBrzZI38b0b5YKW/Dqk4vNl2UGqM 42GQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1698279365; x=1698884165; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=KUL+P8NrKSp/2wsdRODDHeKdHM6SlkUdqF+vGMepqTA=; b=EmLeHacPsLaA9cR0bBCikhpS9by/E+B5FtVu5yGEqgNThE0zbfzJFDKmVlO1yNXsCX xCoAkr/sVDr+L0fhlzklNlBPFCXQ2deXqzMiYAbDwxz8dPykU+WMTlkIL+nUJKWALVwb v6BzHdOaF2i9NAhrkjcyAPnGL0ok1Vax8m5mCmOmIy4pzZ5gJj3FsqpyXLCmq+BpmEJ5 aAtidAerEHhpvU4B5kUx9UWSbGfI4g4G+ERoIrqhYpxLSG4iDdlzg4TJcydn1D7Od4Y+ bK8XB95SqnUeF+wFLr+a6sV8GtS4cmOUYSG9VqzlOS4eFFkD2hD+9djUe668lxGu0kop FSRg== X-Gm-Message-State: AOJu0YzI6xIaFptESyDJZfumkQDqKcG8lfKM2Ew3EHfftmji1kMwE81y 3CUMvhHFi3CiUieop3kjGwOwiUcHQ4Jju5vkGac= X-Received: by 2002:a17:902:f0d2:b0:1c9:b785:bc50 with SMTP id v18-20020a170902f0d200b001c9b785bc50mr10998924pla.47.1698279365560; Wed, 25 Oct 2023 17:16:05 -0700 (PDT) Received: from stoup.. ([71.212.149.95]) by smtp.gmail.com with ESMTPSA id ij23-20020a170902ab5700b001c582de968dsm10038433plb.72.2023.10.25.17.16.04 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 25 Oct 2023 17:16:05 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH 13/29] tcg/i386: Support TCG_COND_TST{EQ,NE} Date: Wed, 25 Oct 2023 17:14:05 -0700 Message-Id: <20231026001542.1141412-27-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231026001542.1141412-1-richard.henderson@linaro.org> References: <20231026001542.1141412-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::630; envelope-from=richard.henderson@linaro.org; helo=mail-pl1-x630.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 --- tcg/i386/tcg-target.c.inc | 43 +++++++++++++++++++++++++++------------ 1 file changed, 30 insertions(+), 13 deletions(-) diff --git a/tcg/i386/tcg-target.c.inc b/tcg/i386/tcg-target.c.inc index f4f456a2c0..0d97864174 100644 --- a/tcg/i386/tcg-target.c.inc +++ b/tcg/i386/tcg-target.c.inc @@ -504,6 +504,8 @@ static const uint8_t tcg_cond_to_jcc[] = { [TCG_COND_GEU] = JCC_JAE, [TCG_COND_LEU] = JCC_JBE, [TCG_COND_GTU] = JCC_JA, + [TCG_COND_TSTEQ] = JCC_JE, + [TCG_COND_TSTNE] = JCC_JNE, }; #if TCG_TARGET_REG_BITS == 64 @@ -1419,12 +1421,14 @@ static void tcg_out_jxx(TCGContext *s, int opc, TCGLabel *l, bool small) } /* Test register R vs immediate bits I, setting Z flag for EQ/NE. */ -static void __attribute__((unused)) -tcg_out_testi(TCGContext *s, TCGReg r, uint32_t i, int rexw) +static void tcg_out_testi(TCGContext *s, TCGReg r, uint32_t i, int rexw) { if (i <= 0xff && (TCG_TARGET_REG_BITS == 64 || r < 4)) { tcg_out_modrm(s, OPC_GRP3_Eb | P_REXB_RM, EXT3_TESTi, r); tcg_out8(s, i); + } else if ((i & ~0xff00) == 0 && r < 4) { + tcg_out_modrm(s, OPC_GRP3_Eb, EXT3_TESTi, r); + tcg_out8(s, i >> 8); } else { tcg_out_modrm(s, OPC_GRP3_Ev + rexw, EXT3_TESTi, r); tcg_out32(s, i); @@ -1434,15 +1438,25 @@ tcg_out_testi(TCGContext *s, TCGReg r, uint32_t i, int rexw) static int tcg_out_cmp(TCGContext *s, TCGCond cond, TCGArg arg1, TCGArg arg2, int const_arg2, int rexw) { - if (const_arg2) { - if (arg2 == 0) { - /* test r, r */ + if (is_tst_cond(cond)) { + if (!const_arg2) { + tcg_out_modrm(s, OPC_TESTL + rexw, arg1, arg2); + } else { + if (!rexw) { + arg2 = (uint32_t)arg2; + } else if ((arg2 >> 31 >> 1) == 0) { + rexw = 0; + } + tcg_out_testi(s, arg1, arg2, rexw); + } + } else { + if (!const_arg2) { + tgen_arithr(s, ARITH_CMP + rexw, arg1, arg2); + } else if (arg2 == 0) { tcg_out_modrm(s, OPC_TESTL + rexw, arg1, arg1); } else { tgen_arithi(s, ARITH_CMP + rexw, arg1, arg2, 0); } - } else { - tgen_arithr(s, ARITH_CMP + rexw, arg1, arg2); } return tcg_cond_to_jcc[cond]; } @@ -1461,18 +1475,21 @@ static void tcg_out_brcond2(TCGContext *s, const TCGArg *args, { TCGLabel *label_next = gen_new_label(); TCGLabel *label_this = arg_label(args[5]); + TCGCond cond = args[4]; - switch(args[4]) { + switch (cond) { case TCG_COND_EQ: - tcg_out_brcond(s, 0, TCG_COND_NE, args[0], args[2], const_args[2], - label_next, 1); - tcg_out_brcond(s, 0, TCG_COND_EQ, args[1], args[3], const_args[3], + case TCG_COND_TSTEQ: + tcg_out_brcond(s, 0, tcg_invert_cond(cond), + args[0], args[2], const_args[2], label_next, 1); + tcg_out_brcond(s, 0, cond, args[1], args[3], const_args[3], label_this, small); break; case TCG_COND_NE: - tcg_out_brcond(s, 0, TCG_COND_NE, args[0], args[2], const_args[2], + case TCG_COND_TSTNE: + tcg_out_brcond(s, 0, cond, args[0], args[2], const_args[2], label_this, small); - tcg_out_brcond(s, 0, TCG_COND_NE, args[1], args[3], const_args[3], + tcg_out_brcond(s, 0, cond, args[1], args[3], const_args[3], label_this, small); break; case TCG_COND_LT: From patchwork Thu Oct 26 00:14: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: 738199 Delivered-To: patch@linaro.org Received: by 2002:adf:f842:0:b0:32d:baff:b0ca with SMTP id d2csp553556wrq; Wed, 25 Oct 2023 17:21:35 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFsRs/n72Ur7bG4x1CZGVs7Vhv23wLR/2ZMKwiefBB5KKOEXPGMmqGZvUobL8ao0pTjshpj X-Received: by 2002:a05:651c:152:b0:2b9:ecab:d924 with SMTP id c18-20020a05651c015200b002b9ecabd924mr12863941ljd.18.1698279695281; Wed, 25 Oct 2023 17:21:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698279695; cv=none; d=google.com; s=arc-20160816; b=G4SGoYt+ME/29cI8UijYIJNt+D5aWyHKh1PPuoTUm0ecbIqE6dV5Fl8d5Y+1CA74kx JwRmUyyC1lgI1TGo2YNFwyt9AZEKcH/WOXicqRMK4powKo//nlpKR5zsLX3+nFLV4cWi of2xFj0XRFjGKVkDZ3MZ82wZ06oAEFPkSPLUEIM7IX6K6EoRDPHjUmQerQfUZV8Lcxdc iFcU0+mbQ/mb/uB1DjPdz1HxurM1Ntq/S8M90DsvSftfvdHu2+PRatqGIA8HSUUgBjBU 75mf7yYVvcSHHpXL8SIgMpc5ae2IG4dbol2kntMcBw+KDQt8Asq/fxVAS+Iv1lTns7EN ptcA== 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=CKN37OBBkB+L9M8Uud4wSltlqA9gDCBy4N29LWBC2UM=; fh=rYI8DiHAAFX3O5g969KmOAQ7d45Sb8OxQX1+DywGDk4=; b=Y/bs3QfSDTQPf/17o5Rp3OcT3WV8yStpX1yQQidcqykg0LFSshnak6uw63+MQ9xH5p p6QqY6ZS1Ffv/yxoDeijDgK5Fawl9ip5Z7b4Oxpzc83aFyLIHVPc8D6TqSZQcLrFjsR0 Gxuzv6TcJlgLgA/2X/XMP49xT2vGa/rLuGSPVDG999yw1goCfD5id+AZrppxY5IM6e6O r9GtlI5QSzDP6BKIB03zctizRghdEZNHh0ZmCTwI8M2YR6p/xaikMY2Fk6zPXK1kwz3h JGTAlCApzkgKVepDUelQ8zkw2w9BsR9a7BwQwjbMIMeaYfNovOtrkXzukQwN/GLWshSE MugQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=gb8OB9vd; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as 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 u9-20020a05600c19c900b00405407aa08dsi816298wmq.0.2023.10.25.17.21.34 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 25 Oct 2023 17:21: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=gb8OB9vd; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as 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 1qvo2w-0007Ho-Je; Wed, 25 Oct 2023 20:16:22 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qvo2p-000743-P0 for qemu-devel@nongnu.org; Wed, 25 Oct 2023 20:16:15 -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 1qvo2i-0004sS-Lg for qemu-devel@nongnu.org; Wed, 25 Oct 2023 20:16:15 -0400 Received: by mail-pl1-x634.google.com with SMTP id d9443c01a7336-1c9c5a1b87bso2037525ad.3 for ; Wed, 25 Oct 2023 17:16:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1698279366; x=1698884166; 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=CKN37OBBkB+L9M8Uud4wSltlqA9gDCBy4N29LWBC2UM=; b=gb8OB9vd+OqAgyJ52POzt2CgjmEixh99F2rpkWmZwzl2RCesMU5yeNslCz4aRj+TYv TMbQAYEG7Yn8PxYrcyxCgokWVRtAJBb8E3r1lLDNG3ceM/tfZgZRSfvvFWAa8wLpiMgR rPNo00voahOsKWBebfWKV6let9l/Or8kfJJOaXwuygIdmyd3AtKCNGIY553YZ2/l83hm fioYQNPhkjaNyH7E1BulAObj0VZVCTXua0guX+zCZFJLoFMDzSC+fExM6yfYmJBBqiYc G+oPHmWMWe0O9DKLod+zA2l1NGsKNpZW6Bur25Q2FvHcUDY4jK3RamhZXSEhxfI9jDew 22mQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1698279366; x=1698884166; 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=CKN37OBBkB+L9M8Uud4wSltlqA9gDCBy4N29LWBC2UM=; b=mfdwOcoghu8ApA5qRjnBPYTFaJezLSWjThBVvtLycwgfnHXlVpRcPHBUybGPAgjt7y E3tphL1fEFnIsd3pn4+Z5HejzRKWIjh9r3d+ITSjASXTOyD1RTHk1v3xh00yO/Ne3t5l HvZg1C1LiKSjpp3p30OmeY5dVJ8eVsptloqzyvmgPmQ3H1BZpnbW8J+w4lXBBDMPeAhf PTQJGfmy3x8epHRz4dM03vZ5zLQ5yyQL/QZLk1CfV0LO58Px6ut8Ku/bYWTJ840yzMax 83VshH810nV64W8APQjecmgACXp1WP1h6d2VO5DtRYq3KjEwipBzdTbxyw6ldpm2FFi+ 6U9w== X-Gm-Message-State: AOJu0YwpI+nFYUvyOGtpM8Ki8LddflZ34+HHKdKWrVEZr0AVuLtKd1+5 nN2YKrwORaszIVqfCl/43SwWqqopp6EPBOwlwX8= X-Received: by 2002:a17:902:eccb:b0:1c9:ba18:785c with SMTP id a11-20020a170902eccb00b001c9ba18785cmr17910028plh.25.1698279366306; Wed, 25 Oct 2023 17:16:06 -0700 (PDT) Received: from stoup.. ([71.212.149.95]) by smtp.gmail.com with ESMTPSA id ij23-20020a170902ab5700b001c582de968dsm10038433plb.72.2023.10.25.17.16.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 25 Oct 2023 17:16:05 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: Mark Cave-Ayland Subject: [PULL 14/94] target/sparc: Move BPr to decodetree Date: Wed, 25 Oct 2023 17:14:06 -0700 Message-Id: <20231026001542.1141412-28-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231026001542.1141412-1-richard.henderson@linaro.org> References: <20231026001542.1141412-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::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 Tested-by: Mark Cave-Ayland Acked-by: Mark Cave-Ayland 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 Thu Oct 26 00:14: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: 738240 Delivered-To: patch@linaro.org Received: by 2002:adf:f842:0:b0:32d:baff:b0ca with SMTP id d2csp556175wrq; Wed, 25 Oct 2023 17:29:34 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGEcfMTnqKkbP7jDkyh06E6KQDf5GR+S5tINhdRdsw5WTCBZGzsb3NpzuEDp9VSUQNApSHi X-Received: by 2002:a05:6512:6c4:b0:507:99d6:95fc with SMTP id u4-20020a05651206c400b0050799d695fcmr16744250lff.45.1698280173888; Wed, 25 Oct 2023 17:29:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698280173; cv=none; d=google.com; s=arc-20160816; b=KUPntFS1HHTDHid6CO8ZJLR31KM4lrU/imeQypezq32i+/AWvHCTunab6OV5PjqzB7 J5mCxAXS6lJAup+URRXIEKY5lmR+DeG1Xcwnun7BLwn42BMfmxOLmXCBygbz6ZHt68V0 cN8RvVRIDjys7X/QiTrqKdI8YGVFru0xHzjUsHgVjH9BrtfXlXAsXy8RK2j0/DtIoz6x DjL3cBKj1ABow6kvwEEBff0Qb1GNsHqbnhOupDi1yTho3PVDd/ZVtKkWxCTSXSP1kDjY Ymv351oA/9cqNd8W0SC6aW1OQyRlF6AdWftYyKYWjJDtEmfvwd7zKrajEkCLbT8v02TM 9dMw== 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:to:from :dkim-signature; bh=rVEq4DsEieVQejMYJAckiF1y6NMA1Ry2WtOvV/eWoA0=; fh=PnYt+qEB9tAfMKoqBm2xjKOFpYyFFGPudh5cVIoieJM=; b=gFpAOTx4VICmz9MSidA8mE6Mk3ualzeF28STgSIA1OMfN8eXYbWbLhZkYTa+OD0ped rWnecIsFx2vCbprserFsHk9vh/Tzm+XzZE5ccos2g0/GJImVz8WesPFS+bCjyvAcPHSQ bBlafBnf45p7m6WlNM2H/vdcsMVnmdWsNCoOxdgO8JNO7RMtf+3KB8EfGEEPOE3bbgsM wzyH8LJYu9AP335u3iVVQDUa4j2xt4iXVDV2qbtuUjUPdYvqusUzA3mQ4rK983LdJ+MX +yAdpVBRgYcWonu5xqdVA2X2vTCHIHiT90WuCXL+fswlDYWQxpRJKE4gR5tfNZa+NsD1 0DtQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=VauoG9ks; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as 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 cz18-20020a0564021cb200b00533219c580asi5663615edb.95.2023.10.25.17.29.33 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 25 Oct 2023 17:29:33 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=VauoG9ks; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as 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 1qvo2y-0007Ks-4m; Wed, 25 Oct 2023 20:16: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 1qvo2r-000773-UL for qemu-devel@nongnu.org; Wed, 25 Oct 2023 20:16:17 -0400 Received: from mail-pl1-x62a.google.com ([2607:f8b0:4864:20::62a]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qvo2k-0004tC-JI for qemu-devel@nongnu.org; Wed, 25 Oct 2023 20:16:17 -0400 Received: by mail-pl1-x62a.google.com with SMTP id d9443c01a7336-1cc04494653so2165505ad.2 for ; Wed, 25 Oct 2023 17:16:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1698279368; x=1698884168; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=rVEq4DsEieVQejMYJAckiF1y6NMA1Ry2WtOvV/eWoA0=; b=VauoG9ksV41UCMumbIebMMTS1iP6WUnHCYRa+LFJ0Mlw4rdeswa2+R6nVePXnOC6TC /i1KLtKikfZvdal+TrswSgK5+TXIy1gZmECCWhrYUuC1WtezHvjLNEMKcnazTHJkaqIo NXouVhbnDWkoUJiv4GFyhwd1qPwBIYfja1fJSVUt/ozM0FndGAh/HJO2PPCnORBxh4R2 qddwNqXjJUPgxT4w3IzjdmuT8Su71E9hPlf6DDPPYGLR4e+GtP+aSKq3OmM4o08HocfP OvK0upql9/nhRYwswawLxkcfpZ/jo5cChjoFzAcoUGPEWgZgnG108z2Z2obu2+gxdo1C okng== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1698279368; x=1698884168; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=rVEq4DsEieVQejMYJAckiF1y6NMA1Ry2WtOvV/eWoA0=; b=qUYldmdW9tQ/ROLYn+ka6349kJR6Uop0cCJryNhdZeO7H5n1CitfCctzCrZ4VrXrsD MVjjj2nnElUWwEGp6EEmUGBrGR44+i+yzlFr/uTLgMr8hllNrwgMUymCKEOhaEuwBgXS elPbC0QXQOjVbNJ/1lVU//E0VZpivzf0pAHoHWrB+/pJ/bhm6nWNCQcxAlzY8Va75Wlp cwRbiaSQ9rXh877AnVWxdAqrw27htfGLi/NxbAol0jnJc9rD9jNAeZkyQGSvTxwp4dPj kG+MNUMDNw98P742Eoox0H1nLAW7CKnyTRiDZxnYY82zvy/RJwuCIsjERBwgiq9xINDp ylUw== X-Gm-Message-State: AOJu0YwD23VsOhLe9JZvfdyTD3DarfPR/Yhf1svHIBkcR4mXbrweRElE wk6OKzRGCa/DQqSHDhbMnr7cIAjW2rvqWR3OLOo= X-Received: by 2002:a17:902:d904:b0:1c0:d7a9:1c48 with SMTP id c4-20020a170902d90400b001c0d7a91c48mr12285786plz.49.1698279368634; Wed, 25 Oct 2023 17:16:08 -0700 (PDT) Received: from stoup.. ([71.212.149.95]) by smtp.gmail.com with ESMTPSA id ij23-20020a170902ab5700b001c582de968dsm10038433plb.72.2023.10.25.17.16.08 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 25 Oct 2023 17:16:08 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH 15/29] tcg/mips: Support TCG_COND_TST{EQ,NE} Date: Wed, 25 Oct 2023 17:14:09 -0700 Message-Id: <20231026001542.1141412-31-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231026001542.1141412-1-richard.henderson@linaro.org> References: <20231026001542.1141412-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::62a; envelope-from=richard.henderson@linaro.org; helo=mail-pl1-x62a.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 --- tcg/mips/tcg-target.c.inc | 41 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) diff --git a/tcg/mips/tcg-target.c.inc b/tcg/mips/tcg-target.c.inc index 328984ccff..739a0f60b7 100644 --- a/tcg/mips/tcg-target.c.inc +++ b/tcg/mips/tcg-target.c.inc @@ -909,6 +909,16 @@ static void tcg_out_setcond(TCGContext *s, TCGCond cond, TCGReg ret, tcg_out_opc_reg(s, OPC_SLTU, ret, TCG_REG_ZERO, arg1); break; + case TCG_COND_TSTEQ: + tcg_out_opc_reg(s, OPC_AND, ret, arg1, arg2); + tcg_out_opc_imm(s, OPC_SLTIU, ret, ret, 1); + break; + + case TCG_COND_TSTNE: + tcg_out_opc_reg(s, OPC_AND, ret, arg1, arg2); + tcg_out_opc_reg(s, OPC_SLTU, ret, TCG_REG_ZERO, ret); + break; + case TCG_COND_LT: case TCG_COND_GE: case TCG_COND_LE: @@ -989,6 +999,14 @@ static void tcg_out_brcond(TCGContext *s, TCGCond cond, TCGReg arg1, arg2 = TCG_REG_ZERO; break; + case TCG_COND_TSTEQ: + case TCG_COND_TSTNE: + tcg_out_opc_reg(s, OPC_AND, TCG_TMP0, arg1, arg2); + arg1 = TCG_TMP0; + arg2 = TCG_REG_ZERO; + b_opc = cond == TCG_COND_TSTEQ ? OPC_BEQ : OPC_BNE; + break; + default: g_assert_not_reached(); break; @@ -1052,6 +1070,14 @@ static void tcg_out_setcond2(TCGContext *s, TCGCond cond, TCGReg ret, tcg_out_setcond(s, cond, ret, tmp1, TCG_REG_ZERO); break; + case TCG_COND_TSTEQ: + case TCG_COND_TSTNE: + tcg_out_opc_reg(s, OPC_AND, TCG_TMP0, al, bl); + tcg_out_opc_reg(s, OPC_AND, TCG_TMP1, ah, bh); + tcg_out_opc_reg(s, OPC_OR, ret, TCG_TMP0, TCG_TMP1); + tcg_out_setcond(s, tcg_eqne_cond(cond), ret, tmp1, TCG_REG_ZERO); + break; + default: tcg_out_setcond(s, TCG_COND_EQ, tmp0, ah, bh); tcg_out_setcond(s, tcg_unsigned_cond(cond), tmp1, al, bl); @@ -1078,6 +1104,13 @@ static void tcg_out_brcond2(TCGContext *s, TCGCond cond, TCGReg al, TCGReg ah, tmp = tcg_out_reduce_eq2(s, TCG_TMP0, TCG_TMP1, al, ah, bl, bh); break; + case TCG_COND_TSTEQ: + case TCG_COND_TSTNE: + tcg_out_opc_reg(s, OPC_AND, TCG_TMP0, al, bl); + tcg_out_opc_reg(s, OPC_AND, TCG_TMP1, ah, bh); + tcg_out_opc_reg(s, OPC_OR, TCG_TMP1, TCG_TMP1, TCG_TMP0); + break; + default: /* Minimize code size by preferring a compare not requiring INV. */ if (mips_cmp_map[cond] & MIPS_CMP_INV) { @@ -1114,6 +1147,14 @@ static void tcg_out_movcond(TCGContext *s, TCGCond cond, TCGReg ret, } break; + case TCG_COND_TSTEQ: + eqz = true; + /* FALLTHRU */ + case TCG_COND_TSTNE: + tcg_out_opc_reg(s, OPC_AND, TCG_TMP0, c1, c2); + c1 = TCG_TMP0; + break; + default: /* Minimize code size by preferring a compare not requiring INV. */ if (mips_cmp_map[cond] & MIPS_CMP_INV) { From patchwork Thu Oct 26 00:14: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: 738182 Delivered-To: patch@linaro.org Received: by 2002:adf:f842:0:b0:32d:baff:b0ca with SMTP id d2csp552072wrq; Wed, 25 Oct 2023 17:17:20 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGBl2SYcDu+v+Boap4AwbwrRW5+sCLDoIfDDqVosLMxxpCfOPUbHSyH62YHWx/bvXqYstK5 X-Received: by 2002:adf:face:0:b0:32d:9a20:c9e0 with SMTP id a14-20020adfface000000b0032d9a20c9e0mr11516103wrs.61.1698279440563; Wed, 25 Oct 2023 17:17:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698279440; cv=none; d=google.com; s=arc-20160816; b=rI55PNAC9dP1IBYqq1w1jzF/l2MzM/7eRcxk6ACsI7nDbA23rZlF+6lboo5DBn7VRh c6i5YQFP6RRBVVgJ0WdygijJ+OXqJAlNvIAdAnrxoARavssn66P0M5knwqXARvMHrmZR Ha3NSshtAZebQHJ0IFWht5FeJ2JZm06mtwVw+AkiP1fE6kPGy7eTWvuM717cVBoCOyuU g/zCFzl7Cm44PBZ6s91kLCiej5YxWSBPndIkyNCeRgPZHIlAVEvMiTOSUP18i4V2D96M LzyyOaukhGvdE2v3LkwuQNV8V3WzEaKEkmT8D/yx7kmACJVpC4TDKBNQ4flSuJDpyGRa Ao7g== 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:to:from :dkim-signature; bh=Jfu2q0GKRofhI6YPhlOPKDeRs/2pMo83YmOW1OzfqTU=; fh=PnYt+qEB9tAfMKoqBm2xjKOFpYyFFGPudh5cVIoieJM=; b=twThLGNYswKQhzmIQhtvtQyZ3ijG8MlKgZ8ee/sXcPLZKfn5boFNYVaPhuU5G4RVxF F1Fp3nbuFLpDtcZsdFFcsQh7U7sYDntDVztUXGEF1esbuRM8yeyA83kXiLb3GZ2Jd4aC A/+fo+J9MZINMIgb8E+9ytxBkSMM+2jYb1GlSwymRIjPRqj+D7e92M5jSIvHMr9o5EUe XVZQlxKjpvKx1SxDzzZDlYq+xihwqquM0IbDzrVYzcUm5wZzCiM3Um+y+LUDyNxYQFAE DUSjVX4CuRPd/d1KnIv09pl6lNw71c6zyQQBGB9Acses6kDWO9sumt/gXxyrIXVfW8lR UA8g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=V8SckxP7; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as 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 z13-20020adff74d000000b0032d8b101cfcsi8160326wrp.895.2023.10.25.17.17.20 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 25 Oct 2023 17:17: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=V8SckxP7; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as 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 1qvo30-0007MQ-0N; Wed, 25 Oct 2023 20:16: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 1qvo2u-0007BQ-62 for qemu-devel@nongnu.org; Wed, 25 Oct 2023 20:16:20 -0400 Received: from mail-pl1-x635.google.com ([2607:f8b0:4864:20::635]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qvo2m-0004tQ-Ey for qemu-devel@nongnu.org; Wed, 25 Oct 2023 20:16:19 -0400 Received: by mail-pl1-x635.google.com with SMTP id d9443c01a7336-1c9c5a1b87bso2037835ad.3 for ; Wed, 25 Oct 2023 17:16:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1698279370; x=1698884170; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=Jfu2q0GKRofhI6YPhlOPKDeRs/2pMo83YmOW1OzfqTU=; b=V8SckxP7XvyqVSAJ4TIWQovghMVmTPYWGm3a8IT6QRMBlfuCk4QEIVTIKyuRvR6p8b UahVk6H+oz3dZFyzfxvzRnNxRkTRbO1ZNH4xefFLzTLsX0ifZcNv4GyiEBQcdO43HQCP Mu2L+q4DNG4/+kV+wh1FaXlY9oRMCdBDuvYBCEHCcJ5KGcua0ARZJXZHJCW7a0EGhFSp LwDwAtJc++AwWJV7uA4yN/i86Veia2UtGLVAsQlEuyhTTHFfU3vdvXxQU/0cNDCno5S3 WCiUooj+ICyrdUN1WKRHfTYR4KzMiWNKG87vBT13NkaTUeDVj6hhngmfEuOSuSIVdDGt 4BtA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1698279370; x=1698884170; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=Jfu2q0GKRofhI6YPhlOPKDeRs/2pMo83YmOW1OzfqTU=; b=ZNIPjl4hcgwYz+qzhbtZ/WUrZYfe1M/GMz349w059GSWXt+rLyx2qvbQNK4sS6aD4z Ng5Z2MM2CKOP9U4qBfks+++u5QPrzCR3zR8JALOV3wWuWWvljZtDa+0doTYoo+1S4Cgj vTruR1qffl908KyN4kpg/XBcAEFNf0UuN821DUFRFRaUP71cHb2YfKmD2rOHjrQ7UuuX 7IO5kLyKtkt+zwGBBCkkScct+hcyC3nESZV/hMa6nz5u+O7GPZZ8I415+oGOw+cWy7Eg xckp+zoy3AuUPq7eOZVT528geEVWpPr3ef9nxsls08Y8IeflpCIWHbdoxg7R3kK0TKP8 qjAQ== X-Gm-Message-State: AOJu0YzirxFs4Qq7ddbuMjSUXtfVJP1Sa/u8k16B3JZFajyPi9j1YWJS NVF/TELI/9JSh+5DUWMP9xVmrmAT3lWS12mN7gc= X-Received: by 2002:a17:902:7485:b0:1ca:7086:f009 with SMTP id h5-20020a170902748500b001ca7086f009mr12457851pll.61.1698279370159; Wed, 25 Oct 2023 17:16:10 -0700 (PDT) Received: from stoup.. ([71.212.149.95]) by smtp.gmail.com with ESMTPSA id ij23-20020a170902ab5700b001c582de968dsm10038433plb.72.2023.10.25.17.16.09 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 25 Oct 2023 17:16:09 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH 16/29] tcg/riscv: Support TCG_COND_TST{EQ,NE} Date: Wed, 25 Oct 2023 17:14:11 -0700 Message-Id: <20231026001542.1141412-33-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231026001542.1141412-1-richard.henderson@linaro.org> References: <20231026001542.1141412-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::635; envelope-from=richard.henderson@linaro.org; helo=mail-pl1-x635.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, 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 --- tcg/riscv/tcg-target.c.inc | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/tcg/riscv/tcg-target.c.inc b/tcg/riscv/tcg-target.c.inc index 34e10e77d9..3997e2f274 100644 --- a/tcg/riscv/tcg-target.c.inc +++ b/tcg/riscv/tcg-target.c.inc @@ -798,8 +798,14 @@ static const struct { static void tcg_out_brcond(TCGContext *s, TCGCond cond, TCGReg arg1, TCGReg arg2, TCGLabel *l) { - RISCVInsn op = tcg_brcond_to_riscv[cond].op; + RISCVInsn op; + if (is_tst_cond(cond)) { + tcg_out_opc_reg(s, OPC_AND, TCG_REG_TMP0, arg1, arg2); + cond = tcg_tst_eqne_cond(cond); + } + + op = tcg_brcond_to_riscv[cond].op; tcg_debug_assert(op != 0); if (tcg_brcond_to_riscv[cond].swap) { @@ -827,6 +833,7 @@ static int tcg_out_setcond_int(TCGContext *s, TCGCond cond, TCGReg ret, case TCG_COND_GEU: /* -> LTU */ case TCG_COND_GT: /* -> LE */ case TCG_COND_GTU: /* -> LEU */ + case TCG_COND_TSTEQ: /* -> TSTNE */ cond = tcg_invert_cond(cond); flags ^= SETCOND_INV; break; @@ -886,6 +893,15 @@ static int tcg_out_setcond_int(TCGContext *s, TCGCond cond, TCGReg ret, } break; + case TCG_COND_TSTNE: + flags |= SETCOND_NEZ; + if (c2) { + tcg_out_opc_imm(s, OPC_ANDI, ret, arg1, arg2); + } else { + tcg_out_opc_reg(s, OPC_AND, ret, arg1, arg2); + } + break; + case TCG_COND_LT: if (c2) { tcg_out_opc_imm(s, OPC_SLTI, ret, arg1, arg2); @@ -1079,7 +1095,7 @@ static void tcg_out_movcond(TCGContext *s, TCGCond cond, TCGReg ret, int tmpflags; TCGReg t; - if (!have_zicond && (!c_cmp2 || cmp2 == 0)) { + if (!have_zicond && (!c_cmp2 || cmp2 == 0) && !is_tst_cond(cond)) { tcg_out_movcond_br2(s, cond, ret, cmp1, cmp2, val1, c_val1, val2, c_val2); return; From patchwork Thu Oct 26 00:14:12 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 738194 Delivered-To: patch@linaro.org Received: by 2002:adf:f842:0:b0:32d:baff:b0ca with SMTP id d2csp552634wrq; Wed, 25 Oct 2023 17:18:49 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEvyxmAZF5OJ9nGAsyu747D0h2JclzcT0/v1rzebEdI3kITMJ8rarHxUGwOeeE+aNEbtzlx X-Received: by 2002:a05:6000:79d:b0:32d:a688:8813 with SMTP id bu29-20020a056000079d00b0032da6888813mr17198050wrb.32.1698279528788; Wed, 25 Oct 2023 17:18:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698279528; cv=none; d=google.com; s=arc-20160816; b=O9zZ2h5w0yrqZ0EvJm4JW5K/EpwxyvJoCmjUY27gdGDltqkm+hD5gGjsuQl+SEYNgY pmHq+svUcKsFjz/IK1ml/3CU9tFIwEOnWm+kPwqx8ID8ojM/33a70Y6iojTLpoeTKFeK wJFp5YWR+bCxULwEDczQUEGZrNhe9TxW85582FyueLYYE0M2mjXmk81Jd7fM1FxgaLAN cUduQ4EY7T9cY/6/gfTVEtO6732qXfi6l57SFzzshY9COVQJ3VIkK217TNO2Pydpksbi x8z9OIyFm+Ie5ur5j+BAjpUfP7zRDt8OcAN6l86s6591VW2/k4axbA0iYzlK6ECepkGk fhsg== 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=aIOAJWBVtCMbS0c4KC6cXcYTMMaXIG2tg2FWJOn2ue8=; fh=J4M4Z4TZxvAT8lkmK1LtxqMjpO7Qiod4IMBL2bk0hxA=; b=fcul6CftLOy1FkBRJkSsYdJlAmB9LRxEM0NNgAVUC61bnJM3wAQRx6SJAZMwEYTTxD WqJKTnT8lp26jFXTmLAwL7j3NHCdV/ujO4fQ0S/6JB0utHSj6bbv9agHdJ+QcQ0/XO8S xUzaS8uwahKmQ83TYVpM9agYKhTm3r+ZAKBVRVHW/2Lugo5xOnCaRYJTVXBh1+8MQLwd wCuZy9s06YmNB3JlaDBlgZ2u2Ieg95nydAxMXspXpgydxP6Kq9J34y5xG9uSSWVQEYG0 KeYTb0nB4HiumMW7WVJL0GzXsm0gc4cy2AtE4blH51URGNPRU/xrJKcqhbif3SIo1QLq 72HA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=pDmdxugL; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id x12-20020a5d60cc000000b0032487266814si8239224wrt.290.2023.10.25.17.18.48 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 25 Oct 2023 17:18: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=pDmdxugL; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as 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 1qvo3B-0007Pl-Bm; Wed, 25 Oct 2023 20:16:37 -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 1qvo2r-00076i-Hk for qemu-devel@nongnu.org; Wed, 25 Oct 2023 20:16:17 -0400 Received: from mail-pl1-x636.google.com ([2607:f8b0:4864:20::636]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qvo2m-0004tl-Fr for qemu-devel@nongnu.org; Wed, 25 Oct 2023 20:16:17 -0400 Received: by mail-pl1-x636.google.com with SMTP id d9443c01a7336-1c77449a6daso2337045ad.0 for ; Wed, 25 Oct 2023 17:16:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1698279371; x=1698884171; 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=aIOAJWBVtCMbS0c4KC6cXcYTMMaXIG2tg2FWJOn2ue8=; b=pDmdxugLk2t8vZtSZ1t7551RxFxwfyDfhcxkGhsDokxhqbldzYp2nJcIVgeQ7xrTfH +ws5q0IiFVHsgX9OLJ8IFaKUxARrROwngf9nN8htr2qNldicXYpFkts04nak6kqJBfKy Tndp4ITroNWcrsCITpsKCmQkT50hTQ5at3UO8q6KazAc8qoB8HHDy4zmAlW0CbYepMlO S1JHuiS4QJaE3jGjLRPo9AnoELFS2HKroAESx6KK7yEyfYKYHi1QYCdCWzGhg5AchGTv yD3LqUhyRzhEZG6jhZwldmo9091S0+OtktzXp8Mm9jwTG2UwLxZFL+JD11izlROtwtv0 XAGg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1698279371; x=1698884171; 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=aIOAJWBVtCMbS0c4KC6cXcYTMMaXIG2tg2FWJOn2ue8=; b=QClyZ5FOCUA9aSS/8H1xaJezTqvFcSkYZVK2CpnleBNICKdhAl5JEmDH+Uot7YbXI5 luC2awymdztKGceE5SUlwJhaRh9fn1YyalQ3aHsYnrTIbkvkZerl/hXvhcTxKIkwqRjn 0VdRX2tSHXF99NzuKrdqgrpO4dNlVBsk246s9OGDXvjXHRKrJ8Io1TriySwLqefKT0w3 ZON/+uGaIvjsaQwgT3U45bdc2KC26bWYSCsL/JyV72OZYc02FHOIfwiXQyNbbmyWagzi YbCgTWPA2m9334z/dwINHN4ZxABcsbebWDw9BDfZ7ZHNs74PTBE4gOx3mccHXpcBgdA5 SirA== X-Gm-Message-State: AOJu0YxP7AqVoVxHlzdZjOwwlM+yBr8hU0uqRdmeNAMa4iMZVgUYxqlb Sdk5wIwul70csAwZr9//hecLVb5gjnT8o3QcG2o= X-Received: by 2002:a17:902:db12:b0:1c2:218c:3754 with SMTP id m18-20020a170902db1200b001c2218c3754mr20237530plx.53.1698279370892; Wed, 25 Oct 2023 17:16:10 -0700 (PDT) Received: from stoup.. ([71.212.149.95]) by smtp.gmail.com with ESMTPSA id ij23-20020a170902ab5700b001c582de968dsm10038433plb.72.2023.10.25.17.16.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 25 Oct 2023 17:16:10 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: Mark Cave-Ayland , =?utf-8?q?Philippe_Mat?= =?utf-8?q?hieu-Daud=C3=A9?= Subject: [PULL 17/94] target/sparc: Merge gen_fcond with only caller Date: Wed, 25 Oct 2023 17:14:12 -0700 Message-Id: <20231026001542.1141412-34-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231026001542.1141412-1-richard.henderson@linaro.org> References: <20231026001542.1141412-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::636; envelope-from=richard.henderson@linaro.org; helo=mail-pl1-x636.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org Tested-by: Mark Cave-Ayland Acked-by: Mark Cave-Ayland 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 Thu Oct 26 00:14: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: 738197 Delivered-To: patch@linaro.org Received: by 2002:adf:f842:0:b0:32d:baff:b0ca with SMTP id d2csp553035wrq; Wed, 25 Oct 2023 17:20:06 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFRmnflcCZ/JoeO876K/ZlvJUeIABfa4aEe0P7N7Dphe6D1lQdaw7/FLHjqw1uW//wd3QYv X-Received: by 2002:a5d:6e89:0:b0:320:6d6:315b with SMTP id k9-20020a5d6e89000000b0032006d6315bmr922696wrz.29.1698279606135; Wed, 25 Oct 2023 17:20:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698279606; cv=none; d=google.com; s=arc-20160816; b=dYiHdxUKuzaHnUiwEEZFCdjLOUN6XjM60RQ3bXh/TaQ1W41Uf+E1O8ncYTCr0Zffhr 5GswFnx0AYrv4cEnWz0K0fEQm+wWAQaI9WVh3IowqrBdVE3HH3lQxr+7BIvAWqT6C+yJ ulM8e/KwoctGATgNpRoF3/qj3GnekOLzhuT9jz8CYckN21ECjGrIniU8qBowvI72oJv9 C1TAqCQ6lBoG8Xnqlo9yTsj4kYXvNkcoArHLXKpBNyFcemca7bXx8gOGpK9mmzUf5z9a u0zd5iAv03oPNkRGiZh8so7UkM9xlVEn9BCAleI3nQTafLoDwb184Cxe4Wdls7InYKow PuqA== 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:to:from :dkim-signature; bh=oTWlSTl88NPrS8w791ePjYqEfGwAj5/VqVJUyjszQKA=; fh=PnYt+qEB9tAfMKoqBm2xjKOFpYyFFGPudh5cVIoieJM=; b=hNwIP/hyP5BHQJD8IOaKXGU+dXPHxjYgZwjVR5vtJhfhrg1+xcetrZ0TlPCHBe5iVj 7FLU9yU5XmieCXOZX+4n7H5z3FCQRENS1FFjOSui4eZT23lcZ52lHlRneyfGqTMMgY3+ hdxeXXVCqcsMq63IqobRiCWXspwx8wzkaslbfCrHLi6vc7IC8KyN4FMnPnVpu1mi3ig8 83iXuE9DWMadMETqkmFkJUTCuNuNNDz48KntHdPLyFvTZwtgNW78wIHJX+wEtEPtJCcq /sFVOJnLIjktIQabPUAX3NFeTqLL4iSfaxOjukF9F1IGunL/VwdGA8AkBwWS0tMRUUjc 3SXw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=EWk9T0gd; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as 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 v5-20020a5d4a45000000b0032d829884b0si8088866wrs.816.2023.10.25.17.20.06 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 25 Oct 2023 17:20: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=EWk9T0gd; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qvo2z-0007Lh-6N; Wed, 25 Oct 2023 20:16:25 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qvo2t-0007Al-Lr for qemu-devel@nongnu.org; Wed, 25 Oct 2023 20:16:19 -0400 Received: from mail-pl1-x62d.google.com ([2607:f8b0:4864:20::62d]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qvo2o-0004uv-PH for qemu-devel@nongnu.org; Wed, 25 Oct 2023 20:16:19 -0400 Received: by mail-pl1-x62d.google.com with SMTP id d9443c01a7336-1c9e06f058bso11212075ad.0 for ; Wed, 25 Oct 2023 17:16:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1698279373; x=1698884173; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=oTWlSTl88NPrS8w791ePjYqEfGwAj5/VqVJUyjszQKA=; b=EWk9T0gdTUqHOAI1YUGzB//B7h1vwRf9sncQVQmFkOX4mt0MaFz8T1Cko/8tigV6eZ XI1yGbL2eZc4r2fDW5ohTcqea9OSEtufHyPUMHClEdDLlSEzboC+41tdMiijConmDj7e EJYAT3OloaQZou/WHC+zp8TG6loMCV2BvtHN5GSrrXZsFCjBBXsgU03o26BZBvrHYX4y tITUen4oSnNHCMaC6Sa9uCfzu4iYZdd1zoP+tX2Y/TFMDkbmp5o9Zxd8Q2wm0LlS6zG/ amOeSjwvIOH4iiDM2urltC6DuyBDqAAKMpTmb/6VY+7ZnnDOoKC5eUajqROtz3jsd7WS k43A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1698279373; x=1698884173; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=oTWlSTl88NPrS8w791ePjYqEfGwAj5/VqVJUyjszQKA=; b=Yg64Sx4vrqb+a7nkQWlPAxDunRf7xBHG1S+TQthdBZaQizM96lrbIbAjBoAzZ31z3C sbh738Pm81l1wHowfLu0L7HPmQvQO1RwVpEsIcUgbP38va1Ym+x+GOOSIHIBLZ6CZRRI 9WvjlCILxmkg5N40Hm1jdq1ZLziSL7fIOEhBb4sA4LMbsjVMTFICzJ2EzS9sBWlk9nul 0ZAHqUb0dWrytM2kwJGKKmeme8IeRSL+FV1YL6g/9CIlRFmp0AekfP+T52ZCRGRGbM6O trUs7/ne/r4N8LERm4/AqMPko0Xy+6oxahfANpU7fM+6Ar16bqHv3dVJo7u0Mn8cvVub QUsw== X-Gm-Message-State: AOJu0YzQrFM9Dp2jMPMlOk29iWxjPZJ7kLoB8K6aEcmGxh/aqo0m2chz WsgMbZHmfm/2KROOBp3GYijwnN7vC7PrlG6eJLU= X-Received: by 2002:a17:902:f54f:b0:1ca:15ad:1c5 with SMTP id h15-20020a170902f54f00b001ca15ad01c5mr1342866plf.6.1698279373538; Wed, 25 Oct 2023 17:16:13 -0700 (PDT) Received: from stoup.. ([71.212.149.95]) by smtp.gmail.com with ESMTPSA id ij23-20020a170902ab5700b001c582de968dsm10038433plb.72.2023.10.25.17.16.12 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 25 Oct 2023 17:16:13 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH 18/29] tcg/sparc64: Hoist read of tcg_cond_to_rcond Date: Wed, 25 Oct 2023 17:14:15 -0700 Message-Id: <20231026001542.1141412-37-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231026001542.1141412-1-richard.henderson@linaro.org> References: <20231026001542.1141412-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::62d; envelope-from=richard.henderson@linaro.org; helo=mail-pl1-x62d.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 a non-zero value here (an illegal encoding) as a better condition than is_unsigned_cond for when MOVR/BPR is usable. Signed-off-by: Richard Henderson --- tcg/sparc64/tcg-target.c.inc | 25 ++++++++++++++----------- 1 file changed, 14 insertions(+), 11 deletions(-) diff --git a/tcg/sparc64/tcg-target.c.inc b/tcg/sparc64/tcg-target.c.inc index a91defd0ac..13ad92b9b6 100644 --- a/tcg/sparc64/tcg-target.c.inc +++ b/tcg/sparc64/tcg-target.c.inc @@ -619,7 +619,7 @@ static const uint8_t tcg_cond_to_bcond[] = { [TCG_COND_GTU] = COND_GU, }; -static const uint8_t tcg_cond_to_rcond[] = { +static const uint8_t tcg_cond_to_rcond[16] = { [TCG_COND_EQ] = RCOND_Z, [TCG_COND_NE] = RCOND_NZ, [TCG_COND_LT] = RCOND_LZ, @@ -678,7 +678,8 @@ static void tcg_out_brcond_i64(TCGContext *s, TCGCond cond, TCGReg arg1, int32_t arg2, int const_arg2, TCGLabel *l) { /* For 64-bit signed comparisons vs zero, we can avoid the compare. */ - if (arg2 == 0 && !is_unsigned_cond(cond)) { + int rcond = tcg_cond_to_rcond[cond]; + if (arg2 == 0 && rcond) { int off16 = 0; if (l->has_value) { @@ -687,7 +688,7 @@ static void tcg_out_brcond_i64(TCGContext *s, TCGCond cond, TCGReg arg1, tcg_out_reloc(s, s->code_ptr, R_SPARC_WDISP16, l, 0); } tcg_out32(s, INSN_OP(0) | INSN_OP2(3) | BPR_PT | INSN_RS1(arg1) - | INSN_COND(tcg_cond_to_rcond[cond]) | off16); + | INSN_COND(rcond) | off16); } else { tcg_out_cmp(s, arg1, arg2, const_arg2); tcg_out_bpcc(s, tcg_cond_to_bcond[cond], BPCC_XCC | BPCC_PT, l); @@ -695,11 +696,10 @@ static void tcg_out_brcond_i64(TCGContext *s, TCGCond cond, TCGReg arg1, tcg_out_nop(s); } -static void tcg_out_movr(TCGContext *s, TCGCond cond, TCGReg ret, TCGReg c1, +static void tcg_out_movr(TCGContext *s, int rcond, TCGReg ret, TCGReg c1, int32_t v1, int v1const) { - tcg_out32(s, ARITH_MOVR | INSN_RD(ret) | INSN_RS1(c1) - | (tcg_cond_to_rcond[cond] << 10) + tcg_out32(s, ARITH_MOVR | INSN_RD(ret) | INSN_RS1(c1) | (rcond << 10) | (v1const ? INSN_IMM10(v1) : INSN_RS2(v1))); } @@ -710,9 +710,9 @@ static void tcg_out_movcond_i64(TCGContext *s, TCGCond cond, TCGReg ret, /* For 64-bit signed comparisons vs zero, we can avoid the compare. Note that the immediate range is one bit smaller, so we must check for that as well. */ - if (c2 == 0 && !is_unsigned_cond(cond) - && (!v1const || check_fit_i32(v1, 10))) { - tcg_out_movr(s, cond, ret, c1, v1, v1const); + int rcond = tcg_cond_to_rcond[cond]; + if (c2 == 0 && rcond && (!v1const || check_fit_i32(v1, 10))) { + tcg_out_movr(s, rcond, ret, c1, v1, v1const); } else { tcg_out_cmp(s, c1, c2, c2const); tcg_out_movcc(s, cond, MOVCC_XCC, ret, v1, v1const); @@ -787,6 +787,8 @@ static void tcg_out_setcond_i32(TCGContext *s, TCGCond cond, TCGReg ret, static void tcg_out_setcond_i64(TCGContext *s, TCGCond cond, TCGReg ret, TCGReg c1, int32_t c2, int c2const, bool neg) { + int rcond; + if (use_vis3_instructions && !neg) { switch (cond) { case TCG_COND_NE: @@ -806,9 +808,10 @@ static void tcg_out_setcond_i64(TCGContext *s, TCGCond cond, TCGReg ret, /* For 64-bit signed comparisons vs zero, we can avoid the compare if the input does not overlap the output. */ - if (c2 == 0 && !is_unsigned_cond(cond) && c1 != ret) { + rcond = tcg_cond_to_rcond[cond]; + if (c2 == 0 && rcond && c1 != ret) { tcg_out_movi_s13(s, ret, 0); - tcg_out_movr(s, cond, ret, c1, neg ? -1 : 1, 1); + tcg_out_movr(s, rcond, ret, c1, neg ? -1 : 1, 1); } else { tcg_out_cmp(s, c1, c2, c2const); tcg_out_movi_s13(s, ret, 0); From patchwork Thu Oct 26 00:14: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: 738200 Delivered-To: patch@linaro.org Received: by 2002:adf:f842:0:b0:32d:baff:b0ca with SMTP id d2csp553565wrq; Wed, 25 Oct 2023 17:21:36 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGDM/lkPH/3JJ6RguJ9KttuCEWegbIZrEwCR/yvgT+LcMTwspg9VeRkZJ6gspFJGNOpV/wo X-Received: by 2002:a5d:58ee:0:b0:32d:9850:9e01 with SMTP id f14-20020a5d58ee000000b0032d98509e01mr12262792wrd.61.1698279696391; Wed, 25 Oct 2023 17:21:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698279696; cv=none; d=google.com; s=arc-20160816; b=vf4VkBSaU429b6lCQear4gmG2UhioS2nmZuqDssNskJjOxaH/lAfSK32ljroYBVxhd zSHLD9GWrzN53FSEoUERsF6Hmuq+VQ0BDfxT2jpqccDcm1h0/RSLkDO+CXKygmG8xZwo PenJT56/5RfvggT1AE52t7L44XciIAgjcq6aDOXtuAhaLf9q7ZAW+aSZVAGR0LAyTFIu OJ9L5SpgWtrI+zWDQz8KPYETVlxFeOpM7aCFfJf7Rg6AcSHU4I0IvyWQlFY/amo5PiSE hua4u+TZvRkrRCk7vYFLa42IJz9QuI8TzfFGYylIChcF6dU1dC4JKVsBRQlVczkGIkRy Bomg== 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:to:from :dkim-signature; bh=yWPKPMahOrl8l7/yORUc/X3LHhh1SjBoxvyFki6O+l8=; fh=PnYt+qEB9tAfMKoqBm2xjKOFpYyFFGPudh5cVIoieJM=; b=sZsBMhsnuWt69fxnCZU4l0Y6lDEif0tdYS+b0yrF2lsowikPA0OHwPQKsWz8UmfyUD zXmNXgHZxurRD19dRM3gniyvaGykdnZkO8bcHXSzlLTUOEcuG0UoZWx1N3Z1nSaLdCzF ZQtl15RIk7XdbYQib4q8yhew9wBxfD5o15y1CmtbWd9Y/PglpfRzKzj8BBrRyxBRJIgB AcldJwYt9Yv7e07sFSUVRSCe9TIxEOCxry7KchWlU4HwS4q6oF9mlHqx5MmzFcpGUBPi Uzf7K4UqXFo0ulYWDg7bF0c1xuvWnlR0CHYLovwvj5B5y5IRITdyKCmWTyWUi0jJ4Y+Z wooA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=rp5scrnv; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as 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 e5-20020a056000120500b003217d807846si8726631wrx.345.2023.10.25.17.21.36 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 25 Oct 2023 17:21:36 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=rp5scrnv; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as 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 1qvo2v-0007Gl-W4; Wed, 25 Oct 2023 20:16:22 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qvo2u-0007BY-5s for qemu-devel@nongnu.org; Wed, 25 Oct 2023 20:16:20 -0400 Received: from mail-pl1-x636.google.com ([2607:f8b0:4864:20::636]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qvo2q-0004vd-JS for qemu-devel@nongnu.org; Wed, 25 Oct 2023 20:16:19 -0400 Received: by mail-pl1-x636.google.com with SMTP id d9443c01a7336-1c9a1762b43so2237045ad.1 for ; Wed, 25 Oct 2023 17:16:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1698279375; x=1698884175; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=yWPKPMahOrl8l7/yORUc/X3LHhh1SjBoxvyFki6O+l8=; b=rp5scrnva0wnBpfE54E7mnovJYkQtj5TUhcE/c62IUeD5r8kRAXuX6/jTpwPnHzUQ1 /j52ckagLJLqXkSQv2T2qQAFFXSRvD8HS9XVUBJOarhmBJ6UdQ6heb9GIsz4jkdUs1di kEjuqEXGqhjFv3arOrmdTimPQYGZykEk1TPvkMvWIRLz1M+7sTnJutAm2fzKuOQ/6vaK QxzF2MGxttj4XhaLrqz52Ea238ZvGVZnB7SyvsYcRKZzUZC86lEs/bY+EpFGH+/00WGx UjeAtm1QJ9/lW/gJvode++uF2eDVb81mfinsIXnQ+tKSB4jggCnSqa7s/60fNr9PCvn1 xlJg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1698279375; x=1698884175; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=yWPKPMahOrl8l7/yORUc/X3LHhh1SjBoxvyFki6O+l8=; b=JmUt1RIJVOS5p9NfqB2/6OTA7Snq26Ek0LRHL4IDqwlqwD7ZAo1SLqLgVRRrhI08As SRG9ksJzPUMHcDfzNJyDuqjzyo5ZPenqn1WHR1iUnkluAVT+q4xb7Fs7/RJpQvYAoPc4 VZJWaJW0nR1Q4nPKdYWlQ29VGpWle6jH4lFEDMZ8yL/F6AJ9u/eJBjJNMzFi3m2+Tuzg yzM/ZIAhO8Ow/aHc2saVWj251VknpYzkh2zZHRYK2B0R869u++4V92X+edxFHQi/bljU lDBY6Q21vh8m65TO4+lDJq1uzTSHg25CqwwP/yi9V7vBr9+wZoafVt4XhyGHkaZeT4fM eLog== X-Gm-Message-State: AOJu0YxNQzdwJ8LL4DGCXfytaJjkBHTtIiHeAOZC6H59A3+6T/7w5gFQ vbB3KzBxP+xP5Ja0/MvWdpk088f6tTW09pesh+w= X-Received: by 2002:a17:903:23cd:b0:1ca:7086:60ec with SMTP id o13-20020a17090323cd00b001ca708660ecmr15608347plh.65.1698279375378; Wed, 25 Oct 2023 17:16:15 -0700 (PDT) Received: from stoup.. ([71.212.149.95]) by smtp.gmail.com with ESMTPSA id ij23-20020a170902ab5700b001c582de968dsm10038433plb.72.2023.10.25.17.16.14 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 25 Oct 2023 17:16:15 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH 19/29] tcg/sparc64: Pass TCGCond to tcg_out_cmp Date: Wed, 25 Oct 2023 17:14:17 -0700 Message-Id: <20231026001542.1141412-39-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231026001542.1141412-1-richard.henderson@linaro.org> References: <20231026001542.1141412-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::636; envelope-from=richard.henderson@linaro.org; helo=mail-pl1-x636.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 --- tcg/sparc64/tcg-target.c.inc | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/tcg/sparc64/tcg-target.c.inc b/tcg/sparc64/tcg-target.c.inc index 13ad92b9b6..e958e3c242 100644 --- a/tcg/sparc64/tcg-target.c.inc +++ b/tcg/sparc64/tcg-target.c.inc @@ -645,7 +645,8 @@ static void tcg_out_bpcc(TCGContext *s, int scond, int flags, TCGLabel *l) tcg_out_bpcc0(s, scond, flags, off19); } -static void tcg_out_cmp(TCGContext *s, TCGReg c1, int32_t c2, int c2const) +static void tcg_out_cmp(TCGContext *s, TCGCond cond, + TCGReg c1, int32_t c2, int c2const) { tcg_out_arithc(s, TCG_REG_G0, c1, c2, c2const, ARITH_SUBCC); } @@ -653,7 +654,7 @@ static void tcg_out_cmp(TCGContext *s, TCGReg c1, int32_t c2, int c2const) static void tcg_out_brcond_i32(TCGContext *s, TCGCond cond, TCGReg arg1, int32_t arg2, int const_arg2, TCGLabel *l) { - tcg_out_cmp(s, arg1, arg2, const_arg2); + tcg_out_cmp(s, cond, arg1, arg2, const_arg2); tcg_out_bpcc(s, tcg_cond_to_bcond[cond], BPCC_ICC | BPCC_PT, l); tcg_out_nop(s); } @@ -670,7 +671,7 @@ static void tcg_out_movcond_i32(TCGContext *s, TCGCond cond, TCGReg ret, TCGReg c1, int32_t c2, int c2const, int32_t v1, int v1const) { - tcg_out_cmp(s, c1, c2, c2const); + tcg_out_cmp(s, cond, c1, c2, c2const); tcg_out_movcc(s, cond, MOVCC_ICC, ret, v1, v1const); } @@ -690,7 +691,7 @@ static void tcg_out_brcond_i64(TCGContext *s, TCGCond cond, TCGReg arg1, tcg_out32(s, INSN_OP(0) | INSN_OP2(3) | BPR_PT | INSN_RS1(arg1) | INSN_COND(rcond) | off16); } else { - tcg_out_cmp(s, arg1, arg2, const_arg2); + tcg_out_cmp(s, cond, arg1, arg2, const_arg2); tcg_out_bpcc(s, tcg_cond_to_bcond[cond], BPCC_XCC | BPCC_PT, l); } tcg_out_nop(s); @@ -714,7 +715,7 @@ static void tcg_out_movcond_i64(TCGContext *s, TCGCond cond, TCGReg ret, if (c2 == 0 && rcond && (!v1const || check_fit_i32(v1, 10))) { tcg_out_movr(s, rcond, ret, c1, v1, v1const); } else { - tcg_out_cmp(s, c1, c2, c2const); + tcg_out_cmp(s, cond, c1, c2, c2const); tcg_out_movcc(s, cond, MOVCC_XCC, ret, v1, v1const); } } @@ -758,13 +759,13 @@ static void tcg_out_setcond_i32(TCGContext *s, TCGCond cond, TCGReg ret, /* FALLTHRU */ default: - tcg_out_cmp(s, c1, c2, c2const); + tcg_out_cmp(s, cond, c1, c2, c2const); tcg_out_movi_s13(s, ret, 0); tcg_out_movcc(s, cond, MOVCC_ICC, ret, neg ? -1 : 1, 1); return; } - tcg_out_cmp(s, c1, c2, c2const); + tcg_out_cmp(s, cond, c1, c2, c2const); if (cond == TCG_COND_LTU) { if (neg) { /* 0 - 0 - C = -C = (C ? -1 : 0) */ @@ -798,7 +799,7 @@ static void tcg_out_setcond_i64(TCGContext *s, TCGCond cond, TCGReg ret, c2 = c1, c2const = 0, c1 = TCG_REG_G0; /* FALLTHRU */ case TCG_COND_LTU: - tcg_out_cmp(s, c1, c2, c2const); + tcg_out_cmp(s, cond, c1, c2, c2const); tcg_out_arith(s, ret, TCG_REG_G0, TCG_REG_G0, ARITH_ADDXC); return; default: @@ -813,7 +814,7 @@ static void tcg_out_setcond_i64(TCGContext *s, TCGCond cond, TCGReg ret, tcg_out_movi_s13(s, ret, 0); tcg_out_movr(s, rcond, ret, c1, neg ? -1 : 1, 1); } else { - tcg_out_cmp(s, c1, c2, c2const); + tcg_out_cmp(s, cond, c1, c2, c2const); tcg_out_movi_s13(s, ret, 0); tcg_out_movcc(s, cond, MOVCC_XCC, ret, neg ? -1 : 1, 1); } @@ -1101,7 +1102,7 @@ static TCGLabelQemuLdst *prepare_host_addr(TCGContext *s, HostAddress *h, tcg_out_movi_s32(s, TCG_REG_T3, compare_mask); tcg_out_arith(s, TCG_REG_T3, addr_reg, TCG_REG_T3, ARITH_AND); } - tcg_out_cmp(s, TCG_REG_T2, TCG_REG_T3, 0); + tcg_out_cmp(s, TCG_COND_NE, TCG_REG_T2, TCG_REG_T3, 0); ldst = new_ldst_label(s); ldst->is_ld = is_ld; From patchwork Thu Oct 26 00:14:18 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 738196 Delivered-To: patch@linaro.org Received: by 2002:adf:f842:0:b0:32d:baff:b0ca with SMTP id d2csp552963wrq; Wed, 25 Oct 2023 17:19:52 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEd7CziaA7qCJDGNq14/hwYumuHSnhjnBBAY/EbcQkFWF8Hg/Lwx7mHmxRQ9ikNuc+q5adH X-Received: by 2002:a05:600c:224b:b0:408:3975:e225 with SMTP id a11-20020a05600c224b00b004083975e225mr12308884wmm.40.1698279592201; Wed, 25 Oct 2023 17:19:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698279592; cv=none; d=google.com; s=arc-20160816; b=gcbzmQ0ulqdZcNaJ/tqMHTxMQ5wAJqI9yyPg+cdZruC3eOvNyOBot/vhBr/+PrLGaB FiuZzyUSVPolo8Q5E/cscckPVz5+I/nDkOttPMI4+W67SwNOQnluCIu5shMcqhUS6jYN X8nRT68NBeH0cfLB1mQ4kEYF3ifEz+JLojnonucE79/FQ+W3xokRMdDLPFcHufKkXT98 LIC7w+v68yoeCHPYxyzRITze/Ml8/eo4oXdL7mO1qrouc4FC1YRDt5jm95px23/PKsLn C0pOIxG+6t+B4Fi9/PaNHnk9hBf3kHt93tIjBiGjKVM9LkAq9/o8JIjmPpo21Dz8cQ6E Kx1A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=5V/MzDPCPtSl5p/d34/PgkVJsUATuXtmCOJbzl0yEFY=; fh=rYI8DiHAAFX3O5g969KmOAQ7d45Sb8OxQX1+DywGDk4=; b=AkE6H/ToMWI2Apv34/bfYhZBYSn0DH25WWmJMUMc3SemK/w8mn+ItelnaSGs+3f3i5 Q5wP7zXLM9YIFqO0YU4M8iG0bznHn6IjF0x26gn2S+4jpHgSPazFT6zmwxNHqaF8k+oI UfY1pFyKeO5YEK/UZTLb9mLPFZqLl37E1JfW2kDF0/jkGyKlhHhdi9g/L3kS4Vus6O10 Xx7wBSyIMbpRMexsPtax33+VQGJAZnzYR5e7fso1OwNW1yzlQVg4EPGq0he5LyyGLfgr uZwNHd+YX2m+Dg0oE9NbF/8Xut5WNltBwGbj66j0xHNsZkxzXqXxvvHByc0ND+SeuM6U bR4g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="ReP/tdTa"; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id q11-20020a056000136b00b0032ddbecb14dsi8294468wrz.751.2023.10.25.17.19.52 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 25 Oct 2023 17:19:52 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="ReP/tdTa"; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qvo2z-0007Lb-2Z; Wed, 25 Oct 2023 20:16:25 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qvo2v-0007Gh-I5 for qemu-devel@nongnu.org; Wed, 25 Oct 2023 20:16:21 -0400 Received: from mail-pf1-x42f.google.com ([2607:f8b0:4864:20::42f]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qvo2r-0004w5-JR for qemu-devel@nongnu.org; Wed, 25 Oct 2023 20:16:21 -0400 Received: by mail-pf1-x42f.google.com with SMTP id d2e1a72fcca58-6be1bc5aa1cso294899b3a.3 for ; Wed, 25 Oct 2023 17:16:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1698279376; x=1698884176; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=5V/MzDPCPtSl5p/d34/PgkVJsUATuXtmCOJbzl0yEFY=; b=ReP/tdTawWVX0Oj/2MovUjQSPcYasaBEXdYuTy8+wJ8A1GgsUtPoCP5QQ3uX6qxjoG jFbCSy72mZeBCN18p/q1K2uq+fcXlQHtdM2IEBRQxQIR5fiX9S4ALpTjzfHDHbB5P2gt BN7Uls2FsxD8fSmp+rWpMkIjb99qpVwUzfvgH9kwwZKUGIXn7B0US7ADezTuEIrRXYHT WllX3l0TNsOUKEhkqzNdFeWZ5ekFYRm9AT0v84/VrdmaXKd1Q/PtTzwYyCc4kMpp3+dT TtrcouAdLS0LvyXyN6cyH4m9JnHPQk6PsC4neS5Y7PdO1tE/z6FD2bpvVt9O90SrqlWz 4CCA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1698279376; x=1698884176; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=5V/MzDPCPtSl5p/d34/PgkVJsUATuXtmCOJbzl0yEFY=; b=n10ByJeTNWi/FoFBfMveGyu+sat0+dqujaD+yPeVdhCryGRID6iqC97knhgWejEdTF tjaDXTJlF5VP3PRhjkPpcWGNm7C9i0I0xwzvJ15MgeoHci4VQLL7ZLR/5YuutUc3gTir OLnCGe2SI1dqfgu/eudurVR4kbe2uVXFq+d47NPPkBtXsB86egHfSaGOOMfVkcR0bs0M lOSOmDJSPXCW8g/O6XRt87y8cKZ7yfEP5wMZIzMKgsJ6Jkk1X9wdSdCu+dqZDEex8B1n folv9fQEwut/SkTGri9K/cXzlEsAkGsQPAxiKVheGsn9YVodaQdM4lARtvk1L2fGqkMq jc6A== X-Gm-Message-State: AOJu0YxQb03o8S1rFgUvEsZzMtGXFEgtItHz7SbgLzqkuC3Y+bbHeemN +7i8tQp9b70h5ezfWTNc0lfF0edWgPJWB7kHs/4= X-Received: by 2002:a17:902:f550:b0:1ca:7086:60f7 with SMTP id h16-20020a170902f55000b001ca708660f7mr18868027plf.28.1698279376220; Wed, 25 Oct 2023 17:16:16 -0700 (PDT) Received: from stoup.. ([71.212.149.95]) by smtp.gmail.com with ESMTPSA id ij23-20020a170902ab5700b001c582de968dsm10038433plb.72.2023.10.25.17.16.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 25 Oct 2023 17:16:15 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: Mark Cave-Ayland Subject: [PULL 20/94] target/sparc: Move SETHI to decodetree Date: Wed, 25 Oct 2023 17:14:18 -0700 Message-Id: <20231026001542.1141412-40-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231026001542.1141412-1-richard.henderson@linaro.org> References: <20231026001542.1141412-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::42f; envelope-from=richard.henderson@linaro.org; helo=mail-pf1-x42f.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org Tested-by: Mark Cave-Ayland Acked-by: Mark Cave-Ayland Signed-off-by: Richard Henderson --- target/sparc/insns.decode | 6 +++++ target/sparc/translate.c | 50 ++++++++++++--------------------------- 2 files changed, 21 insertions(+), 35 deletions(-) diff --git a/target/sparc/insns.decode b/target/sparc/insns.decode index 9ab3f2eb82..f6f5401b10 100644 --- a/target/sparc/insns.decode +++ b/target/sparc/insns.decode @@ -3,6 +3,10 @@ # Sparc instruction decode definitions. # Copyright (c) 2023 Richard Henderson +## +## Major Opcodes 00 and 01 -- branches, call, and sethi. +## + &bcc i a cond cc BPcc 00 a:1 cond:4 001 cc:1 0 - i:s19 &bcc Bicc 00 a:1 cond:4 010 i:s22 &bcc cc=0 @@ -14,4 +18,6 @@ BPr 00 a:1 0 cond:3 011 .. - rs1:5 .............. i=%d16 NCP 00 - ---- 111 ---------------------- # CBcc +SETHI 00 rd:5 100 i:22 + CALL 01 i:s30 diff --git a/target/sparc/translate.c b/target/sparc/translate.c index d12f2b4b87..cdd929282a 100644 --- a/target/sparc/translate.c +++ b/target/sparc/translate.c @@ -2873,6 +2873,10 @@ static bool advance_pc(DisasContext *dc) return true; } +/* + * Major opcodes 00 and 01 -- branches, call, and sethi + */ + static bool advance_jump_uncond_never(DisasContext *dc, bool annul) { if (annul) { @@ -3029,6 +3033,15 @@ static bool trans_NCP(DisasContext *dc, arg_NCP *a) #endif } +static bool trans_SETHI(DisasContext *dc, arg_SETHI *a) +{ + /* Special-case %g0 because that's the canonical nop. */ + if (a->rd) { + gen_store_gpr(dc, a->rd, tcg_constant_tl((uint32_t)a->i << 10)); + } + return advance_pc(dc); +} + #define CHECK_IU_FEATURE(dc, FEATURE) \ if (!((dc)->def->features & CPU_FEATURE_ ## FEATURE)) \ goto illegal_insn; @@ -3049,41 +3062,8 @@ static void disas_sparc_legacy(DisasContext *dc, unsigned int insn) rd = GET_FIELD(insn, 2, 6); switch (opc) { - case 0: /* branches/sethi */ - { - unsigned int xop = GET_FIELD(insn, 7, 9); - switch (xop) { -#ifdef TARGET_SPARC64 - case 0x1: /* V9 BPcc */ - g_assert_not_reached(); /* in decodetree */ - case 0x3: /* V9 BPr */ - g_assert_not_reached(); /* in decodetree */ - case 0x5: /* V9 FBPcc */ - g_assert_not_reached(); /* in decodetree */ -#else - case 0x7: /* CBN+x */ - g_assert_not_reached(); /* in decodetree */ -#endif - case 0x2: /* BN+x */ - g_assert_not_reached(); /* in decodetree */ - case 0x6: /* FBN+x */ - g_assert_not_reached(); /* in decodetree */ - case 0x4: /* SETHI */ - /* Special-case %g0 because that's the canonical nop. */ - if (rd) { - uint32_t value = GET_FIELD(insn, 10, 31); - TCGv t = gen_dest_gpr(dc, rd); - tcg_gen_movi_tl(t, value << 10); - gen_store_gpr(dc, rd, t); - } - break; - case 0x0: /* UNIMPL */ - default: - goto illegal_insn; - } - break; - } - break; + case 0: + goto illegal_insn; /* in decodetree */ case 1: g_assert_not_reached(); /* in decodetree */ case 2: /* FPU & Logical Operations */ From patchwork Thu Oct 26 00:14: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: 738217 Delivered-To: patch@linaro.org Received: by 2002:adf:f842:0:b0:32d:baff:b0ca with SMTP id d2csp554339wrq; Wed, 25 Oct 2023 17:23:48 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHdLH70NxeTVNHmPVtheXMQ4UYYOmyBCFbZyWqcQKaxvgntF8tJj4VlvnMVbmUSzSE4ENZ2 X-Received: by 2002:a5d:5746:0:b0:32d:62e7:8ff9 with SMTP id q6-20020a5d5746000000b0032d62e78ff9mr11573326wrw.34.1698279828561; Wed, 25 Oct 2023 17:23:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698279828; cv=none; d=google.com; s=arc-20160816; b=Qx8vx6d3F1HlXX2LMEgYvE/2tSjlw1VQy3aA+6iJoN8HTjb9KEePVcb25vhkVcgj+n lEAcB+V8N8W4sL8ZjkZzj+W6tUFVpraKxRhEUImu6tyh2u/uAyLBiK6/SlRUHeDPoj8n Xwer3ml5jI8nO08/c+nHuKBpbv8thiKQ9hNYhR2tATh3EHy7AzGEwlCEGYwk3RY/6nQ+ kSO0fW+f2hKZOE9WVYgHE30oFHVKh7whgCqEW3qVmG1lV2Ga/8eXY5S/nDkwWfuc1ySl s8v0jD0L/QhzYq+YQ7XWSJhroNr0waI94a+0YGc61NtRl23TPHy0WdIYGWtOwxnp/uDh dJ1Q== 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=tfImdl249sFCQ5QfdFytfo/W/FXnENZi8z1/TCfyq8o=; fh=rYI8DiHAAFX3O5g969KmOAQ7d45Sb8OxQX1+DywGDk4=; b=DJ56Dr51D3TcGLbfn7jrSaN0teXevjd1bYzgLq7qmWBjXfLZL79g+cin0x1pSMoQo5 M8R/yn+qhCLV7IfBsINbkdD05bPb+2DanB8C+O0hfhishemY2TRZwlDbnrgAayNqBjXT uDXalluOyZDUGi/fV4ZW7NfnVR97Au8QiD6aaafPKjHH5YgLhOo5hJyBoUJF7SAuhu38 JVsuhdz369zzTlMwT52clleWLCiPpbKgk5IPFA1F9nEIV/vHqdAHIvX2xwg8yRcksGvw MN5UryrnsxPqwM2ppfmmSI7IKjL8IV2s9uXEUIW9AmXNG+tykkyWSukuLSI4eISo692U uM4w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=xc82ynag; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as 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 m2-20020a5d4a02000000b0032da2d7ae86si8290848wrq.1054.2023.10.25.17.23.48 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 25 Oct 2023 17:23: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=xc82ynag; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as 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 1qvo5v-0000cV-Qm; Wed, 25 Oct 2023 20:19:28 -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 1qvo5r-0000RX-R9 for qemu-devel@nongnu.org; Wed, 25 Oct 2023 20:19:23 -0400 Received: from mail-pl1-x629.google.com ([2607:f8b0:4864:20::629]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qvo5p-0006aK-3k for qemu-devel@nongnu.org; Wed, 25 Oct 2023 20:19:23 -0400 Received: by mail-pl1-x629.google.com with SMTP id d9443c01a7336-1c9d407bb15so2444425ad.0 for ; Wed, 25 Oct 2023 17:19:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1698279558; x=1698884358; 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=tfImdl249sFCQ5QfdFytfo/W/FXnENZi8z1/TCfyq8o=; b=xc82ynagxBSTyvwTCjPX+lWpAsc+D99wX68e1+toyhpEOoWLg2i1fX7HxgcSwWmUbu 3E3/CIQJm4pzIGw31UeTcynZkCI0KzBU9XAvkzpUtRZzf2BzEdDS/5eu45hCJwNTzg81 TThcY7yfgZVo+PsIa7XWgKEUueOcYko7bAcfCADqwPErsOStd5mi0qsPzts54eKYuoiN MgdwdESKijBh5vzH3gpeGV+c7etsFJ5AZ7UR51wnF551gaOx74bjXpj3IXCoWlxtmJ6d qGEOVgw4tt1sB+reJYNMwsn2oQJcl6guUpG0jP2GWGOVkYftxC2DrmLKHOstJfpeyJqK uxbQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1698279558; x=1698884358; 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=tfImdl249sFCQ5QfdFytfo/W/FXnENZi8z1/TCfyq8o=; b=XpkbmpsRp09xHj1nLLWgBxKd1Bxn08aBzChLxbKKIjBJG023/wwb5IRhrto2gfNB1S ouZBIPqR9PK2QSAU25QDkluksy9oKjxDcHmvhgbzn5aK1OtyNJG82pZ++7GYNUgTSyRv LFpVhPgAxwhYloGUkZM8wFZRQnF8jSwh3NzYGBqGFr9fqAjze6mLCUFBU9U5gypropf5 G28A30nyEkm1T8OHBaiQcBSf65DgMA3Fk/pWZTmJubemt3viM3cAKFpf25u5wlTrSrgO fSEe09GB9PqZrRBgnT5RBVbGh/RZWixaw45rI78nrAA/qYmI9RdUKSpw0SPRva1OWt2C /SHw== X-Gm-Message-State: AOJu0YyH6kEdw3rtpLVkr3DaPbYDDNCFyuVojtf80ap/AB5Cd+gmHmH3 Jfc1+QG8XvtF+3c8z47HPNEmOnXYbHj9e7BCG2A= X-Received: by 2002:a17:902:c942:b0:1c9:dcea:33e5 with SMTP id i2-20020a170902c94200b001c9dcea33e5mr18107083pla.67.1698279558475; Wed, 25 Oct 2023 17:19:18 -0700 (PDT) Received: from stoup.. ([71.212.149.95]) by smtp.gmail.com with ESMTPSA id jh1-20020a170903328100b001c5fc291ef9sm9754655plb.209.2023.10.25.17.19.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 25 Oct 2023 17:19:18 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: Mark Cave-Ayland Subject: [PULL 21/94] target/sparc: Move Tcc to decodetree Date: Wed, 25 Oct 2023 17:14:20 -0700 Message-Id: <20231026001542.1141412-42-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231026001542.1141412-1-richard.henderson@linaro.org> References: <20231026001542.1141412-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::629; envelope-from=richard.henderson@linaro.org; helo=mail-pl1-x629.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org Use the new delay_exceptionv function in the implementation. Tested-by: Mark Cave-Ayland Acked-by: Mark Cave-Ayland 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 Thu Oct 26 00:14: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: 738225 Delivered-To: patch@linaro.org Received: by 2002:adf:f842:0:b0:32d:baff:b0ca with SMTP id d2csp554947wrq; Wed, 25 Oct 2023 17:25:49 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEtisUbyY5REdDI5Srklg2bO8Ler/4uEuZ5+u/MBSq4cgSOU8z/mmSk2RlS+EsZjphTajsh X-Received: by 2002:adf:fd91:0:b0:31f:e5cf:6724 with SMTP id d17-20020adffd91000000b0031fe5cf6724mr11940640wrr.46.1698279949299; Wed, 25 Oct 2023 17:25:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698279949; cv=none; d=google.com; s=arc-20160816; b=U+Oat4gA++X4iEwMW2eOa5rAsWMttz878TSS6Ptb9/ITs/Qy1BP2aEKQ5dgWQbA8eh lWZ091XBTG7ZfCDPW3P5k2wGtVrJR8rnG8dtj1zr9/DyU28NkGYOfNtKYNraoFJA3AeM 00ALwE6M67Po755X73cCWWAtp9tx3ZXr0mwoVMWp2jlr4rEEs/A+IeibEchxowW9OuOG wbeFmtRE3nKJlB/PWFjXwvanoUF3jTbxxLy7cj2NPCgzFmUIYwHh4OcTIbQWSQhUPkhI lWE5Saiyrqvu+RmjSKjI+1xxy0vGMfqfG8FnrJn8X3N5ZFlGTco/xu87FhezXCD1SXbn 7B6A== 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=0ZFkVjJElMHbZrG486UGB9YDXc8kwMsHMbCp6rWCfS4=; fh=rYI8DiHAAFX3O5g969KmOAQ7d45Sb8OxQX1+DywGDk4=; b=ezqv241bqvGpxB2Bhz5KaavoW5yjBDCxXq9aBfXXkqslzT7oxTuoBr5BZ6NNVVkbNt +j9JsYEDUQi9FP1ziMfmkhIksA3iAF3OZ0hxMBACWGjc2Z0eKL+d98jFGQXvXq61Lhb3 Emyr5RwWJYIrcOFOZCfktdUUnr5gaq8eqlaVffCSn/GAg5gBfuTa4tSM3p3AZImJqY6L 0uiga4fAzh20Wbw7RagEhDnJr2/1TD0P2SWDxRqchQNzzX62s3AUPDT1wNCNM2jfokjS 7f2CWlOXj0F6xAUfFraeWCS2BWs2YCXtHEnaad/t1dy/BxC07CfjWI0e0AgOyvMWvddC qjKA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=gq2NwD8r; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as 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 m9-20020adffa09000000b0031f85d91bc0si8358672wrr.834.2023.10.25.17.25.49 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 25 Oct 2023 17:25: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=gq2NwD8r; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as 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 1qvo6E-00012W-NO; Wed, 25 Oct 2023 20:19:46 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qvo61-0000qo-Fv for qemu-devel@nongnu.org; Wed, 25 Oct 2023 20:19:35 -0400 Received: from mail-pl1-x62f.google.com ([2607:f8b0:4864:20::62f]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qvo5r-0006ah-2f for qemu-devel@nongnu.org; Wed, 25 Oct 2023 20:19:33 -0400 Received: by mail-pl1-x62f.google.com with SMTP id d9443c01a7336-1caa371dcd8so2468165ad.0 for ; Wed, 25 Oct 2023 17:19:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1698279560; x=1698884360; 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=0ZFkVjJElMHbZrG486UGB9YDXc8kwMsHMbCp6rWCfS4=; b=gq2NwD8rjh3QlRgTi2ZUCkDcKNIfuXO1aZ6aGvD2Eqqk9ID6x+EaXFmzxhTeYPC+RK ww8DIBmIGvzFnXPhuRtE7J1Q1RdDGO70YGaKFgo0P4+gxfwV/gCEMcOkUaSdmYMBzaCX v9m+6nzlGFI1r+9yEhEqk5iEk8ynTXsDK5tCUFEdSWQkOiwcNieFmEXaxxgAjDhvbT/x VDIRopUQICKzgqgAGE3/O7hHWju99cUnp5fsNibox0jc+Oiqm51MC7RyDagAiWPpfTNm KbIwVuLl5mj6l6oD+nm+CgEyuw6it8vMBH7ptW5dPiBgdb2cmbz6+f3rs0stv7t80r+j nktw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1698279560; x=1698884360; 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=0ZFkVjJElMHbZrG486UGB9YDXc8kwMsHMbCp6rWCfS4=; b=wT3f0PQWdVdxL3Yu00Ekj1BtQUne1DLO1xdTe4o+gigZrXTNGjclY9Xnls03AaRVoW TyrI5oGB7ERmC4lzJRv24ZUOQQQK7iUQytCRANcex8gvS1VaF1g0Mk7VPUqSUuRp4Itt 5LCOp6OQ0FjnbKQjBPCdAnc/VaCeCzmqZEfEr8JZb0+86HytO7vR97KlYkAJ1EDbJcDs qSKYheXTXAsu2N1Dg6ado5+mAck8XYIgKClnCp/SGOXkXRIOm+035CL34Tt1NKKyzpsk hjcLzAV4vEunLQq6IW8YzSu7AMNjEAPR4QzRau9M745mhKQKjdv37xCrBXa/E1KVhneB Yaww== X-Gm-Message-State: AOJu0YwzNlEXT5/OIgTAFrtHh0bC5VFWEpOnkXIUXtWBc8AeftPUHmC5 S6CzmCKTTYXil0oYCoxLcXF+h0f5DMDLt2Ypbd4= X-Received: by 2002:a17:903:11c9:b0:1c8:a68e:7f1 with SMTP id q9-20020a17090311c900b001c8a68e07f1mr16345293plh.66.1698279560145; Wed, 25 Oct 2023 17:19:20 -0700 (PDT) Received: from stoup.. ([71.212.149.95]) by smtp.gmail.com with ESMTPSA id jh1-20020a170903328100b001c5fc291ef9sm9754655plb.209.2023.10.25.17.19.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 25 Oct 2023 17:19:19 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: Mark Cave-Ayland Subject: [PULL 22/94] target/sparc: Move RDASR, STBAR, MEMBAR to decodetree Date: Wed, 25 Oct 2023 17:14:22 -0700 Message-Id: <20231026001542.1141412-44-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231026001542.1141412-1-richard.henderson@linaro.org> References: <20231026001542.1141412-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::62f; envelope-from=richard.henderson@linaro.org; helo=mail-pl1-x62f.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org Tested-by: Mark Cave-Ayland Acked-by: Mark Cave-Ayland Signed-off-by: Richard Henderson --- target/sparc/insns.decode | 22 +++ target/sparc/translate.c | 342 ++++++++++++++++++++++++-------------- 2 files changed, 235 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..9af4578525 100644 --- a/target/sparc/translate.c +++ b/target/sparc/translate.c @@ -36,6 +36,11 @@ #include "exec/helper-info.c.inc" #undef HELPER_H +#ifndef TARGET_SPARC64 +# define gen_helper_rdccr(D, E) qemu_build_not_reached() +# define gen_helper_tick_get_count(D, E, T, C) 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]. */ @@ -64,10 +69,21 @@ static TCGv cpu_tick_cmpr, cpu_stick_cmpr, cpu_hstick_cmpr; static TCGv cpu_hintp, cpu_htba, cpu_hver, cpu_ssr, cpu_ver; #else static TCGv cpu_wim; +# define cpu_fprs ({ qemu_build_not_reached(); (TCGv)NULL; }) +# define cpu_gsr ({ qemu_build_not_reached(); (TCGv)NULL; }) +# define cpu_tick_cmpr ({ qemu_build_not_reached(); (TCGv)NULL; }) +# define cpu_stick_cmpr ({ qemu_build_not_reached(); (TCGv)NULL; }) #endif /* Floating point registers */ static TCGv_i64 cpu_fpr[TARGET_DPREGS]; +#define env_field_offsetof(X) offsetof(CPUSPARCState, X) +#ifdef TARGET_SPARC64 +# define env64_field_offsetof(X) env_field_offsetof(X) +#else +# define env64_field_offsetof(X) ({ qemu_build_not_reached(); 0; }) +#endif + typedef struct DisasDelayException { struct DisasDelayException *next; TCGLabel *lab; @@ -2842,10 +2858,14 @@ static void gen_faligndata(TCGv dst, TCGv gsr, TCGv s1, TCGv s2) #define avail_ALL(C) true #ifdef TARGET_SPARC64 # define avail_32(C) false +# define avail_ASR17(C) false # define avail_64(C) true +# define avail_HYPV(C) ((C)->def->features & CPU_FEATURE_HYPV) #else # define avail_32(C) true +# define avail_ASR17(C) ((C)->def->features & CPU_FEATURE_ASR17) # define avail_64(C) false +# define avail_HYPV(C) false #endif /* Default case for non jump instructions. */ @@ -2947,6 +2967,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 +3143,183 @@ 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) +{ + TCGv_ptr r_tickptr = tcg_temp_new_ptr(); + + tcg_gen_ld_ptr(r_tickptr, tcg_env, env64_field_offsetof(tick)); + if (translator_io_start(&dc->base)) { + dc->base.is_jmp = DISAS_EXIT; + } + gen_helper_tick_get_count(dst, tcg_env, r_tickptr, + tcg_constant_i32(dc->mem_idx)); + return dst; +} + +/* 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) +{ + tcg_gen_ext_i32_tl(dst, cpu_fprs); + return dst; +} + +TRANS(RDFPRS, 64, do_rd_special, true, a->rd, do_rdfprs) + +static TCGv do_rdgsr(DisasContext *dc, TCGv dst) +{ + gen_trap_ifnofpu(dc); + return cpu_gsr; +} + +TRANS(RDGSR, 64, do_rd_special, true, a->rd, do_rdgsr) + +static TCGv do_rdsoftint(DisasContext *dc, TCGv dst) +{ + tcg_gen_ld32s_tl(dst, tcg_env, env64_field_offsetof(softint)); + return dst; +} + +TRANS(RDSOFTINT, 64, do_rd_special, supervisor(dc), a->rd, do_rdsoftint) + +static TCGv do_rdtick_cmpr(DisasContext *dc, TCGv dst) +{ + return cpu_tick_cmpr; +} + +/* 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) +{ + TCGv_ptr r_tickptr = tcg_temp_new_ptr(); + + tcg_gen_ld_ptr(r_tickptr, tcg_env, env64_field_offsetof(stick)); + if (translator_io_start(&dc->base)) { + dc->base.is_jmp = DISAS_EXIT; + } + gen_helper_tick_get_count(dst, tcg_env, r_tickptr, + tcg_constant_i32(dc->mem_idx)); + return dst; +} + +/* 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) +{ + return cpu_stick_cmpr; +} + +/* 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 +3346,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 +3389,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 +3514,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 +3526,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 Thu Oct 26 00:14: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: 738221 Delivered-To: patch@linaro.org Received: by 2002:adf:f842:0:b0:32d:baff:b0ca with SMTP id d2csp554647wrq; Wed, 25 Oct 2023 17:24:46 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGiZ3FLUerIzF6R65sCT/A74qMrhFPlWZLx2x5kbyQ+sT4eKLYH6a6MKopxpfL9iagJrLXi X-Received: by 2002:a05:600c:450d:b0:408:4cf7:4f91 with SMTP id t13-20020a05600c450d00b004084cf74f91mr12525980wmo.16.1698279886681; Wed, 25 Oct 2023 17:24:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698279886; cv=none; d=google.com; s=arc-20160816; b=QkIdjhqnmgDt8Q9DJdzJZVX8oNQbQeMgBXS3NgtmxAj40DDeli02js//Wjr2TCTaHz LWr8ndMgGkmFraRs/Hc4pnJddl7HrY/gDs2sr9rvX4ueY086Gv5CCAyd+zUmqOBJU4YQ tZP6KpL2mXcWIrBETmyg31UWXrrDdD8fRmebHZxz9NNIZJL+eqh0qu9UR6xie8Le+/28 dmbQ+fzxv2kJRM20t1sRxhKGivmkaIjr86bKRTDOY9ywDeCEhBrq1cpwEjw0zn/+8OaV wj407bzXHS0HoPtLrMckz3zT38uJh9sVxiKGSg59mPAEcaywcyYwn1SltteOLeK+xg7b EMgw== 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=y4JjGfXc1ZK0slmW0Mduo2FRxtvtvRQNj+3A0+w7cQs=; fh=rYI8DiHAAFX3O5g969KmOAQ7d45Sb8OxQX1+DywGDk4=; b=DbfS1Y6VnzT6jwO5NT0uJPGojgIZ0IoKegQME1Y0y0ZyyXdWjUUC9HLQX4qLelCPCb j/rn0r1cAc4QPCshymaXcyiww1vh4pZdrjtfNz7o4Fev0FYN2V0zVmHVw7ZVLRnj84Km FN2haVzu1jxYxH5aiHELyhWI2BHyoGDmjkA1B6h3k8hr75EzoRxBryZ44AyKxVgfW0YC 2e8GOWw0QAwtHUJU3rdh+zrDJ5wrHbgiNWwXkjJndzJUmWQqF9DKusBU7LgzGs5u6IPG Yep4GIXFWaOgvdETF0O0EV6PB4Bv3NJBAycfUUGFXeLinhUhax/bv/HohKz8ltPUUxPz i2IA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=xvyihsaN; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as 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 o37-20020a05600c512500b004051676cebasi809296wms.39.2023.10.25.17.24.46 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 25 Oct 2023 17:24: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=xvyihsaN; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as 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 1qvo6K-0001Gz-Bm; Wed, 25 Oct 2023 20:19:52 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qvo65-0000rD-0i for qemu-devel@nongnu.org; Wed, 25 Oct 2023 20:19:38 -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 1qvo5t-0006bC-Bx for qemu-devel@nongnu.org; Wed, 25 Oct 2023 20:19:35 -0400 Received: by mail-pl1-x634.google.com with SMTP id d9443c01a7336-1c9bf22fe05so2121815ad.2 for ; Wed, 25 Oct 2023 17:19:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1698279562; x=1698884362; 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=y4JjGfXc1ZK0slmW0Mduo2FRxtvtvRQNj+3A0+w7cQs=; b=xvyihsaN/IL8J7P+zIMxfb6AwFMCQQ1iMFuLQtMNCS7b/cU7zP6ceLuQHnsw1d3WvX G2DaR9S41nAzrqnvh5mtZp9chOyco1x+IiRZosB63rONfe+LEX2D0QI7L2wTsy9IYfQM 2huZDanWtVsYleMmP4G0ezD4pJzsA9IU1bpKAmjwJZ1iKlvkD+KO04ts4GTZBy0HafwC 6D0WT3y+dS6HzlWvCZxcrztknSKclWTaS3/+/ocHeL5I6ahbyiQopiksLRrDLhh5nOps MwaZHDqmFYMMRe96g1Ozd+qjroTOteirTY6Q0+nSUrGy8lWU5Ry3VneR7Adx777pmBvJ /VYw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1698279562; x=1698884362; 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=y4JjGfXc1ZK0slmW0Mduo2FRxtvtvRQNj+3A0+w7cQs=; b=gjhUIqpoaGu2KFP0RfTWqPsHeiOToPxdELodY7VbKivzOgUywq7u2tczYEQ21lwNU3 y05MwbwvcEQJO7A6rhPzWmn3wejor/4R0rqMgvxtknQxvcxzaf/QvGoK+j3NxDsYU/Hb +DVpk00X/XilbMV3YfALTTMsyLEoiiB8iKZ2qmMvP5LHishAYE+AqfTM+VCWNbo1Dkeq P5ApCDmT/DBD1/TWJBFSvjsws8Bal0DcigZ9ujHOKfavd+UrrJxcVe4eCynyYvfUiwI2 MB08sOJO6MuSPgRCrZdM+NscItA06+ES3Ei0spXrH8REWqefUkHVzUhy0TJO7ro1imWu PRTg== X-Gm-Message-State: AOJu0Yxh5NyP2VJrX4AZvlteCSUSrEXyyWDttotrMfiA0EeSq8GLPCku FXiV0KC3CU2L2ZUY65sneH6IPbime1u7UEDDVXA= X-Received: by 2002:a17:903:493:b0:1ca:344f:46e6 with SMTP id jj19-20020a170903049300b001ca344f46e6mr12113594plb.33.1698279561777; Wed, 25 Oct 2023 17:19:21 -0700 (PDT) Received: from stoup.. ([71.212.149.95]) by smtp.gmail.com with ESMTPSA id jh1-20020a170903328100b001c5fc291ef9sm9754655plb.209.2023.10.25.17.19.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 25 Oct 2023 17:19:21 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: Mark Cave-Ayland Subject: [PULL 23/94] target/sparc: Move RDPSR, RDHPR to decodetree Date: Wed, 25 Oct 2023 17:14:24 -0700 Message-Id: <20231026001542.1141412-46-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231026001542.1141412-1-richard.henderson@linaro.org> References: <20231026001542.1141412-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::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 Implement htstate in the obvious way. Resolves: https://gitlab.com/qemu-project/qemu/-/issues/847 Tested-by: Mark Cave-Ayland Acked-by: Mark Cave-Ayland Signed-off-by: Richard Henderson --- target/sparc/insns.decode | 10 ++++ target/sparc/translate.c | 116 ++++++++++++++++++++++++-------------- 2 files changed, 83 insertions(+), 43 deletions(-) diff --git a/target/sparc/insns.decode b/target/sparc/insns.decode index 1b084c5b97..a7d78eb6c6 100644 --- a/target/sparc/insns.decode +++ b/target/sparc/insns.decode @@ -44,6 +44,16 @@ CALL 01 i:s30 RDY 10 rd:5 101000 rs1:5 0 0000000000000 } +{ + RDPSR 10 rd:5 101001 00000 0 0000000000000 + RDHPR_hpstate 10 rd:5 101001 00000 0 0000000000000 +} +RDHPR_htstate 10 rd:5 101001 00001 0 0000000000000 +RDHPR_hintp 10 rd:5 101001 00011 0 0000000000000 +RDHPR_htba 10 rd:5 101001 00101 0 0000000000000 +RDHPR_hver 10 rd:5 101001 00110 0 0000000000000 +RDHPR_hstick_cmpr 10 rd:5 101001 11111 0 0000000000000 + Tcc_r 10 0 cond:4 111010 rs1:5 0 cc:1 0000000 rs2:5 { # For v7, the entire simm13 field is present, but masked to 7 bits. diff --git a/target/sparc/translate.c b/target/sparc/translate.c index 9af4578525..b58c2594ca 100644 --- a/target/sparc/translate.c +++ b/target/sparc/translate.c @@ -36,9 +36,12 @@ #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() # define gen_helper_tick_get_count(D, E, T, C) qemu_build_not_reached() +# define MAXTL_MASK 0 #endif /* Dynamic PC, must exit to main loop. */ @@ -71,8 +74,12 @@ static TCGv cpu_hintp, cpu_htba, cpu_hver, cpu_ssr, cpu_ver; static TCGv cpu_wim; # define cpu_fprs ({ qemu_build_not_reached(); (TCGv)NULL; }) # define cpu_gsr ({ qemu_build_not_reached(); (TCGv)NULL; }) -# define cpu_tick_cmpr ({ qemu_build_not_reached(); (TCGv)NULL; }) +# define cpu_hintp ({ qemu_build_not_reached(); (TCGv)NULL; }) +# define cpu_hstick_cmpr ({ qemu_build_not_reached(); (TCGv)NULL; }) +# define cpu_htba ({ qemu_build_not_reached(); (TCGv)NULL; }) +# define cpu_hver ({ qemu_build_not_reached(); (TCGv)NULL; }) # define cpu_stick_cmpr ({ qemu_build_not_reached(); (TCGv)NULL; }) +# define cpu_tick_cmpr ({ qemu_build_not_reached(); (TCGv)NULL; }) #endif /* Floating point registers */ static TCGv_i64 cpu_fpr[TARGET_DPREGS]; @@ -272,15 +279,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 @@ -3320,6 +3326,69 @@ 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) +{ + tcg_gen_ld_tl(dst, tcg_env, env64_field_offsetof(hpstate)); + return dst; +} + +TRANS(RDHPR_hpstate, HYPV, do_rd_special, hypervisor(dc), a->rd, do_rdhpstate) + +static TCGv do_rdhtstate(DisasContext *dc, TCGv dst) +{ + TCGv_i32 tl = tcg_temp_new_i32(); + TCGv_ptr tp = tcg_temp_new_ptr(); + + tcg_gen_ld_i32(tl, tcg_env, env64_field_offsetof(tl)); + tcg_gen_andi_i32(tl, tl, MAXTL_MASK); + tcg_gen_shli_i32(tl, tl, 3); + tcg_gen_ext_i32_ptr(tp, tl); + tcg_gen_add_ptr(tp, tp, tcg_env); + + tcg_gen_ld_tl(dst, tp, env64_field_offsetof(htstate)); + return dst; +} + +TRANS(RDHPR_htstate, HYPV, do_rd_special, hypervisor(dc), a->rd, do_rdhtstate) + +static TCGv do_rdhintp(DisasContext *dc, TCGv dst) +{ + return cpu_hintp; +} + +TRANS(RDHPR_hintp, HYPV, do_rd_special, hypervisor(dc), a->rd, do_rdhintp) + +static TCGv do_rdhtba(DisasContext *dc, TCGv dst) +{ + return cpu_htba; +} + +TRANS(RDHPR_htba, HYPV, do_rd_special, hypervisor(dc), a->rd, do_rdhtba) + +static TCGv do_rdhver(DisasContext *dc, TCGv dst) +{ + return cpu_hver; +} + +TRANS(RDHPR_hver, HYPV, do_rd_special, hypervisor(dc), a->rd, do_rdhver) + +static TCGv do_rdhstick_cmpr(DisasContext *dc, TCGv dst) +{ + return cpu_hstick_cmpr; +} + +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; @@ -3351,45 +3420,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 Thu Oct 26 00:14: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: 738201 Delivered-To: patch@linaro.org Received: by 2002:adf:f842:0:b0:32d:baff:b0ca with SMTP id d2csp553568wrq; Wed, 25 Oct 2023 17:21:36 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFoacg1lt5Q3mcsFcr4WiZDEF1edsZl0zfTP7GbxcQqkuanecQigB7ck58xn8gFyqPp4M41 X-Received: by 2002:adf:efc3:0:b0:32d:8e54:29f7 with SMTP id i3-20020adfefc3000000b0032d8e5429f7mr12099653wrp.64.1698279696602; Wed, 25 Oct 2023 17:21:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698279696; cv=none; d=google.com; s=arc-20160816; b=Sbo19jMwDB1EX3RGq2QeIwbFSqhWIuJbYzXykyupC34ewzlB1HY3gGtooaLASWvoSw UEryLWYvAyWeJfVtDYA/pXAgKhxi5c593JICOPJVtjL1eb4gOmPPCR+hDUfm/zI9dPD3 lAdkqOEpua5JBRXkLeCGr8hSD+Gvp+GKCuw8REBRK4zOS4I/Hn/P4Nmdrj6ZkoNUp00J GA2wToJBknEPTqraln9IJ96zx1bctZSYOZqm28FoTzSi4RStaYAChN+ZS1fGcncopTyb qzQ9kkZYMGmWm4aulCHC0RhG3liAQKb9lFWrkp7WFXK4+sg/i3u1V2A1gKGAeU4Wylcy NNEQ== 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=zEBBC87M+M74G9VePVYzj1ubW0xjjFngqxM/dIsRAKg=; fh=rYI8DiHAAFX3O5g969KmOAQ7d45Sb8OxQX1+DywGDk4=; b=e0ywBlXRcfRWweUl99WEWdQW8hydqK/4UhOvsQhY892J3VO00UyHqxflQOHaZO7Gtp oFnJZiKSZoKh3SK7rGx5iOFf30yBMU3RrZ0ILjFn4iz8k0KsCJeKmbKZbmhsmVnYQMEu zJD430iWnZVpUgeL7SFgTizF/0KS1mbw1B+codJJJcllF1eNA6armNu2UZkIZOs9RK3n QbTrxXG5TFrWgvvn8DYJgVRNf6mxjBeRIl1++bp4k09ju11iymrG7FfYEhQI/jcyjLUM QXn1iLxSwZYouRy8d6GrTK/3CC7+CHRVat11t0B5t+gVtBOeM7wfvpDlduwXBiBqL3Mi yVWQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=HR8FXZEr; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as 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 u18-20020adff892000000b00323299770b8si8088547wrp.880.2023.10.25.17.21.36 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 25 Oct 2023 17:21:36 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=HR8FXZEr; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as 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 1qvo6F-00018L-L5; Wed, 25 Oct 2023 20:19:47 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qvo61-0000qp-OE for qemu-devel@nongnu.org; Wed, 25 Oct 2023 20:19:36 -0400 Received: from mail-pl1-x62f.google.com ([2607:f8b0:4864:20::62f]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qvo5s-0006bU-TZ for qemu-devel@nongnu.org; Wed, 25 Oct 2023 20:19:32 -0400 Received: by mail-pl1-x62f.google.com with SMTP id d9443c01a7336-1ca052ec63bso2398225ad.1 for ; Wed, 25 Oct 2023 17:19:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1698279563; x=1698884363; 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=zEBBC87M+M74G9VePVYzj1ubW0xjjFngqxM/dIsRAKg=; b=HR8FXZEroRUyaYMAPNG8GQj6xTeuXwt1XF/SkkFTF7K8GMSaaYPX69bvGDN0KlkyQ5 V8sKsLvXFf1EA+mSxGSXluUSx2fuOc3oTV5FutaHuy/7mFC+dNJg31dpItreoR9LylHE 7lR9H7SKVoxzGZpIdceBtB3XdnzcwMbYtqHd4SdwjE4uzKuzgOmuxWndKoep3KGnm1Ll uJHYDiM6yILmpuQTm8Wpi2ND1BC6bgJkLsJZoj7l8ioBsSvn+h4wD3ptXtjryTmZTQkh iZX3aIqRbiCmD5rm9TPCDRJ5cU71YSywwb3ikoZg56yh3iwWUIN2ya8pWe/MzcnuOQ2T h6tQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1698279563; x=1698884363; 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=zEBBC87M+M74G9VePVYzj1ubW0xjjFngqxM/dIsRAKg=; b=ZqpMPyUDYM0ZdO5QEnvHOVTcqokZS8mT/+bG40ONGoCy1hjzTJE7o+YoUzkq2oUuZg v4lZqIv9VINq5ojodgQJU/efXmS7n8Yj1aQIfsipfPufAzip/epGQ2NdUvhJ3mwZGv8U f4XRTay8ZkuaCsvHL+TDm316xWLVjqa4++u24LjrPr8unn3v3Cb9BcahGW5H33OBlvGr DYeMc4HRYTUog2S/1HEgJ/0bs3eIR5p4VnQVv9K6AtNYFNzJwi1kl//P4sEexv44VucE D7PyRrbHTUzvgY32Dr/eGXiJJirEas6szgMAIXovZqRuDiYQR/6MmImvF1NNbPy4Q/YY YQZg== X-Gm-Message-State: AOJu0YxiQ66UWrxbyGdTGeo5/fzJbTnbFeRAKqzsRHRpc6d8v57LcJ70 /h6mjwqB52x+T5SCOXbph+lAd58UFr7wBCuIxZw= X-Received: by 2002:a17:903:28c4:b0:1b8:66f6:87a3 with SMTP id kv4-20020a17090328c400b001b866f687a3mr13818818plb.52.1698279563633; Wed, 25 Oct 2023 17:19:23 -0700 (PDT) Received: from stoup.. ([71.212.149.95]) by smtp.gmail.com with ESMTPSA id jh1-20020a170903328100b001c5fc291ef9sm9754655plb.209.2023.10.25.17.19.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 25 Oct 2023 17:19:23 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: Mark Cave-Ayland Subject: [PULL 24/94] target/sparc: Move RDWIM, RDPR to decodetree Date: Wed, 25 Oct 2023 17:14:26 -0700 Message-Id: <20231026001542.1141412-48-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231026001542.1141412-1-richard.henderson@linaro.org> References: <20231026001542.1141412-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::62f; envelope-from=richard.henderson@linaro.org; helo=mail-pl1-x62f.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org Tested-by: Mark Cave-Ayland Acked-by: Mark Cave-Ayland Signed-off-by: Richard Henderson --- target/sparc/insns.decode | 22 +++ target/sparc/translate.c | 320 ++++++++++++++++++++++---------------- 2 files changed, 204 insertions(+), 138 deletions(-) diff --git a/target/sparc/insns.decode b/target/sparc/insns.decode index a7d78eb6c6..7d91a7bc83 100644 --- a/target/sparc/insns.decode +++ b/target/sparc/insns.decode @@ -54,6 +54,28 @@ RDHPR_htba 10 rd:5 101001 00101 0 0000000000000 RDHPR_hver 10 rd:5 101001 00110 0 0000000000000 RDHPR_hstick_cmpr 10 rd:5 101001 11111 0 0000000000000 +{ + RDWIM 10 rd:5 101010 00000 0 0000000000000 + RDPR_tpc 10 rd:5 101010 00000 0 0000000000000 +} +RDPR_tnpc 10 rd:5 101010 00001 0 0000000000000 +RDPR_tstate 10 rd:5 101010 00010 0 0000000000000 +RDPR_tt 10 rd:5 101010 00011 0 0000000000000 +RDPR_tick 10 rd:5 101010 00100 0 0000000000000 +RDPR_tba 10 rd:5 101010 00101 0 0000000000000 +RDPR_pstate 10 rd:5 101010 00110 0 0000000000000 +RDPR_tl 10 rd:5 101010 00111 0 0000000000000 +RDPR_pil 10 rd:5 101010 01000 0 0000000000000 +RDPR_cwp 10 rd:5 101010 01001 0 0000000000000 +RDPR_cansave 10 rd:5 101010 01010 0 0000000000000 +RDPR_canrestore 10 rd:5 101010 01011 0 0000000000000 +RDPR_cleanwin 10 rd:5 101010 01100 0 0000000000000 +RDPR_otherwin 10 rd:5 101010 01101 0 0000000000000 +RDPR_wstate 10 rd:5 101010 01110 0 0000000000000 +RDPR_gl 10 rd:5 101010 10000 0 0000000000000 +RDPR_strand_status 10 rd:5 101010 11010 0 0000000000000 +RDPR_ver 10 rd:5 101010 11111 0 0000000000000 + Tcc_r 10 0 cond:4 111010 rs1:5 0 cc:1 0000000 rs2:5 { # For v7, the entire simm13 field is present, but masked to 7 bits. diff --git a/target/sparc/translate.c b/target/sparc/translate.c index b58c2594ca..6e415d7070 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() # define gen_helper_tick_get_count(D, E, T, C) qemu_build_not_reached() # define MAXTL_MASK 0 #endif @@ -61,15 +62,14 @@ 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; static TCGv cpu_gsr; static TCGv cpu_tick_cmpr, cpu_stick_cmpr, cpu_hstick_cmpr; static TCGv cpu_hintp, cpu_htba, cpu_hver, cpu_ssr, cpu_ver; +# define cpu_wim ({ qemu_build_not_reached(); (TCGv)NULL; }) #else static TCGv cpu_wim; # define cpu_fprs ({ qemu_build_not_reached(); (TCGv)NULL; }) @@ -78,8 +78,10 @@ static TCGv cpu_wim; # define cpu_hstick_cmpr ({ qemu_build_not_reached(); (TCGv)NULL; }) # define cpu_htba ({ qemu_build_not_reached(); (TCGv)NULL; }) # define cpu_hver ({ qemu_build_not_reached(); (TCGv)NULL; }) +# define cpu_ssr ({ qemu_build_not_reached(); (TCGv)NULL; }) # define cpu_stick_cmpr ({ qemu_build_not_reached(); (TCGv)NULL; }) # define cpu_tick_cmpr ({ qemu_build_not_reached(); (TCGv)NULL; }) +# define cpu_ver ({ qemu_build_not_reached(); (TCGv)NULL; }) #endif /* Floating point registers */ static TCGv_i64 cpu_fpr[TARGET_DPREGS]; @@ -2709,8 +2711,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(); @@ -2731,7 +2732,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) @@ -2866,11 +2866,13 @@ static void gen_faligndata(TCGv dst, TCGv gsr, TCGv s1, TCGv s2) # define avail_32(C) false # define avail_ASR17(C) false # define avail_64(C) true +# define avail_GL(C) ((C)->def->features & CPU_FEATURE_GL) # define avail_HYPV(C) ((C)->def->features & CPU_FEATURE_HYPV) #else # define avail_32(C) true # define avail_ASR17(C) ((C)->def->features & CPU_FEATURE_ASR17) # define avail_64(C) false +# define avail_GL(C) false # define avail_HYPV(C) false #endif @@ -3389,6 +3391,177 @@ 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) +{ + return cpu_wim; +} + +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) +{ + tcg_gen_ld32s_tl(dst, tcg_env, env64_field_offsetof(pstate)); + return dst; +} + +TRANS(RDPR_pstate, 64, do_rd_special, supervisor(dc), a->rd, do_rdpstate) + +static TCGv do_rdtl(DisasContext *dc, TCGv dst) +{ + tcg_gen_ld32s_tl(dst, tcg_env, env64_field_offsetof(tl)); + return dst; +} + +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, env_field_offsetof(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) +{ + tcg_gen_ld32s_tl(dst, tcg_env, env64_field_offsetof(cansave)); + return dst; +} + +TRANS(RDPR_cansave, 64, do_rd_special, supervisor(dc), a->rd, do_rdcansave) + +static TCGv do_rdcanrestore(DisasContext *dc, TCGv dst) +{ + tcg_gen_ld32s_tl(dst, tcg_env, env64_field_offsetof(canrestore)); + return dst; +} + +TRANS(RDPR_canrestore, 64, do_rd_special, supervisor(dc), a->rd, + do_rdcanrestore) + +static TCGv do_rdcleanwin(DisasContext *dc, TCGv dst) +{ + tcg_gen_ld32s_tl(dst, tcg_env, env64_field_offsetof(cleanwin)); + return dst; +} + +TRANS(RDPR_cleanwin, 64, do_rd_special, supervisor(dc), a->rd, do_rdcleanwin) + +static TCGv do_rdotherwin(DisasContext *dc, TCGv dst) +{ + tcg_gen_ld32s_tl(dst, tcg_env, env64_field_offsetof(otherwin)); + return dst; +} + +TRANS(RDPR_otherwin, 64, do_rd_special, supervisor(dc), a->rd, do_rdotherwin) + +static TCGv do_rdwstate(DisasContext *dc, TCGv dst) +{ + tcg_gen_ld32s_tl(dst, tcg_env, env64_field_offsetof(wstate)); + return dst; +} + +TRANS(RDPR_wstate, 64, do_rd_special, supervisor(dc), a->rd, do_rdwstate) + +static TCGv do_rdgl(DisasContext *dc, TCGv dst) +{ + tcg_gen_ld32s_tl(dst, tcg_env, env64_field_offsetof(gl)); + return dst; +} + +TRANS(RDPR_gl, GL, do_rd_special, supervisor(dc), a->rd, do_rdgl) + +/* UA2005 strand status */ +static TCGv do_rdssr(DisasContext *dc, TCGv dst) +{ + return cpu_ssr; +} + +TRANS(RDPR_strand_status, HYPV, do_rd_special, hypervisor(dc), a->rd, do_rdssr) + +static TCGv do_rdver(DisasContext *dc, TCGv dst) +{ + return cpu_ver; +} + +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; @@ -3419,133 +3592,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 @@ -4391,7 +4437,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)); } @@ -4401,7 +4447,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)); } @@ -4411,7 +4457,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)); @@ -4422,7 +4468,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)); } @@ -5851,9 +5897,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 Thu Oct 26 00:14: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: 738207 Delivered-To: patch@linaro.org Received: by 2002:adf:f842:0:b0:32d:baff:b0ca with SMTP id d2csp553804wrq; Wed, 25 Oct 2023 17:22:16 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGlSIU/T1F5Lch21CmDhBaceYOs7MO/sLhWiR8Q59ao2qnDwldp2GeP3raEF4z7PVeDNAlL X-Received: by 2002:adf:e606:0:b0:32d:aa62:a8c3 with SMTP id p6-20020adfe606000000b0032daa62a8c3mr11425462wrm.41.1698279736394; Wed, 25 Oct 2023 17:22:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698279736; cv=none; d=google.com; s=arc-20160816; b=ESPPciUAOCuh2e4EsWlfl+aTVwnArQBDvpPOQoog/yCqv003kwF7m0+LFI++wajmPW 2q0r9FKkfYjtO/ijuAGqa3dUg6trcFpnmEFi52lSE6TxvSJJ5ZGBY0TquZgTDzpDX96C u/7+almJHtNcefDnDlo/F6pclarkuPt7F1WHQxnVowb2/hoRraHFiC+YkIwA66zKWEey ZdIEw0yaRzybHOaYMMOzDcKTn4GxzNQ8s70ba+YD40HeNf4u9m/yNf7uAguZDUn6yC5v NecWJn+owdM0niUPniZGZqdPsuccOK+M1xR03dnmer2zR5FB/ef73zrITVEPhA8Xr/DR vxzw== 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=nhTCRa9XqTvPXY/WNnNRGDaEgNbn6sdIYbZhiFVFjNI=; fh=rYI8DiHAAFX3O5g969KmOAQ7d45Sb8OxQX1+DywGDk4=; b=ZRh6nLr7XmWmnrU5RhKc4P0RVx6LhZ0sRx4g5Mnqo8n6NIyCtkyM0Uk73DLQLX0DeU wZUJQF2T5iV1Z557RqQL7wxRV3prf4clbNu3v3k18HaZSswk5JkNw8z0B68H2Rv8w49h KoglYOcsg8/Qnne9vVC2Mq73uEJFFXOS11eQt42YFnoQbbVuyBCzWtZFfxDJiHNauzOe xU2LTegEmX5XkFoIeYz24eBdRJL7jnmq3U7PHW8sCwyragJTvnhcMfSxlV7yUSQvyfk7 IviiYIvQ1HIBOjVH/46K5uBuEkojahfV8/jQkTB+zSB2jm5RZAX6S/4GqcXS8GkRYBmC U1Ww== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=JV43HpWy; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as 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 bj4-20020a0560001e0400b0032daa958d15si8473677wrb.798.2023.10.25.17.22.16 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 25 Oct 2023 17:22:16 -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=JV43HpWy; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as 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 1qvo6N-0001aQ-RL; Wed, 25 Oct 2023 20:19: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 1qvo6A-0000w1-NA for qemu-devel@nongnu.org; Wed, 25 Oct 2023 20:19:44 -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 1qvo5u-0006bk-8J for qemu-devel@nongnu.org; Wed, 25 Oct 2023 20:19:40 -0400 Received: by mail-pl1-x634.google.com with SMTP id d9443c01a7336-1cacde97002so2069285ad.2 for ; Wed, 25 Oct 2023 17:19:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1698279565; x=1698884365; 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=nhTCRa9XqTvPXY/WNnNRGDaEgNbn6sdIYbZhiFVFjNI=; b=JV43HpWyMwwmbz2AaQpmPq3OsUYJ9bK+laqGZjtrdKnqunI7pDQa8a1qmfLRg45FJv KLZmE5vhOiQiUwgUlSm4YZrbxVmu8wSdABxN98lelwOFryrlwjEc35/O/Y3ShgWXfCCq r1S3jL46SvzIPoSc1+ot5vVn1NQ18l03VdLevdE2pog3CRSu+guwsO8Twv60wY+NFqJE ExOupGK2t93oYBgnZZ6/H+OlkKBd8ilIdfOeIVXCB2vYmBugCs5Zr/i0CW0EMmc+Z2AW xRI9ot903qKTCRS/fF/L00sb9g0QpGVslrLDgCt+HuDHZ8E6T2b1Cra6xMzk2k2MIZ3M gVaQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1698279565; x=1698884365; 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=nhTCRa9XqTvPXY/WNnNRGDaEgNbn6sdIYbZhiFVFjNI=; b=rQOcm1O2vGsn1noorjtXhFwk7JIjTydTSa6CHTZGGqSot4A1LcsTQKp7FgfxTDcN8d oh9UWW9P/WJxsYYG4SXQ1G7wKQesT7siolRSZlj71MLfyBMLeBeUoSIE6nLo4ytWhlMJ g+5MH2m34vvCycPTrbBLnv26s7PWXI3jBv5Pa3r/EvjyDdILxSRRdeKl6RBiyMgw0MDp XVSIpFW57Ap5AG+dRitYd5GOfyo6QH9TdPYCdsZXJ0Be+anQePqmwIWgQMGveUvyQjgV gF1Sbqd+AgTSsoG2smH8kgMywmd3qYXBwxGt5kpyrRZRBrNFAyAt0Y7pt5umNxZZMJOt k6pA== X-Gm-Message-State: AOJu0YzMCzgByfPYXko6eKvxiKfWziNNFAiTtWQIfiNdu1d/0ZG0Kk1Y GEdMUz3dL4gGjTjP/L4NRkxn+fN3YHfJ8ig0AII= X-Received: by 2002:a17:902:e54e:b0:1ca:2cd0:2410 with SMTP id n14-20020a170902e54e00b001ca2cd02410mr18669350plf.53.1698279564951; Wed, 25 Oct 2023 17:19:24 -0700 (PDT) Received: from stoup.. ([71.212.149.95]) by smtp.gmail.com with ESMTPSA id jh1-20020a170903328100b001c5fc291ef9sm9754655plb.209.2023.10.25.17.19.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 25 Oct 2023 17:19:24 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: Mark Cave-Ayland Subject: [PULL 25/94] target/sparc: Move RDTBR, FLUSHW to decodetree Date: Wed, 25 Oct 2023 17:14:28 -0700 Message-Id: <20231026001542.1141412-50-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231026001542.1141412-1-richard.henderson@linaro.org> References: <20231026001542.1141412-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::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, 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 Tested-by: Mark Cave-Ayland Acked-by: Mark Cave-Ayland Signed-off-by: Richard Henderson --- target/sparc/insns.decode | 5 +++++ target/sparc/translate.c | 23 +++++++++++------------ 2 files changed, 16 insertions(+), 12 deletions(-) diff --git a/target/sparc/insns.decode b/target/sparc/insns.decode index 7d91a7bc83..0b6f4c9c38 100644 --- a/target/sparc/insns.decode +++ b/target/sparc/insns.decode @@ -76,6 +76,11 @@ RDPR_gl 10 rd:5 101010 10000 0 0000000000000 RDPR_strand_status 10 rd:5 101010 11010 0 0000000000000 RDPR_ver 10 rd:5 101010 11111 0 0000000000000 +{ + FLUSHW 10 00000 101011 00000 0 0000000000000 + RDTBR 10 rd:5 101011 00000 0 0000000000000 +} + Tcc_r 10 0 cond:4 111010 rs1:5 0 cc:1 0000000 rs2:5 { # For v7, the entire simm13 field is present, but masked to 7 bits. diff --git a/target/sparc/translate.c b/target/sparc/translate.c index 6e415d7070..67d3292e68 100644 --- a/target/sparc/translate.c +++ b/target/sparc/translate.c @@ -39,6 +39,7 @@ #ifdef TARGET_SPARC64 # define gen_helper_rdpsr(D, E) qemu_build_not_reached() #else +# define gen_helper_flushw(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_tick_get_count(D, E, T, C) qemu_build_not_reached() @@ -3464,6 +3465,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) @@ -3562,6 +3564,15 @@ 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) +{ + if (avail_64(dc)) { + gen_helper_flushw(tcg_env); + return advance_pc(dc); + } + return false; +} + #define CHECK_IU_FEATURE(dc, FEATURE) \ if (!((dc)->def->features & CPU_FEATURE_ ## FEATURE)) \ goto illegal_insn; @@ -3592,18 +3603,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 Thu Oct 26 00:14: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: 738223 Delivered-To: patch@linaro.org Received: by 2002:adf:f842:0:b0:32d:baff:b0ca with SMTP id d2csp554762wrq; Wed, 25 Oct 2023 17:25:12 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHVj0fOANWRcPBKctXqFdDyCAB1liEXZW5eaNHySEbUm7kyh5PhLkjMJSb0hHnmk3e2CIwz X-Received: by 2002:a2e:9904:0:b0:2c5:17f5:1546 with SMTP id v4-20020a2e9904000000b002c517f51546mr13475141lji.2.1698279912092; Wed, 25 Oct 2023 17:25:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698279912; cv=none; d=google.com; s=arc-20160816; b=H1i+QAXHA2WAbHgND9KyunlcKS50Nsl0p1evLTEdlW7GowHx3U+KMiRO/qUxEULx1a X94+kNyyafnj7t5NCxEOpFmXCCziHPezwp9x4K3HAYuAtykxgDwx38SeMGTGEXpWjc/5 UNbDBOCVLxF8H06BxNMcFYRARzN79rAAYCHiTzTc77GhlIPQjlmts9LxjJAbhWDZRtBN 510C5Cx0tvTsejXqTo3DXH0CkdB0/CSvFbiDK7jTGh2ziklR9TtpNgwDxll22yvXkLD3 d5zRRr5Y+C/2QBlma7WsJjnF9Kvrsjuuq1VDxvECQXBB0Yot3IGXda072v/U+0CJGEUa ncgw== 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=gGK19oqCFLGpJxLElL4pMg6Vo+LqjA3vsLHYvqIIZnI=; fh=rYI8DiHAAFX3O5g969KmOAQ7d45Sb8OxQX1+DywGDk4=; b=a3MY69WersLDta7ROIwAx4PXhbby7Is5DbxqUMELykw6k5TPHQPT11H68O7YdRKey9 /fOjy+3R1gJ1+h6FdlA/bj3Ogf8MsEJUryN1sUYX/oCdFN1m70DJIGsCN2Ns4uCKthBv Sdyj+MSZOQLbbGz2kbcxZJSeROYVcc1pYkX6Bp2ycYiqAC5FHZXqlNmlhKH5Xle4uhmL ArAdD6ckeezc1mpsWozYNCZhaWTJushUqdgYKOKk8Mwn4/xtvybn8xNzmp5NLk1ACP1c CWopNO0faMbYQuFkCUyDF8oCySIvBKQBgMbaypWEKbdIUYhplr+fxpnOBgQrSo4ewpVU I6Jw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=C6iDsB87; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as 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 q10-20020a05600c46ca00b00404f9062e2bsi792418wmo.111.2023.10.25.17.25.11 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 25 Oct 2023 17:25: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=C6iDsB87; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as 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 1qvo6K-0001PU-RY; Wed, 25 Oct 2023 20:19:52 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qvo68-0000v2-KZ for qemu-devel@nongnu.org; Wed, 25 Oct 2023 20:19:42 -0400 Received: from mail-pl1-x633.google.com ([2607:f8b0:4864:20::633]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qvo5v-0006bz-WE for qemu-devel@nongnu.org; Wed, 25 Oct 2023 20:19:40 -0400 Received: by mail-pl1-x633.google.com with SMTP id d9443c01a7336-1c9c5a1b87bso2052185ad.3 for ; Wed, 25 Oct 2023 17:19:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1698279566; x=1698884366; 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=gGK19oqCFLGpJxLElL4pMg6Vo+LqjA3vsLHYvqIIZnI=; b=C6iDsB875m0o75MLLfc4YV7ymxb4u+6k6IZWVJ5N773e1B0/3uG70NlsOdsF3SB3IG PoIwQphNoArMEu3O91xc8tG7vzydEmRhGQ1SXmRylB+mwrD9XzY+/n7CnVWgrkG4t3XN lBEFnMSmtdLBo9Ep7zSwVXaok5v2LVRi1CK8O5dYtjYG7AkQznBrueXAz2r5n4pZc7jJ uYqH2RvLokQ8FEZmminwX26c90NLriXJY0AG7LOMbbfxbSqtTn+zq3mESKsBJMNc66s8 /KzqkcwrGw8VbybsyJrxWiSA7i157f61bJh9crPhwh1bUtPg7J21qjjQBhBu3alafAC8 zFFQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1698279566; x=1698884366; 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=gGK19oqCFLGpJxLElL4pMg6Vo+LqjA3vsLHYvqIIZnI=; b=JOMEggCQNqL5nCzYSvCXycQmT2+Duk5qgXqSbFf1WBBvTII6M386EYjGKKZ2pO+lNd 07dxlzNrSQTZ9OTr++fR74tVOaQ6frioQ57paV/HR40xz2vkvqGV/HMc0lEDPbYzfftB z0KGUcLX7zQo5mNF38LVc0TevgEjuTfxEyBnKYr7CKvcsUhck0olXzgRSbzqIR1cfdWe qj6DP4Sqo9A8rzNhxKkC0nUNipxtfYEnRNboOrUpmPCu7jQ/8YasSo6qJWV+A2Jqz5uk bo1SEEoTUjwfz6jxn2H5vJDEcAivavlc/Vv9aad2B1giazh1NjK4GPFjsJbD2K1MZ+zb G27Q== X-Gm-Message-State: AOJu0YwRXxUzeuX1E7iDj8kOBod0j0AswDG05LSNc5+y/okOsaJMSHay ug/FhWOwM/WKC1vKx9S59KU7aBqT2BUqRWv/NCg= X-Received: by 2002:a17:903:2305:b0:1bb:b74c:88f6 with SMTP id d5-20020a170903230500b001bbb74c88f6mr15582295plh.16.1698279566498; Wed, 25 Oct 2023 17:19:26 -0700 (PDT) Received: from stoup.. ([71.212.149.95]) by smtp.gmail.com with ESMTPSA id jh1-20020a170903328100b001c5fc291ef9sm9754655plb.209.2023.10.25.17.19.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 25 Oct 2023 17:19:26 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: Mark Cave-Ayland Subject: [PULL 26/94] target/sparc: Move WRASR to decodetree Date: Wed, 25 Oct 2023 17:14:30 -0700 Message-Id: <20231026001542.1141412-52-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231026001542.1141412-1-richard.henderson@linaro.org> References: <20231026001542.1141412-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::633; envelope-from=richard.henderson@linaro.org; helo=mail-pl1-x633.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org Tested-by: Mark Cave-Ayland Acked-by: Mark Cave-Ayland Signed-off-by: Richard Henderson --- target/sparc/insns.decode | 31 ++++ target/sparc/translate.c | 341 +++++++++++++++++++++----------------- 2 files changed, 216 insertions(+), 156 deletions(-) diff --git a/target/sparc/insns.decode b/target/sparc/insns.decode index 0b6f4c9c38..118f0f1f17 100644 --- a/target/sparc/insns.decode +++ b/target/sparc/insns.decode @@ -22,6 +22,13 @@ SETHI 00 rd:5 100 i:22 CALL 01 i:s30 +## +## Major Opcode 10 -- integer, floating-point, vis, and system insns. +## + +&r_r_ri rd rs1 rs2_or_imm imm:bool +@n_r_ri .. ..... ...... rs1:5 imm:1 rs2_or_imm:s13 &r_r_ri rd=0 + { [ STBAR 10 00000 101000 01111 0 0000000000000 @@ -44,6 +51,30 @@ CALL 01 i:s30 RDY 10 rd:5 101000 rs1:5 0 0000000000000 } +{ + [ + WRY 10 00000 110000 ..... . ............. @n_r_ri + WRCCR 10 00010 110000 ..... . ............. @n_r_ri + WRASI 10 00011 110000 ..... . ............. @n_r_ri + WRFPRS 10 00110 110000 ..... . ............. @n_r_ri + { + WRGSR 10 10011 110000 ..... . ............. @n_r_ri + WRPOWERDOWN 10 10011 110000 ..... . ............. @n_r_ri + } + WRSOFTINT_SET 10 10100 110000 ..... . ............. @n_r_ri + WRSOFTINT_CLR 10 10101 110000 ..... . ............. @n_r_ri + WRSOFTINT 10 10110 110000 ..... . ............. @n_r_ri + WRTICK_CMPR 10 10111 110000 ..... . ............. @n_r_ri + WRSTICK 10 11000 110000 ..... . ............. @n_r_ri + WRSTICK_CMPR 10 11001 110000 ..... . ............. @n_r_ri + ] + # Before v8, rs1==0 was WRY, and the rest executed as nop. + [ + NOP_v7 10 ----- 110000 ----- 0 00000000 ----- + NOP_v7 10 ----- 110000 ----- 1 -------- ----- + ] +} + { RDPSR 10 rd:5 101001 00000 0 0000000000000 RDHPR_hpstate 10 rd:5 101001 00000 0 0000000000000 diff --git a/target/sparc/translate.c b/target/sparc/translate.c index 67d3292e68..83716307f6 100644 --- a/target/sparc/translate.c +++ b/target/sparc/translate.c @@ -38,11 +38,16 @@ #ifdef TARGET_SPARC64 # define gen_helper_rdpsr(D, E) qemu_build_not_reached() +# define gen_helper_power_down(E) qemu_build_not_reached() #else +# define gen_helper_clear_softint(E, S) qemu_build_not_reached() # define gen_helper_flushw(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_set_softint(E, S) qemu_build_not_reached() # define gen_helper_tick_get_count(D, E, T, C) qemu_build_not_reached() +# define gen_helper_wrccr(E, S) qemu_build_not_reached() +# define gen_helper_write_softint(E, S) qemu_build_not_reached() # define MAXTL_MASK 0 #endif @@ -2866,12 +2871,14 @@ static void gen_faligndata(TCGv dst, TCGv gsr, TCGv s1, TCGv s2) #ifdef TARGET_SPARC64 # define avail_32(C) false # define avail_ASR17(C) false +# define avail_POWERDOWN(C) false # define avail_64(C) true # define avail_GL(C) ((C)->def->features & CPU_FEATURE_GL) # define avail_HYPV(C) ((C)->def->features & CPU_FEATURE_HYPV) #else # define avail_32(C) true # define avail_ASR17(C) ((C)->def->features & CPU_FEATURE_ASR17) +# define avail_POWERDOWN(C) ((C)->def->features & CPU_FEATURE_POWERDOWN) # define avail_64(C) false # define avail_GL(C) false # define avail_HYPV(C) false @@ -3077,6 +3084,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) { @@ -3573,6 +3584,179 @@ static bool trans_FLUSHW(DisasContext *dc, arg_FLUSHW *a) return false; } +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) +{ + TCGv tmp = tcg_temp_new(); + + tcg_gen_ext8u_tl(tmp, src); + tcg_gen_st32_tl(tmp, tcg_env, env64_field_offsetof(asi)); + /* End TB to notice changed ASI. */ + dc->base.is_jmp = DISAS_EXIT; +} + +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) +{ + gen_trap_ifnofpu(dc); + tcg_gen_mov_tl(cpu_gsr, src); +} + +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; @@ -4233,162 +4417,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 Thu Oct 26 00:14: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: 738228 Delivered-To: patch@linaro.org Received: by 2002:adf:f842:0:b0:32d:baff:b0ca with SMTP id d2csp555135wrq; Wed, 25 Oct 2023 17:26:23 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFDx/px8LziUpx+P0Y8ZLYhV74umyMna6DDkPmp9SR4+9+N4OApFXblmdk6KF1dkiSWgkNF X-Received: by 2002:a05:600c:4f01:b0:405:3cc5:1105 with SMTP id l1-20020a05600c4f0100b004053cc51105mr13287521wmq.8.1698279983344; Wed, 25 Oct 2023 17:26:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698279983; cv=none; d=google.com; s=arc-20160816; b=gqF32986UFfFhr2C5iVpXZt6+M1TCDHcZtcC2CRPZY/RuhJ52u6eGJBIgnHkdklnLN 0K1FOMMErDYtvXtqmWM63lp64tofx4qN21qWQh2Ql675nu8zJO03uDqaBEeOcNuxaKRJ FFs5yXU/zoBAXaMN/JaPBH1Vh/pUJifmhNPXnlc/fDP7093JMeG9bK+5SQqBj5aIGH0H MUtrtmtVnPMaNFDOz/zDAXYv9RemokmhtcpEeqDQ2JyiAxzEXB9aC+E+Qgf/cwWBYBl2 5c5VvObFX7Nk09Y3ekbywaShqgpTbVhK1zOYF2gMC7pyPjKcTXUyGOgRM0267L85kcqK LNdQ== 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:to:from :dkim-signature; bh=Qt73rqnYlScESAX1GLvymJtn101eThzhHh8tymn5hTE=; fh=PnYt+qEB9tAfMKoqBm2xjKOFpYyFFGPudh5cVIoieJM=; b=Whov5f+dgzJiR4KK4a72JfVfWA6SKcHoQFzZWG0A/2yFvJgmSi3z82OFgHBYI0BH3x Ys1uX8JyqWtwIfH60Skuvec24qnk1lDv28HOoIYPU/TTyROSJSbresmTfnL7dAQlJo2R JeyCFiistHzz2h+tWiGPtjtXsSeNHBOFWiYgJcc2/1VN2/CmACUm7wiSjnRsoIhQ/BwE ClqpCMWJSx3sk6O5q875Ea/If5YK4kgqcaqTQGfcOiuV2xJCs3LN6moaB9UTIrbbyhIE pwrh84EQ8KTcGqYP1JVU3E6wR/fUsDiXPBnphSghfyiDCfOsuYf1Y0pDzlzX8pbPMrDg xyYA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=DULBObys; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as 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 y4-20020a5d6144000000b003216429c97dsi8254675wrt.515.2023.10.25.17.26.23 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 25 Oct 2023 17:26: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=DULBObys; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as 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 1qvo6j-0002Cm-Fa; Wed, 25 Oct 2023 20:20:17 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qvo6B-0000z0-NN for qemu-devel@nongnu.org; Wed, 25 Oct 2023 20:19:44 -0400 Received: from mail-pl1-x62c.google.com ([2607:f8b0:4864:20::62c]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qvo5x-0006cE-6s for qemu-devel@nongnu.org; Wed, 25 Oct 2023 20:19:42 -0400 Received: by mail-pl1-x62c.google.com with SMTP id d9443c01a7336-1caad0bcc95so2218955ad.0 for ; Wed, 25 Oct 2023 17:19:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1698279568; x=1698884368; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=Qt73rqnYlScESAX1GLvymJtn101eThzhHh8tymn5hTE=; b=DULBObys5g8APW5N3EyCjBIjqk38rVMbS3j/IPPe4p/LVP851+zrv/EzwxX5+aWlXX 9pkZdH60R0AF5V4RL0oKXe3CJ8F3bIQYsiiHgVCczc5IEOmEeHSf+n2/4BgxuIjiPJsj vk4fEtBk4ewHiSO12Y61y2seKoZvFFqeRzUPWgPY9CLz77koPT0iiBfWPj4BNIHaXg9Y VSrIEKHuxI7snLaPW3NFU+2ERlkqgB64MYQQJQpCC51lOycUMrAqUsYSLJMOSsuXpC9K ++XAKvVhckZMPl93aEb3ehT8DUl9EgmxG1oGqcUVujQW0rEOvLrr2ONlH/SO255L8mqL QyNw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1698279568; x=1698884368; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=Qt73rqnYlScESAX1GLvymJtn101eThzhHh8tymn5hTE=; b=HqOwYxAfn9MoxxxDNXupFM/bIHqdRCDfJbMROFNvLGn70Gu2K3BuM9rXfKVk22Wu8k 3hyHElRVlE2svprDR2RobWPwNP2Ji2Yxcd9ggSrVs8DaQM6t+W5YOKXOETuFSfTD+B5Z 0dfbpcdIf7DcuWbC5TqZ4cigP8znCp29UtR0/J9iUr34bYGycD+SxtkPKwK+h5SigRWB xu79DUI0m0zOfc5V9NAJBgk4Nysr59tR91e00llkupizrN7MS8YIgJGxqriwUZokbzmJ O726FA+QyGW0FqqOqKgdVNMkr0dvJh4R0+yoPTZDyphO6VU7TFpgCg2okpWunSSCuMiv MhdQ== X-Gm-Message-State: AOJu0Yy86dXGuycUmu9A1kZ8hW21d3m/fT6BbIIxmYXbohwZWxsJmWOW VKc8T2BH0jgrsB0/d6XVnS5qTyBZaNCjCvJIwYw= X-Received: by 2002:a17:902:fa87:b0:1c9:de48:fc78 with SMTP id lc7-20020a170902fa8700b001c9de48fc78mr14022761plb.7.1698279567902; Wed, 25 Oct 2023 17:19:27 -0700 (PDT) Received: from stoup.. ([71.212.149.95]) by smtp.gmail.com with ESMTPSA id jh1-20020a170903328100b001c5fc291ef9sm9754655plb.209.2023.10.25.17.19.27 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 25 Oct 2023 17:19:27 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH 27/29] target/alpha: Use TCG_COND_TST{EQ,NE} for BLB{C,S} Date: Wed, 25 Oct 2023 17:14:32 -0700 Message-Id: <20231026001542.1141412-54-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231026001542.1141412-1-richard.henderson@linaro.org> References: <20231026001542.1141412-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::62c; envelope-from=richard.henderson@linaro.org; helo=mail-pl1-x62c.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org Signed-off-by: Richard Henderson --- target/alpha/translate.c | 39 ++++++++++++++++----------------------- 1 file changed, 16 insertions(+), 23 deletions(-) diff --git a/target/alpha/translate.c b/target/alpha/translate.c index 32333081d8..49e6a7b62d 100644 --- a/target/alpha/translate.c +++ b/target/alpha/translate.c @@ -453,13 +453,13 @@ static DisasJumpType gen_bdirect(DisasContext *ctx, int ra, int32_t disp) } static DisasJumpType gen_bcond_internal(DisasContext *ctx, TCGCond cond, - TCGv cmp, int32_t disp) + TCGv cmp, uint64_t imm, int32_t disp) { uint64_t dest = ctx->base.pc_next + (disp << 2); TCGLabel *lab_true = gen_new_label(); if (use_goto_tb(ctx, dest)) { - tcg_gen_brcondi_i64(cond, cmp, 0, lab_true); + tcg_gen_brcondi_i64(cond, cmp, imm, lab_true); tcg_gen_goto_tb(0); tcg_gen_movi_i64(cpu_pc, ctx->base.pc_next); @@ -472,27 +472,20 @@ static DisasJumpType gen_bcond_internal(DisasContext *ctx, TCGCond cond, return DISAS_NORETURN; } else { - TCGv_i64 z = load_zero(ctx); + TCGv_i64 i = tcg_constant_i64(imm); TCGv_i64 d = tcg_constant_i64(dest); TCGv_i64 p = tcg_constant_i64(ctx->base.pc_next); - tcg_gen_movcond_i64(cond, cpu_pc, cmp, z, d, p); + tcg_gen_movcond_i64(cond, cpu_pc, cmp, i, d, p); return DISAS_PC_UPDATED; } } static DisasJumpType gen_bcond(DisasContext *ctx, TCGCond cond, int ra, - int32_t disp, int mask) + int32_t disp) { - if (mask) { - TCGv tmp = tcg_temp_new(); - DisasJumpType ret; - - tcg_gen_andi_i64(tmp, load_gpr(ctx, ra), 1); - ret = gen_bcond_internal(ctx, cond, tmp, disp); - return ret; - } - return gen_bcond_internal(ctx, cond, load_gpr(ctx, ra), disp); + return gen_bcond_internal(ctx, cond, load_gpr(ctx, ra), + is_tst_cond(cond), disp); } /* Fold -0.0 for comparison with COND. */ @@ -533,7 +526,7 @@ static DisasJumpType gen_fbcond(DisasContext *ctx, TCGCond cond, int ra, DisasJumpType ret; gen_fold_mzero(cond, cmp_tmp, load_fpr(ctx, ra)); - ret = gen_bcond_internal(ctx, cond, cmp_tmp, disp); + ret = gen_bcond_internal(ctx, cond, cmp_tmp, 0, disp); return ret; } @@ -2827,35 +2820,35 @@ static DisasJumpType translate_one(DisasContext *ctx, uint32_t insn) break; case 0x38: /* BLBC */ - ret = gen_bcond(ctx, TCG_COND_EQ, ra, disp21, 1); + ret = gen_bcond(ctx, TCG_COND_TSTEQ, ra, disp21); break; case 0x39: /* BEQ */ - ret = gen_bcond(ctx, TCG_COND_EQ, ra, disp21, 0); + ret = gen_bcond(ctx, TCG_COND_EQ, ra, disp21); break; case 0x3A: /* BLT */ - ret = gen_bcond(ctx, TCG_COND_LT, ra, disp21, 0); + ret = gen_bcond(ctx, TCG_COND_LT, ra, disp21); break; case 0x3B: /* BLE */ - ret = gen_bcond(ctx, TCG_COND_LE, ra, disp21, 0); + ret = gen_bcond(ctx, TCG_COND_LE, ra, disp21); break; case 0x3C: /* BLBS */ - ret = gen_bcond(ctx, TCG_COND_NE, ra, disp21, 1); + ret = gen_bcond(ctx, TCG_COND_TSTNE, ra, disp21); break; case 0x3D: /* BNE */ - ret = gen_bcond(ctx, TCG_COND_NE, ra, disp21, 0); + ret = gen_bcond(ctx, TCG_COND_NE, ra, disp21); break; case 0x3E: /* BGE */ - ret = gen_bcond(ctx, TCG_COND_GE, ra, disp21, 0); + ret = gen_bcond(ctx, TCG_COND_GE, ra, disp21); break; case 0x3F: /* BGT */ - ret = gen_bcond(ctx, TCG_COND_GT, ra, disp21, 0); + ret = gen_bcond(ctx, TCG_COND_GT, ra, disp21); break; invalid_opc: ret = gen_invalid(ctx); From patchwork Thu Oct 26 00:14: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: 738274 Delivered-To: patch@linaro.org Received: by 2002:adf:f842:0:b0:32d:baff:b0ca with SMTP id d2csp559135wrq; Wed, 25 Oct 2023 17:38:23 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFCWoI1Ji+As3HnZ1Z495aarduLwarACTJ34A0B88fCguAxbI/ec+IWFb2bVzlJZHVi+GCU X-Received: by 2002:adf:f151:0:b0:32d:82f7:e76 with SMTP id y17-20020adff151000000b0032d82f70e76mr13556000wro.34.1698280703127; Wed, 25 Oct 2023 17:38:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698280703; cv=none; d=google.com; s=arc-20160816; b=YPyTgu31qJ0k/jQaDmIEv+F1C2MoVaub30VhJ/wrPZckJHABSdx/+i4XoNmKECl78V jGQoirytxozcE5i2UCWs/nbeOTrYJUcS7x1hPSSIWpmwYqqDpie2GH3L1gBhF2Zn7/ND u5tvuuq+rDzgTPieQMwD3gpcg6DWn7r2+zTkfLOU7wxtOQ0u9CYt+Nj4/7rYtG5WIeS5 kXPYQhFYDTckxu0hcUEPGS+2i8sacjESx/MI0atAb81vmnUygfmUKwAxoIuNwKpXBPY6 ypq76nTWtmNul1cLcHCtVEbq8m2M4Md5/tCcDnjSWaMQGtNpLpK8w6HrOC3jyNB+lqqB 3jmw== 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:to:from :dkim-signature; bh=EHAeumhj/k6eiqLtdrKjjL6mwObgsX5DY/BFSjKBF5I=; fh=PnYt+qEB9tAfMKoqBm2xjKOFpYyFFGPudh5cVIoieJM=; b=J7kz7c5+gCqvpKDzLRKGZ4NuMOnxBmXoIrIRsCPIo3P/hNC3vxPA/Z04lm9y1SmjPD q9l2ZUhwtnOzRtwOe8tno4GcCkEXGLLJX3i3ZCqkAnWtE7EZMvoMfYz6iGIrYiispONq r2hO/oUQPOWVu+3cw1mCJvJ3QP98eH37gIEwa5sCCJXm6qLXX8hIjPylYfY1OAM0vWeO SfEwFIG92Yf8ZGo7rY7o+8m0hupnE60Y6GXXWe41G7n8DvL99AUFMZWruUZEy8mAkgln SPtmRKZUi1eTjTdewzn3ghwA59ccTcQOkHwr+jEokqfk3wJAwWS7rYeYCuQFs6loezlg xo9Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=mgt5qT0D; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as 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 co21-20020a0560000a1500b0032da688fd9csi8703908wrb.852.2023.10.25.17.38.23 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 25 Oct 2023 17:38: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=mgt5qT0D; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as 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 1qvo6c-0001yL-8Z; Wed, 25 Oct 2023 20:20:10 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qvo6A-0000wZ-O8 for qemu-devel@nongnu.org; Wed, 25 Oct 2023 20:19:44 -0400 Received: from mail-pl1-x62c.google.com ([2607:f8b0:4864:20::62c]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qvo5y-0006ci-KC for qemu-devel@nongnu.org; Wed, 25 Oct 2023 20:19:42 -0400 Received: by mail-pl1-x62c.google.com with SMTP id d9443c01a7336-1c9e95aa02dso2342595ad.0 for ; Wed, 25 Oct 2023 17:19:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1698279569; x=1698884369; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=EHAeumhj/k6eiqLtdrKjjL6mwObgsX5DY/BFSjKBF5I=; b=mgt5qT0DBNwI4mrDNeTLnRe01XVQC7ohviSstpeIz5KWPmyNSlvI9t19YASv2pKm2i k3e7p1qM3XolTsVgZicNUhxV8ZJt8SbK6UUbN/1vkAXcW8rK2JBU6Lj42xqQcAl9T0YB bLZK2OuB6e5khUZ9oTZM9h6mANkoqVwXBJbYtbRWRX/0OBOA02TK5/dJanziAxfGKdvX v3nCDDD6k/eCZw3d+0Fn7q5WUtj+1I8jcE3YCG9EtMJGa21ztmzomY6IHBAcqU32sN6q EXpf5Yf9eN/bGJNFse1hCZTWjR0tVsA7yXGD8RFbybbbC065F2+OTLLkq6/2CcjYbr4g 7HDQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1698279569; x=1698884369; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=EHAeumhj/k6eiqLtdrKjjL6mwObgsX5DY/BFSjKBF5I=; b=lHsJjQeyMtjxT7loZbAQaUNFHZbzKKGPyefHlpbE5wSgaYeIOZRrrzpNLixs5elOWl lM4KrULFfS30ypGWtdg9giDUjlxCcvETtHTmTxFTUPz1X0aFtV7QPM8XRsqh7QT2Q7TD o6zueZdwX3MqkST5R/9+82yAWjTfN3CJfPA5ogZnqKyTTlA2KtHm+I79S5k87cjqwOvt +OEYpbIL6HbMiRUYcz0bhK1vBfZR6SivLqOmX71dQ8wuFTCnMvhFIIW8IBvp8b3el9Xq RP9PkhqDQIZBkrcb6ofJ3gilHEGbstfaKvHP5q2BAywcqf5VZ1p/xFmh6fxF2GJR6fHT pmbg== X-Gm-Message-State: AOJu0YzKUDpGPbPmx3amOCfuqWohmFI/m/MtLjgcGiik/hlz4ct+N1mw lhFsBH0wd8lI2WjwIkbJhWGBVt+4HKqGe3y9GnU= X-Received: by 2002:a17:902:e883:b0:1c5:c546:fece with SMTP id w3-20020a170902e88300b001c5c546fecemr1530817plg.34.1698279569435; Wed, 25 Oct 2023 17:19:29 -0700 (PDT) Received: from stoup.. ([71.212.149.95]) by smtp.gmail.com with ESMTPSA id jh1-20020a170903328100b001c5fc291ef9sm9754655plb.209.2023.10.25.17.19.28 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 25 Oct 2023 17:19:29 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH 28/29] target/alpha: Use TCG_COND_TST{EQ,NE} for CMOVLB{C,S} Date: Wed, 25 Oct 2023 17:14:34 -0700 Message-Id: <20231026001542.1141412-56-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231026001542.1141412-1-richard.henderson@linaro.org> References: <20231026001542.1141412-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::62c; envelope-from=richard.henderson@linaro.org; helo=mail-pl1-x62c.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org Signed-off-by: Richard Henderson --- target/alpha/translate.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/target/alpha/translate.c b/target/alpha/translate.c index 49e6a7b62d..c7daf46de7 100644 --- a/target/alpha/translate.c +++ b/target/alpha/translate.c @@ -1676,16 +1676,12 @@ static DisasJumpType translate_one(DisasContext *ctx, uint32_t insn) break; case 0x14: /* CMOVLBS */ - tmp = tcg_temp_new(); - tcg_gen_andi_i64(tmp, va, 1); - tcg_gen_movcond_i64(TCG_COND_NE, vc, tmp, load_zero(ctx), + tcg_gen_movcond_i64(TCG_COND_TSTNE, vc, va, tcg_constant_i64(1), vb, load_gpr(ctx, rc)); break; case 0x16: /* CMOVLBC */ - tmp = tcg_temp_new(); - tcg_gen_andi_i64(tmp, va, 1); - tcg_gen_movcond_i64(TCG_COND_EQ, vc, tmp, load_zero(ctx), + tcg_gen_movcond_i64(TCG_COND_TSTEQ, vc, va, tcg_constant_i64(1), vb, load_gpr(ctx, rc)); break; case 0x20: From patchwork Thu Oct 26 00:14: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: 738209 Delivered-To: patch@linaro.org Received: by 2002:adf:f842:0:b0:32d:baff:b0ca with SMTP id d2csp553856wrq; Wed, 25 Oct 2023 17:22:23 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFueFbcH18dvxQwLOPx27eEAZiSRIzB65hvGiykG6pOhiesUslwgGWR6yCMSjq8POjWdWHy X-Received: by 2002:adf:f5c8:0:b0:32d:8acb:c292 with SMTP id k8-20020adff5c8000000b0032d8acbc292mr11037599wrp.16.1698279743613; Wed, 25 Oct 2023 17:22:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698279743; cv=none; d=google.com; s=arc-20160816; b=vyI18UGyP6ODDNs+OU1nFLwVRRJ+Gwn2naGbrM6PyY1IHbSReAkdVgD46d73QqEEma n+b4r3BNz8WCJPhWOFrlW8KHviOt/+yKYfbCPlr/ixpA5PBOlpx4IVbnw+c69vHjJOHv zMwSTizpBIeA3xER+QZ+tmQUQ/bQvW7lLlJ6uLcTiNs3aFgtsibSyEiKBoPI/TRjKXZW 1up4X9LBkn9wbRyH/nVuxVbXGXzGVzChlISj8OfULEW1mLvNzUvN8eVGcJzl4DqsD/1p uWJC1aAoIpyxt/hJat5zaw2WYcW+sJkvYOU4VpqgChOkpMc5q09h6394bBurDsHAts8a RkjQ== 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:to:from :dkim-signature; bh=jVGlwsfbm4sLINQJ1C25FK0LHbR26UwjjqtCg2xAyg8=; fh=PnYt+qEB9tAfMKoqBm2xjKOFpYyFFGPudh5cVIoieJM=; b=eny1scThk/Hrq+xH6kjLoa8ga/kyxd+y62YjOUq7P/U/H6w4X1cVdCCDMdY8pLbIAr REV7yHg/Po6hAq/NZS9Rs+6KYiYWT9JImer6+yOTgIZ+BvE/jub7SkA+und5ysYhN5iJ 8/ShTCVl86b6avBFr7EiHp9ZRIj+07d3K1qLF2OzwewCbzZkUbh/lULheSfjAbSUVG/Q mYJHCeitu/BvsejX7GWD09N95j5fEFmQx3eHAfEKb5HMs7h1BPPKWKrxZ+Dwb7z+tPAn 1Vjl0WtM9MNHD3nVnuNs5O+Mlt3BQ3iQ0nlu/qlfEbzTkoj9j8O+dZvgtNrfmaaXdYTW /IIA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=FeJMXiYG; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as 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 j9-20020a5d4649000000b003196dba12f9si8646167wrs.864.2023.10.25.17.22.23 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 25 Oct 2023 17:22: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=FeJMXiYG; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as 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 1qvo6G-0001Dg-VP; Wed, 25 Oct 2023 20:19:50 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qvo6B-0000yz-Mx for qemu-devel@nongnu.org; Wed, 25 Oct 2023 20:19:44 -0400 Received: from mail-pl1-x636.google.com ([2607:f8b0:4864:20::636]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qvo61-0006d3-KB for qemu-devel@nongnu.org; Wed, 25 Oct 2023 20:19:43 -0400 Received: by mail-pl1-x636.google.com with SMTP id d9443c01a7336-1cbf47fa563so2294255ad.2 for ; Wed, 25 Oct 2023 17:19:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1698279571; x=1698884371; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=jVGlwsfbm4sLINQJ1C25FK0LHbR26UwjjqtCg2xAyg8=; b=FeJMXiYGlpWU+R4zX53zg7iprgSjuBBAFS2uUI1P3LyrWoauPOkKSrgBHCvad3MUt4 sBFqjzRKA0tVeUtj03z2HFky4k/cfibXmLhVcu2s4eFr9UFz6H0Qkl/Rv8zbo2cHWYF1 FzxhPpoAwSlWmulFv5YpcRXNK2w2v0I5liK2hhZle1LBkrP8nTBm/FiFW23o3hM6o8mP Mgae4Valtq4JM6SxIeupEIw8raWsbEwQ4/ZXGz00kltWXyfbMwlkmChBh7uilo4eNLsu CS/kz6qQwqTjBrdHvmNCTl3i654XuwUjNnaYq3zYKOsLotKNFw009a3RCN6aLyobbTnR 7/4A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1698279571; x=1698884371; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=jVGlwsfbm4sLINQJ1C25FK0LHbR26UwjjqtCg2xAyg8=; b=XO8Jw/JnvlIjQwitRoDjNG3RY6Yw4IR0MyGRjcSOm7ANPdIPZK2aXmq6euh6l4YkOe vKcN0IJdsn44XeIGjG1izpZuYqRwXZCLQdtRnOZYVJMxrhokBxlE9ypzEvsudKQ8rT8B Rf51XE77iJENOgzQsEK0easc6fFbDRfZwV6Q2lH2P2k2DpwYCQGAmo7MqFLfA2/0t5tg TXXKW1zn3HPxvk8E3Kn/XY33Y6jiG1VnrTU7ouHcTsOGpATJRCm62geSTZBUQbamPmdk Y4NkhmuCJoR26NkkckN0nqvGNE7jBNLTVAY4UbBRxShXXe6z4iRadXlqzYXgbz9z/+Pb JOtQ== X-Gm-Message-State: AOJu0YyPXuHkcx8ruKseCJ+S0h1HZbZuDVDQBu6f9FlRMlavTZYJmY67 10HJpHpD+unvlcyeC0hM1sF6I1v6Vun0U66ZWwU= X-Received: by 2002:a17:902:d2c1:b0:1c7:495c:87df with SMTP id n1-20020a170902d2c100b001c7495c87dfmr17741585plc.53.1698279571171; Wed, 25 Oct 2023 17:19:31 -0700 (PDT) Received: from stoup.. ([71.212.149.95]) by smtp.gmail.com with ESMTPSA id jh1-20020a170903328100b001c5fc291ef9sm9754655plb.209.2023.10.25.17.19.30 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 25 Oct 2023 17:19:30 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH 29/29] target/alpha: Use TCG_COND_TSTNE for gen_fold_mzero Date: Wed, 25 Oct 2023 17:14:36 -0700 Message-Id: <20231026001542.1141412-58-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231026001542.1141412-1-richard.henderson@linaro.org> References: <20231026001542.1141412-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::636; envelope-from=richard.henderson@linaro.org; helo=mail-pl1-x636.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/alpha/translate.c | 49 +++++++++++++++++++--------------------- 1 file changed, 23 insertions(+), 26 deletions(-) diff --git a/target/alpha/translate.c b/target/alpha/translate.c index c7daf46de7..c68c2bcd21 100644 --- a/target/alpha/translate.c +++ b/target/alpha/translate.c @@ -490,56 +490,53 @@ static DisasJumpType gen_bcond(DisasContext *ctx, TCGCond cond, int ra, /* Fold -0.0 for comparison with COND. */ -static void gen_fold_mzero(TCGCond cond, TCGv dest, TCGv src) +static TCGv_i64 gen_fold_mzero(TCGCond *pcond, uint64_t *pimm, TCGv_i64 src) { - uint64_t mzero = 1ull << 63; + TCGv_i64 tmp; - switch (cond) { + *pimm = 0; + switch (*pcond) { case TCG_COND_LE: case TCG_COND_GT: /* For <= or >, the -0.0 value directly compares the way we want. */ - tcg_gen_mov_i64(dest, src); - break; + return src; case TCG_COND_EQ: case TCG_COND_NE: - /* For == or !=, we can simply mask off the sign bit and compare. */ - tcg_gen_andi_i64(dest, src, mzero - 1); - break; + /* For == or !=, we can compare without the sign bit. */ + *pcond = *pcond == TCG_COND_EQ ? TCG_COND_TSTEQ : TCG_COND_TSTNE; + *pimm = INT64_MAX; + return src; case TCG_COND_GE: case TCG_COND_LT: /* For >= or <, map -0.0 to +0.0. */ - tcg_gen_movcond_i64(TCG_COND_NE, dest, src, tcg_constant_i64(mzero), - src, tcg_constant_i64(0)); - break; + tmp = tcg_temp_new_i64(); + tcg_gen_movcond_i64(TCG_COND_EQ, tmp, + src, tcg_constant_i64(INT64_MIN), + tcg_constant_i64(0), src); + return tmp; default: - abort(); + g_assert_not_reached(); } } static DisasJumpType gen_fbcond(DisasContext *ctx, TCGCond cond, int ra, int32_t disp) { - TCGv cmp_tmp = tcg_temp_new(); - DisasJumpType ret; - - gen_fold_mzero(cond, cmp_tmp, load_fpr(ctx, ra)); - ret = gen_bcond_internal(ctx, cond, cmp_tmp, 0, disp); - return ret; + uint64_t imm; + TCGv_i64 tmp = gen_fold_mzero(&cond, &imm, load_fpr(ctx, ra)); + return gen_bcond_internal(ctx, cond, tmp, imm, disp); } static void gen_fcmov(DisasContext *ctx, TCGCond cond, int ra, int rb, int rc) { - TCGv_i64 va, vb, z; - - z = load_zero(ctx); - vb = load_fpr(ctx, rb); - va = tcg_temp_new(); - gen_fold_mzero(cond, va, load_fpr(ctx, ra)); - - tcg_gen_movcond_i64(cond, dest_fpr(ctx, rc), va, z, vb, load_fpr(ctx, rc)); + uint64_t imm; + TCGv_i64 tmp = gen_fold_mzero(&cond, &imm, load_fpr(ctx, ra)); + tcg_gen_movcond_i64(cond, dest_fpr(ctx, rc), + tmp, tcg_constant_i64(imm), + load_fpr(ctx, rb), load_fpr(ctx, rc)); } #define QUAL_RM_N 0x080 /* Round mode nearest even */ From patchwork Thu Oct 26 00:14: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: 738270 Delivered-To: patch@linaro.org Received: by 2002:adf:f842:0:b0:32d:baff:b0ca with SMTP id d2csp558911wrq; Wed, 25 Oct 2023 17:37:42 -0700 (PDT) X-Google-Smtp-Source: AGHT+IG+QuTr/qnqOsI3rC1ciYmuWiBhhd6LnDnISv03E9LPe1+mDiqFvbOiO2ekMxXRkX5/lbKM X-Received: by 2002:a50:9b19:0:b0:53f:c889:8f89 with SMTP id o25-20020a509b19000000b0053fc8898f89mr12138411edi.36.1698280662225; Wed, 25 Oct 2023 17:37:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698280662; cv=none; d=google.com; s=arc-20160816; b=lVoySNU1HcwWnv3SMTs5QkzLan1Y+mpLmEA50P0Dk2RGN6xEjVzpmqg2MCpdc5DwpQ jN94bZ9grcnzNAzD0RZpYfXYI7mOgxgS5rupIEgVslHJ/xozKYbZztrhi7li0Os55wsN taZpJI52I8uIH9EZZNeaGNdz8UAWQeEI/fM+FhVYzqeECmV4MqfDa/VtZC3/HlHhtWzR p/cdXOqWxjacJrg/tV3dG1q8XA1wva0rEwWbuSdIs26W2mRj7oeB7jhZN6YH4bqg9S3o +g8TNIr9T41K/tQP2JCO1DqZTOJtIjBbYy3Vqfy5cbFEjJV+DzonAyIL6WoE2yPSu/9V D8XQ== 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:to:from :dkim-signature; bh=qScZs44s00L/oLLs4eIUKTqGk+BatBxWrSAikGLStjw=; fh=PnYt+qEB9tAfMKoqBm2xjKOFpYyFFGPudh5cVIoieJM=; b=n92DUabNCyijG1NxQdJ+F3xDy438g8WuTvtumwv1OIq9WJJrbe572K9gU/N0DuWRZc unxNh3Z8GyJrLdKF/vx8HfgTiUAInx6QQdaLlAWXwmufMmQM4R2tJo+N3NQkWAqeaLbX K9B7yFP+OVqe2U19UiD5rahTv5WQxfYrmfDU/qibun56lCxbTylPlP65dZnfSBaKkHYw fYeDoO9OpqfleRIQVhC4tzzpPQn0HAvVFAocqDo3+Xe0xfn0QtrC5aLyjsAw4aMS/7NU xRU7y8v5x4Dl3r/45bRGvrNa6RSZfjVJqPTks1w2uTxyKnkd5HLD2hRmxbAwyTFpglyi X+BQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=CQpL95Tq; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as 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 s3-20020a056402520300b0053e4940dc45si6082134edd.301.2023.10.25.17.37.42 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 25 Oct 2023 17:37: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=CQpL95Tq; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as 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 1qvo6f-00026j-KN; Wed, 25 Oct 2023 20:20: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 1qvo6F-000162-1O for qemu-devel@nongnu.org; Wed, 25 Oct 2023 20:19:47 -0400 Received: from mail-pl1-x62b.google.com ([2607:f8b0:4864:20::62b]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qvo63-0006de-Ox for qemu-devel@nongnu.org; Wed, 25 Oct 2023 20:19:46 -0400 Received: by mail-pl1-x62b.google.com with SMTP id d9443c01a7336-1cace3e142eso2220845ad.3 for ; Wed, 25 Oct 2023 17:19:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1698279573; x=1698884373; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=qScZs44s00L/oLLs4eIUKTqGk+BatBxWrSAikGLStjw=; b=CQpL95TqoRalMAy5AGV6wpYOJ3YSszC6uCoHCtRERtLvtRBe+EeJ9V8Qsi0b6YDXmT fGXHKykq+lmuTQ3t81xw2Nc0WwIg2mXgJOGlL4x2MqyNKxV+jGs6bOjNH6q9cdjRzC7/ yEHG5ta329YlDutrRFaP/ZLLrW1i2nm7ltcxdyolOme3St4DBH6058b9TTwzRXGbKvhM uc1d9btqOCx0sSl4zI/HeNoCdUjdr14Vt2F1d/UGAdaxoPppBBu0zHYsYK8ADXvORGR+ Q4+k50G9HWK+cFsN9gutmFR/nZo9dEn+E96GZPQ9pAAtAFLgCmk3Sv48X7dzu7zXf7Jt iNsA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1698279573; x=1698884373; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=qScZs44s00L/oLLs4eIUKTqGk+BatBxWrSAikGLStjw=; b=R8zLF/4CQCz8zEPNrZq+i72bdGDBwszyTI2h+gaMW8I9KjJcscxBoN9eOC6FTfTz2D IXpOpOtgmwD4KBO81S3TN9PZY4UNGWylXJoEGzTo5WZOmtgvlf8ojOuFpZsJFmRVzFMv K75381CvbSD5+1lBi1ld76L0Fdv0XhvMUW9DUtQnBIOLKplRJGcLbFFo07NUp9lLZihq CM7R9+fjnkfB1sz7GpRAXNDp35kVkybU9ZO4FKyUhM1w+6355cig8u34jB09+2gWBL8H 5LUTeXShj0PDHwNOhekirNW98F31bMTgaf3bc232x9z4sn+qEzXn0Qi8+7EsIoipXoWy ommA== X-Gm-Message-State: AOJu0YzQKEpKa71w/KsYIV6MIHM9yBFDCG01DWi308rT1QB0wGQupLTn bnT3n2y5tpHzWCyZXFp8e5U+FEXO1l37hJls6wk= X-Received: by 2002:a17:902:e402:b0:1c9:ca02:645c with SMTP id m2-20020a170902e40200b001c9ca02645cmr11144143ple.36.1698279573133; Wed, 25 Oct 2023 17:19:33 -0700 (PDT) Received: from stoup.. ([71.212.149.95]) by smtp.gmail.com with ESMTPSA id jh1-20020a170903328100b001c5fc291ef9sm9754655plb.209.2023.10.25.17.19.32 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 25 Oct 2023 17:19:32 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PULL 30/94] target/sparc: Remove cpu_wim Date: Wed, 25 Oct 2023 17:14:38 -0700 Message-Id: <20231026001542.1141412-60-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231026001542.1141412-1-richard.henderson@linaro.org> References: <20231026001542.1141412-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::62b; envelope-from=richard.henderson@linaro.org; helo=mail-pl1-x62b.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org Use direct loads and stores to env instead. Signed-off-by: Richard Henderson --- target/sparc/translate.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/target/sparc/translate.c b/target/sparc/translate.c index d87c08c18c..096cbb869f 100644 --- a/target/sparc/translate.c +++ b/target/sparc/translate.c @@ -84,9 +84,7 @@ static TCGv_i32 cpu_xcc, cpu_fprs; static TCGv cpu_gsr; static TCGv cpu_tick_cmpr, cpu_stick_cmpr, cpu_hstick_cmpr; static TCGv cpu_hintp, cpu_htba, cpu_hver, cpu_ssr, cpu_ver; -# define cpu_wim ({ qemu_build_not_reached(); (TCGv)NULL; }) #else -static TCGv cpu_wim; # define cpu_fprs ({ qemu_build_not_reached(); (TCGv)NULL; }) # define cpu_gsr ({ qemu_build_not_reached(); (TCGv)NULL; }) # define cpu_hintp ({ qemu_build_not_reached(); (TCGv)NULL; }) @@ -103,8 +101,10 @@ static TCGv_i64 cpu_fpr[TARGET_DPREGS]; #define env_field_offsetof(X) offsetof(CPUSPARCState, X) #ifdef TARGET_SPARC64 +# define env32_field_offsetof(X) ({ qemu_build_not_reached(); 0; }) # define env64_field_offsetof(X) env_field_offsetof(X) #else +# define env32_field_offsetof(X) env_field_offsetof(X) # define env64_field_offsetof(X) ({ qemu_build_not_reached(); 0; }) #endif @@ -3414,7 +3414,8 @@ TRANS(RDHPR_hstick_cmpr, HYPV, do_rd_special, hypervisor(dc), a->rd, static TCGv do_rdwim(DisasContext *dc, TCGv dst) { - return cpu_wim; + tcg_gen_ld_tl(dst, tcg_env, env32_field_offsetof(wim)); + return dst; } TRANS(RDWIM, 32, do_rd_special, supervisor(dc), a->rd, do_rdwim) @@ -3767,7 +3768,10 @@ TRANS(WRPSR, 32, do_wr_special, a, supervisor(dc), do_wrpsr) static void do_wrwim(DisasContext *dc, TCGv src) { target_ulong mask = MAKE_64BIT_MASK(0, dc->def->nwindows); - tcg_gen_andi_tl(cpu_wim, src, mask); + TCGv tmp = tcg_temp_new(); + + tcg_gen_andi_tl(tmp, src, mask); + tcg_gen_st_tl(tmp, tcg_env, env32_field_offsetof(wim)); } TRANS(WRWIM, 32, do_wr_special, a, supervisor(dc), do_wrwim) @@ -5939,8 +5943,6 @@ void sparc_tcg_init(void) #ifdef TARGET_SPARC64 { &cpu_xcc, offsetof(CPUSPARCState, xcc), "xcc" }, { &cpu_fprs, offsetof(CPUSPARCState, fprs), "fprs" }, -#else - { &cpu_wim, offsetof(CPUSPARCState, wim), "wim" }, #endif { &cpu_cc_op, offsetof(CPUSPARCState, cc_op), "cc_op" }, { &cpu_psr, offsetof(CPUSPARCState, psr), "psr" }, From patchwork Thu Oct 26 00:14: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: 738262 Delivered-To: patch@linaro.org Received: by 2002:adf:f842:0:b0:32d:baff:b0ca with SMTP id d2csp558223wrq; Wed, 25 Oct 2023 17:35:30 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFc75ggNTOFd7mL2dJacE98FcEc9eeuwgu82PXFN50gPhA0jdiov01rZ/qcJygyLIN0ovon X-Received: by 2002:aa7:d787:0:b0:53e:538e:3b70 with SMTP id s7-20020aa7d787000000b0053e538e3b70mr12667728edq.29.1698280529877; Wed, 25 Oct 2023 17:35:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698280529; cv=none; d=google.com; s=arc-20160816; b=y140QwLjY0niRPhdeQUP4XPCP4mKq2HPDH2fbnCe/Ko6wfjaKgGoMSbuzuEj/+9vAs F+HuSYpnFkfG9LvvojudfKvwfnIw89JN/VdjpV0D9SokshP2eVCdzW62WL8J2u5fDF7w oS83bkrOaCYAzmHJldA3wrId648t5iYNDKir1kksc/6SuZhMFwlZh8kQWg4GL0sb+5mM /+CfvAsWYUKO28gMCa+6Yzo3NW7/n+rhglYakwjlrU6vRCWL1SIcTVp7Pa0k0W1vABMp 6BXbRidS4BrgrMNb3YdJ1+AN6JMI9PgKL+eJHKzNlmcqXKYW46Mrsk9UjV/Nzeie3PH7 Z/xg== 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:to:from :dkim-signature; bh=70Ansy+qoBySZPBjDOmIfy2SuZzlDjYJIwvEAx7FQ7k=; fh=PnYt+qEB9tAfMKoqBm2xjKOFpYyFFGPudh5cVIoieJM=; b=G2QDHPqi4Yno+d/qQveVdwWJYdyF7woE529i3JlMMUz7jLBolPyHIQEcPc0wa4jxte qZkqzB3+t9wtcM/az15uUFY5Hbtj+Gyt0nsiZo4/SP2990HOCKDlO9otK+obp9aVYjgy 2gZQPXDzaU5nvMoSaW2XZ1BD3ftpU2mRGUEbruCz+NttIei9YMhq1i2AdXdH7bivxbhb oKM095iGlGp0dUcXPzfuUwmJHRs8N0GM5mVldJG49Za0X8HZBEuLOEWuJAtmaznxA1xe 7eQCH0pgJbPVuvnwVbljbGay6lnYV39OEqmCctzithaalqvSlLOKjWg7p9jE+Qsf9wPl K+vQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=UxdnknKc; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as 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 b16-20020a056402351000b0053e2c5973d4si6465897edd.73.2023.10.25.17.35.29 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 25 Oct 2023 17:35:29 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=UxdnknKc; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as 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 1qvo6M-0001Tp-V7; Wed, 25 Oct 2023 20:19: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 1qvo6E-00015U-U9 for qemu-devel@nongnu.org; Wed, 25 Oct 2023 20:19:46 -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 1qvo63-0006dk-Ou for qemu-devel@nongnu.org; Wed, 25 Oct 2023 20:19:46 -0400 Received: by mail-pf1-x42d.google.com with SMTP id d2e1a72fcca58-6b36e1fcee9so287053b3a.3 for ; Wed, 25 Oct 2023 17:19:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1698279574; x=1698884374; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=70Ansy+qoBySZPBjDOmIfy2SuZzlDjYJIwvEAx7FQ7k=; b=UxdnknKc2UdpsNtVa/eZj4gSW5imARaL6UR9CkddUZq15cpAoqwqEtnbZfTT4PKf7A kQxIJ2g88OU046/tw2M/NYH+yfatxOQpme5BuwNyJhGZegSFyDAV79aup6wRsCXNAbt/ Wq7YxvaiC4dG0TCmJB9gFW6orNS4u2s+x7h61+FzYKv/kQuieaUtaHlomx/KLENpga73 Hg7eQNgdqNHIfNkKWbK74zeNtv5BFtD5YZNpvZXuVjwoMF6cHO7XolDkQUKk9H9Lu4Du 0PKJvB9xUqZmbk6bYF5IdnR89BMYtD8sBTktVFe+KYOZNTTHWOkPPn6nscgwUOX62rMH N7Og== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1698279574; x=1698884374; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=70Ansy+qoBySZPBjDOmIfy2SuZzlDjYJIwvEAx7FQ7k=; b=R4GzoD79Jq8BwVLiGUKEijYMApDMBt+bCVZc2cEgl0jKjfB62mYElzQCdELVsRygAJ NrKjpjCRqd+vz5rxHT20IsTrPaOHNFfvbhbo6ssa/iUYtRwugdseevbpCFbuVAzkDcZu ZcMIuxoaGQd8nm3o2bpssBBjuK07a/KbX9/2tGNwaszSn2VvJNn4cGIwf4DUb/nbERQU 0yYlVEhWgKawqVbeOdAwrhbIZeUXTJEQUX1fzxsQM9LMFldDYYA9o7qVzLRN3OVQ7T1I +BlW6sUapfZ2EvqJ64E0LHtxSqMa0n+DXD0rt78Yp0Bd68E8BtZnhfX2nePqi+W39jzj rk0A== X-Gm-Message-State: AOJu0YzfvSAdTqp8HSPJp/QzWWUqcdY0c2UkiGwaYEWHiX/57QdceFtR RfB6+BttpPkzQ2W3InB65veB6B6cs1H3oTPCkYU= X-Received: by 2002:a05:6a21:4984:b0:179:fbe5:f535 with SMTP id ax4-20020a056a21498400b00179fbe5f535mr6310504pzc.58.1698279573841; Wed, 25 Oct 2023 17:19:33 -0700 (PDT) Received: from stoup.. ([71.212.149.95]) by smtp.gmail.com with ESMTPSA id jh1-20020a170903328100b001c5fc291ef9sm9754655plb.209.2023.10.25.17.19.33 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 25 Oct 2023 17:19:33 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PULL 31/94] target/sparc: Remove cpu_tick_cmpr, cpu_stick_cmpr, cpu_hstick_cmpr Date: Wed, 25 Oct 2023 17:14:39 -0700 Message-Id: <20231026001542.1141412-61-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231026001542.1141412-1-richard.henderson@linaro.org> References: <20231026001542.1141412-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::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 Use direct loads and stores to env instead. Signed-off-by: Richard Henderson --- target/sparc/translate.c | 41 ++++++++++++++-------------------------- 1 file changed, 14 insertions(+), 27 deletions(-) diff --git a/target/sparc/translate.c b/target/sparc/translate.c index 096cbb869f..65b71dd931 100644 --- a/target/sparc/translate.c +++ b/target/sparc/translate.c @@ -82,18 +82,14 @@ static TCGv cpu_cond; #ifdef TARGET_SPARC64 static TCGv_i32 cpu_xcc, cpu_fprs; static TCGv cpu_gsr; -static TCGv cpu_tick_cmpr, cpu_stick_cmpr, cpu_hstick_cmpr; static TCGv cpu_hintp, cpu_htba, cpu_hver, cpu_ssr, cpu_ver; #else # define cpu_fprs ({ qemu_build_not_reached(); (TCGv)NULL; }) # define cpu_gsr ({ qemu_build_not_reached(); (TCGv)NULL; }) # define cpu_hintp ({ qemu_build_not_reached(); (TCGv)NULL; }) -# define cpu_hstick_cmpr ({ qemu_build_not_reached(); (TCGv)NULL; }) # define cpu_htba ({ qemu_build_not_reached(); (TCGv)NULL; }) # define cpu_hver ({ qemu_build_not_reached(); (TCGv)NULL; }) # define cpu_ssr ({ qemu_build_not_reached(); (TCGv)NULL; }) -# define cpu_stick_cmpr ({ qemu_build_not_reached(); (TCGv)NULL; }) -# define cpu_tick_cmpr ({ qemu_build_not_reached(); (TCGv)NULL; }) # define cpu_ver ({ qemu_build_not_reached(); (TCGv)NULL; }) #endif /* Floating point registers */ @@ -3307,7 +3303,8 @@ TRANS(RDSOFTINT, 64, do_rd_special, supervisor(dc), a->rd, do_rdsoftint) static TCGv do_rdtick_cmpr(DisasContext *dc, TCGv dst) { - return cpu_tick_cmpr; + tcg_gen_ld_tl(dst, tcg_env, env64_field_offsetof(tick_cmpr)); + return dst; } /* TODO: non-priv access only allowed when enabled. */ @@ -3331,7 +3328,8 @@ TRANS(RDSTICK, 64, do_rd_special, true, a->rd, do_rdstick) static TCGv do_rdstick_cmpr(DisasContext *dc, TCGv dst) { - return cpu_stick_cmpr; + tcg_gen_ld_tl(dst, tcg_env, env64_field_offsetof(stick_cmpr)); + return dst; } /* TODO: supervisor access only allowed when enabled by hypervisor. */ @@ -3406,7 +3404,8 @@ TRANS(RDHPR_hver, HYPV, do_rd_special, hypervisor(dc), a->rd, do_rdhver) static TCGv do_rdhstick_cmpr(DisasContext *dc, TCGv dst) { - return cpu_hstick_cmpr; + tcg_gen_ld_tl(dst, tcg_env, env64_field_offsetof(hstick_cmpr)); + return dst; } TRANS(RDHPR_hstick_cmpr, HYPV, do_rd_special, hypervisor(dc), a->rd, @@ -3696,18 +3695,14 @@ 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)); + tcg_gen_st_tl(src, tcg_env, env64_field_offsetof(tick_cmpr)); + tcg_gen_ld_ptr(r_tickptr, tcg_env, env64_field_offsetof(tick)); translator_io_start(&dc->base); - gen_helper_tick_set_limit(r_tickptr, cpu_tick_cmpr); + gen_helper_tick_set_limit(r_tickptr, src); /* 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) @@ -3731,18 +3726,14 @@ 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)); + tcg_gen_st_tl(src, tcg_env, env64_field_offsetof(stick_cmpr)); + tcg_gen_ld_ptr(r_tickptr, tcg_env, env64_field_offsetof(stick)); translator_io_start(&dc->base); - gen_helper_tick_set_limit(r_tickptr, cpu_stick_cmpr); + gen_helper_tick_set_limit(r_tickptr, src); /* 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) @@ -3984,10 +3975,10 @@ static void do_wrhstick_cmpr(DisasContext *dc, TCGv src) { TCGv_ptr r_tickptr = tcg_temp_new_ptr(); - tcg_gen_mov_tl(cpu_hstick_cmpr, src); + tcg_gen_st_tl(src, tcg_env, env64_field_offsetof(hstick_cmpr)); tcg_gen_ld_ptr(r_tickptr, tcg_env, env64_field_offsetof(hstick)); translator_io_start(&dc->base); - gen_helper_tick_set_limit(r_tickptr, cpu_hstick_cmpr); + gen_helper_tick_set_limit(r_tickptr, src); /* End TB to handle timer interrupt */ dc->base.is_jmp = DISAS_EXIT; } @@ -5951,10 +5942,6 @@ void sparc_tcg_init(void) static const struct { TCGv *ptr; int off; const char *name; } rtl[] = { #ifdef TARGET_SPARC64 { &cpu_gsr, offsetof(CPUSPARCState, gsr), "gsr" }, - { &cpu_tick_cmpr, offsetof(CPUSPARCState, tick_cmpr), "tick_cmpr" }, - { &cpu_stick_cmpr, offsetof(CPUSPARCState, stick_cmpr), "stick_cmpr" }, - { &cpu_hstick_cmpr, offsetof(CPUSPARCState, hstick_cmpr), - "hstick_cmpr" }, { &cpu_hintp, offsetof(CPUSPARCState, hintp), "hintp" }, { &cpu_htba, offsetof(CPUSPARCState, htba), "htba" }, { &cpu_hver, offsetof(CPUSPARCState, hver), "hver" }, From patchwork Thu Oct 26 00:14: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: 738234 Delivered-To: patch@linaro.org Received: by 2002:adf:f842:0:b0:32d:baff:b0ca with SMTP id d2csp555451wrq; Wed, 25 Oct 2023 17:27:22 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGy8jASg4y4mx6mzgwhUUTQ2eFhfsPjzc2MS6/a2BAJsMuDY9qR0agv1fWJ7xdGxN2kIvqn X-Received: by 2002:a50:c055:0:b0:541:186b:1f62 with SMTP id u21-20020a50c055000000b00541186b1f62mr253696edd.22.1698280042609; Wed, 25 Oct 2023 17:27:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698280042; cv=none; d=google.com; s=arc-20160816; b=cTsybyNnze72QtOu6tVB8L/XE5D4AL2dSXiNTz5NKx3kOqTUUK26UbSE8O3tDySyfy oB9Btn+phZoI1XfaAh2Q8YVTHxRfDTCvJgp7wdw0QuEjah9biF10/W2dCxn0aR2JfBcj PhEqxch8podgiz3gZoEJbHy2wYCCti0rsuacN6kjjlvhZivqsxhiTtw36hf5TTLvEu0J GfYBTA+Ubk0k4uz8Z7szDf5mzIh/ZpZDoGmnq8y2hCkcrxgP4xKGzyDK01ou3ByAxfoV nFk4DAMRLnQCoMq4FuYBjLknP3JAyw+KylhPNvNoDQ6G9jIjRGwrj42+3vPs6mimnBH7 jSfA== 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:to:from :dkim-signature; bh=WZI9/ICpEQ1X/D+ks7TjhuKKwZOzznFfbKaTh1LluXE=; fh=PnYt+qEB9tAfMKoqBm2xjKOFpYyFFGPudh5cVIoieJM=; b=SHlZBf11b4Le5eTvOAF4314a+FB5M52ijQISZUxO6D9w4lyFVggGQj/He8BLQo6dF8 tljfQfhzWL5pzdAxqrMualWnNdqKTHjrhKlidMz8OrtTAYxNz80/Xn6+q3iqfJDs0XLg zcnq1SoX2BCZHKuYWBSKSHR5vhZjiyR8rvRdvviNhDHijF53cjhWbK5EauMz+gpyHSnH Hfu/bUMPjdnrioewgGgQE36yl1qMSII5+gn4iFeALOrgjOlimP7/+tk3QczWVoXVmSN7 owc3npbOANDPEP9+IqbJBTzT4ZwEiJUfr2lPxbhT5pbFfutaf7g1JAibiwJNKY7GUv5t ZNGg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=FVpbBpII; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as 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 y4-20020a056402440400b00534cca3fbf7si6183793eda.190.2023.10.25.17.27.22 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 25 Oct 2023 17:27: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=FVpbBpII; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as 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 1qvo6i-0002C7-0s; Wed, 25 Oct 2023 20:20:17 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qvo6F-00017x-CO for qemu-devel@nongnu.org; Wed, 25 Oct 2023 20:19:47 -0400 Received: from mail-pl1-x632.google.com ([2607:f8b0:4864:20::632]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qvo64-0006do-H9 for qemu-devel@nongnu.org; Wed, 25 Oct 2023 20:19:47 -0400 Received: by mail-pl1-x632.google.com with SMTP id d9443c01a7336-1bdf4752c3cso2058865ad.2 for ; Wed, 25 Oct 2023 17:19:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1698279574; x=1698884374; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=WZI9/ICpEQ1X/D+ks7TjhuKKwZOzznFfbKaTh1LluXE=; b=FVpbBpIIeEjPGHqcohu0CzvZ7pohimPQ5hsuZD4zqukdaqn1QCzeYFcBSfkM+8c361 ce94p7D8ED9fRLFd0GChdyKI8TN8cxF78FatHJVJa98JyTc6kNIBFO2Arn3fLo8mjcPo WAAxzdaN/CZleILv/GgSZnFhFrLyq9DXsB1RfC4aZIZkriJWzboshr5SX3P7RjbO7BgU j4JHVCajvqabxV8j2N+k5ZPZFM3zAjGwpQwoSYmdNWNfOxhhs6dNRPkd8Pa1rZs24VCf ywT/1S2q3CmR1BmNjQerXZypCmP4lfWBiRc0OYJqH+wEm+0JibSapiAPMjMXNR3oGH4S QY1g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1698279574; x=1698884374; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=WZI9/ICpEQ1X/D+ks7TjhuKKwZOzznFfbKaTh1LluXE=; b=VPZ7gfL8shkkv9NNaVlY9kXm4IQgJpemvOxYxDvs7fmcJ23kyca6x2PU0LU1c9u5U5 dGOSSwKcyLgelWApzwDJHgIPW3b7slr3WX9Pq+sLMLN0P+8MbQYSXO56ZvB6wGrrEohZ gqMZqNHVSbjhBMT9MVCsD6a8EaV6ohc/9ZPhcaIY3gzKU9IL0yOrCQ9AU82f97lCKkZG +yWufXV1fvZKLeAVSMtKuQdIMkvKfxljNKiTbkLFCWxFYOwLoQAH6mf2PiUsvcgm1cvL nDZviCo5PnpVrsR6UVyHW8vLgAq/r9+Ep94eYOMTO6mDArDAXb3bFTjoVh/yJOCgLwgU bypA== X-Gm-Message-State: AOJu0YyRGNZ8bQvhq894aiDnNW8D+iyYVpP1hQP8UXcKbW0sn0hzv+lj UMR00u9jefWF2JxfmwZHOFx0GujATl6Cl6HIdVM= X-Received: by 2002:a17:902:b48d:b0:1c5:de4c:f079 with SMTP id y13-20020a170902b48d00b001c5de4cf079mr13419776plr.33.1698279574561; Wed, 25 Oct 2023 17:19:34 -0700 (PDT) Received: from stoup.. ([71.212.149.95]) by smtp.gmail.com with ESMTPSA id jh1-20020a170903328100b001c5fc291ef9sm9754655plb.209.2023.10.25.17.19.34 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 25 Oct 2023 17:19:34 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PULL 32/94] target/sparc: Remove cpu_hintp, cpu_htba, cpu_hver, cpu_ssr, cpu_ver Date: Wed, 25 Oct 2023 17:14:40 -0700 Message-Id: <20231026001542.1141412-62-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231026001542.1141412-1-richard.henderson@linaro.org> References: <20231026001542.1141412-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::632; envelope-from=richard.henderson@linaro.org; helo=mail-pl1-x632.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org Use direct loads and stores to env instead. Signed-off-by: Richard Henderson --- target/sparc/translate.c | 32 +++++++++++++------------------- 1 file changed, 13 insertions(+), 19 deletions(-) diff --git a/target/sparc/translate.c b/target/sparc/translate.c index 65b71dd931..7b83803b6b 100644 --- a/target/sparc/translate.c +++ b/target/sparc/translate.c @@ -82,15 +82,9 @@ static TCGv cpu_cond; #ifdef TARGET_SPARC64 static TCGv_i32 cpu_xcc, cpu_fprs; static TCGv cpu_gsr; -static TCGv cpu_hintp, cpu_htba, cpu_hver, cpu_ssr, cpu_ver; #else # define cpu_fprs ({ qemu_build_not_reached(); (TCGv)NULL; }) # define cpu_gsr ({ qemu_build_not_reached(); (TCGv)NULL; }) -# define cpu_hintp ({ qemu_build_not_reached(); (TCGv)NULL; }) -# define cpu_htba ({ qemu_build_not_reached(); (TCGv)NULL; }) -# define cpu_hver ({ qemu_build_not_reached(); (TCGv)NULL; }) -# define cpu_ssr ({ qemu_build_not_reached(); (TCGv)NULL; }) -# define cpu_ver ({ qemu_build_not_reached(); (TCGv)NULL; }) #endif /* Floating point registers */ static TCGv_i64 cpu_fpr[TARGET_DPREGS]; @@ -3383,21 +3377,24 @@ TRANS(RDHPR_htstate, HYPV, do_rd_special, hypervisor(dc), a->rd, do_rdhtstate) static TCGv do_rdhintp(DisasContext *dc, TCGv dst) { - return cpu_hintp; + tcg_gen_ld_tl(dst, tcg_env, env64_field_offsetof(hintp)); + return dst; } TRANS(RDHPR_hintp, HYPV, do_rd_special, hypervisor(dc), a->rd, do_rdhintp) static TCGv do_rdhtba(DisasContext *dc, TCGv dst) { - return cpu_htba; + tcg_gen_ld_tl(dst, tcg_env, env64_field_offsetof(htba)); + return dst; } TRANS(RDHPR_htba, HYPV, do_rd_special, hypervisor(dc), a->rd, do_rdhtba) static TCGv do_rdhver(DisasContext *dc, TCGv dst) { - return cpu_hver; + tcg_gen_ld_tl(dst, tcg_env, env64_field_offsetof(hver)); + return dst; } TRANS(RDHPR_hver, HYPV, do_rd_special, hypervisor(dc), a->rd, do_rdhver) @@ -3572,14 +3569,16 @@ TRANS(RDPR_gl, GL, do_rd_special, supervisor(dc), a->rd, do_rdgl) /* UA2005 strand status */ static TCGv do_rdssr(DisasContext *dc, TCGv dst) { - return cpu_ssr; + tcg_gen_ld_tl(dst, tcg_env, env64_field_offsetof(ssr)); + return dst; } TRANS(RDPR_strand_status, HYPV, do_rd_special, hypervisor(dc), a->rd, do_rdssr) static TCGv do_rdver(DisasContext *dc, TCGv dst) { - return cpu_ver; + tcg_gen_ld_tl(dst, tcg_env, env64_field_offsetof(version)); + return dst; } TRANS(RDPR_ver, 64, do_rd_special, supervisor(dc), a->rd, do_rdver) @@ -3926,7 +3925,7 @@ TRANS(WRPR_gl, GL, do_wr_special, a, supervisor(dc), do_wrgl) /* UA2005 strand status */ static void do_wrssr(DisasContext *dc, TCGv src) { - tcg_gen_mov_tl(cpu_ssr, src); + tcg_gen_st_tl(src, tcg_env, env64_field_offsetof(ssr)); } TRANS(WRPR_strand_status, HYPV, do_wr_special, a, hypervisor(dc), do_wrssr) @@ -3959,14 +3958,14 @@ TRANS(WRHPR_htstate, HYPV, do_wr_special, a, hypervisor(dc), do_wrhtstate) static void do_wrhintp(DisasContext *dc, TCGv src) { - tcg_gen_mov_tl(cpu_hintp, src); + tcg_gen_st_tl(src, tcg_env, env64_field_offsetof(hintp)); } TRANS(WRHPR_hintp, HYPV, do_wr_special, a, hypervisor(dc), do_wrhintp) static void do_wrhtba(DisasContext *dc, TCGv src) { - tcg_gen_mov_tl(cpu_htba, src); + tcg_gen_st_tl(src, tcg_env, env64_field_offsetof(htba)); } TRANS(WRHPR_htba, HYPV, do_wr_special, a, hypervisor(dc), do_wrhtba) @@ -5942,11 +5941,6 @@ void sparc_tcg_init(void) static const struct { TCGv *ptr; int off; const char *name; } rtl[] = { #ifdef TARGET_SPARC64 { &cpu_gsr, offsetof(CPUSPARCState, gsr), "gsr" }, - { &cpu_hintp, offsetof(CPUSPARCState, hintp), "hintp" }, - { &cpu_htba, offsetof(CPUSPARCState, htba), "htba" }, - { &cpu_hver, offsetof(CPUSPARCState, hver), "hver" }, - { &cpu_ssr, offsetof(CPUSPARCState, ssr), "ssr" }, - { &cpu_ver, offsetof(CPUSPARCState, version), "ver" }, #endif { &cpu_cond, offsetof(CPUSPARCState, cond), "cond" }, { &cpu_cc_src, offsetof(CPUSPARCState, cc_src), "cc_src" }, From patchwork Thu Oct 26 00:14: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: 738203 Delivered-To: patch@linaro.org Received: by 2002:adf:f842:0:b0:32d:baff:b0ca with SMTP id d2csp553579wrq; Wed, 25 Oct 2023 17:21:38 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHzDz2IDJnDfUxqrb0NXp9v/G+KzUJjM4W5RFf6CCLzyUrL6NQh3at6R91qfAZljznCZ3CW X-Received: by 2002:a05:6512:1052:b0:506:87a3:c27c with SMTP id c18-20020a056512105200b0050687a3c27cmr15608168lfb.53.1698279698140; Wed, 25 Oct 2023 17:21:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698279698; cv=none; d=google.com; s=arc-20160816; b=r2/DJRJCp2MaOMXyIFRqHIS4txw/bUbxYmaCjUpllYoSZWSK1WK3tTh/X4rJqLY+wy 3hQ5F0tEDQaE/46anTnKbtJ51cRhLDs/STl+B3dMB7PyvJTliZaag00szMLjgJXQzvpD CvwVpGmprcZR+JN8Ky8/sExokJDry3Wipg1ucoy9JQ+kRbb6CO9cmJW5TVK1wdGZRVra JO8hw5j/YGruTV6F9mNNioteynNil1JhY0EeZehQaGuyYESDnBuisvpxumqcAV13HTFa qq5JBuprBPn5MEGqf883ZWWm/qQvehNPKsvFZD3488PszJ6xUQk2Iv0f4Xk5V9HwISjX QvFw== 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=7e32GXOdclDt5koO1LuGMoCHPHXAx66CjXFcUXyFykw=; fh=rYI8DiHAAFX3O5g969KmOAQ7d45Sb8OxQX1+DywGDk4=; b=fw7BB083yMh8fusi7AEiSGCG6z+K71yF/VYFE6hZlzlW7FiLQS0hp10qaVHWqkLwKX rl/98mV4fiZ5FnGEr1NR6LMdq8ZiC+ItNmbjImm/mf7ZPMJ4lRiS9/AsqGp1mu3PkGVG sRwurItOjoSQdPTMImNxGgjMO5L6dt2nmXSqM4LyXFBFuxm9cb3mcMluNU+9296Azs0o 7bewCtrpE17YA48UGiLWrABIbYRJOWKjjBBx0oQK0zVPsxqOeftDO3Idcv3513josmyb vkMSLCl311HVvsMV0vVHCZYB6DmO5QImHQMZzgodYNNuB0+hBVVddWHbZ/GwmoaXUucg ta5Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=LUn77a60; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as 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 y11-20020adfe6cb000000b0032dd12c71fcsi8540339wrm.666.2023.10.25.17.21.37 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 25 Oct 2023 17:21: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=LUn77a60; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as 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 1qvo6v-0002J6-Lj; Wed, 25 Oct 2023 20:20: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 1qvo6G-0001Dy-KG for qemu-devel@nongnu.org; Wed, 25 Oct 2023 20:19:48 -0400 Received: from mail-pl1-x62d.google.com ([2607:f8b0:4864:20::62d]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qvo66-0006e3-Eg for qemu-devel@nongnu.org; Wed, 25 Oct 2023 20:19:48 -0400 Received: by mail-pl1-x62d.google.com with SMTP id d9443c01a7336-1cc04494653so2181965ad.2 for ; Wed, 25 Oct 2023 17:19:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1698279575; x=1698884375; 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=7e32GXOdclDt5koO1LuGMoCHPHXAx66CjXFcUXyFykw=; b=LUn77a60hp8NIaNn/3xeTYwyNoGN3Vv8vwkWHSPsClzx4zZhE+ICKAEg9Adl5XdklC 1HC5K4s6MEePHmTkm08wTl6cawywYnqjEon1XeJj3+zUJy3exD50lGeBdwNxdeB6++Kw E1ShMQrvMMHJWHWWTQuCDleVvbt/IOQiOQQUiG12QLVLt/m/9IqmAIw0DCz+7iLSnouv JG44ujjHr87WLWwquJnIPBFViRAuZjVqdwSip8AZfnYjWNW3MQyxbbkDgSz0zo4nGtF4 gpqO3e1Z/XwAztdbtN/KErftOmXm7381gmCe3Kyk2XD1CMJZlADK9CiElskLJ1urAfdX AETQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1698279575; x=1698884375; 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=7e32GXOdclDt5koO1LuGMoCHPHXAx66CjXFcUXyFykw=; b=AJyornbfsGbW7SNXD203qsOL7oXfwuz+5xxZbCxW2jSnW9YAtJdXUVKqf3hGttiO0R 6NydybGg777E+kgizJ6ZimZGkAJEkdRdYwsggJ/+1BtYVAy1EUzANXkvmB/ihBWSfpJo OUpZXGV6GllIi4FmQvrzIMePCw/rwHwcb/tDf6sIJvTB1/UlIIbzeDOGE9BE0Jj/ktvV Uy5yYTBYsPfjWr33vyGALmtoISRK1a9hM+l8VWGrOuRN07yN9b/SUw2CLtbKYf5Ic2FP 405g6vaTI85pW4xKK4IbrJRpCDf3mdeLJ7E6wpUbD1wRAmJ9CmwvmmEIbhM4ch3BsKqL K4Bw== X-Gm-Message-State: AOJu0YyniPNiySA5ojuEDmc4Qi3bWYRkysRYYppJNfq2htbwNumbQ6Vk 4ohxT5X3+gt1TFYNfslKN/cV91ayuBExlQeouv4= X-Received: by 2002:a17:902:f202:b0:1ca:87e0:93e3 with SMTP id m2-20020a170902f20200b001ca87e093e3mr13462956plc.7.1698279575377; Wed, 25 Oct 2023 17:19:35 -0700 (PDT) Received: from stoup.. ([71.212.149.95]) by smtp.gmail.com with ESMTPSA id jh1-20020a170903328100b001c5fc291ef9sm9754655plb.209.2023.10.25.17.19.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 25 Oct 2023 17:19:35 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: Mark Cave-Ayland Subject: [PULL 33/94] target/sparc: Move basic arithmetic to decodetree Date: Wed, 25 Oct 2023 17:14:41 -0700 Message-Id: <20231026001542.1141412-63-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231026001542.1141412-1-richard.henderson@linaro.org> References: <20231026001542.1141412-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::62d; envelope-from=richard.henderson@linaro.org; helo=mail-pl1-x62d.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. Tested-by: Mark Cave-Ayland Acked-by: Mark Cave-Ayland Signed-off-by: Richard Henderson --- target/sparc/insns.decode | 12 +++ target/sparc/translate.c | 185 +++++++++++++++++--------------------- 2 files changed, 94 insertions(+), 103 deletions(-) diff --git a/target/sparc/insns.decode b/target/sparc/insns.decode index eab737fdcc..3271c2997d 100644 --- a/target/sparc/insns.decode +++ b/target/sparc/insns.decode @@ -29,6 +29,9 @@ CALL 01 i:s30 &r_r_ri rd rs1 rs2_or_imm imm:bool @n_r_ri .. ..... ...... rs1:5 imm:1 rs2_or_imm:s13 &r_r_ri rd=0 +&r_r_ri_cc rd rs1 rs2_or_imm imm:bool cc:bool +@r_r_ri_cc .. rd:5 . cc:1 .... rs1:5 imm:1 rs2_or_imm:s13 &r_r_ri_cc + { [ STBAR 10 00000 101000 01111 0 0000000000000 @@ -152,6 +155,15 @@ WRHPR_hintp 10 00011 110011 ..... . ............. @n_r_ri WRHPR_htba 10 00101 110011 ..... . ............. @n_r_ri WRHPR_hstick_cmpr 10 11111 110011 ..... . ............. @n_r_ri +ADD 10 ..... 0.0000 ..... . ............. @r_r_ri_cc +AND 10 ..... 0.0001 ..... . ............. @r_r_ri_cc +OR 10 ..... 0.0010 ..... . ............. @r_r_ri_cc +XOR 10 ..... 0.0011 ..... . ............. @r_r_ri_cc +SUB 10 ..... 0.0100 ..... . ............. @r_r_ri_cc +ANDN 10 ..... 0.0101 ..... . ............. @r_r_ri_cc +ORN 10 ..... 0.0110 ..... . ............. @r_r_ri_cc +XORN 10 ..... 0.0111 ..... . ............. @r_r_ri_cc + Tcc_r 10 0 cond:4 111010 rs1:5 0 cc:1 0000000 rs2:5 { # For v7, the entire simm13 field is present, but masked to 7 bits. diff --git a/target/sparc/translate.c b/target/sparc/translate.c index 7b83803b6b..2a8846f2ac 100644 --- a/target/sparc/translate.c +++ b/target/sparc/translate.c @@ -4013,6 +4013,88 @@ static bool trans_NOP_v7(DisasContext *dc, arg_NOP_v7 *a) return false; } +static bool do_arith_int(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); +} + +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), + void (*func_cc)(TCGv, TCGv, TCGv)) +{ + if (a->cc) { + return do_arith_int(dc, a, cc_op, func_cc, NULL); + } + return do_arith_int(dc, a, cc_op, func, funci); +} + +static bool do_logic(DisasContext *dc, arg_r_r_ri_cc *a, + void (*func)(TCGv, TCGv, TCGv), + void (*funci)(TCGv, TCGv, target_long)) +{ + return do_arith_int(dc, a, CC_OP_LOGIC, func, funci); +} + +TRANS(ADD, ALL, do_arith, a, CC_OP_ADD, + tcg_gen_add_tl, tcg_gen_addi_tl, gen_op_add_cc) +TRANS(SUB, ALL, do_arith, a, CC_OP_SUB, + tcg_gen_sub_tl, tcg_gen_subi_tl, gen_op_sub_cc) + +TRANS(AND, ALL, do_logic, a, tcg_gen_and_tl, tcg_gen_andi_tl) +TRANS(XOR, ALL, do_logic, a, tcg_gen_xor_tl, tcg_gen_xori_tl) +TRANS(ANDN, ALL, do_logic, a, tcg_gen_andc_tl, NULL) +TRANS(ORN, ALL, do_logic, a, tcg_gen_orc_tl, NULL) +TRANS(XORN, ALL, do_logic, a, 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_logic(dc, a, tcg_gen_or_tl, tcg_gen_ori_tl); +} + #define CHECK_IU_FEATURE(dc, FEATURE) \ if (!((dc)->def->features & CPU_FEATURE_ ## FEATURE)) \ goto illegal_insn; @@ -4361,43 +4443,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); @@ -4474,72 +4519,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 Thu Oct 26 00:14: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: 738243 Delivered-To: patch@linaro.org Received: by 2002:adf:f842:0:b0:32d:baff:b0ca with SMTP id d2csp556752wrq; Wed, 25 Oct 2023 17:31:20 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEeN7N/6+f/GH8ZaAoqV97y+U9Rcyiz3nrGI97Hv6KbCEqE9TBuJxMTmZzaavb43ERNLkTu X-Received: by 2002:a5d:62cd:0:b0:32d:9df1:6f6d with SMTP id o13-20020a5d62cd000000b0032d9df16f6dmr11473995wrv.17.1698280279328; Wed, 25 Oct 2023 17:31:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698280279; cv=none; d=google.com; s=arc-20160816; b=e3LwsPDeGDFd7rCLP0FOIJoEkIPG7Tp3LbeS/0gYkzhsBrCdYnH00M/xAmck8i2dnz 6xFkfftJDz5Twiu0V2qw2rYlz61T1DyPcngefjenDCrfVxk4HwT9GG7UN94swbI6VEbL UcLplP9CsTmZre/YFbRebtdFZoc5NA67+94fgAs0NxY5wBDG+P/3JiohEmTYPIgbYPGG /oS4lT1yF/44JLyvAKxBff09BNgcuRxMXYme2E0iNQZ0yA/ubczzFAstT64ZHv4WnVnI 6myEXIuj3n+dL0sMU5MugC16v1QaWBn7liJNyIpqn7A+sAl/qkZ/fGzQp8V5dC3TuehY yTRw== 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=xoLBlyu7idL5AbpDPBt4MB7Nht6Rv+NOTvRkK60g84Q=; fh=rYI8DiHAAFX3O5g969KmOAQ7d45Sb8OxQX1+DywGDk4=; b=XQSSNne5gsqBktxOVSZfhHK7OnoSvVyNkfcu1g6ndU086XYvu59QxWuItqD8llvrbk 3Be0z7f7OmEtCiMkrWS8xW1pwztk2q6Tywk9/mpZDUpgxKt+KFjlysHq1TNeeZUF1ZUX M0s1wJyu9jpsdQ9KZ4HZWyPRJjvk7vClkFNS1v6axckW3AFYq9kYyQHhtiFIl+PIc93K prafjrsLPB84gveg1DPXpl+OqJQmnq1vlD9x8KpilD9aLuLdV7fF7D6eveCSdELgBu+j VzuEGJVHxjeZBd++11+zYxQRZ7EQX8qp3gfcFDacDt5qFjzbbLWBSU0waekD8oQZ+ASb IvLQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=uqX+qJ2G; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as 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 s9-20020adff809000000b0032da8600ae8si8135150wrp.452.2023.10.25.17.31.19 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 25 Oct 2023 17:31: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=uqX+qJ2G; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as 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 1qvo6N-0001YK-Kq; Wed, 25 Oct 2023 20:19: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 1qvo6G-0001E0-Oa for qemu-devel@nongnu.org; Wed, 25 Oct 2023 20:19:48 -0400 Received: from mail-pl1-x62c.google.com ([2607:f8b0:4864:20::62c]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qvo66-0006eA-Ew for qemu-devel@nongnu.org; Wed, 25 Oct 2023 20:19:48 -0400 Received: by mail-pl1-x62c.google.com with SMTP id d9443c01a7336-1ca6809fb8aso2283605ad.1 for ; Wed, 25 Oct 2023 17:19:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1698279576; x=1698884376; 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=xoLBlyu7idL5AbpDPBt4MB7Nht6Rv+NOTvRkK60g84Q=; b=uqX+qJ2GN6PP4lFMKzaRkH9OOFuHKmNI7TlU8k/Zjrmru8wBJvnhrwIitQuo5r/lwX r3ZdvP8Q6Z8eW7GdxpnBtB1C6cz8P4Ajwl3CG80z+xg3OscCTLeCGdpIB9gHLhRcFDEO fB40WxZZIoBzRW+7nmWxqYrn23CVV6clZRBLrVSXmy+IN2/VEArsgmX0aDWabEwSPqnw HaNumatN9jGvkMYVZ4p3AYKy5Rk6ltN94emM0eZaupM0YE8Q9DC6zyPcGOMFzphrCQxA b27direZYUhLcPqpfBAjMAJz7uKPix8ghV99+JUKcOxbkdLOKzwzHxkMg2ROkMtEDGcE 39ng== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1698279576; x=1698884376; 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=xoLBlyu7idL5AbpDPBt4MB7Nht6Rv+NOTvRkK60g84Q=; b=waOqkltDGgKUR21wOkkLc1mxR1jJkSlmbqe6Pf7PwhyXp1Fme2exATxK01TJn6haSl u+qze2OQXBGOHc9fM40X1pi3opx1+a5eGWzMQa+cLsAmxBGedhqU0OAASQkM8wWdmKYF yndR1L0NPrJzkFamFNKE3VgRioDDaBWJamhFJoRXgexYb6rBTzhXYrX90zoMakrVxhzH hb1YWVFJHqBWNQETayL2dfoykTmozTat5mdHXfDfH9WshdsTuCgTY8bsZIXYSoCBykb9 vR88oOy733WJcumyhUM655LruMuBVP8edGWUFQ93eDISJijJZyEJPb5eCghmqZcDJsyl EL1Q== X-Gm-Message-State: AOJu0YzOJrq5DnLTQDVNQWNO6MLSZ2RI970D2LNrCV7ofujh0bNeqD4n HBUWgbNFBGnGjm6mrRpBrg7FFbalrgE2cz16ykQ= X-Received: by 2002:a17:902:a417:b0:1bb:b855:db3c with SMTP id p23-20020a170902a41700b001bbb855db3cmr11839100plq.41.1698279576244; Wed, 25 Oct 2023 17:19:36 -0700 (PDT) Received: from stoup.. ([71.212.149.95]) by smtp.gmail.com with ESMTPSA id jh1-20020a170903328100b001c5fc291ef9sm9754655plb.209.2023.10.25.17.19.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 25 Oct 2023 17:19:35 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: Mark Cave-Ayland Subject: [PULL 34/94] target/sparc: Move ADDC to decodetree Date: Wed, 25 Oct 2023 17:14:42 -0700 Message-Id: <20231026001542.1141412-64-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231026001542.1141412-1-richard.henderson@linaro.org> References: <20231026001542.1141412-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::62c; envelope-from=richard.henderson@linaro.org; helo=mail-pl1-x62c.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org Tested-by: Mark Cave-Ayland Acked-by: Mark Cave-Ayland Signed-off-by: Richard Henderson --- target/sparc/insns.decode | 1 + target/sparc/translate.c | 154 ++++++++++++++++++++++++-------------- 2 files changed, 97 insertions(+), 58 deletions(-) diff --git a/target/sparc/insns.decode b/target/sparc/insns.decode index 3271c2997d..1cff18fa1f 100644 --- a/target/sparc/insns.decode +++ b/target/sparc/insns.decode @@ -163,6 +163,7 @@ SUB 10 ..... 0.0100 ..... . ............. @r_r_ri_cc ANDN 10 ..... 0.0101 ..... . ............. @r_r_ri_cc ORN 10 ..... 0.0110 ..... . ............. @r_r_ri_cc XORN 10 ..... 0.0111 ..... . ............. @r_r_ri_cc +ADDC 10 ..... 0.1000 ..... . ............. @r_r_ri_cc Tcc_r 10 0 cond:4 111010 rs1:5 0 cc:1 0000000 rs2:5 { diff --git a/target/sparc/translate.c b/target/sparc/translate.c index 2a8846f2ac..eb829acc68 100644 --- a/target/sparc/translate.c +++ b/target/sparc/translate.c @@ -447,71 +447,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); @@ -4095,6 +4113,30 @@ static bool trans_OR(DisasContext *dc, arg_r_r_ri_cc *a) return do_logic(dc, a, tcg_gen_or_tl, tcg_gen_ori_tl); } +static bool trans_ADDC(DisasContext *dc, arg_r_r_ri_cc *a) +{ + switch (dc->cc_op) { + case CC_OP_DIV: + case CC_OP_LOGIC: + /* Carry is known to be zero. Fall back to plain ADD. */ + return do_arith(dc, a, CC_OP_ADD, + tcg_gen_add_tl, tcg_gen_addi_tl, gen_op_add_cc); + case CC_OP_ADD: + case CC_OP_TADD: + case CC_OP_TADDTV: + return do_arith(dc, a, CC_OP_ADDX, + gen_op_addc_add, NULL, gen_op_addccc_add); + case CC_OP_SUB: + case CC_OP_TSUB: + case CC_OP_TSUBTV: + return do_arith(dc, a, CC_OP_ADDX, + gen_op_addc_sub, NULL, gen_op_addccc_sub); + default: + return do_arith(dc, a, CC_OP_ADDX, + gen_op_addc_generic, NULL, gen_op_addccc_generic); + } +} + #define CHECK_IU_FEATURE(dc, FEATURE) \ if (!((dc)->def->features & CPU_FEATURE_ ## FEATURE)) \ goto illegal_insn; @@ -4519,10 +4561,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 Thu Oct 26 00:14: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: 738218 Delivered-To: patch@linaro.org Received: by 2002:adf:f842:0:b0:32d:baff:b0ca with SMTP id d2csp554605wrq; Wed, 25 Oct 2023 17:24:40 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEeU/bk2sxWM7QTotMt4ft8ot4KAbFF0WYudzMXvM4ATPCwDYfWEgu6y6PRYWV+q+X4/iQ/ X-Received: by 2002:a05:600c:20c:b0:408:5a65:c9b2 with SMTP id 12-20020a05600c020c00b004085a65c9b2mr10507272wmi.15.1698279880507; Wed, 25 Oct 2023 17:24:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698279880; cv=none; d=google.com; s=arc-20160816; b=Tq/mmc8CYg6T5GHUkJl/EsDb6+6mkrgHOdSBPBUSbGByN50pg7g+QodaUX5q+FL9Sh yWvbJaHhVNZJCtXzzaF9jUL9QJSQ2RzK2Fy8yaBpmPdN0PpOrs0jPS9094/bmeZYyir0 beNXgahx8e9rwYD5HHDtjJEUkNmb3PqG6XRspIL3X2AtKyKugJ1G+JnX3TVIxAX1Bmr6 ryKHDgNZWtyT95AZu8tEHqegCPDti16woIJ653pVjfkMijjH+n8E2pDsGkXhHzAKb5bE ovb8zScF1zb88XS8V7jNQorXFJ05aXtiiNAnWsQC13eFUQ+yBh043xVurzkQCSVo5jSE VI5g== 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=ii+UgCJP+tPdYxSJC+tW/iaYho3LkDYSDzYDIA5OxYY=; fh=rYI8DiHAAFX3O5g969KmOAQ7d45Sb8OxQX1+DywGDk4=; b=flBubTwuwDW7FeTZMA2Ws4kZslznGFvBUpXKDhBjaUKeT4CW9nsV3c/rWyaFDrYkTW prQaxW6mGknjTmQcjoO6UXbQRJPJxc2adwtYizzUFCWpgsh6gKQZqT3brgUW0TAbUoox RLfOSvR3zirlataTf8PNwWjkqSnTwCPuK+oYpFSPcLWX+aUndx+sgkz3QvsLvIwB5nvZ nZxde6ug3MShnbQ2bx3grC2IADpGv2/0Od/8fe6bVNiNgRzEfnRFgFPEUQSXEGnMCos4 Wz6z5Qo1dQ17BN1PlMql9M1KIxjzvzSiDbq0i57X19WabPk2+Ns+uoQx14NhiG4Or6/J M7jA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=ZSdBgwra; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as 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 q10-20020a05600c46ca00b004064b67428dsi802632wmo.2.2023.10.25.17.24.40 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 25 Oct 2023 17:24:40 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=ZSdBgwra; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as 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 1qvo6z-0002Mx-Mc; Wed, 25 Oct 2023 20:20: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 1qvo6G-0001Dz-OI for qemu-devel@nongnu.org; Wed, 25 Oct 2023 20:19:48 -0400 Received: from mail-pl1-x635.google.com ([2607:f8b0:4864:20::635]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qvo66-0006eJ-G9 for qemu-devel@nongnu.org; Wed, 25 Oct 2023 20:19:48 -0400 Received: by mail-pl1-x635.google.com with SMTP id d9443c01a7336-1c9b7c234a7so2320485ad.3 for ; Wed, 25 Oct 2023 17:19:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1698279577; x=1698884377; 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=ii+UgCJP+tPdYxSJC+tW/iaYho3LkDYSDzYDIA5OxYY=; b=ZSdBgwragL1KvGUP0Fuk+D9WS3MzvYj6MUu24GxX/cSphnyWKpObfhkOFYwNg54hLp bfgmQEe6AmIioYOA3/Obr3Ct360l6uGjzxSXT4OvULUYx69o6xRZQqSUA32cxPpSYOq2 YGHWwFHyjM99y7jv16sniH0DNMFkUNIYPsDGM1zUmgZl2gMwnkRHfSr+TO3TexYzYgWM 1wHv9acXMBwyYder8uZXNUOmamzGBN+FmUTz4khukMxCtCoztNBVzBCxNlQAjWsPxZJn eH93dV3sGfvvWHwAfQ+ZmxzYmmfHgQ0q7FzteLrLRh1NkkDdX3aQ1OItrwXT6CVZqTTe Aa9Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1698279577; x=1698884377; 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=ii+UgCJP+tPdYxSJC+tW/iaYho3LkDYSDzYDIA5OxYY=; b=bdf5KEAU14ey3E50RcLM0/zYivVCpKGVOZOQAnPXwIyjNTNor5sf2lUhOH8Lqbqxsi zwiD5FYDvsW0e5kjHGItorvFG+1fQe1DRyiKdQQkB1Tz51ABKlDsxJ8VTt9H0soS2pVj vdakLEjTAddmezi3w1RWWXwFG3v+gE3WtLKt5voVfZ7x+dAglhkjhdXo7bBlcdx+2UNq plOM0+Oss8NlypyXEHGcxfyzjDSCe3lxMD75J9hGMrJEbuXqeNn/YiKpIMrHs6ajKaE8 VQVQIJgvtnvKhkTe7hbQAvxu3j75M1RblLahN6A9KcLXayIR+zdb7JtLCUqMZ1Ydfb9y u31A== X-Gm-Message-State: AOJu0Yxa1HqvC7he4MYOH6BaGBtNks9n7jiLV5Tt6IpEFsvF4vYefPv9 5sRKL78+haGVWD57jqcbaDQbqr1aJBUR2mjevwQ= X-Received: by 2002:a17:903:191:b0:1c5:c546:febf with SMTP id z17-20020a170903019100b001c5c546febfmr18470105plg.35.1698279577073; Wed, 25 Oct 2023 17:19:37 -0700 (PDT) Received: from stoup.. ([71.212.149.95]) by smtp.gmail.com with ESMTPSA id jh1-20020a170903328100b001c5fc291ef9sm9754655plb.209.2023.10.25.17.19.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 25 Oct 2023 17:19:36 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: Mark Cave-Ayland Subject: [PULL 35/94] target/sparc: Move MULX to decodetree Date: Wed, 25 Oct 2023 17:14:43 -0700 Message-Id: <20231026001542.1141412-65-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231026001542.1141412-1-richard.henderson@linaro.org> References: <20231026001542.1141412-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::635; envelope-from=richard.henderson@linaro.org; helo=mail-pl1-x635.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org Tested-by: Mark Cave-Ayland Acked-by: Mark Cave-Ayland Signed-off-by: Richard Henderson --- target/sparc/insns.decode | 3 +++ target/sparc/translate.c | 8 +++----- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/target/sparc/insns.decode b/target/sparc/insns.decode index 1cff18fa1f..1a04a8e229 100644 --- a/target/sparc/insns.decode +++ b/target/sparc/insns.decode @@ -31,6 +31,7 @@ CALL 01 i:s30 &r_r_ri_cc rd rs1 rs2_or_imm imm:bool cc:bool @r_r_ri_cc .. rd:5 . cc:1 .... rs1:5 imm:1 rs2_or_imm:s13 &r_r_ri_cc +@r_r_ri_cc0 .. rd:5 ...... rs1:5 imm:1 rs2_or_imm:s13 &r_r_ri_cc cc=0 { [ @@ -165,6 +166,8 @@ ORN 10 ..... 0.0110 ..... . ............. @r_r_ri_cc XORN 10 ..... 0.0111 ..... . ............. @r_r_ri_cc ADDC 10 ..... 0.1000 ..... . ............. @r_r_ri_cc +MULX 10 ..... 001001 ..... . ............. @r_r_ri_cc0 + Tcc_r 10 0 cond:4 111010 rs1:5 0 cc:1 0000000 rs2:5 { # For v7, the entire simm13 field is present, but masked to 7 bits. diff --git a/target/sparc/translate.c b/target/sparc/translate.c index eb829acc68..2ecd9edb33 100644 --- a/target/sparc/translate.c +++ b/target/sparc/translate.c @@ -4073,6 +4073,7 @@ static bool do_arith(DisasContext *dc, arg_r_r_ri_cc *a, int cc_op, void (*func_cc)(TCGv, TCGv, TCGv)) { if (a->cc) { + assert(cc_op >= 0); return do_arith_int(dc, a, cc_op, func_cc, NULL); } return do_arith_int(dc, a, cc_op, func, funci); @@ -4096,6 +4097,8 @@ TRANS(ANDN, ALL, do_logic, a, tcg_gen_andc_tl, NULL) TRANS(ORN, ALL, do_logic, a, tcg_gen_orc_tl, NULL) TRANS(XORN, ALL, do_logic, a, tcg_gen_eqv_tl, NULL) +TRANS(MULX, 64, do_arith, a, -1, tcg_gen_mul_tl, tcg_gen_muli_tl, NULL) + static bool trans_OR(DisasContext *dc, arg_r_r_ri_cc *a) { /* OR with %g0 is the canonical alias for MOV. */ @@ -4561,11 +4564,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 Thu Oct 26 00:14: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: 738283 Delivered-To: patch@linaro.org Received: by 2002:adf:f842:0:b0:32d:baff:b0ca with SMTP id d2csp559299wrq; Wed, 25 Oct 2023 17:38:52 -0700 (PDT) X-Google-Smtp-Source: AGHT+IF94oAIVbdXZKadGAADe+Qn6Q+6yGy83PdnQk90xgu/15jbUEquGR6NUFrVWxVg/J+rNJ0i X-Received: by 2002:adf:f9cd:0:b0:32d:825d:f153 with SMTP id w13-20020adff9cd000000b0032d825df153mr12754734wrr.61.1698280732190; Wed, 25 Oct 2023 17:38:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698280732; cv=none; d=google.com; s=arc-20160816; b=Yd06n51Tar0szeLzbFk2D8GQ1lsCD+6jXKGEASYOedDfBZqIDfTEyvCzpi63nzZNCh miztlpy94te7HrG9o5IR42dcDFjkEf/7XfRbzJIV5tWCa07vCd9Ivak3EhlCdp2RPeU/ anQXnMockCxRWq10pcJaQCCd+tl7zv4Pc40iOheVuRE+OwqhEwPmm6UPJALBMAV1TnHv uFFtYegnsUAuNurKDkUri/kmtz8i73yrUewxZc4BMBev+07J2dt6TzH7A5+uXgzORTo2 bwHhGVtCY29xT4/te34Q3M24rt8Tl4A438VdxDvqB7Itf7zWpabtaq049QHLSto4uOWD KFEQ== 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=72s8HqffwPu4WrB9To1B78GgLRzIoL8cOwTuhEiKsh4=; fh=rYI8DiHAAFX3O5g969KmOAQ7d45Sb8OxQX1+DywGDk4=; b=sMG3rJOLEZ2VLwZs4YGhSqV4cETKtnViH/NxiNs426UDVcY9jovesqWBwvOM9RDCrJ YKmQC1U+x5CHl40Dvxt/BUJ4j1Jrn0kQzmetFHep1U7KQAK1W8lXZ1K15lney+1yOr21 Jgs8Avr7K+kv5gcdohOq2axdERLC8fjJaHinwuFHR4T1DC+mz8XFah6fhK46S4/b30o7 gsompq4at1iMu9afPU2Ia+oMl21zS6eDMuwTggmjRbnZYikgSdsj/XTL4bpGBCygoyij 3+JS7CEHab20UxyPuBpXqbx3UBRzq0dR2gG6hj78glj2VegsqyyxXW8NNj84ImvDm+5q RG2A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=osrR7jiK; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as 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 k14-20020a056000004e00b0032d83568f47si8201037wrx.457.2023.10.25.17.38.51 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 25 Oct 2023 17:38: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=osrR7jiK; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as 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 1qvo6n-0002Fl-9C; Wed, 25 Oct 2023 20:20:21 -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 1qvo6I-0001Ew-1Z for qemu-devel@nongnu.org; Wed, 25 Oct 2023 20:19:50 -0400 Received: from mail-pl1-x62d.google.com ([2607:f8b0:4864:20::62d]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qvo68-0006eQ-Ak for qemu-devel@nongnu.org; Wed, 25 Oct 2023 20:19:49 -0400 Received: by mail-pl1-x62d.google.com with SMTP id d9443c01a7336-1ca215cc713so2036785ad.3 for ; Wed, 25 Oct 2023 17:19:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1698279578; x=1698884378; 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=72s8HqffwPu4WrB9To1B78GgLRzIoL8cOwTuhEiKsh4=; b=osrR7jiK8VV9mAwnptytgb4SAqhjEs+j/8TP1PK3YSuShfBdc5VXCXP6D4uzUBHfDn 9Hpq68g3OhgqkOkdryYslmQ1/JArXIhnuF+hzDW/ZLCvewPcHJkUi5cyrjCdIbM3mqKF ug1IBbz0iLV8hf8gafSAhrG9cNULcQc0acH+UaeX2+3RMILU9rrweYRxUgAEXYnEObRm PVma5X6clsZJL4tbMUecfS6rDrtjt8A5hwfXTk6/9K7Dreaa8vnueKLMDBVucyEdBNzH YD+B/Jd2qGL+U9l+WSgavi4htJbuXrzpgijnxkLDrdOokR2g4/wVJpuqBSLluSDVoTpN LJvw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1698279578; x=1698884378; 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=72s8HqffwPu4WrB9To1B78GgLRzIoL8cOwTuhEiKsh4=; b=RxTvuwZTaP6q9IrDLUo491TZZddewvCrQhXYABcGDhiQD9f6OSz8PCSLvzR5aIGb7o S6bxOA2pgnWS+lGAwkJvCRDVExvo3HJIuUq5V3l095d2WhINbk1vamsRig/z1Ifl8vw1 yIW8hJns8zh0hP5Mkb028GFx6D1Aji5uc1+d+7zM6mpdEk2oV+G7jVEyUPO42AoeX+uI iSF3ht9QukgCBZkYc7u4p/UMaw1IuRvKobvSbX7t8LV96uU+s14Zd6sAefjfTx2A5MAo sKjCKNqLEJsmFnLINMJKlLtj697DofFr4cuTg2gDQa5dEmg2Eck3Lmx2xSjfJDsSP7SQ uXgw== X-Gm-Message-State: AOJu0Yz1A15HQETcsCCa6HhusAliqVKb04GP6FR1JOnJeEV7JyktJWqp 8BSpupmUdhK7qalGKjCjaepxQsp4gY33UWkGELk= X-Received: by 2002:a17:902:db0b:b0:1ca:79b6:ce42 with SMTP id m11-20020a170902db0b00b001ca79b6ce42mr14636107plx.47.1698279577829; Wed, 25 Oct 2023 17:19:37 -0700 (PDT) Received: from stoup.. ([71.212.149.95]) by smtp.gmail.com with ESMTPSA id jh1-20020a170903328100b001c5fc291ef9sm9754655plb.209.2023.10.25.17.19.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 25 Oct 2023 17:19:37 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: Mark Cave-Ayland Subject: [PULL 36/94] target/sparc: Move UMUL, SMUL to decodetree Date: Wed, 25 Oct 2023 17:14:44 -0700 Message-Id: <20231026001542.1141412-66-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231026001542.1141412-1-richard.henderson@linaro.org> References: <20231026001542.1141412-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::62d; envelope-from=richard.henderson@linaro.org; helo=mail-pl1-x62d.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org Tested-by: Mark Cave-Ayland Acked-by: Mark Cave-Ayland Signed-off-by: Richard Henderson --- target/sparc/insns.decode | 2 ++ target/sparc/translate.c | 22 ++++------------------ 2 files changed, 6 insertions(+), 18 deletions(-) diff --git a/target/sparc/insns.decode b/target/sparc/insns.decode index 1a04a8e229..d6a7256e71 100644 --- a/target/sparc/insns.decode +++ b/target/sparc/insns.decode @@ -167,6 +167,8 @@ XORN 10 ..... 0.0111 ..... . ............. @r_r_ri_cc ADDC 10 ..... 0.1000 ..... . ............. @r_r_ri_cc MULX 10 ..... 001001 ..... . ............. @r_r_ri_cc0 +UMUL 10 ..... 0.1010 ..... . ............. @r_r_ri_cc +SMUL 10 ..... 0.1011 ..... . ............. @r_r_ri_cc Tcc_r 10 0 cond:4 111010 rs1:5 0 cc:1 0000000 rs2:5 { diff --git a/target/sparc/translate.c b/target/sparc/translate.c index 2ecd9edb33..e7c3c68402 100644 --- a/target/sparc/translate.c +++ b/target/sparc/translate.c @@ -2888,6 +2888,7 @@ static void gen_faligndata(TCGv dst, TCGv gsr, TCGv s1, TCGv s2) #ifdef TARGET_SPARC64 # define avail_32(C) false # define avail_ASR17(C) false +# define avail_MUL(C) true # define avail_POWERDOWN(C) false # define avail_64(C) true # define avail_GL(C) ((C)->def->features & CPU_FEATURE_GL) @@ -2895,6 +2896,7 @@ static void gen_faligndata(TCGv dst, TCGv gsr, TCGv s1, TCGv s2) #else # define avail_32(C) true # define avail_ASR17(C) ((C)->def->features & CPU_FEATURE_ASR17) +# define avail_MUL(C) ((C)->def->features & CPU_FEATURE_MUL) # define avail_POWERDOWN(C) ((C)->def->features & CPU_FEATURE_POWERDOWN) # define avail_64(C) false # define avail_GL(C) false @@ -4098,6 +4100,8 @@ TRANS(ORN, ALL, do_logic, a, tcg_gen_orc_tl, NULL) TRANS(XORN, ALL, do_logic, a, tcg_gen_eqv_tl, NULL) TRANS(MULX, 64, do_arith, a, -1, tcg_gen_mul_tl, tcg_gen_muli_tl, NULL) +TRANS(UMUL, MUL, do_logic, a, gen_op_umul, NULL) +TRANS(SMUL, MUL, do_logic, a, gen_op_smul, NULL) static bool trans_OR(DisasContext *dc, arg_r_r_ri_cc *a) { @@ -4564,24 +4568,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 Thu Oct 26 00:14: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: 738254 Delivered-To: patch@linaro.org Received: by 2002:adf:f842:0:b0:32d:baff:b0ca with SMTP id d2csp557488wrq; Wed, 25 Oct 2023 17:33:17 -0700 (PDT) X-Google-Smtp-Source: AGHT+IG35rEOMwF3Yx+7HFEfSm+hrDEYjfMYkE1HPZZN0dT0JgN+HG7mxRelEVC/cHRkh6aPJ9dV X-Received: by 2002:a2e:8544:0:b0:2c5:3492:5d96 with SMTP id u4-20020a2e8544000000b002c534925d96mr11988381ljj.12.1698280397733; Wed, 25 Oct 2023 17:33:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698280397; cv=none; d=google.com; s=arc-20160816; b=RfrcsiQr9jOddQU45qZV752N+0PNBHbOMSL46ThPQp79H4Ddpk4D5XzTRG5+wRh8sz m/zzXIHQRscNt0mi2w62U7bzH2q0/274XEicY6sczTBCtvCxkVM/wM2xwCHJI9r4mX7s k/JCSs0VRL9AMubnzP+WxfbocpAjNDC09YTV/mLvUo23dIkpX9qMNP4C3INcnUWPodBy ye4a3Jz6vg+eTu/Aw3CUvxab0TyxmvAOepMA3NGnItwf2no9GoQt88U3qgCqr8QvlO4/ ZsGDR6YOUVt8LpkE/SovfSqyYGvzdRMX20JfHjZIV8drV6Oozjmreg3DPxmcNTnGiEei WoKw== 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=Hha0FUqXQ6TXOMfH2RRgnruE6/BvIlYzO4Xx1oTtT4o=; fh=rYI8DiHAAFX3O5g969KmOAQ7d45Sb8OxQX1+DywGDk4=; b=XUrtpF75FtR1YqHV6N9rlUOw+pkrXs5qbD1YAJW36PP09I3UGqwZeIuiNOll+aX5kM C3iZllflnq8je9dUwcK9/wUDswdbMUG/R/NplKwVwmoUzB3m5AqM2p3KRueUQs5iuxve XaPeCCnIH1VexhvzNnQU80ml4ANMpDYZDnaYZsMTh/scZcceXTjR8o3ylA91/XF8uzAD pjRy8C8UrRyg38ZcppHT4aPH7AwY5p5ol0owXBNzDayOrGg88nNEQathCYPzP8tpH6YQ La+w0PEvR6KupBAKvTHYE5byNWCCA2RoU/Jud0xRv/2AXI0XVKB5+J9hD+363RjtIcv2 0xCQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=KslmL5a1; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as 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 p23-20020a05600c1d9700b00403c8dd94e0si804664wms.54.2023.10.25.17.33.17 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 25 Oct 2023 17:33:17 -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=KslmL5a1; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as 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 1qvo6P-0001f0-FK; Wed, 25 Oct 2023 20:19: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 1qvo6I-0001Fl-Dk for qemu-devel@nongnu.org; Wed, 25 Oct 2023 20:19:50 -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 1qvo68-0006gu-BB for qemu-devel@nongnu.org; Wed, 25 Oct 2023 20:19:50 -0400 Received: by mail-pl1-x634.google.com with SMTP id d9443c01a7336-1c9daca2b85so2203375ad.1 for ; Wed, 25 Oct 2023 17:19:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1698279579; x=1698884379; 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=Hha0FUqXQ6TXOMfH2RRgnruE6/BvIlYzO4Xx1oTtT4o=; b=KslmL5a11SbbeH1AQmNHkQOZOoOC7r8sCHrMapvNNxQ3yC3E/nauII9xz2NtY3pRxM 4vGOdIv2OT1lu/v6jbYcBzOG9tRKpwRRis7KPXo1fwFZbBmKwef9Yt8sDdaROhdyBCHG PoosUfMxyy5FPdwpXwFMe1MuVLcIZMakP51vzoHn3TIM7GLq+YEX44rDSQFzoB5luwgm NEsWjvyx9htoEMfjA1Ijy6WxTWzat/TSka6n6iY+tKkWKP48wuEp0BWdNLm1FphdcAdr MwHV6/2GDTffi8ejUXlJ5y4drdAheQ17TeXpYnvBqDor9bhJbatxyJB5/LAJcqfYY1yt 3gFQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1698279579; x=1698884379; 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=Hha0FUqXQ6TXOMfH2RRgnruE6/BvIlYzO4Xx1oTtT4o=; b=LSeXwRpxc9jT1yvoIBmXqwftbRceSya6mrB7y8kfCSXBm8J2dRK5kj6lunqArW+EaJ D3N3CS8P/yF+PQ7OqxlKWQk90zjIWlKkf0BKtCVolR50RI5kRN2n9/Mmb1wirsWhkA/O 7VbLa62US8NNIvPZdMXG5/P8S3fBawzTDsjXEkE9Gr1EvhHimhXwtTrflcfNLQiFKgP2 mJgl1SQlxPVHWAHAr5aeZRz333DBig8orvUAJWxMV3CWHzZqSh/t1FckrOU60DRaXS9X /45yDb7kiLQl7kNc9s2d9q5NjtBTnGNa+X07aZl82sdpPNMvYpNGeXNUqY7rhTjFMpBA PuuQ== X-Gm-Message-State: AOJu0Ywaingqvu+DOvlXO9Im5bno5tF6BrzpqAjiX1XEL8jQzHxWMoN/ XRG4GaIA2QXtsZJxhHT8u5VtJiYknGzjSQMw/UY= X-Received: by 2002:a17:902:e545:b0:1c9:ddd8:9950 with SMTP id n5-20020a170902e54500b001c9ddd89950mr1584571plf.21.1698279578755; Wed, 25 Oct 2023 17:19:38 -0700 (PDT) Received: from stoup.. ([71.212.149.95]) by smtp.gmail.com with ESMTPSA id jh1-20020a170903328100b001c5fc291ef9sm9754655plb.209.2023.10.25.17.19.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 25 Oct 2023 17:19:38 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: Mark Cave-Ayland Subject: [PULL 37/94] target/sparc: Move SUBC to decodetree Date: Wed, 25 Oct 2023 17:14:45 -0700 Message-Id: <20231026001542.1141412-67-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231026001542.1141412-1-richard.henderson@linaro.org> References: <20231026001542.1141412-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::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 Tested-by: Mark Cave-Ayland Acked-by: Mark Cave-Ayland Signed-off-by: Richard Henderson --- target/sparc/insns.decode | 1 + target/sparc/translate.c | 139 ++++++++++++++++++++++++-------------- 2 files changed, 90 insertions(+), 50 deletions(-) diff --git a/target/sparc/insns.decode b/target/sparc/insns.decode index d6a7256e71..a188452d2e 100644 --- a/target/sparc/insns.decode +++ b/target/sparc/insns.decode @@ -165,6 +165,7 @@ ANDN 10 ..... 0.0101 ..... . ............. @r_r_ri_cc ORN 10 ..... 0.0110 ..... . ............. @r_r_ri_cc XORN 10 ..... 0.0111 ..... . ............. @r_r_ri_cc ADDC 10 ..... 0.1000 ..... . ............. @r_r_ri_cc +SUBC 10 ..... 0.1100 ..... . ............. @r_r_ri_cc MULX 10 ..... 001001 ..... . ............. @r_r_ri_cc0 UMUL 10 ..... 0.1010 ..... . ............. @r_r_ri_cc diff --git a/target/sparc/translate.c b/target/sparc/translate.c index e7c3c68402..b8fbd18a4c 100644 --- a/target/sparc/translate.c +++ b/target/sparc/translate.c @@ -538,51 +538,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); @@ -593,16 +553,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_add32_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; @@ -4144,6 +4163,30 @@ static bool trans_ADDC(DisasContext *dc, arg_r_r_ri_cc *a) } } +static bool trans_SUBC(DisasContext *dc, arg_r_r_ri_cc *a) +{ + switch (dc->cc_op) { + case CC_OP_DIV: + case CC_OP_LOGIC: + /* Carry is known to be zero. Fall back to plain SUB. */ + return do_arith(dc, a, CC_OP_SUB, + tcg_gen_sub_tl, tcg_gen_subi_tl, gen_op_sub_cc); + case CC_OP_ADD: + case CC_OP_TADD: + case CC_OP_TADDTV: + return do_arith(dc, a, CC_OP_SUBX, + gen_op_subc_add, NULL, gen_op_subccc_add); + case CC_OP_SUB: + case CC_OP_TSUB: + case CC_OP_TSUBTV: + return do_arith(dc, a, CC_OP_SUBX, + gen_op_subc_sub, NULL, gen_op_subccc_sub); + default: + return do_arith(dc, a, CC_OP_SUBX, + gen_op_subc_generic, NULL, gen_op_subccc_generic); + } +} + #define CHECK_IU_FEATURE(dc, FEATURE) \ if (!((dc)->def->features & CPU_FEATURE_ ## FEATURE)) \ goto illegal_insn; @@ -4568,10 +4611,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 Thu Oct 26 00:14: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: 738279 Delivered-To: patch@linaro.org Received: by 2002:adf:f842:0:b0:32d:baff:b0ca with SMTP id d2csp559221wrq; Wed, 25 Oct 2023 17:38:35 -0700 (PDT) X-Google-Smtp-Source: AGHT+IE51g6mcFfKnOCWbkk0DBS9Hw7UhPDA8vHDst1CXI8ZBsiV7T9rE+3pKk40WJ8vDC4FeDFE X-Received: by 2002:a2e:9812:0:b0:2bd:102c:4161 with SMTP id a18-20020a2e9812000000b002bd102c4161mr13207461ljj.43.1698280715533; Wed, 25 Oct 2023 17:38:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698280715; cv=none; d=google.com; s=arc-20160816; b=BOiF/EIXVvwCAfSwhmyEuMiXczqLr810ipCS6H9vOH/GtrP2XXTnAdi/3z2IVPyTuW WAy5jxfTKFg1QX21OL98wBC0HELvf6faK94fEg1/d7jIamXD959RVkaQqwET+S0JHC0W 1PdfMjFXWrQfR4Buv9WCVNJE48t9mEDOrrDk1At0L9yM5888tI+EI+77Atd6DfTgYfkx fWeWjptIuqRJyjh7grDDJx0wd2DC+c4tAgzFXyvpiFOBraSOs1DGF5kY44yi8vwzlhjR M+hMeaxoPPAXj4zdCiTdNMDGD3McL/dy6Y7YfOcdipOq2ekIycUMqKwVIEOAA206l3MW ey6Q== 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=bPj9+ObK+DfulKal4BkwqX+PvjoTqBOnoBqmRlb19e8=; fh=rYI8DiHAAFX3O5g969KmOAQ7d45Sb8OxQX1+DywGDk4=; b=vGwKTk/w8fyAcPJK2Hg4BjWrY4LtegGwXHwjzQURzTqTvlcGtmmaL+sssuG7dS0ecq pROjVS2EJM+vcSHLUSkwSTQiPOZQIv87er6me3SrI6hHhQlOaqYbY+bGdLTCioj2iAYG yx/NeTnWKsSGedVUslJJ5Ph+247/089Py4fz2T/GjQHWOLG37aYXpvA30qfkCxZdV/X8 kyT2T+RtsnuWsFOYukkHd84Gk7kdymAZ/TwSFrEJeL6xbqO6HEgBrtTobTnv+ClH5OSs 6wp/lT/mg2BZZuM8MyyTHibV/g0bFGcolIwVVlWb6WxyH02e8pe9/oB2zKK6S2Hgp8HJ O+ig== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=cSH9eAkO; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as 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 iv14-20020a05600c548e00b0040648cfbe73si821228wmb.37.2023.10.25.17.38.35 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 25 Oct 2023 17:38: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=cSH9eAkO; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as 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 1qvo6q-0002Hg-Rv; Wed, 25 Oct 2023 20:20: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 1qvo6L-0001Rb-6S for qemu-devel@nongnu.org; Wed, 25 Oct 2023 20:19:53 -0400 Received: from mail-pl1-x635.google.com ([2607:f8b0:4864:20::635]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qvo6A-0006iP-6z for qemu-devel@nongnu.org; Wed, 25 Oct 2023 20:19:52 -0400 Received: by mail-pl1-x635.google.com with SMTP id d9443c01a7336-1c8a1541232so2483755ad.0 for ; Wed, 25 Oct 2023 17:19:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1698279580; x=1698884380; 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=bPj9+ObK+DfulKal4BkwqX+PvjoTqBOnoBqmRlb19e8=; b=cSH9eAkO/ZQEHUuWwRxX8USu6RUUD69mWGplb2SorwsPmO4PBk9xYzQfr7URoQyk5S F1xBzU0Dtn/CnLO2dqCD/qSaq5tHvRVUC3jNHIgki9awX6mgV7idiM4kM2GTWOrInPco vgMWNofV5gWUbq2yt7RGD74tm9oYxstxDPoXFpKMRt5H+vN74H39JR3S68qUIB8YSikG rmAbxvdeZaYKObPF/Ras7gcuYxr5WHDeFZMFp6i/Nf4VEsl9u/Qe8uOJ3oXEsUVXq7TW D54t+KuJ0SvwUwAdPi8oHciyHK+oh2sroW9a79DUQQDOtKs2Z6gYhaj+9exWIT0DpMeV fXnA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1698279580; x=1698884380; 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=bPj9+ObK+DfulKal4BkwqX+PvjoTqBOnoBqmRlb19e8=; b=vwZtA8rChz4yHQmfRmykUBon4uDIHZJ9mod0BVSWMtwxLM8XMmd2hr4BmtIqx1Jptj 0hXu6KztVnTpaAvIYNDU3R/SBEUx3lOAei6xyl543OxN9CdWQJgMy8HIWP7xo8u48+It NOoFQvIn30VFz9A/d08v1JVJbRmJnv9f4+08ny55um0ECZHlOT/nHTP71FQeb0J/ON5A OpUDvXX8KiWYDYqjmZs4Yjt+M4jzKpo/Vex5d7OeCVOUYjO1uQoU0JXOoGuup89qpV4s 5adSUcKbHQiqHC2SawgQTTd7zVJAt1a2/7KkDGrybOVIr1VfBqE26YHJEtsuhmFbrprU ZesQ== X-Gm-Message-State: AOJu0YzeMl0MVhEfHc0lvUXonfPCG9XeL/rk79NfF/Gnc2y8gVlA+be0 oz1iqf4kzvt6maqaUPwzPUST7Q9wegivrUwjr9U= X-Received: by 2002:a17:902:d083:b0:1c9:d968:5639 with SMTP id v3-20020a170902d08300b001c9d9685639mr14511225plv.48.1698279579780; Wed, 25 Oct 2023 17:19:39 -0700 (PDT) Received: from stoup.. ([71.212.149.95]) by smtp.gmail.com with ESMTPSA id jh1-20020a170903328100b001c5fc291ef9sm9754655plb.209.2023.10.25.17.19.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 25 Oct 2023 17:19:39 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: Mark Cave-Ayland Subject: [PULL 38/94] target/sparc: Move UDIVX, SDIVX to decodetree Date: Wed, 25 Oct 2023 17:14:46 -0700 Message-Id: <20231026001542.1141412-68-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231026001542.1141412-1-richard.henderson@linaro.org> References: <20231026001542.1141412-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::635; envelope-from=richard.henderson@linaro.org; helo=mail-pl1-x635.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_PASS=-0.001, T_SPF_HELO_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 Tested-by: Mark Cave-Ayland Acked-by: Mark Cave-Ayland Signed-off-by: Richard Henderson --- target/sparc/insns.decode | 3 +++ target/sparc/translate.c | 24 +++++++++++++++--------- 2 files changed, 18 insertions(+), 9 deletions(-) diff --git a/target/sparc/insns.decode b/target/sparc/insns.decode index a188452d2e..dd0ed3a993 100644 --- a/target/sparc/insns.decode +++ b/target/sparc/insns.decode @@ -171,6 +171,9 @@ MULX 10 ..... 001001 ..... . ............. @r_r_ri_cc0 UMUL 10 ..... 0.1010 ..... . ............. @r_r_ri_cc SMUL 10 ..... 0.1011 ..... . ............. @r_r_ri_cc +UDIVX 10 ..... 001101 ..... . ............. @r_r_ri_cc0 +SDIVX 10 ..... 101101 ..... . ............. @r_r_ri_cc0 + Tcc_r 10 0 cond:4 111010 rs1:5 0 cc:1 0000000 rs2:5 { # For v7, the entire simm13 field is present, but masked to 7 bits. diff --git a/target/sparc/translate.c b/target/sparc/translate.c index b8fbd18a4c..826ba0441b 100644 --- a/target/sparc/translate.c +++ b/target/sparc/translate.c @@ -47,10 +47,12 @@ # define gen_helper_rdcwp(D, E) qemu_build_not_reached() # define gen_helper_restored(E) qemu_build_not_reached() # define gen_helper_saved(E) qemu_build_not_reached() +# define gen_helper_sdivx(D, E, A, B) qemu_build_not_reached() # define gen_helper_set_softint(E, S) qemu_build_not_reached() # define gen_helper_tick_get_count(D, E, T, C) qemu_build_not_reached() # define gen_helper_tick_set_count(P, S) qemu_build_not_reached() # define gen_helper_tick_set_limit(P, S) qemu_build_not_reached() +# define gen_helper_udivx(D, E, A, B) 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) qemu_build_not_reached() @@ -698,6 +700,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) { @@ -4122,6 +4134,9 @@ TRANS(MULX, 64, do_arith, a, -1, tcg_gen_mul_tl, tcg_gen_muli_tl, NULL) TRANS(UMUL, MUL, do_logic, a, gen_op_umul, NULL) TRANS(SMUL, MUL, do_logic, a, gen_op_smul, NULL) +TRANS(UDIVX, 64, do_arith, a, -1, gen_op_udivx, NULL, NULL) +TRANS(SDIVX, 64, do_arith, a, -1, gen_op_sdivx, NULL, NULL) + static bool trans_OR(DisasContext *dc, arg_r_r_ri_cc *a) { /* OR with %g0 is the canonical alias for MOV. */ @@ -4611,11 +4626,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) { @@ -4753,10 +4763,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 Thu Oct 26 00:14: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: 738231 Delivered-To: patch@linaro.org Received: by 2002:adf:f842:0:b0:32d:baff:b0ca with SMTP id d2csp555373wrq; Wed, 25 Oct 2023 17:27:07 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEZ+uWLIiK1caU8i7D0BHedfexvEk4IiGBrrvAeSBIJEhbpuNfW55BQH3QcQTpC3Q+/+6Ba X-Received: by 2002:a17:907:1c0b:b0:9be:45b3:1c3c with SMTP id nc11-20020a1709071c0b00b009be45b31c3cmr15046087ejc.64.1698280026985; Wed, 25 Oct 2023 17:27:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698280026; cv=none; d=google.com; s=arc-20160816; b=z4FmbloXnjS8573sYtJGvQTRpN+Di1gUZe6kZvTecIGKdjcys1B5Y24lSM7YGnOBKG CautEASTkM7Kh8LsWZxMHN/hK+srozrY46LzeHzfUyIbx0gDBOckU1s8A798S3GQ9TwG cD2auNFZRhgCfV9MBW5o1PrpCb5mg526PJM1YcVSR0/njBSA5pfs5iQbMkfW6LyhMGpv gPZcoVP1penG2TqK3QCLF5YsOIJPHC1PvG9hxnhguFitZ74yOTZCeCHqpOuDpPWSEfCT joaUgaZ0sG1NYP/YdEQO8SXfgm+XvT636z1y2UFweaEHao+2GsDA6j6/EoEjD9C7YOVw Gzmw== 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=8tOhWbytnEkVCtnvtdU0qc/aSyodbka2sUWdoaMkej8=; fh=rYI8DiHAAFX3O5g969KmOAQ7d45Sb8OxQX1+DywGDk4=; b=NZg5wG8GLExWCPEa9mtB02XAo/V2y61SoCSQNfn0A26sXk5mnI/XGf/pVneqenaBYN OFfu499crQCwj4z9nkgcrNc5K7Dh11x8pnJeNpckZYZYsJQrETLU83UENC0DyAKqmDw8 MRNi7Fs5W1FSiU/5Bey/C9TNwXh5UB4SymAOW7RBYRJq4Ur11hIQHfPYvBOVQbxjk+x+ kEc6/kR8A+R089x0DKpt/khfRA80oEwBOtR5NtZ1QZhP28vsV+hUxght0pl0jDsEfwHt bB+HmUP+M35Bd5zxsH7XDkMparU/PQ4fNyxGzW9CwVRYYpA9V1U1rm3UJSN/ndmR9mp2 8oYA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=N+3oggYk; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as 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 my12-20020a1709065a4c00b009c76096cb97si5841297ejc.133.2023.10.25.17.27.06 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 25 Oct 2023 17:27: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=N+3oggYk; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as 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 1qvo6o-0002GX-HA; Wed, 25 Oct 2023 20:20:22 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qvo6I-0001GG-GR for qemu-devel@nongnu.org; Wed, 25 Oct 2023 20:19:50 -0400 Received: from mail-pl1-x630.google.com ([2607:f8b0:4864:20::630]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qvo6A-0006lF-7F for qemu-devel@nongnu.org; Wed, 25 Oct 2023 20:19:50 -0400 Received: by mail-pl1-x630.google.com with SMTP id d9443c01a7336-1c9bca1d96cso2187975ad.3 for ; Wed, 25 Oct 2023 17:19:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1698279580; x=1698884380; 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=8tOhWbytnEkVCtnvtdU0qc/aSyodbka2sUWdoaMkej8=; b=N+3oggYkzPVVA2F2TNgSeX3CtAiU17KstwO34PBLAJ5cxh3DNLa32Jv7hXXFBwWgbo SsX4euR8l9UMTn6ATVBanFRr5Yys90MYY42Q4x+Gwk6cPMD9mZkVga56zwHLPyvCeKK7 Sk6D7L4i0m1B5ayZJxMnCgCOo5N3LCUOuUS8jMUElORijhnpdbs5Y2N+wyxD0mhvRS3h hvH7euu3Z2bV1uI2c1MloYMzfvpNkneZPAGkKPwHUIwSBQd4N8ayk8i9321wZ7kTRhC3 dEhHRmpm2XTo9Vj9iU8b7U8fiE0NBHVLS/89klk0N7T+zcvrT68xltgjgCcY8Si/heIw oAaA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1698279580; x=1698884380; 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=8tOhWbytnEkVCtnvtdU0qc/aSyodbka2sUWdoaMkej8=; b=JI0/pCO0olozaWv4KwPhSGL+H01xZprqfCEHm3wpcJ7u1Z2s6x6CbSpRR5OZtmlD5B DgiAFmDglRMWW6+vB6sSWlpWBkx2LMANfEmWTakWrAhKGZ9yxkiILXPzeZQpbQXW+FP4 M3z9cGjwTDfpTw17ZSQ9NMvUQlE0TmTfU8o+NTaRIGjX1YZA3r63eXf9PdvWhoU1oL+b dWIy2KtLV16kVXsbk2rouYABvG0pUlAjQLskJK7az2F4LB5fIueDqYOhQZcmoDYy9va9 XIxmjpHmbYtludzCWxD0//JkaVNDmcp5+Uvp79RnQxbxbvSeYFkcJBMuvNPuJ7hMwDYY c6oA== X-Gm-Message-State: AOJu0YwEHw5ueJi7eCu/zvtDXRrOikLpuYObv3JeaakIekVRTW/3k/9T aoOuoTj5fedbamDPnmDoj9oMZBuSEK8Cyu5YVF4= X-Received: by 2002:a17:902:f550:b0:1ca:8541:e1ea with SMTP id h16-20020a170902f55000b001ca8541e1eamr15875325plf.0.1698279580514; Wed, 25 Oct 2023 17:19:40 -0700 (PDT) Received: from stoup.. ([71.212.149.95]) by smtp.gmail.com with ESMTPSA id jh1-20020a170903328100b001c5fc291ef9sm9754655plb.209.2023.10.25.17.19.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 25 Oct 2023 17:19:40 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: Mark Cave-Ayland Subject: [PULL 39/94] target/sparc: Move UDIV, SDIV to decodetree Date: Wed, 25 Oct 2023 17:14:47 -0700 Message-Id: <20231026001542.1141412-69-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231026001542.1141412-1-richard.henderson@linaro.org> References: <20231026001542.1141412-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::630; envelope-from=richard.henderson@linaro.org; helo=mail-pl1-x630.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org Tested-by: Mark Cave-Ayland Acked-by: Mark Cave-Ayland Signed-off-by: Richard Henderson --- target/sparc/insns.decode | 2 ++ target/sparc/helper.c | 4 --- target/sparc/translate.c | 54 ++++++++++++++++++--------------------- 3 files changed, 27 insertions(+), 33 deletions(-) diff --git a/target/sparc/insns.decode b/target/sparc/insns.decode index dd0ed3a993..4415d03858 100644 --- a/target/sparc/insns.decode +++ b/target/sparc/insns.decode @@ -173,6 +173,8 @@ SMUL 10 ..... 0.1011 ..... . ............. @r_r_ri_cc UDIVX 10 ..... 001101 ..... . ............. @r_r_ri_cc0 SDIVX 10 ..... 101101 ..... . ............. @r_r_ri_cc0 +UDIV 10 ..... 0.1110 ..... . ............. @r_r_ri_cc +SDIV 10 ..... 0.1111 ..... . ............. @r_r_ri_cc Tcc_r 10 0 cond:4 111010 rs1:5 0 cc:1 0000000 rs2:5 { diff --git a/target/sparc/helper.c b/target/sparc/helper.c index c4358bba84..e25fdaeedd 100644 --- a/target/sparc/helper.c +++ b/target/sparc/helper.c @@ -102,9 +102,7 @@ static target_ulong do_udiv(CPUSPARCState *env, target_ulong a, } if (cc) { - env->cc_dst = x0; env->cc_src2 = overflow; - env->cc_op = CC_OP_DIV; } return x0; } @@ -143,9 +141,7 @@ static target_ulong do_sdiv(CPUSPARCState *env, target_ulong a, } if (cc) { - env->cc_dst = x0; env->cc_src2 = overflow; - env->cc_op = CC_OP_DIV; } return x0; } diff --git a/target/sparc/translate.c b/target/sparc/translate.c index 826ba0441b..1ebaaa1114 100644 --- a/target/sparc/translate.c +++ b/target/sparc/translate.c @@ -710,6 +710,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) { @@ -2919,6 +2939,7 @@ static void gen_faligndata(TCGv dst, TCGv gsr, TCGv s1, TCGv s2) #ifdef TARGET_SPARC64 # define avail_32(C) false # define avail_ASR17(C) false +# define avail_DIV(C) true # define avail_MUL(C) true # define avail_POWERDOWN(C) false # define avail_64(C) true @@ -2927,6 +2948,7 @@ static void gen_faligndata(TCGv dst, TCGv gsr, TCGv s1, TCGv s2) #else # define avail_32(C) true # define avail_ASR17(C) ((C)->def->features & CPU_FEATURE_ASR17) +# define avail_DIV(C) ((C)->def->features & CPU_FEATURE_DIV) # define avail_MUL(C) ((C)->def->features & CPU_FEATURE_MUL) # define avail_POWERDOWN(C) ((C)->def->features & CPU_FEATURE_POWERDOWN) # define avail_64(C) false @@ -4136,6 +4158,8 @@ TRANS(SMUL, MUL, do_logic, a, gen_op_smul, NULL) TRANS(UDIVX, 64, do_arith, a, -1, gen_op_udivx, NULL, NULL) TRANS(SDIVX, 64, do_arith, a, -1, gen_op_sdivx, NULL, NULL) +TRANS(UDIV, DIV, do_arith, a, CC_OP_DIV, gen_op_udiv, NULL, gen_op_udivcc) +TRANS(SDIV, DIV, do_arith, a, CC_OP_DIV, gen_op_sdiv, NULL, gen_op_sdivcc) static bool trans_OR(DisasContext *dc, arg_r_r_ri_cc *a) { @@ -4623,35 +4647,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 Thu Oct 26 00:14: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: 738258 Delivered-To: patch@linaro.org Received: by 2002:adf:f842:0:b0:32d:baff:b0ca with SMTP id d2csp557526wrq; Wed, 25 Oct 2023 17:33:23 -0700 (PDT) X-Google-Smtp-Source: AGHT+IG9PN65HAb+XhBcewpy5dm6P4rFfstsSh+CCXFlvmeWmXbruce+cUxj9qdUp9nJXXPb58G8 X-Received: by 2002:a5d:43ca:0:b0:32d:bf28:4519 with SMTP id v10-20020a5d43ca000000b0032dbf284519mr12383012wrr.38.1698280403671; Wed, 25 Oct 2023 17:33:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698280403; cv=none; d=google.com; s=arc-20160816; b=hYlo18bk3G7VyiGp16QJAxjDggqXhIFRW/O7kRsaIBPaTxeKrPUTet5/xwW7uluehp TzInFlsnmsJsYPuTig5SlVEZaOCyljaPR5nhQ/uAvn9Ns6BO2bOKFWT39S9wJvPlCtEz +3AMrI+eLZviIfoclXfG6dNi/w/rp46kBggFJlm8hSX09GWmwUnpq68WoTHbBC4xE0iy kh8T8YGiCx3oy2ympNVpDqsrM4Ax19qEfs/l/s/5YVK8ME5b3TJs4cz6le5xZRppVm5Q x6XR9smpFiiLMCUS3D/D2ugNo35seKDs87+d9bQdV39vI4tkir6d4uuYqJ6Ur4SU2PVW l0Cg== 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=5qmRgRparTj0SEd6WHdvCzqYVoVclLUZvYDDLn1Vsfg=; fh=rYI8DiHAAFX3O5g969KmOAQ7d45Sb8OxQX1+DywGDk4=; b=U0oNWqcEDCLhqxyEfpwvYzPSRUSy5K6YC8QNO7k9JzC+swjyPAIJQq1lmctI1mbKFm g/U6c+cR3E+JQ6cd9CDIiDlC8HJEkL0Z2HWNWav04Nb4a/lIgfyPZ5JZaZUHQzMKcm7i 8yZZAk+KwHi212b1sVWNWvW+Axie7fJkkwQO3P73wgB4ix+gcAoSCq4UFJVddZgmjYmv IMjE60exHW6Xs0YvgyZabfuwx/vRdsHV7hamPnTgD8q48dhHSkhjhs1LgYKmIYkhkylw CF6vYAfRcVmyYiLIksBtEDwCHAu4guFD49cVrB4QBkckR4SaljTI+MtREr2KFJVM7ITI oflQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=v01OkbSj; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as 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 bx26-20020a5d5b1a000000b0032f5cc49a1dsi1597588wrb.663.2023.10.25.17.33.23 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 25 Oct 2023 17: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=v01OkbSj; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as 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 1qvo6h-0002B4-FP; Wed, 25 Oct 2023 20:20: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 1qvo6I-0001IA-PF for qemu-devel@nongnu.org; Wed, 25 Oct 2023 20:19:52 -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 1qvo6B-0006m8-EV for qemu-devel@nongnu.org; Wed, 25 Oct 2023 20:19:50 -0400 Received: by mail-pf1-x436.google.com with SMTP id d2e1a72fcca58-6b26a3163acso278447b3a.2 for ; Wed, 25 Oct 2023 17:19:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1698279581; x=1698884381; 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=5qmRgRparTj0SEd6WHdvCzqYVoVclLUZvYDDLn1Vsfg=; b=v01OkbSjjI4jjJduCyCOptFqVmb0/Okl4rIwy+wo29sQ3Cl7dNdx9g75edAFJ81Y8q TSdR1QGkq9VX7lBdRjcTsTrXNBHQ5waI5y0Gh5ktyE/wlSHcFrdIOxK68osV3vd7pHl7 h7JiO88gejyQvfeHVe/uYQ9NRvxLV6QF7Z/M0HDEECuAby4U16VgbcBvOSJUzcwlF5O1 elFhxwqK5qEbCnqcIu54UEreiXG+/X95e1oLhbpEZVj+nbe4VnHbk+/iRGh4QD9qgqYT YOxzWZTs0RRrwwZiTMa8MJrcILHqocFzsWovwpy1wqupX9XbCpe5UL7Q/jrNb+t2yYBm K1Cw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1698279581; x=1698884381; 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=5qmRgRparTj0SEd6WHdvCzqYVoVclLUZvYDDLn1Vsfg=; b=sLAQn0D59tKyrw5s2ERu7vSmngnN466tsdGqLG3zXospCHDeYlkumsv/NX6EEg4lIW IK6fiC/vsTMeTu8pdMmJ598YUeo3vkxd5cnVeyHmmHIigvAqapMVrrgaxcZPK/ZebSpe uC8EDPahhnm5Sgic6C2uhEJtf3lkxdy+bY26vHQ0KHMObz9jCN6XoMPchNMWqVt5Anv1 xemvbBdRXmtCgoetHlF9qz4R1gcbGPITY2S+SmjFpH9kwXzgUX0ybUv8HT6Y0fKrA3hC L2ZxxaqWhSMd2jflvwdy+lTz9MTRV5CTq4Dms6PipxKYAnYqf1/7fKYhzrfuVb9/mwvu C6ig== X-Gm-Message-State: AOJu0YxfwIQIalmANMuRZQYUcetH81Q3UKhbAD3OIfx75pkr3zpUddiq AWxZucxkJlN1qLVYrPsOJQFjk/jtxmYKshlfJ0Q= X-Received: by 2002:a05:6a20:54a7:b0:15e:2d9f:cae0 with SMTP id i39-20020a056a2054a700b0015e2d9fcae0mr8323941pzk.10.1698279581308; Wed, 25 Oct 2023 17:19:41 -0700 (PDT) Received: from stoup.. ([71.212.149.95]) by smtp.gmail.com with ESMTPSA id jh1-20020a170903328100b001c5fc291ef9sm9754655plb.209.2023.10.25.17.19.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 25 Oct 2023 17:19:40 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: Mark Cave-Ayland Subject: [PULL 40/94] target/sparc: Move TADD, TSUB, MULS to decodetree Date: Wed, 25 Oct 2023 17:14:48 -0700 Message-Id: <20231026001542.1141412-70-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231026001542.1141412-1-richard.henderson@linaro.org> References: <20231026001542.1141412-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::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 Tested-by: Mark Cave-Ayland Acked-by: Mark Cave-Ayland Signed-off-by: Richard Henderson --- target/sparc/insns.decode | 7 ++++++ target/sparc/helper.c | 4 ---- target/sparc/translate.c | 48 ++++++++++++++++++--------------------- 3 files changed, 29 insertions(+), 30 deletions(-) diff --git a/target/sparc/insns.decode b/target/sparc/insns.decode index 4415d03858..b35921aabb 100644 --- a/target/sparc/insns.decode +++ b/target/sparc/insns.decode @@ -32,6 +32,7 @@ CALL 01 i:s30 &r_r_ri_cc rd rs1 rs2_or_imm imm:bool cc:bool @r_r_ri_cc .. rd:5 . cc:1 .... rs1:5 imm:1 rs2_or_imm:s13 &r_r_ri_cc @r_r_ri_cc0 .. rd:5 ...... rs1:5 imm:1 rs2_or_imm:s13 &r_r_ri_cc cc=0 +@r_r_ri_cc1 .. rd:5 ...... rs1:5 imm:1 rs2_or_imm:s13 &r_r_ri_cc cc=1 { [ @@ -170,12 +171,18 @@ SUBC 10 ..... 0.1100 ..... . ............. @r_r_ri_cc MULX 10 ..... 001001 ..... . ............. @r_r_ri_cc0 UMUL 10 ..... 0.1010 ..... . ............. @r_r_ri_cc SMUL 10 ..... 0.1011 ..... . ............. @r_r_ri_cc +MULScc 10 ..... 100100 ..... . ............. @r_r_ri_cc1 UDIVX 10 ..... 001101 ..... . ............. @r_r_ri_cc0 SDIVX 10 ..... 101101 ..... . ............. @r_r_ri_cc0 UDIV 10 ..... 0.1110 ..... . ............. @r_r_ri_cc SDIV 10 ..... 0.1111 ..... . ............. @r_r_ri_cc +TADDcc 10 ..... 100000 ..... . ............. @r_r_ri_cc1 +TSUBcc 10 ..... 100001 ..... . ............. @r_r_ri_cc1 +TADDccTV 10 ..... 100010 ..... . ............. @r_r_ri_cc1 +TSUBccTV 10 ..... 100011 ..... . ............. @r_r_ri_cc1 + Tcc_r 10 0 cond:4 111010 rs1:5 0 cc:1 0000000 rs2:5 { # For v7, the entire simm13 field is present, but masked to 7 bits. diff --git a/target/sparc/helper.c b/target/sparc/helper.c index e25fdaeedd..2bcdc81d54 100644 --- a/target/sparc/helper.c +++ b/target/sparc/helper.c @@ -198,10 +198,8 @@ target_ulong helper_taddcctv(CPUSPARCState *env, target_ulong src1, } /* Only modify the CC after any exceptions have been generated. */ - env->cc_op = CC_OP_TADDTV; env->cc_src = src1; env->cc_src2 = src2; - env->cc_dst = dst; return dst; tag_overflow: @@ -226,10 +224,8 @@ target_ulong helper_tsubcctv(CPUSPARCState *env, target_ulong src1, } /* Only modify the CC after any exceptions have been generated. */ - env->cc_op = CC_OP_TSUBTV; env->cc_src = src1; env->cc_src2 = src2; - env->cc_dst = dst; return dst; tag_overflow: diff --git a/target/sparc/translate.c b/target/sparc/translate.c index 1ebaaa1114..861c6e8f1e 100644 --- a/target/sparc/translate.c +++ b/target/sparc/translate.c @@ -730,6 +730,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) { @@ -4146,6 +4156,11 @@ TRANS(ADD, ALL, do_arith, a, CC_OP_ADD, TRANS(SUB, ALL, do_arith, a, CC_OP_SUB, tcg_gen_sub_tl, tcg_gen_subi_tl, gen_op_sub_cc) +TRANS(TADDcc, ALL, do_arith, a, CC_OP_TADD, NULL, NULL, gen_op_add_cc) +TRANS(TSUBcc, ALL, do_arith, a, CC_OP_TSUB, NULL, NULL, gen_op_sub_cc) +TRANS(TADDccTV, ALL, do_arith, a, CC_OP_TADDTV, NULL, NULL, gen_op_taddcctv) +TRANS(TSUBccTV, ALL, do_arith, a, CC_OP_TSUBTV, NULL, NULL, gen_op_tsubcctv) + TRANS(AND, ALL, do_logic, a, tcg_gen_and_tl, tcg_gen_andi_tl) TRANS(XOR, ALL, do_logic, a, tcg_gen_xor_tl, tcg_gen_xori_tl) TRANS(ANDN, ALL, do_logic, a, tcg_gen_andc_tl, NULL) @@ -4226,6 +4241,12 @@ static bool trans_SUBC(DisasContext *dc, arg_r_r_ri_cc *a) } } +static bool trans_MULScc(DisasContext *dc, arg_r_r_ri_cc *a) +{ + update_psr(dc); + return do_arith(dc, a, CC_OP_ADD, NULL, NULL, gen_op_mulscc); +} + #define CHECK_IU_FEATURE(dc, FEATURE) \ if (!((dc)->def->features & CPU_FEATURE_ ## FEATURE)) \ goto illegal_insn; @@ -4653,36 +4674,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 Thu Oct 26 00:14: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: 738205 Delivered-To: patch@linaro.org Received: by 2002:adf:f842:0:b0:32d:baff:b0ca with SMTP id d2csp553767wrq; Wed, 25 Oct 2023 17:22:11 -0700 (PDT) X-Google-Smtp-Source: AGHT+IF/d4xXwvMuLEqvZ5HLF3L1TP4cvv27uXKgvz1z0TQbfn1Wn5jGLivMR3UpkyI8+cal7VHq X-Received: by 2002:adf:f711:0:b0:32d:b051:9a2b with SMTP id r17-20020adff711000000b0032db0519a2bmr12789656wrp.2.1698279731076; Wed, 25 Oct 2023 17:22:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698279731; cv=none; d=google.com; s=arc-20160816; b=uesZleTWRPu5adbRt8UeP2WY4vn5PZrlD152PZH28tZqVMQoxcNIwArGgb+6T74GFj qs3vo40MAZmncOqGNzp9ZwMWixxeVmRP0aYA4JLeVAMzqO7UIC816ju9o6k0d7f8bWo0 rVRY6h+ZE+s1MC05fJDELFeKfJ6bUx4Ku0Q4kItvP2Yu5u7hUs9McJuXEbOXJlX0yvCo /d1L2EDZBe+YW/XjIw/hSb8N3hHrMLFwihQGn4eJcUkdZLMsqWkZAq9EbYZoZIoO7rxC zQjPM2stqwn++F3cNWU/1A9qlVlLhjgEcgG65Rn1jpL846B5BNEpe0p6G84g6AuCQw6w XOEw== 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=ZPfCIyMItq9qsbpSlNc7YkH4PMGNqYlgO15lo4Wg0C0=; fh=rYI8DiHAAFX3O5g969KmOAQ7d45Sb8OxQX1+DywGDk4=; b=SKH2F1YsrCBL9z/HTmAIFtrchRs6Nv3tkAveo+XIgC0ix/t1GwM88tF+W9YKK9ajUt W/cRT9bT6RgDakyn01Uugv6ZWMBbOhdW2axdLx2p/AVYttrN3bSHqn5MhGcOFqpQKtNM M6B8p1ttDDuY9J0d4h7TbQBDRqyDtwcHHToDawAb1TJYMBxS3A/NOpAV0MVLXr+o46V2 6acWJ/Zplk4w7Y4SBbJ49KBoQWai59rsG/hkeNfu44bwAKBUQL8ORguOtLuk0gCVRycd kcesDrR+vCrw/Eb7DeXgbjbRGpj9RWaMs+NPoyjelsZnEIfaaVqsTFX7Zzf2Gb6YO8Dp oaPg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=qRegKXVK; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as 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 bj25-20020a0560001e1900b0032d9a225ffdsi8780452wrb.953.2023.10.25.17.22.10 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 25 Oct 2023 17:22:11 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=qRegKXVK; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as 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 1qvo6a-0001tS-J1; Wed, 25 Oct 2023 20:20: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 1qvo6J-0001Md-MH for qemu-devel@nongnu.org; Wed, 25 Oct 2023 20:19:52 -0400 Received: from mail-pl1-x636.google.com ([2607:f8b0:4864:20::636]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qvo6B-0006pp-Gf for qemu-devel@nongnu.org; Wed, 25 Oct 2023 20:19:51 -0400 Received: by mail-pl1-x636.google.com with SMTP id d9443c01a7336-1c77449a6daso2355165ad.0 for ; Wed, 25 Oct 2023 17:19:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1698279582; x=1698884382; 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=ZPfCIyMItq9qsbpSlNc7YkH4PMGNqYlgO15lo4Wg0C0=; b=qRegKXVKkFNK5adzFtZN6p38OnfNwHLv4jHcF2oJf1EGSzyHOiiqbf08LEhGk3UZat 4b6RGPycHJ3QHXHZZJaXivhIps2IeLl08nS7MRVBwEmYBygEp2lAVSmyiIJrtb2qygYk aB9JxmhrKX5EPjj47jrTepHHr8cR92x4wep0YcBzkz0YJjZHa4N0Pwk2/Lgh6emZi+VH ezl3D++IPI5ixgtQsuubTqSWAb8ldkogdYEhE7ch5Zmyw56bkD0S93uIhiTWIWrxWHQl TVL+tc6iWisgOt5TPsTS41tp4Lorjmcn8R2Vqf/7MTI/8aQyL0roKoay+MIwpPXA6Fwy IuRg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1698279582; x=1698884382; 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=ZPfCIyMItq9qsbpSlNc7YkH4PMGNqYlgO15lo4Wg0C0=; b=ktvvdUj1NZjnCLLaAEmX7p97fSLblfBYMdXg3PkiMZyLvI/B9GQD1VXnX2g+oh3u8X kd2SAd+dVTkxtVGmbV+6PVyPkaTZoYJv7KQwK2HMFK3AyKh1/lNxgMf445IoHv/YgoM4 8XKFvmmsxm8a+K2FR3rExH2DHcJtEcdt3nQYlER6UD6qQp6zGNz2BlWS2P2AJ5xi8OvK COxnFIcGGzXvKuCzocHUgbDEQPSWrhl5CCQYgJ7+tvPJkl3Lrxx3Zd71xPzzeLCLBZ53 uNi/hy5BXqQjTO8rsGc7ptPf3sPrdLMR5YjhgUxftnaN42Q2b4RjwxSl8BvckRboAo6d fZTQ== X-Gm-Message-State: AOJu0Yzb/MSnPy/ixgYjY+A3DHVczD/vKXUyw40Mw/pO5yJPz7T8z1GJ JiHXZlkIFN/gC08/+h2beGy66AME+dKCwDPUHAU= X-Received: by 2002:a17:903:1112:b0:1c6:117b:7086 with SMTP id n18-20020a170903111200b001c6117b7086mr18392260plh.5.1698279582250; Wed, 25 Oct 2023 17:19:42 -0700 (PDT) Received: from stoup.. ([71.212.149.95]) by smtp.gmail.com with ESMTPSA id jh1-20020a170903328100b001c5fc291ef9sm9754655plb.209.2023.10.25.17.19.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 25 Oct 2023 17:19:41 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: Mark Cave-Ayland Subject: [PULL 41/94] target/sparc: Move SLL, SRL, SRA to decodetree Date: Wed, 25 Oct 2023 17:14:49 -0700 Message-Id: <20231026001542.1141412-71-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231026001542.1141412-1-richard.henderson@linaro.org> References: <20231026001542.1141412-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::636; envelope-from=richard.henderson@linaro.org; helo=mail-pl1-x636.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org Tested-by: Mark Cave-Ayland Acked-by: Mark Cave-Ayland Signed-off-by: Richard Henderson --- target/sparc/insns.decode | 14 +++ target/sparc/translate.c | 182 ++++++++++++++++---------------------- 2 files changed, 92 insertions(+), 104 deletions(-) diff --git a/target/sparc/insns.decode b/target/sparc/insns.decode index b35921aabb..51cddc826d 100644 --- a/target/sparc/insns.decode +++ b/target/sparc/insns.decode @@ -183,6 +183,20 @@ TSUBcc 10 ..... 100001 ..... . ............. @r_r_ri_cc1 TADDccTV 10 ..... 100010 ..... . ............. @r_r_ri_cc1 TSUBccTV 10 ..... 100011 ..... . ............. @r_r_ri_cc1 +&shiftr rd rs1 rs2 x:bool +@shiftr .. rd:5 ...... rs1:5 . x:1 ....... rs2:5 &shiftr + +SLL_r 10 ..... 100101 ..... 0 . 0000000 ..... @shiftr +SRL_r 10 ..... 100110 ..... 0 . 0000000 ..... @shiftr +SRA_r 10 ..... 100111 ..... 0 . 0000000 ..... @shiftr + +&shifti rd rs1 i x:bool +@shifti .. rd:5 ...... rs1:5 . x:1 ...... i:6 &shifti + +SLL_i 10 ..... 100101 ..... 1 . 000000 ...... @shifti +SRL_i 10 ..... 100110 ..... 1 . 000000 ...... @shifti +SRA_i 10 ..... 100111 ..... 1 . 000000 ...... @shifti + Tcc_r 10 0 cond:4 111010 rs1:5 0 cc:1 0000000 rs2:5 { # For v7, the entire simm13 field is present, but masked to 7 bits. diff --git a/target/sparc/translate.c b/target/sparc/translate.c index 861c6e8f1e..ac8cd40aa1 100644 --- a/target/sparc/translate.c +++ b/target/sparc/translate.c @@ -4247,6 +4247,83 @@ static bool trans_MULScc(DisasContext *dc, arg_r_r_ri_cc *a) return do_arith(dc, a, CC_OP_ADD, NULL, NULL, gen_op_mulscc); } +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; @@ -4595,77 +4672,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; @@ -4678,42 +4684,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 Thu Oct 26 00:14: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: 738233 Delivered-To: patch@linaro.org Received: by 2002:adf:f842:0:b0:32d:baff:b0ca with SMTP id d2csp555428wrq; Wed, 25 Oct 2023 17:27:17 -0700 (PDT) X-Google-Smtp-Source: AGHT+IE9U5c8aGyLRfcYdP5sDvgT5N+QRqFJbB6konBfmcjci1xR62trkFoUn9QB1KbnarGixT7Z X-Received: by 2002:a05:6402:348f:b0:53e:3fce:251 with SMTP id v15-20020a056402348f00b0053e3fce0251mr14513918edc.0.1698280037726; Wed, 25 Oct 2023 17:27:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698280037; cv=none; d=google.com; s=arc-20160816; b=rxrPkCBTbNsrypUXV6w2CFA3xE+S1pWTZ9ua/+iCTRr4lA3z7QT6anXHotq4ub43JG EkWXWBj5taSgbKcCJdRe4zDIf4brKAssuhg5YSTqrRL7mqy4ReLPvwzP3NtWfrqSV8A7 E1vqH/dy+BCExcvea2/5Hc4jZMLBmqIaHrwZlzxQLX5drGYy7j7nmhktVHJmjEA0rM12 jW8pqsTIOCt+t9GaHZ8dQXcISZCRtTDQzSZgrLkB/dCMpsqqlUNPMNkVDZrQOeLXP808 JU9u/rEnXEgms7oSLVOI51HWxxOGWB4GZKM0U1XV0yh71zz02XKxe8KYjpxdaP04Xy/L iCcQ== 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=liEvRl/jRK+MVWBVMKhq34S1ClVtdANFLOiARj777ck=; fh=rYI8DiHAAFX3O5g969KmOAQ7d45Sb8OxQX1+DywGDk4=; b=M0BoxAxLAKFjWAfnKFDzzH9/HJ/6lJk+w6KwTbqFNwaDT2uPmuOMk0mVSV2AO3Xmrp NJWqyZqO7Eza058uGjiCTDUJOoaVWl13MlkSNzJFRbUwkCNPlVQ3+9fmwcul7oFXcYkF JLS6BDHMm/vIj7TdWEfeX0etHw+iVApddiLqTnCy2nL3WL/NSqCYTvEgSvlFZoA3FZim B/xTIvlC7TzoqWzQe+SPR9dayuplOFcGNpPJPwRD9R58CTrN050F2IhFeCkFo+URBnCB u//9zruIY4ZOC9HbcrijKQwayQOHQihtxdoxs9MiCnF+OZnBfzZ18rvsj9/SUDcFKyf1 Apsg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="ecVImq/G"; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as 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 o25-20020a509b19000000b00534657e140fsi5845308edi.587.2023.10.25.17.27.17 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 25 Oct 2023 17:27:17 -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="ecVImq/G"; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as 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 1qvo6s-0002II-Iu; Wed, 25 Oct 2023 20:20: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 1qvo6O-0001Vy-3I for qemu-devel@nongnu.org; Wed, 25 Oct 2023 20:19:56 -0400 Received: from mail-pl1-x631.google.com ([2607:f8b0:4864:20::631]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qvo6C-0006qz-AI for qemu-devel@nongnu.org; Wed, 25 Oct 2023 20:19:54 -0400 Received: by mail-pl1-x631.google.com with SMTP id d9443c01a7336-1c9b95943beso2374355ad.1 for ; Wed, 25 Oct 2023 17:19:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1698279583; x=1698884383; 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=liEvRl/jRK+MVWBVMKhq34S1ClVtdANFLOiARj777ck=; b=ecVImq/GEllIv6JWm6jsYmAB8WmtADpsUUrA0k3e8zBHzya9QzH3Qpl+pMFC+i6iKO wE1rLtierjbZCXJ8+WvNWcq6m3acCcNj3fs3wB9eAqMuJNeUQYHrcPu5MlNil58G1lv7 E8agpjZOVz71IXh9m1V6X8+ec5m6bIwydDPAv68Jn0ys96I0gv2Ut9gU1NQcFxkr0/00 B6j0xQtTVhVANPqd9QNcsPrCKefR86lJLMHaz2RJFvMVr9Ji4ZLf/yqTntY3O9SqidEB XN93AvF03VLt6TZjkx/hXkgptLAZ7XKsuPuIL3mGIj85pSTqd6gUs7NCIucpPuwrUsCO 8vCQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1698279583; x=1698884383; 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=liEvRl/jRK+MVWBVMKhq34S1ClVtdANFLOiARj777ck=; b=nvucWjm2HGMyCtbdnF8fima0ghYDHB8jk446yjNSPWEt/Dmnmhad3m0iENJkljG31o kh1NF9QbFvsiwqWzOOiYKH6QZWu5FesKapCteXJtbXwiBYHUvnzJdCAhbQcy5oCkxHZw W6d0mjTISw3ew5LsXETuqOPuRkKAuLqcRmsxurst3DH8bARZ3k7iYTnwYxumUqa99gD3 fGNv/A1IrpsM4wyfz3U/bUeOwRjcd59BGHiYeBuQvqrkwmajUxF6KZ87jqJ7mw9QYrJf /e6YzvcGbFmzox5FIaueMwEKJY99PC+WsYXT6YDMXKcWOMVVa8edAmjS3JxJKq6Ycwmm 0c+w== X-Gm-Message-State: AOJu0Yw1dY4zdjxeFBq0vIhx+dSDk+qlU0LnkyrZoo0ubDV3wfV9CLp1 toe6nYgC5Ti66VzMmjJyRzwg7Kt/E/YXOiwnPXI= X-Received: by 2002:a17:902:e88f:b0:1bc:2abb:4e98 with SMTP id w15-20020a170902e88f00b001bc2abb4e98mr15631700plg.21.1698279583047; Wed, 25 Oct 2023 17:19:43 -0700 (PDT) Received: from stoup.. ([71.212.149.95]) by smtp.gmail.com with ESMTPSA id jh1-20020a170903328100b001c5fc291ef9sm9754655plb.209.2023.10.25.17.19.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 25 Oct 2023 17:19:42 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: Mark Cave-Ayland Subject: [PULL 42/94] target/sparc: Move MOVcc, MOVR to decodetree Date: Wed, 25 Oct 2023 17:14:50 -0700 Message-Id: <20231026001542.1141412-72-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231026001542.1141412-1-richard.henderson@linaro.org> References: <20231026001542.1141412-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::631; envelope-from=richard.henderson@linaro.org; helo=mail-pl1-x631.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 Tested-by: Mark Cave-Ayland Acked-by: Mark Cave-Ayland Signed-off-by: Richard Henderson --- target/sparc/insns.decode | 4 ++ target/sparc/translate.c | 116 ++++++++++++++++++++------------------ 2 files changed, 64 insertions(+), 56 deletions(-) diff --git a/target/sparc/insns.decode b/target/sparc/insns.decode index 51cddc826d..cb21405e1a 100644 --- a/target/sparc/insns.decode +++ b/target/sparc/insns.decode @@ -209,3 +209,7 @@ Tcc_r 10 0 cond:4 111010 rs1:5 0 cc:1 0000000 rs2:5 # Bits [10:8] are reserved and the OSA2011 manual says they must be 0. Tcc_i_v9 10 0 cond:4 111010 rs1:5 1 cc:1 0 000 i:8 } + +MOVcc 10 rd:5 101100 1 cond:4 imm:1 cc:1 0 rs2_or_imm:s11 +MOVfcc 10 rd:5 101100 0 cond:4 imm:1 cc:2 rs2_or_imm:s11 +MOVR 10 rd:5 101111 rs1:5 imm:1 cond:3 rs2_or_imm:s10 diff --git a/target/sparc/translate.c b/target/sparc/translate.c index ac8cd40aa1..10b2d1b578 100644 --- a/target/sparc/translate.c +++ b/target/sparc/translate.c @@ -4324,6 +4324,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; @@ -4696,66 +4754,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 Thu Oct 26 00:14: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: 738222 Delivered-To: patch@linaro.org Received: by 2002:adf:f842:0:b0:32d:baff:b0ca with SMTP id d2csp554702wrq; Wed, 25 Oct 2023 17:25:02 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGRQ87boJTafkBQh4tUB8qTmpFTmfzAZ4joQ9Vw31miCOzDR6+ZuQk+K8SaiM3IB6SXtlHu X-Received: by 2002:a5d:638d:0:b0:317:6513:da7e with SMTP id p13-20020a5d638d000000b003176513da7emr10742796wru.36.1698279902423; Wed, 25 Oct 2023 17:25:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698279902; cv=none; d=google.com; s=arc-20160816; b=rRfO2lirtCGhv7ZH4ylHo6VsELieuxyI0PKfIbrPxj5BKFb2k3g4hglrzn3C0HdKHP 4aoSCIvsI/zlFZ+cuDVCfg1iyxWNqzD+Ydy21crdFZx/kNS0qtITaPsatL+QgoESA2ww 6g/ss7HkoNNNFfDrr2jlYt+SMWrUnWgBYIth8pqJmZYstfP9Bb+eBl0zguFcx4w1mlIc 9emPR5N4y/dvSkTNWLbyMshWukiaMIbEpK3vyGAVVJr31LkDya2DJ7ACFiIEyryXPgQx wfC06idjnQ/XSEg49Wk/VwML0c6P3DcC9o61a83WuyVPpAKtMJi4IBTHFSrHzp0bdA0O 0wwQ== 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=UaLDZUlxbnEBMWQWA0yY43XdPUXdultOeDE7cUVCPGo=; fh=rYI8DiHAAFX3O5g969KmOAQ7d45Sb8OxQX1+DywGDk4=; b=ZAxSh1hrQwJm9po3NeEvm9BtOqyWTYRRIB0z9H7d9a8hEdPfDqWg5wSEKR1/XOnahc RSYfUfsVzlXAtyf+slLR0ASKMGAp3N91U9P03jVFTDid4qIQQvjpZcRrLnt1CzEOaqiM w+jnJ73P7StMLRmay0CU2Wbbyhd7WlJH9ll4AjD4wuMRl61ih24aLW3sqrwOBaOXc6Cg FT8tVOrZjHHTgEqUWCLsSp/U0B6p8urn1W4/DM2xRZNinolmHIlv7VuE++dQ5q7qd8zN GNBzxnsKP64HaliRtRBiQjE2T1bjFipBdY5VYlJsFUL+W1m6s27AxJ1/RY6JkdTsuTEl kCZw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=zWaYqCjb; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id e13-20020adfe38d000000b0032daa4d9033si8033976wrm.728.2023.10.25.17.25.02 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 25 Oct 2023 17:25: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=zWaYqCjb; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as 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 1qvo6e-00025s-4W; Wed, 25 Oct 2023 20:20: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 1qvo6K-0001Mz-0y for qemu-devel@nongnu.org; Wed, 25 Oct 2023 20:19:52 -0400 Received: from mail-pl1-x62e.google.com ([2607:f8b0:4864:20::62e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qvo6E-0006sc-2b for qemu-devel@nongnu.org; Wed, 25 Oct 2023 20:19:51 -0400 Received: by mail-pl1-x62e.google.com with SMTP id d9443c01a7336-1c9e06f058bso11227355ad.0 for ; Wed, 25 Oct 2023 17:19:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1698279584; x=1698884384; 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=UaLDZUlxbnEBMWQWA0yY43XdPUXdultOeDE7cUVCPGo=; b=zWaYqCjbKeNOnR4VUs3rwa1DMB0UkEHxvdSx30I54nsoX3InPZzCEBaD3jlxLnpXwY /8eB292/CaLsN3XjPbeVH+OADN/y4ENqNXFwMRUbXLDOhLAhEEJxALyzBn4rty5CErYS szyDugQxuU0zTxnCxZTTMff3uGF3yQQW36L5Cv2r61Rnm0bky+qV7MnVtLC5jk9SHFdH wjAMYuzJnzAQ+kEdtjnCTz3UAJxtXgsdklti5Qt12E2eqo3AjmGyt4WNkEbiQLdwe0XG 4tPR9f/OODbF3h8jZbotPZaeVR/SbDx35sF+y2pNMeJK5SdESKjWQca7RFNFkjfFWhaD xQxA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1698279584; x=1698884384; 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=UaLDZUlxbnEBMWQWA0yY43XdPUXdultOeDE7cUVCPGo=; b=sXnGEpd1tI7XleBoRuf+ezTTPY0MQqsOIvJji8eZFLp4hB4xACiT/uKPpB1ddkaXKC l39bwR1v/I+cyxikhxW8JoR0uft0V/NIw/S0yXJkX/6vSnslG5VRGXi9Xl+bZWCD1eZj b3GtxkW+i26HhjOI0YafrAT7UomxRX0aQiCJSi5ab0M40ZGz0Bp89pj8jjlkm67Bh9eE qK06q4TdblXX08SF9c/helQhKBbp/PSpZciejE1HYcFnx3TzDZboygUl2IcUH8D8Hnk0 xWrc+rAYr/uYLDQfBUW3oaoHe+MJUUnizW5k75aVNGdelbHjfmvIPNmplJFUqj8FSmbt b5bA== X-Gm-Message-State: AOJu0YztZoSH1amuuS/8CYjWRbTuiK76UrBk9rQlarWBirbKk9twPMRw JrIOmwftn6sTEteebEwuHfkpuqnqVJLyDCMfTLo= X-Received: by 2002:a17:903:32c4:b0:1c7:5776:a30f with SMTP id i4-20020a17090332c400b001c75776a30fmr1373463plr.12.1698279583769; Wed, 25 Oct 2023 17:19:43 -0700 (PDT) Received: from stoup.. ([71.212.149.95]) by smtp.gmail.com with ESMTPSA id jh1-20020a170903328100b001c5fc291ef9sm9754655plb.209.2023.10.25.17.19.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 25 Oct 2023 17:19:43 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: Mark Cave-Ayland Subject: [PULL 43/94] target/sparc: Move POPC to decodetree Date: Wed, 25 Oct 2023 17:14:51 -0700 Message-Id: <20231026001542.1141412-73-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231026001542.1141412-1-richard.henderson@linaro.org> References: <20231026001542.1141412-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::62e; envelope-from=richard.henderson@linaro.org; helo=mail-pl1-x62e.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org Tested-by: Mark Cave-Ayland Acked-by: Mark Cave-Ayland Signed-off-by: Richard Henderson --- target/sparc/insns.decode | 3 +++ target/sparc/translate.c | 56 +++++++-------------------------------- 2 files changed, 12 insertions(+), 47 deletions(-) diff --git a/target/sparc/insns.decode b/target/sparc/insns.decode index cb21405e1a..a596b0fc85 100644 --- a/target/sparc/insns.decode +++ b/target/sparc/insns.decode @@ -183,6 +183,9 @@ TSUBcc 10 ..... 100001 ..... . ............. @r_r_ri_cc1 TADDccTV 10 ..... 100010 ..... . ............. @r_r_ri_cc1 TSUBccTV 10 ..... 100011 ..... . ............. @r_r_ri_cc1 +POPC 10 rd:5 101110 00000 imm:1 rs2_or_imm:s13 \ + &r_r_ri_cc rs1=0 cc=0 + &shiftr rd rs1 rs2 x:bool @shiftr .. rd:5 ...... rs1:5 . x:1 ....... rs2:5 &shiftr diff --git a/target/sparc/translate.c b/target/sparc/translate.c index 10b2d1b578..9122f82844 100644 --- a/target/sparc/translate.c +++ b/target/sparc/translate.c @@ -740,6 +740,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) { @@ -2733,19 +2738,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) { @@ -4176,6 +4168,9 @@ TRANS(SDIVX, 64, do_arith, a, -1, gen_op_sdivx, NULL, NULL) TRANS(UDIV, DIV, do_arith, a, CC_OP_DIV, gen_op_udiv, NULL, gen_op_udivcc) TRANS(SDIV, DIV, do_arith, a, CC_OP_DIV, gen_op_sdiv, NULL, gen_op_sdivcc) +/* TODO: Should have feature bit -- comes in with UltraSparc T2. */ +TRANS(POPC, 64, do_arith, a, -1, gen_op_popc, NULL, NULL) + static bool trans_OR(DisasContext *dc, arg_r_r_ri_cc *a) { /* OR with %g0 is the canonical alias for MOV. */ @@ -4731,40 +4726,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 Thu Oct 26 00:14: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: 738268 Delivered-To: patch@linaro.org Received: by 2002:adf:f842:0:b0:32d:baff:b0ca with SMTP id d2csp558895wrq; Wed, 25 Oct 2023 17:37:38 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGzJzaD+WqAhTXyqHR8suq9/7MlMBsCes6uB9CMfYcmrsdBmBTWxP9tTp83AWeWYfBsSoWz X-Received: by 2002:a5d:4147:0:b0:319:72f8:7249 with SMTP id c7-20020a5d4147000000b0031972f87249mr12800918wrq.66.1698280658796; Wed, 25 Oct 2023 17:37:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698280658; cv=none; d=google.com; s=arc-20160816; b=tinU0X6vP/tK2XiHMfuGqaUozBSrLwFNwf36HCwqLh4l+aqmRIU1o7Y4ZvXXUaAX3W OizlZNj0YoYLVbl4CD4/uhJd2+0h9YicQG7Kb08JKIfvHQtg/r0PpPMCatQlxR89rIy6 nWXt9xs4UTgmRg8hEi4iUhvMacI2ShdXFG5bfuQKOkJBkdmH1/0fzzOymmgi52Cv/oQH wSfBR8NdNYpa+l6S2JPzwBL9QJKAJ7koe+h3uii3KpInyejn5w4gST207ov54K8sPPez cnfOQHjauSXwFQKmzug74OvLHlB/lXk5SlAhTBcSdjbSxIXcikaz+vBfIyP3bdyxyW5r FzZQ== 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=NTjsxTEB+wSbTivrTvElIlgrS7SAqTr5YpOJzPS1BFA=; fh=rYI8DiHAAFX3O5g969KmOAQ7d45Sb8OxQX1+DywGDk4=; b=OQGCKhuiVxSXUlO1WdT0hjVjdcucW4mCiCqXMJSW71faF4wnDXEZG1LfW8mTdH2nwn 5UnEGEZNhJkChCAllMjJ2IZUPm1TWEZgB+8wEjhYpVF+Kqo7dE4OGF7GFXbNyzXytGDp 1zVoNu1tdmBi117XPKEUPemHS8/hSB8Qx+aLKqH4q0tWI/29Sb67iJxDqeLvXf+t6BdI aY0gPAUDcafgr3Pe0rWcBrSiPb55x/9ctw95E9TkBzHCAON7/axg5XjPPlksZmdpK/Hm x+V/bMy+a7bYYqTfsqjxBS+eiL+LvCgS7+ddzz99k4S+8kiZoy8wl/X7R7hUYc7ZzkAv ZdaA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=L99mEGsb; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as 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 n10-20020a5d484a000000b003263b56683asi7866094wrs.48.2023.10.25.17.37.38 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 25 Oct 2023 17:37: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=L99mEGsb; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as 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 1qvo6n-0002GH-Sb; Wed, 25 Oct 2023 20:20:21 -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 1qvo6L-0001RS-1w for qemu-devel@nongnu.org; Wed, 25 Oct 2023 20:19:53 -0400 Received: from mail-pl1-x62d.google.com ([2607:f8b0:4864:20::62d]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qvo6E-0006tB-OO for qemu-devel@nongnu.org; Wed, 25 Oct 2023 20:19:52 -0400 Received: by mail-pl1-x62d.google.com with SMTP id d9443c01a7336-1ca6809fb8aso2284235ad.1 for ; Wed, 25 Oct 2023 17:19:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1698279584; x=1698884384; 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=NTjsxTEB+wSbTivrTvElIlgrS7SAqTr5YpOJzPS1BFA=; b=L99mEGsb5GzXKVrRAE2AfNlXRqxcnzt5Ttbhu/rsE/Fs6cy4ezqCuqDXxFNj/5MTDR 17OuAPp7budrCOOXDaUdQnddhsubGBPV6BtMjEzQ9PGXCjhgWEatnD2HBvpGtESjazhS p0XRrwZJSOUf6blumGy/sjo8iI0fELngCiZgIhHsrYul31IbUxy0u9nc6pJd7+6NCDaz X5Subr+2/ZfB5yjLDt5ulGHpasponf90tU9xiXZMVDA5W9V3c9AMVXTkNcf8gCc5qvA/ y+vJfBoT4GE0iPQ6vota56FqCk9W0EVbxdjkPMf6JJsnhwHD6C+HuJC8tvOS0r+KjyEN /p3w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1698279584; x=1698884384; 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=NTjsxTEB+wSbTivrTvElIlgrS7SAqTr5YpOJzPS1BFA=; b=bAmX935jPdlgbJ+YYQqVZDP+nuevrMzVHRKNTunZQXMmKXHcLSr/qSqE719LidOERB lpGXDygaD9EgKENT0C21EX9+eWJ2eaFD/cZEXZEeemklM/wR/bpWcQUez2UvharSoehU Cxa5KhoaRPEwKpdotVk4vkJon1H25exsjMpH++6xB87PNBtJ0ngaoiH7iTT35kxnLX21 bA4clrScgxWshkjPt5bmfTpbf9r7G/QZ5ChJsmp7F6w6IIm3am84bbxPL6q7YR8h13sA uQcScyIMGVWAToO2Qv4YNEqESF1KwXydUOSzbRDy9/iSDlqMo+fAE38C9w5ruUFVqbeh eoGw== X-Gm-Message-State: AOJu0Yw2/jd7exBOqDm7C+A021+O+iYLUffv/ilI/56nms4oMzh1gcjs iK4PsW6t+f521IoAy8JjcYHgXPwayss6yls8mG0= X-Received: by 2002:a17:902:7407:b0:1ca:86db:1d31 with SMTP id g7-20020a170902740700b001ca86db1d31mr14926194pll.7.1698279584487; Wed, 25 Oct 2023 17:19:44 -0700 (PDT) Received: from stoup.. ([71.212.149.95]) by smtp.gmail.com with ESMTPSA id jh1-20020a170903328100b001c5fc291ef9sm9754655plb.209.2023.10.25.17.19.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 25 Oct 2023 17:19:44 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: Mark Cave-Ayland Subject: [PULL 44/94] target/sparc: Convert remaining v8 coproc insns to decodetree Date: Wed, 25 Oct 2023 17:14:52 -0700 Message-Id: <20231026001542.1141412-74-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231026001542.1141412-1-richard.henderson@linaro.org> References: <20231026001542.1141412-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::62d; envelope-from=richard.henderson@linaro.org; helo=mail-pl1-x62d.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org Tested-by: Mark Cave-Ayland Acked-by: Mark Cave-Ayland Signed-off-by: Richard Henderson --- target/sparc/insns.decode | 11 +++++++++++ target/sparc/translate.c | 32 ++++++-------------------------- 2 files changed, 17 insertions(+), 26 deletions(-) diff --git a/target/sparc/insns.decode b/target/sparc/insns.decode index a596b0fc85..8de986f0bb 100644 --- a/target/sparc/insns.decode +++ b/target/sparc/insns.decode @@ -216,3 +216,14 @@ Tcc_r 10 0 cond:4 111010 rs1:5 0 cc:1 0000000 rs2:5 MOVcc 10 rd:5 101100 1 cond:4 imm:1 cc:1 0 rs2_or_imm:s11 MOVfcc 10 rd:5 101100 0 cond:4 imm:1 cc:2 rs2_or_imm:s11 MOVR 10 rd:5 101111 rs1:5 imm:1 cond:3 rs2_or_imm:s10 + +NCP 10 ----- 110110 ----- --------- ----- # v8 CPop1 +NCP 10 ----- 110111 ----- --------- ----- # v8 CPop2 + +NCP 11 ----- 110000 ----- --------- ----- # v8 LDC +NCP 11 ----- 110001 ----- --------- ----- # v8 LDCSR +NCP 11 ----- 110011 ----- --------- ----- # v8 LDDC +NCP 11 ----- 110100 ----- --------- ----- # v8 STC +NCP 11 ----- 110101 ----- --------- ----- # v8 STCSR +NCP 11 ----- 110110 ----- --------- ----- # v8 STDCQ +NCP 11 ----- 110111 ----- --------- ----- # v8 STDC diff --git a/target/sparc/translate.c b/target/sparc/translate.c index 9122f82844..7cd1af1014 100644 --- a/target/sparc/translate.c +++ b/target/sparc/translate.c @@ -4727,8 +4727,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); @@ -5168,14 +5169,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); @@ -5391,13 +5389,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 */ @@ -5658,12 +5649,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 */ @@ -5703,11 +5688,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 Thu Oct 26 00:14: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: 738210 Delivered-To: patch@linaro.org Received: by 2002:adf:f842:0:b0:32d:baff:b0ca with SMTP id d2csp553892wrq; Wed, 25 Oct 2023 17:22:29 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGbOimTRwi2Knt2avJc+lsCaWAFQkJqO7+JA6SPXD+DaNdGonkprIhWqSe29DanHvp0lC7b X-Received: by 2002:a2e:b790:0:b0:2c2:a337:5ea with SMTP id n16-20020a2eb790000000b002c2a33705eamr12649115ljo.27.1698279749027; Wed, 25 Oct 2023 17:22:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698279748; cv=none; d=google.com; s=arc-20160816; b=CZEhoBqkEtIwN0534667BDftRMJGaM1RvOtoz1DIw7f3Bj24SGc02z9Ilgy65nZTdn 8LavdNtlJrEZ1t16p1s1pzu28V1XfT3qiZEz4xm8fzJDJNEPG1wpbo78Od5pn7wu9Vor c7fa49knLxAj7LELEKe43TB11E8nOfO82q3ai7Ix0JgeAuLVPM8l4k0GXnIgC2BV+ZvU +baVEJgWXg6zRe4qotSoTWgUzj0AYtUYQc3vx9JWCPiIvnPCdKcx60gspl1+x8lNJseq rgrAgnGjrUBXpTXUAHMLoWUC7h9Kyf191Ybs0/MvASovQ1rTzUhcXDs+Jb2m9DhKXtsq CiZg== 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=ohRPCpHejAizc95/5iNRUGKyBYgA+JY/mkKKy87OBpc=; fh=rYI8DiHAAFX3O5g969KmOAQ7d45Sb8OxQX1+DywGDk4=; b=RGaXGmxAB8dnX/cok/u3qHLEvTXJHR0/fE1+j07is8QAHSc7RufuUWb6ZZHDZ1xtkK meTA4as5GYVIOjcdk2T5D+a4axEx1tN+BUDRQZWicSwWeI9kDuOTv+37JLJLE9mTSTlR ngxeNcXec8IRJd/VxCTWh858O/+6muq7rB16E235RJG8osRLs0VJTEb+XQWYtt4vgIJz nBly/guCGIkmgrbPvamYaaZRxkOB7cDPk8/2IQo/Y4QuizYaciJQqFFQcxPCPehDqHcu L1uDYPsgkJiQ6lMT2bhyED8jVEApODm4QR2uUYaU+tRsCgw8RxHqO51FKH+iGT3Dt1cb ygJg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=vGmSKpy9; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id v9-20020a05600c444900b00401bca04584si796932wmn.91.2023.10.25.17.22.28 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 25 Oct 2023 17:22: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=vGmSKpy9; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as 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 1qvo6k-0002DE-Tm; Wed, 25 Oct 2023 20:20:20 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qvo6K-0001N0-AR for qemu-devel@nongnu.org; Wed, 25 Oct 2023 20:19:52 -0400 Received: from mail-pl1-x62e.google.com ([2607:f8b0:4864:20::62e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qvo6E-0006tK-Gf for qemu-devel@nongnu.org; Wed, 25 Oct 2023 20:19:52 -0400 Received: by mail-pl1-x62e.google.com with SMTP id d9443c01a7336-1caa371dcd8so2470715ad.0 for ; Wed, 25 Oct 2023 17:19:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1698279585; x=1698884385; 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=ohRPCpHejAizc95/5iNRUGKyBYgA+JY/mkKKy87OBpc=; b=vGmSKpy9zh6ZrrOoUOI0GX1d4PnYcXjqLQBxykTwEFT1TEAvSJTtCCJzFYcPS66T0F yOAv0Daoh7ZDRUCdo5qmQNJI7pjFJwvyxCKEhmC3KGEG8miPiyASiMB+r8rvZiezxSkh vNQn2/fDCppsfKXaig+gK/IaKFAWsiqFSAUeMFTcKSPF8qPexcApwjAnsFGEEvU+C+H6 uAvmd9c3Gm7AHTXIT74n5PGSYk5UdFYRmB2etnLGZTTq64rBgdwb6zdSIILWwct6w3/1 4hmtJ5fzBqMavWv+6la8xcTuMfSlCZuVVR3pBocXtCD7Owdiw3owS71yUuSZFqRiQkcG 58hg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1698279585; x=1698884385; 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=ohRPCpHejAizc95/5iNRUGKyBYgA+JY/mkKKy87OBpc=; b=XkRrlc0h0Iy9vzyahveRluFkmDRBINVXahJbc8VuyMfDKVXDG82qcsyl2mpa404c0D m8vwCKjXUpknkQMcbwEF7DOb53vD/0QFPW0ua7XTU4ynAz+/kK/TP4m3/8NWJ4IcZj/I P91BX47FwQzuzCp752MpANzhyZhZhMQwH6tg6KOzGUCCvcs6iCn5RCWCYJXQRrFIDrw3 Cd0hcSzG0CN8cKMLrijEuNc+jzskw+One9i9sRzXpDnZMXFq+qpLAVyU8y7GVcwwX3nf jUXCygW0t8tNCMp/cL5OidlSdyYvycEMFhzD5JxXLpiv1OZmISvNbVh7AuJg4YTFpJfP rbHg== X-Gm-Message-State: AOJu0YwwySD5o+BKaxFs0XbkGBF9BXBIH/L3YI9d0j2LBzf57N16Rf6X TS2KUCxGWpnWUtcPWUxFjYbOMFU7sbzCETKCzvw= X-Received: by 2002:a17:902:e5c1:b0:1c9:d667:4e4e with SMTP id u1-20020a170902e5c100b001c9d6674e4emr14369808plf.65.1698279585197; Wed, 25 Oct 2023 17:19:45 -0700 (PDT) Received: from stoup.. ([71.212.149.95]) by smtp.gmail.com with ESMTPSA id jh1-20020a170903328100b001c5fc291ef9sm9754655plb.209.2023.10.25.17.19.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 25 Oct 2023 17:19:44 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: Mark Cave-Ayland Subject: [PULL 45/94] target/sparc: Move JMPL, RETT, RETURN to decodetree Date: Wed, 25 Oct 2023 17:14:53 -0700 Message-Id: <20231026001542.1141412-75-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231026001542.1141412-1-richard.henderson@linaro.org> References: <20231026001542.1141412-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::62e; envelope-from=richard.henderson@linaro.org; helo=mail-pl1-x62e.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org Tested-by: Mark Cave-Ayland Acked-by: Mark Cave-Ayland Signed-off-by: Richard Henderson --- target/sparc/insns.decode | 7 +++ target/sparc/translate.c | 126 ++++++++++++++++++++++++-------------- 2 files changed, 88 insertions(+), 45 deletions(-) diff --git a/target/sparc/insns.decode b/target/sparc/insns.decode index 8de986f0bb..271789ac13 100644 --- a/target/sparc/insns.decode +++ b/target/sparc/insns.decode @@ -28,6 +28,7 @@ CALL 01 i:s30 &r_r_ri rd rs1 rs2_or_imm imm:bool @n_r_ri .. ..... ...... rs1:5 imm:1 rs2_or_imm:s13 &r_r_ri rd=0 +@r_r_ri .. rd:5 ...... rs1:5 imm:1 rs2_or_imm:s13 &r_r_ri &r_r_ri_cc rd rs1 rs2_or_imm imm:bool cc:bool @r_r_ri_cc .. rd:5 . cc:1 .... rs1:5 imm:1 rs2_or_imm:s13 &r_r_ri_cc @@ -217,6 +218,12 @@ MOVcc 10 rd:5 101100 1 cond:4 imm:1 cc:1 0 rs2_or_imm:s11 MOVfcc 10 rd:5 101100 0 cond:4 imm:1 cc:2 rs2_or_imm:s11 MOVR 10 rd:5 101111 rs1:5 imm:1 cond:3 rs2_or_imm:s10 +JMPL 10 ..... 111000 ..... . ............. @r_r_ri +{ + RETT 10 00000 111001 ..... . ............. @n_r_ri + RETURN 10 00000 111001 ..... . ............. @n_r_ri +} + NCP 10 ----- 110110 ----- --------- ----- # v8 CPop1 NCP 10 ----- 110111 ----- --------- ----- # v8 CPop2 diff --git a/target/sparc/translate.c b/target/sparc/translate.c index 7cd1af1014..91de0b1206 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_rett(E) qemu_build_not_reached() # define gen_helper_power_down(E) qemu_build_not_reached() # define gen_helper_wrpsr(E, S) qemu_build_not_reached() #else @@ -4377,6 +4378,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; @@ -5174,30 +5254,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(); @@ -5215,28 +5271,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 Thu Oct 26 00:14: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: 738257 Delivered-To: patch@linaro.org Received: by 2002:adf:f842:0:b0:32d:baff:b0ca with SMTP id d2csp557525wrq; Wed, 25 Oct 2023 17:33:23 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFtcf7I7qtha/nMRV1bx5n8jHVLUeg4xpWc1pj8sKMC1VqKHnzH2vhPF6R5haihV0hKsbKR X-Received: by 2002:a17:907:eab:b0:9bf:1142:4361 with SMTP id ho43-20020a1709070eab00b009bf11424361mr14172916ejc.10.1698280403557; Wed, 25 Oct 2023 17:33:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698280403; cv=none; d=google.com; s=arc-20160816; b=dtHJHUkujNOGIHfSU360bGRHQ4Cd5xMUyObqHvyGmO7O+uKpn82/+0UmZmDQ7PZ659 jWAwfI2n/ZM5VyTNypojFVGZPaEP7Q9UiMhMO9DpV65MMPa3Qf9VijthXRsRYs0WcW35 vvNbHF6QJyYBLLMJB0N+u6/udPg8aAIm+VcHP5R5jRlg6d+nrmZbCovehiwTUADgyiCV /UVWrMGw+NQSOoI2+d9hqFfSD6GOUa+jp44Y8TKnjZdMvMqd4zobcjWf0TZ80ox0t4qn g0OobNAuuGOkB5J7J2LNpq8BqLf8cCzaC8l0RsO5QXNDKvVWpT4mQ9O6ICHMXcGKlHfQ /igQ== 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=PvPbrl15JgqhGwk9JcRkjLrmHs6hD8F59ocp/OQFjPE=; fh=rYI8DiHAAFX3O5g969KmOAQ7d45Sb8OxQX1+DywGDk4=; b=vHR81gKDu8Er1jb7kPBpgJNFHoGaKXjHGh4LqD3fn6pELoga4oFusccDLKnuO14Ayi b0U9PzQKpgRk3GVHFD+7kz4ooL7z78yj6GYsQvONaP1o+jDwhVlOMXpZbp4b6FTUc6c8 IcAC38i0wfpqvMGJrh6o4ddofZoUUH/hCGTWPdAv1sWuM7+eBGs9pWuGXMED825Z6B0y nA3c0WfqiC9Fy4e2fbFr3CFgqLLUXPAmEl1cUntc4MS54/Eo+bnNdPFTzJd71WaNwj/n p8wfJL2R9wBDWUPUhueDywSI7Y6odt7Xp45XDKBNbQUIiV/YuVyJrMd/oecseyucIbrZ ZIVQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Ef613Kob; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as 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 dc11-20020a170906c7cb00b009a63cbd4b02si5844855ejb.932.2023.10.25.17.33.23 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 25 Oct 2023 17: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=Ef613Kob; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as 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 1qvo6u-0002Id-GM; Wed, 25 Oct 2023 20:20:28 -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 1qvo6L-0001Rx-9d for qemu-devel@nongnu.org; Wed, 25 Oct 2023 20:19:53 -0400 Received: from mail-pl1-x629.google.com ([2607:f8b0:4864:20::629]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qvo6F-0006tk-DR for qemu-devel@nongnu.org; Wed, 25 Oct 2023 20:19:53 -0400 Received: by mail-pl1-x629.google.com with SMTP id d9443c01a7336-1cbf47fa563so2295715ad.2 for ; Wed, 25 Oct 2023 17:19:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1698279586; x=1698884386; 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=PvPbrl15JgqhGwk9JcRkjLrmHs6hD8F59ocp/OQFjPE=; b=Ef613KobZB1+X34OVOYNv7+fQ0M0SLeCUoUBefglu36311oTL9aRT/iOfl9Vd9lZuL gY1Lu4DGfWm+teMvPdvT7IMiMFovPHrq1SdiSsXU3W3reAt3pSF//xF4aY0UluxG4T/c 6nRmUFczcPz+iErYuJWS+xsyH+XM2RlIBVUAWOXSWmUDNQ+S5txsOMDlcK33I8OWAuA3 2gwRrm0DoqNpsV5d/S0BEI+0o99GrigYyQsV5STa9XwBGi5AqCGo8DBXBV0nMA/aDktX O8B4ie/9CLM/h0QP79vNSdBV16PJ35cbJnrBCuSLgcNbU+cn93h/5RTyAa82XlAsNAJx msSQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1698279586; x=1698884386; 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=PvPbrl15JgqhGwk9JcRkjLrmHs6hD8F59ocp/OQFjPE=; b=vOhns/EOQOTycR9/tagGW61fkgfSDZ9V1XQOcRbQUjbBAZ+jHT3lhmstYBOLiR37CE f1Cl8vcM74ENi62PZmcRZ8UYUn8NB7VlkTQgPdPFdrQcWAGLoxGJcpeCu0vPLNh7o2e3 xJho1AbPq1N0TiR53tombiZ0Txo4NF640qZchH14WoI6lzwvx78WqtrcnDBotutVEALo uxRetPVM+PsBG/AndRw59X4336Wf9zYIeSnJT0IuRbskxmgntgHtN5G4NKYwder2XetY SWuVGJlahXFh1DYAjslYoqJPfe7i8PIv3ONrZ5xYFFN3pOE0/375QqqO27VcobO0x85p FHMQ== X-Gm-Message-State: AOJu0YwA0iihpy9edirMrVVNirnkhmyktnklDBI27Ajdk7qR5qnL79D6 BHFkUbxewDxAnPM7S9/HVQRPXkGa/3ArOXX/cVk= X-Received: by 2002:a17:902:ec8e:b0:1ca:82f0:131a with SMTP id x14-20020a170902ec8e00b001ca82f0131amr19214169plg.19.1698279586024; Wed, 25 Oct 2023 17:19:46 -0700 (PDT) Received: from stoup.. ([71.212.149.95]) by smtp.gmail.com with ESMTPSA id jh1-20020a170903328100b001c5fc291ef9sm9754655plb.209.2023.10.25.17.19.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 25 Oct 2023 17:19:45 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: Mark Cave-Ayland Subject: [PULL 46/94] target/sparc: Move FLUSH, SAVE, RESTORE to decodetree Date: Wed, 25 Oct 2023 17:14:54 -0700 Message-Id: <20231026001542.1141412-76-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231026001542.1141412-1-richard.henderson@linaro.org> References: <20231026001542.1141412-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::629; envelope-from=richard.henderson@linaro.org; helo=mail-pl1-x629.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org Tested-by: Mark Cave-Ayland Acked-by: Mark Cave-Ayland Signed-off-by: Richard Henderson --- target/sparc/insns.decode | 4 ++++ target/sparc/translate.c | 35 +++++++++++++++++++++++++---------- 2 files changed, 29 insertions(+), 10 deletions(-) diff --git a/target/sparc/insns.decode b/target/sparc/insns.decode index 271789ac13..aa90b5c5bb 100644 --- a/target/sparc/insns.decode +++ b/target/sparc/insns.decode @@ -223,6 +223,10 @@ JMPL 10 ..... 111000 ..... . ............. @r_r_ri RETT 10 00000 111001 ..... . ............. @n_r_ri RETURN 10 00000 111001 ..... . ............. @n_r_ri } +NOP 10 00000 111011 ----- 0 00000000----- # FLUSH reg+reg +NOP 10 00000 111011 ----- 1 ------------- # FLUSH reg+imm +SAVE 10 ..... 111100 ..... . ............. @r_r_ri +RESTORE 10 ..... 111101 ..... . ............. @r_r_ri NCP 10 ----- 110110 ----- --------- ----- # v8 CPop1 NCP 10 ----- 110111 ----- --------- ----- # v8 CPop2 diff --git a/target/sparc/translate.c b/target/sparc/translate.c index 91de0b1206..e0a13e5d29 100644 --- a/target/sparc/translate.c +++ b/target/sparc/translate.c @@ -4077,6 +4077,11 @@ static bool do_saved_restored(DisasContext *dc, bool saved) TRANS(SAVED, 64, do_saved_restored, true) TRANS(RESTORED, 64, do_saved_restored, false) +static bool trans_NOP(DisasContext *dc, arg_NOP *a) +{ + return advance_pc(dc); +} + static bool trans_NOP_v7(DisasContext *dc, arg_NOP_v7 *a) { /* @@ -4457,6 +4462,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; @@ -5272,18 +5295,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 Thu Oct 26 00:14: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: 738247 Delivered-To: patch@linaro.org Received: by 2002:adf:f842:0:b0:32d:baff:b0ca with SMTP id d2csp557011wrq; Wed, 25 Oct 2023 17:32:01 -0700 (PDT) X-Google-Smtp-Source: AGHT+IF5JeZ5s1ATjtLMq90JwShKjs+/lCatmNUxdL+W86e7V2gXtTFIuVZEju14KKnXm7EcDgae X-Received: by 2002:a17:907:9815:b0:9ba:3af4:333e with SMTP id ji21-20020a170907981500b009ba3af4333emr12898607ejc.14.1698280321722; Wed, 25 Oct 2023 17:32:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698280321; cv=none; d=google.com; s=arc-20160816; b=yB/4fROeggn7OuTp1Hr4DzFhhEX5U8UbzG6pjY018ZKQAnTLXTIxnjGOZ/1kToo3SI WLVpWOYoOxGs/Bna1a4Bp39dYKMDYfrpFkidzHTX7jz5tsCuS3fyjlbQdLiFZofFPmpi L5XNn6ZP/RdjMm1IwCKPw2b8HcR53JwgFGhU7DsKFhhmgwmw8d9lBAmVF74cz/X1vPqS vnzjZCdp7YRmuYr5KvKDhkyOFuKm4/fUICW7JlSXjBbM5YKabYSuRerIq3W+yFOyBskd +//8o2VvZKt/8q1W7cJyC9T6vjO8tAvO8z7VkguelBUy4NeiKk9tTcQKUUUXRVUVd3iJ YFtQ== 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=T1LExU5FV8KZbjwf84znCZoseuZjsAqtp+H9XwjBWlI=; fh=rYI8DiHAAFX3O5g969KmOAQ7d45Sb8OxQX1+DywGDk4=; b=Rqg93F8nnKfES1YU9jNhCNgXwFmYVk6Vd7vzeAUTM4TapaqmTxDxNzQ0Ewm8PhocP8 +N0WuyCWU8zZzpShnw4zt9yS2JI3Wt4ATGHHXLAA8HK6tSAlrP0uMPkJyqEWuxDO6+wj PYZc0B6VV9vYptNLb0RXv/ZYnYTlagkhhmjZ2hYR5g51xns1g2H4Uyl7DhdDx9z+O3F8 6qpcvcaHFArAxLz7AnnFCtk01f3YqZNff1+Dq0ZfHp786yXf4Exq0/h4TdauU31iWSg4 Z+/DHV9ZtKU9ANJVXbafkr3OPUFqs01Z8jr4ihjOWeMLO7UdD3phtmgclbD63xIJT4SO EFnw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=wWkt1QgT; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as 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 hy25-20020a1709068a7900b009920f18a5ebsi5752706ejc.729.2023.10.25.17.32.01 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 25 Oct 2023 17:32: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=wWkt1QgT; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as 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 1qvo6f-00028d-0h; Wed, 25 Oct 2023 20:20: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 1qvo6M-0001Sl-TV for qemu-devel@nongnu.org; Wed, 25 Oct 2023 20:19:54 -0400 Received: from mail-pg1-x52e.google.com ([2607:f8b0:4864:20::52e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qvo6G-0006uI-Va for qemu-devel@nongnu.org; Wed, 25 Oct 2023 20:19:53 -0400 Received: by mail-pg1-x52e.google.com with SMTP id 41be03b00d2f7-5b7f3f470a9so319896a12.0 for ; Wed, 25 Oct 2023 17:19:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1698279587; x=1698884387; 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=T1LExU5FV8KZbjwf84znCZoseuZjsAqtp+H9XwjBWlI=; b=wWkt1QgTY3rGrswh8AXIOPueRBtj7awNAEzwRHRRoQNqXA9fhPqRRpLKqshBdFhECE aXoqXAYiTV42LZtuh3XGOspSS1DbvrTONgyNGEBdYcxLJzHlcddaJLl/cCE4KfI7pqfm ZMdPtPH+8veTA8+e44H5fIE+98XDUwaY0V/Fz5DAhvcdeE98rE9FFORJiS1i/UCXavTW oPe2WWGPgjZGDr7KsiuOy4FQSrIXuXcXf9GvCEYuMf530nIlRCRtTbnkwazB8J5HDLWt JdeiTFfHuxdJ33nqF4l+xlGn14kGk2AtmVIAP0FNKjM22i36LLEns7wK2wdJ5xDW8jSx O2GA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1698279587; x=1698884387; 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=T1LExU5FV8KZbjwf84znCZoseuZjsAqtp+H9XwjBWlI=; b=EXVAwk/MohNhuiWQBgoauMMq0rb7K2jSPZgvw/czyC7xRW272DalRQo433X0zItfdE OBCxcbW4eYXLX0hZ8NbPJN9H746xROgikdUflkaS/ZuKQ2BiepsAbwzbbyRZnoQQvcl1 STa9WIAp2teLfgy/ynqquJsP5EVzLYR0UuxtcnQyXOiWp7dvCWRoSO/4e+f6QT/LJjq3 tb7FZprUaRFsn+w68DapM3Pv3R0Q30QvFTINIWtDfVJPcu2EW+xPXtBkAazc2f0aV1+2 6SS0Mp1B806m3viQ3wYqycmD+OdEzbjFI1DjhLvoctQ+ISGTHrdmj/rwavBNEm7ZMh7A MCWA== X-Gm-Message-State: AOJu0YyWoj6aYTiAqJy3hDhIXei+FG/tYEpHt1YgyUZfM0uYB/PMh72M J86X04pcUezARse3V/6JoS3uUoBBZctwmryU+PU= X-Received: by 2002:a05:6a20:8419:b0:16b:80b4:c39a with SMTP id c25-20020a056a20841900b0016b80b4c39amr9833426pzd.19.1698279586855; Wed, 25 Oct 2023 17:19:46 -0700 (PDT) Received: from stoup.. ([71.212.149.95]) by smtp.gmail.com with ESMTPSA id jh1-20020a170903328100b001c5fc291ef9sm9754655plb.209.2023.10.25.17.19.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 25 Oct 2023 17:19:46 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: Mark Cave-Ayland Subject: [PULL 47/94] target/sparc: Move DONE, RETRY to decodetree Date: Wed, 25 Oct 2023 17:14:55 -0700 Message-Id: <20231026001542.1141412-77-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231026001542.1141412-1-richard.henderson@linaro.org> References: <20231026001542.1141412-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::52e; envelope-from=richard.henderson@linaro.org; helo=mail-pg1-x52e.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org Tested-by: Mark Cave-Ayland Acked-by: Mark Cave-Ayland Signed-off-by: Richard Henderson --- target/sparc/insns.decode | 3 ++ target/sparc/translate.c | 88 ++++++++++++--------------------------- 2 files changed, 29 insertions(+), 62 deletions(-) diff --git a/target/sparc/insns.decode b/target/sparc/insns.decode index aa90b5c5bb..137b7eb3c6 100644 --- a/target/sparc/insns.decode +++ b/target/sparc/insns.decode @@ -228,6 +228,9 @@ NOP 10 00000 111011 ----- 1 ------------- # FLUSH reg+imm SAVE 10 ..... 111100 ..... . ............. @r_r_ri RESTORE 10 ..... 111101 ..... . ............. @r_r_ri +DONE 10 00000 111110 00000 0 0000000000000 +RETRY 10 00001 111110 00000 0 0000000000000 + NCP 10 ----- 110110 ----- --------- ----- # v8 CPop1 NCP 10 ----- 110111 ----- --------- ----- # v8 CPop2 diff --git a/target/sparc/translate.c b/target/sparc/translate.c index e0a13e5d29..8faf2c59b2 100644 --- a/target/sparc/translate.c +++ b/target/sparc/translate.c @@ -43,10 +43,12 @@ # define gen_helper_wrpsr(E, S) qemu_build_not_reached() #else # define gen_helper_clear_softint(E, S) qemu_build_not_reached() +# define gen_helper_done(E) qemu_build_not_reached() # define gen_helper_flushw(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_restored(E) qemu_build_not_reached() +# define gen_helper_retry(E) qemu_build_not_reached() # define gen_helper_saved(E) qemu_build_not_reached() # define gen_helper_sdivx(D, E, A, B) qemu_build_not_reached() # define gen_helper_set_softint(E, S) qemu_build_not_reached() @@ -4480,6 +4482,25 @@ static bool do_restore(DisasContext *dc, int rd, TCGv src) TRANS(RESTORE, ALL, do_add_special, a, do_restore) +static bool do_done_retry(DisasContext *dc, bool done) +{ + if (!supervisor(dc)) { + return raise_priv(dc); + } + dc->npc = DYNAMIC_PC; + dc->pc = DYNAMIC_PC; + translator_io_start(&dc->base); + if (done) { + gen_helper_done(tcg_env); + } else { + gen_helper_retry(tcg_env); + } + return true; +} + +TRANS(DONE, 64, do_done_retry, true) +TRANS(RETRY, 64, do_done_retry, false) + #define CHECK_IU_FEATURE(dc, FEATURE) \ if (!((dc)->def->features & CPU_FEATURE_ ## FEATURE)) \ goto illegal_insn; @@ -4491,7 +4512,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; @@ -4506,9 +4528,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)) { @@ -4828,8 +4849,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 */ @@ -5271,65 +5290,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 */ @@ -5726,7 +5690,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 Thu Oct 26 00:14: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: 738272 Delivered-To: patch@linaro.org Received: by 2002:adf:f842:0:b0:32d:baff:b0ca with SMTP id d2csp559107wrq; Wed, 25 Oct 2023 17:38:17 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGtmN+LfkDT1TJ56OGT2ofDmmw1s+e8JGPFo5FXMHWRjxmLmSct6TCV+RF6U8wpZLmpqIUg X-Received: by 2002:a05:6402:3506:b0:540:bf39:bf72 with SMTP id b6-20020a056402350600b00540bf39bf72mr4015402edd.25.1698280697036; Wed, 25 Oct 2023 17:38:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698280697; cv=none; d=google.com; s=arc-20160816; b=sABtaHlF+ktV6uW2YuGDQPctpls3yugkNSJ0b1yNZQezX0Hjdzn0YCRbsoONNWAPnK ojlN+pnMZWUxyW8hc/29ox/0SNMDeX1drqpfu8/vMti0AVrn5f5QvQoLp0hLVwM2dXUg FXGjr1YHOpUQCSQwow7wnLfKSDGrjCxYdP0mNhG28kfBHxLX123TzQGY/P8NcVzjb+Ca ELr4FlWgaTCpD0Bek9cxnCUIcnQ+4I3E2ApFIyfEujrTNGIn18Q6/ec9mL5DDIX0AXSR 2tiRM8kIdzVfLzU64gx4tlHT7glKP/facSVf+Fd+WUXYefbr1DEDKBEauf7MVhzAP/UF FRkw== 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=aVBY1LYgLUlwFA05aut9PR71PO2vl5OwkfiJRqeU+Ek=; fh=rYI8DiHAAFX3O5g969KmOAQ7d45Sb8OxQX1+DywGDk4=; b=Kd10iHT7LkqzvKMrvK6sn9RJWZFZloy7YIIbzvdOYrLxmQgXlJ1MnJnJcB/rZLHLYR ZyfXAv2OhayVUYwSuPJcnPd1n2HOcT0hpG+pV7iQraUEjwaC03/Q+hlXGufo6MdN8q61 c9aETLBUs7XcSDLfSlG2+tX9HoGhgGlImP83XyqnOMlCZVMDsoRHdD7dzJK/XEw+h7Dq k5p6Gq6sYvq+0XXtPNY9wrlCIGXX6SAQPzcmclW42yoWoGzV9Y581dLUcPy7JkvCqGAI r7/hL8nOZTV7Wbk2nSPiyTRpXAUwKZDd4N2aQpepfM7YXLT/Ch9OURgBEjpq4RHqU3oJ qobg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=HeRqIjo3; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as 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 m17-20020a50c191000000b00530893136fcsi3974508edf.18.2023.10.25.17.38.16 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 25 Oct 2023 17:38:17 -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=HeRqIjo3; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as 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 1qvo6q-0002H4-4U; Wed, 25 Oct 2023 20:20: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 1qvo6M-0001Sx-At for qemu-devel@nongnu.org; Wed, 25 Oct 2023 20:19:54 -0400 Received: from mail-pl1-x62e.google.com ([2607:f8b0:4864:20::62e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qvo6I-0006ue-5l for qemu-devel@nongnu.org; Wed, 25 Oct 2023 20:19:54 -0400 Received: by mail-pl1-x62e.google.com with SMTP id d9443c01a7336-1c9a1762b43so2254675ad.1 for ; Wed, 25 Oct 2023 17:19:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1698279587; x=1698884387; 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=aVBY1LYgLUlwFA05aut9PR71PO2vl5OwkfiJRqeU+Ek=; b=HeRqIjo3R6K476jX+K7LQSjwv/vPFdZbYViQAEkLgIZWNOmflW0SSFlgW0/oZFRsKw H7U3PgpItS3VYgz1KkRXrlCNdwbmja0JXppxz7KMS0NVY3W8Fx4lBZSAAujfGiPlzPJC oIO2wIrrb3IL0Rzm9jimVMkPy9bzfpm6uIG2A92FZk51oIdVl1waeta/5s8vnPwHKwlf XkDAcM2jZNytZKKMmZpMpmP27IZJ/Mehfi/GNvtBpuQtZZJLqnd5DLW6azQxcMWoNPb+ TVq9xOzhM7/T79ygG1N5hq1O5MswWgt5Kz7WCpOFbhj9fulIwFN457cFPwRfxOR4TfY7 nWKw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1698279587; x=1698884387; 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=aVBY1LYgLUlwFA05aut9PR71PO2vl5OwkfiJRqeU+Ek=; b=U3vjsmEogRsiTVF1Y2tJQrbAc2sqSr7f1LgqtWQZa3wFCWYg5yJJcKyg7HvVMF1Ebf th+qlmbjR1S6NZ1zsyVpKXnBir1gTS8R2y8zQbVaEFcN7QQSJECn4IXmE5zVIyCMV8Z2 Q53JoCJUjt/ZQNH+9/7Mqr2Bza/BPkKmXo3jeyZLRxzgiCHC5tcMzAJUWT5nRiD29DGN JDnynf50/Unl6i7D/acBrC99zwm+NlqJGKGufsqSjs07hFN2cRG6dKVwuM/bx93AplN7 HAPplrzMXKFpurdL7xIyDT1NGvu1Us8cXQmf276GW35X2eqjTOpJD5nrwl+4A/IJUTVJ CQbQ== X-Gm-Message-State: AOJu0YxqCOmXogZGCPbUSqVWB2Fz4EioZws3EyhuzUX0Bz3prkrg5SbK bq8CJWmzc8RGYOQZAq+7VGTWvIz3cwVR1a4RDbA= X-Received: by 2002:a17:903:2642:b0:1ca:7439:f74f with SMTP id je2-20020a170903264200b001ca7439f74fmr16448865plb.60.1698279587656; Wed, 25 Oct 2023 17:19:47 -0700 (PDT) Received: from stoup.. ([71.212.149.95]) by smtp.gmail.com with ESMTPSA id jh1-20020a170903328100b001c5fc291ef9sm9754655plb.209.2023.10.25.17.19.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 25 Oct 2023 17:19:47 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: Mark Cave-Ayland Subject: [PULL 48/94] target/sparc: Split out resolve_asi Date: Wed, 25 Oct 2023 17:14:56 -0700 Message-Id: <20231026001542.1141412-78-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231026001542.1141412-1-richard.henderson@linaro.org> References: <20231026001542.1141412-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::62e; envelope-from=richard.henderson@linaro.org; helo=mail-pl1-x62e.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org Tested-by: Mark Cave-Ayland Acked-by: Mark Cave-Ayland 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 8faf2c59b2..6c1610486e 100644 --- a/target/sparc/translate.c +++ b/target/sparc/translate.c @@ -1919,15 +1919,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) @@ -1970,7 +1980,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. */ @@ -2129,9 +2139,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 Thu Oct 26 00:14: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: 738292 Delivered-To: patch@linaro.org Received: by 2002:adf:f842:0:b0:32d:baff:b0ca with SMTP id d2csp559629wrq; Wed, 25 Oct 2023 17:39:56 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEWYO7OgvfrXx5/SpQ/wYBOmKHdLJKKaMac3hphxgiG/qbm9wCyACr+WxyDqKSlNCHrRkWd X-Received: by 2002:a5d:49c7:0:b0:32d:87e1:c349 with SMTP id t7-20020a5d49c7000000b0032d87e1c349mr10246480wrs.57.1698280796807; Wed, 25 Oct 2023 17:39:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698280796; cv=none; d=google.com; s=arc-20160816; b=rR1qyOgQVAbYLB3FZcwpe2Mw/SeZkMA0ZrUGjIKYUBbV4o7jBIurNR+sRBRWL19FAR fnZAMPumJKp/BCGnLu96RAFYtFZV8UnroBQvqzLmT/8TcrsUdZGpEdpopmnBS2/jRWhZ ud2P18pZU/U8vw8Aq+SDKJ7DozmvlvcY1CiEqkoMwLy8do/OOuPd1WiBB0pS4Hv8VbIJ FvzFthIjszra4xUxl3yjHeL96aP7CLjitI04sRZHPI8MqL3z52pGHBnQxHeRbqpC/S1o xNi/2vlQ+7diOvSIfg0r6wnqOiug5G3ioBDmGxg0B8ZOV9fcLxCMYuufA0vdY6I91353 dQLw== 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=eZLc1NKbNfziRuoiZu6Ior80vSayHdq/c4RE66LCIXM=; fh=rYI8DiHAAFX3O5g969KmOAQ7d45Sb8OxQX1+DywGDk4=; b=eNeW9DDU5Q92mE2SSNA6AjlhJoA977EwAXLTuA2Y4AiDrnfqEZB0fc6N3rI12aJimy jtCycjukM4CwmEfPJHSFUXByojBr5fi9D+nc02Mcw2AEpL8G7bsSKSLfJL5zLolKOjWh /SGewx6oJjFj+kNARDt52kCLPj8XMtda5HjIp6rASUQfj5AYS6OJCUFERo4JmhliCEF3 RWgD1mInPQ3ZwM7S7ndgs+Giayw+o/VzhAR21eRyG6HlT/xR3V5CQyc0/PjTz+zb7AYj qsRWF5PUar7dpqJua+Ip5S6aKs7CTG7w+D3nKtZVueoz53k0PytQKUAVgz+W7r+1Eck2 DVqw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=twVIQHdu; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as 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 k1-20020a056000004100b0032dc0157eccsi8517057wrx.62.2023.10.25.17.39.56 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 25 Oct 2023 17:39:56 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=twVIQHdu; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as 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 1qvo72-0002Ov-I1; Wed, 25 Oct 2023 20:20: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 1qvo6O-0001dF-6f for qemu-devel@nongnu.org; Wed, 25 Oct 2023 20:19:56 -0400 Received: from mail-pl1-x636.google.com ([2607:f8b0:4864:20::636]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qvo6I-0006vk-O3 for qemu-devel@nongnu.org; Wed, 25 Oct 2023 20:19:54 -0400 Received: by mail-pl1-x636.google.com with SMTP id d9443c01a7336-1c87a85332bso2331015ad.2 for ; Wed, 25 Oct 2023 17:19:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1698279588; x=1698884388; 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=eZLc1NKbNfziRuoiZu6Ior80vSayHdq/c4RE66LCIXM=; b=twVIQHdu4KUpK/rBt/EN13Hwb0tDQbEZA6bfLbtpfZX1ljQuMdg7vGHX2CnvuHP/n/ mr1751dWtl8LATNNxcRE9XQ4U73JWNi4DmMZHpOv8DUe/f4I2vMSDoNJvI5zR0MDkGpa mTKGC0cBjKs4MVphKYF3yXl6uyRfJkHwpLQORiKAHmGCkK1OJCyYP2RRlkhGpuUF52yF 8+DJdv2ZjvzgACZ9y/PfSkEOFic+dlc6z0d/nRmO+T2kj+vlCw1r2RgtUCRjZK8h+ReZ jBj8wpJ4zXMeir5S+tuv77rR6m+9yHKflbA3xiqmw4bMPiFxY3zXrBbT+6uvxgcaCq8O xP7Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1698279588; x=1698884388; 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=eZLc1NKbNfziRuoiZu6Ior80vSayHdq/c4RE66LCIXM=; b=RReWFYa7x6evE8hdwoWXC/owGOzDA6R490/Tzjqiv10aV+G4vsfL4IOyV9yHn6tA65 SrYSECydxY5gA2lTQkM2Zo6DRnIyIHyaII9thkzZDaOhoubz3E/yWxoAq4CXOYPqDG8W NvRThrBK/nUR9zjuqiXUkrVAaSZZUl3F3r4cW3hdcu3TI8DHh9Lon3Vz7aPljpmLK+n+ M05wfv29sb0S5BVvHxCoFgh8DIbJovFZdUNYtK8ZYj1OEYBtFytpHzPwCx0AjpbB/AG3 PWyeUi78Vz0ApbR1LezfI2BgVknn1B9rC6eU76dLk7otmxt5q39arVfxVkSAxSBifxQ/ DXOw== X-Gm-Message-State: AOJu0YyOQereVwwa70OLVqHNkU50NdZB4tBT2eXkvqX0b809RiRJsogq 1/JPB5+0Vi+ITkFkBuUl+l8lgxcVZge7qRckBBY= X-Received: by 2002:a17:902:c653:b0:1c7:495c:87e0 with SMTP id s19-20020a170902c65300b001c7495c87e0mr14634746pls.37.1698279588397; Wed, 25 Oct 2023 17:19:48 -0700 (PDT) Received: from stoup.. ([71.212.149.95]) by smtp.gmail.com with ESMTPSA id jh1-20020a170903328100b001c5fc291ef9sm9754655plb.209.2023.10.25.17.19.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 25 Oct 2023 17:19:48 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: Mark Cave-Ayland Subject: [PULL 49/94] target/sparc: Drop ifdef around get_asi and friends Date: Wed, 25 Oct 2023 17:14:57 -0700 Message-Id: <20231026001542.1141412-79-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231026001542.1141412-1-richard.henderson@linaro.org> References: <20231026001542.1141412-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::636; envelope-from=richard.henderson@linaro.org; helo=mail-pl1-x636.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. Tested-by: Mark Cave-Ayland Acked-by: Mark Cave-Ayland Signed-off-by: Richard Henderson --- target/sparc/translate.c | 189 +++++++++++++++------------------------ 1 file changed, 72 insertions(+), 117 deletions(-) diff --git a/target/sparc/translate.c b/target/sparc/translate.c index 6c1610486e..09b01ccf77 100644 --- a/target/sparc/translate.c +++ b/target/sparc/translate.c @@ -1900,7 +1900,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, @@ -2149,8 +2148,22 @@ 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) +#if defined(CONFIG_USER_ONLY) && !defined(TARGET_SPARC64) +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 + +static void __attribute__((unused)) +gen_ld_asi(DisasContext *dc, TCGv dst, TCGv addr, int insn, MemOp memop) { DisasASI da = get_asi(dc, insn, memop); @@ -2184,8 +2197,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); @@ -2260,8 +2273,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); @@ -2278,8 +2291,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; @@ -2300,7 +2313,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); @@ -2335,11 +2349,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; @@ -2447,8 +2459,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; @@ -2530,21 +2542,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: @@ -2558,9 +2572,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; @@ -2580,9 +2594,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; @@ -2592,8 +2606,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); @@ -2603,10 +2617,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: @@ -2617,15 +2632,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. */ @@ -2636,9 +2673,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); @@ -2648,8 +2685,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; @@ -2670,88 +2707,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 Thu Oct 26 00:14: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: 738216 Delivered-To: patch@linaro.org Received: by 2002:adf:f842:0:b0:32d:baff:b0ca with SMTP id d2csp554333wrq; Wed, 25 Oct 2023 17:23:48 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFn3oWD7Qdw625CzrwIO3bcQndRW29wFH2PAklM9h9+bsl082Ald211kf76LeDgeeGTH6QV X-Received: by 2002:a05:600c:3104:b0:408:3cdf:32c with SMTP id g4-20020a05600c310400b004083cdf032cmr12769548wmo.41.1698279827913; Wed, 25 Oct 2023 17:23:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698279827; cv=none; d=google.com; s=arc-20160816; b=KatjwEmmZXUm8B8YY8mZOE56eiebl0nE/DIP0mkPGDfnROh0vfk+BlOeHZiG6Na6MB hv1I5xV2iPd29YQztE9X9jttMLu8hrJZm9pn2b8dGLcWvca04eJdQDoxA6ql54C1AfPS xl+hFEaG2MHknReCFqclj3RLqch1888ajs9OSoTtymWd2qBRRMHw5SmCK8vgTmSz8uEX bfyibJ43InvLvXnpPbd5P2xyzk+BnQYxW9G1vYgfSLLAnoQkohcmSDrwh+xunqlKb6p4 UZ+rhGiV7eYW9h4OtVsigWmIOp6kp5ZK7bhI4hk+XcW2iqe2CGjkMlkX3tqphJG+/D3Y i9pw== 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=FJWQTSXIVaWpvvHhP9KgF/nTwAogXnm2BnoIdB4YZKA=; fh=rYI8DiHAAFX3O5g969KmOAQ7d45Sb8OxQX1+DywGDk4=; b=A3t4DjiqJz+wONO//mg+8fA19y/gAOJ1NCQY1ohFSEZC3Dnchc+ldI6vLvPwC4r70E Vz1iZvepFkWdYi3dtRPdDabcyYEF9J3pqfiY/Wxz+DLXF0621NSJEsOSQhMP0SV7t2Rg xG5pFjuIqOhlN7tqUvijrCkqdxOUHF+Iz5EWEgm/UXeQFCEfja3qxE/tUkhImMj4tug2 61cTeKLmU47Mb9gBY5TW2tb0Ujy31Ots39j2IxcYgxCP77oKOXfxQllyAGQPGWYGMKvZ +N72pF+PiaBN+CbgGwm17k9H2eaqbBlLW6exf4X0V36CqBGYoyKpnkpWsgNww157BZFL 0UXQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=mRrGtxEw; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as 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 m29-20020a05600c3b1d00b003fe24e7fb5asi806691wms.32.2023.10.25.17.23.47 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 25 Oct 2023 17:23: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=mRrGtxEw; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as 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 1qvo6z-0002KE-6n; Wed, 25 Oct 2023 20:20: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 1qvo6O-0001dG-Ab for qemu-devel@nongnu.org; Wed, 25 Oct 2023 20:19:56 -0400 Received: from mail-pl1-x62c.google.com ([2607:f8b0:4864:20::62c]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qvo6I-0006xe-HC for qemu-devel@nongnu.org; Wed, 25 Oct 2023 20:19:56 -0400 Received: by mail-pl1-x62c.google.com with SMTP id d9443c01a7336-1ca052ec63bso2400465ad.1 for ; Wed, 25 Oct 2023 17:19:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1698279589; x=1698884389; 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=FJWQTSXIVaWpvvHhP9KgF/nTwAogXnm2BnoIdB4YZKA=; b=mRrGtxEwAzlyy8tbSip8Xx/kwvpMClMXkEPMvrQGydmdu5nqBryAn2Uk7qr0zLeni3 OVTjeFMigz/odrBWLo07+FSSZc29vroXayt1BA/pXxOZb2Y/PXn86KRq03cWCIvkeHVV vl5WAiKVetnh/fx/R1O8/NpR3werMLvIqQlbK3LsDF9QCIf3IuVz9aunS3mtaydV/8mh l2kuVvC8dWRELZSUiuPmDnWheazWv/rhBBoxGLnn3P0XMdzxfS6eph14Br6Luitj2Upc VGT7MeJeO+uGQt80zK/NvOCVf9D807ORpoHdUv9GvqOraXwFkV0qWR50DTz80VHY9JWy YfSQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1698279589; x=1698884389; 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=FJWQTSXIVaWpvvHhP9KgF/nTwAogXnm2BnoIdB4YZKA=; b=ulp2USFaHuTLXeRn0YKPlO3UvbCarpThsgpSzBuq9PxvGN0yVpbZ1MbCYnHbL27PCm wjLzvBFV1wJv7/83oqkI4oNbXYvyP9+qnaFpNp+AMwTdvgpHZtpfoUXrckBZTLf1RIQP bbxkYhTgxVjjM0Z13Nk4sydoKZnPfsjJHzZmZiA+00EmPlIbMgDIgKHlsJSwUluQAQ4t nte9WSLFhGtVy36tzA5Aczg2MpjwQSwyA29rU+OkfF2shPyQjLU73MM5PX2HtRiZewju 6Hv2kM9QweLsqqQqmwiCFpZAhhO1IUgG3Qru8pjWUJnTceJnfxT7uXsPKO77ZHxuFidE BBkg== X-Gm-Message-State: AOJu0Yxq4+p9MsxLEKnUEFR3eYhiCRd1uj+IgRrBz6JJdWMr96AShr0U W/QwbYDm3cr1hmk5c4aoapXMcS9gbMMJ2uXKPSE= X-Received: by 2002:a17:902:ce88:b0:1ca:92a:df0 with SMTP id f8-20020a170902ce8800b001ca092a0df0mr18705046plg.59.1698279589218; Wed, 25 Oct 2023 17:19:49 -0700 (PDT) Received: from stoup.. ([71.212.149.95]) by smtp.gmail.com with ESMTPSA id jh1-20020a170903328100b001c5fc291ef9sm9754655plb.209.2023.10.25.17.19.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 25 Oct 2023 17:19:48 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: Mark Cave-Ayland Subject: [PULL 50/94] target/sparc: Split out ldst functions with asi pre-computed Date: Wed, 25 Oct 2023 17:14:58 -0700 Message-Id: <20231026001542.1141412-80-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231026001542.1141412-1-richard.henderson@linaro.org> References: <20231026001542.1141412-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::62c; envelope-from=richard.henderson@linaro.org; helo=mail-pl1-x62c.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org As an intermediate step in decodetree conversion, create new functions passing in DisasASI and not insn. Tested-by: Mark Cave-Ayland Acked-by: Mark Cave-Ayland 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 09b01ccf77..e24945e50e 100644 --- a/target/sparc/translate.c +++ b/target/sparc/translate.c @@ -2162,25 +2162,21 @@ static void gen_helper_st_asi(TCGv_env e, TCGv a, TCGv_i64 r, } #endif -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 @@ -2198,33 +2194,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 @@ -2242,18 +2243,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 @@ -2273,16 +2274,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. */ @@ -2295,34 +2329,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. @@ -2330,7 +2363,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; @@ -2350,6 +2383,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) { @@ -2542,36 +2584,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); @@ -2585,15 +2623,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); @@ -2607,21 +2645,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: @@ -2631,13 +2676,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; @@ -2657,7 +2701,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); } } @@ -2667,12 +2711,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); @@ -2686,25 +2730,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 Thu Oct 26 00:14: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: 738246 Delivered-To: patch@linaro.org Received: by 2002:adf:f842:0:b0:32d:baff:b0ca with SMTP id d2csp556769wrq; Wed, 25 Oct 2023 17:31:21 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGlCM7jK9c8IriXvFyAlc89u6GcpGAb1sFJtummTfmWkwV5OLo4YFPf/AnTOlb7QEWu/61q X-Received: by 2002:a05:600c:4c19:b0:406:8498:3d3a with SMTP id d25-20020a05600c4c1900b0040684983d3amr13083264wmp.14.1698280281635; Wed, 25 Oct 2023 17:31:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698280281; cv=none; d=google.com; s=arc-20160816; b=VrMzj9lNveyAK/gawbGvN+ffBSwx2sR5gD++REq+6ZdixcMSkmRzWRllEF6b1vo/Tl WcRkKTv2GRdgve1bTCrDRgalWUKZd44ksDHzKKv2kf4I6tJDCq4BbCQzW1SDLR29Jo1I WYvy0RB27xXj/RYOLHzgZy0DCV9zwfNk/eR490xxhFwXTAh0ju471+7l4tMUau+Yjrwk KgpIbNuFPPIU+yx3DMQDmkmG7JABVRKWPnlthsiVV+DRFEj4kJVWnWwNKe/BZnlqpqBi AdMuTg4lC+iK9uorXjB8CIrgJHQQLmsEKHAm29nieqb3WJQTeS28vaOQqabimry7XJNB E86Q== 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=tug4Ye+ri5yZyV+52Sfq/q/Jg8MaYnVtboKHbVUVRBc=; fh=rYI8DiHAAFX3O5g969KmOAQ7d45Sb8OxQX1+DywGDk4=; b=ipJ1PYhAillQ8p4IT2X9fkpynims9a1ttxGD+ekbyAxbe5bG1I/RFsr8jH2SnCMH6+ xZwlaTylhzBmVh1FLFU7nxTjnWVz16IfI/Xz5102ODIwUjAG8K3/Ti802iZRQXLjRo6M JJxIylHCkQ0PelQD7Riq8jlxVcNw9bZeM4VP0xt7c7+J9tkFWDaUsuIKoXFdsfNh90fx So42bfT7mbbU1TT7uqdjy4JfeGiQGuTCyNPTx42vyIK15FBvQlT0Npod1XBPLK2fEwwo H34UIcDpB2HcOaE2RJhjZaRocQnI/plIq5r15ahAM/QmBA4pNqTdocR7Mi36wywIwcJA 5G/w== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=yfpkQYwD; spf=pass (google.com: domain of qemu-devel-bounces+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 r15-20020a056000014f00b0032da0d27931si8626401wrx.989.2023.10.25.17.31.21 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 25 Oct 2023 17:31: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=fail header.i=@linaro.org header.s=google header.b=yfpkQYwD; spf=pass (google.com: domain of qemu-devel-bounces+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 1qvo9Q-0000zN-LQ; Wed, 25 Oct 2023 20:23: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 1qvo9I-0008Se-CN for qemu-devel@nongnu.org; Wed, 25 Oct 2023 20:22:58 -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 1qvo9E-0008AN-IS for qemu-devel@nongnu.org; Wed, 25 Oct 2023 20:22:55 -0400 Received: by mail-pg1-x52a.google.com with SMTP id 41be03b00d2f7-565e54cb93aso302053a12.3 for ; Wed, 25 Oct 2023 17:22:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1698279770; x=1698884570; 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=tug4Ye+ri5yZyV+52Sfq/q/Jg8MaYnVtboKHbVUVRBc=; b=yfpkQYwD5jONLqy3Kn/qYAi4ubnQIHrSiPYdIyMWF8SnER6xi34QAFIpYT+tj8kasf 2Y+hG3JnOAJXeytET9cTdXEt7ZcTiEvadDIxVn/6S4/RY5RxKUw2bJ++4i4316FmMze9 5UWoNhElTz1Z8pJDhJZbu1elAT3pTT0+8rEmU3JZvIizgHgUG13Ifym8WA+XSPiaxGFM WOT+8VYAaijdZy5dezeCllVOkTRzNIMBeOcfx1jmMByGsIngAw7wWf/wUC049ttadGQq IMbK27JvwQYal7MIeESd80PCyx6J9Cy2e3LE+Ed2JlI8G9qbLq25wrUiokOHuheU195i q0xA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1698279770; x=1698884570; 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=tug4Ye+ri5yZyV+52Sfq/q/Jg8MaYnVtboKHbVUVRBc=; b=jfnj+aZKH+54n17n+lO2k1uLR0qaxfvqBOHinMfYDxiVa9p40CJfn9gC8E6/UB0OvJ LdQ6j1E9L/h+R5VTJBUxQ/Ls+Vr9ejUEAO5KCdKWJmQSwoa3+qFBLSItdcOqG9BCY0Wp C8qoRmQ2lwQqR5kK9kHLFVobFzPHpKhkvW/cpXoBPZfQ7ZtonH0/7j5remw4+Ek2F4q7 3vgUqe0eIyT4UZTpPW9QJ445u3fWOtZa85mtSEufhBEQKeWc03YyN8O53qgpqwvgApHT szHaAFQgNk3nEjtLIi/CK1Mus2HD3YCRY5OXhNHkraFsCc3NC5sdPRInPhw2ajQT7EV3 p5Aw== X-Gm-Message-State: AOJu0YyGd50kfb7YGf7/zfZIBPmTF8KL8dZa0iRSKosY2T4BN8fOtzIn pma8YRHc1lH7b7ze3z2t24Elviq1BX0LvCX9b+U= X-Received: by 2002:a17:90b:4a8f:b0:27d:b885:17f2 with SMTP id lp15-20020a17090b4a8f00b0027db88517f2mr13526115pjb.30.1698279770446; Wed, 25 Oct 2023 17:22:50 -0700 (PDT) Received: from stoup.. ([71.212.149.95]) by smtp.gmail.com with ESMTPSA id 9-20020a17090a0cc900b0027463889e72sm499870pjt.55.2023.10.25.17.22.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 25 Oct 2023 17:22:50 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: Mark Cave-Ayland Subject: [PULL 51/94] target/sparc: Use tcg_gen_qemu_{ld, st}_i128 for GET_ASI_DTWINX Date: Wed, 25 Oct 2023 17:14:59 -0700 Message-Id: <20231026001542.1141412-81-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231026001542.1141412-1-richard.henderson@linaro.org> References: <20231026001542.1141412-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::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 Perform one atomic 16-byte operation. The atomicity is required for the LDTXA instructions. Tested-by: Mark Cave-Ayland Acked-by: Mark Cave-Ayland 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 e24945e50e..7ce9ab66c6 100644 --- a/target/sparc/translate.c +++ b/target/sparc/translate.c @@ -2594,11 +2594,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: { @@ -2663,11 +2679,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 Thu Oct 26 00:15: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: 738219 Delivered-To: patch@linaro.org Received: by 2002:adf:f842:0:b0:32d:baff:b0ca with SMTP id d2csp554630wrq; Wed, 25 Oct 2023 17:24:42 -0700 (PDT) X-Google-Smtp-Source: AGHT+IG2r60RN/OoCancH4ge6KToC03ZBOO65RC5rvJps6FlqlwWWeO00DpztU4aqz4Wmiv2P4m+ X-Received: by 2002:a05:600c:1f83:b0:406:411f:742e with SMTP id je3-20020a05600c1f8300b00406411f742emr12606296wmb.34.1698279882758; Wed, 25 Oct 2023 17:24:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698279882; cv=none; d=google.com; s=arc-20160816; b=y7NXu26yF59CWOueBYJsh/dD3gotwdkBbQZ9ODz5V1RFYFIVERUV25VN6/KbOSTT/e VEDIwMrAel5Ido8Jb6Im/Li57Tjlvl1EDO1giDVjXenj25D3/dnXpy/+etSY3SeWQ1fH vdDoSixVNkHIwosC4FfGAqVQn8VeWeZm00oX283nMKf/eQGmOsBnALWKnIhofsZNIcKu SL7LO9OIMuRZtXOIo3L2DV2xjOegK+WHiYOCI9ZRl8Qs7Pg9/zN5/hUFomC3mpZVeWWn TAPIz6Cm8OVAFm4OC6ZVuSy7TqFXWrieo5MzB6PAzucgu8QWmqgvAmewm7MnT7ZtGNCN y8Cg== 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=10ZlbZnfTg8LnI0vemtKsGjnuIMVwA7h5DHDNssZclo=; fh=rYI8DiHAAFX3O5g969KmOAQ7d45Sb8OxQX1+DywGDk4=; b=fhEvAAmjTrCVJHqHaf8uoCwZgnaLBhlO6lFxBw523IE3KqYNkq6hcPCR5iQzllu7z0 QGMnmEA6MhaNgIEeVyZWhCyCui8bZGmtA29HtW64S5hJocYFRIGQWRuRc3lx5NIc3vhz HeF4dVEvOzjf8hdYoSL8l3pWbJDXVO2/sVrjkE1yhorILj0e+prt1jof0vLSXRJ3GHyX 9x5JT87vctwXkcYk9y3rUMiTBz2M7D9OasJtB+QsEdhCgM/gyoQWtLYoGzceLvSdcci4 fWfQFqBhV6ryc29BquvKo3nZzq1dGmVpDynkbv8LoDpJJ5diVNwt7De0F+AzwqTtRNLx KFYA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=OxwTXMYl; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as 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 b13-20020a05600c4e0d00b0040541d4bb6asi791255wmq.143.2023.10.25.17.24.42 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 25 Oct 2023 17:24: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=OxwTXMYl; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as 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 1qvo9W-0001ev-73; Wed, 25 Oct 2023 20:23:10 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qvo9I-0008WJ-Nf for qemu-devel@nongnu.org; Wed, 25 Oct 2023 20:22:58 -0400 Received: from mail-pj1-x102d.google.com ([2607:f8b0:4864:20::102d]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qvo9F-0008AR-NN for qemu-devel@nongnu.org; Wed, 25 Oct 2023 20:22:56 -0400 Received: by mail-pj1-x102d.google.com with SMTP id 98e67ed59e1d1-27d18475ed4so252633a91.0 for ; Wed, 25 Oct 2023 17:22:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1698279771; x=1698884571; 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=10ZlbZnfTg8LnI0vemtKsGjnuIMVwA7h5DHDNssZclo=; b=OxwTXMYl3k5hd4lHcZu8RhKI5xcXN2bT+XBgjIIVaGsqvLoaJXmFPywRJ4kciIe3fT zwgPJZpU2BdZvT+Q7bv6Xeu/gnyPCpIeN+NDUQ4QAgcFENHE0AfhGkvuhPK7tQZGfwhL Y5q26ZCFKw0XUHQ35AuFroWbbwns98Q7IXVmEviff1uZffoHLvcyKBKaDWw33yEHlVyg gT5I+icpoLMUujk3w5xP8j7yLCiMxa7rZGkoQiqzU370w05NhtIaerJzc5J4MfRwq65t jbu3pIUJezdnTgZDPZhgjsYh/uIeU1DteJjsXD6CVZzWMPsYfqiK272QzpeFjEGufSFp xMVA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1698279771; x=1698884571; 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=10ZlbZnfTg8LnI0vemtKsGjnuIMVwA7h5DHDNssZclo=; b=LSzd51usgBZYTv84I/3rlovmr03753qUJf8H4uVVTwt9gzDRyuSuEdp5lYYhIlkUGV CRFdFVXQ/Vf8mPbxueOxg7FSHAumHusq06BEb5o7eTi3YGIGKKLIZdHc9s6ReyBvoYFT hHOuQ376d5blj6BIkdqIUos9kHCrMiNm0hpIVP+I2qpleofzBXhaL5mSFHa3CsECqlUs iWuaMEoPwa7zIV9drWiGhzlg7diAOjCPl15llIRDUNZkT6a6PloGDF6r/UFZqCqws+OA SsrpBnB/pAl3eG71+StUVyqt0rHFqCvQtlpI6KVmuD2bD4QkzvNZslxRrwQcSXbaNzsk fx5Q== X-Gm-Message-State: AOJu0YzRvCNS8AnsmCcfhBiPJfwU3FKw5O57PjOvMC5eB6U7hWYUZLHz RwOrtoy3QigQpmoCOn4w39hDo4WJFMdC8vEJMcU= X-Received: by 2002:a17:90a:fa8f:b0:268:2658:3b01 with SMTP id cu15-20020a17090afa8f00b0026826583b01mr13163836pjb.39.1698279771277; Wed, 25 Oct 2023 17:22:51 -0700 (PDT) Received: from stoup.. ([71.212.149.95]) by smtp.gmail.com with ESMTPSA id 9-20020a17090a0cc900b0027463889e72sm499870pjt.55.2023.10.25.17.22.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 25 Oct 2023 17:22:50 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: Mark Cave-Ayland Subject: [PULL 52/94] target/sparc: Move simple integer load/store to decodetree Date: Wed, 25 Oct 2023 17:15:00 -0700 Message-Id: <20231026001542.1141412-82-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231026001542.1141412-1-richard.henderson@linaro.org> References: <20231026001542.1141412-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::102d; envelope-from=richard.henderson@linaro.org; helo=mail-pj1-x102d.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. Tested-by: Mark Cave-Ayland Acked-by: Mark Cave-Ayland Signed-off-by: Richard Henderson --- target/sparc/insns.decode | 22 +++++ target/sparc/translate.c | 196 +++++++++++++++++++++++--------------- 2 files changed, 142 insertions(+), 76 deletions(-) diff --git a/target/sparc/insns.decode b/target/sparc/insns.decode index 137b7eb3c6..6197fbdb03 100644 --- a/target/sparc/insns.decode +++ b/target/sparc/insns.decode @@ -231,6 +231,28 @@ RESTORE 10 ..... 111101 ..... . ............. @r_r_ri DONE 10 00000 111110 00000 0 0000000000000 RETRY 10 00001 111110 00000 0 0000000000000 +## +## Major Opcode 11 -- load and store instructions +## + +&r_r_ri_asi rd rs1 rs2_or_imm asi imm:bool +@r_r_ri_na .. rd:5 ...... rs1:5 imm:1 rs2_or_imm:s13 &r_r_ri_asi asi=-1 + +LDUW 11 ..... 000000 ..... . ............. @r_r_ri_na +LDUB 11 ..... 000001 ..... . ............. @r_r_ri_na +LDUH 11 ..... 000010 ..... . ............. @r_r_ri_na +LDD 11 ..... 000011 ..... . ............. @r_r_ri_na +LDSW 11 ..... 001000 ..... . ............. @r_r_ri_na +LDSB 11 ..... 001001 ..... . ............. @r_r_ri_na +LDSH 11 ..... 001010 ..... . ............. @r_r_ri_na +LDX 11 ..... 001011 ..... . ............. @r_r_ri_na + +STW 11 ..... 000100 ..... . ............. @r_r_ri_na +STB 11 ..... 000101 ..... . ............. @r_r_ri_na +STH 11 ..... 000110 ..... . ............. @r_r_ri_na +STD 11 ..... 000111 ..... . ............. @r_r_ri_na +STX 11 ..... 001110 ..... . ............. @r_r_ri_na + NCP 10 ----- 110110 ----- --------- ----- # v8 CPop1 NCP 10 ----- 110111 ----- --------- ----- # v8 CPop2 diff --git a/target/sparc/translate.c b/target/sparc/translate.c index 7ce9ab66c6..db09255854 100644 --- a/target/sparc/translate.c +++ b/target/sparc/translate.c @@ -4536,6 +4536,117 @@ static bool do_done_retry(DisasContext *dc, bool done) TRANS(DONE, 64, do_done_retry, true) TRANS(RETRY, 64, do_done_retry, false) +/* + * 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; @@ -5359,47 +5470,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; @@ -5441,16 +5520,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; @@ -5543,38 +5612,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); @@ -5593,11 +5642,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 Thu Oct 26 00:15: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: 738251 Delivered-To: patch@linaro.org Received: by 2002:adf:f842:0:b0:32d:baff:b0ca with SMTP id d2csp557270wrq; Wed, 25 Oct 2023 17:32:39 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHnZ6e2mUbDZv+162HQiGcKNN8YcSLaJ33T197ZrfYb8Pwoob+HE0desjMbUoKwv4ewRGuJ X-Received: by 2002:a17:907:3206:b0:9be:4af4:f5f4 with SMTP id xg6-20020a170907320600b009be4af4f5f4mr13263291ejb.32.1698280358975; Wed, 25 Oct 2023 17:32:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698280358; cv=none; d=google.com; s=arc-20160816; b=CpejqsmSqTuLVuFZPUXg9+SCg7FU3a4DX+HRMqASlnLQvhI4sal+bZt9n5Um7+lhGg oDsSF0eJ/KTxPgJoJstwPD6QIUOk78yOhl2BASijjKx3G0owL1hOAdz7OjYLfLse5vbe 2Qm6NA7cCqy08fG637529LyLH0Of2E024qYkfyRc2iZax0GPte4GcupoYjYWaydCgeMb h338mC4IWtaOff9YmH2MLxbrWP/mTJQ8DMqjz+F47Aak+5WDhgMa796u+iX/TcWa1w4B ReRfroE/j6OlhdX9WGURc8Rgvpy1C3qJ+4wKr8V/6KOclG7bW2SgdiYPDNP1nfDhcepe yh2w== 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=jZBbjchxW1tHrNN5v0YkGnZIiPMEUx8oDtYFBFTOGuQ=; fh=rYI8DiHAAFX3O5g969KmOAQ7d45Sb8OxQX1+DywGDk4=; b=kSCYYoogMqhmehRIMWOTiepkyF7ncsvs6PU9LJhBNLbmdWG65OYuMEAJo84J5Pzh09 Xa4nVaBSKzO/JIRMJCaEmwgHM+imBE4A9vhGdjAVkvWUxONMR00E80csa4A0rUVl4jyV gt2fUgSOMaYmISRzG0Nja6SZnCOrEIXErwa4RNCpJZxhfdZLAKcY1E6y+qFVSjUNHm8a ZbExfyC6vW9N6HvSk3dQanBVoLdB+yAyMV1ctZ5r2LGNIbP1F5Trv/l6tssIsMfZR2ob nssAxm7/x1yrXD6jLVPoGlkn/IM/7ItWJYOTrK6RRSorK9vALWEHrOF7o09omhHnk9Ez KvkQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=n1AyPk7k; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as 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 i12-20020a17090671cc00b009cc43e5697dsi2050276ejk.132.2023.10.25.17.32.38 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 25 Oct 2023 17:32: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=n1AyPk7k; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as 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 1qvo9V-0001VT-03; Wed, 25 Oct 2023 20:23: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 1qvo9M-0000Tv-MM for qemu-devel@nongnu.org; Wed, 25 Oct 2023 20:23:00 -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 1qvo9G-0008AU-Ej for qemu-devel@nongnu.org; Wed, 25 Oct 2023 20:23:00 -0400 Received: by mail-pg1-x531.google.com with SMTP id 41be03b00d2f7-53fbf2c42bfso292427a12.3 for ; Wed, 25 Oct 2023 17:22:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1698279772; x=1698884572; 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=jZBbjchxW1tHrNN5v0YkGnZIiPMEUx8oDtYFBFTOGuQ=; b=n1AyPk7kp2Cdh3G1FlMsXyqbcRDtsarjxZs5iZqI43FGzj0JWCUq+0Ky6ewqNxVeD6 eWU7koCtwUnw6VqjDixNmvDp9ajf233i6YLtfPNRFc9pxxDjYH1ptOAoT0MyxtH08I0s +z2d/IQ4I2ittE7o6Zqv9jGbVCyOzIxQXyzcUFF/aiMOivPL8RMuQiIiNSG9hT1+L+oM sy+GQSvyeifq/pKO/AeoqY8VOriPpcUE79rPdqD6nXkx+v2ZZKRAfvQn9hVPsMSrYamB ekno/ax8IhBjBUW3medjr9MDl72ERu0zEYrl1pJgIL7yXBmq4pyV4cMgy078Lycz0iCe bkVQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1698279772; x=1698884572; 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=jZBbjchxW1tHrNN5v0YkGnZIiPMEUx8oDtYFBFTOGuQ=; b=mmkBn3JOhBoGSvymbzi6OHjaR+xu68/nT6EvOWitbN+2UyEzql4KiGvJGb/RzPnzLZ kql/segrvxAI1lfGE1kEXeaVIfJPIcwtsVg4zNCGu4ficWoWLhUqjEMQdr6fB40PCx06 daG1VRM8TUpKTBr3JzngeZQfH4LHySoB0r0jebTAooy6IBPJpomypw9QdEnMCxIcZW+8 J1NxFwV1bnJb2wUJ2T0o8yx4dmfSwBTLJNvrThxjQGwfu/XGRZii4fPbLqHHo9msoKdG 8W+nbkRlqzLGYJjRDV3mnvoCnOlLcTuwLClnlrPTIvX6g+zRr7fdlnEpTIVEAfgpU8Al ntTg== X-Gm-Message-State: AOJu0YyCOeUU7MG2+n6pXOvur0+caezvM8Kny1bgrgiQnKo/2Hq90Q96 PprjANr0+acCOSoz2KBnW1yF/R/bF9NhQ4VUByc= X-Received: by 2002:a17:90a:7442:b0:27d:9b67:7fa6 with SMTP id o2-20020a17090a744200b0027d9b677fa6mr14984972pjk.3.1698279771997; Wed, 25 Oct 2023 17:22:51 -0700 (PDT) Received: from stoup.. ([71.212.149.95]) by smtp.gmail.com with ESMTPSA id 9-20020a17090a0cc900b0027463889e72sm499870pjt.55.2023.10.25.17.22.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 25 Oct 2023 17:22:51 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: Mark Cave-Ayland Subject: [PULL 53/94] target/sparc: Move asi integer load/store to decodetree Date: Wed, 25 Oct 2023 17:15:01 -0700 Message-Id: <20231026001542.1141412-83-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231026001542.1141412-1-richard.henderson@linaro.org> References: <20231026001542.1141412-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::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, 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 Move LDDA, LDSBA, LDSHA, LDSWA, LDUBA, LDUHA, LDUWA, LDXA, STBA, STDA, STHA, STWA, STXA. Tested-by: Mark Cave-Ayland Acked-by: Mark Cave-Ayland Signed-off-by: Richard Henderson --- target/sparc/insns.decode | 31 +++++++++ target/sparc/translate.c | 128 +++++--------------------------------- 2 files changed, 48 insertions(+), 111 deletions(-) diff --git a/target/sparc/insns.decode b/target/sparc/insns.decode index 6197fbdb03..280b19f033 100644 --- a/target/sparc/insns.decode +++ b/target/sparc/insns.decode @@ -237,6 +237,9 @@ RETRY 10 00001 111110 00000 0 0000000000000 &r_r_ri_asi rd rs1 rs2_or_imm asi imm:bool @r_r_ri_na .. rd:5 ...... rs1:5 imm:1 rs2_or_imm:s13 &r_r_ri_asi asi=-1 +@r_r_r_asi .. rd:5 ...... rs1:5 0 asi:8 rs2_or_imm:5 &r_r_ri_asi imm=0 +@r_r_i_asi .. rd:5 ...... rs1:5 1 rs2_or_imm:s13 \ + &r_r_ri_asi imm=1 asi=-2 LDUW 11 ..... 000000 ..... . ............. @r_r_ri_na LDUB 11 ..... 000001 ..... . ............. @r_r_ri_na @@ -253,6 +256,34 @@ STH 11 ..... 000110 ..... . ............. @r_r_ri_na STD 11 ..... 000111 ..... . ............. @r_r_ri_na STX 11 ..... 001110 ..... . ............. @r_r_ri_na +LDUW 11 ..... 010000 ..... . ............. @r_r_r_asi # LDUWA +LDUW 11 ..... 010000 ..... . ............. @r_r_i_asi # LDUWA +LDUB 11 ..... 010001 ..... . ............. @r_r_r_asi # LDUBA +LDUB 11 ..... 010001 ..... . ............. @r_r_i_asi # LDUBA +LDUH 11 ..... 010010 ..... . ............. @r_r_r_asi # LDUHA +LDUH 11 ..... 010010 ..... . ............. @r_r_i_asi # LDUHA +LDD 11 ..... 010011 ..... . ............. @r_r_r_asi # LDDA +LDD 11 ..... 010011 ..... . ............. @r_r_i_asi # LDDA +LDX 11 ..... 011011 ..... . ............. @r_r_r_asi # LDXA +LDX 11 ..... 011011 ..... . ............. @r_r_i_asi # LDXA +LDSB 11 ..... 011001 ..... . ............. @r_r_r_asi # LDSBA +LDSB 11 ..... 011001 ..... . ............. @r_r_i_asi # LDSBA +LDSH 11 ..... 011010 ..... . ............. @r_r_r_asi # LDSHA +LDSH 11 ..... 011010 ..... . ............. @r_r_i_asi # LDSHA +LDSW 11 ..... 011000 ..... . ............. @r_r_r_asi # LDSWA +LDSW 11 ..... 011000 ..... . ............. @r_r_i_asi # LDSWA + +STW 11 ..... 010100 ..... . ............. @r_r_r_asi # STWA +STW 11 ..... 010100 ..... . ............. @r_r_i_asi # STWA +STB 11 ..... 010101 ..... . ............. @r_r_r_asi # STBA +STB 11 ..... 010101 ..... . ............. @r_r_i_asi # STBA +STH 11 ..... 010110 ..... . ............. @r_r_r_asi # STHA +STH 11 ..... 010110 ..... . ............. @r_r_i_asi # STHA +STD 11 ..... 010111 ..... . ............. @r_r_r_asi # STDA +STD 11 ..... 010111 ..... . ............. @r_r_i_asi # STDA +STX 11 ..... 011110 ..... . ............. @r_r_r_asi # STXA +STX 11 ..... 011110 ..... . ............. @r_r_i_asi # STXA + NCP 10 ----- 110110 ----- --------- ----- # v8 CPop1 NCP 10 ----- 110111 ----- --------- ----- # v8 CPop2 diff --git a/target/sparc/translate.c b/target/sparc/translate.c index db09255854..74cf3105f0 100644 --- a/target/sparc/translate.c +++ b/target/sparc/translate.c @@ -2162,7 +2162,7 @@ static void gen_helper_st_asi(TCGv_env e, TCGv a, TCGv_i64 r, } #endif -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: @@ -2193,16 +2193,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: @@ -2274,15 +2265,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) { @@ -2584,7 +2566,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); @@ -2660,16 +2642,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); @@ -2761,15 +2734,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); @@ -4580,7 +4544,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); } @@ -4604,7 +4568,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); } @@ -4626,7 +4590,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); } @@ -4643,7 +4607,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); } @@ -5475,9 +5439,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); @@ -5489,27 +5461,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; @@ -5520,12 +5471,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 */ @@ -5557,7 +5502,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) { @@ -5610,45 +5555,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 Thu Oct 26 00:15: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: 738284 Delivered-To: patch@linaro.org Received: by 2002:adf:f842:0:b0:32d:baff:b0ca with SMTP id d2csp559358wrq; Wed, 25 Oct 2023 17:39:04 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEXe9/u0cb1Efb33GSFlTvnpsElZXYw7bT+FZV6GU9kp7FwPPRlKK20AXMVfOrIwptLMr32 X-Received: by 2002:a05:6000:984:b0:32d:bf1c:ce65 with SMTP id by4-20020a056000098400b0032dbf1cce65mr1460646wrb.22.1698280744693; Wed, 25 Oct 2023 17:39:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698280744; cv=none; d=google.com; s=arc-20160816; b=Q6gMBhTiAWGje15ESEL4xe5ZhitC3Z3GmboFNJzSJ277PAivWZ9los6m0zFOWDfXGY VPUEk5tcX0LOr+9dLKarXcTXWSXGPR5NuGeGQtx9AoGtrsZ5+JRP0X4T85pJGBf8EZMl VjEHMiF0WH5NoLZei+a2xjca7iIerygmpDR1yavZYylCnPh8YJTwouiRHLXzFmOYDJkD YGDDT8Si6ofR5vHxP0bgMbWq/FhThX+JGbL45r7o+BwfBqwttRaxad0/k+SKKFO+dJos VTwGCCxG8br3hO7NuX5flAhKLLUSSRGYvUfe2Z1vsI3NdOOBAGvv6QIVThUICbcwov/3 zDCQ== 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=nqsLsbZVjs5bsqoicc0u3zyho9ONy37FphIeA4eEfCQ=; fh=rYI8DiHAAFX3O5g969KmOAQ7d45Sb8OxQX1+DywGDk4=; b=WtLEW07fZCvztOCjEAvYEyN8IXiaCLFALaB+BOP8jEdhnaMFtfJYUF3RQ/O9ghGazx wOMendtFqh4lgiXYN2uJuGN5k8iTnBR4K02U7BntDMAK3oPmCdfUlUNhAsL1XU4nZ5nA yFzbyxIvVYg0h1Gu4tE/f6/OVuxE1h8Cw7ec0rOsbDeuO9u2I8CL4CSAnfSHKcEAipn1 CCfcgK5lxbi6YSV8VXUBeE+ES1ZGR19SkivC7uRx6pNv3PjvbT1yysJ+Xau7UMSadqsa sVzwmgc4Zakpkdw7NBidFbcfeRdNvIoRxJ53mzXKTRQkBN5XyVsE9NvoaEOCp9Z6bg2v c+tg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=tfxCLzm1; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as 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 r7-20020adfce87000000b003233662a5fasi8171339wrn.51.2023.10.25.17.39.04 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 25 Oct 2023 17:39:04 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=tfxCLzm1; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as 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 1qvo9N-0000PX-B2; Wed, 25 Oct 2023 20:23: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 1qvo9I-0008UA-Fr for qemu-devel@nongnu.org; Wed, 25 Oct 2023 20:22:58 -0400 Received: from mail-pj1-x1032.google.com ([2607:f8b0:4864:20::1032]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qvo9G-0008Ab-9q for qemu-devel@nongnu.org; Wed, 25 Oct 2023 20:22:56 -0400 Received: by mail-pj1-x1032.google.com with SMTP id 98e67ed59e1d1-27cfb8bc7eeso237254a91.0 for ; Wed, 25 Oct 2023 17:22:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1698279773; x=1698884573; 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=nqsLsbZVjs5bsqoicc0u3zyho9ONy37FphIeA4eEfCQ=; b=tfxCLzm1fIWtzRf4/Acfgx+RKwWjjBDj5tET08Xas5ou/UfNIGoFks2T2RT5sLfltK 7KBH3BexSIeXIfoIEjTymaKnwh3h9lHn5Q2BnBc39VVHABL+Y7TKEiBiVmLboVfzUt/i uqLxfidZf3QliXWVi8LdhgdC8by280e679S3HLtEG+iRG9OzUirwrU6Ly9qr/3I+3WSP VW7cvcwO7Sh3I2Q/3+MfMFy0oJjkIJ1LrOJUcvbqiBfYo4AWPJXobtV4Y088D9xpoccM imamLYlzOo0r9mFQzHNdTPmecDw5xTXIVoeYx/cMfh41AQn8vo/i4C1caNsvxrF/uu4d wrdA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1698279773; x=1698884573; 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=nqsLsbZVjs5bsqoicc0u3zyho9ONy37FphIeA4eEfCQ=; b=WnGeDXBZKD3g2ifeYus0s34VeIVThq25VBl4hEOma9luP2nZDzcBhHKHZ2AEigp3Vr 13/vhjiVmlnUysmyEvmE1+Xy1JRyZoWFBpqRgzs/TDnJRiBl6jNWCuOu7AZ00MhbuYOq 2JEnJNKJtlNQAtUHlwszSPEr5Lpu+PRyfZ8A+YJ4NKm9VMk2Lx+8tXgtntvwgTi6sbml crHtyb5Hxbfyc1GjC85ogshQBVAcBQJ8foL9sL2phgqOpm1S1SlS6TlrrM9O7Z55M0z1 oSiJ9iLaFU9aoPP0CvjGpMdlmTestJtWW9DOGw5hPSYpMr+r0koNAupMNvNfpgtv8clU 5sRQ== X-Gm-Message-State: AOJu0YwISHPVpXiNRvnvHFYB/dETsO/9uBHrSKut3zF/hW4KtkUC8EcS OWDLjS7lseF5j1kKmi1/e5sFCy0N/vF4uMrNPpg= X-Received: by 2002:a17:90a:1c8:b0:27d:6dd:fb7d with SMTP id 8-20020a17090a01c800b0027d06ddfb7dmr17544975pjd.17.1698279772817; Wed, 25 Oct 2023 17:22:52 -0700 (PDT) Received: from stoup.. ([71.212.149.95]) by smtp.gmail.com with ESMTPSA id 9-20020a17090a0cc900b0027463889e72sm499870pjt.55.2023.10.25.17.22.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 25 Oct 2023 17:22:52 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: Mark Cave-Ayland Subject: [PULL 54/94] target/sparc: Move LDSTUB, LDSTUBA to decodetree Date: Wed, 25 Oct 2023 17:15:02 -0700 Message-Id: <20231026001542.1141412-84-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231026001542.1141412-1-richard.henderson@linaro.org> References: <20231026001542.1141412-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::1032; envelope-from=richard.henderson@linaro.org; helo=mail-pj1-x1032.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. Tested-by: Mark Cave-Ayland Acked-by: Mark Cave-Ayland Signed-off-by: Richard Henderson --- target/sparc/insns.decode | 4 ++++ target/sparc/translate.c | 46 +++++++++++++++++++-------------------- 2 files changed, 26 insertions(+), 24 deletions(-) diff --git a/target/sparc/insns.decode b/target/sparc/insns.decode index 280b19f033..2f950000b5 100644 --- a/target/sparc/insns.decode +++ b/target/sparc/insns.decode @@ -284,6 +284,10 @@ STD 11 ..... 010111 ..... . ............. @r_r_i_asi # STDA STX 11 ..... 011110 ..... . ............. @r_r_r_asi # STXA STX 11 ..... 011110 ..... . ............. @r_r_i_asi # STXA +LDSTUB 11 ..... 001101 ..... . ............. @r_r_ri_na +LDSTUB 11 ..... 011101 ..... . ............. @r_r_r_asi # LDSTUBA +LDSTUB 11 ..... 011101 ..... . ............. @r_r_i_asi # LDSTUBA + NCP 10 ----- 110110 ----- --------- ----- # v8 CPop1 NCP 10 ----- 110111 ----- --------- ----- # v8 CPop2 diff --git a/target/sparc/translate.c b/target/sparc/translate.c index 74cf3105f0..ddfb76af68 100644 --- a/target/sparc/translate.c +++ b/target/sparc/translate.c @@ -1892,13 +1892,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, @@ -2331,13 +2324,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. @@ -2365,15 +2359,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) { @@ -4611,6 +4596,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; @@ -5439,21 +5441,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); @@ -5461,9 +5462,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 Thu Oct 26 00:15: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: 738263 Delivered-To: patch@linaro.org Received: by 2002:adf:f842:0:b0:32d:baff:b0ca with SMTP id d2csp558318wrq; Wed, 25 Oct 2023 17:35:45 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGS0Kp1kqJBcnLf6VtUMyzbsmmygZ+36RDOnTbUk4azhhd/BXJXaxZVVe9D54ZC10NMQe2r X-Received: by 2002:a5d:5291:0:b0:32d:a717:717a with SMTP id c17-20020a5d5291000000b0032da717717amr14371165wrv.40.1698280544972; Wed, 25 Oct 2023 17:35:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698280544; cv=none; d=google.com; s=arc-20160816; b=j6WziE5jFtA4IyAXfyw+6eqg/VBR7qDZiZsmI2o4m8NlBC8jrLnkUO1PFyngP9gVZP p7XnUayUmcgwi/m49wZLRnHYcR+T/7XZSSIP6E6o+Kn6wBHosrBy5tpq6q5IeN+iNJuV Fiy80Fm9RPS9ON4J9DmVhCmlFw/QcSH0KqcRqz5vT9wgx0RfPL3kI6x+J3PZQx5Bvl+u oZdah8fL/kHF41x2YsY3OFBbYFF9/j4poukw491UMdIWFdZbE6pxZq575FrxvUFjZd9f d2s9h6AtxxNceJC8nJPgUaTYMMDceWS6kyYFMGkSSI4Vr7inhvhcXBIQ9OExkqSoX6bo U6lw== 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=1RBMEZdckkbOemPC0F9coR5p32iULbwwkWkdlHi6JSU=; fh=rYI8DiHAAFX3O5g969KmOAQ7d45Sb8OxQX1+DywGDk4=; b=KSA8WMfdQLWrt1bd50yQ21gpw6dYwEYHMw0Ro3nVFOZsUMhmCdO/pCuwHQgvzTdqWw YyTFMx2HjQmw/ZHber0iAi3gEA7yRZQ0CPLlQIgPXzWf42KwciQPsVF79Ulg5Xoe9E8u 0yNYQ8HUW5BPeKaJzJxPuehefd/ftailO+/+/jnS0rawKHUtnMFt/z72qc5kpXHTopcZ DQkeOjuaIt4GmBYgjhklX81ENEaW3FjzNZ2H7T/V6j4AVEdqMZXCAyC9aUharnksBVsJ 6sVAfV2JcRqRVtjSDz36RtVzEXHgVvO7zDBwUMZHrPMKgNlVrGO0CFRhd6hiB1mmo0Pg KAjA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=hCcH9BPO; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as 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 m4-20020adff384000000b0032db1841c85si8309973wro.312.2023.10.25.17.35.44 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 25 Oct 2023 17:35: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=hCcH9BPO; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as 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 1qvo9Y-00028r-Tz; Wed, 25 Oct 2023 20:23: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 1qvo9K-000089-Md for qemu-devel@nongnu.org; Wed, 25 Oct 2023 20:22:58 -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 1qvo9H-0008Aq-1a for qemu-devel@nongnu.org; Wed, 25 Oct 2023 20:22:58 -0400 Received: by mail-pg1-x533.google.com with SMTP id 41be03b00d2f7-5b8c39a2dceso289862a12.2 for ; Wed, 25 Oct 2023 17:22:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1698279774; x=1698884574; 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=1RBMEZdckkbOemPC0F9coR5p32iULbwwkWkdlHi6JSU=; b=hCcH9BPOgSeQTwnClbaqyRCUKu1OseqLLd8elqSw/71hX3zIMZZt8bnIQxJCroKqxM jQkVZ3Fe7jmmpWKPZJvq9y0Byt+Ra9JFNb8uRPFyqQq490UgF6sLwIWEYy6WzbmXMzrC FBW3hMEFD6h+DpwaKRrrLKXRW5rVqfURSC6+8bA6AEJ2NzCH0UmBO4bviUmov1juq9VL a/ZvWjfUgX10G5ALQtPvIw4Nn/VjEY5oYECrYrEkgna+pjDogHwoel2GcdfRaN0gmsW1 EX8NINatqyPXXXHnN8VTwZKJpzMuPfC0mJTAkgYVGe5tot7O3+XfKTZblSXwkhIpWjoO efKw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1698279774; x=1698884574; 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=1RBMEZdckkbOemPC0F9coR5p32iULbwwkWkdlHi6JSU=; b=tV/H+3lHFvlcU/lEHrx/rQRAqW6C5otXRLqo1uFZC2SdzkK+KbH4CDzb3BVazVfpl2 6zRBGXaojkltJ6vvzOioORHw4n2qMIPxo0KBq+RVQZle1rHhet3OtMVWQMc3GlrK7QBo kd/HpRpjjQ2VVClRz02uwq4/6lBC+oYkpy8fY++mys3xJ4v6vsHyspHf+2L7fVlxszEl 6c8hZG7Z9f5II1SKyvDa33lnJcY5YFd8AbedaWV4zMPur+cNaIN+CC3VQXBeBCxeypkz 2Qzy0oAdlE0rDjlVcRCR3YfKSEzgnmv/wRkl5aFG4hFRjzzHEOMekwXxax+8uatqeMSd prsQ== X-Gm-Message-State: AOJu0YyM7LIW0Zrz0DtwK0BwHFKJVb83ufSl40MN9rkost+YCtiuafa0 1m696cq1JSa78BhCVH10FhpO+4epbMtAQPxei0M= X-Received: by 2002:a17:90a:1996:b0:27c:fa10:fc82 with SMTP id 22-20020a17090a199600b0027cfa10fc82mr14254516pji.28.1698279773734; Wed, 25 Oct 2023 17:22:53 -0700 (PDT) Received: from stoup.. ([71.212.149.95]) by smtp.gmail.com with ESMTPSA id 9-20020a17090a0cc900b0027463889e72sm499870pjt.55.2023.10.25.17.22.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 25 Oct 2023 17:22:53 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: Mark Cave-Ayland Subject: [PULL 55/94] target/sparc: Move SWAP, SWAPA to decodetree Date: Wed, 25 Oct 2023 17:15:03 -0700 Message-Id: <20231026001542.1141412-85-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231026001542.1141412-1-richard.henderson@linaro.org> References: <20231026001542.1141412-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::533; envelope-from=richard.henderson@linaro.org; helo=mail-pg1-x533.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org Remove gen_swap_asi. Rename gen_swap_asi0 to gen_swap_asi. Merge gen_swap into gen_swap_asi. Tested-by: Mark Cave-Ayland Acked-by: Mark Cave-Ayland Signed-off-by: Richard Henderson --- target/sparc/insns.decode | 4 +++ target/sparc/translate.c | 58 +++++++++++++++++---------------------- 2 files changed, 29 insertions(+), 33 deletions(-) diff --git a/target/sparc/insns.decode b/target/sparc/insns.decode index 2f950000b5..9c4597317c 100644 --- a/target/sparc/insns.decode +++ b/target/sparc/insns.decode @@ -288,6 +288,10 @@ LDSTUB 11 ..... 001101 ..... . ............. @r_r_ri_na LDSTUB 11 ..... 011101 ..... . ............. @r_r_r_asi # LDSTUBA LDSTUB 11 ..... 011101 ..... . ............. @r_r_i_asi # LDSTUBA +SWAP 11 ..... 001111 ..... . ............. @r_r_ri_na +SWAP 11 ..... 011111 ..... . ............. @r_r_r_asi # SWAPA +SWAP 11 ..... 011111 ..... . ............. @r_r_i_asi # SWAPA + NCP 10 ----- 110110 ----- --------- ----- # v8 CPop1 NCP 10 ----- 110111 ----- --------- ----- # v8 CPop2 diff --git a/target/sparc/translate.c b/target/sparc/translate.c index ddfb76af68..29bfc98522 100644 --- a/target/sparc/translate.c +++ b/target/sparc/translate.c @@ -1885,13 +1885,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, @@ -2258,14 +2251,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. */ @@ -2274,15 +2268,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) { @@ -4613,6 +4598,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; @@ -4624,7 +4627,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; @@ -5442,6 +5445,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 */ @@ -5449,25 +5453,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 Thu Oct 26 00:15: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: 738273 Delivered-To: patch@linaro.org Received: by 2002:adf:f842:0:b0:32d:baff:b0ca with SMTP id d2csp559124wrq; Wed, 25 Oct 2023 17:38:20 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFeF02FiuuBw0Jf+QxbEGwqZcyohLqGbzlVr5yik56u3H5XLVnXngBX4M6ClZDv9uA35C2P X-Received: by 2002:a2e:958e:0:b0:2c5:1b82:a533 with SMTP id w14-20020a2e958e000000b002c51b82a533mr11468811ljh.15.1698280700247; Wed, 25 Oct 2023 17:38:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698280700; cv=none; d=google.com; s=arc-20160816; b=WJiGp22dzZjqaJguTva7zs4Cqn0pzvWMTNVvKvUPfBJM12lNsmcaU6ITWHXVa+EkTz KcnboQrhQh2AdCBgnE9j1ZrdNOXvdrzcVirrAYAR2WXQ4N8ZAOmuQEoLquF8K5JBg9jo 5T5hlrXWZmUBgckOasg2N/QN23yTbfyLoXwkerI+OoJQvF6IQ0P/7HF+tCWLM/m09baO JR7/B2z0DQQE7kQ3DTApkjjTQdBYHZRddjG5xQv5tk+lvUSfwSaWyKe2RATEhORIXfyQ o67eAUe0yu8BIbeDPwW+vYf0AhdAHkEubT2DslEhN9fPE3C44PbV/Pd1SezayPxWB7AY BHSw== 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=BibC+DRs59nbFE1Ls41U4uh2VUfxNEDa0ycsD8PCaHk=; fh=rYI8DiHAAFX3O5g969KmOAQ7d45Sb8OxQX1+DywGDk4=; b=lj2uO8nlbjuKTQOBdSLebMf5a7wVk3Wb4NcFaSmfq6T4zK5i6OZnYz8A/wBaj+URtF 34ScY7iAhmz2rIQ+zsmHoYa+jPqdtX9iYlN388GxuzPnrbLCFDhwpCPh869r6h4SnjzM TMm3+85u3A0xiavHmDs/lwXbIejF7R1+FFIpgFkfQSQgOfaEOlKIgeUugabC5GUmNup1 CmilxvH2PFMEcvI639oC3pFn8yAxTe+kQUrlc4f8FN2VAJtyZKoRcqwCAY+i3NKyMXQM k51HGPJMu7ZZrHap/SumS+FSNaK0+nX/q+hsaNkUmylXfSjgGtPZv99qFyOeUZgxZJRQ xqSg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=kVlnxQXr; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as 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 be12-20020a05600c1e8c00b0040907633839si809665wmb.95.2023.10.25.17.38.20 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 25 Oct 2023 17:38: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=kVlnxQXr; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as 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 1qvo9N-0000bG-M4; Wed, 25 Oct 2023 20:23: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 1qvo9L-0000Db-4B for qemu-devel@nongnu.org; Wed, 25 Oct 2023 20:22:59 -0400 Received: from mail-pj1-x1036.google.com ([2607:f8b0:4864:20::1036]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qvo9I-0008BF-2I for qemu-devel@nongnu.org; Wed, 25 Oct 2023 20:22:58 -0400 Received: by mail-pj1-x1036.google.com with SMTP id 98e67ed59e1d1-27d1a03f540so242336a91.1 for ; Wed, 25 Oct 2023 17:22:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1698279774; x=1698884574; 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=BibC+DRs59nbFE1Ls41U4uh2VUfxNEDa0ycsD8PCaHk=; b=kVlnxQXrX/1PUJZ1ScHRxpW5gu1qlG3lxCNp6v1lFMp2Zfm54FvcpSErCRnrFAwQuD gtZnB6xLJsxA2PNHAwBucPp77sm+h+cvoHF8I5BbBO352Tpgca7lLPaoTPqxqfc+FRTh ep5aISm00WEaptsSWKD0W1C3jVlPC5nFCMRX1UPfsEP27l8m8fa5pC+4+PTMhSmirIzA d/hqo/xmXbGW5Obw4+iB2fpJp7Xlv2sWdBJB+mxrs6SqLgunNBkqX3B2mWg+TkKS/FEX fVLYKOH4fvo+0DNE+08bQ1ZUvN1MYxqSF3lHewdSGOa0vKwWqwIo0f5m1o2bB041zRos 13iQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1698279774; x=1698884574; 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=BibC+DRs59nbFE1Ls41U4uh2VUfxNEDa0ycsD8PCaHk=; b=RBd2+YXTAwczY1D+tgsoxFEwMUcGZa2jRRM9fKItWQiDu5SoxksOu7OUL1zJLEhihz 9mpX5y51kNKl6H60a8uWK9Won+Vck/4XRmsnzG4zfsIecLS6zWAiV243RLkDmdCk2nyN Sjno05BLqxo8+oxlHmhZRnUA+DIdNr2PK5WWXHgtD6+jab9ebH4L/xv+rWAfK1fhvJM4 rOW06rmVuvbtJDaBA+Rj2z7waUgRCdWRoQ7ACh3R7ufGQfgvnGUGiOghXaKj7/TIOnh3 u3qn9Yyl5/2yz0iTQ7IeFHTqygjYoKb4SgWrvR6r8WLilvuJ5VtbeO6OAmBDdSGSSr82 dcTg== X-Gm-Message-State: AOJu0YxjAuhT/hQZqLZ5lTda+yiXJ1L7+WrVJSRuBXRsQhOMW2hC8J7n irInrgXczwww+0PJ0lO/Z1/bYJ/a4NSipOvlxOE= X-Received: by 2002:a17:90b:1016:b0:27d:23f1:ddf5 with SMTP id gm22-20020a17090b101600b0027d23f1ddf5mr13425605pjb.30.1698279774430; Wed, 25 Oct 2023 17:22:54 -0700 (PDT) Received: from stoup.. ([71.212.149.95]) by smtp.gmail.com with ESMTPSA id 9-20020a17090a0cc900b0027463889e72sm499870pjt.55.2023.10.25.17.22.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 25 Oct 2023 17:22:54 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: Mark Cave-Ayland Subject: [PULL 56/94] target/sparc: Move CASA, CASXA to decodetree Date: Wed, 25 Oct 2023 17:15:04 -0700 Message-Id: <20231026001542.1141412-86-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231026001542.1141412-1-richard.henderson@linaro.org> References: <20231026001542.1141412-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::1036; envelope-from=richard.henderson@linaro.org; helo=mail-pj1-x1036.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org Remove gen_cas_asi, gen_casx_asi. Rename gen_cas_asi0 to gen_cas_asi. Tested-by: Mark Cave-Ayland Acked-by: Mark Cave-Ayland Signed-off-by: Richard Henderson --- target/sparc/insns.decode | 7 ++++ target/sparc/translate.c | 72 ++++++++++++++++----------------------- 2 files changed, 36 insertions(+), 43 deletions(-) diff --git a/target/sparc/insns.decode b/target/sparc/insns.decode index 9c4597317c..82c484fbc7 100644 --- a/target/sparc/insns.decode +++ b/target/sparc/insns.decode @@ -240,6 +240,8 @@ RETRY 10 00001 111110 00000 0 0000000000000 @r_r_r_asi .. rd:5 ...... rs1:5 0 asi:8 rs2_or_imm:5 &r_r_ri_asi imm=0 @r_r_i_asi .. rd:5 ...... rs1:5 1 rs2_or_imm:s13 \ &r_r_ri_asi imm=1 asi=-2 +@casa_imm .. rd:5 ...... rs1:5 1 00000000 rs2_or_imm:5 \ + &r_r_ri_asi imm=1 asi=-2 LDUW 11 ..... 000000 ..... . ............. @r_r_ri_na LDUB 11 ..... 000001 ..... . ............. @r_r_ri_na @@ -292,6 +294,11 @@ SWAP 11 ..... 001111 ..... . ............. @r_r_ri_na SWAP 11 ..... 011111 ..... . ............. @r_r_r_asi # SWAPA SWAP 11 ..... 011111 ..... . ............. @r_r_i_asi # SWAPA +CASA 11 ..... 111100 ..... . ............. @r_r_r_asi +CASA 11 ..... 111100 ..... . ............. @casa_imm +CASXA 11 ..... 111110 ..... . ............. @r_r_r_asi +CASXA 11 ..... 111110 ..... . ............. @casa_imm + NCP 10 ----- 110110 ----- --------- ----- # v8 CPop1 NCP 10 ----- 110111 ----- --------- ----- # v8 CPop2 diff --git a/target/sparc/translate.c b/target/sparc/translate.c index 29bfc98522..2175c00ded 100644 --- a/target/sparc/translate.c +++ b/target/sparc/translate.c @@ -2268,8 +2268,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: @@ -2285,30 +2285,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) { @@ -2913,6 +2889,7 @@ static void gen_faligndata(TCGv dst, TCGv gsr, TCGv s1, TCGv s2) #ifdef TARGET_SPARC64 # define avail_32(C) false # define avail_ASR17(C) false +# define avail_CASA(C) true # define avail_DIV(C) true # define avail_MUL(C) true # define avail_POWERDOWN(C) false @@ -2922,6 +2899,7 @@ static void gen_faligndata(TCGv dst, TCGv gsr, TCGv s1, TCGv s2) #else # define avail_32(C) true # 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_MUL(C) ((C)->def->features & CPU_FEATURE_MUL) # define avail_POWERDOWN(C) ((C)->def->features & CPU_FEATURE_POWERDOWN) @@ -4616,6 +4594,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; @@ -5419,9 +5419,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); @@ -5634,22 +5632,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 Thu Oct 26 00:15: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: 738241 Delivered-To: patch@linaro.org Received: by 2002:adf:f842:0:b0:32d:baff:b0ca with SMTP id d2csp556179wrq; Wed, 25 Oct 2023 17:29:34 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFysSR3SJUKRm4kHF6DIhWIrXdHxXsTfrgIb71ns1kAX3JMK1WsO7DbqRQ4sQ7L99RrsZ1V X-Received: by 2002:a05:6402:27cc:b0:540:194f:5781 with SMTP id c12-20020a05640227cc00b00540194f5781mr10988294ede.33.1698280174283; Wed, 25 Oct 2023 17:29:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698280174; cv=none; d=google.com; s=arc-20160816; b=UGeajcqAp/3c7pJynnhZdDoriAefjJd5o5uKYTS8xM12bYSEjwbVun9cn+Y1NXQGcI uSbLekmU/XsGYuC8P3mZyfwUS33mZkPycee38tXBkvwcH6vxXDNeEvdncFCNAfD1Y3XL vuhYHb28gHW8gHkJ8mx5pQJzAbRugPLOTtOK8ScjhqHQcDBTWrtAmMEJd/hEMwMfzvJg +GW/UoRXOJRfxaPFaOW8ckKPC8IybV+kivMk/P4jfBFvkSX17QueISrfNxZTsW3IM9eq 3gI4rkgwvFoDvKoHvom7WbbC2+NsMS+vSszn2Ez65AqQ9Q4EyfCA9BR15hj/6WKQtKl0 y0mA== 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=mb776AbN/UqgNrPvlR/H9NLV+RfwQ56KQuO6pLUVjFA=; fh=rYI8DiHAAFX3O5g969KmOAQ7d45Sb8OxQX1+DywGDk4=; b=DQbUT4wp53OjTrnWqfgkJylVeVMsDd2OeSmcvcv/9cyDWWTQptMQO8tTOxf9VzX+G7 HrYz/ZeMLgdBaPxE/cR/6tJU7UIYLdleD6ks0P1hAKrZv2L7yrzGTr91D20z9uw264wp QEgCtitPZvqI0FV5TSCmufQzmwTF8KOuqR1CLW/tN6I8hHg83+4siRaVWSsjVB+9LWdp uRnCvfjjjQ1vQ5pRL4Xmd2Etys6qnp5YFE7Jjwcfxb2Zo1vph40kiDabquIHmDbxyfNq o1bBTpRAlDLU+Gw84L0lGWbpTcVTPMcOHkHuFsAsPvQNSUSSJ6HLVLiXK+//a8ODzPVM ghXA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=OjVTX4+O; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as 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 f17-20020a0564021e9100b005402a0c9787si4665561edf.71.2023.10.25.17.29.34 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 25 Oct 2023 17:29: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=OjVTX4+O; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as 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 1qvo9Q-0000kr-1t; Wed, 25 Oct 2023 20:23: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 1qvo9N-0000XK-5Q for qemu-devel@nongnu.org; Wed, 25 Oct 2023 20:23:01 -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 1qvo9K-0008BO-8D for qemu-devel@nongnu.org; Wed, 25 Oct 2023 20:22:59 -0400 Received: by mail-pg1-x535.google.com with SMTP id 41be03b00d2f7-577e62e2adfso294149a12.2 for ; Wed, 25 Oct 2023 17:22:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1698279775; x=1698884575; 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=mb776AbN/UqgNrPvlR/H9NLV+RfwQ56KQuO6pLUVjFA=; b=OjVTX4+O6doMeodf+ZSca7uoyAUIX3+m6etFm3eGH3/VkxxmZxauh2eYjz1bfwXlrz vv3JsGAbWnaRtJ/E6UwqqthO1RS8XzDnUE2CJ6GjAPwYaqTf91obbCwTjt0B/YHmKTrs cOGf4VNkTc4/BE4EHlczR9o9ex7rbm1SYq9yGrf/VZaITMDxvfdV1UBNw2uTJ9hOveDn 5RP89M2NHblcvl9Pebmix0MYKy2gYjDVSQstnfzdiq65w1FzJ3W6G4YEAzNywWhYqyrP vKlApIfkrU8Y/On20Zthrl9VNvIaeKFBPgu2oUIDJizqA7guCMJGeFbNvG4zpIwZ9xin cnXg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1698279775; x=1698884575; 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=mb776AbN/UqgNrPvlR/H9NLV+RfwQ56KQuO6pLUVjFA=; b=vPwsguRjtUk67XNWLAw9BfUtgi3+cy6/9/Ag1nyx5wL4GuNBuTLdzlyOYylFyqK7np HVMEcxdD+EtRRzK/BuWdBhOLg67HvFweuiGC7se/JRsxRxodkSaeIYF6pQOVrI4Pk7jq MLGb4sx/sMLOI3pGun3dlkagjYM9PNM8+TqP89BAq+NeyLkrHoMKaDZOwr+LhJ0bhfLG wjVvyFQhwWdsjScAuOaib6O7s3zyKP4Om8QbVmMGpokHadHSDkw05GYK15R7pF/Bn8tB QTbN+UV4ggXKcDmxNQCy+L4ASh/PejwfPk6/VDH/W/IMIgo/3PkVmJpKqWcXrLPykUsA Up7Q== X-Gm-Message-State: AOJu0YxNEwJnZKkI2dMwAoj1XHf7+cTMJyxNib48s7VPKCyFa8kCov6h AG9YbUt5soHJbSa64+otws7l6kxiVYOFgOp0P6Y= X-Received: by 2002:a17:90b:3883:b0:27d:669e:5a10 with SMTP id mu3-20020a17090b388300b0027d669e5a10mr13225442pjb.13.1698279775248; Wed, 25 Oct 2023 17:22:55 -0700 (PDT) Received: from stoup.. ([71.212.149.95]) by smtp.gmail.com with ESMTPSA id 9-20020a17090a0cc900b0027463889e72sm499870pjt.55.2023.10.25.17.22.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 25 Oct 2023 17:22:54 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: Mark Cave-Ayland Subject: [PULL 57/94] target/sparc: Move PREFETCH, PREFETCHA to decodetree Date: Wed, 25 Oct 2023 17:15:05 -0700 Message-Id: <20231026001542.1141412-87-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231026001542.1141412-1-richard.henderson@linaro.org> References: <20231026001542.1141412-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::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 Tested-by: Mark Cave-Ayland Acked-by: Mark Cave-Ayland Signed-off-by: Richard Henderson --- target/sparc/insns.decode | 8 ++++++-- target/sparc/translate.c | 23 ++++++++--------------- 2 files changed, 14 insertions(+), 17 deletions(-) diff --git a/target/sparc/insns.decode b/target/sparc/insns.decode index 82c484fbc7..aa452f1d00 100644 --- a/target/sparc/insns.decode +++ b/target/sparc/insns.decode @@ -231,6 +231,9 @@ RESTORE 10 ..... 111101 ..... . ............. @r_r_ri DONE 10 00000 111110 00000 0 0000000000000 RETRY 10 00001 111110 00000 0 0000000000000 +NCP 10 ----- 110110 ----- --------- ----- # v8 CPop1 +NCP 10 ----- 110111 ----- --------- ----- # v8 CPop2 + ## ## Major Opcode 11 -- load and store instructions ## @@ -299,8 +302,9 @@ CASA 11 ..... 111100 ..... . ............. @casa_imm CASXA 11 ..... 111110 ..... . ............. @r_r_r_asi CASXA 11 ..... 111110 ..... . ............. @casa_imm -NCP 10 ----- 110110 ----- --------- ----- # v8 CPop1 -NCP 10 ----- 110111 ----- --------- ----- # v8 CPop2 +NOP_v9 11 ----- 101101 ----- 0 00000000 ----- # PREFETCH +NOP_v9 11 ----- 101101 ----- 1 ------------- # PREFETCH +NOP_v9 11 ----- 111101 ----- - ------------- # PREFETCHA NCP 11 ----- 110000 ----- --------- ----- # v8 LDC NCP 11 ----- 110001 ----- --------- ----- # v8 LDCSR diff --git a/target/sparc/translate.c b/target/sparc/translate.c index 2175c00ded..363d8b7fc8 100644 --- a/target/sparc/translate.c +++ b/target/sparc/translate.c @@ -4031,17 +4031,12 @@ static bool trans_NOP(DisasContext *dc, arg_NOP *a) return advance_pc(dc); } -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; -} +/* + * TODO: Need a feature bit for sparcv8. + * In the meantime, treat all 32-bit cpus like sparcv7. + */ +TRANS(NOP_v7, 32, trans_NOP, a) +TRANS(NOP_v9, 64, trans_NOP, a) static bool do_arith_int(DisasContext *dc, arg_r_r_ri_cc *a, int cc_op, void (*func)(TCGv, TCGv, TCGv), @@ -5457,10 +5452,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; @@ -5475,8 +5470,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 Thu Oct 26 00:15: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: 738245 Delivered-To: patch@linaro.org Received: by 2002:adf:f842:0:b0:32d:baff:b0ca with SMTP id d2csp556766wrq; Wed, 25 Oct 2023 17:31:21 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEcckOlf5Khdy1WLeM71oxRXDFp2XHZp8p1HyVl0pY1MnJ2KRgU5X462eu1vdE5wSdZbeXf X-Received: by 2002:a5d:67d2:0:b0:329:6be4:e199 with SMTP id n18-20020a5d67d2000000b003296be4e199mr11989317wrw.13.1698280281411; Wed, 25 Oct 2023 17:31:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698280281; cv=none; d=google.com; s=arc-20160816; b=VmW0ojKjKfYOlmUwBcsVL4rvvIRlP5u6piwXFYEeEKOHpTGT2smN1NoH9Ikmsqf60G g1WFuLpdgu1pbHW+Z8caCBD8FrJvh+t2P1xoDgA7gxy+0wuyE6DD6X88cR2CQIF6tsMr MfMT6vgxnRTO1snTDdOkii2bFXNwMulfXMCnZsXAdlyUuCwfGn5rc1dNpVDcEkN6xdax H1mL7N66Hbjg+J/IbpAQoO2/+TL+GBB3FatAgQW9+/qGl/ZLQu9skbb2/i1iYa5TOu3U reiFMdU4sMOh/TnOlXMyuoLZaKwRGrMBLUZO41+MfaVF+U+HDX3jJ9WrQy0YypCH7yyb c63w== 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=MS8CtSutyWAJAksCJoGHPpSo/oeGceEkhH07ubL3sMY=; fh=rYI8DiHAAFX3O5g969KmOAQ7d45Sb8OxQX1+DywGDk4=; b=NB//7ajejIKNei7IE/EpgJF/NB2GQY5UyXPLHf9nz3PCJIW+Stmdj5kPeIhUpxBkYy DIlEiuPOyuM7hGSFvNevaswqnEiX9ju0MP3KLChQSXYKG75bJvl2cIoYu8YwJnK9vnig gtMu80K2Ymm/bpc1qLhXVcx1nhJc3++FXbdnq0es63QE5y163+i7vOKE3FRJx4T0b4G8 7i/xtLkrdMUnVkyRH5xUvdGoJlurgGWhz4dF7q9j7EsNWmk8RZ4UgFMZEZalryP4oZ8p VJMylbDsRAKl1Gjvj2J9Nk1GqMejQnXjbF1nd71U5hbzDp2LH6PHSgLfHuu+oveQFf01 kNRw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=BygX+Jj9; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as 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 c6-20020a5d4cc6000000b0032d910b88e6si8599599wrt.829.2023.10.25.17.31.21 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 25 Oct 2023 17:31: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=BygX+Jj9; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as 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 1qvo9T-0001R3-FA; Wed, 25 Oct 2023 20:23: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 1qvo9P-0000nL-15 for qemu-devel@nongnu.org; Wed, 25 Oct 2023 20:23:03 -0400 Received: from mail-pj1-x1034.google.com ([2607:f8b0:4864:20::1034]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qvo9K-0008Bl-8P for qemu-devel@nongnu.org; Wed, 25 Oct 2023 20:23:02 -0400 Received: by mail-pj1-x1034.google.com with SMTP id 98e67ed59e1d1-27d0acd0903so240208a91.1 for ; Wed, 25 Oct 2023 17:22:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1698279776; x=1698884576; 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=MS8CtSutyWAJAksCJoGHPpSo/oeGceEkhH07ubL3sMY=; b=BygX+Jj9NP+IVqkgQagfv+J67MDHAtp6KEeb+RNQfDj0OXEKauQtg/QaFHkIPh6f7M rgM4f1mT+c37T3gEduVYzLuu0xlB1RaXFLvjPY87mlhHLlUsmz7ozt79KvXVf2uWVNFk /zTnOCtIDU5EMKhP1VD0Wr1yk0PQzFlLNBM05UIg6xfQI2XOvHQoYr6HxCdKVG1HJOfw uA45yGmZK+pDLpukjqOoMiuLSBDdUPg7HkaBlAwGdNYlDVmfM0BGDhGY9qmbFHUmDG29 QLpYIyDGmJV+uJxdwQ4JUfjEuFDTjCeLOkOeTJpYyUBfoQWRdZGS5fHejq1Ld6ERYjyr 58nA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1698279776; x=1698884576; 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=MS8CtSutyWAJAksCJoGHPpSo/oeGceEkhH07ubL3sMY=; b=htAxAL9rnWA/LSQplEvByUnlz3RMdsuXHNapksK+sFFlhTusssobbV75shmh9hTDW6 +RfoMrVII+92dRp7U/IHYmO9jx8iNWuEgZzD+SG9r9Ash+m8MqIIffc/lCDX0vzvAw/I uliekMx5+l/EvyiIUH8GG/ZeXsPm3wL1Wot9At9limPR1g+iUTRcG6pnjuVOvTWaeOC1 rQq8qiyvtNOqvEw8z71w2fCo/PFYwkm8tArKYvRmvF2VyytzLl8Rm4tCXX9ymDQj81zu LyP+F5uAD525lcDhhV+ouMwsA+ajMoGY8+zxl9JhJ8LBen5l7S5nXuw5n2VZXv1rnsAQ pnZg== X-Gm-Message-State: AOJu0YxRiKrP6hAxumU//O0lvtXRGeiZDlgeun2wMD/emgTAZelJTwSu rPss/opH3Y+iBDrzbgCHqcxplFxRtvvKSmxEnbE= X-Received: by 2002:a17:90b:1093:b0:27d:2c3c:7e25 with SMTP id gj19-20020a17090b109300b0027d2c3c7e25mr14823515pjb.46.1698279776085; Wed, 25 Oct 2023 17:22:56 -0700 (PDT) Received: from stoup.. ([71.212.149.95]) by smtp.gmail.com with ESMTPSA id 9-20020a17090a0cc900b0027463889e72sm499870pjt.55.2023.10.25.17.22.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 25 Oct 2023 17:22:55 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: Mark Cave-Ayland Subject: [PULL 58/94] target/sparc: Split out fp ldst functions with asi precomputed Date: Wed, 25 Oct 2023 17:15:06 -0700 Message-Id: <20231026001542.1141412-88-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231026001542.1141412-1-richard.henderson@linaro.org> References: <20231026001542.1141412-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::1034; envelope-from=richard.henderson@linaro.org; helo=mail-pj1-x1034.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org Take the operation size from the MemOp instead of a separate parameter. Tested-by: Mark Cave-Ayland Acked-by: Mark Cave-Ayland Signed-off-by: Richard Henderson --- target/sparc/translate.c | 138 +++++++++++++++++++++++---------------- 1 file changed, 80 insertions(+), 58 deletions(-) diff --git a/target/sparc/translate.c b/target/sparc/translate.c index 363d8b7fc8..55d6f83736 100644 --- a/target/sparc/translate.c +++ b/target/sparc/translate.c @@ -2320,35 +2320,41 @@ static void gen_ldstub_asi(DisasContext *dc, DisasASI *da, TCGv dst, TCGv addr) } } -static void __attribute__((unused)) -gen_ldf_asi(DisasContext *dc, TCGv addr, int insn, int size, int rd) +static void gen_ldf_asi0(DisasContext *dc, DisasASI *da, MemOp orig_size, + TCGv addr, int rd) { - DisasASI da = get_asi(dc, insn, (size == 4 ? MO_TEUL : MO_TEUQ)); + MemOp memop = da->memop; + MemOp size = memop & MO_SIZE; TCGv_i32 d32; TCGv_i64 d64; - switch (da.type) { + /* TODO: Use 128-bit load/store below. */ + if (size == MO_128) { + memop = (memop & ~MO_SIZE) | MO_64; + } + + switch (da->type) { case GET_ASI_EXCP: break; case GET_ASI_DIRECT: - gen_address_mask(dc, addr); + memop |= MO_ALIGN_4; switch (size) { - case 4: + case MO_32: d32 = gen_dest_fpr_F(dc); - tcg_gen_qemu_ld_i32(d32, addr, da.mem_idx, da.memop | MO_ALIGN); + tcg_gen_qemu_ld_i32(d32, addr, da->mem_idx, memop); gen_store_fpr_F(dc, rd, d32); break; - case 8: - tcg_gen_qemu_ld_i64(cpu_fpr[rd / 2], addr, da.mem_idx, - da.memop | MO_ALIGN_4); + + case MO_64: + tcg_gen_qemu_ld_i64(cpu_fpr[rd / 2], addr, da->mem_idx, memop); break; - case 16: + + case MO_128: d64 = tcg_temp_new_i64(); - tcg_gen_qemu_ld_i64(d64, addr, da.mem_idx, da.memop | MO_ALIGN_4); + tcg_gen_qemu_ld_i64(d64, addr, da->mem_idx, memop); tcg_gen_addi_tl(addr, addr, 8); - tcg_gen_qemu_ld_i64(cpu_fpr[rd/2+1], addr, da.mem_idx, - da.memop | MO_ALIGN_4); + tcg_gen_qemu_ld_i64(cpu_fpr[rd / 2 + 1], addr, da->mem_idx, memop); tcg_gen_mov_i64(cpu_fpr[rd / 2], d64); break; default: @@ -2358,24 +2364,19 @@ gen_ldf_asi(DisasContext *dc, TCGv addr, int insn, int size, int rd) case GET_ASI_BLOCK: /* Valid for lddfa on aligned registers only. */ - if (size == 8 && (rd & 7) == 0) { - MemOp memop; + if (orig_size == MO_64 && (rd & 7) == 0) { TCGv eight; int i; - gen_address_mask(dc, addr); - /* The first operation checks required alignment. */ - memop = da.memop | MO_ALIGN_64; eight = tcg_constant_tl(8); for (i = 0; ; ++i) { - tcg_gen_qemu_ld_i64(cpu_fpr[rd / 2 + i], addr, - da.mem_idx, memop); + tcg_gen_qemu_ld_i64(cpu_fpr[rd / 2 + i], addr, da->mem_idx, + memop | (i == 0 ? MO_ALIGN_64 : 0)); if (i == 7) { break; } tcg_gen_add_tl(addr, addr, eight); - memop = da.memop; } } else { gen_exception(dc, TT_ILL_INSN); @@ -2384,10 +2385,9 @@ gen_ldf_asi(DisasContext *dc, TCGv addr, int insn, int size, int rd) case GET_ASI_SHORT: /* Valid for lddfa only. */ - if (size == 8) { - gen_address_mask(dc, addr); - tcg_gen_qemu_ld_i64(cpu_fpr[rd / 2], addr, da.mem_idx, - da.memop | MO_ALIGN); + if (orig_size == MO_64) { + tcg_gen_qemu_ld_i64(cpu_fpr[rd / 2], addr, da->mem_idx, + memop | MO_ALIGN); } else { gen_exception(dc, TT_ILL_INSN); } @@ -2395,8 +2395,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 @@ -2404,21 +2404,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: @@ -2430,36 +2432,52 @@ gen_ldf_asi(DisasContext *dc, TCGv addr, int insn, int size, int rd) } static void __attribute__((unused)) -gen_stf_asi(DisasContext *dc, TCGv addr, int insn, int size, int rd) +gen_ldf_asi(DisasContext *dc, TCGv addr, int insn, int size, int rd) { - DisasASI da = get_asi(dc, insn, (size == 4 ? MO_TEUL : MO_TEUQ)); + MemOp sz = ctz32(size); + DisasASI da = get_asi(dc, insn, MO_TE | sz); + + gen_address_mask(dc, addr); + gen_ldf_asi0(dc, &da, sz, addr, rd); +} + +static void gen_stf_asi0(DisasContext *dc, DisasASI *da, MemOp orig_size, + TCGv addr, int rd) +{ + MemOp memop = da->memop; + MemOp size = memop & MO_SIZE; TCGv_i32 d32; - switch (da.type) { + /* TODO: Use 128-bit load/store below. */ + if (size == MO_128) { + memop = (memop & ~MO_SIZE) | MO_64; + } + + switch (da->type) { case GET_ASI_EXCP: break; case GET_ASI_DIRECT: - gen_address_mask(dc, addr); + memop |= MO_ALIGN_4; switch (size) { - case 4: + case MO_32: d32 = gen_load_fpr_F(dc, rd); - tcg_gen_qemu_st_i32(d32, addr, da.mem_idx, da.memop | MO_ALIGN); + tcg_gen_qemu_st_i32(d32, addr, da->mem_idx, memop | MO_ALIGN); break; - case 8: - tcg_gen_qemu_st_i64(cpu_fpr[rd / 2], addr, da.mem_idx, - da.memop | MO_ALIGN_4); + case MO_64: + tcg_gen_qemu_st_i64(cpu_fpr[rd / 2], addr, da->mem_idx, + memop | MO_ALIGN_4); break; - case 16: + case MO_128: /* Only 4-byte alignment required. However, it is legal for the cpu to signal the alignment fault, and the OS trap handler is required to fix it up. Requiring 16-byte alignment here avoids having to probe the second page before performing the first write. */ - tcg_gen_qemu_st_i64(cpu_fpr[rd / 2], addr, da.mem_idx, - da.memop | MO_ALIGN_16); + tcg_gen_qemu_st_i64(cpu_fpr[rd / 2], addr, da->mem_idx, + memop | MO_ALIGN_16); tcg_gen_addi_tl(addr, addr, 8); - tcg_gen_qemu_st_i64(cpu_fpr[rd/2+1], addr, da.mem_idx, da.memop); + tcg_gen_qemu_st_i64(cpu_fpr[rd / 2 + 1], addr, da->mem_idx, memop); break; default: g_assert_not_reached(); @@ -2468,24 +2486,19 @@ gen_stf_asi(DisasContext *dc, TCGv addr, int insn, int size, int rd) case GET_ASI_BLOCK: /* Valid for stdfa on aligned registers only. */ - if (size == 8 && (rd & 7) == 0) { - MemOp memop; + if (orig_size == MO_64 && (rd & 7) == 0) { TCGv eight; int i; - gen_address_mask(dc, addr); - /* The first operation checks required alignment. */ - memop = da.memop | MO_ALIGN_64; eight = tcg_constant_tl(8); for (i = 0; ; ++i) { - tcg_gen_qemu_st_i64(cpu_fpr[rd / 2 + i], addr, - da.mem_idx, memop); + tcg_gen_qemu_st_i64(cpu_fpr[rd / 2 + i], addr, da->mem_idx, + memop | (i == 0 ? MO_ALIGN_64 : 0)); if (i == 7) { break; } tcg_gen_add_tl(addr, addr, eight); - memop = da.memop; } } else { gen_exception(dc, TT_ILL_INSN); @@ -2494,10 +2507,9 @@ gen_stf_asi(DisasContext *dc, TCGv addr, int insn, int size, int rd) case GET_ASI_SHORT: /* Valid for stdfa only. */ - if (size == 8) { - gen_address_mask(dc, addr); - tcg_gen_qemu_st_i64(cpu_fpr[rd / 2], addr, da.mem_idx, - da.memop | MO_ALIGN); + if (orig_size == MO_64) { + tcg_gen_qemu_st_i64(cpu_fpr[rd / 2], addr, da->mem_idx, + memop | MO_ALIGN); } else { gen_exception(dc, TT_ILL_INSN); } @@ -2512,6 +2524,16 @@ gen_stf_asi(DisasContext *dc, TCGv addr, int insn, int size, int rd) } } +static void __attribute__((unused)) +gen_stf_asi(DisasContext *dc, TCGv addr, int insn, int size, int rd) +{ + MemOp sz = ctz32(size); + DisasASI da = get_asi(dc, insn, MO_TE | sz); + + gen_address_mask(dc, addr); + gen_stf_asi0(dc, &da, sz, addr, rd); +} + static void gen_ldda_asi(DisasContext *dc, DisasASI *da, TCGv addr, int rd) { TCGv hi = gen_dest_gpr(dc, rd); From patchwork Thu Oct 26 00:15: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: 738261 Delivered-To: patch@linaro.org Received: by 2002:adf:f842:0:b0:32d:baff:b0ca with SMTP id d2csp558192wrq; Wed, 25 Oct 2023 17:35:24 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGHcnb4CT9VLDCMCy7TMqVcL7QRk2IZn27qhdpevNZCqIje3PLs7H7xbsPNbEP079PX3Z18 X-Received: by 2002:a05:6512:3096:b0:507:f0f2:57b1 with SMTP id z22-20020a056512309600b00507f0f257b1mr12016595lfd.15.1698280524459; Wed, 25 Oct 2023 17:35:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698280524; cv=none; d=google.com; s=arc-20160816; b=BYYY3yjOSSoyJxj4PzwRjBW56O+jUSF2jTSZrPn+Yj9W/zLZYcO1cMm3XLFfKb94EZ kLFiOMibmCCb2XJ8x3l7Z7BcseQcIlz/cW4V5/SWbnBuKAPWGGf8xI9HFrwzW139iqag Cj0sQUf7tNGW6EVKkFcPa2WFmcU25bYiicfYoi3v1J5viPD+LIY2CYZ2OC0plOz5wSm1 TItCYiFXLfs5R2b8M0zVAnfOjAxfQKvPiL6xGpJHULR/YJtsoCxEVsCrUuCSVvy53Dxw R5Cmh+pRfnSetZsmsxTJuweBwGgH0QcaI0Dg1iQ3Xb1oxxBW8Ufw/cYlwtfcp2XJE1Cv 9w7A== 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=b+HQpe9L5M9mn0a2A+T0Xl3xxidoAXsFEfrMksqu35Y=; fh=rYI8DiHAAFX3O5g969KmOAQ7d45Sb8OxQX1+DywGDk4=; b=rPzkF4ZMDOtb9MUNjvup/FkhA197pGPC2wM4m1/meoBepxeVOJAwF6FmPC9OJUTeYz uI65BlyB+rF5cIaWcHen3gRsvfR2wmRcTLzDZMvl8dssl7b7k4XWCVmzH38FgSNYJGXD veiOc/GbNKofPTKe96x4NPZ/oDh6xDMBWgje6MsstXi1SbTYrcTiU8jXYBLNTbA32CAw iSkuO/e34C3ZVfApfv39vEscE7mnlDU+V5lMmTpA2wZsjjY2CXiGF17kOHtLb1dQNXyJ LiXUoaB8mb1MGL1G+d/T1/idcTP2n5BimKG2f5U9hzqbcY+x19LhCuX65hq4+v3LG/dn lwLw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=NPU6NlHp; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as 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 cm13-20020a0564020c8d00b005411fa93b82si11451edb.631.2023.10.25.17.35.24 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 25 Oct 2023 17:35: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=NPU6NlHp; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as 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 1qvo9v-0003au-4T; Wed, 25 Oct 2023 20:23: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 1qvo9b-0002o1-GU for qemu-devel@nongnu.org; Wed, 25 Oct 2023 20:23:16 -0400 Received: from mail-pj1-x102d.google.com ([2607:f8b0:4864:20::102d]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qvo9K-0008Bo-B1 for qemu-devel@nongnu.org; Wed, 25 Oct 2023 20:23:15 -0400 Received: by mail-pj1-x102d.google.com with SMTP id 98e67ed59e1d1-27d0a173e61so248347a91.0 for ; Wed, 25 Oct 2023 17:22:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1698279777; x=1698884577; 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=b+HQpe9L5M9mn0a2A+T0Xl3xxidoAXsFEfrMksqu35Y=; b=NPU6NlHpElBQF45oFJOUHxUcT6BR/Owv6xBtGcDIcP/T8tSWAeNBqFo/lxC7wwcvQF hm4IUZQZM1LFxfPVbfqCpoLkQj3A+XEyp6QpQjjx/3tnpyzCIb1LXARqVMds5xSCEHf2 ZdKOW3DPAzSZP0NsjLNyAJE05wXIiNtNakm9K4/X2dwaZqbgaNrRdrPxnBXDXPMISIJx LB1kOjERL6AbVIGd1YpGVvMHOHIsifemsoGlwG3maUOhRzIJzAQn8S5lSYQNWau0BFhk 1ZI+YI1LXlF8sIXpitQZn3b71x21uW6RoXzE+GSSSiBWxyVoVZk6pU590OcomLR7yLej Ryag== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1698279777; x=1698884577; 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=b+HQpe9L5M9mn0a2A+T0Xl3xxidoAXsFEfrMksqu35Y=; b=msmn6hIg6YM/60ZcQw9U9bSwdwPc+/FHenVBxU2URH8X89XiY93h6djxclfZvFVFZd ijVh8Z8IJTIUKuitHlGdIBFjw+QEuWb21RI1g9eozeivEtTjrT/is+emJtYSClizHy8W wCLW/IXn8kDQWlRrh2YUxo2n7/gAzrJ7PPSRDXY10kkwQZ/W1Wbk8MHilzCXps/OV+JB Tjtqg2ctHYJ5IdSd82fb/0n3zO0mBXJge0u73L4xZc8+ePz4gFilv8nLq1lA8iQlbdD6 GujGib1MhWIV07XE4uEvf3J7WnBHIZgdebNOczwhKDEfVzWOC3pi7ATImHC6vp7lPPR6 bLew== X-Gm-Message-State: AOJu0Yz6zFXcbqCE419ybVXQz2l1yuYd5L8jYrckO8vvDpP/JzRuBAD7 oxTXQMRJoFN6rJY+tpXzbzVg6bbjJ2c9gA7ovR4= X-Received: by 2002:a17:90a:c0f:b0:27c:fa71:4765 with SMTP id 15-20020a17090a0c0f00b0027cfa714765mr13149375pjs.33.1698279776818; Wed, 25 Oct 2023 17:22:56 -0700 (PDT) Received: from stoup.. ([71.212.149.95]) by smtp.gmail.com with ESMTPSA id 9-20020a17090a0cc900b0027463889e72sm499870pjt.55.2023.10.25.17.22.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 25 Oct 2023 17:22:56 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: Mark Cave-Ayland Subject: [PULL 59/94] target/sparc: Move simple fp load/store to decodetree Date: Wed, 25 Oct 2023 17:15:07 -0700 Message-Id: <20231026001542.1141412-89-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231026001542.1141412-1-richard.henderson@linaro.org> References: <20231026001542.1141412-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::102d; envelope-from=richard.henderson@linaro.org; helo=mail-pj1-x102d.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_NONE=0.001, 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 Tested-by: Mark Cave-Ayland Acked-by: Mark Cave-Ayland Signed-off-by: Richard Henderson --- target/sparc/insns.decode | 19 ++++ target/sparc/translate.c | 194 ++++++++++++++++++-------------------- 2 files changed, 113 insertions(+), 100 deletions(-) diff --git a/target/sparc/insns.decode b/target/sparc/insns.decode index aa452f1d00..1150890e44 100644 --- a/target/sparc/insns.decode +++ b/target/sparc/insns.decode @@ -238,8 +238,16 @@ NCP 10 ----- 110111 ----- --------- ----- # v8 CPop2 ## Major Opcode 11 -- load and store instructions ## +%dfp_rd 25:5 !function=extract_dfpreg +%qfp_rd 25:5 !function=extract_qfpreg + &r_r_ri_asi rd rs1 rs2_or_imm asi imm:bool @r_r_ri_na .. rd:5 ...... rs1:5 imm:1 rs2_or_imm:s13 &r_r_ri_asi asi=-1 +@d_r_ri_na .. ..... ...... rs1:5 imm:1 rs2_or_imm:s13 \ + &r_r_ri_asi rd=%dfp_rd asi=-1 +@q_r_ri_na .. ..... ...... rs1:5 imm:1 rs2_or_imm:s13 \ + &r_r_ri_asi rd=%qfp_rd asi=-1 + @r_r_r_asi .. rd:5 ...... rs1:5 0 asi:8 rs2_or_imm:5 &r_r_ri_asi imm=0 @r_r_i_asi .. rd:5 ...... rs1:5 1 rs2_or_imm:s13 \ &r_r_ri_asi imm=1 asi=-2 @@ -289,6 +297,17 @@ STD 11 ..... 010111 ..... . ............. @r_r_i_asi # STDA STX 11 ..... 011110 ..... . ............. @r_r_r_asi # STXA STX 11 ..... 011110 ..... . ............. @r_r_i_asi # STXA +LDF 11 ..... 100000 ..... . ............. @r_r_ri_na +LDQF 11 ..... 100010 ..... . ............. @q_r_ri_na +LDDF 11 ..... 100011 ..... . ............. @d_r_ri_na + +STF 11 ..... 100100 ..... . ............. @r_r_ri_na +{ + STQF 11 ..... 100110 ..... . ............. @q_r_ri_na + STDFQ 11 ----- 100110 ----- - ------------- +} +STDF 11 ..... 100111 ..... . ............. @d_r_ri_na + LDSTUB 11 ..... 001101 ..... . ............. @r_r_ri_na LDSTUB 11 ..... 011101 ..... . ............. @r_r_r_asi # LDSTUBA LDSTUB 11 ..... 011101 ..... . ............. @r_r_i_asi # LDSTUBA diff --git a/target/sparc/translate.c b/target/sparc/translate.c index 55d6f83736..dab3dfd09c 100644 --- a/target/sparc/translate.c +++ b/target/sparc/translate.c @@ -254,29 +254,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); @@ -2900,6 +2878,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" @@ -3035,6 +3023,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); @@ -4633,6 +4635,68 @@ static bool do_casa(DisasContext *dc, arg_r_r_ri_asi *a, MemOp mop) TRANS(CASA, CASA, do_casa, a, MO_TEUL) TRANS(CASXA, 64, do_casa, a, MO_TEUQ) +static bool do_ld_fpr(DisasContext *dc, arg_r_r_ri_asi *a, MemOp sz) +{ + TCGv addr = gen_ldst_addr(dc, a->rs1, a->imm, a->rs2_or_imm); + DisasASI da; + + if (addr == NULL) { + return false; + } + if (gen_trap_ifnofpu(dc)) { + return true; + } + if (sz == MO_128 && gen_trap_float128(dc)) { + return true; + } + da = resolve_asi(dc, a->asi, MO_TE | sz); + gen_ldf_asi0(dc, &da, sz, addr, a->rd); + gen_update_fprs_dirty(dc, a->rd); + return advance_pc(dc); +} + +TRANS(LDF, ALL, do_ld_fpr, a, MO_32) +TRANS(LDDF, ALL, do_ld_fpr, a, MO_64) +TRANS(LDQF, ALL, do_ld_fpr, a, MO_128) + +static bool do_st_fpr(DisasContext *dc, arg_r_r_ri_asi *a, MemOp sz) +{ + TCGv addr = gen_ldst_addr(dc, a->rs1, a->imm, a->rs2_or_imm); + DisasASI da; + + if (addr == NULL) { + return false; + } + if (gen_trap_ifnofpu(dc)) { + return true; + } + if (sz == MO_128 && gen_trap_float128(dc)) { + return true; + } + da = resolve_asi(dc, a->asi, MO_TE | sz); + gen_stf_asi0(dc, &da, sz, addr, a->rd); + return advance_pc(dc); +} + +TRANS(STF, ALL, do_st_fpr, a, MO_32) +TRANS(STDF, ALL, do_st_fpr, a, MO_64) +TRANS(STQF, ALL, do_st_fpr, a, MO_128) + +static bool trans_STDFQ(DisasContext *dc, arg_STDFQ *a) +{ + if (!avail_32(dc)) { + return false; + } + if (!supervisor(dc)) { + return raise_priv(dc); + } + if (gen_trap_ifnofpu(dc)) { + return true; + } + gen_op_fpexception_im(dc, FSR_FTT_SEQ_ERROR); + return true; +} + #define CHECK_IU_FEATURE(dc, FEATURE) \ if (!((dc)->def->features & CPU_FEATURE_ ## FEATURE)) \ goto illegal_insn; @@ -4647,7 +4711,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); @@ -5514,12 +5579,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); @@ -5536,25 +5598,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; } @@ -5564,11 +5607,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 @@ -5583,43 +5624,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; } @@ -5666,19 +5670,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 Thu Oct 26 00:15: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: 738238 Delivered-To: patch@linaro.org Received: by 2002:adf:f842:0:b0:32d:baff:b0ca with SMTP id d2csp555684wrq; Wed, 25 Oct 2023 17:28:11 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEEK0ZeNdSoXTapFg0BFVCkagSiIhb7Hh5mAhH/k5UkQ1CBTSCa/BDIqmVaOTiL5Hs8/0qW X-Received: by 2002:a05:6000:152:b0:31f:8999:c409 with SMTP id r18-20020a056000015200b0031f8999c409mr12002898wrx.66.1698280090956; Wed, 25 Oct 2023 17:28:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698280090; cv=none; d=google.com; s=arc-20160816; b=hIf+KE8ci0SH3U24z/2Avp5OWQQubU+mF+r7aI3m1yCMn+Qjl8qn8BRXSLsUD6FF45 84VVXoMrmikt2Gl8qwcESv9nVKt0ryw34rN4Fz6JVp6H4/zD/d8v1a4Ff6NwLiftf27F vc7+42dmO0JItAgAYqj2O703nkrI2g/fbxJ/dvRuJMWV/D2wu71FNENbxIww2q3KveMf u17l4zxEScdcULLUQuIzdzysqLXQKtIoNLzIY04jGmU6OhPH1/E6Gxg+Qd4KHfLI2ahS D04b/gAJVR8keVK54r7SUkdBI4RXcIW9QGTrsWcih5zXnKCkxGVurUTTwILt+w9iEVzj mwVA== 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=K8YU64Za2EkWkchsAfoy1+WnYH0eMyiNHsii8BGP13U=; fh=rYI8DiHAAFX3O5g969KmOAQ7d45Sb8OxQX1+DywGDk4=; b=TH7Cs9vWIAwV9/tNh26Y65t2qDwB69iBy9/iknVgCMFibTrrmMC3F/pglr6EJxkeqL bZzmcyvPE3HAJv31dZuR9F8cJbhRt5LImsL8EXNRElxPGo0yrb2ms2F/rL7GU2xHeNkN Tdj7lVzsYrexmf0TmS1/mzo6fSpLFZUYUU+ecE+YI5JFLOVoYbbY6EZNJcbIZzUNr6dy WJY6ItlvIipvEMNSzaZlU3M4UxD0rzh8eAO3POxBezMcvDt5TN29mGeM74MtCu4hSlbY RmIbvCsbdBYqK7I0O1C0Qmjn1I0tx1RdbnCc58Z+TCofeF/NhLkl0q2L6oqIj3FvCC8P SIkA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=QDGyrZSW; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as 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-20020a5d4e81000000b0031fb13d9945si8180915wru.879.2023.10.25.17.28.10 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 25 Oct 2023 17:28: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=QDGyrZSW; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as 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 1qvo9w-0003bw-3Z; Wed, 25 Oct 2023 20:23: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 1qvo9Q-0000zD-8C for qemu-devel@nongnu.org; Wed, 25 Oct 2023 20:23:04 -0400 Received: from mail-pj1-x102e.google.com ([2607:f8b0:4864:20::102e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qvo9L-0008Bu-E3 for qemu-devel@nongnu.org; Wed, 25 Oct 2023 20:23:03 -0400 Received: by mail-pj1-x102e.google.com with SMTP id 98e67ed59e1d1-27d23f1e3b8so241814a91.1 for ; Wed, 25 Oct 2023 17:22:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1698279778; x=1698884578; 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=K8YU64Za2EkWkchsAfoy1+WnYH0eMyiNHsii8BGP13U=; b=QDGyrZSWEACu+JOtqYf/LiVLKYhJ6uIGeg1bKetNcThg4D6c4wRixcEdnUcQyQ+ScD 2Gjd5YE3lnnW6uPuIk6rgPGFpDOn+5+6M5UZJQtPsdLkMgxg4ar0+UrH7DAp3tEM0GUk 6BY6/ujxrRGlK8glKO79eBv8NgKrCaASZhq+AqXuTZXPkK/6t/JohRbpcWbGmtIS1m1U 5PjaEXcET6qeBtQHm/iK7ADyGk+KB5HXE+oajsAPKVjnsnsd2K/dewxaeGS54XaelBUc wCpyAuZ0hq2VsphdES42pqohBaCngzrVRGVhTiD2Kl7cWtyLjcqV/NJxE91q5i0MWUIP 3JhQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1698279778; x=1698884578; 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=K8YU64Za2EkWkchsAfoy1+WnYH0eMyiNHsii8BGP13U=; b=lF9wAD0/OK5/IbCAP9XtdiS9CbakDjGHZ8a5Xu9ILFxICyOqmmVN8sXi5/+7ZHI0MY 73Xzha7GKEMOh7UO3dehE2jzDhQI1+FLQlz/d51vMzaEkoa7gmRLBtHj2b8V3RB02n8q XzUPMbn4aTW+dMClExKDfWOMDK6f1b5Bykf2kgmhuz7PIxmptKXX64jUaKF+aEUnfd9d zvdaMFCH8lXaLAJ+mAfUVqZzz0FdF6/BTdHgx4B9lcOLmIzMnOMmXH4osMbx9MpFjUxM G5jAcKEhHlnMEdxR9c62EYjkpW/A9obtAW5rxjy6Fe/K+xTpnPxdhj9pHONfdivQ72ZG lW9A== X-Gm-Message-State: AOJu0Yx9ZAOKEEvrQbKRbxniadOSWMKfJO/3yuwWpdjHQC6+XqGF710L aNByUsiVv7p4K5WTIAp+WJ4NVvH3WEoSoEmnDgs= X-Received: by 2002:a17:90b:5108:b0:27d:4b6e:b405 with SMTP id sc8-20020a17090b510800b0027d4b6eb405mr15351813pjb.33.1698279777670; Wed, 25 Oct 2023 17:22:57 -0700 (PDT) Received: from stoup.. ([71.212.149.95]) by smtp.gmail.com with ESMTPSA id 9-20020a17090a0cc900b0027463889e72sm499870pjt.55.2023.10.25.17.22.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 25 Oct 2023 17:22:57 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: Mark Cave-Ayland Subject: [PULL 60/94] target/sparc: Move asi fp load/store to decodetree Date: Wed, 25 Oct 2023 17:15:08 -0700 Message-Id: <20231026001542.1141412-90-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231026001542.1141412-1-richard.henderson@linaro.org> References: <20231026001542.1141412-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::102e; envelope-from=richard.henderson@linaro.org; helo=mail-pj1-x102e.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org Tested-by: Mark Cave-Ayland Acked-by: Mark Cave-Ayland Signed-off-by: Richard Henderson --- target/sparc/insns.decode | 51 +++++++++-- target/sparc/translate.c | 173 ++++++++------------------------------ 2 files changed, 81 insertions(+), 143 deletions(-) diff --git a/target/sparc/insns.decode b/target/sparc/insns.decode index 1150890e44..45eb6a967f 100644 --- a/target/sparc/insns.decode +++ b/target/sparc/insns.decode @@ -251,6 +251,14 @@ NCP 10 ----- 110111 ----- --------- ----- # v8 CPop2 @r_r_r_asi .. rd:5 ...... rs1:5 0 asi:8 rs2_or_imm:5 &r_r_ri_asi imm=0 @r_r_i_asi .. rd:5 ...... rs1:5 1 rs2_or_imm:s13 \ &r_r_ri_asi imm=1 asi=-2 +@d_r_r_asi .. ..... ...... rs1:5 0 asi:8 rs2_or_imm:5 \ + &r_r_ri_asi rd=%dfp_rd imm=0 +@d_r_i_asi .. ..... ...... rs1:5 1 rs2_or_imm:s13 \ + &r_r_ri_asi rd=%dfp_rd imm=1 asi=-2 +@q_r_r_asi .. ..... ...... rs1:5 0 asi:8 rs2_or_imm:5 \ + &r_r_ri_asi rd=%qfp_rd imm=0 +@q_r_i_asi .. ..... ...... rs1:5 1 rs2_or_imm:s13 \ + &r_r_ri_asi rd=%qfp_rd imm=1 asi=-2 @casa_imm .. rd:5 ...... rs1:5 1 00000000 rs2_or_imm:5 \ &r_r_ri_asi imm=1 asi=-2 @@ -325,10 +333,43 @@ NOP_v9 11 ----- 101101 ----- 0 00000000 ----- # PREFETCH NOP_v9 11 ----- 101101 ----- 1 ------------- # PREFETCH NOP_v9 11 ----- 111101 ----- - ------------- # PREFETCHA -NCP 11 ----- 110000 ----- --------- ----- # v8 LDC +{ + [ + LDFA 11 ..... 110000 ..... . ............. @r_r_r_asi + LDFA 11 ..... 110000 ..... . ............. @r_r_i_asi + ] + NCP 11 ----- 110000 ----- --------- ----- # v8 LDC +} NCP 11 ----- 110001 ----- --------- ----- # v8 LDCSR -NCP 11 ----- 110011 ----- --------- ----- # v8 LDDC -NCP 11 ----- 110100 ----- --------- ----- # v8 STC +LDQFA 11 ..... 110010 ..... . ............. @q_r_r_asi +LDQFA 11 ..... 110010 ..... . ............. @q_r_i_asi +{ + [ + LDDFA 11 ..... 110011 ..... . ............. @d_r_r_asi + LDDFA 11 ..... 110011 ..... . ............. @d_r_i_asi + ] + NCP 11 ----- 110011 ----- --------- ----- # v8 LDDC +} + +{ + [ + STFA 11 ..... 110100 ..... . ............. @r_r_r_asi + STFA 11 ..... 110100 ..... . ............. @r_r_i_asi + ] + NCP 11 ----- 110100 ----- --------- ----- # v8 STC +} NCP 11 ----- 110101 ----- --------- ----- # v8 STCSR -NCP 11 ----- 110110 ----- --------- ----- # v8 STDCQ -NCP 11 ----- 110111 ----- --------- ----- # v8 STDC +{ + [ + STQFA 11 ..... 110110 ..... . ............. @q_r_r_asi + STQFA 11 ..... 110110 ..... . ............. @q_r_i_asi + ] + NCP 11 ----- 110110 ----- --------- ----- # v8 STDCQ +} +{ + [ + STDFA 11 ..... 110111 ..... . ............. @d_r_r_asi + STDFA 11 ..... 110111 ..... . ............. @d_r_i_asi + ] + NCP 11 ----- 110111 ----- --------- ----- # v8 STDC +} diff --git a/target/sparc/translate.c b/target/sparc/translate.c index dab3dfd09c..ebffcd7393 100644 --- a/target/sparc/translate.c +++ b/target/sparc/translate.c @@ -2106,12 +2106,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); -} - #if defined(CONFIG_USER_ONLY) && !defined(TARGET_SPARC64) static void gen_helper_ld_asi(TCGv_i64 r, TCGv_env e, TCGv a, TCGv_i32 asi, TCGv_i32 mop) @@ -2298,13 +2292,14 @@ static void gen_ldstub_asi(DisasContext *dc, DisasASI *da, TCGv dst, TCGv addr) } } -static void gen_ldf_asi0(DisasContext *dc, DisasASI *da, MemOp orig_size, - TCGv addr, int rd) +static void gen_ldf_asi(DisasContext *dc, DisasASI *da, MemOp orig_size, + TCGv addr, int rd) { MemOp memop = da->memop; MemOp size = memop & MO_SIZE; TCGv_i32 d32; TCGv_i64 d64; + TCGv addr_tmp; /* TODO: Use 128-bit load/store below. */ if (size == MO_128) { @@ -2331,8 +2326,9 @@ static void gen_ldf_asi0(DisasContext *dc, DisasASI *da, MemOp orig_size, case MO_128: d64 = tcg_temp_new_i64(); tcg_gen_qemu_ld_i64(d64, addr, da->mem_idx, memop); - tcg_gen_addi_tl(addr, addr, 8); - tcg_gen_qemu_ld_i64(cpu_fpr[rd / 2 + 1], addr, da->mem_idx, memop); + addr_tmp = tcg_temp_new(); + tcg_gen_addi_tl(addr_tmp, addr, 8); + tcg_gen_qemu_ld_i64(cpu_fpr[rd / 2 + 1], addr_tmp, da->mem_idx, memop); tcg_gen_mov_i64(cpu_fpr[rd / 2], d64); break; default: @@ -2343,18 +2339,16 @@ static void gen_ldf_asi0(DisasContext *dc, DisasASI *da, MemOp orig_size, case GET_ASI_BLOCK: /* Valid for lddfa on aligned registers only. */ if (orig_size == MO_64 && (rd & 7) == 0) { - TCGv eight; - int i; - /* The first operation checks required alignment. */ - eight = tcg_constant_tl(8); - for (i = 0; ; ++i) { + addr_tmp = tcg_temp_new(); + for (int i = 0; ; ++i) { tcg_gen_qemu_ld_i64(cpu_fpr[rd / 2 + i], addr, da->mem_idx, memop | (i == 0 ? MO_ALIGN_64 : 0)); if (i == 7) { break; } - tcg_gen_add_tl(addr, addr, eight); + tcg_gen_addi_tl(addr_tmp, addr, 8); + addr = addr_tmp; } } else { gen_exception(dc, TT_ILL_INSN); @@ -2396,8 +2390,9 @@ static void gen_ldf_asi0(DisasContext *dc, DisasASI *da, MemOp orig_size, case MO_128: d64 = tcg_temp_new_i64(); gen_helper_ld_asi(d64, tcg_env, addr, r_asi, r_mop); - tcg_gen_addi_tl(addr, addr, 8); - gen_helper_ld_asi(cpu_fpr[rd / 2 + 1], tcg_env, addr, + addr_tmp = tcg_temp_new(); + tcg_gen_addi_tl(addr_tmp, addr, 8); + gen_helper_ld_asi(cpu_fpr[rd / 2 + 1], tcg_env, addr_tmp, r_asi, r_mop); tcg_gen_mov_i64(cpu_fpr[rd / 2], d64); break; @@ -2409,22 +2404,13 @@ static void gen_ldf_asi0(DisasContext *dc, DisasASI *da, MemOp orig_size, } } -static void __attribute__((unused)) -gen_ldf_asi(DisasContext *dc, TCGv addr, int insn, int size, int rd) -{ - MemOp sz = ctz32(size); - DisasASI da = get_asi(dc, insn, MO_TE | sz); - - gen_address_mask(dc, addr); - gen_ldf_asi0(dc, &da, sz, addr, rd); -} - -static void gen_stf_asi0(DisasContext *dc, DisasASI *da, MemOp orig_size, - TCGv addr, int rd) +static void gen_stf_asi(DisasContext *dc, DisasASI *da, MemOp orig_size, + TCGv addr, int rd) { MemOp memop = da->memop; MemOp size = memop & MO_SIZE; TCGv_i32 d32; + TCGv addr_tmp; /* TODO: Use 128-bit load/store below. */ if (size == MO_128) { @@ -2454,8 +2440,9 @@ static void gen_stf_asi0(DisasContext *dc, DisasASI *da, MemOp orig_size, write. */ tcg_gen_qemu_st_i64(cpu_fpr[rd / 2], addr, da->mem_idx, memop | MO_ALIGN_16); - tcg_gen_addi_tl(addr, addr, 8); - tcg_gen_qemu_st_i64(cpu_fpr[rd / 2 + 1], addr, da->mem_idx, memop); + addr_tmp = tcg_temp_new(); + tcg_gen_addi_tl(addr_tmp, addr, 8); + tcg_gen_qemu_st_i64(cpu_fpr[rd / 2 + 1], addr_tmp, da->mem_idx, memop); break; default: g_assert_not_reached(); @@ -2465,18 +2452,16 @@ static void gen_stf_asi0(DisasContext *dc, DisasASI *da, MemOp orig_size, case GET_ASI_BLOCK: /* Valid for stdfa on aligned registers only. */ if (orig_size == MO_64 && (rd & 7) == 0) { - TCGv eight; - int i; - /* The first operation checks required alignment. */ - eight = tcg_constant_tl(8); - for (i = 0; ; ++i) { + addr_tmp = tcg_temp_new(); + for (int i = 0; ; ++i) { tcg_gen_qemu_st_i64(cpu_fpr[rd / 2 + i], addr, da->mem_idx, memop | (i == 0 ? MO_ALIGN_64 : 0)); if (i == 7) { break; } - tcg_gen_add_tl(addr, addr, eight); + tcg_gen_addi_tl(addr_tmp, addr, 8); + addr = addr_tmp; } } else { gen_exception(dc, TT_ILL_INSN); @@ -2502,16 +2487,6 @@ static void gen_stf_asi0(DisasContext *dc, DisasASI *da, MemOp orig_size, } } -static void __attribute__((unused)) -gen_stf_asi(DisasContext *dc, TCGv addr, int insn, int size, int rd) -{ - MemOp sz = ctz32(size); - DisasASI da = get_asi(dc, insn, MO_TE | sz); - - gen_address_mask(dc, addr); - gen_stf_asi0(dc, &da, sz, addr, rd); -} - static void gen_ldda_asi(DisasContext *dc, DisasASI *da, TCGv addr, int rd) { TCGv hi = gen_dest_gpr(dc, rd); @@ -4650,7 +4625,7 @@ static bool do_ld_fpr(DisasContext *dc, arg_r_r_ri_asi *a, MemOp sz) return true; } da = resolve_asi(dc, a->asi, MO_TE | sz); - gen_ldf_asi0(dc, &da, sz, addr, a->rd); + gen_ldf_asi(dc, &da, sz, addr, a->rd); gen_update_fprs_dirty(dc, a->rd); return advance_pc(dc); } @@ -4659,6 +4634,10 @@ TRANS(LDF, ALL, do_ld_fpr, a, MO_32) TRANS(LDDF, ALL, do_ld_fpr, a, MO_64) TRANS(LDQF, ALL, do_ld_fpr, a, MO_128) +TRANS(LDFA, 64, do_ld_fpr, a, MO_32) +TRANS(LDDFA, 64, do_ld_fpr, a, MO_64) +TRANS(LDQFA, 64, do_ld_fpr, a, MO_128) + static bool do_st_fpr(DisasContext *dc, arg_r_r_ri_asi *a, MemOp sz) { TCGv addr = gen_ldst_addr(dc, a->rs1, a->imm, a->rs2_or_imm); @@ -4674,7 +4653,7 @@ static bool do_st_fpr(DisasContext *dc, arg_r_r_ri_asi *a, MemOp sz) return true; } da = resolve_asi(dc, a->asi, MO_TE | sz); - gen_stf_asi0(dc, &da, sz, addr, a->rd); + gen_stf_asi(dc, &da, sz, addr, a->rd); return advance_pc(dc); } @@ -4682,6 +4661,10 @@ TRANS(STF, ALL, do_st_fpr, a, MO_32) TRANS(STDF, ALL, do_st_fpr, a, MO_64) TRANS(STQF, ALL, do_st_fpr, a, MO_128) +TRANS(STFA, 64, do_st_fpr, a, MO_32) +TRANS(STDFA, 64, do_st_fpr, a, MO_64) +TRANS(STQFA, 64, do_st_fpr, a, MO_128) + static bool trans_STDFQ(DisasContext *dc, arg_STDFQ *a) { if (!avail_32(dc)) { @@ -5515,64 +5498,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; @@ -5628,36 +5554,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 Thu Oct 26 00:15: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: 738242 Delivered-To: patch@linaro.org Received: by 2002:adf:f842:0:b0:32d:baff:b0ca with SMTP id d2csp556186wrq; Wed, 25 Oct 2023 17:29:35 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEyc7REnvPN7v2hGcELadlWoeN2ovq5+AWOZocqPXqo280THEcIiUKijeQTo7jM3Vmy/lE8 X-Received: by 2002:a05:600c:4ec6:b0:406:7029:c4f2 with SMTP id g6-20020a05600c4ec600b004067029c4f2mr12539419wmq.26.1698280175024; Wed, 25 Oct 2023 17:29:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698280175; cv=none; d=google.com; s=arc-20160816; b=hYZ1POSrQtbLdsMua9gElbbGlBIlUiR806gUUuq/RpuixsCha3DmFEo4x2HWd3+py8 H41/9hbtuOBwGGTLF/u0441xcZcStxAmJcnjfi13b/+xuOnUKfqqzXfliLxve/F/IPC8 B6FUKIU6KHSC96H+6gIoz5Mr8Ffmh8hQ/q072GVtaDAJu0hN72S6M+uF35p883VO6qJ4 ZGfR86I8VXwKX7c+1N+GRjAjSrvp2PqV6VsX9ms8+k+TFykv9IrpLFdHWgoVeuCzFxf7 GUCEsC1S0jOaFDRPvU0Fik+vseR7kvhnRE5RZP9tXiApBjgpA5gCIslid8eFq15vO5JO 9bDw== 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=RIi7xoRuzKbSVlpBvebwS7XPDovioXkEjFSzNKBTcCg=; fh=rYI8DiHAAFX3O5g969KmOAQ7d45Sb8OxQX1+DywGDk4=; b=PI4yNhgRRBSUjFOApN3o+M+A11nhuQz4B7NmSas80D/j7jygWc0tsh96KXcbWtmZhO 5u0OPf785wnwDNCoLftrHluI+2e2HqYp0EIbzQDqQBcP9DLhrIUKViCXikORpWXp4JZG r8XLMEOdkh9iK/eQmTRtd3cnY/oOEh09Qy5UjzaOISYTOUP2Tr83qMzyls4yP4ObXY6U M4I99QFVIqTVfQpddW2XVEuz50s2t85nsLmFRmkyYgKUyuYbjyPe4OlGBpEtWTVlkWyJ B70BBKNgTxzMnUrBZhYi0JEuzpQyocNDklNcFWEs2CZA8qapyjW78uiKUK98UXf9GU7/ MDWw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=C5+IGhuZ; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as 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 g7-20020a05600c4ec700b004068d2c41c5si761768wmq.226.2023.10.25.17.29.34 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 25 Oct 2023 17:29: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=C5+IGhuZ; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as 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 1qvo9o-0003FK-Ir; Wed, 25 Oct 2023 20:23: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 1qvo9P-0000yP-UN for qemu-devel@nongnu.org; Wed, 25 Oct 2023 20:23:04 -0400 Received: from mail-pj1-x1031.google.com ([2607:f8b0:4864:20::1031]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qvo9L-0008CB-RW for qemu-devel@nongnu.org; Wed, 25 Oct 2023 20:23:03 -0400 Received: by mail-pj1-x1031.google.com with SMTP id 98e67ed59e1d1-27d4372322aso230999a91.3 for ; Wed, 25 Oct 2023 17:22:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1698279778; x=1698884578; 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=RIi7xoRuzKbSVlpBvebwS7XPDovioXkEjFSzNKBTcCg=; b=C5+IGhuZeTEXf845J3zcdiH0fBhg1G63HVH9OYH/+fBGXZpx+3iwJci9eozz46mIHm K5LJQS58fgu5ZhFrW+AKdDqnQpsbRAgeDcsDiOullNrDn4F2CXLeoUcPY9q0+nuZHlBw sFytSHzktjeaL7gwPnq6n2ulSqt0sx4i2gg9k13YHPpiCGOOr3C68msB0r2P7uK1coQO J6pbjjhp4MB3p6EtNZDsH/AKR2eCrTOyhZUQgNBSpXyrCaIWjp6egDeDyjRgwT+fYM34 HDnkN+WN4wQQ0E2zKlU5pcILFENH6E44g9a0gCMxH2FcAxxq58JP+FGU4cG6oWQKhop9 DmTg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1698279778; x=1698884578; 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=RIi7xoRuzKbSVlpBvebwS7XPDovioXkEjFSzNKBTcCg=; b=E1EEuOn5hjFwu/LQAUaxRmlVTb6k30YTB5Jew//w6QzC6w3lMMHzNXzJHsRyW4oJWo psVdOIh5yjPBjd5LCjiP6KqYRMjYprhvqv/zxHTnhiGRpBARDWEQfYzynMS25S6CR6TO A5B7NVtZIKaFj0JnjCvfKBBbIc68XHAa5UoWf33marfZPqH+IWOXOzOu8SXOe5Yi7KWK 2m8PWwvU6fyh7q6eNAkdVWV7ab9YnDUEp2cNjMsyMuu+ChytXSEhD65bJd716h0uC1eH bvUhkWCtEvRW1yoC3OP7MUvOETpDCLGQqIwjXNyIV4iZVPTPvkSYiDt2g8+Uhq7Hr5YD xluA== X-Gm-Message-State: AOJu0YyOhh1hqJ9i3xg8LWnWH8W5tDfcTEJYk9C6sCLJr1QUa+o9Paqg QQNZsq06FiDhc58cKAMeO2+4Bl/QLV/iyPkvCng= X-Received: by 2002:a17:90b:354e:b0:27d:37bb:12c0 with SMTP id lt14-20020a17090b354e00b0027d37bb12c0mr13885687pjb.36.1698279778327; Wed, 25 Oct 2023 17:22:58 -0700 (PDT) Received: from stoup.. ([71.212.149.95]) by smtp.gmail.com with ESMTPSA id 9-20020a17090a0cc900b0027463889e72sm499870pjt.55.2023.10.25.17.22.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 25 Oct 2023 17:22:57 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: Mark Cave-Ayland Subject: [PULL 61/94] target/sparc: Move LDFSR, STFSR to decodetree Date: Wed, 25 Oct 2023 17:15:09 -0700 Message-Id: <20231026001542.1141412-91-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231026001542.1141412-1-richard.henderson@linaro.org> References: <20231026001542.1141412-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::1031; envelope-from=richard.henderson@linaro.org; helo=mail-pj1-x1031.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org Tested-by: Mark Cave-Ayland Acked-by: Mark Cave-Ayland Signed-off-by: Richard Henderson --- target/sparc/insns.decode | 4 + target/sparc/translate.c | 152 +++++++++++++++----------------------- 2 files changed, 64 insertions(+), 92 deletions(-) diff --git a/target/sparc/insns.decode b/target/sparc/insns.decode index 45eb6a967f..5df3b1add4 100644 --- a/target/sparc/insns.decode +++ b/target/sparc/insns.decode @@ -306,10 +306,14 @@ STX 11 ..... 011110 ..... . ............. @r_r_r_asi # STXA STX 11 ..... 011110 ..... . ............. @r_r_i_asi # STXA LDF 11 ..... 100000 ..... . ............. @r_r_ri_na +LDFSR 11 00000 100001 ..... . ............. @n_r_ri +LDXFSR 11 00001 100001 ..... . ............. @n_r_ri LDQF 11 ..... 100010 ..... . ............. @q_r_ri_na LDDF 11 ..... 100011 ..... . ............. @d_r_ri_na STF 11 ..... 100100 ..... . ............. @r_r_ri_na +STFSR 11 00000 100101 ..... . ............. @n_r_ri +STXFSR 11 00001 100101 ..... . ............. @n_r_ri { STQF 11 ..... 100110 ..... . ............. @q_r_ri_na STDFQ 11 ----- 100110 ----- - ------------- diff --git a/target/sparc/translate.c b/target/sparc/translate.c index ebffcd7393..4c0e7cde4a 100644 --- a/target/sparc/translate.c +++ b/target/sparc/translate.c @@ -45,6 +45,7 @@ # define gen_helper_clear_softint(E, S) qemu_build_not_reached() # define gen_helper_done(E) qemu_build_not_reached() # define gen_helper_flushw(E) qemu_build_not_reached() +# define gen_helper_ldxfsr(D, E, A, B) 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_restored(E) qemu_build_not_reached() @@ -164,12 +165,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) @@ -2655,13 +2650,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; @@ -4680,6 +4675,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; @@ -4693,10 +4743,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); @@ -5477,89 +5527,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 Thu Oct 26 00:15: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: 738232 Delivered-To: patch@linaro.org Received: by 2002:adf:f842:0:b0:32d:baff:b0ca with SMTP id d2csp555386wrq; Wed, 25 Oct 2023 17:27:08 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFw2mxG5bPIYp0fFKujfCvrrDCEej3RVTuldvc+sFuwqLPqGBMkvrzjEc+poYqLo6pX4dTI X-Received: by 2002:a2e:9219:0:b0:2c5:1388:e370 with SMTP id k25-20020a2e9219000000b002c51388e370mr12376157ljg.30.1698280028315; Wed, 25 Oct 2023 17:27:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698280028; cv=none; d=google.com; s=arc-20160816; b=gl73f3rIHksLoMx+NtwG31+hZd+1Jl8IezGltDX3eDivAnJzP883Y3uyx+sRVS/yPl 9R1rzwzEnAweC+MAgN0ysSl0RiGqdv3ds+tzHL24DjuInnNJWWNpPv1vdcOTIc12yCNZ 0WabYgmjhPRy79QVTx085dTgSwl1J6Rw+NXhjgcZplo1swFdgVKs56PiWO4GVPJtFI7+ Aqbb31pwbZGQ/5wIexjJrm49RJawObLSVyZEorxydTbTf3R2mMyXXOW5FfNyZcQ5CsDL f+6XRKcwBNCXs6KjVGgQYF7XHAm8fx9QIezVkykoCZjDhzHbS19YMTbM4zMuq0pzQ3U2 kBkw== 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=XwblM3qYHhgk/BSbqYTN8K2nRmzxfzwTe7jRYcOw49o=; fh=rYI8DiHAAFX3O5g969KmOAQ7d45Sb8OxQX1+DywGDk4=; b=vu94oCGXXXRABFdYDCcKUCiBgBqmso46nhsgiALPCsEdg4t7evHtlGXPL8gBlSnIJY FLxt2v1oY5dliy+P3z+bN7rsXMyyPfHW1CxhJNpvhBtQ5PepHpDLQ/aV9ybN3lgb6eA5 ie9HxPzY/Npdu3nuAZY/7dnEkJ+HW4mkun8Grx46ym6mxkqtoqkyyicJ6vvBSsL0v5lx TDtVRg/+raiuSL3a8Z5MHdp6kj30ILEor2h7I7D+AMc/tMV40dM6aYWF38iRgPW+cEEw FuJ5wA70Rf6izSZQYtxRUbKd9xiN5s0u9GE8yy6q3BilLFxvJ/42cyeGnVeQdhImO3TU nJDw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=siYacVCU; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as 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 u20-20020a05600c00d400b004050520cb8bsi767786wmm.176.2023.10.25.17.27.08 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 25 Oct 2023 17:27: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=siYacVCU; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as 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 1qvo9i-0002tv-1P; Wed, 25 Oct 2023 20:23:22 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qvo9T-0001QP-0Z for qemu-devel@nongnu.org; Wed, 25 Oct 2023 20:23:07 -0400 Received: from mail-pj1-x102c.google.com ([2607:f8b0:4864:20::102c]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qvo9O-0008CP-5W for qemu-devel@nongnu.org; Wed, 25 Oct 2023 20:23:06 -0400 Received: by mail-pj1-x102c.google.com with SMTP id 98e67ed59e1d1-27d292d38c0so243709a91.1 for ; Wed, 25 Oct 2023 17:23:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1698279779; x=1698884579; 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=XwblM3qYHhgk/BSbqYTN8K2nRmzxfzwTe7jRYcOw49o=; b=siYacVCUOgF3CAT2tuXgx68dIpTpF5VA2069tcX3Dlf83rN4sXazeu2JgO14PceC/Z aF8blQZr+M2OwOWoejORTOBiUku2A76WNcOa7B7T3Wb72cXm4cvvWO/JTZB+EC1LvrGM r4aq0NeiJo69qTxrY9awGoX1wCnQ5EdZlyZiDoh123Hio+KijxCpW34uOAyPCfjZfQ0u 9pjGTqZY6moVTI7+gIY4kFsowxC9A2r+Ci4Zg5dEZR47y6hWdaH/h0IsQoIDMf7oOnoa aO0D8mqduL2r1TjGZIZP+LZhkOOKZDyjkMiXhzSqGokB/OweFtYGJ1mYevHi/tJrvCmm RR/w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1698279779; x=1698884579; 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=XwblM3qYHhgk/BSbqYTN8K2nRmzxfzwTe7jRYcOw49o=; b=YZU6dhl5uWiHQTKCtz4FAkhqRledptgzfMfPH2SlR/8kIJmnj7EAv3FHWo+bOWGbRF yiBIP+T4lIEjrkvhdsYX9ANTyiFvEEn5Vble1SQBECT7ngKeLWK75LPl5MyrDgWcfef5 OjeB6+jGlbmZcrXe7Vi6ReXkg+eh2bCuwFKDsaEFP1PJdn7VV9SsG8/0LdNUX6Hu8Kyu VikFJgMHI7eGcAuEeLyptuZRQ+wS/lCZggJwvcxxEQO674iI/95WTkjiu+dlLhg/1oSq AOUkKizNQxctMBJnQiW+CqnrJXncQkuZw54ltYsOKo/mIC1WgpgRYRotsUtzVQf5qLWO PJ/w== X-Gm-Message-State: AOJu0YyhbLBwZwVjxQVV8twVPDIDLEd9uM7pnyd5o6uods35OxDsWWnQ YY9VYRHNr32araonRhDfwvDj6pkZGEFUce/1ePk= X-Received: by 2002:a17:90a:56:b0:27d:1ec3:4367 with SMTP id 22-20020a17090a005600b0027d1ec34367mr14292477pjb.0.1698279779037; Wed, 25 Oct 2023 17:22:59 -0700 (PDT) Received: from stoup.. ([71.212.149.95]) by smtp.gmail.com with ESMTPSA id 9-20020a17090a0cc900b0027463889e72sm499870pjt.55.2023.10.25.17.22.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 25 Oct 2023 17:22:58 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: Mark Cave-Ayland Subject: [PULL 62/94] target/sparc: Merge LDFSR, LDXFSR implementations Date: Wed, 25 Oct 2023 17:15:10 -0700 Message-Id: <20231026001542.1141412-92-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231026001542.1141412-1-richard.henderson@linaro.org> References: <20231026001542.1141412-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::102c; envelope-from=richard.henderson@linaro.org; helo=mail-pj1-x102c.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. Tested-by: Mark Cave-Ayland Acked-by: Mark Cave-Ayland 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 4c0e7cde4a..bf8c5a16b6 100644 --- a/target/sparc/translate.c +++ b/target/sparc/translate.c @@ -45,7 +45,6 @@ # define gen_helper_clear_softint(E, S) qemu_build_not_reached() # define gen_helper_done(E) qemu_build_not_reached() # define gen_helper_flushw(E) qemu_build_not_reached() -# define gen_helper_ldxfsr(D, E, A, B) 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_restored(E) qemu_build_not_reached() @@ -63,6 +62,8 @@ # define gen_helper_write_softint(E, S) qemu_build_not_reached() # define gen_helper_wrpil(E, S) qemu_build_not_reached() # define gen_helper_wrpstate(E, S) qemu_build_not_reached() +# define FSR_LDXFSR_MASK 0 +# define FSR_LDXFSR_OLDMASK 0 # define MAXTL_MASK 0 #endif @@ -4675,44 +4676,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 Thu Oct 26 00:15: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: 738295 Delivered-To: patch@linaro.org Received: by 2002:adf:f842:0:b0:32d:baff:b0ca with SMTP id d2csp559993wrq; Wed, 25 Oct 2023 17:41:14 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGDzEyS9CC/wnT8N6Rhq+udbPkm9ryFOFQI6QKzB/O1fqm1BZr7Twba5BNj+41XqzPt5x2n X-Received: by 2002:ad4:5aa3:0:b0:66d:1e99:6111 with SMTP id u3-20020ad45aa3000000b0066d1e996111mr1818071qvg.32.1698280874401; Wed, 25 Oct 2023 17:41:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698280874; cv=none; d=google.com; s=arc-20160816; b=hd4IWdoX+K2UkXsfsJeR4bofhndjEtFQCFBAD1S9kIZ+g0nGx8XcEyvh0smHb+OsL3 txQISQhRbypGzQVWM1hsgDCu/W+Q2r8iC+reCEteRHno4nseiJJOVanwERfCc/slYzgv AU/+L3onGb90wZyF/UZNcZ5SN+LeLduerPF9DcynM9zT/58g4bYRvLYQSGq7ZGPxJ5wd KtI8DJblpaSMVux6swz9jEMUqnfPF2SsmOWk8WIdf/xEeJLkae1xyJa9sZeEjlBNjv2x rzPD0tyI5CpC2w9TCS6gXB3tZKKOULKhPd7HJm5DjZ0ANporfVUEU1mrOF0iCrXFIk47 6Xlw== 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=ScyMfTagP4goaCM2jC0NkO7nez7jj0doZYKgRXEaW1k=; fh=rYI8DiHAAFX3O5g969KmOAQ7d45Sb8OxQX1+DywGDk4=; b=Ut5G3gsW45EZh959ukrvY1MGfUYE+2dOe56Xftkw4zhwL/bU/dpyd1Laj9UwT8flxt 0oXX5e56YYAUa9sDGqNraXCtp6gzJHEeDwufADmkcUXYKEN0JRFUmkUIOZT2CZnX/cwa Doi4eO3y+clx+4F3Zx+zIvHpX4urBkEFQ6HvU2cRWztgc3uvAfi5Jb7yQnvIBmh0uakx kMmkzNOSGKFSj1nHsOcKJUDEq0VxGI0/lIiBRWVHcml6jpRprvKtGxNYmV5reI5vXdmx dlAcMNyZ3VWWSv2jGQae+/lebxmV2Zgz+9tpQ+c6kf6151wsShHyv1ieurTQpnOfT9CY njYg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="i3UY/KPq"; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as 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 mv4-20020a056214338400b0065af4f5d8ddsi9269678qvb.222.2023.10.25.17.41.14 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 25 Oct 2023 17:41: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="i3UY/KPq"; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as 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 1qvo9x-0003lc-TZ; Wed, 25 Oct 2023 20:23: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 1qvo9R-0001AK-NK for qemu-devel@nongnu.org; Wed, 25 Oct 2023 20:23:06 -0400 Received: from mail-pg1-x52f.google.com ([2607:f8b0:4864:20::52f]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qvo9N-0008CV-D8 for qemu-devel@nongnu.org; Wed, 25 Oct 2023 20:23:05 -0400 Received: by mail-pg1-x52f.google.com with SMTP id 41be03b00d2f7-5b837dc2855so227968a12.0 for ; Wed, 25 Oct 2023 17:23:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1698279780; x=1698884580; 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=ScyMfTagP4goaCM2jC0NkO7nez7jj0doZYKgRXEaW1k=; b=i3UY/KPqHK87pTH1mqUBj5dpzfpPU9L+NAVhPs67dovcZw+Ngjvgu4v+cl/YiuSZWq RvlUZW5SE9xT6R6Lsddm1jVNX5xmKCdCK+mi3XvKh8hAaqbXOjprV8IPQJ51vLsr3BfK ZntsBhs8vmMB0NrB0w+/5CSuXexnJhCnCKyA6tK/TF780DIRjXnq75RfMOOlyD60SXpz uYF4cpSRa98XKyTR/GPdr/eaB6a0YOZxf33gMXEw+XWoTP678bP5fPq0O2fjXcLgblrm rWaBIrY4/Y2Y33a1Ipnj4Id8siH2wIW/0i5TxAGFmN+15Rng0nmwHgosvqy7ewEurX94 8s9w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1698279780; x=1698884580; 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=ScyMfTagP4goaCM2jC0NkO7nez7jj0doZYKgRXEaW1k=; b=EdBasNs17yAH3OdAVWp+yHBCqFU6Am3Ex5BTDNZhlUJOgJgVrQTTrMVl5Wceif/a6D qH3ogh5uLoNK7Jik3olgT19yigHRbctV9Pg6dS6LBA3wSE8o0biA7MMWaGHPkrHGYD0M rSaDa5vus1c/OE3VVKUh+p/Lq7inQWihFk1E+IDqSTbmVYhG9pz0DYlxhFszUlY7iMar F5yG5DN2AO172PbXiAhVKPT65z07l9TwBYzdRTNc0XW/h65l0pV86a5PQetwhUNE56We RufzTVdvzIsiPkCo8nT9817u7K/8ihRZt3rDwifja2JXbcDC4HMACxt48o/e4MoK251D qchA== X-Gm-Message-State: AOJu0YwsNOt2HH6zSY71vF6BhM6o7e9yEwUw/qpNLCsPuaH8xX08nHL0 AK6ov/ju+gkHqCnNEEM3g/9PHfqMatwKFhGjmxg= X-Received: by 2002:a17:90b:1e47:b0:274:dd15:87bf with SMTP id pi7-20020a17090b1e4700b00274dd1587bfmr1361312pjb.20.1698279779880; Wed, 25 Oct 2023 17:22:59 -0700 (PDT) Received: from stoup.. ([71.212.149.95]) by smtp.gmail.com with ESMTPSA id 9-20020a17090a0cc900b0027463889e72sm499870pjt.55.2023.10.25.17.22.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 25 Oct 2023 17:22:59 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: Mark Cave-Ayland Subject: [PULL 63/94] target/sparc: Move EDGE* to decodetree Date: Wed, 25 Oct 2023 17:15:11 -0700 Message-Id: <20231026001542.1141412-93-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231026001542.1141412-1-richard.henderson@linaro.org> References: <20231026001542.1141412-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::52f; envelope-from=richard.henderson@linaro.org; helo=mail-pg1-x52f.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org Tested-by: Mark Cave-Ayland Acked-by: Mark Cave-Ayland Signed-off-by: Richard Henderson --- target/sparc/insns.decode | 22 +++- target/sparc/translate.c | 271 ++++++++++++++++---------------------- 2 files changed, 133 insertions(+), 160 deletions(-) diff --git a/target/sparc/insns.decode b/target/sparc/insns.decode index 5df3b1add4..a9630509bd 100644 --- a/target/sparc/insns.decode +++ b/target/sparc/insns.decode @@ -35,6 +35,9 @@ CALL 01 i:s30 @r_r_ri_cc0 .. rd:5 ...... rs1:5 imm:1 rs2_or_imm:s13 &r_r_ri_cc cc=0 @r_r_ri_cc1 .. rd:5 ...... rs1:5 imm:1 rs2_or_imm:s13 &r_r_ri_cc cc=1 +&r_r_r rd rs1 rs2 +@r_r_r .. rd:5 ...... rs1:5 . ........ rs2:5 &r_r_r + { [ STBAR 10 00000 101000 01111 0 0000000000000 @@ -231,7 +234,24 @@ RESTORE 10 ..... 111101 ..... . ............. @r_r_ri DONE 10 00000 111110 00000 0 0000000000000 RETRY 10 00001 111110 00000 0 0000000000000 -NCP 10 ----- 110110 ----- --------- ----- # v8 CPop1 +{ + [ + EDGE8cc 10 ..... 110110 ..... 0 0000 0000 ..... @r_r_r + EDGE8N 10 ..... 110110 ..... 0 0000 0001 ..... @r_r_r + EDGE8Lcc 10 ..... 110110 ..... 0 0000 0010 ..... @r_r_r + EDGE8LN 10 ..... 110110 ..... 0 0000 0011 ..... @r_r_r + EDGE16cc 10 ..... 110110 ..... 0 0000 0100 ..... @r_r_r + EDGE16N 10 ..... 110110 ..... 0 0000 0101 ..... @r_r_r + EDGE16Lcc 10 ..... 110110 ..... 0 0000 0110 ..... @r_r_r + EDGE16LN 10 ..... 110110 ..... 0 0000 0111 ..... @r_r_r + EDGE32cc 10 ..... 110110 ..... 0 0000 1000 ..... @r_r_r + EDGE32N 10 ..... 110110 ..... 0 0000 1001 ..... @r_r_r + EDGE32Lcc 10 ..... 110110 ..... 0 0000 1010 ..... @r_r_r + EDGE32LN 10 ..... 110110 ..... 0 0000 1011 ..... @r_r_r + ] + NCP 10 ----- 110110 ----- --------- ----- # v8 CPop1 +} + NCP 10 ----- 110111 ----- --------- ----- # v8 CPop2 ## diff --git a/target/sparc/translate.c b/target/sparc/translate.c index bf8c5a16b6..2f38453dc6 100644 --- a/target/sparc/translate.c +++ b/target/sparc/translate.c @@ -2728,93 +2728,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(); @@ -2877,6 +2790,8 @@ static int extract_qfpreg(DisasContext *dc, int x) # define avail_64(C) true # define avail_GL(C) ((C)->def->features & CPU_FEATURE_GL) # define avail_HYPV(C) ((C)->def->features & CPU_FEATURE_HYPV) +# define avail_VIS1(C) ((C)->def->features & CPU_FEATURE_VIS1) +# define avail_VIS2(C) ((C)->def->features & CPU_FEATURE_VIS2) #else # define avail_32(C) true # define avail_ASR17(C) ((C)->def->features & CPU_FEATURE_ASR17) @@ -2887,6 +2802,8 @@ static int extract_qfpreg(DisasContext *dc, int x) # define avail_64(C) false # define avail_GL(C) false # define avail_HYPV(C) false +# define avail_VIS1(C) false +# define avail_VIS2(C) false #endif /* Default case for non jump instructions. */ @@ -4187,6 +4104,113 @@ static bool trans_MULScc(DisasContext *dc, arg_r_r_ri_cc *a) return do_arith(dc, a, CC_OP_ADD, NULL, NULL, gen_op_mulscc); } +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; @@ -5075,89 +5099,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 Thu Oct 26 00:15: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: 738267 Delivered-To: patch@linaro.org Received: by 2002:adf:f842:0:b0:32d:baff:b0ca with SMTP id d2csp558728wrq; Wed, 25 Oct 2023 17:37:08 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGus+Lmo0ZbNtmg5kCjUK2dwukNKQh3JHVsGkDldBDCCGRInCB2Rha61O/UbH/Cm7p9SfTy X-Received: by 2002:a05:651c:170b:b0:2c5:2eaa:5398 with SMTP id be11-20020a05651c170b00b002c52eaa5398mr11413445ljb.25.1698280627775; Wed, 25 Oct 2023 17:37:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698280627; cv=none; d=google.com; s=arc-20160816; b=RHh4om/vZQdF5XMcQ9qEpHh/VlWkN1W1eHXM0sr6BUIjlvTiJYH7Xu524nZE2aQeG1 UAuPwbgKVw9wgx7JxVv6PHCcJAIkUzOtC1yrft3B4+U2CLbbQJxYKKKvs98O/iqBTa3t jh4GC6IBj5JfxbqOobBeTzqRaLU9f357Aptm0tSNpimone0+n5zfy1BEXaSeZ9YX9nJv 9d1i1gRHeEJXMGdg7ILGzlYb46EaDMkbo4ve+dtDUQFMbTXZlygcEI/kgcaDrDKb90Dt CskC9UU7DnTXbojKV9x5w7GHrZzyAWRfaGUfgJw5eLgJeLZtRylJQ+6K1oqRwAy9qslE pTdA== 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=h9qerMvCajXmsDh07rrL/xuRlXNT8gncm0ZxsFLAfDY=; fh=rYI8DiHAAFX3O5g969KmOAQ7d45Sb8OxQX1+DywGDk4=; b=0Xghj0aS41T/JU5r0SOb3RtIK7vwZqTkaWVMo3MMJ8Q8HnOE/lDVJE42XnMH6Cek5i N17eJWjilUe/6DHfTSOZowxYUDS1GE2QFpg+20W/aHlPxO5g72/g/ZioYveJPYcmoyNM +7qhYfLdfWEck+a/3p7EosBOvNBfc7DRsHJGdCe/yXAydGecNTDr8mcfujjm+ArCKncR rB4IS1P6AEonV7j87v0XS8S0FEtnpUrMmTW0j0vtARCIcdYPTmyHAgEgxOCR+f6WPAwV rvC6ZWeptf8D/L/iL6kFbJxhs+7qJJOfX05krXbYyvppc9dFpkeM3avD7G9ajCiNvMV1 QQnQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=d8xzdpiR; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as 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 d21-20020a05600c34d500b004053fe477d0si816663wmq.76.2023.10.25.17.37.07 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 25 Oct 2023 17:37: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=d8xzdpiR; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as 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 1qvoAf-00071n-Sw; Wed, 25 Oct 2023 20:24:21 -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 1qvo9d-0002tr-2c for qemu-devel@nongnu.org; Wed, 25 Oct 2023 20:23:20 -0400 Received: from mail-pj1-x1030.google.com ([2607:f8b0:4864:20::1030]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qvo9P-0008Cf-0Z for qemu-devel@nongnu.org; Wed, 25 Oct 2023 20:23:16 -0400 Received: by mail-pj1-x1030.google.com with SMTP id 98e67ed59e1d1-27d1fa1c787so216584a91.3 for ; Wed, 25 Oct 2023 17:23:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1698279780; x=1698884580; 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=h9qerMvCajXmsDh07rrL/xuRlXNT8gncm0ZxsFLAfDY=; b=d8xzdpiRvz/+7OlP5pvlJBZKuVrTzuu+3FuTKboHeWwABoMszCe2veHKX9gibqJ1z5 BHNgbp7AVue2UanSihW5/M6vBXn/vZY6gcr6cQVDY89w0b2gGEpnZI/QmH2cXeYJofHe bQIfrcxVN2PnUkAUebsoan2NycGc2HTQ7zrlVtFdkteXBvp9FM+vHkcn8F3iTrmdEsS8 dFsWf4pY1s5yeuzo1i+OK4XKcMDgYVr4+M7FA+YEdu3qZSoF9NOPSHhF2YwjqahnFoqY o3pmRCE8X7C/cMxByBt8py82XO764Qj+pj9nGLPGocZOHkAIXTzOzHtk53+Z77KOQwJY 7mjQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1698279780; x=1698884580; 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=h9qerMvCajXmsDh07rrL/xuRlXNT8gncm0ZxsFLAfDY=; b=cBDIcSi/lboMeCK3g2VmHdO6C3sbxsFc+7Wqdb3OjLVReyXMfcHSAF0CwJ5PR2L0Yu XZgye4z71i0Gn0l01Z/yNlxJtYARN3ORz1aBvWU+fK/8xoE25ynd6xzVDxCToNpcM7h1 hqHGO0W1Fy81CcxOF832y6AcobMVGGsLdR0RkpiDGFoli+fFkTv9P4rcGXruicTZk5ho 69MGv4xYC2s4tvnYmqTEQiC7a7WDZZFvm/znBmDQV3s56SvVyC1Lt5bM9KI8JyXNFreg ivi8h9svnS8lfiXhplIZ7x1+2mU6S9qSb5aAxmSfrLyCmQzAanA0FosXa2L3QTlVZQfa d6Ig== X-Gm-Message-State: AOJu0YxGsjGhswLRNH6GrEZ8v2IEZNa638ewmswBWrbpmzvJ9bcoXyDZ uAyrM2JG/aNGN6ZrzN/ipeCWGgO/CZ+7h5S3yEo= X-Received: by 2002:a17:90a:186:b0:27f:f260:ceaf with SMTP id 6-20020a17090a018600b0027ff260ceafmr785180pjc.10.1698279780581; Wed, 25 Oct 2023 17:23:00 -0700 (PDT) Received: from stoup.. ([71.212.149.95]) by smtp.gmail.com with ESMTPSA id 9-20020a17090a0cc900b0027463889e72sm499870pjt.55.2023.10.25.17.23.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 25 Oct 2023 17:23:00 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: Mark Cave-Ayland Subject: [PULL 64/94] target/sparc: Move ARRAY* to decodetree Date: Wed, 25 Oct 2023 17:15:12 -0700 Message-Id: <20231026001542.1141412-94-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231026001542.1141412-1-richard.henderson@linaro.org> References: <20231026001542.1141412-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::1030; envelope-from=richard.henderson@linaro.org; helo=mail-pj1-x1030.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org Tested-by: Mark Cave-Ayland Acked-by: Mark Cave-Ayland Signed-off-by: Richard Henderson --- target/sparc/insns.decode | 4 +++ target/sparc/translate.c | 57 ++++++++++++++++++++++++--------------- 2 files changed, 40 insertions(+), 21 deletions(-) diff --git a/target/sparc/insns.decode b/target/sparc/insns.decode index a9630509bd..b15ede5fd4 100644 --- a/target/sparc/insns.decode +++ b/target/sparc/insns.decode @@ -248,6 +248,10 @@ RETRY 10 00001 111110 00000 0 0000000000000 EDGE32N 10 ..... 110110 ..... 0 0000 1001 ..... @r_r_r EDGE32Lcc 10 ..... 110110 ..... 0 0000 1010 ..... @r_r_r EDGE32LN 10 ..... 110110 ..... 0 0000 1011 ..... @r_r_r + + ARRAY8 10 ..... 110110 ..... 0 0001 0000 ..... @r_r_r + ARRAY16 10 ..... 110110 ..... 0 0001 0010 ..... @r_r_r + ARRAY32 10 ..... 110110 ..... 0 0001 0100 ..... @r_r_r ] NCP 10 ----- 110110 ----- --------- ----- # v8 CPop1 } diff --git a/target/sparc/translate.c b/target/sparc/translate.c index 2f38453dc6..d40d664f16 100644 --- a/target/sparc/translate.c +++ b/target/sparc/translate.c @@ -722,6 +722,25 @@ static void gen_op_popc(TCGv dst, TCGv src1, TCGv src2) tcg_gen_ctpop_tl(dst, src2); } +#ifndef TARGET_SPARC64 +static void gen_helper_array8(TCGv dst, TCGv src1, TCGv src2) +{ + g_assert_not_reached(); +} +#endif + +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) { @@ -4211,6 +4230,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; @@ -5110,30 +5145,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 Thu Oct 26 00:15: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: 738252 Delivered-To: patch@linaro.org Received: by 2002:adf:f842:0:b0:32d:baff:b0ca with SMTP id d2csp557281wrq; Wed, 25 Oct 2023 17:32:40 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFWm8KSNoLS04e2ZV/qJDwUx8gd5YtFXe19ioDMoj7tumVS9pCZC0G6Oi5LP+ba++XXPh+b X-Received: by 2002:a05:6000:1081:b0:32d:87df:6ded with SMTP id y1-20020a056000108100b0032d87df6dedmr13291639wrw.27.1698280360695; Wed, 25 Oct 2023 17:32:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698280360; cv=none; d=google.com; s=arc-20160816; b=0MJvBjfvgoIMR4181WnSHAWQFJHqGsxrIbXmD6YsmSRIHmBi5ZEvDK8m4vwhHchpZ8 Msky2PWz/lc/9rTORB8qQqHrzRyvQvune15g+1eL8p+2QMcQYHRApxYymDmiGOr9Ezjc yi2wv5fweg2ObSGTO6OG0ny85RDOTCpitmVQjWNLu+zNU3cXAUH0TWWcG6BXQ2pS5fty mP93eK+QkLZV1PGbzH08PF3uIToTeP3fWAfmT0JiQtyazOW3HAQQ4FTxfzJMZL4Mi8Uk BAT/RvoIADj7uV/VQ9PvP0uAkFKPLn8hN1D87S4V3uEgL6ySI62lhZogXqQlkRZw0tjq PZAg== 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=3Ht05l455lxmDw3bU8/EY1KEqMWEE3s1dKBaVsXGD9Q=; fh=rYI8DiHAAFX3O5g969KmOAQ7d45Sb8OxQX1+DywGDk4=; b=STBceJKSRYlseLmG6jFwEcVBk0xXhQt3C+kkAaqgkQrNOn4F8w0EJpNvTMI1MV82yN NHW4f71TIpmdh2txL3MddDtvPxgZvuXGmLiKxqlvKapRZzQxG1z2l/wKvZlvwohfcnxD q1BfrgXB4TFMfY2wZaG+YWKUBKXwI9wEIab7H2oYGsggPKeGIDAylr1LM8ClNEmWHnGj kngMhrEiMX/JEtaKqf/s/AtYbPNxAw20s5IFRT24GuAItSv+Y4IWKOyVLmrUuE4pmCn+ Go2z/RjPneiFV52iVoeUJNdlbW/l4524YrID7bpOsUVzQQf36ZdwBGQ3MtMDeoLQ+3Kt C12w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=DIGoIWTh; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as 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-20020a056000000f00b00319754295c8si8005340wrx.636.2023.10.25.17.32.40 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 25 Oct 2023 17:32:40 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=DIGoIWTh; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as 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 1qvo9y-0003oE-Ut; Wed, 25 Oct 2023 20:23: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 1qvo9T-0001QT-0R for qemu-devel@nongnu.org; Wed, 25 Oct 2023 20:23:07 -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 1qvo9P-0008Cn-RO for qemu-devel@nongnu.org; Wed, 25 Oct 2023 20:23:06 -0400 Received: by mail-pg1-x52c.google.com with SMTP id 41be03b00d2f7-5aa481d53e5so299672a12.1 for ; Wed, 25 Oct 2023 17:23:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1698279781; x=1698884581; 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=3Ht05l455lxmDw3bU8/EY1KEqMWEE3s1dKBaVsXGD9Q=; b=DIGoIWThDKKanJ7ADqq9P2YuOqg2/KcKDyrxTwEJN9VcDLoOLRSiRZBpZtBtO4+vKn s5D5G9ljhROgPfIrs6ry9qrsZOFzM/1XOd7vZMJK1yPouxNtWXxxG8//wQp3Fijtgu3V pad6hFe6CGH21ycbhehZIO8Mk0jmStzXfZ70+xTsWb1VV1YHflox3n3XFzZ7ElsAMr83 OefLWrk3fBi2z95JRWM7oaLJOE935/KYzuPc4bZTX/kKQA3KNUcDy1qTWV1LeBOjWEj1 8FV2NdPrxMzugk3xyaJepy+hVa2uqbb6xhdiamNHJAJ1ql0pBd1R5Zog/Q81gcXFcxBj ny1w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1698279781; x=1698884581; 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=3Ht05l455lxmDw3bU8/EY1KEqMWEE3s1dKBaVsXGD9Q=; b=Bs++xbZ0aSivXoJrfuxu6/rb8F4Dmjf/sIfKrde+LxKy/AcW0iUz0PZfRNU9lYkJy+ z6/Z2EY3n/n7JxZEkbcoLvCbf6qsM/YDvgoQUEH1wvbuT+LdTrz90FhsDwiYjlSbEIG5 85tI7Pe1KwVXXkeAvB3HAdKB0/oKYOVv57X2fscifKDDl1vIAS82G5bQ1qQLNJmdWdAV McX+OiN1ssByt9uwykgObn2B5UGLWAV8MuL0Uvvzinv5jzfquS4UZTIShEsOMUg0Dh0p oBv3BlPhkVdmqw4pLX/cwm33w0w+pm22S7QgAt5UxSLsHnZ4JEzCYDqnslyoafmGtTQE XzbA== X-Gm-Message-State: AOJu0YzIrhx+gZ6ytCBYu1HqIxiXxj33HMvcR0LUkPjLRtzSPL9/8RVE 2uPuWOfNFHUNd382JCuz7pI33xKZJ1n0kATmfOw= X-Received: by 2002:a17:90a:19cb:b0:27d:4b71:ed17 with SMTP id 11-20020a17090a19cb00b0027d4b71ed17mr14220184pjj.29.1698279781295; Wed, 25 Oct 2023 17:23:01 -0700 (PDT) Received: from stoup.. ([71.212.149.95]) by smtp.gmail.com with ESMTPSA id 9-20020a17090a0cc900b0027463889e72sm499870pjt.55.2023.10.25.17.23.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 25 Oct 2023 17:23:00 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: Mark Cave-Ayland Subject: [PULL 65/94] target/sparc: Move ADDRALIGN* to decodetree Date: Wed, 25 Oct 2023 17:15:13 -0700 Message-Id: <20231026001542.1141412-95-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231026001542.1141412-1-richard.henderson@linaro.org> References: <20231026001542.1141412-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::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 Tested-by: Mark Cave-Ayland Acked-by: Mark Cave-Ayland Signed-off-by: Richard Henderson --- target/sparc/insns.decode | 3 +++ target/sparc/translate.c | 56 ++++++++++++++++++++++----------------- 2 files changed, 34 insertions(+), 25 deletions(-) diff --git a/target/sparc/insns.decode b/target/sparc/insns.decode index b15ede5fd4..f70423895e 100644 --- a/target/sparc/insns.decode +++ b/target/sparc/insns.decode @@ -252,6 +252,9 @@ RETRY 10 00001 111110 00000 0 0000000000000 ARRAY8 10 ..... 110110 ..... 0 0001 0000 ..... @r_r_r ARRAY16 10 ..... 110110 ..... 0 0001 0010 ..... @r_r_r ARRAY32 10 ..... 110110 ..... 0 0001 0100 ..... @r_r_r + + ALIGNADDR 10 ..... 110110 ..... 0 0001 1000 ..... @r_r_r + ALIGNADDRL 10 ..... 110110 ..... 0 0001 1010 ..... @r_r_r ] NCP 10 ----- 110110 ----- --------- ----- # v8 CPop1 } diff --git a/target/sparc/translate.c b/target/sparc/translate.c index d40d664f16..5d2be34135 100644 --- a/target/sparc/translate.c +++ b/target/sparc/translate.c @@ -2747,18 +2747,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; @@ -4246,6 +4234,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; @@ -5148,21 +5166,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 Thu Oct 26 00:15: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: 738291 Delivered-To: patch@linaro.org Received: by 2002:adf:f842:0:b0:32d:baff:b0ca with SMTP id d2csp559617wrq; Wed, 25 Oct 2023 17:39:54 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHNow7YYz4+PoiZgH2cvB5/7r/HznJtVYsqqTbSKF5BWqgKvIpB1I2+V9RJBCYbX5MBuAI0 X-Received: by 2002:a05:651c:1541:b0:2c5:2fa8:716a with SMTP id y1-20020a05651c154100b002c52fa8716amr17571239ljp.9.1698280794304; Wed, 25 Oct 2023 17:39:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698280794; cv=none; d=google.com; s=arc-20160816; b=Gw5w+JHQrpfpooyevnyOq++4Di82GBo+Ct7N98CVjoGUVzle40t4IQLKQhDknH6dM7 XxLu7/rCbtVOacYA0oXwYgJJg82IXCoRNYv5k+zQ9y4O0hIYWrIzYTjUZa/mIUVIkEKr ZblhXMfolkK9kf3LzL2F4/KgM8+LIH/Y1QMpfkIonMK8OikBrTnIHXVoe/xy4yTwh98S b+PhpastjmIMd5YudDurYFEFCyxczwqGp8BcjaEz7Di+UVr+uurQD9bQYX9zxos9F2St L5YoXh3TKpe49b6h+6R2BUzKSbl16UJYaS2hnESFwzxNF0SO2o9HhnW/HuHMquIioDyJ vdXQ== 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=zT14RAopyAvl8kuzSxXdtDC5GmRV87HsUcPsxZmEC3k=; fh=rYI8DiHAAFX3O5g969KmOAQ7d45Sb8OxQX1+DywGDk4=; b=tP6TpIQknPJufDZn4ycFBiLHM2OcYcV0q/bjY+vWueJTAniRutA65/CCkZ2gici32d a1CaqPFd5SKutCWgZb5tZC3EO47RVQLvBguX0AouAxKy5QelCBEOFOtq/SEoqhIfobax VKJ2eFBQ4FLNC1oB/loPXBZGYb7MG8LUFbo+EamYdjuH+tqCjj0ObjCFsmI+QV9aUJdd 9vvLkDwnW8xELIrYj2JBS6oOdcPoyhho7CnV1xuA2fxUoHCJqOo1CunmorR1PZLS6rnm pWXZAj9zuoJ2nUAa9wPns7NChbvAkbApYBeGJEAieGlbgQtaONupCYCbFUrWntj5EjNP 5oZg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=vog200oO; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as 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 o37-20020a05600c512500b004051676cebasi824975wms.39.2023.10.25.17.39.54 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 25 Oct 2023 17:39: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=vog200oO; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as 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 1qvoA0-0004BZ-TP; Wed, 25 Oct 2023 20:23: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 1qvo9U-0001dg-Nr for qemu-devel@nongnu.org; Wed, 25 Oct 2023 20:23:08 -0400 Received: from mail-pj1-x1030.google.com ([2607:f8b0:4864:20::1030]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qvo9Q-0008Cr-Im for qemu-devel@nongnu.org; Wed, 25 Oct 2023 20:23:08 -0400 Received: by mail-pj1-x1030.google.com with SMTP id 98e67ed59e1d1-27d0251d305so222028a91.2 for ; Wed, 25 Oct 2023 17:23:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1698279782; x=1698884582; 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=zT14RAopyAvl8kuzSxXdtDC5GmRV87HsUcPsxZmEC3k=; b=vog200oOhjhocjie4tU2iE3vgfMcV/+86er6GmFE8FJaoatqBO6z3xdLifWmVJUQip lGu2O4E+7yBBcJaQ9biXIK5hw00CjbjhqHycJ43hX0gZwlyL0P0NdVul08IBgfc2gTeB TXVfEACbYV4vQfQTuZ4fhSG1GKwCDd6pfhYWRasPa3IPkni0udk+S3YHQElK8ZtQGth6 ao0nrHrLJiEUZbG1A9kTuu4S5wl9ZJ/9+XKjld07KWsC6EG3WcP+RNfF05TRSsPHKbhY R2z/SjINg18Yf56LX1jwQlftMFFnDtIerMi29j7Jumh3dzJqZgzjCBVz6k5BUgntJC3E fA/w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1698279782; x=1698884582; 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=zT14RAopyAvl8kuzSxXdtDC5GmRV87HsUcPsxZmEC3k=; b=R3COay3o8HZrRURtkea6JZuJdSONzOtZeDWIqipDLPsDl/cxskz6wIplOdNwdLrWL0 o6h8h9P6CrVh6bUnuPV70bsozbIDyOatfldxltIUswsA6u4MvqhEeYWlP+is2QuhDF/A 6HCmv4eGAja5CWdmfnP9kesTJ9KNSQHYq6end+JB5xLzBAgqpp3RQLGsqBLthSLsSQBx KoKvgpmfvf/fLdH1XD4iJqpOCpH85YF2i4LvdK8atCmx3uxAWArjXj54r+qjY+Hw7wSz 00tILJQEU177vUkTPmf9OIZjgdyOrpGzp2RnZ7TlMHQq642EOBFlHuMLruWEHCqyyIxR z3iw== X-Gm-Message-State: AOJu0YwJPZpQHGdEywY1BC0zqSrYuayUlCJr+NPWKfIFrY6ygWbwPlvU 2x5cxa8LDkD4t5LK75HVteOrWL8NuwZVrSKlU+o= X-Received: by 2002:a17:90b:2b85:b0:27d:1339:9176 with SMTP id rs5-20020a17090b2b8500b0027d13399176mr14652551pjb.25.1698279782019; Wed, 25 Oct 2023 17:23:02 -0700 (PDT) Received: from stoup.. ([71.212.149.95]) by smtp.gmail.com with ESMTPSA id 9-20020a17090a0cc900b0027463889e72sm499870pjt.55.2023.10.25.17.23.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 25 Oct 2023 17:23:01 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: Mark Cave-Ayland Subject: [PULL 66/94] target/sparc: Move BMASK to decodetree Date: Wed, 25 Oct 2023 17:15:14 -0700 Message-Id: <20231026001542.1141412-96-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231026001542.1141412-1-richard.henderson@linaro.org> References: <20231026001542.1141412-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::1030; envelope-from=richard.henderson@linaro.org; helo=mail-pj1-x1030.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org Tested-by: Mark Cave-Ayland Acked-by: Mark Cave-Ayland Signed-off-by: Richard Henderson --- target/sparc/insns.decode | 2 ++ target/sparc/translate.c | 22 +++++++++++++--------- 2 files changed, 15 insertions(+), 9 deletions(-) diff --git a/target/sparc/insns.decode b/target/sparc/insns.decode index f70423895e..db372573a2 100644 --- a/target/sparc/insns.decode +++ b/target/sparc/insns.decode @@ -255,6 +255,8 @@ RETRY 10 00001 111110 00000 0 0000000000000 ALIGNADDR 10 ..... 110110 ..... 0 0001 1000 ..... @r_r_r ALIGNADDRL 10 ..... 110110 ..... 0 0001 1010 ..... @r_r_r + + BMASK 10 ..... 110110 ..... 0 0001 1001 ..... @r_r_r ] NCP 10 ----- 110110 ----- --------- ----- # v8 CPop1 } diff --git a/target/sparc/translate.c b/target/sparc/translate.c index 5d2be34135..ee0c263a99 100644 --- a/target/sparc/translate.c +++ b/target/sparc/translate.c @@ -4264,6 +4264,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; @@ -4803,7 +4815,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)); @@ -5168,15 +5179,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 Thu Oct 26 00:15: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: 738294 Delivered-To: patch@linaro.org Received: by 2002:adf:f842:0:b0:32d:baff:b0ca with SMTP id d2csp559634wrq; Wed, 25 Oct 2023 17:39:58 -0700 (PDT) X-Google-Smtp-Source: AGHT+IH6iiPUwlDsIjphX750+fBgElyrTvEAt9XK5wFYSl8AOLtR6zqlyzHjFM0cE1beF7NEydAT X-Received: by 2002:a2e:9803:0:b0:2c5:d3c:8f4d with SMTP id a3-20020a2e9803000000b002c50d3c8f4dmr11548055ljj.13.1698280798249; Wed, 25 Oct 2023 17:39:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698280798; cv=none; d=google.com; s=arc-20160816; b=j6me+hEV+SISb0aBJzhy3NRUN4KiR2QFg+3tSiJw6oECg/nAO/BdiL8eJ5SDyxpVcw CM8oOd9RAInWOETBngsxS/NkjJvP5NNG6GO5jG//6U+/nbxlmT+IhsEyYdSZ0JE3PRIQ L55UlYUvBKXkfATmYRqbgMTJwq0x5zzoIAU3ylAC1XycVVWNmNAUd/OgJg/EvyQa+MpY bXVauz7PyVT0XL9+iGGbx/TmMDKCWVDa7kYWtBDrDC9YVjbRMO595fKLKqkIEoTfQcd6 tRuvYDIp3y7ZZRFhL/S9ze8g4fX3pbEHKAyPnYvvkG03jbEEB4KekRITJ1NGOowj21LV Iorw== 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=fp7W70YqgH/p4ly82quRZ+c8jMF9Gc+3JIEU1npBxn0=; fh=rYI8DiHAAFX3O5g969KmOAQ7d45Sb8OxQX1+DywGDk4=; b=IkKm4fFyy1tLFQG7pyJrhsjKxoaa1I1JdJb3KclWm7TGpyvfsX+U6AjRksQJzcyDDt rUBllO6mzhKLIC/y8JDkkl3hcqIlFCI9t8VExH8aeLDnR6EP4SawybP1gRWKVmrxDDIu OrwYAT7m1PNvaVsSpuc+AYJoHjYXxmKx2+8/bgvGDAgtHacdTzmyd4ulchVzV77YBrsM KHRxc1B/ZjwFQTCP5211L5xXE9xi2Wdb6RYOoFSJPVUI9gpwrc+SqKFcUSdK84rHk6pl 0DyyVFrikgt/p0E5yzhglw8q2FY6S2d4CvGqcfLuM3E8g9lWqn7GEy7C89shEA5knEAN 3u0g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=ANxyKcpi; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as 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 l23-20020a05600c1d1700b00401b313f1b0si832122wms.42.2023.10.25.17.39.58 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 25 Oct 2023 17:39: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=ANxyKcpi; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as 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 1qvoA1-0004NL-HN; Wed, 25 Oct 2023 20:23: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 1qvo9U-0001dh-OB for qemu-devel@nongnu.org; Wed, 25 Oct 2023 20:23:09 -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 1qvo9Q-0008D7-Ag for qemu-devel@nongnu.org; Wed, 25 Oct 2023 20:23:08 -0400 Received: by mail-pf1-x436.google.com with SMTP id d2e1a72fcca58-6b26a3163acso280491b3a.2 for ; Wed, 25 Oct 2023 17:23:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1698279783; x=1698884583; 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=fp7W70YqgH/p4ly82quRZ+c8jMF9Gc+3JIEU1npBxn0=; b=ANxyKcpivlrzmxWi6/i2u2NKvhRvrVfEnMARgxv0Gq1EGACwMZpj8VkXUtGWKFi3FJ zGtdQaDn8+MKkzgwHWndwhpb1Wh9fkjgym6nEXZ4BPkhaqCn5gAsYmRqOu4gVSPMh2kN ZSRumbA/jAsyQbIiczFY9h1EEPNsbY1kAoJi7sF1jsZPxMjlR5ROpZWQ+0tvKFhD1LAU 8+FldqBVv3sFEUQVVSLzTbTJI1ZMRYXjWvBT/9ZdeVK/GS0Yzquq5K4dopMmRcMxenyX JJGdooTYb51ktpV2sTut5mo0YJGwC+Qg7VBnzXqTukAqdM2skqnfVA96BJAeXLhIKzLD oRuw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1698279783; x=1698884583; 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=fp7W70YqgH/p4ly82quRZ+c8jMF9Gc+3JIEU1npBxn0=; b=VM7hLKdmLdTgL0Ovg1BoE0bn9NtRPyPrLeCjYCueikj7xZu3E+eBbDdXq9cLOs9tlz moyuYMUyjwVEUWXKzkbHqSoFSYh99UEWx2wn5nOu0Qq5MUXCZ7V0bsWgXil2L/v8MFyx /EMKPEgWdZ3Ic1c7qPUZog6w+TT8e2xfHb7FgxjelqEk7wcxbZU92ELdm9Cruhxjp1i8 e8cGXqs7FIlNXlaCzLaODMo1qz+5tBP+N0ukJSmk05DxFmpvE5GUBAivEp44i9bG2YJv kGxn2UnIrpvrPKWp26aOsP8ZFuCbBfgk5pZdSHEPU7iXTsIFSozoTL+HCS0jc/4+Psgq fxhQ== X-Gm-Message-State: AOJu0YzUEx2hRziVABwUBR5hatyCdYjT2RBHWd2X0nGIpkpakWysCWWP hrt3WNUQXKiL/0AXrprRCUDq/oD5K1+snqxITVU= X-Received: by 2002:a05:6a21:1a0:b0:11f:4707:7365 with SMTP id le32-20020a056a2101a000b0011f47077365mr8516258pzb.38.1698279782745; Wed, 25 Oct 2023 17:23:02 -0700 (PDT) Received: from stoup.. ([71.212.149.95]) by smtp.gmail.com with ESMTPSA id 9-20020a17090a0cc900b0027463889e72sm499870pjt.55.2023.10.25.17.23.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 25 Oct 2023 17:23:02 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: Mark Cave-Ayland Subject: [PULL 67/94] target/sparc: Move FMOVS, FNEGS, FABSS, FSRC*S, FNOT*S to decodetree Date: Wed, 25 Oct 2023 17:15:15 -0700 Message-Id: <20231026001542.1141412-97-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231026001542.1141412-1-richard.henderson@linaro.org> References: <20231026001542.1141412-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::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 Tested-by: Mark Cave-Ayland Acked-by: Mark Cave-Ayland Signed-off-by: Richard Henderson --- target/sparc/insns.decode | 13 ++++++ target/sparc/translate.c | 92 +++++++++++++++++++++------------------ 2 files changed, 62 insertions(+), 43 deletions(-) diff --git a/target/sparc/insns.decode b/target/sparc/insns.decode index db372573a2..669a54e297 100644 --- a/target/sparc/insns.decode +++ b/target/sparc/insns.decode @@ -38,6 +38,10 @@ CALL 01 i:s30 &r_r_r rd rs1 rs2 @r_r_r .. rd:5 ...... rs1:5 . ........ rs2:5 &r_r_r +&r_r rd rs +@r_r1 .. rd:5 ...... rs:5 . ........ ..... &r_r +@r_r2 .. rd:5 ...... ..... . ........ rs:5 &r_r + { [ STBAR 10 00000 101000 01111 0 0000000000000 @@ -234,6 +238,10 @@ RESTORE 10 ..... 111101 ..... . ............. @r_r_ri DONE 10 00000 111110 00000 0 0000000000000 RETRY 10 00001 111110 00000 0 0000000000000 +FMOVs 10 ..... 110100 00000 0 0000 0001 ..... @r_r2 +FNEGs 10 ..... 110100 00000 0 0000 0101 ..... @r_r2 +FABSs 10 ..... 110100 00000 0 0000 1001 ..... @r_r2 + { [ EDGE8cc 10 ..... 110110 ..... 0 0000 0000 ..... @r_r_r @@ -257,6 +265,11 @@ RETRY 10 00001 111110 00000 0 0000000000000 ALIGNADDRL 10 ..... 110110 ..... 0 0001 1010 ..... @r_r_r BMASK 10 ..... 110110 ..... 0 0001 1001 ..... @r_r_r + + FSRCs 10 ..... 110110 ..... 0 0111 0101 00000 @r_r1 # FSRC1s + FSRCs 10 ..... 110110 00000 0 0111 1001 ..... @r_r2 # FSRC2s + FNOTs 10 ..... 110110 ..... 0 0110 1011 00000 @r_r1 # FNOT1s + FNOTs 10 ..... 110110 00000 0 0110 0111 ..... @r_r2 # FNOT2s ] NCP 10 ----- 110110 ----- --------- ----- # v8 CPop1 } diff --git a/target/sparc/translate.c b/target/sparc/translate.c index ee0c263a99..eb0aa2020f 100644 --- a/target/sparc/translate.c +++ b/target/sparc/translate.c @@ -1397,6 +1397,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) { @@ -1557,11 +1580,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)) { @@ -1576,19 +1594,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)) { @@ -4803,6 +4808,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; @@ -4844,15 +4870,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; @@ -5180,6 +5200,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); @@ -5367,10 +5391,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); @@ -5383,10 +5403,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); @@ -5424,11 +5440,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); @@ -5442,11 +5453,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 Thu Oct 26 00:15: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: 738269 Delivered-To: patch@linaro.org Received: by 2002:adf:f842:0:b0:32d:baff:b0ca with SMTP id d2csp558896wrq; Wed, 25 Oct 2023 17:37:39 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGvIj2CjzDUJP4NLbA/GJItgv/98xQO3p7C2gHT7K5TB41M2/BwGuZwZtQHa8IhE9wAbRV9 X-Received: by 2002:a05:6402:4487:b0:529:d147:e9f3 with SMTP id er7-20020a056402448700b00529d147e9f3mr1321468edb.5.1698280658820; Wed, 25 Oct 2023 17:37:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698280658; cv=none; d=google.com; s=arc-20160816; b=oA8g158TEweRXCCccC1f8c1U2muCxQxBifU49NCxhfuV/RfqKM2Zcnd7XxX0ELa49h bUtNyAD11rB7jJZC59mzpS7ja5Afwggq15buzQXGb1UzEQeTfgDxRkYmqMJgXFajhqbG r05KnHcUDUnsQlUUZOhxsCLKuZ4aDwgTP6pZHqBfIqRMxGlo4DIyoPpJBbBGeOuEuv0H VgnhJtFnXsORs1wjYqzob7fNrDYYbP02dSP6AI5su1XoLmhnbKS0VSoi22NH6IA9D1m2 5XWc3xPqhU1ev9vDcE0yDPKxLqFfazQXigvhDkyBnE/L95VorHFMWisRAEoQvgBxeSlM kxog== 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=MGWLyQfay0uP/3bYGaNwrCYZ5Inxa0SX5PTOaPawi4s=; fh=rYI8DiHAAFX3O5g969KmOAQ7d45Sb8OxQX1+DywGDk4=; b=YEphkrXh04i3IvadV0+ue4a6ahbD4D9m5sgbQ3+UcgULZJOypd19tXK9Qtyp9c1DkT qLNAnQTWPWYNCk64imPGXrcDbe1CTgPz0AbIiwfaB6EdGNiNoWfhit6wZB44IeG6JmDp csdMKJu9I94tHrTuraNjyl4bmjH6Cl6mR1vsSze5mL5RGDiHj/DGeKJmACeDKtXLDyEn qrJz5CaSQycRF/udgwsBBm8TNeaEYZkAlNEwedYnHQ+VNMEkZyPWgKY7qiqJoHGGmYej TqNWWOwQjq3AY3L2hzC7MtZGpO2WmSDBWHi6P+NX+NpcRQYvqaydOj7SOmtovVvU+TzM YHKw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=me9JrXJw; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as 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 x91-20020a50bae4000000b00530c5c644e6si5980829ede.566.2023.10.25.17.37.38 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 25 Oct 2023 17:37: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=me9JrXJw; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as 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 1qvoA0-0003rb-5f; Wed, 25 Oct 2023 20:23: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 1qvo9V-0001i8-FD for qemu-devel@nongnu.org; Wed, 25 Oct 2023 20:23:09 -0400 Received: from mail-pj1-x1036.google.com ([2607:f8b0:4864:20::1036]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qvo9R-0008DP-CF for qemu-devel@nongnu.org; Wed, 25 Oct 2023 20:23:09 -0400 Received: by mail-pj1-x1036.google.com with SMTP id 98e67ed59e1d1-27e1eea2f0dso225728a91.1 for ; Wed, 25 Oct 2023 17:23:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1698279783; x=1698884583; 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=MGWLyQfay0uP/3bYGaNwrCYZ5Inxa0SX5PTOaPawi4s=; b=me9JrXJwShgguberk286Z2IaoS8kFIdYyIxrlAWBFmWxlw5HXq/5hWgd48pxPttDj/ Gjndidy2rzjDJP0/7iN8hFZaMupGtFYTpBFLlKuFJA2/PDZKC0A0Di+P4h2I9zUjTKoi pAhpvlY6UI+Nju0YoWcKv4cEcTVZ25Vr8b5+0Vab67FNY8y/0HZHBxl7guO81yUeuccx WkqG/pVaZ8z+zWCpJClMJo0ThS/R7mRvrT2FPcbBxem2C5MWTkVNBSdBkozgOGVPOs6a SD1A16iHWtPXJUkeDxUMmOMsmu5xtKlSgPhMZ8emDFaI7bies5El56wJ4f9VwukZ2GtR /ZuQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1698279783; x=1698884583; 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=MGWLyQfay0uP/3bYGaNwrCYZ5Inxa0SX5PTOaPawi4s=; b=tdan0eUHi5St4//GrUzOXc/+YKjs9NY8lWSxK/6k/3O73aUfHO93brfceoh7ua5fNz yFUazIupCfIKU3YnZq3alxzAPQ8oxJmSYeBaT+AshC7SSZRoqOE+eHyvje3xlZ2WdyaI wZ2GP5Kov3Cb7CnAYnIHhr77Wb/8D2EngWfVmhTrFrq8ozwfXOkzuGp6BQr+FcFE/d/4 Xl8YBNtOP3AsZBS+x3fhy8O6UuPDcblrKksSLdFuxnNg1H82yeousnThFujLp7bz51aW Obv+J0n2p3yqIow/fd+3iKxfBc3oDGr6b7u3EZKQf3CL0nWPo9lmpj1S+bEej9SkWDyE yONA== X-Gm-Message-State: AOJu0Yxm7nNrcN3cb0AGmOajqmlS3zEVrIsMSOHp09goMIRzqijQBrdS AMhEDP+xOGRo1jPC9fcWCmErWerCtNxZoO5rPKQ= X-Received: by 2002:a17:90a:df01:b0:27d:198:fcc2 with SMTP id gp1-20020a17090adf0100b0027d0198fcc2mr13033046pjb.33.1698279783549; Wed, 25 Oct 2023 17:23:03 -0700 (PDT) Received: from stoup.. ([71.212.149.95]) by smtp.gmail.com with ESMTPSA id 9-20020a17090a0cc900b0027463889e72sm499870pjt.55.2023.10.25.17.23.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 25 Oct 2023 17:23:03 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: Mark Cave-Ayland Subject: [PULL 68/94] target/sparc: Move FMOVD, FNEGD, FABSD, FSRC*D, FNOT*D to decodetree Date: Wed, 25 Oct 2023 17:15:16 -0700 Message-Id: <20231026001542.1141412-98-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231026001542.1141412-1-richard.henderson@linaro.org> References: <20231026001542.1141412-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::1036; envelope-from=richard.henderson@linaro.org; helo=mail-pj1-x1036.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org Tested-by: Mark Cave-Ayland Acked-by: Mark Cave-Ayland Signed-off-by: Richard Henderson --- target/sparc/insns.decode | 7 +++ target/sparc/translate.c | 91 +++++++++++++++++++++------------------ 2 files changed, 56 insertions(+), 42 deletions(-) diff --git a/target/sparc/insns.decode b/target/sparc/insns.decode index 669a54e297..23a21f2c20 100644 --- a/target/sparc/insns.decode +++ b/target/sparc/insns.decode @@ -239,8 +239,11 @@ DONE 10 00000 111110 00000 0 0000000000000 RETRY 10 00001 111110 00000 0 0000000000000 FMOVs 10 ..... 110100 00000 0 0000 0001 ..... @r_r2 +FMOVd 10 ..... 110100 00000 0 0000 0010 ..... @r_r2 FNEGs 10 ..... 110100 00000 0 0000 0101 ..... @r_r2 +FNEGd 10 ..... 110100 00000 0 0000 0110 ..... @r_r2 FABSs 10 ..... 110100 00000 0 0000 1001 ..... @r_r2 +FABSd 10 ..... 110100 00000 0 0000 1010 ..... @r_r2 { [ @@ -266,9 +269,13 @@ FABSs 10 ..... 110100 00000 0 0000 1001 ..... @r_r2 BMASK 10 ..... 110110 ..... 0 0001 1001 ..... @r_r_r + FSRCd 10 ..... 110110 ..... 0 0111 0100 00000 @r_r1 # FSRC1d FSRCs 10 ..... 110110 ..... 0 0111 0101 00000 @r_r1 # FSRC1s + FSRCd 10 ..... 110110 00000 0 0111 1000 ..... @r_r2 # FSRC2d FSRCs 10 ..... 110110 00000 0 0111 1001 ..... @r_r2 # FSRC2s + FNOTd 10 ..... 110110 ..... 0 0110 1010 00000 @r_r1 # FNOT1d FNOTs 10 ..... 110110 ..... 0 0110 1011 00000 @r_r1 # FNOT1s + FNOTd 10 ..... 110110 00000 0 0110 0110 ..... @r_r2 # FNOT2d FNOTs 10 ..... 110110 00000 0 0110 0111 ..... @r_r2 # FNOT2s ] NCP 10 ----- 110110 ----- --------- ----- # v8 CPop1 diff --git a/target/sparc/translate.c b/target/sparc/translate.c index eb0aa2020f..572de4ef14 100644 --- a/target/sparc/translate.c +++ b/target/sparc/translate.c @@ -44,7 +44,9 @@ #else # define gen_helper_clear_softint(E, S) qemu_build_not_reached() # define gen_helper_done(E) qemu_build_not_reached() +# define gen_helper_fabsd(D, S) qemu_build_not_reached() # define gen_helper_flushw(E) qemu_build_not_reached() +# define gen_helper_fnegd(D, S) 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_restored(E) qemu_build_not_reached() @@ -1420,6 +1422,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) { @@ -1639,21 +1659,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)) { @@ -4829,6 +4834,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; @@ -4872,6 +4899,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); @@ -4974,24 +5004,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); @@ -5204,6 +5224,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); @@ -5387,10 +5411,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); @@ -5399,10 +5419,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); @@ -5435,10 +5451,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); @@ -5448,11 +5460,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 Thu Oct 26 00:15: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: 738264 Delivered-To: patch@linaro.org Received: by 2002:adf:f842:0:b0:32d:baff:b0ca with SMTP id d2csp558469wrq; Wed, 25 Oct 2023 17:36:12 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFxmEEHRDnYAlZB3JllaxBaYOPjFY1ogIPDwBVzwi33wBfSIysenJXIC2coKcLiBCrZ7uIb X-Received: by 2002:a05:651c:a12:b0:2bc:ff80:f639 with SMTP id k18-20020a05651c0a1200b002bcff80f639mr16405417ljq.7.1698280572355; Wed, 25 Oct 2023 17:36:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698280572; cv=none; d=google.com; s=arc-20160816; b=rZb9zs+MZ9VnUqGEB5CZWVjRmn7s3omnLsg5nNAuM2iDXZRGqN2GT2CuSwFS9qjM+2 WYXMD/mXHww3uoWb9jYhNzPQ0+uSVXmECRuOLFhrDD/BzYMqiXMj6FJRkWnT2EmxkL8r v3LCOHNZuT44seOnAi3GzxLVOL//jdQu2/yq7zeuiWutLMdX6ESj/pZLGI5PVDhNR4wr NxhzD5Wih1ytK4KC46MgLJGv0oGyNal8j2+jFLqsUNIv9jE1d9rs6R5MufsHisZwNXPg bNczY2wOOEll73zDWYzcQ98WZX40RvmNIu6OG3w5gayMn7kP7EzCI+/TIex8RrF7K2kk 8Xnw== 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=Mf1oJrduPCBqL7ZJPmcmrJhpPRE8uXn/4De5kKhDPeY=; fh=rYI8DiHAAFX3O5g969KmOAQ7d45Sb8OxQX1+DywGDk4=; b=d4P8LEYH4nkKZgsp/WafRO/qmECYvtbNiPHzX5vu4YdQyf3HIXcy5uy3eTammGlt7l 6W1Ist4T2cyvOxIH5WYYVx/qcgnKr/F2BaKjHMDNZCji7iDxjgrP7/GYJlxR3bUM2A2p iPUreKC+7cryTxUZCFMOKBEri9J1NPT7Jqo34j6WZl2mcPXzBwG38YwLTt3H6vLT5CfG 50hNZDPvupbNax7RCMxWQeeC9yggGhDxo+w1Xrrinc5aobnYScMbRfqLRhRrvOxXunDx RAM0OOrBc7BEmB6zaocovGQXKTwXbT5oXUxSykKKCrfyf4zhkMgKiFlN9gdnS3ScYgkd muUg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=ZnGzBBOD; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as 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 h4-20020a5d6884000000b0032d94fe62dasi8164441wru.512.2023.10.25.17.36.12 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 25 Oct 2023 17:36: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=ZnGzBBOD; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as 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 1qvo9u-0003Yc-5d; Wed, 25 Oct 2023 20:23: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 1qvo9W-0001o3-8J for qemu-devel@nongnu.org; Wed, 25 Oct 2023 20:23:10 -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 1qvo9R-0008Db-VE for qemu-devel@nongnu.org; Wed, 25 Oct 2023 20:23:09 -0400 Received: by mail-pf1-x432.google.com with SMTP id d2e1a72fcca58-6b87c1edfd5so292849b3a.1 for ; Wed, 25 Oct 2023 17:23:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1698279784; x=1698884584; 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=Mf1oJrduPCBqL7ZJPmcmrJhpPRE8uXn/4De5kKhDPeY=; b=ZnGzBBODna+PKMReZ3IEqpU40rrUXy7CRbozznbBh4xgpTvl1ZOr8pc6itDBgy/gMg qQAvHECRUvfMK0cL+rGsfNWsvSZ23c7sUSvqE6nZp8RCpsRNmVFaPLbzJQFNuc4EVGl4 Opkz2/R1BnlVtWHVPvkrJrxNvIsc0WeWdYNG0nEm7D1YmK1SuCRtMdA/zrhyVhPW4GcE gDo716PSgWVEa59CgHpvT/hCElbb3UoCSmfNoulVpq5eHp2O0vhBXTjsDXEP/gY3WDQQ YC1csOUgtChMo7+YnWtLf+6BzRvqJJV8U1xs3ppFSSef/E5Vu28v9FFSXdGt4RVr/Bgc u42g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1698279784; x=1698884584; 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=Mf1oJrduPCBqL7ZJPmcmrJhpPRE8uXn/4De5kKhDPeY=; b=cMKuT6KQqx0V8W48iZiVfMuwgtgA/6FGNAZmQ+7xkLrMQuftVzzKzQZna7ValuFfda iMAITtL3hDlPZ7xUBzcuhoR7IACNgSjKn3IM79LP/MoWm+Do3WTpLtAmbvtjxGWHfdUk ENWhy0rPzrRRniG9YCyjEQSv1SzyxGglHTLvSk0PCJZQl6Aeueu6JQAXW+z3QnIkztJK 88WbTkVoEn5pEw7aJ2OWVnux10TDMzdeKUOIq1ulc9yRm+YUrmzrLNEMuSg+NHQarvb2 zIfgGPkzTuCfK8RmrzFtKyB+H3AYQx1TOhOrjZltfU6yG8TBnuSouNFs+X7rbhH3R6yk XsQg== X-Gm-Message-State: AOJu0Ywemxk0mCllOLUM24Rw6/R7aQmvh4xSF84AgXISwRHh1Ij2Wu5D qHSvw0ng2CNXndNZG81ryb2KXzf9VO46JxFJ5xg= X-Received: by 2002:a05:6a20:7f86:b0:174:2d20:5414 with SMTP id d6-20020a056a207f8600b001742d205414mr9593997pzj.49.1698279784366; Wed, 25 Oct 2023 17:23:04 -0700 (PDT) Received: from stoup.. ([71.212.149.95]) by smtp.gmail.com with ESMTPSA id 9-20020a17090a0cc900b0027463889e72sm499870pjt.55.2023.10.25.17.23.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 25 Oct 2023 17:23:04 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: Mark Cave-Ayland Subject: [PULL 69/94] target/sparc: Use tcg_gen_vec_{add,sub}* Date: Wed, 25 Oct 2023 17:15:17 -0700 Message-Id: <20231026001542.1141412-99-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231026001542.1141412-1-richard.henderson@linaro.org> References: <20231026001542.1141412-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::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 Replace the local helpers for the same integer operations. Tested-by: Mark Cave-Ayland Acked-by: Mark Cave-Ayland 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 572de4ef14..09ca9c51bd 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" @@ -5353,15 +5352,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); @@ -5369,15 +5368,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 Thu Oct 26 00:15: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: 738248 Delivered-To: patch@linaro.org Received: by 2002:adf:f842:0:b0:32d:baff:b0ca with SMTP id d2csp557037wrq; Wed, 25 Oct 2023 17:32:06 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEqzGEprIBQ5yaKUhQC9MWK3CJIbzW4GQUlEAQnOtb+QrKjaWr6hD/8ZwFEAxQK6S0DdxzV X-Received: by 2002:a05:6000:a:b0:32d:8830:cda1 with SMTP id h10-20020a056000000a00b0032d8830cda1mr12693430wrx.63.1698280325840; Wed, 25 Oct 2023 17:32:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698280325; cv=none; d=google.com; s=arc-20160816; b=ZlvlObT8lv/QzRszrWm72VPE1VebcCVU5mWCCWDFvtce4fqKDLEfNBNW2A6paghnRL jiUdrqYoyqRO/I5WXShAoYmgc8Sm5L/qZv+GKtQysuq6mIP4H2ipCQcMn8b7kygHNYSW JQX44sKPsnS+/xV10NET7UhD0Qr2+UBhZ85a3nD/4HNG1RYy3ALSIMN/YlI7zdcAhEAw gdb88yksRJSKXkFeGvUtp6d3m7eR4mzR69fO9Mlc+5YmfAeSbZ8FzQueaAiZzykZUrvd p4tFpv6MqykJo9s19B54n4FNeJo42Bjjvl9c2BDaNqGR/FWaaRvaNFIGZf5ZwAcPozjZ DgdQ== 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=bk59M1JI+E4cyB0CQ9rgcLwL2YU9APHWN+wZfRVduds=; fh=rYI8DiHAAFX3O5g969KmOAQ7d45Sb8OxQX1+DywGDk4=; b=sSGkzy9shrno799cd+4ABpzOdENx0azFyFRoNw/jn8U7hh6c6eMHSjuEpcANgftzBZ 4TEIcOr7Hg3wIcWfGofhax0W8t6w5I/QsuHP3TWx9JuUu3xqECyILU07Rgf2c/TkCmao 7uIqyBOjrUpLtS6ms5EGJsL10n3MmoTrErzje60P/6/E46JPSoXsIEokTo399ryX54rz p7BC578bdO/4u8Ud4H7Qr3MFNddQiu0N9G5d1OnhAM3+xUbfmYdQn0TQtEbn1rhvKntJ zV5AVN1kB8f5PVJxZb+y7q0UUwDmBg6tP9lnDn5EK3RvMCdl1WQkPycPCX6PpzJQGxqI tQ5Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=OStBVrJE; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as 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 d2-20020adff842000000b00327d0741e78si8171825wrq.433.2023.10.25.17.32.05 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 25 Oct 2023 17:32: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=OStBVrJE; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as 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 1qvo9g-0002nV-Be; Wed, 25 Oct 2023 20:23:21 -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 1qvo9X-0001zL-HJ for qemu-devel@nongnu.org; Wed, 25 Oct 2023 20:23:11 -0400 Received: from mail-pj1-x1030.google.com ([2607:f8b0:4864:20::1030]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qvo9S-0008Di-VN for qemu-devel@nongnu.org; Wed, 25 Oct 2023 20:23:11 -0400 Received: by mail-pj1-x1030.google.com with SMTP id 98e67ed59e1d1-27ddc1b1652so224305a91.2 for ; Wed, 25 Oct 2023 17:23:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1698279785; x=1698884585; 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=bk59M1JI+E4cyB0CQ9rgcLwL2YU9APHWN+wZfRVduds=; b=OStBVrJE9kNGAQ6mc1jAacHy6OCQOWpAwm2ZsdZAUgLAUGmMpBYSbpe5oNNXnEA9EQ mUrQATaUILyb+CMdg0oM9ELxI9cDaqz+YDoEJ6V59CZn5+8EhYSqpk2J2hMReRpttRfR kfgBvBQYAO2VIZIOm9fdRMuYjKjh3Qi0rxQLHWdZlEfTK5by9gbQnbbOeXwRf0iXRafq JojLMmHGz/FNeN+pQJRNuatR1H9jnIiaTgyJVyQYLXUCiavul34Pmg5IUkf7y9qnPMf5 lubsi0YFPcKdyawbs24K+fYNqSwGsGjwVxNiCHYCfwXgH6VOkmT5mGDkZAynxUer03oN kg9w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1698279785; x=1698884585; 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=bk59M1JI+E4cyB0CQ9rgcLwL2YU9APHWN+wZfRVduds=; b=QTZ4pZRCm2iHOwJqjb2hvszUdQrNWXPHEVK91ikeOWXtHJiMq14X02rlF0H/I5xg1H MxCHeLyNmMlZ5q1qUibhES75SiMqHpkc8xI5A4UJpU7tKkOYK1bAt+nYGvHC7IraC2Gj 3H0Hhu80e5BN4e6voHeyN9U9r51kWNtQFZuKxg45dS7XDn5A3DMx3VEQM7qmMEOtOeqH XGbZqY5ExHuE2F56drLtJZBbs7tMURdJOwHkHpW9YSPeWgy4lz7TOe1EjY3xbPNiFBnf dWAgW/fdfHBl7OREvhqWEL4cENaaGDseUwBtkktUbq1vVUlC26Bel8zEdUvX8xFE7MP5 5+Qw== X-Gm-Message-State: AOJu0YythxVSvCIFi+qHB+/nR05JOYuM5EVyudCRjI3zxv/ezK+FcfmZ I90NbqxX2PyGhmuhErUtDDzJp92Gjwa/GBVCQHY= X-Received: by 2002:a17:90a:6e05:b0:27c:edf3:d045 with SMTP id b5-20020a17090a6e0500b0027cedf3d045mr16250718pjk.40.1698279785096; Wed, 25 Oct 2023 17:23:05 -0700 (PDT) Received: from stoup.. ([71.212.149.95]) by smtp.gmail.com with ESMTPSA id 9-20020a17090a0cc900b0027463889e72sm499870pjt.55.2023.10.25.17.23.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 25 Oct 2023 17:23:04 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: Mark Cave-Ayland Subject: [PULL 70/94] target/sparc: Move gen_ne_fop_FFF insns to decodetree Date: Wed, 25 Oct 2023 17:15:18 -0700 Message-Id: <20231026001542.1141412-100-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231026001542.1141412-1-richard.henderson@linaro.org> References: <20231026001542.1141412-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::1030; envelope-from=richard.henderson@linaro.org; helo=mail-pj1-x1030.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. Tested-by: Mark Cave-Ayland Acked-by: Mark Cave-Ayland Signed-off-by: Richard Henderson --- target/sparc/insns.decode | 16 ++++++ target/sparc/translate.c | 116 ++++++++++++++------------------------ 2 files changed, 59 insertions(+), 73 deletions(-) diff --git a/target/sparc/insns.decode b/target/sparc/insns.decode index 23a21f2c20..0290f2aefb 100644 --- a/target/sparc/insns.decode +++ b/target/sparc/insns.decode @@ -37,6 +37,7 @@ CALL 01 i:s30 &r_r_r rd rs1 rs2 @r_r_r .. rd:5 ...... rs1:5 . ........ rs2:5 &r_r_r +@r_r_r_swap .. rd:5 ...... rs2:5 . ........ rs1:5 &r_r_r &r_r rd rs @r_r1 .. rd:5 ...... rs:5 . ........ ..... &r_r @@ -277,6 +278,21 @@ FABSd 10 ..... 110100 00000 0 0000 1010 ..... @r_r2 FNOTs 10 ..... 110110 ..... 0 0110 1011 00000 @r_r1 # FNOT1s FNOTd 10 ..... 110110 00000 0 0110 0110 ..... @r_r2 # FNOT2d FNOTs 10 ..... 110110 00000 0 0110 0111 ..... @r_r2 # FNOT2s + + FPADD16s 10 ..... 110110 ..... 0 0101 0001 ..... @r_r_r + FPADD32s 10 ..... 110110 ..... 0 0101 0011 ..... @r_r_r + FPSUB16s 10 ..... 110110 ..... 0 0101 0101 ..... @r_r_r + FPSUB32s 10 ..... 110110 ..... 0 0101 0111 ..... @r_r_r + FNORs 10 ..... 110110 ..... 0 0110 0011 ..... @r_r_r + FANDNOTs 10 ..... 110110 ..... 0 0110 0101 ..... @r_r_r # FANDNOT2s + FANDNOTs 10 ..... 110110 ..... 0 0110 1001 ..... @r_r_r_swap # ... 1s + FXORs 10 ..... 110110 ..... 0 0110 1101 ..... @r_r_r + FNANDs 10 ..... 110110 ..... 0 0110 1111 ..... @r_r_r + FANDs 10 ..... 110110 ..... 0 0111 0001 ..... @r_r_r + FXNORs 10 ..... 110110 ..... 0 0111 0011 ..... @r_r_r + FORNOTs 10 ..... 110110 ..... 0 0111 0111 ..... @r_r_r # FORNOT2s + FORNOTs 10 ..... 110110 ..... 0 0111 1011 ..... @r_r_r_swap # ... 1s + FORs 10 ..... 110110 ..... 0 0111 1101 ..... @r_r_r ] NCP 10 ----- 110110 ----- --------- ----- # v8 CPop1 } diff --git a/target/sparc/translate.c b/target/sparc/translate.c index 09ca9c51bd..949d1954a4 100644 --- a/target/sparc/translate.c +++ b/target/sparc/translate.c @@ -1628,22 +1628,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)) { @@ -4855,6 +4839,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; @@ -5227,6 +5240,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); @@ -5354,34 +5381,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); @@ -5398,83 +5409,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 Thu Oct 26 00:15: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: 738229 Delivered-To: patch@linaro.org Received: by 2002:adf:f842:0:b0:32d:baff:b0ca with SMTP id d2csp555229wrq; Wed, 25 Oct 2023 17:26:39 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEX52/JYqm/msAXGAS30OPAcL4b+3zudBX7Km8ZrfZnG7/PjGRRco+4Y0UdiSQ/HeEjSrAl X-Received: by 2002:a5d:6d86:0:b0:32d:8982:ff12 with SMTP id l6-20020a5d6d86000000b0032d8982ff12mr1307506wrs.7.1698279999033; Wed, 25 Oct 2023 17:26:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698279999; cv=none; d=google.com; s=arc-20160816; b=Rb4von9zg4kDKTB61lvBYEP3nnA8vwZsxEQWUUbPQwaNLuZ1ym+Xj6DChkXgDLGSVp fbWFHAkAcy6pJgcCoOONQjnlIHv94LdKg5/K3SKmcMDeL+GOC9FwZHbhfUIfVSjgg2u+ xx9T7/rZlzuO8V7bkfBqf0VBhexEEkzUzGnx3iVfl18YtO1/wuHNHanx9juXvHJ5A/+C Mos0YO+Dmh+pPIc5+auZivq5w7QOOJ2A80VHI1G7Wc54kz7Nc0qbfJedRDTe0dUMLsoo yYRW32c+nhOILf/I0ETCXBqJ0vfI1kf0eeqVMAsdwnzIq4x1bzu4chqkce461OcBaJgX BDoQ== 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=HW1LRQw9VDcfdWictsx6e3CwLT7UvGJ/b2nB3wYTzgI=; fh=rYI8DiHAAFX3O5g969KmOAQ7d45Sb8OxQX1+DywGDk4=; b=WfiUapVNyYWpdrobX9RxWarnLVWd7SqZMGz8EhE45KJXRojHdmxr+AHCRRRQMy85HY ifn9JNWJ2psKXAqK6BmgY99Ttz58dWBRhSrq09mB8O67sSESYLwTrd3Zxr91r5UHiyk3 jHFLY4GoRfQ0iNdYEkBYN5BzlQrCQZFl3mVClKHr915w8X4mfYIUKLXhgvcc93QQV4jC BJFMnzxeyTSucies1YzHHBBq5g0YJcMiNlF9qXQAt9b/ssqKmiLIYQiJgJCGiNiKFPsP ceXusk+DLJCfvmpA45Oq0TgAyXBi9D73icXVu1mgo5nEVbxiZOi3dDY93LouChz58vAu hI9Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=yRK6iFri; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id b6-20020a5d4b86000000b0032d932edac0si8151631wrt.187.2023.10.25.17.26.38 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 25 Oct 2023 17:26:39 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=yRK6iFri; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as 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 1qvoA3-0004cw-6X; Wed, 25 Oct 2023 20:23: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 1qvo9Z-00028J-FG for qemu-devel@nongnu.org; Wed, 25 Oct 2023 20:23:14 -0400 Received: from mail-pj1-x1036.google.com ([2607:f8b0:4864:20::1036]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qvo9T-0008Dr-5e for qemu-devel@nongnu.org; Wed, 25 Oct 2023 20:23:12 -0400 Received: by mail-pj1-x1036.google.com with SMTP id 98e67ed59e1d1-27d4372322aso231096a91.3 for ; Wed, 25 Oct 2023 17:23:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1698279786; x=1698884586; 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=HW1LRQw9VDcfdWictsx6e3CwLT7UvGJ/b2nB3wYTzgI=; b=yRK6iFriHu1YUXmopEIJREjkX7IeO2QL3ue5MJquFFgFg1bnuLsyyo4mJHkIJ9xBf7 FvYCUUqJCVlgQR8o7ojFNYLDjJGbTbfQAbvZS2k5br45Iyb39p9s7q+OQFzs/80/6LsO wVrRQ2UKKnNT2KUDBMN8vASvMbQnw539ciQAA+WMEXIHmYMfZtnZN5GQGpMuLm4c/e// 48rttDzemzsNK268EEmXb1HoaGIrWTkMVoRoTwDe4fjue35uVZiIIh+g6Z1KLzQGFxPV HL3r9TXzDGjA/nGAuaWJ4u1hLFCwdKiQFjCucron/aJm4hQSSd0RGplO+LH1jcg9ay9i n//w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1698279786; x=1698884586; 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=HW1LRQw9VDcfdWictsx6e3CwLT7UvGJ/b2nB3wYTzgI=; b=kHRNyn9JSnUZIlrLlhwyjPuGu1+nejam5MAr1S3PZSoE6olPnoqACysAFIlmPlMEJJ VpKQHmNJvSVwKntCJstQrazNwYEYXv2mgA+8x9lVqN/T9w73ltYLPMNkKJJHBFOk47hf Is8jQY2p0s5+k2D2y3/ASrkpEUdZwH3CQXojy8eQrob+Q933Yi6/WlAazVG5tiD6/w/T TFMndZiBEm3cFl0Joo3DdGKRAnlRQABe1tn2LDmJBEZC5oEaE2j7w23Hao3F1jYsbBlY EH78+T8opyT3uK3SFeMWHhfPPOOyS+WYe2Tzi1HKx2Uxsh8n3c3J5OXjJ033v4k8x3Gp Gpvg== X-Gm-Message-State: AOJu0Yxo0TDmAMlZR2zemsfii/HP1axzQEMq4AxlXiqIWGjRZbiXHJJZ V4zkKePS4vCFDegFzefL4t7Ms/Rrtnow7Qtdmqo= X-Received: by 2002:a17:90b:2b46:b0:27d:882f:e6c5 with SMTP id rr6-20020a17090b2b4600b0027d882fe6c5mr14563505pjb.9.1698279785824; Wed, 25 Oct 2023 17:23:05 -0700 (PDT) Received: from stoup.. ([71.212.149.95]) by smtp.gmail.com with ESMTPSA id 9-20020a17090a0cc900b0027463889e72sm499870pjt.55.2023.10.25.17.23.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 25 Oct 2023 17:23:05 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: Mark Cave-Ayland Subject: [PULL 71/94] target/sparc: Move gen_ne_fop_DDD insns to decodetree Date: Wed, 25 Oct 2023 17:15:19 -0700 Message-Id: <20231026001542.1141412-101-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231026001542.1141412-1-richard.henderson@linaro.org> References: <20231026001542.1141412-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::1036; envelope-from=richard.henderson@linaro.org; helo=mail-pj1-x1036.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org Move FMUL8x16, FMUL8x16AU, FMUL8x16AL, FMUL8SUx16, FMUL8ULx16, FMULD8SUx16, FMULD8ULx16, FPMERGE, FEXPAND, FANDNOT1d, FANDNOT2d, FANDd, FNANDd, FNORd, FORNOT1d, FORNOT2d, FORd, FPADD16d, FPADD32d, FPSUB16d, FPSUB32d, FXNORd, FXORd. Tested-by: Mark Cave-Ayland Acked-by: Mark Cave-Ayland Signed-off-by: Richard Henderson --- target/sparc/insns.decode | 26 ++++++ target/sparc/translate.c | 178 +++++++++++++++----------------------- 2 files changed, 98 insertions(+), 106 deletions(-) diff --git a/target/sparc/insns.decode b/target/sparc/insns.decode index 0290f2aefb..0e29629b5c 100644 --- a/target/sparc/insns.decode +++ b/target/sparc/insns.decode @@ -270,6 +270,17 @@ FABSd 10 ..... 110100 00000 0 0000 1010 ..... @r_r2 BMASK 10 ..... 110110 ..... 0 0001 1001 ..... @r_r_r + FMUL8x16 10 ..... 110110 ..... 0 0011 0001 ..... @r_r_r + FMUL8x16AU 10 ..... 110110 ..... 0 0011 0011 ..... @r_r_r + FMUL8x16AL 10 ..... 110110 ..... 0 0011 0101 ..... @r_r_r + FMUL8SUx16 10 ..... 110110 ..... 0 0011 0110 ..... @r_r_r + FMUL8ULx16 10 ..... 110110 ..... 0 0011 0111 ..... @r_r_r + FMULD8SUx16 10 ..... 110110 ..... 0 0011 1000 ..... @r_r_r + FMULD8ULx16 10 ..... 110110 ..... 0 0011 1001 ..... @r_r_r + + FPMERGE 10 ..... 110110 ..... 0 0100 1011 ..... @r_r_r + FEXPAND 10 ..... 110110 ..... 0 0100 1101 ..... @r_r_r + FSRCd 10 ..... 110110 ..... 0 0111 0100 00000 @r_r1 # FSRC1d FSRCs 10 ..... 110110 ..... 0 0111 0101 00000 @r_r1 # FSRC1s FSRCd 10 ..... 110110 00000 0 0111 1000 ..... @r_r2 # FSRC2d @@ -279,19 +290,34 @@ FABSd 10 ..... 110100 00000 0 0000 1010 ..... @r_r2 FNOTd 10 ..... 110110 00000 0 0110 0110 ..... @r_r2 # FNOT2d FNOTs 10 ..... 110110 00000 0 0110 0111 ..... @r_r2 # FNOT2s + FPADD16 10 ..... 110110 ..... 0 0101 0000 ..... @r_r_r FPADD16s 10 ..... 110110 ..... 0 0101 0001 ..... @r_r_r + FPADD32 10 ..... 110110 ..... 0 0101 0010 ..... @r_r_r FPADD32s 10 ..... 110110 ..... 0 0101 0011 ..... @r_r_r + FPSUB16 10 ..... 110110 ..... 0 0101 0100 ..... @r_r_r FPSUB16s 10 ..... 110110 ..... 0 0101 0101 ..... @r_r_r + FPSUB32 10 ..... 110110 ..... 0 0101 0110 ..... @r_r_r FPSUB32s 10 ..... 110110 ..... 0 0101 0111 ..... @r_r_r + + FNORd 10 ..... 110110 ..... 0 0110 0010 ..... @r_r_r FNORs 10 ..... 110110 ..... 0 0110 0011 ..... @r_r_r + FANDNOTd 10 ..... 110110 ..... 0 0110 0100 ..... @r_r_r # FANDNOT2d FANDNOTs 10 ..... 110110 ..... 0 0110 0101 ..... @r_r_r # FANDNOT2s + FANDNOTd 10 ..... 110110 ..... 0 0110 1000 ..... @r_r_r_swap # ... 1d FANDNOTs 10 ..... 110110 ..... 0 0110 1001 ..... @r_r_r_swap # ... 1s + FXORd 10 ..... 110110 ..... 0 0110 1100 ..... @r_r_r FXORs 10 ..... 110110 ..... 0 0110 1101 ..... @r_r_r + FNANDd 10 ..... 110110 ..... 0 0110 1110 ..... @r_r_r FNANDs 10 ..... 110110 ..... 0 0110 1111 ..... @r_r_r + FANDd 10 ..... 110110 ..... 0 0111 0000 ..... @r_r_r FANDs 10 ..... 110110 ..... 0 0111 0001 ..... @r_r_r + FXNORd 10 ..... 110110 ..... 0 0111 0010 ..... @r_r_r FXNORs 10 ..... 110110 ..... 0 0111 0011 ..... @r_r_r + FORNOTd 10 ..... 110110 ..... 0 0111 0110 ..... @r_r_r # FORNOT2d FORNOTs 10 ..... 110110 ..... 0 0111 0111 ..... @r_r_r # FORNOT2s + FORNOTd 10 ..... 110110 ..... 0 0111 1010 ..... @r_r_r_swap # ... 1d FORNOTs 10 ..... 110110 ..... 0 0111 1011 ..... @r_r_r_swap # ... 1s + FORd 10 ..... 110110 ..... 0 0111 1100 ..... @r_r_r FORs 10 ..... 110110 ..... 0 0111 1101 ..... @r_r_r ] NCP 10 ----- 110110 ----- --------- ----- # v8 CPop1 diff --git a/target/sparc/translate.c b/target/sparc/translate.c index 949d1954a4..35fdcfe4c1 100644 --- a/target/sparc/translate.c +++ b/target/sparc/translate.c @@ -63,6 +63,15 @@ # define gen_helper_write_softint(E, S) qemu_build_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_fexpand ({ qemu_build_not_reached(); NULL; }) +# define gen_helper_fmul8sux16 ({ qemu_build_not_reached(); NULL; }) +# define gen_helper_fmul8ulx16 ({ qemu_build_not_reached(); NULL; }) +# define gen_helper_fmul8x16al ({ qemu_build_not_reached(); NULL; }) +# define gen_helper_fmul8x16au ({ qemu_build_not_reached(); NULL; }) +# define gen_helper_fmul8x16 ({ qemu_build_not_reached(); NULL; }) +# define gen_helper_fmuld8sux16 ({ qemu_build_not_reached(); NULL; }) +# define gen_helper_fmuld8ulx16 ({ qemu_build_not_reached(); NULL; }) +# define gen_helper_fpmerge ({ qemu_build_not_reached(); NULL; }) # define FSR_LDXFSR_MASK 0 # define FSR_LDXFSR_OLDMASK 0 # define MAXTL_MASK 0 @@ -1658,20 +1667,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)) { @@ -4868,6 +4863,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; @@ -5254,6 +5289,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); @@ -5311,34 +5369,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); @@ -5365,34 +5395,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); @@ -5405,46 +5411,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 Thu Oct 26 00:15: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: 738293 Delivered-To: patch@linaro.org Received: by 2002:adf:f842:0:b0:32d:baff:b0ca with SMTP id d2csp559631wrq; Wed, 25 Oct 2023 17:39:57 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFuf1+KT+PwBjHu0L2MWOFsCAL8N1FwbA34iePpvbx28STwyeiDW/DrkYE0JY7hilQVa174 X-Received: by 2002:a05:600c:1f8d:b0:407:8ee2:9986 with SMTP id je13-20020a05600c1f8d00b004078ee29986mr12044703wmb.26.1698280797394; Wed, 25 Oct 2023 17:39:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698280797; cv=none; d=google.com; s=arc-20160816; b=iv65RwgQgTwevDG+ahGj122QtsozcP+my5VnCyLTOxQirz/Std8zQOv2xmsXYOJLmJ kr8NlBj7w+sV2YL18fxeoBvxDtNVumMl2icD4D8yl0oniJLzxypnzDuYlEz5eSEjzJeQ mHe8ox04v3AzDgetNO9EA7zDCDxAmv/5/pQRQaMvJSkLXNGn6yl4EjWIz3ryuTYLPuWg 8yIWqbwLmoHuSO3efQ9kB1fIEh86tRLxXC0zOqRXLINp0d+mvDc4Y+5BQNPRSoHLJg9p 4Ey7zkqfsyWg5OmPvh8VrcYhFz7lPC5dsMNaMzMITXp6xF145uaVDNw8tkmWSeyMmI97 SttA== 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=+izpcOcVyLZOmdkTPJ82RJ4OWeC+Q1LpqFNyQvH78LU=; fh=rYI8DiHAAFX3O5g969KmOAQ7d45Sb8OxQX1+DywGDk4=; b=QBl7H9Dxok+uDKzQqhL6/s8yeNtTOXf4iroDAJl53AIDQ6lY1W+ADuO8oqci2qXGRS VCIS9dSO4j/L/NybafejqVdCvPwS2H+OiQvUagSjofVqS1L1hiL80HaZRkMhBcLzqxtG NtmcxsYN/4p66D5cGNHoPCGy04KbJsZsqEXktJTPg/rRNkwwfeeHgICjAeKtLeBpxFOn RjBDnghHHjb/ilERWJ/nVLuJNuCHx0WsXR4Y0rXc1TMSgC8anHDDBKJZLcg7cIbk28VR IZEvwogca5ba7gG+Ky4qw9yzR+jBoeWPMuazCvOdrTRFl/jn2XyHUENAI0C/yVURQwii w28Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=bRIeynCe; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as 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 v14-20020a05600c470e00b0040517e3d6e3si806217wmo.42.2023.10.25.17.39.57 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 25 Oct 2023 17:39: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=bRIeynCe; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as 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 1qvoA2-0004So-Gh; Wed, 25 Oct 2023 20:23: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 1qvo9Z-0002LS-IM for qemu-devel@nongnu.org; Wed, 25 Oct 2023 20:23:14 -0400 Received: from mail-pf1-x433.google.com ([2607:f8b0:4864:20::433]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qvo9T-0008E4-Vi for qemu-devel@nongnu.org; Wed, 25 Oct 2023 20:23:13 -0400 Received: by mail-pf1-x433.google.com with SMTP id d2e1a72fcca58-6b44befac59so1131798b3a.0 for ; Wed, 25 Oct 2023 17:23:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1698279786; x=1698884586; 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=+izpcOcVyLZOmdkTPJ82RJ4OWeC+Q1LpqFNyQvH78LU=; b=bRIeynCebZyit4PpDa+vss6YiEZY6tyKwUbqZAxhdUh6Se0W550iN+f8oBmKzyhCRx DnRg1anOXuOe0pmPqmz3GLa5Ce1G/LrDFqZ46RU8lyqP7z/xUclNb0KXRSl2BTP6TC/V K7bhzgHn6TGVBhrjLzWyiu/eWI6BH9sIV+sqWrx34WOm0jCjpIMtG4RfPLLg8lL9O8pk gzafpv8GNKg23+4KxZWbHsoMnEHprCJsh4XeDkURHiSXdhxSllBzmCKdwtUKm5C7+te7 61AzjbugG/9jDlAbdOc1Baq+ZDyQKQsPwO9mUFq3xrWPpQQqNNsJAv67Z0x+suttPnl1 LlMg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1698279786; x=1698884586; 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=+izpcOcVyLZOmdkTPJ82RJ4OWeC+Q1LpqFNyQvH78LU=; b=cKECDqkeTg6pMJ9r5/sre/7J5Mh79c9ALZxko02qNQBzxar3B01XGh/ejJPvnugizF T2lnjlqh1IHNHJxQ0C0pj6jL7oqaebOak5RDDwMFsvjCplimebjD42DIhSGRXpJFjmNg tiGevvAUxv36XWhrSnP8egjWwDP50eK/FQSskQkujdjY0clVcTOFYEgohhzouyEMW6dz 6PpF/n9oZLmI7iJ5hv849yFBwgArjogiGICpoZ+/Bn+ZGeH3aT8j88zq51ARwSjJy1i/ zdF4TYo0BLD8SXVXzTZ7bMkGxMNdSg5oHF2otFGWlYfQEK/muvwP3/CFZw2h4niEQoKq vunw== X-Gm-Message-State: AOJu0Yx3jC3piEezXsGb7il3aNVisCYaUSIhnoqhfSEqzHPKxHuuKZ57 SnoQAxGPqLlxIzC9+3YAbHYLJh6109PFuuycpnU= X-Received: by 2002:a17:90b:4d0f:b0:27d:469b:8847 with SMTP id mw15-20020a17090b4d0f00b0027d469b8847mr1472981pjb.3.1698279786540; Wed, 25 Oct 2023 17:23:06 -0700 (PDT) Received: from stoup.. ([71.212.149.95]) by smtp.gmail.com with ESMTPSA id 9-20020a17090a0cc900b0027463889e72sm499870pjt.55.2023.10.25.17.23.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 25 Oct 2023 17:23:06 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: Mark Cave-Ayland Subject: [PULL 72/94] target/sparc: Move PDIST to decodetree Date: Wed, 25 Oct 2023 17:15:20 -0700 Message-Id: <20231026001542.1141412-102-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231026001542.1141412-1-richard.henderson@linaro.org> References: <20231026001542.1141412-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::433; envelope-from=richard.henderson@linaro.org; helo=mail-pf1-x433.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org Tested-by: Mark Cave-Ayland Acked-by: Mark Cave-Ayland Signed-off-by: Richard Henderson --- target/sparc/insns.decode | 1 + target/sparc/translate.c | 41 +++++++++++++++++++++------------------ 2 files changed, 23 insertions(+), 19 deletions(-) diff --git a/target/sparc/insns.decode b/target/sparc/insns.decode index 0e29629b5c..42d740ad44 100644 --- a/target/sparc/insns.decode +++ b/target/sparc/insns.decode @@ -277,6 +277,7 @@ FABSd 10 ..... 110100 00000 0 0000 1010 ..... @r_r2 FMUL8ULx16 10 ..... 110110 ..... 0 0011 0111 ..... @r_r_r FMULD8SUx16 10 ..... 110110 ..... 0 0011 1000 ..... @r_r_r FMULD8ULx16 10 ..... 110110 ..... 0 0011 1001 ..... @r_r_r + PDIST 10 ..... 110110 ..... 0 0011 1110 ..... @r_r_r FPMERGE 10 ..... 110110 ..... 0 0100 1011 ..... @r_r_r FEXPAND 10 ..... 110110 ..... 0 0100 1101 ..... @r_r_r diff --git a/target/sparc/translate.c b/target/sparc/translate.c index 35fdcfe4c1..40ef395d14 100644 --- a/target/sparc/translate.c +++ b/target/sparc/translate.c @@ -72,6 +72,7 @@ # define gen_helper_fmuld8sux16 ({ qemu_build_not_reached(); NULL; }) # define gen_helper_fmuld8ulx16 ({ qemu_build_not_reached(); NULL; }) # define gen_helper_fpmerge ({ qemu_build_not_reached(); NULL; }) +# define gen_helper_pdist ({ qemu_build_not_reached(); NULL; }) # define FSR_LDXFSR_MASK 0 # define FSR_LDXFSR_OLDMASK 0 # define MAXTL_MASK 0 @@ -1680,21 +1681,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, @@ -4903,6 +4889,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; @@ -5312,6 +5318,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); @@ -5387,10 +5394,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 Thu Oct 26 00:15: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: 738236 Delivered-To: patch@linaro.org Received: by 2002:adf:f842:0:b0:32d:baff:b0ca with SMTP id d2csp555521wrq; Wed, 25 Oct 2023 17:27:37 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFqghE9hXNJgXrhkKRNdN8E79RMc7EhVCXv5yohAekssuNJQ+CrgKNXk0wcYZgOTCaAfQHs X-Received: by 2002:a50:9ec2:0:b0:540:9be9:a849 with SMTP id a60-20020a509ec2000000b005409be9a849mr5720686edf.1.1698280056895; Wed, 25 Oct 2023 17:27:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698280056; cv=none; d=google.com; s=arc-20160816; b=0oZZUW7uVbSzLVcrff0vNJKENHPxr59oEqFm3EeyMSv4mngSwl1BE+IqW9/2Leb3H4 yM9fK6XSyPxCasilm4mXRsRs4R3FMQBxSg3vtoG45ToH9EBInDW4XDNlz0f5IhQp6sVx sjGkTgdKoWjD6YJBWu4TIJEJ3yIXd8QbT0Taw97XsxAWkHcNHUsyHMCkeTpSsVzE34Io G08Tj8csnuP2gRkibrnq7WD09lJ9jQhWpWEnYjkRj8LoxcNkfHf+Lww/dx73FUd1y+8T rVOV2YvtyZY+5aK0WgKkr99AEmZeIGJTXqztu4AIdpStw6g5sg0qG4NJMoy+DpQYqiN+ qjKg== 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=mOv2aXvy/cTQRcQjfdy8YMCe5wBIO8HMxVf+QakBJKM=; fh=rYI8DiHAAFX3O5g969KmOAQ7d45Sb8OxQX1+DywGDk4=; b=bmNfJg26He/GHml+MjT/fvIKwRPWPau97rr+Q7XmaQ+mBU3MpPOP4uCog5UsdUtm/K nYyEzWNa6INrKwxnU8u4/lXfksG5hkmZbCPk1Xx1bCkV49Beb8awXVsUdvDw97dW99I7 ukyoQPm+jPSpuQcAvZATOY7dM2BWT0moOZ0EHDMmM7g+8QSEKuzna/KlJQZCEE6VeULA 4SCSST4sKqd2+58Curi2dN2hATaOQy/uuoiDoacp78/U2mEQG4Z1owOKAoFKHSbLNxc7 jhmPb/IdNd9tyxMocejkTkbhIs8A+cwvnsWVQ0GXqiGTFWh06HVsxdfg22N5eAlRoahK P1Xg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=gxsVK33z; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as 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 z30-20020a50cd1e000000b00522c0ee05d9si5980064edi.241.2023.10.25.17.27.36 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 25 Oct 2023 17:27:36 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=gxsVK33z; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as 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 1qvoA3-0004dm-6R; Wed, 25 Oct 2023 20:23: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 1qvo9Z-0002JI-Ce for qemu-devel@nongnu.org; Wed, 25 Oct 2023 20:23:14 -0400 Received: from mail-pj1-x1036.google.com ([2607:f8b0:4864:20::1036]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qvo9U-0008EJ-Lk for qemu-devel@nongnu.org; Wed, 25 Oct 2023 20:23:13 -0400 Received: by mail-pj1-x1036.google.com with SMTP id 98e67ed59e1d1-27d3c886671so234756a91.3 for ; Wed, 25 Oct 2023 17:23:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1698279787; x=1698884587; 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=mOv2aXvy/cTQRcQjfdy8YMCe5wBIO8HMxVf+QakBJKM=; b=gxsVK33zrqz50Hie0achCX8XpJCLt0SuPEXNo4wvrGyx8d2F0SSPYurTmfwSFpDD7U RUtpfQ3Nfaq4hewb1neC4kRwfxSNrgW7VVzl75hNbtsj00Yp9krKN2x03rV0G5lfDvme NQ0Xx3zvImMYX77b92Z1B9JWaqCrzu1QJcb7AOTFRaXxpnvYkxRgaIHWBHHYcYH2jJXx 0ZbBrCr8a7jWGipCzg2Vqqg6/RzHPNlPc96cLgtLbko1pWQzzvsN/9bC5HZmY3IbqkT8 gcfuj71W4sCBNiRBUjgg2kE+uBJPlyzpejBk8nx/p5VkVPWoR3+aN2nXjE0sGJeYmtLj cNBg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1698279787; x=1698884587; 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=mOv2aXvy/cTQRcQjfdy8YMCe5wBIO8HMxVf+QakBJKM=; b=VSJDAJKgbtTCUyHslnarcKOrBmvQnanrasT8AT/7DeY9wDjgZytmxIDOi1pHhC4HtY 6fMtyYpk1eN5PQagmf36sG6IV4gQiJnaX2kulYjrLTocS7c0JYtRWuy6ehLeeVsIBA9X 319JESlKEuTfwCzzV1lNkmKFVjni31gNDf/+iJuxZIHeubmrcfFO1aTq3aOflQz7M67F f8Sde1fEMGSy95Yq0eMck6UJYWvKoFik+0kEtAQtJg8Z9ZZV1mAY7/5K2LeIpxPWrQOz JXZpTinPEQR1fKb2BBGQg991q/PucIGJCErg/ueeQ+PjiV2W1NzgkwGAzkiTXvxYmiTi 2y8Q== X-Gm-Message-State: AOJu0YyEEZEkLWmPsOtknjjRRUpl10ktKQT99vbqHc5fbCR3qwOLCNEL GPA4Mp6Riu6jI0XmljD9HV2lACAePt+D/Qzu9aA= X-Received: by 2002:a17:90a:1a52:b0:27f:bd9e:5a10 with SMTP id 18-20020a17090a1a5200b0027fbd9e5a10mr8285510pjl.20.1698279787354; Wed, 25 Oct 2023 17:23:07 -0700 (PDT) Received: from stoup.. ([71.212.149.95]) by smtp.gmail.com with ESMTPSA id 9-20020a17090a0cc900b0027463889e72sm499870pjt.55.2023.10.25.17.23.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 25 Oct 2023 17:23:07 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: Mark Cave-Ayland Subject: [PULL 73/94] target/sparc: Move gen_gsr_fop_DDD insns to decodetree Date: Wed, 25 Oct 2023 17:15:21 -0700 Message-Id: <20231026001542.1141412-103-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231026001542.1141412-1-richard.henderson@linaro.org> References: <20231026001542.1141412-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::1036; envelope-from=richard.henderson@linaro.org; helo=mail-pj1-x1036.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org Move FPACK32, FALIGNDATA, BSHUFFLE. Tested-by: Mark Cave-Ayland Acked-by: Mark Cave-Ayland Signed-off-by: Richard Henderson --- target/sparc/insns.decode | 3 ++ target/sparc/translate.c | 101 ++++++++++++++++++++------------------ 2 files changed, 55 insertions(+), 49 deletions(-) diff --git a/target/sparc/insns.decode b/target/sparc/insns.decode index 42d740ad44..bc449023dd 100644 --- a/target/sparc/insns.decode +++ b/target/sparc/insns.decode @@ -277,9 +277,12 @@ FABSd 10 ..... 110100 00000 0 0000 1010 ..... @r_r2 FMUL8ULx16 10 ..... 110110 ..... 0 0011 0111 ..... @r_r_r FMULD8SUx16 10 ..... 110110 ..... 0 0011 1000 ..... @r_r_r FMULD8ULx16 10 ..... 110110 ..... 0 0011 1001 ..... @r_r_r + FPACK32 10 ..... 110110 ..... 0 0011 1010 ..... @r_r_r PDIST 10 ..... 110110 ..... 0 0011 1110 ..... @r_r_r + FALIGNDATAg 10 ..... 110110 ..... 0 0100 1000 ..... @r_r_r FPMERGE 10 ..... 110110 ..... 0 0100 1011 ..... @r_r_r + BSHUFFLE 10 ..... 110110 ..... 0 0100 1100 ..... @r_r_r FEXPAND 10 ..... 110110 ..... 0 0100 1101 ..... @r_r_r FSRCd 10 ..... 110110 ..... 0 0111 0100 00000 @r_r1 # FSRC1d diff --git a/target/sparc/translate.c b/target/sparc/translate.c index 40ef395d14..197c0bea54 100644 --- a/target/sparc/translate.c +++ b/target/sparc/translate.c @@ -752,6 +752,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) { @@ -1667,22 +1712,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)) { @@ -2720,27 +2749,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) @@ -4889,6 +4897,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)) { @@ -5319,6 +5331,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); @@ -5376,10 +5391,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); @@ -5394,14 +5405,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 Thu Oct 26 00:15: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: 738280 Delivered-To: patch@linaro.org Received: by 2002:adf:f842:0:b0:32d:baff:b0ca with SMTP id d2csp559233wrq; Wed, 25 Oct 2023 17:38:41 -0700 (PDT) X-Google-Smtp-Source: AGHT+IF9UxZqGgiqM2rjBggkb6WMiZTqZHw0xIlfuRKSHU79CAaNfX+k8cph3MJLQpdAk4YEj7fZ X-Received: by 2002:a05:6402:2553:b0:53d:b52a:5f4b with SMTP id l19-20020a056402255300b0053db52a5f4bmr12490184edb.41.1698280721607; Wed, 25 Oct 2023 17:38:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698280721; cv=none; d=google.com; s=arc-20160816; b=SMf+9RUEdcKkfURvVdQGLrRIsd7b/WABZFknyfPlxlrTzI+Bb+1SIQDDA3eHBUMant s2+25dA3RvUMsz3WMhAwZkuR1bX8DyuF7f7nhoe2sU5nzqaZOqX4xiNi23OTJd9EDF1k +ZDA8SrC/vKvIhYk5+pKY8iEg3omzGys4sx1LasHWOta2LDBsD/z+UFX9DAPNnlJ2n6S 7CzAbIuhqhRfjs6opQq7eCwwHV+c/Y2vsPljMZ8b2rWqvUX09wa9hO4EVXHtKbMcRL+v 5Cqmj7o11UNBNoYAWcVFaTSnlY2Kr384AiH5TExCLCTLLMZUll/n1YwbimJZr/SpRHgp TJLw== 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=aiKlYh0ZSQ4q5RqF1EsnIe40ZaI3W0/mpHtSrRjKKnM=; fh=rYI8DiHAAFX3O5g969KmOAQ7d45Sb8OxQX1+DywGDk4=; b=t0xcdlvLDQ6fTM37toa9bz9LgrSso6LkRPm5M+DTjpSM7IdVPvytvkaCzGq+dFjaLj WNBXMiNlmwq8eGN4kPnXeZz30MvlabLD5hzmEDo+wfDocM4GpB0w5y9lSY/5o9z+LqmV ydyZ41lduXDSGjMzKeMZiylCrCApglnZZbxAkX0IgHXfyOviRpK/4fVeJBYFXlalR/3j EWNPsR/rNA4wsJosM5EmTy1Har+HJ2EQ33yVChLTHCVgJGDkRCbE/vD4y58O9x+AVMY6 5qgdfyGqP+4GMZWYm5houwjsTmg2Y8uenKYe0uoRG5O7Z29q40U6sViChHVl5wHveoNl hjgg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=dzcAlT3l; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as 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 v11-20020a056402348b00b005308c42fb56si5885284edc.106.2023.10.25.17.38.41 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 25 Oct 2023 17:38: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=dzcAlT3l; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as 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 1qvoAQ-0006FM-78; Wed, 25 Oct 2023 20:24: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 1qvo9k-0003EF-3X for qemu-devel@nongnu.org; Wed, 25 Oct 2023 20:23:25 -0400 Received: from mail-pj1-x102b.google.com ([2607:f8b0:4864:20::102b]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qvo9X-0008EZ-6d for qemu-devel@nongnu.org; Wed, 25 Oct 2023 20:23:22 -0400 Received: by mail-pj1-x102b.google.com with SMTP id 98e67ed59e1d1-27e1eea2f0dso225771a91.1 for ; Wed, 25 Oct 2023 17:23:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1698279788; x=1698884588; 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=aiKlYh0ZSQ4q5RqF1EsnIe40ZaI3W0/mpHtSrRjKKnM=; b=dzcAlT3l5QTav52QML6cL6OS2kYcUBvXT53gZnqEA3bdEKozs/RHKDjXAB9gTVv8M3 u+nXl29Ve2CLSpr/LdPtuorJggQRI1+jqZ1JeKXPT6wqywQho0W1MZh7f2YJy4H4E5to LNEcqHfsXiobnQT1okVF5cvz/oyxJkBfqOoAgfFwLoIvEs7jaNnSjQaLaX9DU0Y63oV3 Eq9WvaIS7M2L05ExDvhqbLl2SDDnuQFDMKy0glQ1SuU8kvkQpybuRM4na7KizCKPVAIM txQBtUpDCTdBnSk0xSX7gLrFBoEsa1UeVrtsgrArUcCrGYffBvk4NUTtATK5O/TBu1/l Rs8g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1698279788; x=1698884588; 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=aiKlYh0ZSQ4q5RqF1EsnIe40ZaI3W0/mpHtSrRjKKnM=; b=s2C2Xw/R4QiNGT+QZunLWSdyPAQm+AOcm/yhP+eA0OpMnkvvPgLCXyD+SYQzjmbaHq w9YNc0hsmZGxpJqLyezxcODem0IrCOlU/GmrympJLkB1YBthTYeB1V93WzFncHwxdnbA cbmGX+bSQtqjOdIIhn7JNj/qzWrZLHodEXiVIG/b88zNrU1Vt3Zxt47tKqZjE3bLQd6o Fb0YBvKOpkFWMfs/+pJjZj61g3JiLt40jt2YMDE7gxbIFYuwZdxMrEVbWSDvs1MHQ7YG mBy1tDi3jTmJREwuU9qDlb6VJz0Ig7MeWevUD/QIJ4TxLqbmj3X8OlKRj6+G7vZq0PQ8 n48g== X-Gm-Message-State: AOJu0Ywz18T0p0KQ5dezeuKuS8rqCzhJZlXpnnFtfP91TtPpPiUamgHX FSp4SYbHq1TwxlIlPvXjOJRDUTI52rK2TXAQ4ts= X-Received: by 2002:a17:90b:3654:b0:27d:22ed:8e9e with SMTP id nh20-20020a17090b365400b0027d22ed8e9emr13691032pjb.6.1698279788161; Wed, 25 Oct 2023 17:23:08 -0700 (PDT) Received: from stoup.. ([71.212.149.95]) by smtp.gmail.com with ESMTPSA id 9-20020a17090a0cc900b0027463889e72sm499870pjt.55.2023.10.25.17.23.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 25 Oct 2023 17:23:07 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: Mark Cave-Ayland Subject: [PULL 74/94] target/sparc: Move gen_fop_FF insns to decodetree Date: Wed, 25 Oct 2023 17:15:22 -0700 Message-Id: <20231026001542.1141412-104-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231026001542.1141412-1-richard.henderson@linaro.org> References: <20231026001542.1141412-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::102b; envelope-from=richard.henderson@linaro.org; helo=mail-pj1-x102b.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. Tested-by: Mark Cave-Ayland Acked-by: Mark Cave-Ayland Signed-off-by: Richard Henderson --- target/sparc/insns.decode | 3 +++ target/sparc/translate.c | 47 ++++++++++++++++++++------------------- 2 files changed, 27 insertions(+), 23 deletions(-) diff --git a/target/sparc/insns.decode b/target/sparc/insns.decode index bc449023dd..85464285b7 100644 --- a/target/sparc/insns.decode +++ b/target/sparc/insns.decode @@ -245,6 +245,9 @@ FNEGs 10 ..... 110100 00000 0 0000 0101 ..... @r_r2 FNEGd 10 ..... 110100 00000 0 0000 0110 ..... @r_r2 FABSs 10 ..... 110100 00000 0 0000 1001 ..... @r_r2 FABSd 10 ..... 110100 00000 0 0000 1010 ..... @r_r2 +FSQRTs 10 ..... 110100 00000 0 0010 1001 ..... @r_r2 +FiTOs 10 ..... 110100 00000 0 1100 0100 ..... @r_r2 +FsTOi 10 ..... 110100 00000 0 1101 0001 ..... @r_r2 { [ diff --git a/target/sparc/translate.c b/target/sparc/translate.c index 197c0bea54..13932e087d 100644 --- a/target/sparc/translate.c +++ b/target/sparc/translate.c @@ -1654,20 +1654,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)) { @@ -4806,6 +4792,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)) { @@ -4967,10 +4974,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; @@ -5026,9 +5033,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; @@ -5058,9 +5062,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 Thu Oct 26 00:15: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: 738288 Delivered-To: patch@linaro.org Received: by 2002:adf:f842:0:b0:32d:baff:b0ca with SMTP id d2csp559588wrq; Wed, 25 Oct 2023 17:39:49 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEkouGYgBBdznHk/LskmEx6ucep6SpyXxxhTh39+l1Rt3z6aKMvEj3Zx7UG+szBx+S/vDuK X-Received: by 2002:adf:f487:0:b0:31f:ef77:67ee with SMTP id l7-20020adff487000000b0031fef7767eemr14149929wro.40.1698280789303; Wed, 25 Oct 2023 17:39:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698280789; cv=none; d=google.com; s=arc-20160816; b=sQPFBIMDEIAH4o3f5upk76J5paoJSpb9OpHBO5n3oOkCAGvVWL8J4Thtk526w0LVEb kSRQFHttKOiuUrpP16ihSY081P72puUmhn/Tmx+45uK6gV9Xn2b08amDGeKiJnW5cpuR lqZ9hjLFzBDjwcVfnCXitlMb00yPq40ksRA29m3pselGyC3QVP15rzTm6uvJMgU4kA0P 41/GJe+H5on2FZ9N8GRXhNRJqTKN5TTohpnG4BMk/iFZZEPxCCO850sOCeDE1DxbdvSB ulnAaGBuhOZfnY3Ra93IrhMpE1L/idxVqyQhQmWcMtlYhaUnWLcaUd7YNU1X4ae5xodA MZUQ== 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=zFG3LVvfi+A5uqJYCl0wfU1RjeC2BCq05T39q27kqdA=; fh=rYI8DiHAAFX3O5g969KmOAQ7d45Sb8OxQX1+DywGDk4=; b=QHGotG/Wxal/NAvVFfuD13Uu7KOmtFXJGoAkJ7qdNRlMjRxGKjnO8LBTdbA4jVlGGN OJVwBePQffR7mt+AyvhPJqoDyuBIIpYlo6ua0fqCsckPyquvgYsovn4yFDVCA82Uxqxi /BXgutFD0rEtJhwBessmS0DXa/5AFGSg2NoPQMw2HpiiXoHMt3HIPyOeYpKdRAqAlPu1 9W2Im5A4Agu4I2rOKqJHomGqQePUnaCrKl5CtCEE9evVTtTLJRz+x1XXj6pj/TkwjrDP cukXmp8ay+EiaeN8ZdR2IR8aetObBMPQ6i7TE7xcVWpDaPgabv+O2rHjOqYhNgDx3Yve ISYg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=RuVv6tB4; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as 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 s16-20020a5d69d0000000b0032da50f6dffsi8116600wrw.157.2023.10.25.17.39.49 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 25 Oct 2023 17:39: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=RuVv6tB4; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as 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 1qvoA5-0004xJ-UH; Wed, 25 Oct 2023 20:23: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 1qvo9e-0002zc-SQ for qemu-devel@nongnu.org; Wed, 25 Oct 2023 20:23:20 -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 1qvo9W-0008Ev-If for qemu-devel@nongnu.org; Wed, 25 Oct 2023 20:23:18 -0400 Received: by mail-pg1-x529.google.com with SMTP id 41be03b00d2f7-5ac865d1358so301870a12.3 for ; Wed, 25 Oct 2023 17:23:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1698279789; x=1698884589; 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=zFG3LVvfi+A5uqJYCl0wfU1RjeC2BCq05T39q27kqdA=; b=RuVv6tB4dFE8dAvArjZKVjcUg6b8aa6PMJ6c5I6vLpLUUcZoHVcTEb68VDDSoAC9pY jmGGJnGP66o5kOsG6FxBPHAnu0l1YyawvKjyew24o0soDF0hCimr9Zj3Dlr4zk7nIZhM O+IpqstwNkESDpCPhZgEssV0ufPlAip05wWLwXbc7ArpnlGmCB9G4pSkrTfs7ckFlSEQ 0epDhX+8EPNmywyE40s+2QX9gRF70AYmnAJyOtgwAUh+ux3HiOb4ckhQUrKvknLvpKss 6bHyXebYTmV9g2EuDOlTfknI746EvGawWRn8c0FU29NchZgkcnvrymX0Vm+OwAnb1GUN LobQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1698279789; x=1698884589; 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=zFG3LVvfi+A5uqJYCl0wfU1RjeC2BCq05T39q27kqdA=; b=QbBvKnoUemCxbK3jD7BVwXY5uydAeB7BsC/iITwNGhlxy1LTLqWwJElIjWsvlhMD74 YpOSJGA1p67oyxamVZXqBAKtkZ1I46EBlF1Vc/iphwkva7y4QwxjIFXHE+0LBX0JhHAa E+uGNiXxGUlBhDZlioAuxqfuyyEC8AxSFfHhK4wz8CoIDnTzJU0i/D/dOhTCrpHcRD4W NlkxOwvG9CbT06zXX6MEgqYyTbhtFTi9qzXx+eC+gqNoEJr396IcSNh95NdGXAJ7kpVI yJfirLnXhdWrKRiE5FwtWqmT4Ra9U2OVHXa9U0qcNdqf9edsWRz6dAHfirrSmIj8p1+Z K/QA== X-Gm-Message-State: AOJu0YyaM1d6G+oL/zuNiaznBmX47lEqyszZztM6dUMl7VvJpyyAXahw OcZk5FUNubhXdxSXB5SGfEQ03UhhJeSTt/QG2aQ= X-Received: by 2002:a17:90b:2d8d:b0:27d:4ab9:fccb with SMTP id sj13-20020a17090b2d8d00b0027d4ab9fccbmr14930344pjb.5.1698279788983; Wed, 25 Oct 2023 17:23:08 -0700 (PDT) Received: from stoup.. ([71.212.149.95]) by smtp.gmail.com with ESMTPSA id 9-20020a17090a0cc900b0027463889e72sm499870pjt.55.2023.10.25.17.23.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 25 Oct 2023 17:23:08 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: Mark Cave-Ayland Subject: [PULL 75/94] target/sparc: Move gen_fop_DD insns to decodetree Date: Wed, 25 Oct 2023 17:15:23 -0700 Message-Id: <20231026001542.1141412-105-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231026001542.1141412-1-richard.henderson@linaro.org> References: <20231026001542.1141412-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::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, 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 Move FSQRTd, FxTOd, FdTOx. Tested-by: Mark Cave-Ayland Acked-by: Mark Cave-Ayland Signed-off-by: Richard Henderson --- target/sparc/insns.decode | 3 +++ target/sparc/translate.c | 50 +++++++++++++++++++++------------------ 2 files changed, 30 insertions(+), 23 deletions(-) diff --git a/target/sparc/insns.decode b/target/sparc/insns.decode index 85464285b7..1d766fab21 100644 --- a/target/sparc/insns.decode +++ b/target/sparc/insns.decode @@ -246,6 +246,9 @@ FNEGd 10 ..... 110100 00000 0 0000 0110 ..... @r_r2 FABSs 10 ..... 110100 00000 0 0000 1001 ..... @r_r2 FABSd 10 ..... 110100 00000 0 0000 1010 ..... @r_r2 FSQRTs 10 ..... 110100 00000 0 0010 1001 ..... @r_r2 +FSQRTd 10 ..... 110100 00000 0 0010 1010 ..... @r_r2 +FdTOx 10 ..... 110100 00000 0 1000 0010 ..... @r_r2 +FxTOd 10 ..... 110100 00000 0 1000 1000 ..... @r_r2 FiTOs 10 ..... 110100 00000 0 1100 0100 ..... @r_r2 FsTOi 10 ..... 110100 00000 0 1101 0001 ..... @r_r2 diff --git a/target/sparc/translate.c b/target/sparc/translate.c index 13932e087d..307fbc4628 100644 --- a/target/sparc/translate.c +++ b/target/sparc/translate.c @@ -63,6 +63,7 @@ # define gen_helper_write_softint(E, S) qemu_build_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_fdtox ({ qemu_build_not_reached(); NULL; }) # define gen_helper_fexpand ({ qemu_build_not_reached(); NULL; }) # define gen_helper_fmul8sux16 ({ qemu_build_not_reached(); NULL; }) # define gen_helper_fmul8ulx16 ({ qemu_build_not_reached(); NULL; }) @@ -72,6 +73,7 @@ # define gen_helper_fmuld8sux16 ({ qemu_build_not_reached(); NULL; }) # define gen_helper_fmuld8ulx16 ({ qemu_build_not_reached(); NULL; }) # define gen_helper_fpmerge ({ qemu_build_not_reached(); NULL; }) +# define gen_helper_fxtod ({ qemu_build_not_reached(); NULL; }) # define gen_helper_pdist ({ qemu_build_not_reached(); NULL; }) # define FSR_LDXFSR_MASK 0 # define FSR_LDXFSR_OLDMASK 0 @@ -1669,20 +1671,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)) { @@ -4835,6 +4823,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)) { @@ -4977,10 +4987,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); @@ -5085,9 +5095,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); @@ -5095,9 +5102,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 Thu Oct 26 00:15: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: 738299 Delivered-To: patch@linaro.org Received: by 2002:adf:f842:0:b0:32d:baff:b0ca with SMTP id d2csp560406wrq; Wed, 25 Oct 2023 17:42:41 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEmSRRrut6YppH922Gm9hU8YN1nfC2SGcJFvn1xF0UCA/LXc8+vpGGUt5Gsyd8P84UI78Cx X-Received: by 2002:a05:6214:3b84:b0:66d:ad78:130d with SMTP id nf4-20020a0562143b8400b0066dad78130dmr12013792qvb.21.1698280961599; Wed, 25 Oct 2023 17:42:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698280961; cv=none; d=google.com; s=arc-20160816; b=KcgDoPi6rM6ja9C5dnRnPmp+b1JQUxfh6aiwXw6STEnAuBoUxAK/GIj5d834s5ug2g 1TvHv8ntQiie9UtUYBpoSQuCVofPWC62a7gN4AECFeDSylz9Meri/fEthyELX9x0vTmG aKQKlOZVYXdwdNDwf78R7uhw8EPpnVyqavu8xOix6Cr0VB/vzo/bUfFMMnZMfLueXmxo s6dkwYVnUWyMlXRZBDeH+O516bcRnAm7y5surqWh0wXXbBnr1OtU/S8uMbWvI79IXRoC th7HimQxoYmlU8+o54kH1H3P1xCG2HIXespndL4srM+PePmqfPGQG6Q5Wvm8kkKMyIAX /ngA== 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=5r4ilrU9iHcD4mE02FqIHVSwcLuS8iY4OK6WJcyFSZw=; fh=rYI8DiHAAFX3O5g969KmOAQ7d45Sb8OxQX1+DywGDk4=; b=lPkyMK7zAabHlPZoVopPPoP+Gus3G73wuSktDhAIF2FcUCGSeqphCHdhWo5p2jtFcW +2uYcOS6zIaCBFrijuSlCjgTEXxgVKOLZrIGkx8yhOwf1CmPrvbrvD/QsLYRH0Iq3ASu PMc3su+xzeXMhC7o2NhNqpyZUj6sspo98BJpD2AGrIZOL7oohgCqAJY79qgYo++K5rt7 /l+/rb7BvW0ndeLNqbH4tk99vL2YcpTOKTXIRwWsBXiaGfxc6arlezeMttRMy6hkBUD9 TPw3TUBoKwErkSHGEWOBQwCy/9iGoEwFgq71QhJLSaGxwDzH7nlzo4h6HCo/E+fsBPms 5lEg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=WPDZ5QeT; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as 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 di18-20020ad458f2000000b0066d0869c6absi8874223qvb.550.2023.10.25.17.42.41 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 25 Oct 2023 17:42: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=WPDZ5QeT; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as 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 1qvoA4-0004jr-4O; Wed, 25 Oct 2023 20:23: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 1qvo9c-0002tU-Mq for qemu-devel@nongnu.org; Wed, 25 Oct 2023 20:23:19 -0400 Received: from mail-pj1-x1032.google.com ([2607:f8b0:4864:20::1032]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qvo9Y-0008F6-06 for qemu-devel@nongnu.org; Wed, 25 Oct 2023 20:23:16 -0400 Received: by mail-pj1-x1032.google.com with SMTP id 98e67ed59e1d1-27d0251d305so222082a91.2 for ; Wed, 25 Oct 2023 17:23:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1698279789; x=1698884589; 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=5r4ilrU9iHcD4mE02FqIHVSwcLuS8iY4OK6WJcyFSZw=; b=WPDZ5QeTJSaHC/ootlYmbu5YwrjtlKIXVPWaeoWzBPDhCDiEZnJh4vbtp1mmClwsNp 97caF9/hB6rKnc/SoeBrVoijil0GXmVjMcK6mIGiJqKf4M4NsSfZ20ftb0yXBrtKruZ0 OGPNsyead+fgbw87G1OF/4uuSTf65cMRaNra2uTMS2JOc1yFaAM8FZ63uricGfmXtCyc BrP/AS+PXQfmWk68TPW+fId2mBBJUPpLGut6PRkMofwOnKWfLm1hsJaKu4bbXpW8PQ69 Vxzs0j/bTubFWCwSjoV4g1aemNnJzWLBwqYLYUf9eYJnDPObjN7kMrKrbdQNDSx47Owx AYzA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1698279789; x=1698884589; 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=5r4ilrU9iHcD4mE02FqIHVSwcLuS8iY4OK6WJcyFSZw=; b=oOGZ9sZPvd2VGqRpU0Ab2XaZLyP80xxqG/9YNU8c3QCooEVZw9xuhozgwkYGvo8BoU bdID7CNueXbOOa0tBb/K2Kti2bxAJMBQb1JCXmrh8dzSEQjQaYuegCTaEJJ9wEu3lmBU irW95rtG3c7dmBqjjuFPyx+oCqhFGYnla2BBRoq2f9055jIotWCBpOS7JBT8igKjvyWR 8L2gNWnxXA70yO4up2i9rmLRYaGiNQ0wh/Znx7hu/NyBr2YyuOVe1YLe9dq9pSvwhbVB TUlm9SArq+g0Fo98uP/XlvyW0OBABGBa6YHsON6/YftYTBbGIrz1nWa3/RsdMymtUvnp Ul0w== X-Gm-Message-State: AOJu0Yyx8ItSQTBhlH3xL+G2bKiShwEywFHnuMIFv6BmtcYZ5BRa2cPO KmdrUsdKQJuPkuCX0Q3scL+kk4vFPsOoc34/0MU= X-Received: by 2002:a17:90b:2b4d:b0:27d:9b7:cc7 with SMTP id rr13-20020a17090b2b4d00b0027d09b70cc7mr13713260pjb.24.1698279789652; Wed, 25 Oct 2023 17:23:09 -0700 (PDT) Received: from stoup.. ([71.212.149.95]) by smtp.gmail.com with ESMTPSA id 9-20020a17090a0cc900b0027463889e72sm499870pjt.55.2023.10.25.17.23.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 25 Oct 2023 17:23:09 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: Mark Cave-Ayland Subject: [PULL 76/94] target/sparc: Move FSQRTq to decodetree Date: Wed, 25 Oct 2023 17:15:24 -0700 Message-Id: <20231026001542.1141412-106-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231026001542.1141412-1-richard.henderson@linaro.org> References: <20231026001542.1141412-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::1032; envelope-from=richard.henderson@linaro.org; helo=mail-pj1-x1032.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org Tested-by: Mark Cave-Ayland Acked-by: Mark Cave-Ayland Signed-off-by: Richard Henderson --- target/sparc/insns.decode | 1 + target/sparc/translate.c | 38 ++++++++++++++++++++++---------------- 2 files changed, 23 insertions(+), 16 deletions(-) diff --git a/target/sparc/insns.decode b/target/sparc/insns.decode index 1d766fab21..4cb250265d 100644 --- a/target/sparc/insns.decode +++ b/target/sparc/insns.decode @@ -247,6 +247,7 @@ FABSs 10 ..... 110100 00000 0 0000 1001 ..... @r_r2 FABSd 10 ..... 110100 00000 0 0000 1010 ..... @r_r2 FSQRTs 10 ..... 110100 00000 0 0010 1001 ..... @r_r2 FSQRTd 10 ..... 110100 00000 0 0010 1010 ..... @r_r2 +FSQRTq 10 ..... 110100 00000 0 0010 1011 ..... @r_r2 FdTOx 10 ..... 110100 00000 0 1000 0010 ..... @r_r2 FxTOd 10 ..... 110100 00000 0 1000 1000 ..... @r_r2 FiTOs 10 ..... 110100 00000 0 1100 0100 ..... @r_r2 diff --git a/target/sparc/translate.c b/target/sparc/translate.c index 307fbc4628..93efdf3383 100644 --- a/target/sparc/translate.c +++ b/target/sparc/translate.c @@ -1686,18 +1686,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)) @@ -4845,6 +4833,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)) { @@ -4990,11 +4999,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 Thu Oct 26 00:15: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: 738281 Delivered-To: patch@linaro.org Received: by 2002:adf:f842:0:b0:32d:baff:b0ca with SMTP id d2csp559252wrq; Wed, 25 Oct 2023 17:38:44 -0700 (PDT) X-Google-Smtp-Source: AGHT+IE4yXK606cl26iI93hFPwCpE79wttxggkgUWsNuRg6TOIn57v87CdQf8VR5hTvqfXTryiQC X-Received: by 2002:a5d:548c:0:b0:32d:9395:dec2 with SMTP id h12-20020a5d548c000000b0032d9395dec2mr11885205wrv.71.1698280724052; Wed, 25 Oct 2023 17:38:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698280724; cv=none; d=google.com; s=arc-20160816; b=hdhqp61di1veUA1bT3Th1hNxwEl2DdCP1Ey/pR3wllDDu72h20i1LrujrRx7kTiMIm ZUjcfWxlmWDMQsEQ7iyxoZpVmKJW1q0xhGSfBXZwBlOOmCauNORkQkEktLFX0hRHc3EX eIm2DTsyyavWz/pOJAZPxIO0xabrOYTOYhkxUAwSq1ipdWntLizS+B90LaESNtzc+A57 QFbaUfSptbBMw1AWtxtRgPgAY/OCRRjJwUHGLJcAAu4xD5kXvw+OYH2Y4b06GkndCZgr Ntlddepe0zIHlEcF1v/n5vdKuOa9/Ypt1aPSGhaiaS6DmoJd9fTC0jICCWj8KPJj44kW 8LMw== 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=2Vu8uE4u91cXAtlNEMc67KwdFgVsES8vkFmIj+yngHw=; fh=rYI8DiHAAFX3O5g969KmOAQ7d45Sb8OxQX1+DywGDk4=; b=pUEUHEC/JxaDPxWg6/MLwKRByFeAtLasUDMYGZ3APKEbufjaIRau0D4uC32sgp/7Wc jfoJUGSv8AJPZ584ma77KoC0IZ4HaIyZkh50FS+zrtgUWiCIV0eyBamS3qQOZsk+LdPf +T801DbBZZcXo9jMDUzp/M+EN8zCZbIoCmWE08CmZVZ1Frfn5RzMTibxPAZcmztqvW8W EBmsYNUP34SyznMLrrJOJlDbGE9NFfue6whN46NFgPwEPaBq3mRwevbGsPtKpNBiQSeu KKtRUO3s0JzmlOOaatLl4wQnNT5XHjNeO+hTjoTTLoyQNUnHYnaDjUpi11CtUYFyHOHL hKOw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=iFbAkQmY; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as 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 l2-20020adfe9c2000000b0032d9ef6ce33si8111483wrn.752.2023.10.25.17.38.43 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 25 Oct 2023 17:38: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=iFbAkQmY; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as 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 1qvoAc-0006s3-4a; Wed, 25 Oct 2023 20:24:18 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qvo9b-0002mi-03 for qemu-devel@nongnu.org; Wed, 25 Oct 2023 20:23:16 -0400 Received: from mail-pj1-x1034.google.com ([2607:f8b0:4864:20::1034]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qvo9X-0008FL-Qq for qemu-devel@nongnu.org; Wed, 25 Oct 2023 20:23:14 -0400 Received: by mail-pj1-x1034.google.com with SMTP id 98e67ed59e1d1-27d0a173e61so248479a91.0 for ; Wed, 25 Oct 2023 17:23:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1698279790; x=1698884590; 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=2Vu8uE4u91cXAtlNEMc67KwdFgVsES8vkFmIj+yngHw=; b=iFbAkQmYiTlvqNfnQCGrSTy8wkXUqpb/oPDad81H8CTUs/2mbT1vAnkuoCNfjZwzdZ 4ZTFFJVJ8gU6hPoj5IfyZ3hq1DjHw7nRUMR/hnMwfNmpYEwXMVm+dre/fpovFqta0jCi 5FcN4wd8dSpchBNXYVyQ55jyPQJ4HDfpHQHg5Ugxg+x0PdbOXUJ0JUwI2O10nbVoefrO yX1lm3k7ntWo8OmvSEK647tFuoJV6kOuKIT+LYHRSdSN2vAYgzzLHg2LdJuYocdocWo/ 2fiME/CSn5l6MeC6kcqKHLC/iJlZl03qjuLFEl6jPayziJe0R4yMPAsKGsF7ONZqaOnC +SXA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1698279790; x=1698884590; 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=2Vu8uE4u91cXAtlNEMc67KwdFgVsES8vkFmIj+yngHw=; b=o2xzNJrflODygXigyY85Qe0D5mZ+CSHqyBgr+XcgjKq6Yb5JiIUp5wfegSgAN3DLJa HKUbHKH2cauqz+VzVLwq7pOG8FMxVnwPPWSPJ9kmNlsDs9di51NPiQWQEaCds0nXgvST dY44KpKZin9gjSQXitFaVZlF6slANqlqw/R98VA3ZLdfQbez+kbvjByYEJf4JiN9HBjO 9zz2Tx6tJpl3bDU4Ebolo24YN8USvDWUoqxes8sTTorn7z2IxFdtoRCVdnxtIuHOL2ds Cvll/U/SS7qbYqDgNEplBIYbJPJBa0IuMNgLWWlxIo92usle3vGXKg+pwU9xmWF5D0rY ZHkg== X-Gm-Message-State: AOJu0YwRIIUbRe2zNWLFmeUg8O+FO2eVT1lXOPMnjJi2LKtVHD6B6qUP JzpYlVlwvD5JzgcrzF4fuJfLUlMhB5+BynWDOr0= X-Received: by 2002:a17:90a:194b:b0:27d:1ea0:bc84 with SMTP id 11-20020a17090a194b00b0027d1ea0bc84mr13636473pjh.34.1698279790409; Wed, 25 Oct 2023 17:23:10 -0700 (PDT) Received: from stoup.. ([71.212.149.95]) by smtp.gmail.com with ESMTPSA id 9-20020a17090a0cc900b0027463889e72sm499870pjt.55.2023.10.25.17.23.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 25 Oct 2023 17:23:10 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: Mark Cave-Ayland Subject: [PULL 77/94] target/sparc: Move gen_fop_FFF insns to decodetree Date: Wed, 25 Oct 2023 17:15:25 -0700 Message-Id: <20231026001542.1141412-107-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231026001542.1141412-1-richard.henderson@linaro.org> References: <20231026001542.1141412-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::1034; envelope-from=richard.henderson@linaro.org; helo=mail-pj1-x1034.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org Move FADDs, FSUBs, FMULs, FDIVs. Tested-by: Mark Cave-Ayland Acked-by: Mark Cave-Ayland Signed-off-by: Richard Henderson --- target/sparc/insns.decode | 4 +++ target/sparc/translate.c | 54 +++++++++++++++++++-------------------- 2 files changed, 31 insertions(+), 27 deletions(-) diff --git a/target/sparc/insns.decode b/target/sparc/insns.decode index 4cb250265d..09444e313f 100644 --- a/target/sparc/insns.decode +++ b/target/sparc/insns.decode @@ -248,6 +248,10 @@ FABSd 10 ..... 110100 00000 0 0000 1010 ..... @r_r2 FSQRTs 10 ..... 110100 00000 0 0010 1001 ..... @r_r2 FSQRTd 10 ..... 110100 00000 0 0010 1010 ..... @r_r2 FSQRTq 10 ..... 110100 00000 0 0010 1011 ..... @r_r2 +FADDs 10 ..... 110100 ..... 0 0100 0001 ..... @r_r_r +FSUBs 10 ..... 110100 ..... 0 0100 0101 ..... @r_r_r +FMULs 10 ..... 110100 ..... 0 0100 1001 ..... @r_r_r +FDIVs 10 ..... 110100 ..... 0 0100 1101 ..... @r_r_r FdTOx 10 ..... 110100 00000 0 1000 0010 ..... @r_r2 FxTOd 10 ..... 110100 00000 0 1000 1000 ..... @r_r2 FiTOs 10 ..... 110100 00000 0 1100 0100 ..... @r_r2 diff --git a/target/sparc/translate.c b/target/sparc/translate.c index 93efdf3383..d2205f7e7d 100644 --- a/target/sparc/translate.c +++ b/target/sparc/translate.c @@ -1656,21 +1656,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)) { @@ -4883,6 +4868,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)) { @@ -5000,10 +5008,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; @@ -5011,9 +5020,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; @@ -5021,9 +5027,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; @@ -5031,9 +5034,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 Thu Oct 26 00:15: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: 738237 Delivered-To: patch@linaro.org Received: by 2002:adf:f842:0:b0:32d:baff:b0ca with SMTP id d2csp555643wrq; Wed, 25 Oct 2023 17:28:02 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEQ182mavrpEb5E8jQKLJNi0Bb52Du2uwsy+oZy6MrnYpIP4B3W5CbDVDhWVISGM4224/SO X-Received: by 2002:a5d:498b:0:b0:32d:af58:b4e9 with SMTP id r11-20020a5d498b000000b0032daf58b4e9mr13303993wrq.24.1698280082220; Wed, 25 Oct 2023 17:28:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698280082; cv=none; d=google.com; s=arc-20160816; b=dKwBjZUSS5hdWHd29LXtTA59ShKw0iGiUK0RWJC85DunSeA2Jx0qObryUVVblQqYu9 9V57/f1GdnB9e4gEsruPCuzLAXPgAV2VQkjjXr8fQJ6AOaMgNTZrZEUG1QuKh3dTzQ5/ UWMWneouzo+Vty2P3St9mFWQs/P1cZEqTzHM/AplFZ6cedCxxPMYVCFw6tTJ3fB+2/ws dSMm0+pPAHV+PYC92hHeEAQUWra7ADEEmvBKkMvq7tyfm9rJp/hp+yoHoJQUEdxqLt8r 4/FKkm9RsJbXp8IToe9dA5Nh8lGsOEMGXI/ziwk5/ilB/Pz+IeyuKoDFQiMWxPZ+6HK+ 9MZQ== 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=llQJzbUwM11Tola+ykfL4GeM3KHqjJx/kOe5B4gTN/o=; fh=rYI8DiHAAFX3O5g969KmOAQ7d45Sb8OxQX1+DywGDk4=; b=lzyg+sLW+3EhDtFQ8JefHe3aGB4cZsoOW3Dk3wGRAM7EZ358wFziF9VU20e7cTMYJo t52ADZ10zKE01aQkICyvE4Fba1iuW69ZqVfQPp9UygENKVQHNkW9Q507MbkfNq7PzMdS v2R2uRWuRnTDbDyqF4Ga3Gx7ppHNsC+pd3e7ujPFyYspqlKnBlR6Wnmjz8J0RNt9SsfW 4OM2n1ZhL19yDqiQ/bGw+s35vyUvdkMeQOlqn7F3IkSQbJAigzErY2htCA9R/lrYS711 dngIpGvu9fXyaAnssuALvwn6GOfrd+WpwP7ylIR1UGYi4z08F2Hs0WNHOz2TC6ECTRGP Cj4g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=VlTYy12W; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as 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 f17-20020adff451000000b0032482ff69ddsi8053256wrp.57.2023.10.25.17.28.02 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 25 Oct 2023 17:28: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=VlTYy12W; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as 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 1qvo9z-0003pd-T7; Wed, 25 Oct 2023 20:23: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 1qvo9f-00030r-Eu for qemu-devel@nongnu.org; Wed, 25 Oct 2023 20:23:20 -0400 Received: from mail-pj1-x1033.google.com ([2607:f8b0:4864:20::1033]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qvo9Z-0008Fi-R1 for qemu-devel@nongnu.org; Wed, 25 Oct 2023 20:23:19 -0400 Received: by mail-pj1-x1033.google.com with SMTP id 98e67ed59e1d1-27cfb84432aso240097a91.2 for ; Wed, 25 Oct 2023 17:23:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1698279791; x=1698884591; 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=llQJzbUwM11Tola+ykfL4GeM3KHqjJx/kOe5B4gTN/o=; b=VlTYy12WC47e+z9K/+Fwn1TP665jxWaUUIU/PcwdsxXi6yqmpL6WpDnSsjiJ/47xxf H3zFKeoEsE6pWO28OF6H9cRhnhfxbakWsog2JAEn4msgxswwX5EPqsfCp2jkjROIHUxd dpuRzBnZliL0sCpRLhlj+gX0b6xDxCTIlc5V8AFhRW3P8Mlr5+21kNXIg4T896PRAV4d eOeIg1md0uks3NY0Pn6pT5dZUkXQHNmFSWSKh8PWj2tdhdGg5vyO/q+Df4wTAeS+rWEQ o95IYwN2DJF/JGISikGvbPaiIey4AEOSrj21Pwc5OqnkxMbU9VcShyUE78HxLdPir4cR iOeg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1698279791; x=1698884591; 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=llQJzbUwM11Tola+ykfL4GeM3KHqjJx/kOe5B4gTN/o=; b=kRVFUjHS8k34+BbF25GI4kBZU+YQ8ZRIQCrcJnLx2pZ0LPVX1sSEQrfUiYhPqUyuCV k4o/KNC732mxpG+UYiNyzgCY/rxinER4tQlttosDcQWZZuKbceSgXwAVm2pqW0Bnvz7M BgGkgOqV4krwQf2AOohSOpXfXA3242x2S+ayHgFtNpHjoia6UsaNBrIVeZ8AXehB4K9h jquxfB8zyUQMM5dAoJWTuSgXlIrkKbzN9T7aylkKJSOhboKIMh+T9262xqFhaZi7IhrW Pk4O1L103QZs5YvUWry537LA3GfJEUmdT1DRknHStORsNUr4//UN5xFgibal7rvCsDQy vQ+g== X-Gm-Message-State: AOJu0YzyCzOeYWBmreu5QAMwhNbNlzRp2gz74lyuMzylJTE21la7xv3d tgcjmc1RRIlCGOMLXprof7UJaPrelHLgNCcZy3U= X-Received: by 2002:a17:90b:1c82:b0:27f:df1e:198e with SMTP id oo2-20020a17090b1c8200b0027fdf1e198emr3162634pjb.26.1698279791336; Wed, 25 Oct 2023 17:23:11 -0700 (PDT) Received: from stoup.. ([71.212.149.95]) by smtp.gmail.com with ESMTPSA id 9-20020a17090a0cc900b0027463889e72sm499870pjt.55.2023.10.25.17.23.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 25 Oct 2023 17:23:10 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: Mark Cave-Ayland Subject: [PULL 78/94] target/sparc: Move gen_fop_DDD insns to decodetree Date: Wed, 25 Oct 2023 17:15:26 -0700 Message-Id: <20231026001542.1141412-108-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231026001542.1141412-1-richard.henderson@linaro.org> References: <20231026001542.1141412-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::1033; envelope-from=richard.henderson@linaro.org; helo=mail-pj1-x1033.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org Move FADDd, FSUBd, FMULd, FDIVd. Tested-by: Mark Cave-Ayland Acked-by: Mark Cave-Ayland Signed-off-by: Richard Henderson --- target/sparc/insns.decode | 4 +++ target/sparc/translate.c | 55 ++++++++++++++++++++------------------- 2 files changed, 32 insertions(+), 27 deletions(-) diff --git a/target/sparc/insns.decode b/target/sparc/insns.decode index 09444e313f..a429c04980 100644 --- a/target/sparc/insns.decode +++ b/target/sparc/insns.decode @@ -249,9 +249,13 @@ FSQRTs 10 ..... 110100 00000 0 0010 1001 ..... @r_r2 FSQRTd 10 ..... 110100 00000 0 0010 1010 ..... @r_r2 FSQRTq 10 ..... 110100 00000 0 0010 1011 ..... @r_r2 FADDs 10 ..... 110100 ..... 0 0100 0001 ..... @r_r_r +FADDd 10 ..... 110100 ..... 0 0100 0010 ..... @r_r_r FSUBs 10 ..... 110100 ..... 0 0100 0101 ..... @r_r_r +FSUBd 10 ..... 110100 ..... 0 0100 0110 ..... @r_r_r FMULs 10 ..... 110100 ..... 0 0100 1001 ..... @r_r_r +FMULd 10 ..... 110100 ..... 0 0100 1010 ..... @r_r_r FDIVs 10 ..... 110100 ..... 0 0100 1101 ..... @r_r_r +FDIVd 10 ..... 110100 ..... 0 0100 1110 ..... @r_r_r FdTOx 10 ..... 110100 00000 0 1000 0010 ..... @r_r2 FxTOd 10 ..... 110100 00000 0 1000 1000 ..... @r_r2 FiTOs 10 ..... 110100 00000 0 1100 0100 ..... @r_r2 diff --git a/target/sparc/translate.c b/target/sparc/translate.c index d2205f7e7d..e2bcb3c7b1 100644 --- a/target/sparc/translate.c +++ b/target/sparc/translate.c @@ -1656,21 +1656,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)) @@ -4935,6 +4920,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)) { @@ -5012,31 +5021,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 Thu Oct 26 00:15: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: 738298 Delivered-To: patch@linaro.org Received: by 2002:adf:f842:0:b0:32d:baff:b0ca with SMTP id d2csp560403wrq; Wed, 25 Oct 2023 17:42:41 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGikz0AKbv9D7zVgWCfQl/JzZFuV/TteWVXZvOIC8FnLIHxMYJEEJQ7BEDlUd8i9FLTHg4R X-Received: by 2002:a05:6214:d6f:b0:66d:57ca:fa59 with SMTP id 15-20020a0562140d6f00b0066d57cafa59mr19272103qvs.37.1698280961030; Wed, 25 Oct 2023 17:42:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698280961; cv=none; d=google.com; s=arc-20160816; b=RsOy/XJiHU9YgVizxHFYTY7qj775MCIkcNe5jhV+iT7gwjXJKX2mY3xvCMfuBWguP3 CLMmu+Z25iPRZD/kXTp39iaWUAc0BW9qOhnWHw5/R9f8Clxd0kjuuGUqEf0vJ6VicrQ6 9qna7adLOvr4grku5zPGLtxhDxEHHoeKbc25f8M0PqYf+TGgXhAIY8XCCXqYGgie0+cJ HCM/uRfagK5IicuFG0Pu4+cmHnbOotuqIE2IUVPLtIqSyRz8Hz6YK89V25cS+TbAgSyu 1zDud89phd1LvsdiNzWRQk2+zbF4ECHc+kF7rC13dLWsqTB1fOMj8TexitdChrQOJ3dc 6vGg== 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=mjRWjnlqByQklHOKc+9sawwOVbp/u1JMPPydsIJPquk=; fh=rYI8DiHAAFX3O5g969KmOAQ7d45Sb8OxQX1+DywGDk4=; b=yk5ZKsevNILN86KYirwfEL4/BBIES24qTTM1NcE7taJDpIIRjPH+Hm6IvXrHbtkOwB yDn/6+eH3+im+Co8CcoB7gnTl987/1szmUG4qLdVLAAbu2E1DySairBIZjZOYPjeHTrN KY3DxOr6jIRKRMsq4u09LNs5ddXDaTdVGku68dd88kMu0YAy5JbflsNDglu1NrbqWQ6w JJTAkotdMnJ0iQl+UsyuW68Mh6CEEvwx0bhXfTyGwRD89so+25KWpb/+O526mcBVQZmc uM93DTWTqEzOYpfO/MepfgU/dlYG2l1SzGyWSNg8GQdTrYtHLY1IaWvLShF+xQSfv0u1 /GFw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=nGusn1v0; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as 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 na9-20020a0562142d4900b0066cf6670c75si9600996qvb.433.2023.10.25.17.42.40 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 25 Oct 2023 17:42: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=nGusn1v0; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as 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 1qvo9x-0003g0-JR; Wed, 25 Oct 2023 20:23:37 -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 1qvo9f-00030L-BZ for qemu-devel@nongnu.org; Wed, 25 Oct 2023 20:23:20 -0400 Received: from mail-pj1-x102d.google.com ([2607:f8b0:4864:20::102d]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qvo9Z-0008Ft-9V for qemu-devel@nongnu.org; Wed, 25 Oct 2023 20:23:18 -0400 Received: by mail-pj1-x102d.google.com with SMTP id 98e67ed59e1d1-27d113508bfso235866a91.3 for ; Wed, 25 Oct 2023 17:23:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1698279792; x=1698884592; 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=mjRWjnlqByQklHOKc+9sawwOVbp/u1JMPPydsIJPquk=; b=nGusn1v0FsFwyC6/xWst6bTMtxRZG3RcP7DKHxeMHCR5yevQihbdm199YRAZHsYzNU Cm2UPyj/819TIs/ls0RBVg+XjgWSTbXQxKuexzkOZJPTR2Lsjsns4tQv6ii0U6uZw4Tv OIeEKVfKl4p24S/enzbju9AMsD7Kl82ozQbYBnDDqzaFexyyZECJdarwevyKFMfWVdwa 66xuZjsaWPJHpJvo3yl05EnfryjIhTlaAscaXpJUdq+eGOtP0XSXQznh1gm2dFHoKc5+ UiSzsUs8dHVig2TnWgz2bAs8wlx7eGmn0oyto2Z6WLn62GqZNLkuvSNKQC7aN0YiMbVq MjNg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1698279792; x=1698884592; 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=mjRWjnlqByQklHOKc+9sawwOVbp/u1JMPPydsIJPquk=; b=ppovui9uEf554G/ZJrV6FbW7naBpNOYKB75tnwHDe7BSFCRtv5ueGNJsU+tdENwMA5 56TKJoIHD1jYL7riP1a0IrMqIqf4imqV/Et67juh3y5BT13Q/G0A+Wynxt8yfGfPUjPC 4n2AaQe5e33YGKmSYWKSq/QK9Ph31YhqsOcFDeFaGaWpT6RsqnsIn05NVa/S4b/fdXSw sqwvURPGDmylNOsptZzeSDhUfpaSFh4sH2LS48SysyuoNtzxSzg+DRko6z37RLszhu0K rPo0PEBrPBNwWdI9TGWR+aey71BBge5/13vNJkLiRyDH6fWiwuQbloNwxb6DAs6KDNqF PpvQ== X-Gm-Message-State: AOJu0Yw0A9VMBEllrQkVhSpqU67zhfvUhyfzFKeSKPDzTLlzHwSIckK7 OUzzlA2MuiOcYQghZuNKWDGoMX+3K9O2tq5ZriE= X-Received: by 2002:a17:90b:3c0d:b0:27d:29f6:79e0 with SMTP id pb13-20020a17090b3c0d00b0027d29f679e0mr17840829pjb.17.1698279792039; Wed, 25 Oct 2023 17:23:12 -0700 (PDT) Received: from stoup.. ([71.212.149.95]) by smtp.gmail.com with ESMTPSA id 9-20020a17090a0cc900b0027463889e72sm499870pjt.55.2023.10.25.17.23.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 25 Oct 2023 17:23:11 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: Mark Cave-Ayland Subject: [PULL 79/94] target/sparc: Move gen_fop_QQQ insns to decodetree Date: Wed, 25 Oct 2023 17:15:27 -0700 Message-Id: <20231026001542.1141412-109-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231026001542.1141412-1-richard.henderson@linaro.org> References: <20231026001542.1141412-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::102d; envelope-from=richard.henderson@linaro.org; helo=mail-pj1-x102d.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. Tested-by: Mark Cave-Ayland Acked-by: Mark Cave-Ayland Signed-off-by: Richard Henderson --- target/sparc/insns.decode | 4 +++ target/sparc/translate.c | 52 +++++++++++++++++++-------------------- 2 files changed, 30 insertions(+), 26 deletions(-) diff --git a/target/sparc/insns.decode b/target/sparc/insns.decode index a429c04980..f18fd99476 100644 --- a/target/sparc/insns.decode +++ b/target/sparc/insns.decode @@ -250,12 +250,16 @@ FSQRTd 10 ..... 110100 00000 0 0010 1010 ..... @r_r2 FSQRTq 10 ..... 110100 00000 0 0010 1011 ..... @r_r2 FADDs 10 ..... 110100 ..... 0 0100 0001 ..... @r_r_r FADDd 10 ..... 110100 ..... 0 0100 0010 ..... @r_r_r +FADDq 10 ..... 110100 ..... 0 0100 0011 ..... @r_r_r FSUBs 10 ..... 110100 ..... 0 0100 0101 ..... @r_r_r FSUBd 10 ..... 110100 ..... 0 0100 0110 ..... @r_r_r +FSUBq 10 ..... 110100 ..... 0 0100 0111 ..... @r_r_r FMULs 10 ..... 110100 ..... 0 0100 1001 ..... @r_r_r FMULd 10 ..... 110100 ..... 0 0100 1010 ..... @r_r_r +FMULq 10 ..... 110100 ..... 0 0100 1011 ..... @r_r_r FDIVs 10 ..... 110100 ..... 0 0100 1101 ..... @r_r_r FDIVd 10 ..... 110100 ..... 0 0100 1110 ..... @r_r_r +FDIVq 10 ..... 110100 ..... 0 0100 1111 ..... @r_r_r FdTOx 10 ..... 110100 00000 0 1000 0010 ..... @r_r2 FxTOd 10 ..... 110100 00000 0 1000 1000 ..... @r_r2 FiTOs 10 ..... 110100 00000 0 1100 0100 ..... @r_r2 diff --git a/target/sparc/translate.c b/target/sparc/translate.c index e2bcb3c7b1..94ad75b897 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_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)) { @@ -4964,6 +4951,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; @@ -5025,23 +5037,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 Thu Oct 26 00:15: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: 738227 Delivered-To: patch@linaro.org Received: by 2002:adf:f842:0:b0:32d:baff:b0ca with SMTP id d2csp555067wrq; Wed, 25 Oct 2023 17:26:12 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEUmVyd/OhPVtjq2hjkqlWDOZr/PlcKXysh29v+fg1rorBx2tMvsPYrRZSOTPza0ZEXsHNU X-Received: by 2002:a1c:6a08:0:b0:406:52f1:7e6f with SMTP id f8-20020a1c6a08000000b0040652f17e6fmr14211440wmc.12.1698279972077; Wed, 25 Oct 2023 17:26:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698279972; cv=none; d=google.com; s=arc-20160816; b=azWzhXtmAoTKvHKn+Jwrij5bOHPxZL+dzxGR5KdpDzqWgiIQgZM5wBBuceoGqXQrMd F6dR7FiOj279wbh369etwbWLhdhFIU2v5wQ6WVVdagl7CNRrz9WYsnIUbtU+p6ZdbkY1 yMICrRhMzG8ZMU8tgmdHtvab9ok5xwfNGY56Bn8Nd95cXLpiN1tO2Onaj+6UNkwkuT9D 1gB8/EWInxBxkj62hK4v09RG6KzPjY3jPSYza0bpa8Bl9EpyoBJm8sbH2JeRtdBIVsnd 4MyorkUqVBMyT+sDViPGfjhhC5OVNXsyR0NcUrbUn9kvR3608Kyf6PUrc9ICehE+a5iO 5nsQ== 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=Igz27nAt1G4kcSZCVnTvSOQq2ldt0OLkmfH9kT7xTEQ=; fh=rYI8DiHAAFX3O5g969KmOAQ7d45Sb8OxQX1+DywGDk4=; b=cGhJkGt32cReXcBsVqMX2VWXu2sk5/SVkxBB4f0Q6HJczYOEvmnpOS3+jjn3dqMtgZ cJgXpova5PJq1/gIGqhucIMy8hK1yEyTqAchlQAXydOFW8L72M/YXyXX6M8w1NItfJx3 evb85Ia6M8Re5UK+qCYkNgVe8BxWMqZ33ME+uU62FY4dYMR/VPK8q+ZcplKrtH3wUP0s komD46MNCqefUhFazGUVtZlnOFCIfMtQIrePPGC9S5ow6L/ddj1hgG3RzORzzd71tq4o y/YSSWGlSBj2c3KtoPQTrPxHSiwjdjF9NbYycYDp0f8lGn/N3UMiw0z38Aw0ooggPLOe CRNg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=B1SP3Ha7; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as 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 hg26-20020a05600c539a00b004083c9e5a4csi789494wmb.114.2023.10.25.17.26.11 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 25 Oct 2023 17:26: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=B1SP3Ha7; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as 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 1qvoAG-00063r-Of; Wed, 25 Oct 2023 20:23: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 1qvo9g-00033s-MV for qemu-devel@nongnu.org; Wed, 25 Oct 2023 20:23:21 -0400 Received: from mail-pj1-x1034.google.com ([2607:f8b0:4864:20::1034]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qvo9Z-0008G0-UH for qemu-devel@nongnu.org; Wed, 25 Oct 2023 20:23:20 -0400 Received: by mail-pj1-x1034.google.com with SMTP id 98e67ed59e1d1-27d4b280e4eso219803a91.1 for ; Wed, 25 Oct 2023 17:23:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1698279792; x=1698884592; 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=Igz27nAt1G4kcSZCVnTvSOQq2ldt0OLkmfH9kT7xTEQ=; b=B1SP3Ha7pj7SXx517FwGyw60E1Dq8TRR3UMfXReVznf6getWdawLEEGSVn+V4CTF1y dc0J3nEMioXhk1M1nXFb5OmbaD1BLdxeRM5qyfObGs+AMllG8y/CekDIBhAwF/lyUy/O 2eSgKDIxJTwoS6OnIQ8tDP1ibavf2pnL0P5a4mXYbfk2D5+wB+IaC9+gytNHmIbCJkdw GBmfJUjxSQ7n6ZX3VLhQMq6NHH72om4FbYOBzWl8eu04PY0+CcZB63GmIK9EEe3jNt3x mcPCFlUfQrlI2IVsrggnN0Z3JqPY7OdJ5RodZC2HAOikeLvL9xjwZozqc/39oqJhK8hl c9Jg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1698279792; x=1698884592; 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=Igz27nAt1G4kcSZCVnTvSOQq2ldt0OLkmfH9kT7xTEQ=; b=NurUcrQAL+RiXSowuZcovHgHPHHbvl5sGKYafKup7IwEdyfZTyk+yLsRbFhiw457bH 0RsAI/HG3IqN9WroE/8GOkdQzL3HfpRmmW9Cs0iMf1P1rqkPWZ1J5qkwcUHdq1MbNto3 G1Ho7/ODv1uwuqtIOK2DcV4TS+1xfSy1cDRqRTLieSoh2OEWMa8JFNTE4HGQYRIF+06Z z1Dm+1T6EdMDPMLMczPOVDWqgUyZcagy1Mn8myHNYKfcVcwffiYwFSjEvQrfnrhGzRs7 k7KZuvzM+z6rWyfvgcqji8MRGFyApnWz792dpoVPDp811UZcsM9PHt2Zdp0x1CSm3Mv4 47xA== X-Gm-Message-State: AOJu0YyOW27FSsKf2Imykf1QXBHgnqwQ6iVW4x8PNab9eDmogCiaPcbC PiPJfUPglF6W8HHMDTP8x32KmWlR7eBHT992KqQ= X-Received: by 2002:a17:90a:b396:b0:27c:ecec:8854 with SMTP id e22-20020a17090ab39600b0027cecec8854mr1512703pjr.7.1698279792688; Wed, 25 Oct 2023 17:23:12 -0700 (PDT) Received: from stoup.. ([71.212.149.95]) by smtp.gmail.com with ESMTPSA id 9-20020a17090a0cc900b0027463889e72sm499870pjt.55.2023.10.25.17.23.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 25 Oct 2023 17:23:12 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: Mark Cave-Ayland Subject: [PULL 80/94] target/sparc: Move FSMULD to decodetree Date: Wed, 25 Oct 2023 17:15:28 -0700 Message-Id: <20231026001542.1141412-110-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231026001542.1141412-1-richard.henderson@linaro.org> References: <20231026001542.1141412-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::1034; envelope-from=richard.henderson@linaro.org; helo=mail-pj1-x1034.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org Tested-by: Mark Cave-Ayland Acked-by: Mark Cave-Ayland Signed-off-by: Richard Henderson --- target/sparc/insns.decode | 1 + target/sparc/translate.c | 43 +++++++++++++++++++++------------------ 2 files changed, 24 insertions(+), 20 deletions(-) diff --git a/target/sparc/insns.decode b/target/sparc/insns.decode index f18fd99476..6817d52ca2 100644 --- a/target/sparc/insns.decode +++ b/target/sparc/insns.decode @@ -260,6 +260,7 @@ FMULq 10 ..... 110100 ..... 0 0100 1011 ..... @r_r_r FDIVs 10 ..... 110100 ..... 0 0100 1101 ..... @r_r_r FDIVd 10 ..... 110100 ..... 0 0100 1110 ..... @r_r_r FDIVq 10 ..... 110100 ..... 0 0100 1111 ..... @r_r_r +FsMULd 10 ..... 110100 ..... 0 0110 1001 ..... @r_r_r FdTOx 10 ..... 110100 00000 0 1000 0010 ..... @r_r2 FxTOd 10 ..... 110100 00000 0 1000 1000 ..... @r_r2 FiTOs 10 ..... 110100 00000 0 1100 0100 ..... @r_r2 diff --git a/target/sparc/translate.c b/target/sparc/translate.c index 94ad75b897..6626042776 100644 --- a/target/sparc/translate.c +++ b/target/sparc/translate.c @@ -1669,22 +1669,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)) { @@ -4931,6 +4915,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)) { @@ -5041,11 +5047,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 Thu Oct 26 00:15: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: 738286 Delivered-To: patch@linaro.org Received: by 2002:adf:f842:0:b0:32d:baff:b0ca with SMTP id d2csp559501wrq; Wed, 25 Oct 2023 17:39:35 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFOLKTIknjEunSxmM6hAGneFfcfj95Pn6xdL0AIKFZbZiHwUZU4fLbdi/bCkuj2K25Gf46l X-Received: by 2002:a05:600c:4708:b0:408:5919:5f97 with SMTP id v8-20020a05600c470800b0040859195f97mr11015783wmo.25.1698280775132; Wed, 25 Oct 2023 17:39:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698280775; cv=none; d=google.com; s=arc-20160816; b=C91YG7u5XeXnCICwcVpaqG99i+JNWKi+L2Qng6TRK9NQc2VxUK+yJt8s3H+tS4oMn/ m6uhJ4tgodRN4cwXr2xTrKiVNTiLNz+lDLEDC5l1qR6h0e79n55J6yYmBKeyUYonibQs TLfxgJIXBsMwZ+HZ5txG1xE0wXJ/fmZMfinqWyZZ1294BetxiwTTnRpG42pmnB1mjoZg q/DyxuX2LI1FlYubu4uU1dX+Yv4dOsAX7+/8ZBrjSNQ3A67JyxA/xjSvqILmqT5bMJQA d+CeySqXFSoNqhWutqAyAhPctg8eYQXJQOGdSkEEu3rQWuSRDMBcgMojH9fTnnN8pWy7 cMJg== 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=82K7Y1lkn8cxFHk/aj1abheMJJJzCXuFVAOpX84t3dE=; fh=rYI8DiHAAFX3O5g969KmOAQ7d45Sb8OxQX1+DywGDk4=; b=rvFhZhuGLE2XkuKS5xrRAbr2ySKqHnigfK0gwUFJdnQgM/TaRLRF0K6KyH6+uPUuFQ l60Y2e/vzJZimLWvAQXFQGKJECdYtOTO9mXtf9aiUPkNgBgGrGK1Gr91hEwzZ1o13sgj MF5FrWBYjrJNcZyVVoZH4i+BCJDhn1aKXHkF1AP4MWffPDy+vmVO4lSTQ/c0U9DAd5MR m4ledHgf2POWaOGlDUNhJe0Z+NHp9HXhL6L74z/FDZWxPrXKt8VLA8oc3eywuuNI22NZ xtl0e3W8XddD5i2NV8CmkfHhmNKnP/f4hDQklft6vEXpnJyYwSqhZoMZfvC2HEKC8Ppb wn6w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="qXXQm/VJ"; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as 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-20020a5d668e000000b0032daa649a34si8087820wru.492.2023.10.25.17.39.35 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 25 Oct 2023 17:39: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="qXXQm/VJ"; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as 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 1qvoA5-0004uF-NB; Wed, 25 Oct 2023 20:23: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 1qvo9g-000343-Nt for qemu-devel@nongnu.org; Wed, 25 Oct 2023 20:23:22 -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 1qvo9b-0008GG-1G for qemu-devel@nongnu.org; Wed, 25 Oct 2023 20:23:20 -0400 Received: by mail-pg1-x530.google.com with SMTP id 41be03b00d2f7-565e54cb93aso302216a12.3 for ; Wed, 25 Oct 2023 17:23:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1698279793; x=1698884593; 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=82K7Y1lkn8cxFHk/aj1abheMJJJzCXuFVAOpX84t3dE=; b=qXXQm/VJuc+K2SaNhwFfB+8az7cAEviCEwYd/ogt3eSLsgSaBd0Sf3IGM7GnIHwmEm d2xyYkFl9rx0S0SzM+E6XgLxr1graZDyPvmmqBJhkur2qpynM0F+4TEWH0bUiEvDen9u dE8zUghLSG6iJRkxN9btYjn/FsTn2WLlSXqBjeKp1WpZMWrIjwGnEO3EEPkdMSsaCXaC L7R+JOjbFk3Mxh52t+Paw8HfApctdP0oBA3SnpZr9Kfu8xbodS8h623VllVbLTwe2D21 Xk2lrziBXzc4hllhe4hNHXxGXptRVU4uw/qaYwGelvDXgu3TfAYoEgyE9Hpi0wuNZ/c6 UAGg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1698279793; x=1698884593; 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=82K7Y1lkn8cxFHk/aj1abheMJJJzCXuFVAOpX84t3dE=; b=Zsy+4AqucRFdiHI2Zo+fLvv6TCwqe1uGquxlsl+Z+NBACMtJcwtdEJudzEgoTcmFU3 gzagjT6W1lqRUtCeWF1T0EsF8EPZn8DOiCUUc++en30iJFY5JEfX5XEJYefUWSSd9lkm sg3kHmM/WUGONEEmpHB07Ke1FG88gMBcZctl6DDAXpz3G46ZCcUXkws0MjyCSVCGgfea fduPQgPul17JHrSxq+VUyi89IV0L7f06rhE8CaE7Wb4wgp+f5v+w6Pwe4RP3wVVp+pcO YluL3GxXXDoIo4kH5vR2BDwLWUYwFgwwIZsv9yMfpB7iQL9ctTo/20jdF26PC/Lsgl/a EAeg== X-Gm-Message-State: AOJu0YytOhBS4RkFJl76Ygufzw5CVk13PHpqTf2kv/h7/C80V+XfYWzB 1i4oRaAz7X4EwSCfXClWRChZbceChm8cajwLJ1E= X-Received: by 2002:a05:6a21:3b44:b0:14e:a1f0:a8ea with SMTP id zy4-20020a056a213b4400b0014ea1f0a8eamr6524053pzb.3.1698279793472; Wed, 25 Oct 2023 17:23:13 -0700 (PDT) Received: from stoup.. ([71.212.149.95]) by smtp.gmail.com with ESMTPSA id 9-20020a17090a0cc900b0027463889e72sm499870pjt.55.2023.10.25.17.23.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 25 Oct 2023 17:23:13 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: Mark Cave-Ayland Subject: [PULL 81/94] target/sparc: Move FDMULQ to decodetree Date: Wed, 25 Oct 2023 17:15:29 -0700 Message-Id: <20231026001542.1141412-111-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231026001542.1141412-1-richard.henderson@linaro.org> References: <20231026001542.1141412-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::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 Tested-by: Mark Cave-Ayland Acked-by: Mark Cave-Ayland Signed-off-by: Richard Henderson --- target/sparc/insns.decode | 1 + target/sparc/translate.c | 41 +++++++++++++++++++++------------------ 2 files changed, 23 insertions(+), 19 deletions(-) diff --git a/target/sparc/insns.decode b/target/sparc/insns.decode index 6817d52ca2..a19d191603 100644 --- a/target/sparc/insns.decode +++ b/target/sparc/insns.decode @@ -261,6 +261,7 @@ FDIVs 10 ..... 110100 ..... 0 0100 1101 ..... @r_r_r FDIVd 10 ..... 110100 ..... 0 0100 1110 ..... @r_r_r FDIVq 10 ..... 110100 ..... 0 0100 1111 ..... @r_r_r FsMULd 10 ..... 110100 ..... 0 0110 1001 ..... @r_r_r +FdMULq 10 ..... 110100 ..... 0 0110 1110 ..... @r_r_r FdTOx 10 ..... 110100 00000 0 1000 0010 ..... @r_r2 FxTOd 10 ..... 110100 00000 0 1000 1000 ..... @r_r2 FiTOs 10 ..... 110100 00000 0 1100 0100 ..... @r_r2 diff --git a/target/sparc/translate.c b/target/sparc/translate.c index 6626042776..29643768e1 100644 --- a/target/sparc/translate.c +++ b/target/sparc/translate.c @@ -1669,21 +1669,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)) @@ -4982,6 +4967,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; @@ -5048,11 +5054,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 Thu Oct 26 00:15: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: 738300 Delivered-To: patch@linaro.org Received: by 2002:adf:f842:0:b0:32d:baff:b0ca with SMTP id d2csp560423wrq; Wed, 25 Oct 2023 17:42:48 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFDtbbJ9z95dRn3GBeDnIemHW8h5vl4K4oMKNzSpkNvsCbgao3819aTkEYSXzoY9Czldy1i X-Received: by 2002:a05:600c:3b9a:b0:405:3455:567e with SMTP id n26-20020a05600c3b9a00b004053455567emr12985365wms.5.1698280968497; Wed, 25 Oct 2023 17:42:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698280968; cv=none; d=google.com; s=arc-20160816; b=J2ZFVNY6YsSifetieu2QV2ufGxcYDSosohnLtdfUO+D4xOYtz7mjF9jyGfLdg/SDXu 8uZOGofksd4lVieUDSC7RfElbuwxrp0pLalRaQZaJ6+ONk1LqGjTo6EXPvZXx3F4ypZ2 0hMJJGkRxQV1pUxq3va8qEEhuBn+GZHkdNS6IzfMe3LuXX2w7aQ4bnuQfGy32kpv0/A4 8Rth32oGJgJdfRqgh1yJR+YOQNRDpQNedDKlPmFIDFhNG4f9s2ExxnfnKLhuC+ZjEK7z CvMMTtWzUhiH1Uflab/ZOr39HhBt7IckzOJBqdFcG2C/grZapbbeAk8ncaslJK46hJwd Fwwg== 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=tFnSxDeK3rdSz9x4fev82AZ34W6M8VZ9rvoNIcYwmXE=; fh=rYI8DiHAAFX3O5g969KmOAQ7d45Sb8OxQX1+DywGDk4=; b=byQRhYAq7GixZSYbtNauSQDwF/5f8BBCA1sgGPltkewvjMSkIkS+OU0aepGorWgZ16 vyHjzAyq1tMO3xv6x/mTffQbfl+loFXyV41ITWkFx2KNYnVtFMk4K4JTLCYznki8rHdw DLajLz6leh0U59LrnS4G2akb5+K2CwrZyk7sZoLu7JNVMOPW6/KJgMsBjOba/rh3z8dA bnlzGRGnBD56qj9EXOlofvLPcxDJNYy+frSttpWSSivZubc2rNMgpRDCWsxfBjhxR76C 6x/hhG7BgTo52ZajAT1oyzEYwwKkH3y77FtLd/oesynVohs86098NiijKjIev83pu1HH 2o/w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=L1R4JiZL; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as 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 15-20020a05600c22cf00b0040559ffcd1asi780795wmg.157.2023.10.25.17.42.48 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 25 Oct 2023 17:42: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=L1R4JiZL; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as 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 1qvoA4-0004qC-Pf; Wed, 25 Oct 2023 20:23: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 1qvo9h-00034h-3T for qemu-devel@nongnu.org; Wed, 25 Oct 2023 20:23:22 -0400 Received: from mail-pg1-x52f.google.com ([2607:f8b0:4864:20::52f]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qvo9b-0008GL-Jm for qemu-devel@nongnu.org; Wed, 25 Oct 2023 20:23:20 -0400 Received: by mail-pg1-x52f.google.com with SMTP id 41be03b00d2f7-5aa481d53e5so299767a12.1 for ; Wed, 25 Oct 2023 17:23:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1698279794; x=1698884594; 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=tFnSxDeK3rdSz9x4fev82AZ34W6M8VZ9rvoNIcYwmXE=; b=L1R4JiZLtpaycJYn1EdrgX/ite72R0Wk2Y2zPT9O2dErHzIX4NOO1WGkQb0XT9TVCU UFvyWA6Saw2+zF8C909MvBrPnxgh/H/IFfjUYzeIaXUaD3jIZZ4Zg/G5iB3oznRLWEFE TdckOoigZv8xJgEDXQre3+PMUqk35EptP6qpSLb09p/QWREhX2+Pz15G3tfWfvGBgQaJ mSdX3Aj1yke7dL9P4d7cB514joMBm5ToBU/cDPGGq0K2i5UVrWcz4TYkVpmgM/tOB+sN JKjkHAt8EePMkcCvok0O/s0Mb0sT39D1xo622RsHq7I/knMpz0geAnQ8dj/dyWxkxbVp CEEg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1698279794; x=1698884594; 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=tFnSxDeK3rdSz9x4fev82AZ34W6M8VZ9rvoNIcYwmXE=; b=Exb37oqLK4hA68LNKob8F+BYvTnrW/6qbNcc5ODEvJsT3NrN7CIZh4JJtBQmJcD7ex uyCCn/flUi0NO8zR9klGMm1OUzAQld6rmncXNvswpiiN2KoUwIB68OwFAc0vKCbZih9r n6zBl4co9FTAM4BsOTJVa8bdYe0SQ7OF/HlEXdXk1cjRkqxHhc77K6htjPDk3tRaWzWy QkRhnfiNtITYaJ0rdYknl6u38Y2kIhjhD9vhJ5BXPEULtqFzLhINOfcSU1SRl7a8U25J eDbN0iBrftNGi/qqR9U3vu0Z649PXFTqzi/SJg7tCjYmmaDtU4mKgcELgv9LzOD5dVPL Gwpg== X-Gm-Message-State: AOJu0YwwavgilnL82PHOhjcjl5I/XEakcOSs2rs+U0jaKuLODAQLOccQ ghaQeD9xzFd5z/6RykZGJcMwh1NfmlNth8lKSbo= X-Received: by 2002:a17:90b:4f4a:b0:27d:1862:a494 with SMTP id pj10-20020a17090b4f4a00b0027d1862a494mr14172731pjb.11.1698279794150; Wed, 25 Oct 2023 17:23:14 -0700 (PDT) Received: from stoup.. ([71.212.149.95]) by smtp.gmail.com with ESMTPSA id 9-20020a17090a0cc900b0027463889e72sm499870pjt.55.2023.10.25.17.23.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 25 Oct 2023 17:23:13 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: Mark Cave-Ayland Subject: [PULL 82/94] target/sparc: Move gen_fop_FD insns to decodetree Date: Wed, 25 Oct 2023 17:15:30 -0700 Message-Id: <20231026001542.1141412-112-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231026001542.1141412-1-richard.henderson@linaro.org> References: <20231026001542.1141412-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::52f; envelope-from=richard.henderson@linaro.org; helo=mail-pg1-x52f.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. Tested-by: Mark Cave-Ayland Acked-by: Mark Cave-Ayland Signed-off-by: Richard Henderson --- target/sparc/insns.decode | 3 +++ target/sparc/translate.c | 51 +++++++++++++++++++++------------------ 2 files changed, 30 insertions(+), 24 deletions(-) diff --git a/target/sparc/insns.decode b/target/sparc/insns.decode index a19d191603..faf2bcef83 100644 --- a/target/sparc/insns.decode +++ b/target/sparc/insns.decode @@ -263,9 +263,12 @@ FDIVq 10 ..... 110100 ..... 0 0100 1111 ..... @r_r_r FsMULd 10 ..... 110100 ..... 0 0110 1001 ..... @r_r_r FdMULq 10 ..... 110100 ..... 0 0110 1110 ..... @r_r_r FdTOx 10 ..... 110100 00000 0 1000 0010 ..... @r_r2 +FxTOs 10 ..... 110100 00000 0 1000 0100 ..... @r_r2 FxTOd 10 ..... 110100 00000 0 1000 1000 ..... @r_r2 FiTOs 10 ..... 110100 00000 0 1100 0100 ..... @r_r2 +FdTOs 10 ..... 110100 00000 0 1100 0110 ..... @r_r2 FsTOi 10 ..... 110100 00000 0 1101 0001 ..... @r_r2 +FdTOi 10 ..... 110100 00000 0 1101 0010 ..... @r_r2 { [ diff --git a/target/sparc/translate.c b/target/sparc/translate.c index 29643768e1..6c1dcf6472 100644 --- a/target/sparc/translate.c +++ b/target/sparc/translate.c @@ -74,6 +74,7 @@ # define gen_helper_fmuld8ulx16 ({ qemu_build_not_reached(); NULL; }) # define gen_helper_fpmerge ({ 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_pdist ({ qemu_build_not_reached(); NULL; }) # define FSR_LDXFSR_MASK 0 # define FSR_LDXFSR_OLDMASK 0 @@ -1700,21 +1701,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)) { @@ -4715,6 +4701,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)) { @@ -5055,10 +5064,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); @@ -5085,9 +5094,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); @@ -5112,9 +5118,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 Thu Oct 26 00:15: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: 738250 Delivered-To: patch@linaro.org Received: by 2002:adf:f842:0:b0:32d:baff:b0ca with SMTP id d2csp557261wrq; Wed, 25 Oct 2023 17:32:37 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGAtZX6DtcPVJrkNo5LdE3i0vaug1bf9jksSIgO074MgIkDgxwsZlcTbNPVdUsD68xi/hWw X-Received: by 2002:a17:907:9812:b0:9ae:5fe1:ef01 with SMTP id ji18-20020a170907981200b009ae5fe1ef01mr12447295ejc.37.1698280357527; Wed, 25 Oct 2023 17:32:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698280357; cv=none; d=google.com; s=arc-20160816; b=hPT+YBEUi1rZbRacXWA+2mdhrfatmrY6yWVfYU5dhtvsok8NXafTbjRnFLJlAA5+ex InN6+yTa792Ko6sbO1PP9yDyYtBLyJcL4KpN5VUS9xWNVi1QQ2kcopO6xfgiiZ1bxjj7 gmMsN3Pvt5vIBkmrpi971x7SiQP2rpLrZGb1zsRc+75wpq9bTYSenVOpKN11zg7nCRXe r/IK74Omh5r9pycpJuVyaIVJyKzt2yYPcLxLo7wHMHMyOaQriqlwVWMAJv+4Mn0sBHzg GP//QM+Yc1b/DTq9djCyECd/VTw1Mtlk+SmllI5NerMywk+6vB4jSd1aaPJmYi+SDCaV yK2g== 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=W5ov1/Ws58A6tJgu37c7vPdUN8+EpdwR2VU2PLSJwVY=; fh=rYI8DiHAAFX3O5g969KmOAQ7d45Sb8OxQX1+DywGDk4=; b=CvLILABp1llzD3V9jo8YKi5KzWj3OsEF+0KisGMdiW9qM1xUY5ExndSoELVkc2yrUB hOhlfvH5/4FhZMiRk1tmZ36n7zV8tNtMq1RDH8PB4zBfTfgzk4v1f/PNsaCb6socrgPh YWhqW4S9sE7nGXHr8DjwjBFTx+iYdD2rBYXEMpIQjkrED5GMKoyrkp42SqcHMeAuAKaC orJtEfSsDq2/Bvdared07Kc9BgDa9S7B4+DLS8zPAO9pFqrD9QvisfbELwBMqLTPJQDj DTvUm1j6iND87d1nMEd1oDnzK2tfc8vFNTMc6lYdm8ccqPRvsk0ObFHa9LDHvSkqz3a2 1ujA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=lJWzDqDi; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as 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 di9-20020a170906730900b009c3d72487c8si5997716ejc.504.2023.10.25.17.32.37 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 25 Oct 2023 17:32:37 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=lJWzDqDi; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as 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 1qvoAD-0005eA-1V; Wed, 25 Oct 2023 20:23: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 1qvo9k-0003EH-3n for qemu-devel@nongnu.org; Wed, 25 Oct 2023 20:23:25 -0400 Received: from mail-pj1-x1036.google.com ([2607:f8b0:4864:20::1036]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qvo9e-0008Gm-E4 for qemu-devel@nongnu.org; Wed, 25 Oct 2023 20:23:22 -0400 Received: by mail-pj1-x1036.google.com with SMTP id 98e67ed59e1d1-27d2b814912so252985a91.0 for ; Wed, 25 Oct 2023 17:23:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1698279795; x=1698884595; 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=W5ov1/Ws58A6tJgu37c7vPdUN8+EpdwR2VU2PLSJwVY=; b=lJWzDqDiEl6UH27RJfec5tLuDYg/zPLqerdX3WmG3rrsOCH0vCdHERBKPwtPkARiRB SH7ORi8uYnQgpmmkVrlsWD5V/RdePaRXawh4jMwMi5Hb/ot2gdbhQsJdhlBsdoRcWDbD LAij+nbCoCw/hrPyC6GG0W4PGWrsAS5GS6wfVwvAmlWUsQNpSqvn0+ou7+37wEAPb2dN slWNfUBvfAa8RBKuGz9FnuZ3oVjD6RMk9NtKTknRaaSj9ym+3xNCGvpVse+Oh+uIF7Cd llZB6R4kEZiPafM/vyHvO4LBUCjSQ367TA+XC/vv0rmcyugiKHnH09KNMcBR/8A8eiGX Yw3Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1698279795; x=1698884595; 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=W5ov1/Ws58A6tJgu37c7vPdUN8+EpdwR2VU2PLSJwVY=; b=DZlGyl6Q4j9sUXAdoeJyNRfPnv3C4GWsS1EaJLNb8dFrPowKZhad72jkCvr8m4dEVB dnfyr9KoVmIUL6xAfKRyrsc1Kv3z0iDRpWrK4Q2IT2dgJpCmSsQb7f46AOSdqz1/4a2T A4Pj+wxwLMY3VwAWnwiWYqFvPxA+M0xtRqavDjTpBXe9RkKTrEwydcomL82QwOywDYwI 2u2eueMYKG/1pxpAkkimj1gHoKyJTaVs4vDKDKNlS9WKvxk1oo3x7FkjqJutMqnjdJ3c Rd99xj9gRWu+Ovo9ZU9VySzEF+bxUjExzUnwN5UGdojUxttmUq9i2GCUhupcFCNMBrQl kHFg== X-Gm-Message-State: AOJu0YwnKj9B6l8Q+eBK8gA88N1rRnk0rJlvRXlAe8EYerhO2xU/bKaa 6QRK7GcD/UwvkXoAOkM8he6UbDh9KCVd0LGSMTA= X-Received: by 2002:a17:90a:7543:b0:268:1355:b03e with SMTP id q61-20020a17090a754300b002681355b03emr14570195pjk.38.1698279794915; Wed, 25 Oct 2023 17:23:14 -0700 (PDT) Received: from stoup.. ([71.212.149.95]) by smtp.gmail.com with ESMTPSA id 9-20020a17090a0cc900b0027463889e72sm499870pjt.55.2023.10.25.17.23.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 25 Oct 2023 17:23:14 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: Mark Cave-Ayland Subject: [PULL 83/94] target/sparc: Move FiTOd, FsTOd, FsTOx to decodetree Date: Wed, 25 Oct 2023 17:15:31 -0700 Message-Id: <20231026001542.1141412-113-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231026001542.1141412-1-richard.henderson@linaro.org> References: <20231026001542.1141412-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::1036; envelope-from=richard.henderson@linaro.org; helo=mail-pj1-x1036.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org Note that gen_ne_fop_DF was incorrectly named and does pass env. The two sets of helpers should have been unified. Tested-by: Mark Cave-Ayland Acked-by: Mark Cave-Ayland Signed-off-by: Richard Henderson --- target/sparc/insns.decode | 3 ++ target/sparc/translate.c | 67 ++++++++++++++++----------------------- 2 files changed, 30 insertions(+), 40 deletions(-) diff --git a/target/sparc/insns.decode b/target/sparc/insns.decode index faf2bcef83..ee9262061b 100644 --- a/target/sparc/insns.decode +++ b/target/sparc/insns.decode @@ -262,11 +262,14 @@ FDIVd 10 ..... 110100 ..... 0 0100 1110 ..... @r_r_r FDIVq 10 ..... 110100 ..... 0 0100 1111 ..... @r_r_r FsMULd 10 ..... 110100 ..... 0 0110 1001 ..... @r_r_r FdMULq 10 ..... 110100 ..... 0 0110 1110 ..... @r_r_r +FsTOx 10 ..... 110100 00000 0 1000 0001 ..... @r_r2 FdTOx 10 ..... 110100 00000 0 1000 0010 ..... @r_r2 FxTOs 10 ..... 110100 00000 0 1000 0100 ..... @r_r2 FxTOd 10 ..... 110100 00000 0 1000 1000 ..... @r_r2 FiTOs 10 ..... 110100 00000 0 1100 0100 ..... @r_r2 FdTOs 10 ..... 110100 00000 0 1100 0110 ..... @r_r2 +FiTOd 10 ..... 110100 00000 0 1100 1000 ..... @r_r2 +FsTOd 10 ..... 110100 00000 0 1100 1001 ..... @r_r2 FsTOi 10 ..... 110100 00000 0 1101 0001 ..... @r_r2 FdTOi 10 ..... 110100 00000 0 1101 0010 ..... @r_r2 diff --git a/target/sparc/translate.c b/target/sparc/translate.c index 6c1dcf6472..e71b41e196 100644 --- a/target/sparc/translate.c +++ b/target/sparc/translate.c @@ -73,6 +73,7 @@ # define gen_helper_fmuld8sux16 ({ qemu_build_not_reached(); NULL; }) # define gen_helper_fmuld8ulx16 ({ qemu_build_not_reached(); NULL; }) # define gen_helper_fpmerge ({ 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_pdist ({ qemu_build_not_reached(); NULL; }) @@ -1670,37 +1671,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)) { @@ -4768,6 +4738,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)) { @@ -5067,17 +5060,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); @@ -5111,9 +5101,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 Thu Oct 26 00:15: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: 738301 Delivered-To: patch@linaro.org Received: by 2002:adf:f842:0:b0:32d:baff:b0ca with SMTP id d2csp560425wrq; Wed, 25 Oct 2023 17:42:48 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGN9A9pBxnhjbkuCAezhX4fc5SJFxsuFLlybRQSpWDp+4M7k1B97V/wxQArp9NhbVS1c6pp X-Received: by 2002:a05:622a:134d:b0:41c:c692:e3ed with SMTP id w13-20020a05622a134d00b0041cc692e3edmr22847093qtk.34.1698280968680; Wed, 25 Oct 2023 17:42:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698280968; cv=none; d=google.com; s=arc-20160816; b=kGbbwE0D1d+eYcQTvfKGfmFnYVeq3c/GTqOuzshi4a52WOgf6BIKo3+syVqZckd4sR E9dexAdzUCCMk+SJMPHVNZCfk218SyghmPgvT01Qy55gyux63aPM1Fhi60sF7CxRTXPn Aga/COMQxNYnVuQnTGjZwSWji5KoCUDLK86q6YVYWJGauH5Nyup0Lfj+daLZccbvI4Qi 5KM/MBDTKj0mwB9/dAFn/yZbnRiOksF4JHyCX8Jby8zTBNnIHBkBZs5F8sMP4XjIQWdt blLmWoppY0MjSr5N5wv7h8g+ny5Yms/sOTeQhy7q4ncktDMUgF6KRqrpxXFPKTkGKE5D uM5A== 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=z6FFXra1EildNrILVO+FVSvaerCZUInRPG0JCvbw9Rk=; fh=rYI8DiHAAFX3O5g969KmOAQ7d45Sb8OxQX1+DywGDk4=; b=GpudYrv+qLv8A2aAM/DxMjX6dXfHJMdGYwmOkFbc8eDa8XWpsJEQLpkfFTawsEl/at HMoZI/n2DzEPkb9BTU1Vvkb01orgKk07alTjkva34LgMGCypbJ9RNjyLanjqe3WoZv6/ ROEtR7VmovCMUtJT+qkAbc8+778ydSBLncQiDX4NWDquePyjeer4Cl2Hd4tycLZ2uM7N goQEi7tOxE1PZnG1qd9ztuWjpolA2nsvITseGgeXfWqxpEFaXPxtacvbne5pTYtFohEH 8Pwmva7YbufQ1hQhVIgVSrNhr0mjydLMqpKAklYk8JQNBxqvyIBu23OxOMi0pJq9aCtR YrxA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=MwY3RNX0; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as 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-20020a05622a020200b00403b84a6bbasi8668234qtx.385.2023.10.25.17.42.48 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 25 Oct 2023 17:42: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=MwY3RNX0; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as 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 1qvo9x-0003kz-Uz; Wed, 25 Oct 2023 20:23: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 1qvo9j-0003Dr-1r for qemu-devel@nongnu.org; Wed, 25 Oct 2023 20:23:24 -0400 Received: from mail-pj1-x102c.google.com ([2607:f8b0:4864:20::102c]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qvo9d-0008Gj-3G for qemu-devel@nongnu.org; Wed, 25 Oct 2023 20:23:22 -0400 Received: by mail-pj1-x102c.google.com with SMTP id 98e67ed59e1d1-27cefb5ae1fso224188a91.3 for ; Wed, 25 Oct 2023 17:23:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1698279795; x=1698884595; 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=z6FFXra1EildNrILVO+FVSvaerCZUInRPG0JCvbw9Rk=; b=MwY3RNX0fdf65PHEhMfgC7D+OKpP85IHYq618u7fhfxFz7wug8jqHn5yVPMbZ2KgfQ kOv/3OSrfKxmcZVthX3fAuEP/EklN1FC8ci6YDPOQyWGhRDEt2zsYDR+WGjZ5RG+IlPe ccElCcTU3JYSDfZhGalDN6JIKcok9bS5hwwIQ3+2LPpS2YiI3SCYNNKks42+2t2/rstJ eq4rK7o8oUPklPQoo7U5zLNcE3RXNZDEg92l6778dBOIjL04MdjSq6Pos2DlhgoABkR0 iXVQQ2QBw+pvU+gRb5T6Da4h9JXwF0RIlAHF/EQeI/mtwBXQX/Ry5Hu6UMOb++6oiLa1 CSog== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1698279795; x=1698884595; 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=z6FFXra1EildNrILVO+FVSvaerCZUInRPG0JCvbw9Rk=; b=uuWaUVNTimHh8YUer7lNmRhfoyF/fjaUb8cFD873jBMmkVu5J1scmBPX1GEkd+BUiy tgg9lGzW9Y6JwU2NQxxIWfBwAYS/dV4oOsFFsvOSVaBAhnnsHed71RXEW9Wsy88q+gy+ UboRDs0bVnIjDzBTspLwoqbPIa1bfnx8Lm6q1eGdyqWO3NFh6q5jtVuksS/34cSzQ1My UuQ8imfKRV8w/RUa4+3GDNRGSKOcBHvf1LV5MsptUKSw5uAtf5wc5UBpd0I2X3pnEhZz HI9cait4Ljrsz9nzeHHjNiramZNzSm7WhqYJo5rqVxCL3M5D+mrLv5TmeVPi/tQe+Gro +fKA== X-Gm-Message-State: AOJu0YwdrweWhQUHqPk0syZPdNNytfyiFJCq2Henwftvub/+hpO/3oa2 ZvJp23iNemhkEMw30LLQDi6LK8JNLWZLq1HPWqM= X-Received: by 2002:a17:90b:2311:b0:27e:3ae3:eae0 with SMTP id mt17-20020a17090b231100b0027e3ae3eae0mr10131883pjb.16.1698279795584; Wed, 25 Oct 2023 17:23:15 -0700 (PDT) Received: from stoup.. ([71.212.149.95]) by smtp.gmail.com with ESMTPSA id 9-20020a17090a0cc900b0027463889e72sm499870pjt.55.2023.10.25.17.23.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 25 Oct 2023 17:23:15 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: Mark Cave-Ayland Subject: [PULL 84/94] target/sparc: Move FqTOs, FqTOi to decodetree Date: Wed, 25 Oct 2023 17:15:32 -0700 Message-Id: <20231026001542.1141412-114-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231026001542.1141412-1-richard.henderson@linaro.org> References: <20231026001542.1141412-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::102c; envelope-from=richard.henderson@linaro.org; helo=mail-pj1-x102c.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org Tested-by: Mark Cave-Ayland Acked-by: Mark Cave-Ayland Signed-off-by: Richard Henderson --- target/sparc/insns.decode | 2 ++ target/sparc/translate.c | 48 +++++++++++++++++++++------------------ 2 files changed, 28 insertions(+), 22 deletions(-) diff --git a/target/sparc/insns.decode b/target/sparc/insns.decode index ee9262061b..33f0c738e6 100644 --- a/target/sparc/insns.decode +++ b/target/sparc/insns.decode @@ -268,10 +268,12 @@ FxTOs 10 ..... 110100 00000 0 1000 0100 ..... @r_r2 FxTOd 10 ..... 110100 00000 0 1000 1000 ..... @r_r2 FiTOs 10 ..... 110100 00000 0 1100 0100 ..... @r_r2 FdTOs 10 ..... 110100 00000 0 1100 0110 ..... @r_r2 +FqTOs 10 ..... 110100 00000 0 1100 0111 ..... @r_r2 FiTOd 10 ..... 110100 00000 0 1100 1000 ..... @r_r2 FsTOd 10 ..... 110100 00000 0 1100 1001 ..... @r_r2 FsTOi 10 ..... 110100 00000 0 1101 0001 ..... @r_r2 FdTOi 10 ..... 110100 00000 0 1101 0010 ..... @r_r2 +FqTOi 10 ..... 110100 00000 0 1101 0011 ..... @r_r2 { [ diff --git a/target/sparc/translate.c b/target/sparc/translate.c index e71b41e196..37405df926 100644 --- a/target/sparc/translate.c +++ b/target/sparc/translate.c @@ -1671,20 +1671,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)) { @@ -4782,6 +4768,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)) { @@ -5063,11 +5073,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); @@ -5084,10 +5092,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 Thu Oct 26 00:15: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: 738255 Delivered-To: patch@linaro.org Received: by 2002:adf:f842:0:b0:32d:baff:b0ca with SMTP id d2csp557497wrq; Wed, 25 Oct 2023 17:33:18 -0700 (PDT) X-Google-Smtp-Source: AGHT+IE/rFTHW3vbplutMrkjPSTclESOx8NskTL8AKcrs1xs7hYCMPvIa5VqoJzFL6Jq4C+857cc X-Received: by 2002:a05:600c:4585:b0:405:3924:3cad with SMTP id r5-20020a05600c458500b0040539243cadmr1211742wmo.15.1698280398496; Wed, 25 Oct 2023 17:33:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698280398; cv=none; d=google.com; s=arc-20160816; b=Gyp7e9l1osExDjBMkN55Fwk+zS2rFpDHHot0yuGpWcaEZZdI8+pFcI/WdPAzp5vcss 5+6vqdSdkuaw4Winhbf1LtVgou3kM6FvBhdEnnJvt/xVEK8cyeb6FV9UZJglFvBjadoZ WAELN9hrS+c+59VV23RBphU+qE39yb+VW/ZpeF4pEVtDW12RzTj2eaakMI1c+IsRezsA NpH8oIOD5B9h5KuO9U5XhfuBWwNfrA+YttPb3g8xXVpBBt4/tz7B9xLgfda+rhwXYrId Q7RPJUvE1o4J4MaNupEMM03EBJmYB3J6ntLtDNGP5q948K5nPe2munpPCONJr3T8xHe0 IXyw== 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=9KotDm1ccWcjMGj47lWKXfQ3MeQ3vl4Hk13goI3+D2k=; fh=rYI8DiHAAFX3O5g969KmOAQ7d45Sb8OxQX1+DywGDk4=; b=kjXZfiVdjHdiCA6ScLb+rdDghPgVX6zl0l2VAt+AHL7S+vYdpggMdoslakXbA3/SAD nk0poDDrHft6GXYhbc+uvQHXuZQNcB3tlFtW0vZzhe0QAXICUz5myOIBj7D5qzB2aEti FpM526AfLyIv9wP6LgbyuHm5TF8659NSYeI4YnnRmbp+K1l1pugidnJOUX+YourvSr61 7RJVmGYOWB6YBaPZoJRk74hvK1OwuDEVREmEsdytHDVXZujqi91GpvuMTdxqoQ+l9WIn HkW3vGVN+QveBjsxWmejFYCr5p8NJXJMhkhByU7y9xrIBdjuWtDQpICFyU9Rane8mG3Z M5lg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=gsCKmACl; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id x12-20020adff64c000000b0032d885ea11asi8371016wrp.101.2023.10.25.17.33.18 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 25 Oct 2023 17:33:18 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=gsCKmACl; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as 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 1qvoAY-0006g3-0C; Wed, 25 Oct 2023 20:24: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 1qvo9k-0003FO-5L for qemu-devel@nongnu.org; Wed, 25 Oct 2023 20:23:26 -0400 Received: from mail-pj1-x1033.google.com ([2607:f8b0:4864:20::1033]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qvo9e-0008Gv-Nh for qemu-devel@nongnu.org; Wed, 25 Oct 2023 20:23:23 -0400 Received: by mail-pj1-x1033.google.com with SMTP id 98e67ed59e1d1-27d3ede72f6so242953a91.1 for ; Wed, 25 Oct 2023 17:23:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1698279796; x=1698884596; 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=9KotDm1ccWcjMGj47lWKXfQ3MeQ3vl4Hk13goI3+D2k=; b=gsCKmAClRETZfwE1AIhEaOAuA3XToKPhIrsXh2TLKsE2z40uUZMoC+M3WJZs4VLbwx qISQZETHoNz1RiAdA4XBsewNXhs7qs2Mr51jxkj4efPWBQ8SoekYyMVTPJGCTBLusoKw SiswlzZpTbmfGfAAPahdEHuKBot2N69+rirL92dIiYNXvn8LcHwvEiYsfi6ALUh2zrVM D740TPu66TvDZv8y2y7IL3BCY9nRkznXK/aAYu0GxqU8PxmFE6vGHDuPp3WohJQy/C1j 2fNPFH6D6Nb0nqF5QnJ58PB+kxrh3krHtbIDC2drCDuuQuXvmyVgYoKHwCQLMz3Dukdl MezQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1698279796; x=1698884596; 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=9KotDm1ccWcjMGj47lWKXfQ3MeQ3vl4Hk13goI3+D2k=; b=oQ24/IQQYccxE2GGdcoFoRwG0pgdHjfTiIPQ2pEh7E91Bl2A161ooxRVk0ArqX0GwH GQADga8dg9Rrsx0Qpg2UaJ0De+RKie3dqWA2Aw3cyhXzpWu3LmFJqPzXTY3UMpGL8tcY bIp/AMTNxWZW6lJWIKV6HSB4fcWRZYHiSmFHtHcRIzFDus79soLisfRWqdvzPjBlzovy f5pPW+b0sHDYbtDU+wcr4UuI/Obv/LvKvXPgTOaHBrg8X4uTnEWsF/WrClgs4zVxsA0B wJQ3/maArJlADn6zNSckSrjvnoKcw9bUK7sbl1kqcyDBtc8s4OZzfk30oQJdAjP5GKJt u8pQ== X-Gm-Message-State: AOJu0YwdLTbuh7oR+bpmUNiuEoejW1wEBOihA6+EDY2NUn4hmsIZIB1Q /8J9laRf2xlnG/ZZF+w9ITn6zhVZ4dy6YT7xWfY= X-Received: by 2002:a17:90a:1983:b0:27d:3f93:c148 with SMTP id 3-20020a17090a198300b0027d3f93c148mr15818438pji.13.1698279796248; Wed, 25 Oct 2023 17:23:16 -0700 (PDT) Received: from stoup.. ([71.212.149.95]) by smtp.gmail.com with ESMTPSA id 9-20020a17090a0cc900b0027463889e72sm499870pjt.55.2023.10.25.17.23.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 25 Oct 2023 17:23:15 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: Mark Cave-Ayland Subject: [PULL 85/94] target/sparc: Move FqTOd, FqTOx to decodetree Date: Wed, 25 Oct 2023 17:15:33 -0700 Message-Id: <20231026001542.1141412-115-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231026001542.1141412-1-richard.henderson@linaro.org> References: <20231026001542.1141412-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::1033; envelope-from=richard.henderson@linaro.org; helo=mail-pj1-x1033.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org Tested-by: Mark Cave-Ayland Acked-by: Mark Cave-Ayland Signed-off-by: Richard Henderson --- target/sparc/insns.decode | 2 ++ target/sparc/translate.c | 49 +++++++++++++++++++++------------------ 2 files changed, 29 insertions(+), 22 deletions(-) diff --git a/target/sparc/insns.decode b/target/sparc/insns.decode index 33f0c738e6..7b65b31f89 100644 --- a/target/sparc/insns.decode +++ b/target/sparc/insns.decode @@ -264,6 +264,7 @@ FsMULd 10 ..... 110100 ..... 0 0110 1001 ..... @r_r_r FdMULq 10 ..... 110100 ..... 0 0110 1110 ..... @r_r_r FsTOx 10 ..... 110100 00000 0 1000 0001 ..... @r_r2 FdTOx 10 ..... 110100 00000 0 1000 0010 ..... @r_r2 +FqTOx 10 ..... 110100 00000 0 1000 0011 ..... @r_r2 FxTOs 10 ..... 110100 00000 0 1000 0100 ..... @r_r2 FxTOd 10 ..... 110100 00000 0 1000 1000 ..... @r_r2 FiTOs 10 ..... 110100 00000 0 1100 0100 ..... @r_r2 @@ -271,6 +272,7 @@ FdTOs 10 ..... 110100 00000 0 1100 0110 ..... @r_r2 FqTOs 10 ..... 110100 00000 0 1100 0111 ..... @r_r2 FiTOd 10 ..... 110100 00000 0 1100 1000 ..... @r_r2 FsTOd 10 ..... 110100 00000 0 1100 1001 ..... @r_r2 +FqTOd 10 ..... 110100 00000 0 1100 1011 ..... @r_r2 FsTOi 10 ..... 110100 00000 0 1101 0001 ..... @r_r2 FdTOi 10 ..... 110100 00000 0 1101 0010 ..... @r_r2 FqTOi 10 ..... 110100 00000 0 1101 0011 ..... @r_r2 diff --git a/target/sparc/translate.c b/target/sparc/translate.c index 37405df926..39da3f1705 100644 --- a/target/sparc/translate.c +++ b/target/sparc/translate.c @@ -73,6 +73,7 @@ # define gen_helper_fmuld8sux16 ({ qemu_build_not_reached(); NULL; }) # define gen_helper_fmuld8ulx16 ({ qemu_build_not_reached(); NULL; }) # define gen_helper_fpmerge ({ qemu_build_not_reached(); NULL; }) +# define gen_helper_fqtox ({ 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; }) @@ -1671,20 +1672,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)) { @@ -4792,6 +4779,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)) { @@ -5075,11 +5086,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); @@ -5105,10 +5114,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 Thu Oct 26 00:15: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: 738260 Delivered-To: patch@linaro.org Received: by 2002:adf:f842:0:b0:32d:baff:b0ca with SMTP id d2csp557687wrq; Wed, 25 Oct 2023 17:33:49 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHtEJvkuJrktJV1MKIGIAn0xSubAUr+mvgmGSAVpGKPIIMYH8J1mNvymP91Av3SUlV7HTjZ X-Received: by 2002:a17:907:25c3:b0:9bf:a614:9a2e with SMTP id ae3-20020a17090725c300b009bfa6149a2emr14177250ejc.61.1698280428915; Wed, 25 Oct 2023 17:33:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698280428; cv=none; d=google.com; s=arc-20160816; b=QBgfw+zrdLjCdtKsWwnLyPz5Qvu5oIQgWfEjSKlnGfopKYz09agYumT33hm3pcgAjD 4kSr8U05hO8I6ntvz95oPoKEjjR2qS6KQoo6AnYFZsl61QN1hoRTEAyVf7HrmM5MiJmL JhUhLMFGlRhAQKRpxTvOmAbbLgTp8iZqV60c5mUvWUZaJs0WcL2+btx1oo8ipSKsR+8a rdPBA7yqYzJIOpSI/TVNfunrF1clUbGCuULnsW+oln8GBXpMh/j94cFmnlkU37ekRYpr TwqNONGCkTJCC/eWWMnSc71fAmCA+IFdCncQ57bgcsdHvcLBhoio8Q3DR/DEmLKuiUER vyPA== 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=/fjzgfpQS9oPQQPd/gylCCDrHsUezvD1M5UxyFdfsBQ=; fh=rYI8DiHAAFX3O5g969KmOAQ7d45Sb8OxQX1+DywGDk4=; b=a/6dnX/sKAf45l0zpMyfbjwOBtMdIBnhWMiS+o2YlgIukSNghHakXU0IMwnJDUgGqZ n5I3Tjnzt5oLYUuQ+2mVLxeJ3HAYZkLo81BpLLWZzKBX7LlDXrH99ymJ8Fpsn8lTekhN yFGl+/o/YoDAj/sRlBqtNWQZBJWeuNN3TDj48qMqQP+UA4X159Ba4zrsDOBTBOi7B4ce RkGCTo7u5Hu1TCvz2tJ/8v6T8IF7jduMvy82Noq0z0hZncz9uEdi41TNrXyUQjb/EWN0 BjgWb7V3S2FbdIUn0VnzWWsMUvpxCtyQv3dEkd2tlL+T6jouqzVcBIryiRdyEOKQ/zfI ciig== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="OKH/ojwi"; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as 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 gu26-20020a170906f29a00b009b916fa6387si6129715ejb.997.2023.10.25.17.33.48 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 25 Oct 2023 17:33: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="OKH/ojwi"; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as 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 1qvoAT-0006US-OX; Wed, 25 Oct 2023 20:24: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 1qvo9j-0003Eq-TV for qemu-devel@nongnu.org; Wed, 25 Oct 2023 20:23:25 -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 1qvo9e-0008H7-Ej for qemu-devel@nongnu.org; Wed, 25 Oct 2023 20:23:23 -0400 Received: by mail-pg1-x534.google.com with SMTP id 41be03b00d2f7-5b837dc2855so228072a12.0 for ; Wed, 25 Oct 2023 17:23:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1698279797; x=1698884597; 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=/fjzgfpQS9oPQQPd/gylCCDrHsUezvD1M5UxyFdfsBQ=; b=OKH/ojwifOY2iKhO2+CVn+m55IzO4yKpEEeeJ0uSi77nHinGw4USvow1AgGoh+w20h McgKWLHaE60+CkRB7EXBuCFOoTcc2XPmZOPTtv/ZDv7hveEMAQ+xds7UWk9OcRHMFqeM z2lM3sc7zAJnMDyBcBSIb9FvXqIwhxx3mfgrv6dU1wYsJgu6r0Do3MIJnKzRihfJRxLO XBi/RZn+mLHg0rr+XkRJZTBoU1UJtodWxfAfL5Tu0tzoTOmv2JXN21KMrJWXne9zP9Hl 7V4I6fRAR3Ja0B0jIm0BmfN2tSDwjknM8JNmczw6tOrfY3+dVxM2rWHg6qTjG3ihrbUJ znHA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1698279797; x=1698884597; 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=/fjzgfpQS9oPQQPd/gylCCDrHsUezvD1M5UxyFdfsBQ=; b=IZpDN7/WQCHNc7Yi0XZgHtndbBdpVyZ8oyxduJE7tFflQSPabDpvYFUcOr2naGGCQD QeQzwtFRhZ+zVdAsPoQ8lm2T+gpgMsI9IFRIGdAQEwzuWyF9LDQXELtj6gKFws6Y5i90 aPdz1jjs0BU5d0un8YdS+yIaAMBtGFtYqM1ERALPSlfExb+H0/ypQmgCVD19GTOXq/Wq YpFtvf8U4pUSRfErwM23UhrrsknMySD39v/O79OYhzVzuXY8/7ZRGcRYKUSET6Nx+cL3 lJ6+Ry3J+THMiPvmShpOzfFP7S0PRI73R/mWVE8RZwrT8vwmvkmhpMS8o6gia5PzpVc5 213g== X-Gm-Message-State: AOJu0Yz2VjVxOtIL5WIujDRYDRqL7853BytPdAIanSytmotkkfTg1dCP 6IzA72Uoh/UKCBdEg78ih/x+gqnpyjsyr1GoyZ0= X-Received: by 2002:a17:90a:fb53:b0:27d:5568:e867 with SMTP id iq19-20020a17090afb5300b0027d5568e867mr1499468pjb.9.1698279796958; Wed, 25 Oct 2023 17:23:16 -0700 (PDT) Received: from stoup.. ([71.212.149.95]) by smtp.gmail.com with ESMTPSA id 9-20020a17090a0cc900b0027463889e72sm499870pjt.55.2023.10.25.17.23.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 25 Oct 2023 17:23:16 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: Mark Cave-Ayland Subject: [PULL 86/94] target/sparc: Move FiTOq, FsTOq to decodetree Date: Wed, 25 Oct 2023 17:15:34 -0700 Message-Id: <20231026001542.1141412-116-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231026001542.1141412-1-richard.henderson@linaro.org> References: <20231026001542.1141412-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::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 Tested-by: Mark Cave-Ayland Acked-by: Mark Cave-Ayland Signed-off-by: Richard Henderson --- target/sparc/insns.decode | 2 ++ target/sparc/translate.c | 44 +++++++++++++++++++++------------------ 2 files changed, 26 insertions(+), 20 deletions(-) diff --git a/target/sparc/insns.decode b/target/sparc/insns.decode index 7b65b31f89..c76e603f2d 100644 --- a/target/sparc/insns.decode +++ b/target/sparc/insns.decode @@ -273,6 +273,8 @@ FqTOs 10 ..... 110100 00000 0 1100 0111 ..... @r_r2 FiTOd 10 ..... 110100 00000 0 1100 1000 ..... @r_r2 FsTOd 10 ..... 110100 00000 0 1100 1001 ..... @r_r2 FqTOd 10 ..... 110100 00000 0 1100 1011 ..... @r_r2 +FiTOq 10 ..... 110100 00000 0 1100 1100 ..... @r_r2 +FsTOq 10 ..... 110100 00000 0 1100 1101 ..... @r_r2 FsTOi 10 ..... 110100 00000 0 1101 0001 ..... @r_r2 FdTOi 10 ..... 110100 00000 0 1101 0010 ..... @r_r2 FqTOi 10 ..... 110100 00000 0 1101 0011 ..... @r_r2 diff --git a/target/sparc/translate.c b/target/sparc/translate.c index 39da3f1705..ad2d794b3d 100644 --- a/target/sparc/translate.c +++ b/target/sparc/translate.c @@ -1672,19 +1672,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)) { @@ -4803,6 +4790,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)) { @@ -5088,15 +5098,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 Thu Oct 26 00:15: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: 738287 Delivered-To: patch@linaro.org Received: by 2002:adf:f842:0:b0:32d:baff:b0ca with SMTP id d2csp559508wrq; Wed, 25 Oct 2023 17:39:35 -0700 (PDT) X-Google-Smtp-Source: AGHT+IH03+uvR1zx7H3qnOEgOH9kOvI6Rx91INEGolYtSEGIO8IDdon+GckV7UJ47waNMFVwOs0F X-Received: by 2002:a05:651c:1a28:b0:2c5:80d:53b1 with SMTP id by40-20020a05651c1a2800b002c5080d53b1mr14952682ljb.43.1698280775422; Wed, 25 Oct 2023 17:39:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698280775; cv=none; d=google.com; s=arc-20160816; b=ULDVkiXXNZ3ybymbOb2jA0GvxKQfa2p4qZvZgkhrTcB2Q7KCkP5rBkC8AQB8z80wKW TmQwE4SmOhWcfd+98eTZFzTc67vhzfd4kGqmcyhxuy4zF6UTLMGkaQ0RgUg9jPdtvkdB WiDwNOO/z/hhqffMAFmPx3tu/d6W0FNiHuyHs70jmiZGhlinZ1sIK5IMI/Utg4mnJtPy W3XJ9qmSev/u3MnKlqKW1EKvesv1vpS0SyNnLxJCOJ1cLZByBf7rwxzQy9AR8MeyqLZD iSaA7AGqLNxL8puejKNY4h2ot4p4aGRhy5Gd1GsCBG6SU4f03hxx41yO0CXiFXo47EIg ddEw== 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=b3Q80+YPvNL1h+vw0KOE43P0va8bo0EfHjxknGckkgM=; fh=rYI8DiHAAFX3O5g969KmOAQ7d45Sb8OxQX1+DywGDk4=; b=htnTrSFA/8q9NXYYfPh6b5rICGS4dJHJGzgD8A/BZm3ZbwwtilSqWwCq9lZQG39WDU XRUw84itQ+2DG3n8W2yAuRUf3xPskIBwRXeeJhpsWJa1SpYil14AgL4PoVsVyqZpWOn3 ZNJklwmmcr/mnQLBjfziDWYzNI7zZV1f/I+nQDa5mc7eFvaWGC6/lmLnlk4ik/CDzCre EmMwmrb78R9FEwWX50gwEehPhFyujcpRYeoK7ECzbv5L70i3+ogYebeZBpoMtmtSH/QJ AIkYNvs59ghzV2uyNDjFdUR1owq7TniIAK5zU+FqUiSjNRU6VAVGCHhfxTFLMYIWrbo2 XAvA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=fFZHcsRj; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as 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 y1-20020a05600c20c100b00403cab5f2e4si775139wmm.211.2023.10.25.17.39.35 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 25 Oct 2023 17:39: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=fFZHcsRj; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as 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 1qvoAP-0006CY-7C; Wed, 25 Oct 2023 20:24: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 1qvo9l-0003Hl-1L for qemu-devel@nongnu.org; Wed, 25 Oct 2023 20:23:27 -0400 Received: from mail-pj1-x1034.google.com ([2607:f8b0:4864:20::1034]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qvo9f-0008HE-8Z for qemu-devel@nongnu.org; Wed, 25 Oct 2023 20:23:24 -0400 Received: by mail-pj1-x1034.google.com with SMTP id 98e67ed59e1d1-27d3ede72f6so242973a91.1 for ; Wed, 25 Oct 2023 17:23:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1698279798; x=1698884598; 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=b3Q80+YPvNL1h+vw0KOE43P0va8bo0EfHjxknGckkgM=; b=fFZHcsRj2xEFsCUqsgLrrIEF/+yRWT3YZfa5y+AEXIF2DiZ8WJZQ4F07gQu+IFrOw8 tCWdjN6GhWZRmsPtEvIyE059czxFVarS8l2rjVc88++5b4ycWxWGEy+dfK8qy2VLcy9F gPCa0e6B/H2y2J4xsw47SzSFg6vRQcimmmDNemXN3rASZDO2iIk2YKPArCWWIXWgSZmd +hG9+7T1Wbm6/mRVyN4K1IWbrN/F71cdTgfP+wSr5mwx2fdUGskWtkPmwlFEjwP/nB4s 42iVizZDRNwYqT2OGe01QNtAcwII5lwUe+4us166j2HsmNE0Xa/ZLGlP1dBdPggzh5aU N//w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1698279798; x=1698884598; 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=b3Q80+YPvNL1h+vw0KOE43P0va8bo0EfHjxknGckkgM=; b=FyJ2bKhNPvXBqXsj6Qkt/zGWW2LQmEOhuvU4EaGpsEZz5JE0qg1WM6RwUTrq+qeuQ7 ARtmxCyq3QoRBm88RK94W+EYQuZ4/h4mk5bARadRLUo5RKjtllFAymSoGZfHB2S9tkqX U3aivWJMlkAkBpd5UZa0h5OcHnN0puGzkXlZ4Xm1XPhx3FmaQXp2WrvJ4adVKxFWwAPz ximpU/pQpRvLADz+tx1zrXy9+zyahBNq+VB124Ik4XwUBLFanRmke2PulH9+oFWRrEKi uy8xZ5+N35tB2nOZ0iBsDkOXg2o+1hDDUYIP2zRFKAj/OC6973UqcTK6hZ7oBUM8Bam3 098g== X-Gm-Message-State: AOJu0YyhJuEN2FtSt8z4HDLHhUq0qCaECwu2ngtFviTWE9dZhpgPiBJv pcidWq1AB82ix8qH8No572WrY6GikiWSa/33IJg= X-Received: by 2002:a17:90a:1d9:b0:27c:fb63:9c89 with SMTP id 25-20020a17090a01d900b0027cfb639c89mr17226330pjd.0.1698279797891; Wed, 25 Oct 2023 17:23:17 -0700 (PDT) Received: from stoup.. ([71.212.149.95]) by smtp.gmail.com with ESMTPSA id 9-20020a17090a0cc900b0027463889e72sm499870pjt.55.2023.10.25.17.23.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 25 Oct 2023 17:23:17 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: Mark Cave-Ayland Subject: [PULL 87/94] target/sparc: Move FdTOq, FxTOq to decodetree Date: Wed, 25 Oct 2023 17:15:35 -0700 Message-Id: <20231026001542.1141412-117-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231026001542.1141412-1-richard.henderson@linaro.org> References: <20231026001542.1141412-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::1034; envelope-from=richard.henderson@linaro.org; helo=mail-pj1-x1034.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org Tested-by: Mark Cave-Ayland Acked-by: Mark Cave-Ayland Signed-off-by: Richard Henderson --- target/sparc/insns.decode | 2 ++ target/sparc/translate.c | 47 ++++++++++++++++++++++----------------- 2 files changed, 28 insertions(+), 21 deletions(-) diff --git a/target/sparc/insns.decode b/target/sparc/insns.decode index c76e603f2d..e1f5394d17 100644 --- a/target/sparc/insns.decode +++ b/target/sparc/insns.decode @@ -267,6 +267,7 @@ FdTOx 10 ..... 110100 00000 0 1000 0010 ..... @r_r2 FqTOx 10 ..... 110100 00000 0 1000 0011 ..... @r_r2 FxTOs 10 ..... 110100 00000 0 1000 0100 ..... @r_r2 FxTOd 10 ..... 110100 00000 0 1000 1000 ..... @r_r2 +FxTOq 10 ..... 110100 00000 0 1000 1100 ..... @r_r2 FiTOs 10 ..... 110100 00000 0 1100 0100 ..... @r_r2 FdTOs 10 ..... 110100 00000 0 1100 0110 ..... @r_r2 FqTOs 10 ..... 110100 00000 0 1100 0111 ..... @r_r2 @@ -275,6 +276,7 @@ FsTOd 10 ..... 110100 00000 0 1100 1001 ..... @r_r2 FqTOd 10 ..... 110100 00000 0 1100 1011 ..... @r_r2 FiTOq 10 ..... 110100 00000 0 1100 1100 ..... @r_r2 FsTOq 10 ..... 110100 00000 0 1100 1101 ..... @r_r2 +FdTOq 10 ..... 110100 00000 0 1100 1110 ..... @r_r2 FsTOi 10 ..... 110100 00000 0 1101 0001 ..... @r_r2 FdTOi 10 ..... 110100 00000 0 1101 0010 ..... @r_r2 FqTOi 10 ..... 110100 00000 0 1101 0011 ..... @r_r2 diff --git a/target/sparc/translate.c b/target/sparc/translate.c index ad2d794b3d..40823f1325 100644 --- a/target/sparc/translate.c +++ b/target/sparc/translate.c @@ -77,6 +77,7 @@ # 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_fxtoq ({ qemu_build_not_reached(); NULL; }) # define gen_helper_pdist ({ qemu_build_not_reached(); NULL; }) # define FSR_LDXFSR_MASK 0 # define FSR_LDXFSR_OLDMASK 0 @@ -1672,19 +1673,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, @@ -4813,6 +4801,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)) { @@ -5100,11 +5111,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); @@ -5118,10 +5127,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 Thu Oct 26 00:15: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: 738277 Delivered-To: patch@linaro.org Received: by 2002:adf:f842:0:b0:32d:baff:b0ca with SMTP id d2csp559180wrq; Wed, 25 Oct 2023 17:38:27 -0700 (PDT) X-Google-Smtp-Source: AGHT+IH4cLO3HuyisudCP/Y/gKrHyOmJMz3x873pME7Rz61KXSd0VdrZCXuNPKs6ascXka2+V8TV X-Received: by 2002:a5d:453a:0:b0:32d:96e0:8048 with SMTP id j26-20020a5d453a000000b0032d96e08048mr12847761wra.9.1698280707697; Wed, 25 Oct 2023 17:38:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698280707; cv=none; d=google.com; s=arc-20160816; b=YgMOCdCYchGxMFGTFpgLv/mv4RIfCjwYX9tXyxGXz218tgJZKyvAtoiZ55nQcK8DgH BQl8F/c1nCXcSf55emrm3PwsFHrg6MlEk8ObqC9EnbRXBfOPAJhTLwsdnkIl/lmWKD7t zjJka6ekCPuxC2zJY7e3bR5yvgf8XkvdHISU84eVlc8d/IV3akbRsjnC/yguoYEV4APG PaZf/e2ak5uHZSNgg3erCyJsI5matUxVbVbywP7htUaLftDbalrV0/+LRfNr7JEsOgx5 S76/noRBpzAYvrOjguqFUWcHsMrqC85wYBeZzMvWLe5zyBGA4CrsfVXL/au0vUEtqI8H Jbyw== 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=sdr8oDySzTkWIfZb6hneR4/eP/NuHeStlGUv/iYpjNI=; fh=rYI8DiHAAFX3O5g969KmOAQ7d45Sb8OxQX1+DywGDk4=; b=XMNCD5WQ4v2bJbVhAjbtIcWp0DzIHcM6FCkDvkcsY5PejhiAgUGHRLLuRs+4gYln3w OkyzyOSjjI5JVf05l2MWWc69pCBJa+Ry6ls+KtLphMD3JjjVbkjt/WJO542pWez2QtBf o/gpnX82ZZAragdAVYGis/CH+uzJSYDnPQvN+dLrmMm7wYGL+hYMFcNyNP1Wd4AuAAXP su5BDMf7SekrWWxN2J1z0U6iBwn8OB1b0AnX81dvcAGDQuXP5AwIRZUk4Nb4aSK6J/44 giWAuwfAcSbAlg3IypXZjxca4XJN6CjbtWKBnZ2pnAjoQC/joC8BanhjNcHyD2opTP/Q m2AQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=CeM+hvvc; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as 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 i14-20020adfe48e000000b0032db7cd58bbsi8191900wrm.517.2023.10.25.17.38.27 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 25 Oct 2023 17:38: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=CeM+hvvc; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as 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 1qvoAR-0006LQ-Mx; Wed, 25 Oct 2023 20:24: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 1qvo9t-0003Yw-Vb for qemu-devel@nongnu.org; Wed, 25 Oct 2023 20:23:34 -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 1qvo9g-0008Iv-32 for qemu-devel@nongnu.org; Wed, 25 Oct 2023 20:23:33 -0400 Received: by mail-pg1-x530.google.com with SMTP id 41be03b00d2f7-5b8f68ba4e5so311935a12.1 for ; Wed, 25 Oct 2023 17:23:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1698279799; x=1698884599; 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=sdr8oDySzTkWIfZb6hneR4/eP/NuHeStlGUv/iYpjNI=; b=CeM+hvvcFdeFPTzebT+ksRiQWGVp10kq27Nh+2CXCGXMSMYoOiFQyDAXB28HpbCAOX H0VL9GMOOGnIwKTwlRxm1PEJULikAWTbTknrQTzRXt5vfhpmabqdxPK8gmtPdKXUP6sd hCXVBhTvdzGjRiDdiV+/6JUUY6qSt7Fqv6/uiDmoBtGF1PievggKHHVRqW3X9nH25m5c e8Jbg+IDPAxWROroZY1P0NrS+qsL7Fad3dV5Xk0a8x7rc1Dju08ojnSPRxpcU3XKzLeG BdEQx+AiTTF8Z+uej7bqW3hgm4H8OlcfSSSAobLSBUR+8DF7IRMBe9z4wFpptKpXTZER 7k7Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1698279799; x=1698884599; 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=sdr8oDySzTkWIfZb6hneR4/eP/NuHeStlGUv/iYpjNI=; b=FwlVDi2sgYom+eTdKzuu5yPyaL5fUka38WdJhrzn8qtLVOtUPG4ify73B6S15rJZrw RPFyAC483vN0PCJOdqStDGsz7KDSfC8R9iPDG+rmHZGuOhWwWaJ4Ivbrwr8ApDsNXTKu euTzjGQqkZ02c7nQFeCYxCIB7Qu1xeyZCf8XlQVpD7Eg2ohiemKn86C20xrYTgqz7xyu DRGjmHgCqo5yQQEDeVs3pYj+CnIcpefkgyx5QO7CDEr555JNw53oB/trPVBo8bLkApNN FevoXmizeQtOeUWt7nFdGcLgmRNLDIgsssHE3DHD1WFNEEqjxi76uZIOxDNfIndG8jIJ 4Y7A== X-Gm-Message-State: AOJu0YxfOTHCt5lZXPxmJm3lP0keO1yJ18Cd8r2F1p20WRKbXEqhQh17 fxlxt8XqQqvUB0qIWyEvl8zCfmq0o+W4RgVp7VM= X-Received: by 2002:a17:90a:d505:b0:27c:efe3:89dc with SMTP id t5-20020a17090ad50500b0027cefe389dcmr13754981pju.14.1698279798710; Wed, 25 Oct 2023 17:23:18 -0700 (PDT) Received: from stoup.. ([71.212.149.95]) by smtp.gmail.com with ESMTPSA id 9-20020a17090a0cc900b0027463889e72sm499870pjt.55.2023.10.25.17.23.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 25 Oct 2023 17:23:18 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: Mark Cave-Ayland Subject: [PULL 88/94] target/sparc: Move FMOVq, FNEGq, FABSq to decodetree Date: Wed, 25 Oct 2023 17:15:36 -0700 Message-Id: <20231026001542.1141412-118-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231026001542.1141412-1-richard.henderson@linaro.org> References: <20231026001542.1141412-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::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 Tested-by: Mark Cave-Ayland Acked-by: Mark Cave-Ayland Signed-off-by: Richard Henderson --- target/sparc/insns.decode | 3 + target/sparc/translate.c | 142 +++++++++++++------------------------- 2 files changed, 51 insertions(+), 94 deletions(-) diff --git a/target/sparc/insns.decode b/target/sparc/insns.decode index e1f5394d17..807ed3f66f 100644 --- a/target/sparc/insns.decode +++ b/target/sparc/insns.decode @@ -241,10 +241,13 @@ RETRY 10 00001 111110 00000 0 0000000000000 FMOVs 10 ..... 110100 00000 0 0000 0001 ..... @r_r2 FMOVd 10 ..... 110100 00000 0 0000 0010 ..... @r_r2 +FMOVq 10 ..... 110100 00000 0 0000 0011 ..... @r_r2 FNEGs 10 ..... 110100 00000 0 0000 0101 ..... @r_r2 FNEGd 10 ..... 110100 00000 0 0000 0110 ..... @r_r2 +FNEGq 10 ..... 110100 00000 0 0000 0111 ..... @r_r2 FABSs 10 ..... 110100 00000 0 0000 1001 ..... @r_r2 FABSd 10 ..... 110100 00000 0 0000 1010 ..... @r_r2 +FABSq 10 ..... 110100 00000 0 0000 1011 ..... @r_r2 FSQRTs 10 ..... 110100 00000 0 0010 1001 ..... @r_r2 FSQRTd 10 ..... 110100 00000 0 0010 1010 ..... @r_r2 FSQRTq 10 ..... 110100 00000 0 0010 1011 ..... @r_r2 diff --git a/target/sparc/translate.c b/target/sparc/translate.c index 40823f1325..e6451f3950 100644 --- a/target/sparc/translate.c +++ b/target/sparc/translate.c @@ -63,6 +63,7 @@ # define gen_helper_write_softint(E, S) qemu_build_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_fabsq ({ qemu_build_not_reached(); NULL; }) # define gen_helper_fdtox ({ qemu_build_not_reached(); NULL; }) # define gen_helper_fexpand ({ qemu_build_not_reached(); NULL; }) # define gen_helper_fmul8sux16 ({ qemu_build_not_reached(); NULL; }) @@ -72,12 +73,13 @@ # define gen_helper_fmul8x16 ({ qemu_build_not_reached(); NULL; }) # define gen_helper_fmuld8sux16 ({ qemu_build_not_reached(); NULL; }) # define gen_helper_fmuld8ulx16 ({ qemu_build_not_reached(); NULL; }) +# define gen_helper_fnegq ({ qemu_build_not_reached(); NULL; }) # define gen_helper_fpmerge ({ qemu_build_not_reached(); NULL; }) # define gen_helper_fqtox ({ 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_fxtoq ({ qemu_build_not_reached(); NULL; }) +# define gen_helper_fxtos ({ qemu_build_not_reached(); NULL; }) # define gen_helper_pdist ({ qemu_build_not_reached(); NULL; }) # define FSR_LDXFSR_MASK 0 # define FSR_LDXFSR_OLDMASK 0 @@ -267,18 +269,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 @@ -1660,19 +1650,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, @@ -4709,6 +4686,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)) { @@ -5063,74 +5084,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 Thu Oct 26 00:15: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: 738285 Delivered-To: patch@linaro.org Received: by 2002:adf:f842:0:b0:32d:baff:b0ca with SMTP id d2csp559417wrq; Wed, 25 Oct 2023 17:39:18 -0700 (PDT) X-Google-Smtp-Source: AGHT+IH0eDFAVQagniAZ0hOZV1doLMarFdSLY+P0l6vMiCL/DmmAn3Lr9GobAgwCyb8k8eN3+jQc X-Received: by 2002:a5d:64a8:0:b0:32d:c692:eacd with SMTP id m8-20020a5d64a8000000b0032dc692eacdmr1474744wrp.9.1698280758162; Wed, 25 Oct 2023 17:39:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698280758; cv=none; d=google.com; s=arc-20160816; b=bDN5eD/aMI9KEtt4Gv51kzOag18SeBnneww7s5H5yWCla23ol1hXKi7b4kw+IwgVZv TZhURf5n88NjZ/A1tAwiRz80Wg7Nm+Xd+PudEis4rk7L4kZsWECTykaCvNiCnxUPnnxM d5slFEyKmyhJD1XXGAFP74beAy82v8oNICTswrLvMoOyT/yevJonqUGj0PkgFnOq93NV +VKIzrkp+AvG8nNuje2u8vaFemqD51tLzRxPsjUCcteTLZMuUFWKGDlnF6MmmURZzm1i Mq2oZsHxHMnHl+DDdAYcyhENouMpTcEmyBKz89UajGvgq2V3JrlF/hSaKZbIJrcExdYK UwlQ== 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=YbAeuFFIY7TPZX4asw1TP0a7buvodVkyZhPcuY29plg=; fh=rYI8DiHAAFX3O5g969KmOAQ7d45Sb8OxQX1+DywGDk4=; b=gSA3PetL+IGvjyXmnlt348Pdj14InHbVYKJydZUhpH6or5ZBD+NZA8Pk7Hfu2kGTEC qAjoAthzGKbpfra9jL7qyi+R+8t2fyXc8a6nJ5Tt93JkMBne1wJkLkLww4BfMIEBGcBz lh0kb8ErpjLMNREuabP1Bv3vP68iuogQ2Z63yxiQHiUsScYgkb18AF+akt5AwkTe0OPJ /fz9tHeu3L1l9PBaNJG7ldoGYgHbv9lWLSFiubynvA0C/usfELoyrWY61GAGu91rxQmM OPuEvScUUYhrlBBtsVRGuIzl/S+ji43WUGkgTCZl+DqxEswpA/H50iU0noD71KONQMKa 2Bfg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="yavyJde/"; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as 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 u14-20020a5d468e000000b0032d81e0a2d0si8364021wrq.357.2023.10.25.17.39.18 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 25 Oct 2023 17:39:18 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="yavyJde/"; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as 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 1qvoA1-0004Kl-Ea; Wed, 25 Oct 2023 20:23: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 1qvo9l-0003K2-LD for qemu-devel@nongnu.org; Wed, 25 Oct 2023 20:23:27 -0400 Received: from mail-pj1-x1029.google.com ([2607:f8b0:4864:20::1029]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qvo9g-0008JE-T6 for qemu-devel@nongnu.org; Wed, 25 Oct 2023 20:23:25 -0400 Received: by mail-pj1-x1029.google.com with SMTP id 98e67ed59e1d1-27d0251d305so222175a91.2 for ; Wed, 25 Oct 2023 17:23:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1698279799; x=1698884599; 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=YbAeuFFIY7TPZX4asw1TP0a7buvodVkyZhPcuY29plg=; b=yavyJde//EK7q7OeRxt2wskHL4EOQJu6uj4EALMK1uLQ9H6R6vmb2RpsfL5ihCyptP ctcLAp/BbUAsLkEpHGCQQNvixkpheaUX9srlh7SkZ17ZH3Uaf28G4u8BgP/cLBC2Ws5U 5HFxiY3c2oSeSAJebBp/9sMoX/O0Q53teUd7dTPwkP86ZhBE9CdQ9RFY9aTBdamsKihG 1EfPSuw10gJg25qv6ZGRohJd8bK9gga2MuOt77ENo2SSaDnw0YGEOHc5BtMp/0Eegk6o G/EP07kI6wuUpZP890lEameAGxUFheqtBJRUPFS0BzRdOz0UIU572vwjDLGM3XrIo9as 0kTw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1698279799; x=1698884599; 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=YbAeuFFIY7TPZX4asw1TP0a7buvodVkyZhPcuY29plg=; b=EFkKzr/2CyKdEHPm6Ejm14ZWmdZmUNe5iwOV/3EMiXyvBns/gXAstNcgR0lbF/BSaP WarPEfFbvdi1fKA8WoTGn6dKWm9ZyQgRAWz4S4Q+V8GOdiOHDa9HaCMpV4Cvh2dhfB0B ukX8Qtu7l6ovTv/sAb9XzwvJwPSxgYYwcEROLT8YxafEOPUIx4S5MW5VHrHSQtRQIBVm HLcgMSpW/kdFDDFfa/XD/c2wBpnoXNQQ40aHONcH/K8CdZk1hRmvCbSwMNIC0HxkDQIg 5RcpkH8sIYlkN8xUvHapEef8gN8CacVDsRfK95p9AsMxd6eOwhoWhEFcoF4y/g2DAajn NnnQ== X-Gm-Message-State: AOJu0YxjOrrQ9a/qJejf/QYhUPLUcnvYGhpPPdwnEc9jcXmqMqMY6pQj 8hiJFmRn1WVuZghB2rEX2HZIM6V9cpO2DZ7fdC4= X-Received: by 2002:a17:90b:2b4d:b0:27d:9b7:cc7 with SMTP id rr13-20020a17090b2b4d00b0027d09b70cc7mr13713541pjb.24.1698279799530; Wed, 25 Oct 2023 17:23:19 -0700 (PDT) Received: from stoup.. ([71.212.149.95]) by smtp.gmail.com with ESMTPSA id 9-20020a17090a0cc900b0027463889e72sm499870pjt.55.2023.10.25.17.23.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 25 Oct 2023 17:23:19 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: Mark Cave-Ayland Subject: [PULL 89/94] target/sparc: Move FMOVR, FMOVcc, FMOVfcc to decodetree Date: Wed, 25 Oct 2023 17:15:37 -0700 Message-Id: <20231026001542.1141412-119-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231026001542.1141412-1-richard.henderson@linaro.org> References: <20231026001542.1141412-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::1029; envelope-from=richard.henderson@linaro.org; helo=mail-pj1-x1029.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org Tested-by: Mark Cave-Ayland Acked-by: Mark Cave-Ayland Signed-off-by: Richard Henderson --- target/sparc/insns.decode | 12 +++ target/sparc/translate.c | 192 ++++++++++++++++---------------------- 2 files changed, 91 insertions(+), 113 deletions(-) diff --git a/target/sparc/insns.decode b/target/sparc/insns.decode index 807ed3f66f..d4487e326a 100644 --- a/target/sparc/insns.decode +++ b/target/sparc/insns.decode @@ -284,6 +284,18 @@ FsTOi 10 ..... 110100 00000 0 1101 0001 ..... @r_r2 FdTOi 10 ..... 110100 00000 0 1101 0010 ..... @r_r2 FqTOi 10 ..... 110100 00000 0 1101 0011 ..... @r_r2 +FMOVscc 10 rd:5 110101 0 cond:4 1 cc:1 0 000001 rs2:5 +FMOVdcc 10 rd:5 110101 0 cond:4 1 cc:1 0 000010 rs2:5 +FMOVqcc 10 rd:5 110101 0 cond:4 1 cc:1 0 000011 rs2:5 + +FMOVsfcc 10 rd:5 110101 0 cond:4 0 cc:2 000001 rs2:5 +FMOVdfcc 10 rd:5 110101 0 cond:4 0 cc:2 000010 rs2:5 +FMOVqfcc 10 rd:5 110101 0 cond:4 0 cc:2 000011 rs2:5 + +FMOVRs 10 rd:5 110101 rs1:5 0 cond:3 00101 rs2:5 +FMOVRd 10 rd:5 110101 rs1:5 0 cond:3 00110 rs2:5 +FMOVRq 10 rd:5 110101 rs1:5 0 cond:3 00111 rs2:5 + { [ EDGE8cc 10 ..... 110110 ..... 0 0000 0000 ..... @r_r_r diff --git a/target/sparc/translate.c b/target/sparc/translate.c index e6451f3950..ff18dc0482 100644 --- a/target/sparc/translate.c +++ b/target/sparc/translate.c @@ -2442,15 +2442,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, @@ -2473,19 +2467,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); @@ -2495,8 +2497,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(); @@ -5053,6 +5059,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; @@ -5086,9 +5158,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; } @@ -5097,110 +5166,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 Thu Oct 26 00:15: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: 738297 Delivered-To: patch@linaro.org Received: by 2002:adf:f842:0:b0:32d:baff:b0ca with SMTP id d2csp560125wrq; Wed, 25 Oct 2023 17:41:41 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGvRSnWhpj4pAFHXkYpIiQ8PjRDtexcsBQAvtKGPXxoX4QW1YsQt28J+imn6xFKG6+tGihg X-Received: by 2002:a05:620a:45a5:b0:778:98b9:d3a9 with SMTP id bp37-20020a05620a45a500b0077898b9d3a9mr21271710qkb.13.1698280901311; Wed, 25 Oct 2023 17:41:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698280901; cv=none; d=google.com; s=arc-20160816; b=zjl0whfFy5TtntH++TflIWSFW1TofPUAHso19e9woXoNcPyic880zkNozY3SYlLMvu kXhF7zF2rD7k7xwyMPalr/JglcUacXjB0I8k28YDkyKn10A4jRAHPqIl3VbCKxXjoXhk +BR+fWmGegxhDmrBs4Re9WwrcnDajr1gKL1eTgkla0kba6RAfcyokkbcO1wqGE0uuxjL bxUP24UcHunNTJ5doRVV9zhSfbm2V1ulCtC2z7+YnSCD/XwoXL61QGsLCUwtwRwyPtnO rgFZyg8mni6CH8yLGj+2nKeTYPN3HzHzTSj5GuS+vWo7f5Tya2JIguDw6CvU0VJXOYQZ o+Yg== 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=OKfAF+H1AcXFL59wBO/5aYmxdpJuCmthIwvpvI4kmMY=; fh=rYI8DiHAAFX3O5g969KmOAQ7d45Sb8OxQX1+DywGDk4=; b=pZqFb15U1k64UCJKcJvHEGjJNe4kQvzj77BcnjozxM5mq5QMuAxyicdpvSz6GzcXla urmZs/ls92N2W9bd4Tec4ImLrRFSHLZaXYIgus80uRthyh9QL3w6eOs3gCoj2Y5todVy 5LFXJCjf7hZGsvYXQLIea1cuJtlixz4ZjZnCEe0O6RksVvOFEqlAo1rRVXMnpEp8yHor J3/zA339XaBqHg/947gjOdEzvjT/Fh4UE9uKhc59VKoohdxXhWhKvso+Z8tMYiG6DqP+ MY2rLnpZizgsmXQPqoQlBwMVJsO0sv0wBdCisMTdVhCkmr+Ec8GaTuZTFPrBlgCf6zlN yWYw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=KkUI2FsU; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as 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 t9-20020a05620a450900b00775787784bfsi8949352qkp.67.2023.10.25.17.41.41 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 25 Oct 2023 17:41: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=KkUI2FsU; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as 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 1qvoAm-0007Ft-DR; Wed, 25 Oct 2023 20:24: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 1qvo9l-0003K6-Rm for qemu-devel@nongnu.org; Wed, 25 Oct 2023 20:23:27 -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 1qvo9h-0008JU-G4 for qemu-devel@nongnu.org; Wed, 25 Oct 2023 20:23:25 -0400 Received: by mail-pf1-x431.google.com with SMTP id d2e1a72fcca58-6b36e1fcea0so288984b3a.1 for ; Wed, 25 Oct 2023 17:23:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1698279800; x=1698884600; 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=OKfAF+H1AcXFL59wBO/5aYmxdpJuCmthIwvpvI4kmMY=; b=KkUI2FsU+9j3XGQ2qBe9Rnt+ZaLj+U1e4TiVDAeOwI5cNQQzr35oumXSp5I1Ail5lS Cdd3XgzO7dSG7Km8RYGWl5R/mPOZsmgAR4VH9/zILeoAA+xY4pCCIDnT0q03m4ZzlJom o1ngMwgAiq8KZH4e70SXL0ufd3ByXwg39I0ScMLpZPWzSMcNHsyRHxXvWxF4WBWOOuAA pFOIr1QPLzmjCgY03jtiZJRWRI2JptE9FsHiLW2MGD5bHbbBoUl+s77pD5URd+F5ltMQ 4Syu9oxvTrb7sD+rU2YmZwIpNFp6kNQLgPSTvxunUHwqX5RRcrCJPtOs9J3B3vmCFEsi Qfjg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1698279800; x=1698884600; 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=OKfAF+H1AcXFL59wBO/5aYmxdpJuCmthIwvpvI4kmMY=; b=aE2hnXxu9z8UTUXrore2H2NiMwJQ/0hSNepWjLsx43Ap/hHY7RP+NEf2k0wlvE0pRs lxipEGx6/QUGt1WQq8xj9xXm8VdC+p3XqMOwkGpD6V3cKARnI1LekgrAAnA+Nb1TbS6A kz6Mhl8RlmPxVi25a01oXLDAPP5mScUFMMN5HjqeNS8ZuJm2k0vS/kSrS9Egv5C8K9hp i0KCLCKA9s1RjzQ9PVxmVZf7jfHyPzKU3bS6YZTflT19QLeVN+cLzftG1CaQbjCPvCP0 Wq65NZD9RxlqAk8zDB1X1wsdc9cDcDLJHcwGAtDTqh8Wmh9Vo2tRl0tWQOecMoKcoTIX k+cw== X-Gm-Message-State: AOJu0YyptkTnMYNNePGJ12ZqZABs0ZuO8F27sOdseWPkg/t7+voDwhaK +LeKotHjRUCbwKNYHOPVofyDpP/71Ydzweq3N/8= X-Received: by 2002:a05:6a20:4420:b0:12f:c0c1:d70 with SMTP id ce32-20020a056a20442000b0012fc0c10d70mr8421125pzb.40.1698279800240; Wed, 25 Oct 2023 17:23:20 -0700 (PDT) Received: from stoup.. ([71.212.149.95]) by smtp.gmail.com with ESMTPSA id 9-20020a17090a0cc900b0027463889e72sm499870pjt.55.2023.10.25.17.23.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 25 Oct 2023 17:23:19 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: Mark Cave-Ayland Subject: [PULL 90/94] target/sparc: Convert FCMP, FCMPE to decodetree Date: Wed, 25 Oct 2023 17:15:38 -0700 Message-Id: <20231026001542.1141412-120-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231026001542.1141412-1-richard.henderson@linaro.org> References: <20231026001542.1141412-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::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 Tested-by: Mark Cave-Ayland Acked-by: Mark Cave-Ayland Signed-off-by: Richard Henderson --- target/sparc/insns.decode | 7 ++ target/sparc/translate.c | 145 +++++++++++++++++++++++--------------- 2 files changed, 96 insertions(+), 56 deletions(-) diff --git a/target/sparc/insns.decode b/target/sparc/insns.decode index d4487e326a..f197bb0b36 100644 --- a/target/sparc/insns.decode +++ b/target/sparc/insns.decode @@ -296,6 +296,13 @@ FMOVRs 10 rd:5 110101 rs1:5 0 cond:3 00101 rs2:5 FMOVRd 10 rd:5 110101 rs1:5 0 cond:3 00110 rs2:5 FMOVRq 10 rd:5 110101 rs1:5 0 cond:3 00111 rs2:5 +FCMPs 10 000 cc:2 110101 rs1:5 0 0101 0001 rs2:5 +FCMPd 10 000 cc:2 110101 rs1:5 0 0101 0010 rs2:5 +FCMPq 10 000 cc:2 110101 rs1:5 0 0101 0011 rs2:5 +FCMPEs 10 000 cc:2 110101 rs1:5 0 0101 0101 rs2:5 +FCMPEd 10 000 cc:2 110101 rs1:5 0 0101 0110 rs2:5 +FCMPEq 10 000 cc:2 110101 rs1:5 0 0101 0111 rs2:5 + { [ EDGE8cc 10 ..... 110110 ..... 0 0000 0000 ..... @r_r_r diff --git a/target/sparc/translate.c b/target/sparc/translate.c index ff18dc0482..ddde64dfb4 100644 --- a/target/sparc/translate.c +++ b/target/sparc/translate.c @@ -5125,6 +5125,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; @@ -5135,15 +5211,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: @@ -5153,61 +5221,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; } @@ -5392,14 +5421,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 Thu Oct 26 00:15: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: 738249 Delivered-To: patch@linaro.org Received: by 2002:adf:f842:0:b0:32d:baff:b0ca with SMTP id d2csp557193wrq; Wed, 25 Oct 2023 17:32:29 -0700 (PDT) X-Google-Smtp-Source: AGHT+IExI6RLXiacIdpccHCX+/DK68SUf/hMvjynG4islfK/JC/NRi/gsUZHmOOue4iqVfC2Jaa6 X-Received: by 2002:a17:907:da0:b0:9bd:a73a:7a0d with SMTP id go32-20020a1709070da000b009bda73a7a0dmr13168345ejc.13.1698280348946; Wed, 25 Oct 2023 17:32:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698280348; cv=none; d=google.com; s=arc-20160816; b=L9gFbJMMrpSDtCAOR9Iyg1Yh4E0zRq1CrNY7Sperkm/Fm/2f6rVEu0b+6ZUNdqN4Wo sO0MSerVze/fvTxnHE1VEzbEMa7W6FJaR4NRaXkXfvPFsQxWGWpH+DMm27EoM9h0yvQe PUc244QylQf3PsdDd45FOLGTwzrJDiYQgpYXuXCWB1X1N4ugK+JNn4q+uEQWXNvp2jpW q6opnObShQYy7DVfMxzw5mGFvQV2vF+PewuwpBCMtMzwGBEbw5nVQ5Hf6J3WJpNC5aKH ddICfqjtZvFwS4Wdfjjt2DVIrPTb0c1pdndmH/6qv+NoD17IYfLWm/RCfuFn2O7BqkYM hdQA== 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=TlDQR2RS1X5QFIGEv7Zn93QeQqX1awIw1sbXo7EVy3E=; fh=rYI8DiHAAFX3O5g969KmOAQ7d45Sb8OxQX1+DywGDk4=; b=OWGBw4sFyk+tcoZOF8euRPnAIpqWIhRBjZYYZZOa0JaW4hzuTPFMweg2pqeGniL64O 7xN7X8O1lE92qtz+hnBwws3LCx/4btVRtQU7z09yKE305r7HBP03eHH4pSt6xQSq5GrH 1cf9E1tdHOFllrlLn0PkfJWrrhks/ZF1ObzxwuOSKPEcrDeduz6iqc2pEtLKmQfhstRw 0P+7A/Eij6UeisjHd68+60DYE5EFg5gKzUvdOFXwDL2HELtxgUhLjRgh4XsYe6jk/gwZ Do2H2eKXCaaWtTip63mWg7R1phRzDMawan3hAsMRBzpxavGwJJL7He4ohO3XocoiYRvT t+3A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=DzBDDQM0; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as 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 cw5-20020a170906c78500b009b2ca12045esi5557337ejb.762.2023.10.25.17.32.28 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 25 Oct 2023 17:32: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=DzBDDQM0; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as 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 1qvoCk-0003q6-4O; Wed, 25 Oct 2023 20:26: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 1qvoCg-0003bi-Cz for qemu-devel@nongnu.org; Wed, 25 Oct 2023 20:26:26 -0400 Received: from mail-pj1-x1032.google.com ([2607:f8b0:4864:20::1032]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qvoCe-0000Xu-7z for qemu-devel@nongnu.org; Wed, 25 Oct 2023 20:26:26 -0400 Received: by mail-pj1-x1032.google.com with SMTP id 98e67ed59e1d1-27db9fdec16so238068a91.2 for ; Wed, 25 Oct 2023 17:26:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1698279982; x=1698884782; 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=TlDQR2RS1X5QFIGEv7Zn93QeQqX1awIw1sbXo7EVy3E=; b=DzBDDQM0mSVvtFSzl2pUm5Swwj2XTEg71rVDea3lmPTT5rEYyLadYjqVgp3RhvwzE8 Qtj0BDUfMdyUabzLVQ9/6v17qY5yQrNMdl4JT49v2puo99UKtOjhwz9bUkNpxK+RuOhz 3jMqbvpog3SOTvGdRB/EkwtTh5O+dGjOf3R14pN1hCd4U/y9wOcT+ifjvOo6cng+Xk1w W7W8Sq8NkBTF3JIw7/i8vlBpwHXRVeJaKScL3QGyWZjYu7qJey/+Lu2oaUVaDkjDGscw atJHI52Up95inwIadktUI2VwEl5AR56DB9gmGy7OLsnNIdVpI9NqMhUMMJ11QrOuXwFH e+CA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1698279982; x=1698884782; 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=TlDQR2RS1X5QFIGEv7Zn93QeQqX1awIw1sbXo7EVy3E=; b=EVgrB3Dqag61GW/UFDWBAKvoB0yEoeq56qdLm1qKqjV8nRMKFHrriCpNfCvV5O7ODy ua9mf7OVKNTc7CQT874SBButLeQz/aAJllVSuZ2RESTi95INiZLOYJ9ykfDrc8eZkovy 1rV1JTiMECX/hE6qSj57/qHH5+7ubbJpaxirAxKZnmPrmT+X6G2sKkhVVA/2t0biqyiY n7YGrzyr6K5ucJKRAR97P6LtDjBfrohNDQC2yBNcl++hXV2sSsaw8+gq+g0R2TfGRV8p FBtUr1olDUP6C4kt0UM6PutmmzkXqzsrRIBy5326NFF5YwL9RO19OoocmH8KrWtp86Ru Zh+w== X-Gm-Message-State: AOJu0YwM8ELAVbLMyPzkfEFAA10l2m4YhY5CjP8cFTDR502LFa/HD7JI +KqFqKNh5MGA57iUZW3quRI1+ZZ/ByKeI+uq7CY= X-Received: by 2002:a17:90a:9f06:b0:27d:a015:a783 with SMTP id n6-20020a17090a9f0600b0027da015a783mr13125374pjp.35.1698279981710; Wed, 25 Oct 2023 17:26:21 -0700 (PDT) Received: from stoup.. ([71.212.149.95]) by smtp.gmail.com with ESMTPSA id gv24-20020a17090b11d800b00262ca945cecsm438134pjb.54.2023.10.25.17.26.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 25 Oct 2023 17:26:21 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: Mark Cave-Ayland Subject: [PULL 91/94] target/sparc: Move FPCMP* to decodetree Date: Wed, 25 Oct 2023 17:15:39 -0700 Message-Id: <20231026001542.1141412-121-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231026001542.1141412-1-richard.henderson@linaro.org> References: <20231026001542.1141412-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::1032; envelope-from=richard.henderson@linaro.org; helo=mail-pj1-x1032.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org Tested-by: Mark Cave-Ayland Acked-by: Mark Cave-Ayland Signed-off-by: Richard Henderson --- target/sparc/insns.decode | 9 ++++ target/sparc/translate.c | 90 +++++++++++++++++---------------------- 2 files changed, 47 insertions(+), 52 deletions(-) diff --git a/target/sparc/insns.decode b/target/sparc/insns.decode index f197bb0b36..781c3cd7f7 100644 --- a/target/sparc/insns.decode +++ b/target/sparc/insns.decode @@ -327,6 +327,15 @@ FCMPEq 10 000 cc:2 110101 rs1:5 0 0101 0111 rs2:5 BMASK 10 ..... 110110 ..... 0 0001 1001 ..... @r_r_r + FPCMPLE16 10 ..... 110110 ..... 0 0010 0000 ..... @r_r_r + FPCMPNE16 10 ..... 110110 ..... 0 0010 0010 ..... @r_r_r + FPCMPGT16 10 ..... 110110 ..... 0 0010 1000 ..... @r_r_r + FPCMPEQ16 10 ..... 110110 ..... 0 0010 1010 ..... @r_r_r + FPCMPLE32 10 ..... 110110 ..... 0 0010 0100 ..... @r_r_r + FPCMPNE32 10 ..... 110110 ..... 0 0010 0110 ..... @r_r_r + FPCMPGT32 10 ..... 110110 ..... 0 0010 1100 ..... @r_r_r + FPCMPEQ32 10 ..... 110110 ..... 0 0010 1110 ..... @r_r_r + FMUL8x16 10 ..... 110110 ..... 0 0011 0001 ..... @r_r_r FMUL8x16AU 10 ..... 110110 ..... 0 0011 0011 ..... @r_r_r FMUL8x16AL 10 ..... 110110 ..... 0 0011 0101 ..... @r_r_r diff --git a/target/sparc/translate.c b/target/sparc/translate.c index ddde64dfb4..3ee1015cc4 100644 --- a/target/sparc/translate.c +++ b/target/sparc/translate.c @@ -64,6 +64,14 @@ # define gen_helper_wrpil(E, S) qemu_build_not_reached() # define gen_helper_wrpstate(E, S) qemu_build_not_reached() # define gen_helper_fabsq ({ qemu_build_not_reached(); NULL; }) +# define gen_helper_fcmpeq16 ({ qemu_build_not_reached(); NULL; }) +# define gen_helper_fcmpeq32 ({ qemu_build_not_reached(); NULL; }) +# define gen_helper_fcmpgt16 ({ qemu_build_not_reached(); NULL; }) +# define gen_helper_fcmpgt32 ({ qemu_build_not_reached(); NULL; }) +# define gen_helper_fcmple16 ({ qemu_build_not_reached(); NULL; }) +# define gen_helper_fcmple32 ({ qemu_build_not_reached(); NULL; }) +# define gen_helper_fcmpne16 ({ qemu_build_not_reached(); NULL; }) +# define gen_helper_fcmpne32 ({ qemu_build_not_reached(); NULL; }) # define gen_helper_fdtox ({ qemu_build_not_reached(); NULL; }) # define gen_helper_fexpand ({ qemu_build_not_reached(); NULL; }) # define gen_helper_fmul8sux16 ({ qemu_build_not_reached(); NULL; }) @@ -4947,6 +4955,34 @@ 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, TCGv_i64, TCGv_i64)) +{ + TCGv_i64 src1, src2; + TCGv dst; + + 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); +} + +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)) { @@ -5229,11 +5265,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); @@ -5309,63 +5343,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 Thu Oct 26 00:15: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: 738259 Delivered-To: patch@linaro.org Received: by 2002:adf:f842:0:b0:32d:baff:b0ca with SMTP id d2csp557626wrq; Wed, 25 Oct 2023 17:33:38 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHtAeCI5Ic32aHv0PhF6tZ+nupjRtDsMBaNguIZqEZenzaSnS1KxLMlfJZz70zI9D4c23Qt X-Received: by 2002:a05:600c:488a:b0:408:369a:dad1 with SMTP id j10-20020a05600c488a00b00408369adad1mr1222198wmp.4.1698280418563; Wed, 25 Oct 2023 17:33:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698280418; cv=none; d=google.com; s=arc-20160816; b=K2yTA31Zk/xAsm+td/RVJW7qOVu/6QynMCh7s+THmehnoLObqIO5t1MJfjl7HpEd/z ZwwX1p9U8IsL2Zy0vmWbgqc/NzUEbCNj4r348NIKFwoCsVnN6Gi/mGuVtcgQhs1EQbqa E1DJkocwF1Ld5+v1kuzWWcj0Te+NL1LohYKo5W5pdsd4zxE4k6WL5c55WGXGyMEU92kN mMomIisUzzmngeOXdPCQRH1fDOqrqiCQvRZG796dLdJ+U9f6kBRqs9Q6hzhKeO5gxORh CN9ITG+uYTABKuCn5agpu8lLHAZky2T4Zr+DMPxXqROpIOByOdu3CFud4eLshWz5QGe/ UeSQ== 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=TQF3etiI8esxPvJgRU7maR5kYUtpFP3hIg8XqhuROnM=; fh=rYI8DiHAAFX3O5g969KmOAQ7d45Sb8OxQX1+DywGDk4=; b=V0e9Hh+3VAQk3mAPmI4VuhISu6SXCAdJ12ymr/epI7ppe3AXlls6yowZABdfJevK5G llWAghSkWueTZuvVZqbyYk5jb0EMylowBaY888YMBKIOsDH1rgRkx9XzaKtIl72DiOS3 6DYIuq3v71DGPmNW8XosL6hJkF1K/dSPeXbPf7AJ1ktqLpq5/tqXJf/jL82lSZoMKNKQ pA7ysDCW6CuuHXVZsBcESnSm58+u36t6XGPW10HV03ApQZ3KyxTy01eJz1KcQx9hR4Eo lm22vllqmkAMixn45oLi81zZ6grfZrujt4s/zce+f2OAbcHmdoi6x0hLgqeEB+U697EK XVnQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=NB6BpZhn; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as 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 n11-20020a5d400b000000b0032da480825fsi8202589wrp.466.2023.10.25.17.33.38 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 25 Oct 2023 17:33: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=NB6BpZhn; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as 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 1qvoCj-0003io-TL; Wed, 25 Oct 2023 20:26: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 1qvoCf-0003bX-Vs for qemu-devel@nongnu.org; Wed, 25 Oct 2023 20:26:26 -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 1qvoCe-0000Zn-5y for qemu-devel@nongnu.org; Wed, 25 Oct 2023 20:26:25 -0400 Received: by mail-pg1-x532.google.com with SMTP id 41be03b00d2f7-5b856d73a12so301590a12.1 for ; Wed, 25 Oct 2023 17:26:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1698279982; x=1698884782; 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=TQF3etiI8esxPvJgRU7maR5kYUtpFP3hIg8XqhuROnM=; b=NB6BpZhnyT4ljfbyrFS1szRwoQScY6lDcDvRuabPfrOhznxhNPtd8XmKJB1uQBx0wG Id7EpL2bbvUmE3Q4QgcL8Yv670axoSfRIXdxRyERPRGDKOHEWayNoRZZ0CpmnAzs/41w Cxg9FnPh+RJjlmSdFri7JqajyRMPWOzBHbCoUZd2b0kBcYPDCAk9ZWLG4BZGjEldSfod NAcCyi8c3cv+/a9Uux+8wJS/H5ihZR7K1f0iu5DoOglmsenMbJyTz6qaoSIc3L6r7Nwb E7s3Q9DliiTKOMJKbu7T7Ku7ZyII1MkdHYOaDrtu6cXLyCFzOYykv2U1B3PC4Scj8Mjs GQGw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1698279982; x=1698884782; 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=TQF3etiI8esxPvJgRU7maR5kYUtpFP3hIg8XqhuROnM=; b=A+PovdGxOROni3YQF1taVdPhzQOacRHhiJKRiwDQVGl/Q7veP2dzG5L4cZnkvB3AxC lvkaWkLb9kJVRwD//f9dCu/0bxO/k5RokCuWI2wCA7zvnw/8hssLz2C+FzYHIPrLT3Mn ofvYuy0HUY0ZxRQLuOHvrI9el8Ir/kzJP2GsQ98pLSkI/SRBRXj7UO4habcznn4yzZH/ RZzvQSwVC/s2sgXWdmUN3kANxlv7kAglhxt1ibgPgNhBwGgowkNadiNW5Or+EYM20yy/ 84dTzQTWmMHN4xBbuY5WBZN+ypFUaPNXhbXcJcehQ8Ekjb+cYV9dwu0dPbv9wD5x5SJ2 P8OA== X-Gm-Message-State: AOJu0YxvDPI9X4AWeI+WCv68LW6U78NJLbmaPIb8PGtKq0FWgmDWpL/B WOQlB4Af5jykURGp4E8ll7gXAjo00nX2wi/GjHw= X-Received: by 2002:a17:90b:3812:b0:27d:3f08:cc21 with SMTP id mq18-20020a17090b381200b0027d3f08cc21mr17856206pjb.5.1698279982626; Wed, 25 Oct 2023 17:26:22 -0700 (PDT) Received: from stoup.. ([71.212.149.95]) by smtp.gmail.com with ESMTPSA id gv24-20020a17090b11d800b00262ca945cecsm438134pjb.54.2023.10.25.17.26.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 25 Oct 2023 17:26:22 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: Mark Cave-Ayland Subject: [PULL 92/94] target/sparc: Move FPACK16, FPACKFIX to decodetree Date: Wed, 25 Oct 2023 17:15:40 -0700 Message-Id: <20231026001542.1141412-122-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231026001542.1141412-1-richard.henderson@linaro.org> References: <20231026001542.1141412-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::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 Tested-by: Mark Cave-Ayland Acked-by: Mark Cave-Ayland Signed-off-by: Richard Henderson --- target/sparc/insns.decode | 2 ++ target/sparc/translate.c | 55 ++++++++++++++++++++++++++++----------- 2 files changed, 42 insertions(+), 15 deletions(-) diff --git a/target/sparc/insns.decode b/target/sparc/insns.decode index 781c3cd7f7..18a840709f 100644 --- a/target/sparc/insns.decode +++ b/target/sparc/insns.decode @@ -344,6 +344,8 @@ FCMPEq 10 000 cc:2 110101 rs1:5 0 0101 0111 rs2:5 FMULD8SUx16 10 ..... 110110 ..... 0 0011 1000 ..... @r_r_r FMULD8ULx16 10 ..... 110110 ..... 0 0011 1001 ..... @r_r_r FPACK32 10 ..... 110110 ..... 0 0011 1010 ..... @r_r_r + FPACK16 10 ..... 110110 00000 0 0011 1011 ..... @r_r2 + FPACKFIX 10 ..... 110110 00000 0 0011 1101 ..... @r_r2 PDIST 10 ..... 110110 ..... 0 0011 1110 ..... @r_r_r FALIGNDATAg 10 ..... 110110 ..... 0 0100 1000 ..... @r_r_r diff --git a/target/sparc/translate.c b/target/sparc/translate.c index 3ee1015cc4..15c91c6caa 100644 --- a/target/sparc/translate.c +++ b/target/sparc/translate.c @@ -756,6 +756,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 @@ -4589,6 +4607,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)) { @@ -5265,10 +5303,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)) { @@ -5351,21 +5388,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 Thu Oct 26 00:15: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: 738289 Delivered-To: patch@linaro.org Received: by 2002:adf:f842:0:b0:32d:baff:b0ca with SMTP id d2csp559611wrq; Wed, 25 Oct 2023 17:39:53 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEKPWjK3R3TxW+jHtiZViDvuz2DiMyfkZKvPeNhnUuQhui2t//ztwwHlihT62ModWOLypuM X-Received: by 2002:a05:600c:154e:b0:402:e68f:8896 with SMTP id f14-20020a05600c154e00b00402e68f8896mr12852376wmg.0.1698280793612; Wed, 25 Oct 2023 17:39:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698280793; cv=none; d=google.com; s=arc-20160816; b=w1zFx+Ceaee9Jzqjc5yX/U/F4pHgfQr1o/jkqG92Ti0vqJUhQXzfxZZLQWnrs6AmXd B6Drrp0kL7QBtuh2JCCQLmBX0C27GIXYDO5Bk9BTgVnEXS8K+EjvEkhEmSkXnX4X+X3V mHZDD05Hc/DMUbJwDNYoh9EMgji35NbpoAQgg9y2Pr0XBDFD38MaVMMrIR4nAfS4wqWN n/CJgItXMgqwyDh0r5NlOKqCpiuBnndSrGAmQCVt2dpK6tM8S4MmXhV7ckZX22JVtsuB 2O9yX5ifncQFenFN+0qVW7eYEr3o9XeK+b3gSSsJoKPLEsU0wAr/znJXAPgkw+K3k7Al Rptw== 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=M7Hy4FRhrtQMUQBOlTBEDnVOTqOwnk/keHHETr31iWo=; fh=rYI8DiHAAFX3O5g969KmOAQ7d45Sb8OxQX1+DywGDk4=; b=Am7WBN0SjKiAl0fdJFFVt/K/4SJJN9szSqD3eIy+wdmzFmxlas4fZrPYhwn7Z9SKoD H7hcNxEfYlX+L6QJwbmWxBe5eK9TkwOv1IPnmhNzVzbX03Kkb+ND/F4aCKLnMCWZdVaO YDMDHEmzd409JKRpUYwAyqzp7sXt2HBLcl9JvZTFD7+BDKoWNRyEtrsTYwOmVcXNTWYr pqpvv7+fZYfOkz8p/r45egD/YZG5tKXS2dUScDkcexNRoZH7618NCx0xHl/F4zMFF5uy aN6cr1BlG2hEzTgzWf4GN+4PTfQkaAs801Oeffl04QbQeisELCSqYAdDKGXnLJoy0ELd ZwEw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=TIi51CWi; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as 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 f14-20020a0560001b0e00b0032da15f2963si8145117wrz.732.2023.10.25.17.39.53 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 25 Oct 2023 17:39: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=TIi51CWi; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as 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 1qvoCl-0003vb-Qn; Wed, 25 Oct 2023 20:26:31 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qvoCh-0003dR-Np for qemu-devel@nongnu.org; Wed, 25 Oct 2023 20:26:27 -0400 Received: from mail-pj1-x102f.google.com ([2607:f8b0:4864:20::102f]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qvoCf-0000dm-Vx for qemu-devel@nongnu.org; Wed, 25 Oct 2023 20:26:27 -0400 Received: by mail-pj1-x102f.google.com with SMTP id 98e67ed59e1d1-27ddc1b1652so225961a91.2 for ; Wed, 25 Oct 2023 17:26:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1698279983; x=1698884783; 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=M7Hy4FRhrtQMUQBOlTBEDnVOTqOwnk/keHHETr31iWo=; b=TIi51CWiyBmVuXHZXDOOxM+LnL8jdxoBr63GIri14DNQi6gJwz4NXWiZrPLOz6JmD9 xKFtxIBHZKt4AqdQU7qiUsmuXoos4sucmgcuunxi+2GTUTuScoc0Q8x5cdbb2t51t0Xn fen1FBvZP8DtT1IvbclAuWNcqGNnQkPaJIK0vkVCOcFbedp3BjPr5qOf6z1O8n8Qa8To zGLU6rV0zmsnU0OwRbDyScIY9GwBsVYxfJkPijUIynH1vD8FCh9CS06jiCWYIlkUJlLi H+6NuJ8PHjHZ+Ve74hzCYPeFgcL0yTfef3wpjhNaBr2SOvQoGZLWjY3WslIAOIhz3cmA wCBA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1698279983; x=1698884783; 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=M7Hy4FRhrtQMUQBOlTBEDnVOTqOwnk/keHHETr31iWo=; b=IQiBcSsUW+PrmNWgIj/oXnhNr7ox/0fKHMeSLl0EOzJ+J5CbbHtqgjo2qcUV2PNoP3 N3DmOLvTBqKm7rCRKPcvoxzb+oHTMLjTBLOzmX9BcT3zjq7BiwYb2LWj6tM6PK1uN9cE P1EfU1JSdwN3w8gdpvL9iVDEHlDmhv3BWtsE4+QnLvAr6utv6U+nwDKmhQzdygll4OmE 5evUoH+WCrpb/cOXys1A4WDCoLIDJQ9sO7UzjDNqrUpjHe+vNMoi7mbpaMIIOmObBoTb TUHIWMLKqZxb8Tobtkk9mCCgsWzT6oms7/pf0Cggwy0XMQb5Njffgyz+XWYqRQlfecDA ZvuQ== X-Gm-Message-State: AOJu0Yy6s9mmcPZHNKQn92EIbl95BGGoJ2BN4UxTHoenEX5yRj9bnyy0 Fd48OMAWj9AP71x0MxnqMSZH/1qrRCm07PyC55s= X-Received: by 2002:a17:90b:1d09:b0:27d:48e1:d1e8 with SMTP id on9-20020a17090b1d0900b0027d48e1d1e8mr15767986pjb.13.1698279983439; Wed, 25 Oct 2023 17:26:23 -0700 (PDT) Received: from stoup.. ([71.212.149.95]) by smtp.gmail.com with ESMTPSA id gv24-20020a17090b11d800b00262ca945cecsm438134pjb.54.2023.10.25.17.26.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 25 Oct 2023 17:26:23 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: Mark Cave-Ayland Subject: [PULL 93/94] target/sparc: Convert FZERO, FONE to decodetree Date: Wed, 25 Oct 2023 17:15:41 -0700 Message-Id: <20231026001542.1141412-123-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231026001542.1141412-1-richard.henderson@linaro.org> References: <20231026001542.1141412-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::102f; envelope-from=richard.henderson@linaro.org; helo=mail-pj1-x102f.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org Tested-by: Mark Cave-Ayland Acked-by: Mark Cave-Ayland Signed-off-by: Richard Henderson --- target/sparc/insns.decode | 5 +++ target/sparc/translate.c | 69 +++++++++++++++++++++++---------------- 2 files changed, 45 insertions(+), 29 deletions(-) diff --git a/target/sparc/insns.decode b/target/sparc/insns.decode index 18a840709f..0552f1447d 100644 --- a/target/sparc/insns.decode +++ b/target/sparc/insns.decode @@ -391,6 +391,11 @@ FCMPEq 10 000 cc:2 110101 rs1:5 0 0101 0111 rs2:5 FORNOTs 10 ..... 110110 ..... 0 0111 1011 ..... @r_r_r_swap # ... 1s FORd 10 ..... 110110 ..... 0 0111 1100 ..... @r_r_r FORs 10 ..... 110110 ..... 0 0111 1101 ..... @r_r_r + + FZEROd 10 rd:5 110110 00000 0 0110 0000 00000 + FZEROs 10 rd:5 110110 00000 0 0110 0001 00000 + FONEd 10 rd:5 110110 00000 0 0111 1110 00000 + FONEs 10 rd:5 110110 00000 0 0111 1111 00000 ] NCP 10 ----- 110110 ----- --------- ----- # v8 CPop1 } diff --git a/target/sparc/translate.c b/target/sparc/translate.c index 15c91c6caa..62c77ae5e1 100644 --- a/target/sparc/translate.c +++ b/target/sparc/translate.c @@ -4586,6 +4586,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)) { @@ -5303,10 +5342,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; @@ -5390,31 +5426,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 @@ -5439,11 +5455,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 Thu Oct 26 00:15: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: 738253 Delivered-To: patch@linaro.org Received: by 2002:adf:f842:0:b0:32d:baff:b0ca with SMTP id d2csp557477wrq; Wed, 25 Oct 2023 17:33:15 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGPUM7Sh1NOiiA0Sme+t8tUJYfsKMc31v65JETvPbbI/F7mL11FDCs8zkEwnCHIHjkLOET4 X-Received: by 2002:adf:f552:0:b0:32d:90f7:ce4f with SMTP id j18-20020adff552000000b0032d90f7ce4fmr11164598wrp.38.1698280395002; Wed, 25 Oct 2023 17:33:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698280394; cv=none; d=google.com; s=arc-20160816; b=OY3CWE2o8o3U7Pvcw6Kk3eNWwQbsCBAZUvgDaXc1PpjxgdizwVz9i5TyB7EY/otZUa GsATmwOOxuKQ4fu5STazIt2rLvEtFJHTN2usYnJxjpJvXCPHXsjW6v40g5BJ/mYNNgkM yAH31Q1nyb+nBy7w0GNCawELfqvETP8J0OaJZf+iD/dtSXXTHSeWjDyAMjoyYNiNuCNe A6ZUr9z18oOtU56gjb48HnJcDKkRLCYvOZGBAaSbdv1g6n9qwqKW7OKgwhAWx1RHcj5t oj/mWzGWjUE7XUwbN4WiucBz0ItZ6wy1s54Q2w5sF1xYhwpX2S0yXYYAZl58ByYf9mLs 0RoA== 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=UNlHweIcSWalX2p286xPjt52l47jSewmSDxHwGQ1o5o=; fh=rYI8DiHAAFX3O5g969KmOAQ7d45Sb8OxQX1+DywGDk4=; b=d/du050V81ssVixDXIXTXl1viN/yN4c3Cj9G5srnKgf5uI8YpFdrXlNi8lA4TxHEWe VNTsOC8lIDr8CinUOotwZ9JuxAvNJZNjc7HJtgWwQND2UIGhj0dPd8FgLS2jl5K0vAxa Omu0sV9yO61bHY2zhint8m4qKOggtspeJWaLExDUlUEjqOdvPNO6YQ504SLdac28WO8s wYBEoUyAi+j3xYZWCToQpv8sDRZHnkBDO181j1aGWAs/7Up9Ug+rojcOVZWBzvfT7Fxm imykrBhj0KkiFFhdk7/FjhiRQp5rKqjuBf7f4rfOS2yREn65NY8Ifb94bvDmY+B0kLNM D//Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=WpoGiTQj; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as 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 c17-20020adfef51000000b0031f32beb1d1si8169430wrp.477.2023.10.25.17.33.14 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 25 Oct 2023 17: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=WpoGiTQj; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as 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 1qvoCk-0003t1-Su; Wed, 25 Oct 2023 20:26:31 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qvoCh-0003dQ-Fn for qemu-devel@nongnu.org; Wed, 25 Oct 2023 20:26:27 -0400 Received: from mail-pf1-x42e.google.com ([2607:f8b0:4864:20::42e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qvoCf-0000eK-GP for qemu-devel@nongnu.org; Wed, 25 Oct 2023 20:26:27 -0400 Received: by mail-pf1-x42e.google.com with SMTP id d2e1a72fcca58-6be0277c05bso301909b3a.0 for ; Wed, 25 Oct 2023 17:26:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1698279984; x=1698884784; 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=UNlHweIcSWalX2p286xPjt52l47jSewmSDxHwGQ1o5o=; b=WpoGiTQj4BNo2uIiW2VgsbLHF6wy3/IlgonXobcdMNZmCi3kDjuuI6qd+04cwW6jGv 4w2X81sCcUnUCj85uXVw50gIsHvaYyEwqGHP+iNno/4PQH5X5mkfjVwfEj8pX4s3cI32 R9SqdJfjZmBjM74wqzD9OGMpyeYGNqeUuLzvHGcNFCiuvFQuz8FrJ0uCvu8Oj+OZ/8UO is3S0ERgpO3MygOCF6rQnD+FwyF/GJH0lY/BeBIhAvollUdozkRg0w4vMgVVOVaS2Ezo y+bcym+UNpUnbLw0frz1ncEhZ+GxK7iwM3lIqZGcmRHIP82pXH44PUvzFBEbJI4onFnE d4Ag== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1698279984; x=1698884784; 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=UNlHweIcSWalX2p286xPjt52l47jSewmSDxHwGQ1o5o=; b=XJNqdurxB9iaqn55/96ZU0fJQBv4WYEhWLweGJXa5KFA5l2dYeoBwLyfaIBzMWoz9+ NbEGPLkSjm2F17SZmuq1w6FyzUlcI1OGA2E7A7EzMoas3+qs6m/0YtE1PTR2ZS/OlIOj vjcQWnyypk5K3nbtM3xie1peYWUP+3Bm+gzeRQskMWjHt4ztX8rwsN15zCH7us4PnEba 7ZJSzfz1Jwh11WajLSYtUWM1AC+mipsWfN5d0vbmKimcrXN/eSWKgyRhi77vlBHIuito BPtuImHKuhwBkN0pZEfMT+MO0o6X1IW6DMfOKSxn/UF5Dz6SPtHqZf/I12Cd+YG0a4N4 NM9w== X-Gm-Message-State: AOJu0Yx+dWynJPukoaGlHkTmYenvno2oTVI8BSjI0lXuGxxrv+qTqSdy kh9zlyO6mkrl16xaAi/MLtvsaQRphkCFzpkFY14= X-Received: by 2002:a05:6a21:488b:b0:179:fac0:a89a with SMTP id av11-20020a056a21488b00b00179fac0a89amr7853967pzc.54.1698279984153; Wed, 25 Oct 2023 17:26:24 -0700 (PDT) Received: from stoup.. ([71.212.149.95]) by smtp.gmail.com with ESMTPSA id gv24-20020a17090b11d800b00262ca945cecsm438134pjb.54.2023.10.25.17.26.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 25 Oct 2023 17:26:23 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: Mark Cave-Ayland Subject: [PULL 94/94] target/sparc: Remove disas_sparc_legacy Date: Wed, 25 Oct 2023 17:15:42 -0700 Message-Id: <20231026001542.1141412-124-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231026001542.1141412-1-richard.henderson@linaro.org> References: <20231026001542.1141412-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::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 All instructions are now converted. Tested-by: Mark Cave-Ayland Acked-by: Mark Cave-Ayland 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 62c77ae5e1..986a88c4e1 100644 --- a/target/sparc/translate.c +++ b/target/sparc/translate.c @@ -5314,149 +5314,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); @@ -5524,7 +5381,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) {