From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by master.gitmailbox.com (Postfix) with ESMTP id 3C8E3405EB for ; Tue, 21 Dec 2021 20:52:27 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 2F90F68AEA0; Tue, 21 Dec 2021 22:52:25 +0200 (EET) Received: from w4.tutanota.de (w4.tutanota.de [81.3.6.165]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 0BD9068ACF5 for ; Tue, 21 Dec 2021 22:52:18 +0200 (EET) Received: from w3.tutanota.de (unknown [192.168.1.164]) by w4.tutanota.de (Postfix) with ESMTP id 98619106016F for ; Tue, 21 Dec 2021 20:52:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; t=1640119937; s=s1; d=lynne.ee; h=From:From:To:To:Subject:Subject:Content-Description:Content-ID:Content-Type:Content-Type:Content-Transfer-Encoding:Content-Transfer-Encoding:Cc:Date:Date:In-Reply-To:In-Reply-To:MIME-Version:MIME-Version:Message-ID:Message-ID:Reply-To:References:References:Sender; bh=F/dou9WMcdORSauBTuyAe8eK5IaXrgBnyGYAdFZKVuU=; b=LIgWJlbepCJFzA8y8khTfTmXMrdyfPHV3beDGXfjppbpzFLuyC6apLaRdo09J/sl l6C+S1/wvAyBm+j7+xoNjUtgeLGDo2QgKUma8RULgHgcl0FylEHdnick0QJbvWoYzU4 0dKMaTAQr6cGuTV/cnGXZea/48hEzd8XNLsQeE3gkozvXm4seuESof7Ez+vWq6Hh1lF KUezCLddnY8e3U8s0wGFyJyDSKK2QEaR5oxr1RC+j5ubdL8j7B10Qc+3cfL3/VC+OJf jAyRXkI1QKfCzQq7v6V42UGknRlDGFfxrnbwx1GNL33p6wYCmOHERvLHBVMIFge/oJt wrnke6E65A== Date: Tue, 21 Dec 2021 21:52:17 +0100 (CET) From: Lynne To: FFmpeg development discussions and patches Message-ID: In-Reply-To: <20211221195641.1644735-1-alankelly@google.com> References: <20211220135627.615097-1-alankelly@google.com> <8424d6a1-df63-954e-6823-740bf1fcb891@gmail.com> <20211220144312.738559-1-alankelly@google.com> <20211220145903.838398-1-alankelly@google.com> <20211221195641.1644735-1-alankelly@google.com> MIME-Version: 1.0 Subject: Re: [FFmpeg-devel] [PATCH 1/2] libavutil/cpu: Add AV_CPU_FLAG_SLOW_GATHER. X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: FFmpeg development discussions and patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: FFmpeg development discussions and patches Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Archived-At: List-Archive: List-Post: 21 Dec 2021, 20:56 by alankelly-at-google.com@ffmpeg.org: > This flag is set on Haswell and earlier and all AMD cpus. > --- > Checks for family for Haswell. All checks are done where AVX2 flag is > set as this is clearer. > libavutil/cpu.h | 1 + > libavutil/x86/cpu.c | 15 ++++++++++++++- > 2 files changed, 15 insertions(+), 1 deletion(-) > > diff --git a/libavutil/cpu.h b/libavutil/cpu.h > index ae443eccad..ce9bf14bf7 100644 > --- a/libavutil/cpu.h > +++ b/libavutil/cpu.h > @@ -54,6 +54,7 @@ > #define AV_CPU_FLAG_BMI1 0x20000 ///< Bit Manipulation Instruction Set 1 > #define AV_CPU_FLAG_BMI2 0x40000 ///< Bit Manipulation Instruction Set 2 > #define AV_CPU_FLAG_AVX512 0x100000 ///< AVX-512 functions: requires OS support even if YMM/ZMM registers aren't used > +#define AV_CPU_FLAG_SLOW_GATHER 0x2000000 ///< CPU has slow gathers. > > #define AV_CPU_FLAG_ALTIVEC 0x0001 ///< standard > #define AV_CPU_FLAG_VSX 0x0002 ///< ISA 2.06 > diff --git a/libavutil/x86/cpu.c b/libavutil/x86/cpu.c > index bcd41a50a2..441b4695d5 100644 > --- a/libavutil/x86/cpu.c > +++ b/libavutil/x86/cpu.c > @@ -146,8 +146,21 @@ int ff_get_cpu_flags_x86(void) > if (max_std_level >= 7) { > cpuid(7, eax, ebx, ecx, edx); > #if HAVE_AVX2 > - if ((rval & AV_CPU_FLAG_AVX) && (ebx & 0x00000020)) > + if ((rval & AV_CPU_FLAG_AVX) && (ebx & 0x00000020)) { > rval |= AV_CPU_FLAG_AVX2; > + cpuid(1, eax, ebx, ecx, std_caps); > + family = ((eax >> 8) & 0xf) + ((eax >> 20) & 0xff); > + model = ((eax >> 4) & 0xf) + ((eax >> 12) & 0xf0); > + /* Haswell has slow gather */ > + if (!strncmp(vendor.c, "GenuineIntel", 12)) > + if (family == 6 && model < 70) > + rval |= AV_CPU_FLAG_SLOW_GATHER; > + /* Zen 3 and earlier have slow gather */ > + if (!strncmp(vendor.c, "AuthenticAMD", 12)) > + if (family <= 0x19) > + rval |= AV_CPU_FLAG_SLOW_GATHER; > + } > + > #if HAVE_AVX512 /* F, CD, BW, DQ, VL */ > if ((xcr0_lo & 0xe0) == 0xe0) { /* OPMASK/ZMM state */ > if ((rval & AV_CPU_FLAG_AVX2) && (ebx & 0xd0030000) == 0xd0030000) > -- > 2.34.1.173.g76aa8bc2d0-goog > LGTM, thanks _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".