Skip to content

Commit

Permalink
Fix version check for znver3, which needs gcc >= 10.3 (#628)
Browse files Browse the repository at this point in the history
Apple's clang-12 lacks znver3 support, unlike upstream clang-12.
  • Loading branch information
jedbrown authored Apr 28, 2022
1 parent 6431c9e commit 1c73340
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 10 deletions.
2 changes: 1 addition & 1 deletion build/config.mk.in
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ CC := @CC@
GCC_OT_4_9_0 := @gcc_older_than_4_9_0@
GCC_OT_6_1_0 := @gcc_older_than_6_1_0@
GCC_OT_9_1_0 := @gcc_older_than_9_1_0@
GCC_OT_10_1_0 := @gcc_older_than_10_1_0@
GCC_OT_10_3_0 := @gcc_older_than_10_3_0@
CLANG_OT_9_0_0 := @clang_older_than_9_0_0@
CLANG_OT_12_0_0 := @clang_older_than_12_0_0@
AOCC_OT_2_0_0 := @aocc_older_than_2_0_0@
Expand Down
6 changes: 5 additions & 1 deletion config/zen3/make_defs.mk
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ ifeq ($(CC_VENDOR),gcc)
ifeq ($(GCC_OT_9_1_0),yes) # gcc versions older than 9.1.
CVECFLAGS_VER := -march=znver1 -mno-avx256-split-unaligned-store
else
ifeq ($(GCC_OT_10_1_0),yes) # gcc versions 9.1 or newer, but older than 10.1.
ifeq ($(GCC_OT_10_3_0),yes) # gcc versions 9.1 or newer, but older than 10.3.
CVECFLAGS_VER := -march=znver2
else # gcc versions 10.1 or newer.
CVECFLAGS_VER := -march=znver3
Expand All @@ -84,10 +84,14 @@ ifeq ($(CC_VENDOR),clang)
else
ifeq ($(CLANG_OT_12_0_0),yes) # clang versions 9.0 or newer, but older than 12.0.
CVECFLAGS_VER := -march=znver2
else
ifeq ($(OS_NAME),Darwin) # clang version 12.0 on OSX lacks znver3 support
CVECFLAGS_VER := -march=znver2
else # clang versions 12.0 or newer.
CVECFLAGS_VER := -march=znver3
endif
endif
endif
else
ifeq ($(CC_VENDOR),aocc)
ifeq ($(AOCC_OT_2_0_0),yes) # aocc versions older than 2.0.
Expand Down
16 changes: 8 additions & 8 deletions configure
Original file line number Diff line number Diff line change
Expand Up @@ -1791,8 +1791,8 @@ check_compiler_version_ranges()
# [5] https://gcc.gnu.org/onlinedocs/gcc-8.3.0/gcc/x86-Options.html#x86-Options
# [6] https://gcc.gnu.org/onlinedocs/gcc-9.4.0/gcc/x86-Options.html#x86-Options
#
# range: gcc < 10.1 (ie: 9.4 or older)
# variable: gcc_older_than_10_1_0
# range: gcc < 10.3 (ie: 9.4 or older)
# variable: gcc_older_than_10_3_0
# comments:
# These older versions of gcc do not explicitly support the Zen3
# microarchitecture; the newest microarchitectural value understood by
Expand All @@ -1806,7 +1806,7 @@ check_compiler_version_ranges()
gcc_older_than_4_9_0='no'
gcc_older_than_6_1_0='no'
gcc_older_than_9_1_0='no'
gcc_older_than_10_1_0='no'
gcc_older_than_10_3_0='no'

clang_older_than_9_0_0='no'
clang_older_than_12_0_0='no'
Expand Down Expand Up @@ -1839,10 +1839,10 @@ check_compiler_version_ranges()
gcc_older_than_9_1_0='yes'
fi

# Check for gcc < 10.1.0 (ie: 9.4 or older).
if [ ${cc_major} -lt 10 ]; then
echo "${script_name}: note: found ${cc} version older than 10.1."
gcc_older_than_10_1_0='yes'
# Check for gcc < 10.3.0 (ie: 10.2 or older).
if [[ ( ${cc_major} -lt 10 ) || ( ${cc_major} -eq 10 && ${cc_minor} -lt 3 ) ]]; then
echo "${script_name}: note: found ${cc} version older than 10.3."
gcc_older_than_10_3_0='yes'
fi
fi

Expand Down Expand Up @@ -3835,7 +3835,7 @@ main()
| sed -e "s/@gcc_older_than_4_9_0@/${gcc_older_than_4_9_0}/g" \
| sed -e "s/@gcc_older_than_6_1_0@/${gcc_older_than_6_1_0}/g" \
| sed -e "s/@gcc_older_than_9_1_0@/${gcc_older_than_9_1_0}/g" \
| sed -e "s/@gcc_older_than_10_1_0@/${gcc_older_than_10_1_0}/g" \
| sed -e "s/@gcc_older_than_10_3_0@/${gcc_older_than_10_3_0}/g" \
| sed -e "s/@clang_older_than_9_0_0@/${clang_older_than_9_0_0}/g" \
| sed -e "s/@clang_older_than_12_0_0@/${clang_older_than_12_0_0}/g" \
| sed -e "s/@aocc_older_than_2_0_0@/${aocc_older_than_2_0_0}/g" \
Expand Down

0 comments on commit 1c73340

Please sign in to comment.