From patchwork Tue Apr 30 19:42: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: 793369 Delivered-To: patch@linaro.org Received: by 2002:a05:6000:54f:b0:34d:5089:5a9e with SMTP id b15csp438047wrf; Tue, 30 Apr 2024 12:44:20 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCU/sFaM7gQKqAksD5qx46COaLFR9vLVuWAwIg+HYZKCGRlKs6VlABOd0rFx+FhCUNfge8Aa93PaamvWjMaBTufb X-Google-Smtp-Source: AGHT+IFSU/b+2dVEse3816xpxRZwBs+rvTqBYFtL8TTwrFTydxmgcRbAK8yu1H7eaOCvDmPa8bTu X-Received: by 2002:a05:6214:ca3:b0:6a0:9770:39c2 with SMTP id s3-20020a0562140ca300b006a0977039c2mr289566qvs.54.1714506260388; Tue, 30 Apr 2024 12:44:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1714506260; cv=none; d=google.com; s=arc-20160816; b=ibQ/A9/cB4shKZXoBAH7xmHgxzY0LjeZgxN43LrdeGTeSHbt63eKdxxCVq4IP8zboO fjyL+8usS6ugyeqN8s8ZEg5FJswT6QLLBFdjK2aXyGohkbmbEh6V3/lNWMjnCaj7GseI S324wid2+mZQJE6BY5ARM4UvTvPbtnj4MLfnLl4s8ab0fJceHORmRM6/m9RLZwOkxA/v D44WgWncnXHMyHHYIPVBG3yVc6Bo6VsMXyB5xgPlwQLYSDryxS2/JDmU3lc3CB00ISP1 16lZieFwNLO0xojdnjL9aXAjaMP8+aCVzzF3MInV0XpDB09hZAgedfn9m3s/JbYWABtZ a7PQ== 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=QtYERfLY+/6lXIVoMxqjAcWASzkMPfeQc3Ur4v8xQcU=; b=QrcolW/scgPBBQ9Pl+9W+BpJqWqctGxkmrFZz6qHw6gzEJJYTj2yXgXTTpvE4GC2sq XzVsFjGradgwpT+iUpBJ81jOyyks13H/eUpRCmDlFcbMzz+hXiGG6TZ1jbjTzSOSmUwW tsRTqmtJHHVPQgNhmDR26TljqhdxiC/nHrTmLkTHISZKQ1BmcPQuIbJh3QMDN3YBxfKy E9dC4QMspeZWWN0HeBo+K3Q7P5vPrs2k/cEk310sJY7CK2gA5Pw+Gur/auNDsz3dNv/m eoB8tyHOm72iUsM9fHMvk6lfet0KvRcaSIpcbrgNITFs16l7m7HMUHZyERgPLblCujCa DlRQ==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=N88rQM1c; 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 kj22-20020a056214529600b006a0ac634515si11089621qvb.229.2024.04.30.12.44.20 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 30 Apr 2024 12:44: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=N88rQM1c; 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 1s1tNX-00072Y-8t; Tue, 30 Apr 2024 15:43:03 -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 1s1tNW-00071u-1y for qemu-devel@nongnu.org; Tue, 30 Apr 2024 15:43:02 -0400 Received: from mail-oa1-x33.google.com ([2001:4860:4864:20::33]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1s1tNU-0006kX-Cw for qemu-devel@nongnu.org; Tue, 30 Apr 2024 15:43:01 -0400 Received: by mail-oa1-x33.google.com with SMTP id 586e51a60fabf-23d5df2d600so100186fac.3 for ; Tue, 30 Apr 2024 12:42:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1714506179; x=1715110979; 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=N88rQM1c5IUmb3VjDJolYhKegfgxGmqPMMbu+0FWDIQrqxKsuCZzuV3NsMQQ6r8tpw QU0nvpEkSfA2n+oTSXj7eLh79KTOgXx6hIfEId7QNaFn0Ii202ESF20HYoxirvOhZ0dQ /+IrzKpeiROS567MiI9ikyBQytt/FjG6gHWh2E0zYOEzOS54fZmCpcuBpM/NpGWFk8pH lFBKEtpoCF1fZiN1/ua/McB4F84DPY27lsIvrwLjr+6QXSdDrV8zFD4CuaOavg3sONWE pKDbZ1aK3iue5L09HBd7SJhPuGs07w7Hu/iPwGIHQ+7t5K9kOArowM0Araei7SZc3/X7 7vhA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1714506179; x=1715110979; 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=LAYreS7BB7OrJ1s1J0w9E53SImG5id2PL58BIAiQIp8s6axrRIdQpMJuv0g0wcBhWX GKuPpw48IiFWxA3JjspVeNGDOt3STfKuaW040uuzdALpwcrmdB0YebKwe+NgDlE1DwXr xNPwofbY9KwBkuDZzmSg/QyS1W/G5pL/pD0wIgfle82bcisxFaOhiGpJNsAXbDiNysaZ oRUKRhEOBIBgPhmaswHrmTUie5QCKPlDzeK4DheXsS5qtmMaM97BrStYfzB0ekJEQ6K0 YJBDSb5SyWRcP9C27pK4j8VxpawTJmS1ZHTTWgm/RQ1xJVXL9opQ/IL6Pb3hh7kDeZe4 xIMQ== X-Gm-Message-State: AOJu0Yxaaubal0baRynM1iZuvPPGffrrD9ZpjoPrhZnS8P9CYw1C9tJ6 EocGpMEFDHsEBFEBIpm5wzuO629Gc1A06B2tIum8587lYAWRXakgKMHl3xp8DAcNwJmBk/ez2Bm s X-Received: by 2002:a05:6870:4153:b0:23b:f2d0:7b9c with SMTP id r19-20020a056870415300b0023bf2d07b9cmr521780oad.24.1714506178861; Tue, 30 Apr 2024 12:42:58 -0700 (PDT) Received: from stoup.. (174-21-72-5.tukw.qwest.net. [174.21.72.5]) by smtp.gmail.com with ESMTPSA id d12-20020a63360c000000b005d880b41598sm20861523pga.94.2024.04.30.12.42.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 30 Apr 2024 12:42:58 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: philmd@linaro.org, Alexander Monakov , Mikhail Romanov Subject: [PATCH v7 04/10] util/bufferiszero: Remove useless prefetches Date: Tue, 30 Apr 2024 12:42:47 -0700 Message-Id: <20240430194253.904768-5-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240430194253.904768-1-richard.henderson@linaro.org> References: <20240430194253.904768-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2001:4860:4864:20::33; envelope-from=richard.henderson@linaro.org; helo=mail-oa1-x33.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; }