From patchwork Wed Dec 11 16:29:47 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 849246 Delivered-To: patch@linaro.org Received: by 2002:a05:6000:2c4:b0:385:e875:8a9e with SMTP id o4csp423804wry; Wed, 11 Dec 2024 08:39:40 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCU3a7O7yYRH3jjC9kdBgm+Tic4eB1sHtMWVdMvXV2TDFNn81I+REJCNUM+GGZoJWBx/cWV/nQ==@linaro.org X-Google-Smtp-Source: AGHT+IEVf4y1qSaYb/koei/nA6y/U9pnYNQIP0B9oi1M2nlOrn+Xb+78UJk7r1SeUJStJC81QnEy X-Received: by 2002:a05:622a:2c5:b0:467:8703:a740 with SMTP id d75a77b69052e-467961769b4mr365031cf.18.1733935179908; Wed, 11 Dec 2024 08:39:39 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1733935179; cv=none; d=google.com; s=arc-20240605; b=TEzF6ScwWXRnJndVLe+UoOx4pUR72KYrf5ayF5wQrTg25VztpCDyxonj4zyiUOmUci AbwB9eHCYzkrS8lKsK00WUldMhv28sTDgbTCNa2R1xvOn89tW2yBO/wnaoBKva2d/6l0 fYzm1/nvhctMRvY5nePZS+UP+heN5d5Kz0GeLUPfAgcZl1kDyd1Xv7V5HFwdgUYpslRO YUa2d8kAnmua/7TswNGqxKrkd3fzYGkfJ0vhuUuQ8oScsT9vGYv4a3h0E5iQnTYzyEYS PtrOyeEBQ/Q3CqQIRN3TvneN8f1UESBdx0QMS/y4r6DW3wIfPiEew4FvOd7EgY/drFVY RYVg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=nBi50fBjO71qRLAMWMSi4czuRa2YaRF8EoteBaucdNo=; fh=ZhBia3nL9o1nuf7SbgdYn/0pDmAeja6gisyWXi2cqYE=; b=OFIceA1DlKadbEWtEdS8j2fMkTJugdd/wdKgZ7+ayb4T1fFlQuzWVSn/Np9XbPLURd Iallvbf8vVcJ1FV6Hqg4lTyXWt3dxuAG5YmlUfyvRqbVeRXPgEbvXc3bcbr4X/QeNPId PWeaU0tH6h6wSufMokrNpGeu7q44tQI64See3P6iEdXnDphJ3Y3x4AzJg8Ou9X5cJd/z hryNyu7GlFoix1g8XINMIvN6xo30a+ctwYvKD06t7aO8lpdPuAjUeWkVJyZNr7LOLAUB pllD7NV/6C4wwPdsxI38HvaiBPX+k/qImmk020KXm4nv4rRun2I/pxTwGbKWQBVWb120 9fAw==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=CH2GlJL4; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id d75a77b69052e-4678a49d5casi21975151cf.687.2024.12.11.08.39.39 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 11 Dec 2024 08:39:39 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=CH2GlJL4; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tLPe3-0008OU-Mo; Wed, 11 Dec 2024 11:33:03 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tLPd8-00055x-9h for qemu-devel@nongnu.org; Wed, 11 Dec 2024 11:32:08 -0500 Received: from mail-qt1-x832.google.com ([2607:f8b0:4864:20::832]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tLPd5-0001LP-7J for qemu-devel@nongnu.org; Wed, 11 Dec 2024 11:32:05 -0500 Received: by mail-qt1-x832.google.com with SMTP id d75a77b69052e-467777d7c83so20585631cf.3 for ; Wed, 11 Dec 2024 08:32:02 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1733934722; x=1734539522; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=nBi50fBjO71qRLAMWMSi4czuRa2YaRF8EoteBaucdNo=; b=CH2GlJL4ok/nBk8GUaWx1tV6Q4l1CgV1laArdwFimhQvrr0XcWkwLP9Dolo01in0as 5l3uZpppGJal5lbfwlWRb6MsNx8qXpP9gYnCQaucHY4DRvQH2oM8atiIB2BOsZVRnuCq LT19zBpTKYQUuZdwOlnV9fYGqoMxTOY/aC9WML2MqrEVEOLGii2QzL7SK4/SLx/OlWIj H12BX/n4uEzpy3NGV4aopHZjg9sdBGTws7DKa9g1OCLePhMzqmRQN12FQp/SDuIae60g R2M8/ZtYANoztXi+v5tIB+VNr5vm+4tVZ9LPAKft8Wc3/nxYAIah9UXcQNdWAnVDFx6e lzhQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1733934722; x=1734539522; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=nBi50fBjO71qRLAMWMSi4czuRa2YaRF8EoteBaucdNo=; b=v/M19PdXZ7RGCG9FJ+JC4aTidvHQeAiWwjN74IgCC0XtEWWDHK2p2ZDHoVgBxqxkef RsML/iaKVfBQNI6NswLkBIN0a+r8j96PA4E5pCxvpssjiN0cDhaWgWgsMvP7Br1gA8ls To6QwWCNXSrY+SsB9ChVCHWdp5WIrJYzH4t3TOFslVsfKi72QZnJnetVI+jxtSSOvUcZ yzKqnvX3Ua0r+6xmpzkK8yWMNHIpCpzQHAw7tXldOjVtdQCMjF56YZ9YruJ/b+NToKtA pXbmT6SUm7LNY6HpZ3U4DgCd5b4VXtoNTgbJMmRD/tRPWS2bbZUP1AMw1v/ME6+7Hd00 nDug== X-Gm-Message-State: AOJu0YwPtWRjWA1H9g2/0ww7jPQ08tWkTYexrLtnKf0qlxmkbTfqSTp9 VjGp7kRrGX/NbWqOglJJ8VNVI16i53Wgx2Z7/jWqRp3JfzM8UEVRiiun3b0Y3nk0pap+CjwBs+8 4RelqpspV X-Gm-Gg: ASbGncvjITy03WhXMURUtEcBZ1KCEiCMR4DIMcYYgRtwDzn/gpO3ibsaAnz9Wzo+Jx5 zqSDS9X4ku07ebC4ATn1H1mJihw2Lwk8zk/RaXaB7Y/qU5imN7pHDISdrmk+T1AMSnMkA13fRJC IAYVKUX+l+EqvvfePr1fwZohY5XLVi9+Vah14d9n3IdLTDmQ0z+TcKE3d7E8OhBceOOow+8x51/ 5vDN1zCTd+CnpnD7eZQovvTwYHmYQkRFJycFv9Pcz1ChRbQAb+wzCEvw9xr9Q== X-Received: by 2002:a05:622a:9009:b0:466:9f89:3d72 with SMTP id d75a77b69052e-46795423575mr6616651cf.36.1733934722165; Wed, 11 Dec 2024 08:32:02 -0800 (PST) Received: from stoup.. ([187.217.227.247]) by smtp.gmail.com with ESMTPSA id d75a77b69052e-46755db613csm43849381cf.70.2024.12.11.08.32.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 11 Dec 2024 08:32:01 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Cc: qemu-arm@nongnu.org, Peter Maydell Subject: [PATCH v3 20/69] target/arm: Introduce fp_access_check_scalar_hsd Date: Wed, 11 Dec 2024 10:29:47 -0600 Message-ID: <20241211163036.2297116-21-richard.henderson@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241211163036.2297116-1-richard.henderson@linaro.org> References: <20241211163036.2297116-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::832; envelope-from=richard.henderson@linaro.org; helo=mail-qt1-x832.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org Provide a simple way to check for float64, float32, and float16 support, as well as the fpu enabled. Reviewed-by: Peter Maydell Signed-off-by: Richard Henderson --- target/arm/tcg/translate-a64.c | 62 ++++++++++++++++++---------------- 1 file changed, 32 insertions(+), 30 deletions(-) diff --git a/target/arm/tcg/translate-a64.c b/target/arm/tcg/translate-a64.c index 9c6365f5ef..4e47b8a804 100644 --- a/target/arm/tcg/translate-a64.c +++ b/target/arm/tcg/translate-a64.c @@ -1239,6 +1239,27 @@ static bool fp_access_check(DisasContext *s) return true; } +/* + * Return <0 for non-supported element sizes, with MO_16 controlled by + * FEAT_FP16; return 0 for fp disabled; otherwise return >0 for success. + */ +static int fp_access_check_scalar_hsd(DisasContext *s, MemOp esz) +{ + switch (esz) { + case MO_64: + case MO_32: + break; + case MO_16: + if (!dc_isar_feature(aa64_fp16, s)) { + return -1; + } + break; + default: + return -1; + } + return fp_access_check(s); +} + /* * Check that SVE access is enabled. If it is, return true. * If not, emit code to generate an appropriate exception and return false. @@ -6628,22 +6649,10 @@ static bool trans_FCSEL(DisasContext *s, arg_FCSEL *a) { TCGv_i64 t_true, t_false; DisasCompare64 c; + int check = fp_access_check_scalar_hsd(s, a->esz); - switch (a->esz) { - case MO_32: - case MO_64: - break; - case MO_16: - if (!dc_isar_feature(aa64_fp16, s)) { - return false; - } - break; - default: - return false; - } - - if (!fp_access_check(s)) { - return true; + if (check <= 0) { + return check == 0; } /* Zero extend sreg & hreg inputs to 64 bits now. */ @@ -6894,22 +6903,15 @@ TRANS(FMINV_s, do_fp_reduction, a, gen_helper_vfp_mins) static bool trans_FMOVI_s(DisasContext *s, arg_FMOVI_s *a) { - switch (a->esz) { - case MO_32: - case MO_64: - break; - case MO_16: - if (!dc_isar_feature(aa64_fp16, s)) { - return false; - } - break; - default: - return false; - } - if (fp_access_check(s)) { - uint64_t imm = vfp_expand_imm(a->esz, a->imm); - write_fp_dreg(s, a->rd, tcg_constant_i64(imm)); + int check = fp_access_check_scalar_hsd(s, a->esz); + uint64_t imm; + + if (check <= 0) { + return check == 0; } + + imm = vfp_expand_imm(a->esz, a->imm); + write_fp_dreg(s, a->rd, tcg_constant_i64(imm)); return true; }