From patchwork Tue Jun 25 18:35:25 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 807285 Delivered-To: patch@linaro.org Received: by 2002:adf:e842:0:b0:362:4979:7f74 with SMTP id d2csp37609wrn; Tue, 25 Jun 2024 15:30:52 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCUu2f+BNo18P6lPoijc2D4JEL7RkCuuoydWlbRwHZgLfugRZl4iwTAtTbZrleLcqiFGEfW3QrDVMAj5na9yGQ57 X-Google-Smtp-Source: AGHT+IEnNU2363HVn3vf1hOMtH7Zq4DEYeLOUcVFTjHVHPZx00OP9keSF4KMdJ5hu90Vs43bOcI5 X-Received: by 2002:adf:f98d:0:b0:360:7574:d6b9 with SMTP id ffacd0b85a97d-366e94d9520mr7536262f8f.34.1719354652586; Tue, 25 Jun 2024 15:30:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1719354652; cv=none; d=google.com; s=arc-20160816; b=IwZAOROo58nN3H81R7WPpnjCh7FlrbWQcGJ3wOA0m/lkjLJ/0eDOuKvKfjLz8PTY65 dUJJXY1lRlb1vTPDdlOb2cC3tt4WF/1tNwqyq+TZYH4P2yW8+cRamEJ/XIUa7hHKkfkm SjOUn7bsQl2sviCDHotY1Hm1NwEs/xj1r1IC3hMRFQppZ0589ErXh8+0kvkx3W9NlBjI m3vKWRC36l4BW7GyaKfUwd2fmJ4RDkaZHLliIc5oJpDvlBgIaUJUGqnprOsVXaQKj3Nd ky92oQ6m7GUJ+Kpj6rhC7w0HEdjkHz2m3VAnUmw+h3XlR9eIWywBUgDYkOQP1UCQJoDs Z0oQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe: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=Mj7QlXoeP2V1pOBsxsghEG+3S3aDNGmpRLT6MqBN1Ws=; fh=ZcJeIuJ0l6vALYCr1DZMZXnfBb1Sl86FXIV/sEmtGxc=; b=CYgw8lak+83RF6VfpwTXksxOBqeCJwDvpBqVfaAAKgilxbaZqdwJRYRj/04kU+wuaE 1FXKQT6qsn/HftrVzOCdR26MesO4KjOCLeXDyhNtKQqXAbHWc7GANQbXQr2y+BzetXyP 0ZIp/pnRzVo5ztOFiGSys+rcRuAso0EjWI/mFrPWa8YVweUIgzEXQVwUThZwSUgBoFyO bCEsesXSD2BGnTq64GVFlKEI+fU9nghSn2QTYLwX0pvXe3u1QE8FVVPfh1w/e6FSErvB boh+pdZzpz2wZLSkAcoD+6g8/KJgZLzZXOFtH1D+YZGh2b9xZlsSjz5z/3SXI3pyLkb1 HhzA==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=hFIni6GN; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id ffacd0b85a97d-3663a2f809dsi5689255f8f.475.2024.06.25.15.30.52 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 25 Jun 2024 15:30: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=hFIni6GN; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sMED6-0003uj-Bo; Tue, 25 Jun 2024 18:00:26 -0400 Received: from eggs.gnu.org ([209.51.188.92]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sMECm-0003sF-0G for qemu-devel@nongnu.org; Tue, 25 Jun 2024 18:00:03 -0400 Received: from [2607:f8b0:4864:20::331] (helo=mail-ot1-x331.google.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sMEBt-00046X-E9 for qemu-devel@nongnu.org; Tue, 25 Jun 2024 17:59:41 -0400 Received: by mail-ot1-x331.google.com with SMTP id 46e09a7af769-7009b8113ebso2628414a34.1 for ; Tue, 25 Jun 2024 14:57:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1719352652; x=1719957452; 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=Mj7QlXoeP2V1pOBsxsghEG+3S3aDNGmpRLT6MqBN1Ws=; b=hFIni6GNtQE03mQNEVVb2gXCaYhWn0MkZUnLhAHNsJzE+AR9UJDPmKSakOnegPdAky xZWGx8szxLiArTEMYR0LFCxRChwYcFmD2WQ1amJaWtcXA88/yboIbg8xlYNA1FaKmAtp Zgh/sCGJXx9WrmTG11J4kPUn6DL87JpNTMZnEFcftKyZOm8QjzMXNM5Df/2QfV3SEUeA UnW8kzpUymYTL1H2DWRx4/0Ei4D1C3UMqlXSsSmVo/+3eyVFWAgDaXfD8Sk8H3bh4tnV HP14EWyD/UDzfvJbg1XYKc/fgPKaN8WVoD3YJKKs8d7DRdkMNwRaxmwdT+tqVfmJZAP8 VHXw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1719352652; x=1719957452; 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=Mj7QlXoeP2V1pOBsxsghEG+3S3aDNGmpRLT6MqBN1Ws=; b=QlP+W7tJutkouutacDDb7i3g8tVgD8bq50CnpOQMS0J4qzTS+OV12t250Shbr61oMW Go7gbRBPML8VDoMyqpwDwbe+5IMJ3XKXFxPrgCY6gmz+ak3CkagD5tNyzBCyfhaz130z LIeMcUAKDEPR02QvgKHmthpS80jKTrS3MdgC+/VYI8NUaD7yUZFgA6ziI6DGEWWvr5+Z C6Lard5KWufyGzo5uxlvuQ8czrMtjnN0rAa7UAKpgxVpL56jxDwi3F29ibfrtqi7SX8K 4ldo7TIcP51pOaOpMMdZcWbNZK0MxyIQWmerdjyLkV8Ku0cJ+pa6Ke6+352d9FQWuZgH DNEQ== X-Gm-Message-State: AOJu0YxDEAmMQ1i9jEfVzWG6a7a8tQfVXaAb8h0xLOiZMWvtIfpr6fWa R8KacOtv06gPDojC7jXclnvh5hEcar5LHraS5HoDcieK0Jx0reyRYuY9dmxorIut/iMHT8Y8v1i 0 X-Received: by 2002:a17:902:bd07:b0:1f7:23d9:f530 with SMTP id d9443c01a7336-1fa23f8df23mr67334385ad.66.1719340539628; Tue, 25 Jun 2024 11:35:39 -0700 (PDT) Received: from stoup.. (174-21-76-141.tukw.qwest.net. [174.21.76.141]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-1f9eb3c6027sm84693235ad.133.2024.06.25.11.35.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 25 Jun 2024 11:35:39 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: qemu-arm@nongnu.org, qemu-stable@nongnu.org, Peter Maydell Subject: [PATCH v2 02/13] target/arm: Fix SQDMULH (by element) with Q=0 Date: Tue, 25 Jun 2024 11:35:25 -0700 Message-Id: <20240625183536.1672454-3-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240625183536.1672454-1-richard.henderson@linaro.org> References: <20240625183536.1672454-1-richard.henderson@linaro.org> MIME-Version: 1.0 X-Host-Lookup-Failed: Reverse DNS lookup failed for 2607:f8b0:4864:20::331 (deferred) Received-SPF: pass client-ip=2607:f8b0:4864:20::331; envelope-from=richard.henderson@linaro.org; helo=mail-ot1-x331.google.com X-Spam_score_int: -8 X-Spam_score: -0.9 X-Spam_bar: / X-Spam_report: (-0.9 / 5.0 requ) BAYES_00=-1.9, DKIM_INVALID=0.1, DKIM_SIGNED=0.1, PDS_HP_HELO_NORDNS=0.001, RDNS_NONE=0.793, SPF_HELO_NONE=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 The inner loop, bounded by eltspersegment, must not be larger than the outer loop, bounded by elements. Cc: qemu-stable@nongnu.org Reviewed-by: Peter Maydell Signed-off-by: Richard Henderson --- target/arm/tcg/vec_helper.c | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-) diff --git a/target/arm/tcg/vec_helper.c b/target/arm/tcg/vec_helper.c index 7b34cc98af..d477479bb1 100644 --- a/target/arm/tcg/vec_helper.c +++ b/target/arm/tcg/vec_helper.c @@ -317,10 +317,12 @@ void HELPER(neon_sqdmulh_idx_h)(void *vd, void *vn, void *vm, intptr_t i, j, opr_sz = simd_oprsz(desc); int idx = simd_data(desc); int16_t *d = vd, *n = vn, *m = (int16_t *)vm + H2(idx); + intptr_t elements = opr_sz / 2; + intptr_t eltspersegment = MIN(16 / 2, elements); - for (i = 0; i < opr_sz / 2; i += 16 / 2) { + for (i = 0; i < elements; i += 16 / 2) { int16_t mm = m[i]; - for (j = 0; j < 16 / 2; ++j) { + for (j = 0; j < eltspersegment; ++j) { d[i + j] = do_sqrdmlah_h(n[i + j], mm, 0, false, false, vq); } } @@ -333,10 +335,12 @@ void HELPER(neon_sqrdmulh_idx_h)(void *vd, void *vn, void *vm, intptr_t i, j, opr_sz = simd_oprsz(desc); int idx = simd_data(desc); int16_t *d = vd, *n = vn, *m = (int16_t *)vm + H2(idx); + intptr_t elements = opr_sz / 2; + intptr_t eltspersegment = MIN(16 / 2, elements); - for (i = 0; i < opr_sz / 2; i += 16 / 2) { + for (i = 0; i < elements; i += 16 / 2) { int16_t mm = m[i]; - for (j = 0; j < 16 / 2; ++j) { + for (j = 0; j < eltspersegment; ++j) { d[i + j] = do_sqrdmlah_h(n[i + j], mm, 0, false, true, vq); } } @@ -512,10 +516,12 @@ void HELPER(neon_sqdmulh_idx_s)(void *vd, void *vn, void *vm, intptr_t i, j, opr_sz = simd_oprsz(desc); int idx = simd_data(desc); int32_t *d = vd, *n = vn, *m = (int32_t *)vm + H4(idx); + intptr_t elements = opr_sz / 4; + intptr_t eltspersegment = MIN(16 / 4, elements); - for (i = 0; i < opr_sz / 4; i += 16 / 4) { + for (i = 0; i < elements; i += 16 / 4) { int32_t mm = m[i]; - for (j = 0; j < 16 / 4; ++j) { + for (j = 0; j < eltspersegment; ++j) { d[i + j] = do_sqrdmlah_s(n[i + j], mm, 0, false, false, vq); } } @@ -528,10 +534,12 @@ void HELPER(neon_sqrdmulh_idx_s)(void *vd, void *vn, void *vm, intptr_t i, j, opr_sz = simd_oprsz(desc); int idx = simd_data(desc); int32_t *d = vd, *n = vn, *m = (int32_t *)vm + H4(idx); + intptr_t elements = opr_sz / 4; + intptr_t eltspersegment = MIN(16 / 4, elements); - for (i = 0; i < opr_sz / 4; i += 16 / 4) { + for (i = 0; i < elements; i += 16 / 4) { int32_t mm = m[i]; - for (j = 0; j < 16 / 4; ++j) { + for (j = 0; j < eltspersegment; ++j) { d[i + j] = do_sqrdmlah_s(n[i + j], mm, 0, false, true, vq); } }