From patchwork Wed Apr 24 22:56:59 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 791551 Delivered-To: patch@linaro.org Received: by 2002:a5d:4884:0:b0:346:15ad:a2a with SMTP id g4csp1093349wrq; Wed, 24 Apr 2024 15:58:54 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCUQ1Oi6ZR0a48eb795EYyUTHYZLeGDRp9ZdgbI+5tjcGaodAaKixBCKEZuAGkMGuKn3gP5nHalHDmlMbnOLpLoS X-Google-Smtp-Source: AGHT+IGneJink9fDmmACGtWvjQsfLbRsl1uUwAO8sXrmso6u1b9FjiNGTKLUT3uUObBYX2rp3uVs X-Received: by 2002:a05:6214:1310:b0:69c:b559:547d with SMTP id pn16-20020a056214131000b0069cb559547dmr2206110qvb.25.1713999533932; Wed, 24 Apr 2024 15:58:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1713999533; cv=none; d=google.com; s=arc-20160816; b=qM0aWa1mYlImYCYVF2Z0zPFYCQDFG8AKKfwd2yJy0zgZqGshWRGdTVkpL68RidKfs+ EVCYOmWj4qMyEGP7tZtvWV0KM3gLSx/7PhuO8ee3jZOVqHqLR9rS25nMGkLDLLcpXvI2 tgdYhMtoi2gJ2sxJMa98SkoRlQMETDlaJKMfesDC4meQ3i8kO13zTauNjfxRu4avlO80 kkGpOVG1YRrcCWs/53BTKE4LlQaw0fOV8YzZSY7ecj+SVQq4kgGCp590dWAqSk5x0Iq7 K7ufoeqWCjGStcJ1w+b0bt8snmiLyLE176i8rejMu2fGfvCRg5Q3jiR6mloflWBNaFPK 5wig== 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=RPMJ9Fq7Hagw2E+aglC+ITwqURcRV1FccXRLb5FLQFU=; fh=IOfZmL/4G2LGBtSV+LzySu7eotL7HJ1AQcRx3etIBXU=; b=HfUFpvZ9eiqqZuS/IN74BqKgLwqumFIXSE8UY5w+Ej+ohMjR8dInM83Z2Fa/6+2oOr +toFEwJYE+U0l/SqQfIiOg2BlR041gVNLQIEAFVepBTOeflf5Lin9KKg4lcNk+svYRLt vAg6dNu5OuQYOi96KSFSTc/dtYsTcX8YlAevLCzPxI9rBNBYPMUfvShkNgXy8T5LsAlt iO1ZVjfdGvMogfhp9nEohLmt2F/gIOGTWNxG9UUyUUK5CzcMXQCillDj4JZ18I5R1lq8 GI/ZgHTbYbe/5sbqcl7FjvnLz8SV7ZRCXPqs4DbxEMDqsmAHSNVh4o2Xs+3r7+DswWc7 jlyA==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=dIkgolER; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as 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 e8-20020a0562140d8800b0069b4c0a5c9bsi15947284qve.330.2024.04.24.15.58.53 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 24 Apr 2024 15:58: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=dIkgolER; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as 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 1rzlYP-0005TV-3l; Wed, 24 Apr 2024 18:57: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 1rzlYI-0005PB-OE for qemu-devel@nongnu.org; Wed, 24 Apr 2024 18:57:23 -0400 Received: from mail-pf1-x42d.google.com ([2607:f8b0:4864:20::42d]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rzlYF-0001mu-Uk for qemu-devel@nongnu.org; Wed, 24 Apr 2024 18:57:21 -0400 Received: by mail-pf1-x42d.google.com with SMTP id d2e1a72fcca58-6f0aeee172dso308397b3a.1 for ; Wed, 24 Apr 2024 15:57:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1713999438; x=1714604238; 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=RPMJ9Fq7Hagw2E+aglC+ITwqURcRV1FccXRLb5FLQFU=; b=dIkgolERSWYXhsFzfxo3/NE4n7/13xtTcWddkyqqpEeUF/kIAy1WPT3YZmjDbBi7JW jcuicdnEO55OeRrkYBZ746HmOR05Yx8PVrZ7CPjZarrfIlPn3SZvciBYBRLa8BNslgdL nInt77x7Syx9pD9hq5Ej06yYXvCsgx4A0PkWNiYYgWf5CwGms7cYUkM18xhs70tUPmx3 oHQNKSM577JHubEVHshpn+u3i1vBCAZ4nkPy/VPx97cUbWiSf3RaRMqdcj4QgbhuqeXV tR8ftzQNqh753MroFVwPBxxFjSGFSiJvNJkSF7tg5F/5l3RO3IUh6hG84r8GFqHeve31 c9JQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1713999438; x=1714604238; 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=RPMJ9Fq7Hagw2E+aglC+ITwqURcRV1FccXRLb5FLQFU=; b=F/f1AzC4ze12+Q4srNmvWFeoslxAsMBcDtzGyfK6TCx65FIIH49uExv3lNCwyhXnwM CrD/0M5AYFPr0qsK5D8fwOrMVKlV87p4rBkE4V3XwMs21E3oBHlY7fqY67m5iZ+flVoK NK7ZTOPxdagB6q+yWEzLgIhupUX11/vlN3joVbfy+myOAf2ES6xvgDA1oSvHtebgjTPA yYwGbfBcRc4P8wLsTuv799S7SNnFp6zE1XEQkCwnA2B0e9jUIB281nCgT1aKjBDVCLdP t3qN087/N6GJoFqBtbVXBFEDH+7PqQbgjWmPO0ONMeKdf6JcDGNQ2d6iBs1oKUSzryht kFVA== X-Gm-Message-State: AOJu0Yy0LPLKox/hfMV7IPSo2kly1XIYZDh8boWhS16eL1seKIvHIVSe nrKOtNfvdUfFYLy0K8aZEybiRAPZGfFgl1F97oHHoGHTIe64PeWqW1l8fV0HeIGFQM0+HNfDNO0 l X-Received: by 2002:a05:6a00:a86:b0:6ed:2f0d:8d73 with SMTP id b6-20020a056a000a8600b006ed2f0d8d73mr1623257pfl.3.1713999438469; Wed, 24 Apr 2024 15:57:18 -0700 (PDT) Received: from stoup.. ([156.19.246.23]) by smtp.gmail.com with ESMTPSA id gu26-20020a056a004e5a00b006ed9760b815sm11947413pfb.211.2024.04.24.15.57.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 24 Apr 2024 15:57:18 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: Alexander Monakov , Mikhail Romanov Subject: [PATCH v6 04/10] util/bufferiszero: Remove useless prefetches Date: Wed, 24 Apr 2024 15:56:59 -0700 Message-Id: <20240424225705.929812-5-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240424225705.929812-1-richard.henderson@linaro.org> References: <20240424225705.929812-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 From: Alexander Monakov Use of prefetching in bufferiszero.c is quite questionable: - prefetches are issued just a few CPU cycles before the corresponding line would be hit by demand loads; - they are done for simple access patterns, i.e. where hardware prefetchers can perform better; - they compete for load ports in loops that should be limited by load port throughput rather than ALU throughput. Signed-off-by: Alexander Monakov Signed-off-by: Mikhail Romanov Reviewed-by: Richard Henderson Message-Id: <20240206204809.9859-5-amonakov@ispras.ru> --- util/bufferiszero.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/util/bufferiszero.c b/util/bufferiszero.c index 972f394cbd..00118d649e 100644 --- a/util/bufferiszero.c +++ b/util/bufferiszero.c @@ -50,7 +50,6 @@ static bool buffer_is_zero_integer(const void *buf, size_t len) const uint64_t *e = (uint64_t *)(((uintptr_t)buf + len) & -8); for (; p + 8 <= e; p += 8) { - __builtin_prefetch(p + 8); if (t) { return false; } @@ -80,7 +79,6 @@ buffer_zero_sse2(const void *buf, size_t len) /* Loop over 16-byte aligned blocks of 64. */ while (likely(p <= e)) { - __builtin_prefetch(p); t = _mm_cmpeq_epi8(t, zero); if (unlikely(_mm_movemask_epi8(t) != 0xFFFF)) { return false; @@ -111,7 +109,6 @@ buffer_zero_avx2(const void *buf, size_t len) /* Loop over 32-byte aligned blocks of 128. */ while (p <= e) { - __builtin_prefetch(p); if (unlikely(!_mm256_testz_si256(t, t))) { return false; }