From patchwork Sat Feb 17 00:39:15 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 773700 Delivered-To: patch@linaro.org Received: by 2002:a5d:4943:0:b0:33b:4db1:f5b3 with SMTP id r3csp206572wrs; Fri, 16 Feb 2024 16:40:33 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCVfgwgroHWBzRtovCJPDMuMEhX8HbOJb/w4xqhTEm7KmVND8KCJhhPxSA5oJOUZRlyEof4dHUuLCHX2TCOVJpUd X-Google-Smtp-Source: AGHT+IF5Wd1Gmlgd+ocY8+8a8Q2qGHVKdWHwpMYz+89ftqXV4wRwz5b2TxP3SYvGGj+l9Zqhi0/6 X-Received: by 2002:a0c:cc14:0:b0:68c:e81a:6618 with SMTP id r20-20020a0ccc14000000b0068ce81a6618mr6084645qvk.10.1708130433004; Fri, 16 Feb 2024 16:40:33 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1708130432; cv=none; d=google.com; s=arc-20160816; b=kOl9Zs14sGSnvs58kESSV5rErnNVP3oUnkN5lsRjdrIs4f1dD1I1S+OnSuZwENHXyW Tz/CiNjjAc3NQH/9gCiKRakpnPlbQ/QXoLNYMhsgXb53knNORdCf2xJmNyyheps+4aNP 6DTdgBGdVtJYEwClM2g9+P3W9mUBtEd0TBDngnfUzUi76M7f6OWqDPR48Kjeoxdzay2n ICXAHYaWC+ULUphnMjF/zT7j3t6lPmRN3yy8Em7mEzbU9pBRNOLyB6wY9m0WHX+mq3dw pQ0+/yaLAhXJBhAhsKJVyyFszGv6cgX/Guw/TBR3uWENleN8Cd69Ae626DB6y+P2tMlV z1Uw== 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=ijJGORoBUm3OaIKDGyVcLAHo3HCT5x1FLS32130PX9o=; fh=bXD9UGo7d05OYjVg0qF2wA28p2gxs496M6ftxgeDKVY=; b=DcwxqhCpK9gs0Y+rzqK4BtW24GuvqiPmb0JmRV72kD9xkK15IZR4VJkhiG3hXcRGQ9 W4eI6EmeYdmY5NSX8/ebYtPVsaGjZlYjBCyg1bPD3aHfIt7oIyA/eyfISN9psMUW02L4 IphYO0ubDUAPwCNnK1owzH6G2kDlfqsuSX2uGPKRvwxpQfAciBokC5xhjL8lWkeELy01 VlFSIH95AefK4QnKtlsv5MvGU5g8vpFGfBz/qc0/pfOzs+utNPFWEyGRNAiCnNRO1q9W Gz6c7DwplG1czQ7pHueJucLHyH/hhiJpAZNZlzOUTNVqta3hrr0Uwr0cahQyyWY24q3M IgoQ==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=mseDhCwh; 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 p6-20020a05621421e600b0068ee94fc0c0si1015998qvj.1.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=mseDhCwh; 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 1rb8jw-00068R-BH; Fri, 16 Feb 2024 19:39:36 -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 1rb8jt-00066S-O5 for qemu-devel@nongnu.org; Fri, 16 Feb 2024 19:39:33 -0500 Received: from mail-pl1-x634.google.com ([2607:f8b0:4864:20::634]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rb8js-0008Gz-4d for qemu-devel@nongnu.org; Fri, 16 Feb 2024 19:39:33 -0500 Received: by mail-pl1-x634.google.com with SMTP id d9443c01a7336-1d72f71f222so10656755ad.1 for ; Fri, 16 Feb 2024 16:39:31 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1708130371; x=1708735171; 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=ijJGORoBUm3OaIKDGyVcLAHo3HCT5x1FLS32130PX9o=; b=mseDhCwhM9L63/KctK9w/i8kVh/CYQU7pea2pQewzp2IIhgK0f2Z0NjBHOvPpVaAEM yrKydpx+Z24fV0o741+oZBPiOdY1QrCc4HgbTKV4q5BrcIBa6P54JrARznQuPMgSzvTS nVNSMJc95xV1Ro1oUKfB+nS3sMrXYaDn7W6ce146lQgDYPJ5Ukywo5unwe4OJ9SZ7t2Q 5wMI2jpXZqnkh8LdaZmv9XxnoTIBMbArqgfq0XC8pyGOjLFUBvLVvyQj28rLovkRrNBQ MwjzQGQtqWi5Rc/LADW6H2iGcgy1YnWc2V+uQb02gE8mdmfjS6fJ22TlbITysmSFYQuB JcMQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1708130371; x=1708735171; 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=ijJGORoBUm3OaIKDGyVcLAHo3HCT5x1FLS32130PX9o=; b=ZjhdQwUSPnWHT6TLk6OMtyuGfyp669g/gkW2idVWL5b1UE8yksru+fXvioVd+aQq3X xC4v5i3xN3gPDlvhsWh07Gw4YxyG0tGYfvG69I6PMGQzfm8UBtXceLcqQAJE8PmmdLNm keMg5kd8qd7ubyQTGQUUcfNsXtFCcl6gaeiu8ASDQuoPZyZrFRD0eZkXUlkz/OZB0s1Z 0LRsoSfqeS0kQDB4/WDbErMM9eisrtAPmtqTuzzGY1I5J2sDfhtc0I+M51438L5rDS2M i3DHGnVXAQqu0558Xsc8s23gX1RcunRlgt9IInSdkGxLxEmWsODejX3ldBa8DPMhYQ8O Q6jw== X-Gm-Message-State: AOJu0YwqW7uqfbLHFuiCwEezYICGy1P4b93BD+AAPDIyRA+HXbgr5nm/ 3WYn0CN8Ja3tS3eFzOxWyvJfcAfadlkB7jpgrl3dCUdGWtUYTRj6aipm6BP2MYiPTK0FNWeQQhc z X-Received: by 2002:a17:902:650c:b0:1db:875b:efb2 with SMTP id b12-20020a170902650c00b001db875befb2mr5946519plk.10.1708130370896; Fri, 16 Feb 2024 16:39:30 -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.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 16 Feb 2024 16:39:30 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Cc: amonakov@ispras.ru, mmromanov@ispras.ru Subject: [PATCH v5 07/10] util/bufferiszero: Introduce biz_accel_fn typedef Date: Fri, 16 Feb 2024 14:39:15 -1000 Message-Id: <20240217003918.52229-8-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::634; envelope-from=richard.henderson@linaro.org; helo=mail-pl1-x634.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 Signed-off-by: Richard Henderson --- util/bufferiszero.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/util/bufferiszero.c b/util/bufferiszero.c index a904b747c7..61ea59d2e0 100644 --- a/util/bufferiszero.c +++ b/util/bufferiszero.c @@ -26,7 +26,8 @@ #include "qemu/bswap.h" #include "host/cpuinfo.h" -static bool (*buffer_is_zero_accel)(const void *, size_t); +typedef bool (*biz_accel_fn)(const void *, size_t); +static biz_accel_fn buffer_is_zero_accel; static bool buffer_is_zero_int_lt256(const void *buf, size_t len) { @@ -179,13 +180,15 @@ buffer_zero_avx2(const void *buf, size_t len) } #endif /* CONFIG_AVX2_OPT */ + + static unsigned __attribute__((noinline)) select_accel_cpuinfo(unsigned info) { /* Array is sorted in order of algorithm preference. */ static const struct { unsigned bit; - bool (*fn)(const void *, size_t); + biz_accel_fn fn; } all[] = { #ifdef CONFIG_AVX2_OPT { CPUINFO_AVX2, buffer_zero_avx2 }, @@ -232,7 +235,7 @@ bool test_buffer_is_zero_next_accel(void) #define INIT_ACCEL buffer_is_zero_int_ge256 #endif -static bool (*buffer_is_zero_accel)(const void *, size_t) = INIT_ACCEL; +static biz_accel_fn buffer_is_zero_accel = INIT_ACCEL; bool buffer_is_zero_ool(const void *buf, size_t len) {