From patchwork Sat Feb 17 00:39:12 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 773699 Delivered-To: patch@linaro.org Received: by 2002:a5d:4943:0:b0:33b:4db1:f5b3 with SMTP id r3csp206568wrs; Fri, 16 Feb 2024 16:40:32 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCU8CZjnziF9WwXpXvwM05wTDag7SRVRCsRmYdmhWg8vlFMEAkqFyVNIoLHrukGW8VMqVbSpU///KdTWg7RibAzu X-Google-Smtp-Source: AGHT+IGi1dzBMweVK181GcS7zDKraaS0+8+mYuBf+r0EdgPl321+90RhklfudeWpChvoGbQwXUm9 X-Received: by 2002:a67:fc94:0:b0:470:41e0:bd07 with SMTP id x20-20020a67fc94000000b0047041e0bd07mr335260vsp.10.1708130432753; Fri, 16 Feb 2024 16:40:32 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1708130432; cv=none; d=google.com; s=arc-20160816; b=F3e1iZk9Fhj4ZVCDSFR+L5hxMmut/YrpoeSeUSD3KR3GA1+ge/+dkH0wXBjoziza6i kYyQqT16SYn82fv1YRDbEeJbe9mi9xY+j4Wv7fpuzV4lH8nqiU8u4B+XARQFNCUb2kNn RL4vb3YPEVh0EMJP2ArsupEIZkX5sz3D/OZTTktjSUe0dtkoNscRmUWLV5y4Cqn26GiI cU6cUje/+/CXB+3HwwrHHXns7vRiB5DnKRjg9ftwcZqws2U1k0mUVpm884nygjorpVPC 5uqmZCak4Ls76yJ2KFmkC61JsdOLWsUUbUyelzx9Pr5R8gTPa6Rz3BIpD5Mque0/VxLf nJQw== 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=bXD9UGo7d05OYjVg0qF2wA28p2gxs496M6ftxgeDKVY=; b=kr0xxKeiBX3K75HPMsiREaMmoXx6Unw80Qq/TYj4dJ8wSWWg/6YIq1c3Lw2ppMZyNy LglNfHWoySy7fHdpA3+Ho0ajTfCfGm7L7nu0M3Ddj4h+8C3PhXEyoeS9LjkSTngQoPLb vG7fQPbCKPBLhkpQaLPjVCkdVG2E/2wH110MtoD3ESFgLC+q1vuH33iXgMo+uJ7zh+hv jQzyLHlQvPKygQBTyTsatUlglyUOutLPD4h1qPboj9DSE6iPH2yGDJPbLnaC/98pIY0Y eLg24o7zHCMc6e4vTA4v38/iAQNqZLtUISAKKEpubumN63jseIBibDQwAAP6APzphJMQ 2oNw==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=s6Lt3QDf; 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 d9-20020ac85d89000000b0042c260dff43si1171469qtx.637.2024.02.16.16.40.32 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 16 Feb 2024 16:40:32 -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=s6Lt3QDf; 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 1rb8js-000666-Ln; Fri, 16 Feb 2024 19:39:32 -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 1rb8jr-00065v-Cq for qemu-devel@nongnu.org; Fri, 16 Feb 2024 19:39:31 -0500 Received: from mail-pg1-x534.google.com ([2607:f8b0:4864:20::534]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rb8jp-0008G9-Mv for qemu-devel@nongnu.org; Fri, 16 Feb 2024 19:39:31 -0500 Received: by mail-pg1-x534.google.com with SMTP id 41be03b00d2f7-5bdbe2de25fso2208161a12.3 for ; Fri, 16 Feb 2024 16:39:27 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1708130367; x=1708735167; 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=s6Lt3QDf6aOIOcLl+25gn6fa4ukCa1aQIhcjxdY6QUG4BQm0ozv9YDcW/bd5pFmV20 gPCxu2OAhJonu75T5dHDZhwZ+17dvH85a1n9xou0Fn+dg0sDwWey+xf+o4Km2A4l7wjx X/bVHzmCa8MY6qeHCCcddo1SWXmX4G9UBgqOJIYuktACIT5zzUi1fiBRC6o/uqmSW7v/ Y2MizLqJf48dNC6Ok1gKpQeHF/UAB/JuxsPVWBaSUyAIEm0lsD3H1hmxHLbfjv8ygKOz cdX98190GfluMGbZaVtDQXknzrCfizSW6yTJ60GqrlqEqnyAFbkeSoqyZy3T/pjKisEF cZ8w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1708130367; x=1708735167; 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=Lu3YHPPNFXOXpzV+f+D6OD35CACvAnUMnoI6DvzL842Q/ckBstFXDMqu48lUkLjzFs /AJyMAbVLi88uLC+H1MW5txw4k2ErfN4tck1CqgAgpS138TWGT72PNpaUCq4SdhRck+t xWCvjWbQZp0UeuEote7nInpYpZaT3KSy52KVg/jpN8Old+BU6Py51xthpWISDveUbycq bf6FF02zzTXu1ZUDjYAYayqbq86rp5dSPBAn+CqRSPhBEOseQmFuFxoxraIg+COwmAFw RHyddqvSwpr41kdLTGW7vP6rsK0M6WN6JOalVQrzlq5mg5pOSv0o7AUhKPF/YF4WZifM 4kvQ== X-Gm-Message-State: AOJu0YzJChpeNqqyWcOcNi6R6utnkjwxO9sCAD/m0u9re459ij0Rm16S GIQ2v6Xa0z/Fr7LMbFVU+nKyN7aog6fWuPhBwVvYGSg8oeeP3SesdyXnKr6arl9NcNXv1xSj6Jo r X-Received: by 2002:a17:902:ff0f:b0:1da:22d9:e7be with SMTP id f15-20020a170902ff0f00b001da22d9e7bemr6067832plj.23.1708130366822; Fri, 16 Feb 2024 16:39:26 -0800 (PST) Received: from stoup.. (173-197-098-125.biz.spectrum.com. [173.197.98.125]) by smtp.gmail.com with ESMTPSA id z6-20020a170902ee0600b001d90306bdcfsm419325plb.65.2024.02.16.16.39.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 16 Feb 2024 16:39:26 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Cc: amonakov@ispras.ru, mmromanov@ispras.ru Subject: [PATCH v5 04/10] util/bufferiszero: Remove useless prefetches Date: Fri, 16 Feb 2024 14:39:12 -1000 Message-Id: <20240217003918.52229-5-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240217003918.52229-1-richard.henderson@linaro.org> References: <20240217003918.52229-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::534; envelope-from=richard.henderson@linaro.org; helo=mail-pg1-x534.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, T_SCC_BODY_TEXT_LINE=-0.01 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; }