summaryrefslogtreecommitdiff
path: root/crypto/bn/asm
diff options
context:
space:
mode:
authorRichard Levitte <levitte@openssl.org>2022-10-07 10:37:15 +0200
committerTomas Mraz <tomas@openssl.org>2022-10-13 15:45:46 +0200
commit523e0577305bbcc732d22bcb063c6c8ca658874a (patch)
tree68d1e17d3931b7c8168d585b0e959f474bce6783 /crypto/bn/asm
parentc048779520d47962316ddb436d08a050d5659666 (diff)
downloadopenssl-new-523e0577305bbcc732d22bcb063c6c8ca658874a.tar.gz
Fix LLVM vs Apple LLVM version numbering confusion, for $avx512ifma
Apple LLVM has a different version numbering scheme than upstream LLVM. That makes for quite a bit of confusion. https://en.wikipedia.org/wiki/Xcode#Toolchain_versions to the rescue, they have collected quite a lot of useful data. This change is concentrated around the `$avx512ifma` flag Fixes #16670 for the master branch Reviewed-by: Paul Dale <pauli@openssl.org> Reviewed-by: Tomas Mraz <tomas@openssl.org> (Merged from https://github.com/openssl/openssl/pull/19361)
Diffstat (limited to 'crypto/bn/asm')
-rw-r--r--crypto/bn/asm/rsaz-2k-avx512.pl13
-rw-r--r--crypto/bn/asm/rsaz-3k-avx512.pl13
-rw-r--r--crypto/bn/asm/rsaz-4k-avx512.pl13
3 files changed, 33 insertions, 6 deletions
diff --git a/crypto/bn/asm/rsaz-2k-avx512.pl b/crypto/bn/asm/rsaz-2k-avx512.pl
index eba4b11a65..6c5ffc5398 100644
--- a/crypto/bn/asm/rsaz-2k-avx512.pl
+++ b/crypto/bn/asm/rsaz-2k-avx512.pl
@@ -49,8 +49,17 @@ if (!$avx512 && $win64 && ($flavour =~ /nasm/ || $ENV{ASM} =~ /nasm/) &&
$avx512ifma = ($1==2.11 && $2>=8) + ($1>=2.12);
}
-if (!$avx512 && `$ENV{CC} -v 2>&1` =~ /((?:clang|LLVM) version|.*based on LLVM) ([0-9]+\.[0-9]+)/) {
- $avx512ifma = ($2>=7.0);
+if (!$avx512 && `$ENV{CC} -v 2>&1`
+ =~ /(Apple)?\s*((?:clang|LLVM) version|.*based on LLVM) ([0-9]+)\.([0-9]+)\.([0-9]+)?/) {
+ my $ver = $3 + $4/100.0 + $5/10000.0; # 3.1.0->3.01, 3.10.1->3.1001
+ if ($1) {
+ # Apple conditions, they use a different version series, see
+ # https://en.wikipedia.org/wiki/Xcode#Xcode_7.0_-_10.x_(since_Free_On-Device_Development)_2
+ # clang 7.0.0 is Apple clang 10.0.1
+ $avx512ifma = ($ver>=10.0001)
+ } else {
+ $avx512ifma = ($ver>=7.0);
+ }
}
open OUT,"| \"$^X\" \"$xlate\" $flavour \"$output\""
diff --git a/crypto/bn/asm/rsaz-3k-avx512.pl b/crypto/bn/asm/rsaz-3k-avx512.pl
index ef82beef0b..df025a87f0 100644
--- a/crypto/bn/asm/rsaz-3k-avx512.pl
+++ b/crypto/bn/asm/rsaz-3k-avx512.pl
@@ -48,8 +48,17 @@ if (!$avx512 && $win64 && ($flavour =~ /nasm/ || $ENV{ASM} =~ /nasm/) &&
$avx512ifma = ($1==2.11 && $2>=8) + ($1>=2.12);
}
-if (!$avx512 && `$ENV{CC} -v 2>&1` =~ /((?:clang|LLVM) version|.*based on LLVM) ([0-9]+\.[0-9]+)/) {
- $avx512ifma = ($2>=7.0);
+if (!$avx512 && `$ENV{CC} -v 2>&1`
+ =~ /(Apple)?\s*((?:clang|LLVM) version|.*based on LLVM) ([0-9]+)\.([0-9]+)\.([0-9]+)?/) {
+ my $ver = $3 + $4/100.0 + $5/10000.0; # 3.1.0->3.01, 3.10.1->3.1001
+ if ($1) {
+ # Apple conditions, they use a different version series, see
+ # https://en.wikipedia.org/wiki/Xcode#Xcode_7.0_-_10.x_(since_Free_On-Device_Development)_2
+ # clang 7.0.0 is Apple clang 10.0.1
+ $avx512ifma = ($ver>=10.0001)
+ } else {
+ $avx512ifma = ($ver>=7.0);
+ }
}
open OUT,"| \"$^X\" \"$xlate\" $flavour \"$output\""
diff --git a/crypto/bn/asm/rsaz-4k-avx512.pl b/crypto/bn/asm/rsaz-4k-avx512.pl
index 5593165906..53d327e765 100644
--- a/crypto/bn/asm/rsaz-4k-avx512.pl
+++ b/crypto/bn/asm/rsaz-4k-avx512.pl
@@ -48,8 +48,17 @@ if (!$avx512 && $win64 && ($flavour =~ /nasm/ || $ENV{ASM} =~ /nasm/) &&
$avx512ifma = ($1==2.11 && $2>=8) + ($1>=2.12);
}
-if (!$avx512 && `$ENV{CC} -v 2>&1` =~ /((?:clang|LLVM) version|.*based on LLVM) ([0-9]+\.[0-9]+)/) {
- $avx512ifma = ($2>=7.0);
+if (!$avx512 && `$ENV{CC} -v 2>&1`
+ =~ /(Apple)?\s*((?:clang|LLVM) version|.*based on LLVM) ([0-9]+)\.([0-9]+)\.([0-9]+)?/) {
+ my $ver = $3 + $4/100.0 + $5/10000.0; # 3.1.0->3.01, 3.10.1->3.1001
+ if ($1) {
+ # Apple conditions, they use a different version series, see
+ # https://en.wikipedia.org/wiki/Xcode#Xcode_7.0_-_10.x_(since_Free_On-Device_Development)_2
+ # clang 7.0.0 is Apple clang 10.0.1
+ $avx512ifma = ($ver>=10.0001)
+ } else {
+ $avx512ifma = ($ver>=7.0);
+ }
}
open OUT,"| \"$^X\" \"$xlate\" $flavour \"$output\""