Skip to content

Commit 2519c9d

Browse files
authored
Merge pull request #3579 from martin-frbg/issue3557-2
Fix malfunctioning AVX512 check
2 parents 4cb302a + b79b99d commit 2519c9d

File tree

3 files changed

+4
-11
lines changed

3 files changed

+4
-11
lines changed

Makefile.prebuild

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,8 @@ endif
7171

7272

7373
getarch : getarch.c cpuid.S dummy $(CPUIDEMU)
74-
$(HOSTCC) $(HOST_CFLAGS) $(EXFLAGS) -o $(@F) getarch.c cpuid.S $(CPUIDEMU)
74+
avx512=$$(perl c_check - - gcc | grep NO_AVX512); \
75+
$(HOSTCC) $(HOST_CFLAGS) $(EXFLAGS) $${avx512:+-D$${avx512}} -o $(@F) getarch.c cpuid.S $(CPUIDEMU)
7576

7677
getarch_2nd : getarch_2nd.c config.h dummy
7778
ifndef TARGET_CORE

c_check

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -254,7 +254,7 @@ if (($architecture eq "x86") || ($architecture eq "x86_64")) {
254254
# $tmpf = new File::Temp( UNLINK => 1 );
255255
($fh,$tmpf) = tempfile( SUFFIX => '.c' , UNLINK => 1 );
256256
$code = '"vbroadcastss -4 * 4(%rsi), %zmm2"';
257-
print $tmpf "#include <immintrin.h>\n\nint main(void){ __asm__ volatile($code); }\n";
257+
print $fh "#include <immintrin.h>\n\nint main(void){ __asm__ volatile($code); }\n";
258258
$args = " -march=skylake-avx512 -c -o $tmpf.o $tmpf";
259259
if ($compiler eq "PGI") {
260260
$args = " -tp skylake -c -o $tmpf.o $tmpf";
@@ -278,7 +278,7 @@ if ($data =~ /HAVE_C11/) {
278278
$c11_atomics = 0;
279279
} else {
280280
($fh,$tmpf) = tempfile( SUFFIX => '.c' , UNLINK => 1 );
281-
print $tmpf "#include <stdatomic.h>\nint main(void){}\n";
281+
print $fh "#include <stdatomic.h>\nint main(void){}\n";
282282
$args = " -c -o $tmpf.o $tmpf";
283283
my @cmd = ("$compiler_name $flags $args >/dev/null 2>/dev/null");
284284
system(@cmd) == 0;

getarch.c

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -94,14 +94,6 @@ USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
9494
#include <sys/sysinfo.h>
9595
#endif
9696

97-
#if defined(__x86_64__) || defined(_M_X64)
98-
#if (( defined(__GNUC__) && __GNUC__ > 6 && defined(__AVX2__)) || (defined(__clang__) && __clang_major__ >= 6))
99-
#else
100-
#ifndef NO_AVX512
101-
#define NO_AVX512
102-
#endif
103-
#endif
104-
#endif
10597
/* #define FORCE_P2 */
10698
/* #define FORCE_KATMAI */
10799
/* #define FORCE_COPPERMINE */

0 commit comments

Comments
 (0)