Use a more reliable way of detecting CPU features
This commit is contained in:
parent
3788dd56f2
commit
7220d35059
@ -1,11 +1,10 @@
|
||||
--- src/blister.c.orig 2022-08-18 14:51:32.000000000 -0600
|
||||
+++ src/blister.c 2022-08-22 15:15:48.900018807 -0600
|
||||
@@ -840,6 +840,29 @@ void ConvBlist (
|
||||
--- src/blister.c.orig 2022-12-17 19:18:59.000000000 -0700
|
||||
+++ src/blister.c 2023-08-10 20:07:09.650671153 -0600
|
||||
@@ -840,6 +840,28 @@ void ConvBlist (
|
||||
**
|
||||
*F COUNT_TRUES_BLOCK( <block> ) . . . . . . . . . . . count number of trues
|
||||
*/
|
||||
+#ifdef __x86_64__
|
||||
+#include <cpuid.h>
|
||||
+static UInt __attribute__((target ("popcnt"))) fast_COUNT_TRUES_BLOCK(UInt block)
|
||||
+{
|
||||
+ return __builtin_popcountl(block);
|
||||
@ -18,10 +17,10 @@
|
||||
+
|
||||
+static UInt (*resolve_COUNT_TRUES_BLOCK(void))(UInt block)
|
||||
+{
|
||||
+ unsigned int eax, ebx, ecx, edx;
|
||||
+ return (__get_cpuid(1, &eax, &ebx, &ecx, &edx) && (ecx & bit_POPCNT) != 0)
|
||||
+ __builtin_cpu_init();
|
||||
+ return __builtin_cpu_supports("popcnt")
|
||||
+ ? &fast_COUNT_TRUES_BLOCK
|
||||
+ : &slow_COUNT_TRUES_BLOCK;
|
||||
+ : &slow_COUNT_TRUES_BLOCK;
|
||||
+}
|
||||
+
|
||||
+UInt __attribute__((ifunc ("resolve_COUNT_TRUES_BLOCK")))
|
||||
@ -30,7 +29,7 @@
|
||||
UInt COUNT_TRUES_BLOCK(UInt block)
|
||||
{
|
||||
#if USE_POPCNT && defined(HAVE___BUILTIN_POPCOUNTL)
|
||||
@@ -864,6 +887,7 @@ UInt COUNT_TRUES_BLOCK(UInt block)
|
||||
@@ -864,6 +886,7 @@ UInt COUNT_TRUES_BLOCK(UInt block)
|
||||
return block;
|
||||
#endif
|
||||
}
|
||||
|
5
gap.spec
5
gap.spec
@ -32,7 +32,7 @@
|
||||
|
||||
Name: gap
|
||||
Version: 4.12.2
|
||||
Release: 4%{?dist}
|
||||
Release: 5%{?dist}
|
||||
Summary: Computational discrete algebra
|
||||
|
||||
%global majver %(cut -d. -f1-2 <<< %{version})
|
||||
@ -444,6 +444,9 @@ make check
|
||||
%{_libdir}/libgap.so
|
||||
|
||||
%changelog
|
||||
* Thu Aug 10 2023 Jerry James <loganjerry@gmail.com> - 4.12.2-5
|
||||
- Use a more reliable way of detecting CPU features
|
||||
|
||||
* Wed Jul 19 2023 Fedora Release Engineering <releng@fedoraproject.org> - 4.12.2-4
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_39_Mass_Rebuild
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user