From nobody Sat Feb 7 07:31:23 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1668034433; cv=none; d=zohomail.com; s=zohoarc; b=nV2QII3HZ6vtYdR0O7/ODoK/nKXn14DTqgjEEfrsBLBkUMWE6prNtLDml7Y9SPGkOAEb7MU0vCxo5UhZWCKzr+dG8bHzMOZhncRTAuIO9MFHZy50PiPz3NutCL2/NhKsFjXE33D1dY+eJOCjup6l/X8Bbx+NZhhwL2fjC7ajft4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1668034433; h=Content-Transfer-Encoding:Cc:Date:From:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:To; bh=7RM5k9bBCdCShmyzVORGHgspw4nuUOaq4rWkJ77yW1s=; b=JSNwIZqvW/IF4DqMKWv9oPKJQeKmUQlG91mh/mUQs469JB6d3UZO9koKAMs/oOq9QqaDBnF1oZsJLS4uNd5AL0uLAlJvnlZRmX/2Jw8nS75oCGIZh+nCOSfDG+sBkpsK8wVMQtwC6KLQzT0NRKE1KjlGQUtsjucEKQA5SrZ3Vxk= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1668034433654727.8157118732278; Wed, 9 Nov 2022 14:53:53 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ostwr-0000oC-Rr; Wed, 09 Nov 2022 17:53:33 -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 1ostBK-0008MH-Pq for qemu-devel@nongnu.org; Wed, 09 Nov 2022 17:04:33 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ostBG-0001y1-HU for qemu-devel@nongnu.org; Wed, 09 Nov 2022 17:04:24 -0500 Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-99-_jYnl-IaMcWlyNIIdWr7Uw-1; Wed, 09 Nov 2022 17:03:15 -0500 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.rdu2.redhat.com [10.11.54.1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id E11853803903 for ; Wed, 9 Nov 2022 22:03:14 +0000 (UTC) Received: from pkg.. (unknown [10.22.34.246]) by smtp.corp.redhat.com (Postfix) with ESMTP id 4976B40C2086; Wed, 9 Nov 2022 22:03:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1668031461; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=7RM5k9bBCdCShmyzVORGHgspw4nuUOaq4rWkJ77yW1s=; b=Z/svlyjA7+zT3lOJtmiLwe9/Ifbc9CcLXT32YT1uTPZcBakFWaFgctA5WPVQ3hbd1Hw13l A8aOKJo20d+PJ9OcPop0TZNO1AjHkB4TmcNjuh+sX4EXgbewcY+dU4BQurSgEl3QbmpWas 8d9DTd26tRVIgvVeric+N+qH2D5O0vk= X-MC-Unique: _jYnl-IaMcWlyNIIdWr7Uw-1 From: Tom Stellard To: qemu-devel@nongnu.org Cc: Paolo Bonzini , "Daniel P . Berrange" , Tom Stellard Subject: [PATCH] Use a more portable way to enable target specific functions Date: Wed, 9 Nov 2022 22:03:07 +0000 Message-Id: <20221109220307.226283-1-tstellar@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.1 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.129.124; envelope-from=tstellar@redhat.com; helo=us-smtp-delivery-124.mimecast.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, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-Mailman-Approved-At: Wed, 09 Nov 2022 17:53:31 -0500 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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1668034435585100003 Content-Type: text/plain; charset="utf-8" This adds function attributes for avx2, sse2, etc. specialized functions. These attributes are supported by both clang and gcc and are necessary in order to build the code with clang. The existing gcc specific pragmas were left in place due to a comment in utils/bufferiszero.c which mentions the pragmas are needed before headers to work around a bug in gcc <=3D 4.8. Signed-off-by: Tom Stellard --- meson.build | 2 +- util/bufferiszero.c | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/meson.build b/meson.build index cf3e517e56..45573c0e44 100644 --- a/meson.build +++ b/meson.build @@ -2323,7 +2323,7 @@ config_host_data.set('CONFIG_AVX2_OPT', get_option('a= vx2') \ #pragma GCC target("avx2") #include #include - static int bar(void *a) { + __attribute__((target("avx2"))) static int bar(void *a) { __m256i x =3D *(__m256i *)a; return _mm256_testz_si256(x, x); } diff --git a/util/bufferiszero.c b/util/bufferiszero.c index ec3cd4ca15..e4f5628643 100644 --- a/util/bufferiszero.c +++ b/util/bufferiszero.c @@ -75,7 +75,7 @@ buffer_zero_int(const void *buf, size_t len) =20 /* Note that each of these vectorized functions require len >=3D 64. */ =20 -static bool +__attribute__((target("sse2"))) static bool buffer_zero_sse2(const void *buf, size_t len) { __m128i t =3D _mm_loadu_si128(buf); @@ -117,7 +117,7 @@ buffer_zero_sse2(const void *buf, size_t len) #pragma GCC target("sse4") #include =20 -static bool +__attribute__((target("sse4"))) static bool buffer_zero_sse4(const void *buf, size_t len) { __m128i t =3D _mm_loadu_si128(buf); @@ -150,7 +150,7 @@ buffer_zero_sse4(const void *buf, size_t len) #pragma GCC target("avx2") #include =20 -static bool +__attribute__((target("avx2"))) static bool buffer_zero_avx2(const void *buf, size_t len) { /* Begin with an unaligned head of 32 bytes. */ @@ -184,7 +184,7 @@ buffer_zero_avx2(const void *buf, size_t len) #pragma GCC target("avx512f") #include =20 -static bool +__attribute__((target("avx512f"))) static bool buffer_zero_avx512(const void *buf, size_t len) { /* Begin with an unaligned head of 64 bytes. */ --=20 2.35.3