From patchwork Sat Feb 1 16:39:53 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 861267 Delivered-To: patch@linaro.org Received: by 2002:adf:fb05:0:b0:385:e875:8a9e with SMTP id c5csp1264228wrr; Sat, 1 Feb 2025 08:47:31 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCUQr64LG12+ud/IgHRJONk1jqQ02yAbJmXjWXOXAEQskbvy+JxtCsWZWeiTv0LNpL9TVo1ong==@linaro.org X-Google-Smtp-Source: AGHT+IG3uqm7tTaiYlBa95ahDo3/Oo5ddswLIrUBWGp4zHOI92ZuTvR+FZNTQvwCfEuZIgb7iL0w X-Received: by 2002:a0c:f201:0:b0:6d8:959b:c307 with SMTP id 6a1803df08f44-6e243c0ece6mr263329806d6.10.1738428450785; Sat, 01 Feb 2025 08:47:30 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1738428450; cv=none; d=google.com; s=arc-20240605; b=SaMgJzSp3p6A6Zw8v0PUu/9YTfNB1ao524r91x3QIssEeHFaRjpehiuUM7viY5os0g GRJjG6VD/BUqg7Lw4Xi95HPwapEZPFMn6LtoeFknGn873IzS+Nl50ESeyrK9LbNH7VMh hzctGs6lQo5tN7tK+9BVlpNvZjR22V9rjHavqg4pgptDKttMUnVL7DH89BwTMx+n1SY/ Qcr7Pn7Sd01d2RHOh9ABW/PUEmiGkIZOpj7psW81R/wunV5IA+WxO+8VbYO9cDzZtPO0 gRnhjlK+fRqPqTW64t8cK8RmF8zSjBeMJX+T1wRnlJwdNFHDBfiN1vkfGv/dALgZIWOW wfKg== 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:to:from :dkim-signature; bh=OWU/PlXSyEzT9phV28MmmzHlFyTyrUZHww5V+yN3G6E=; fh=MObh/DXJ6x+5Wnmdl1hcnqG6e3o4RFqjG3xpSAwQ47I=; b=BRrV/XasGXpFO63HOXzF7u9+p+Reu+QaJZP8W1BujKXmqP7i+3qwHbTB4EfJZzCzAt c5DtW7NQ8S0OZ3Ih6Dphax3R9EQlfZFxRfsx24zGk4c8voRgYfSh2Jx1sEmh+MjkWDXB UyzC5bKjtlikpPseBP3t7mkc3JWFEd79A94e7bXcXQbImV8T0pzNN8v3N3xDpw3pYpXo pySypgi6oJdRSLnIg1BWFATrZFSSO5oP9q0WiyuedzzTSR1SUEC1RGiUHNs5ESKSpcDO YaVwijXSUe8jSHo3aw35qaMyy7ZncN2PJDzlYWMIo9zrmXBnp7nN4+aPy339zh1TW8i/ 4Seg==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=lXnvWQpB; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as 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 6a1803df08f44-6e25497046asi57944346d6.257.2025.02.01.08.47.30 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sat, 01 Feb 2025 08:47:30 -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=lXnvWQpB; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as 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 1teGZ6-00007K-BF; Sat, 01 Feb 2025 11:41:52 -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 1teGYd-0007I1-9a for qemu-devel@nongnu.org; Sat, 01 Feb 2025 11:41:23 -0500 Received: from mail-wr1-x42c.google.com ([2a00:1450:4864:20::42c]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1teGYb-0001JM-KE for qemu-devel@nongnu.org; Sat, 01 Feb 2025 11:41:23 -0500 Received: by mail-wr1-x42c.google.com with SMTP id ffacd0b85a97d-3862b40a6e0so1894871f8f.0 for ; Sat, 01 Feb 2025 08:41:21 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1738428080; x=1739032880; 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=OWU/PlXSyEzT9phV28MmmzHlFyTyrUZHww5V+yN3G6E=; b=lXnvWQpB7EsQAL49ODDDdeIt07/IAPtv4zrS1lgNjvu0zMdz6VF/qmxE7RP/dwXXGC lKnT8FUXyYc1s/ic3EgqzBlaEIOknVegKxU1m1LmpbT3BZZPEBzfR0WIahc/tAWD8FxG PSWoiPz+Yi3kNsudl/WuXYWtbMtgn6D/UWHUwL31p9fukYuVbjSvakMOimj7HFSEwR1G 1oPjjjjwcCAb1oyGoIJxhvCRzQpMg75yrK9pC10NgAq66+MSUkfWpuc2i3jtRTXiYUkz pCCz2fv1cwOHdSXr9xNT17xgiok55d9WHSfefEhnFgw1xmhT6Mx6Wm0BNAAHkW7Cjg+X 9kOg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1738428080; x=1739032880; 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=OWU/PlXSyEzT9phV28MmmzHlFyTyrUZHww5V+yN3G6E=; b=ItAK3Bpj7rjjAXSfJJdBhpSQZz6CEYBSjEZ2lE/sUKZzTLEmCk/HmJhBfgXES/8vrz fVuO/O4LxcZ4KVm4z4kWbT2KyF0TSY2hRUWoRUbtHDHkt0IcCNDRS2UfyfPBIckQ3Qqz /G7E0BWHXfQSbiCUGaZrhn2LtW2QV+NjOMkYl6wPfmY+tCv63bRDAZcs3HZ5tvR6mOJV w8MKbd2j3LBLLt54nd5D4Dwwy/dIHJPJ9faS9/MHjifIOgrNkRz0ziYxpy0dw/gY75tN diQpE5sTwr9Z9lmUFCtz0gcw/0xfMMmomrJYzkG/VDSd4zAMr924KuPKlNs9sq69ngWT GEyQ== X-Forwarded-Encrypted: i=1; AJvYcCVZbLWlXSIUoK9obHDSw1B9YqfKbyld1LprJ86camCFP4KsJCxuuKXDgaNgtzEWwk9kBPFN4g+F/0oI@nongnu.org X-Gm-Message-State: AOJu0Yw9QMZHN+ylyREBv2DHjHjHd46FDyMlUbSWa3gobH0pfTyTvlms xEwlcrRBZxsYPd7AJ0iUn+91T+IzmQwJjmJAdUebBESpGi2gVhkdaFmMsjUWHVc= X-Gm-Gg: ASbGnctkA3xajUGUWzhxhvggRehzTOI4/RjRRicluhzWYQmaP/tRfhzTCZc4um+WXzj 1CddLE56vvByogVNmhnNuT4R+0JuETlc+k7qiRxJdRSEVpUGWkw14HFZ35RH4vyFwmPE/z9i6gT hgDhPyGqVHqnKIxvZ16aqMbHiGw2GpTuHLUP75Pokq8W4hk/x1XWoUYSotthXb95WqJc3BLRP41 F91rbZLRPODWFyCfWLJaPd1AraJimkf8b6V1THCL262KYveUNxMh4L8EMsQBQTajuJIpLzIE5Sj ZAj/GGNZtemaLLQzIbvs X-Received: by 2002:a05:6000:1567:b0:38c:5bb2:b928 with SMTP id ffacd0b85a97d-38c5bb2bd44mr7951163f8f.20.1738428080015; Sat, 01 Feb 2025 08:41:20 -0800 (PST) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-438dcc81d74sm127401525e9.37.2025.02.01.08.41.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 01 Feb 2025 08:41:19 -0800 (PST) From: Peter Maydell To: qemu-arm@nongnu.org, qemu-devel@nongnu.org Subject: [PATCH v2 50/69] target/arm: Handle FPCR.AH in SVE FMLSL (indexed) Date: Sat, 1 Feb 2025 16:39:53 +0000 Message-Id: <20250201164012.1660228-51-peter.maydell@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20250201164012.1660228-1-peter.maydell@linaro.org> References: <20250201164012.1660228-1-peter.maydell@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::42c; envelope-from=peter.maydell@linaro.org; helo=mail-wr1-x42c.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org From: Richard Henderson Handle FPCR.AH's requirement to not negate the sign of a NaN in SVE FMLSL (indexed), using the usual trick of negating by XOR when AH=0 and by muladd flags when AH=1. Since we have the CPUARMState* in the helper anyway, we can look directly at env->vfp.fpcr and don't need toa pass in the FPCR.AH value via the SIMD data word. Signed-off-by: Richard Henderson Message-id: 20250129013857.135256-32-richard.henderson@linaro.org [PMM: commit message tweaked] Reviewed-by: Peter Maydell Signed-off-by: Peter Maydell --- target/arm/tcg/vec_helper.c | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/target/arm/tcg/vec_helper.c b/target/arm/tcg/vec_helper.c index 5f0656f34ca..42bb43acd78 100644 --- a/target/arm/tcg/vec_helper.c +++ b/target/arm/tcg/vec_helper.c @@ -2250,23 +2250,32 @@ void HELPER(sve2_fmlal_zzxw_s)(void *vd, void *vn, void *vm, void *va, CPUARMState *env, uint32_t desc) { intptr_t i, j, oprsz = simd_oprsz(desc); - uint16_t negn = extract32(desc, SIMD_DATA_SHIFT, 1) << 15; + bool is_s = extract32(desc, SIMD_DATA_SHIFT, 1); intptr_t sel = extract32(desc, SIMD_DATA_SHIFT + 1, 1) * sizeof(float16); intptr_t idx = extract32(desc, SIMD_DATA_SHIFT + 2, 3) * sizeof(float16); float_status *status = &env->vfp.fp_status_a64; bool fz16 = get_flush_inputs_to_zero(&env->vfp.fp_status_f16_a64); + int negx = 0, negf = 0; + + if (is_s) { + if (env->vfp.fpcr & FPCR_AH) { + negf = float_muladd_negate_product; + } else { + negx = 0x8000; + } + } for (i = 0; i < oprsz; i += 16) { float16 mm_16 = *(float16 *)(vm + i + idx); float32 mm = float16_to_float32_by_bits(mm_16, fz16); for (j = 0; j < 16; j += sizeof(float32)) { - float16 nn_16 = *(float16 *)(vn + H1_2(i + j + sel)) ^ negn; + float16 nn_16 = *(float16 *)(vn + H1_2(i + j + sel)) ^ negx; float32 nn = float16_to_float32_by_bits(nn_16, fz16); float32 aa = *(float32 *)(va + H1_4(i + j)); *(float32 *)(vd + H1_4(i + j)) = - float32_muladd(nn, mm, aa, 0, status); + float32_muladd(nn, mm, aa, negf, status); } } }