mirror of
https://github.com/openssl/openssl.git
synced 2026-05-07 20:12:39 +00:00
Add icx compiler version support in perl asm scripts
Reviewed-by: Dmitry Belyavskiy <beldmit@gmail.com> Reviewed-by: Paul Dale <paul.dale@oracle.com> MergeDate: Mon Apr 27 06:44:52 2026 (Merged from https://github.com/openssl/openssl/pull/30313)
This commit is contained in:
committed by
Nikola Pajkovsky
parent
40577e1355
commit
82124a204a
@@ -49,6 +49,13 @@ if (!$avx512vaes && `$ENV{CC} -v 2>&1`
|
||||
}
|
||||
}
|
||||
|
||||
if (!$avx512vaes && `$ENV{CC} -x c /dev/null -dM -E|grep __clang_major__`
|
||||
=~ /#define __clang_major__.([0-9]+)/) {
|
||||
if ($1) {
|
||||
$avx512vaes = ($1>=11); #icx started with clang 11
|
||||
}
|
||||
}
|
||||
|
||||
open OUT,"| \"$^X\" \"$xlate\" $flavour \"$output\""
|
||||
or die "can't call $xlate: $!";
|
||||
*STDOUT=*OUT;
|
||||
|
||||
@@ -80,6 +80,13 @@ if (!$avx && `$ENV{CC} -v 2>&1` =~ /((?:clang|LLVM) version|.*based on LLVM) ([0
|
||||
$avx = ($2>=3.0) + ($2>3.0);
|
||||
}
|
||||
|
||||
if (!$avx && `$ENV{CC} -x c /dev/null -dM -E|grep __clang_major__`
|
||||
=~ /#define __clang_major__.([0-9]+)/) {
|
||||
if ($1) {
|
||||
$avx = ($1>=11); #icx started with clang 11
|
||||
}
|
||||
}
|
||||
|
||||
open OUT,"| \"$^X\" \"$xlate\" $flavour \"$output\""
|
||||
or die "can't call $xlate: $!";
|
||||
*STDOUT=*OUT;
|
||||
|
||||
@@ -111,6 +111,9 @@ $avx=1 if (!$avx && $win64 && ($flavour =~ /masm/ || $ENV{ASM} =~ /ml64/) &&
|
||||
$1>=10);
|
||||
$avx=1 if (!$avx && `$ENV{CC} -v 2>&1` =~ /((?:clang|LLVM) version|.*based on LLVM) ([0-9]+\.[0-9]+)/ && $2>=3.0);
|
||||
|
||||
$avx=1 if (!$avx && `$ENV{CC} -x c /dev/null -dM -E|grep __clang_major__` =~ /#define __clang_major__.([0-9]+)/ &&
|
||||
$1>=11); #icx started with clang 11
|
||||
|
||||
$shaext=1; ### set to zero if compiling for 1.0.1
|
||||
|
||||
$stitched_decrypt=0;
|
||||
|
||||
@@ -75,6 +75,13 @@ if (!$avx && `$ENV{CC} -v 2>&1` =~ /((?:clang|LLVM) version|.*based on LLVM) ([0
|
||||
$avx = ($2>=3.0) + ($2>3.0);
|
||||
}
|
||||
|
||||
if (!$avx && `$ENV{CC} -x c /dev/null -dM -E|grep __clang_major__`
|
||||
=~ /#define __clang_major__.([0-9]+)/) {
|
||||
if ($1) {
|
||||
$avx = ($1>=11); #icx started with clang 11
|
||||
}
|
||||
}
|
||||
|
||||
$shaext=$avx; ### set to zero if compiling for 1.0.1
|
||||
$avx=1 if (!$shaext && $avx);
|
||||
|
||||
|
||||
@@ -59,6 +59,13 @@ if (!$avx512vaes && `$ENV{CC} -v 2>&1`
|
||||
}
|
||||
}
|
||||
|
||||
if (!$avx512vaes && `$ENV{CC} -x c /dev/null -dM -E|grep __clang_major__`
|
||||
=~ /#define __clang_major__.([0-9]+)/) {
|
||||
if ($1) {
|
||||
$avx512vaes = ($1>=11); #icx started with clang 11
|
||||
}
|
||||
}
|
||||
|
||||
open OUT,"| \"$^X\" \"$xlate\" $flavour \"$output\""
|
||||
or die "can't call $xlate: $!";
|
||||
*STDOUT=*OUT;
|
||||
|
||||
@@ -64,6 +64,13 @@ if (!$avx512ifma && `$ENV{CC} -v 2>&1`
|
||||
}
|
||||
}
|
||||
|
||||
if (!$avx512ifma && `$ENV{CC} -x c /dev/null -dM -E|grep __clang_major__`
|
||||
=~ /#define __clang_major__.([0-9]+)/) {
|
||||
if ($1) {
|
||||
$avx512ifma = ($1>=11); #icx started with clang 11
|
||||
}
|
||||
}
|
||||
|
||||
open OUT,"| \"$^X\" \"$xlate\" $flavour \"$output\""
|
||||
or die "can't call $xlate: $!";
|
||||
*STDOUT=*OUT;
|
||||
|
||||
@@ -39,6 +39,13 @@ if (!$avxifma && `$ENV{CC} -v 2>&1`
|
||||
$avxifma = ($ver>=16.0);
|
||||
}
|
||||
|
||||
if (!$avxifma && `$ENV{CC} -x c /dev/null -dM -E|grep __clang_major__`
|
||||
=~ /#define __clang_major__.([0-9]+)/) {
|
||||
if ($1) {
|
||||
$avxifma = ($1>=16);
|
||||
}
|
||||
}
|
||||
|
||||
if ($win64 && ($flavour =~ /nasm/ || $ENV{ASM} =~ /nasm/) &&
|
||||
`nasm -v 2>&1` =~ /NASM version ([0-9]+)\.([0-9]+)(?:\.([0-9]+))?(rc[0-9]+)?/) {
|
||||
my $ver = $1 + $2/100.0 + $3/10000.0; # 3.1.0->3.01, 3.10.1->3.1001
|
||||
|
||||
@@ -63,6 +63,13 @@ if (!$avx512ifma && `$ENV{CC} -v 2>&1`
|
||||
}
|
||||
}
|
||||
|
||||
if (!$avx512ifma && `$ENV{CC} -x c /dev/null -dM -E|grep __clang_major__`
|
||||
=~ /#define __clang_major__.([0-9]+)/) {
|
||||
if ($1) {
|
||||
$avx512ifma = ($1>=11); #icx started with clang 11
|
||||
}
|
||||
}
|
||||
|
||||
open OUT,"| \"$^X\" \"$xlate\" $flavour \"$output\""
|
||||
or die "can't call $xlate: $!";
|
||||
*STDOUT=*OUT;
|
||||
|
||||
@@ -38,6 +38,13 @@ if (!$avxifma && `$ENV{CC} -v 2>&1`
|
||||
$avxifma = ($ver>=16.0);
|
||||
}
|
||||
|
||||
if (!$avxifma && `$ENV{CC} -x c /dev/null -dM -E|grep __clang_major__`
|
||||
=~ /#define __clang_major__.([0-9]+)/) {
|
||||
if ($1) {
|
||||
$avxifma = ($1>=16);
|
||||
}
|
||||
}
|
||||
|
||||
if ($win64 && ($flavour =~ /nasm/ || $ENV{ASM} =~ /nasm/) &&
|
||||
`nasm -v 2>&1` =~ /NASM version ([2-9]\.[0-9]+)(?:\.([0-9]+))?(rc[0-9]+)?/) {
|
||||
$avxifma = ($1>2.16) + ($1==2.16 && ((!defined($2) && !defined($3)) || (defined($2))));
|
||||
|
||||
@@ -63,6 +63,13 @@ if (!$avx512ifma && `$ENV{CC} -v 2>&1`
|
||||
}
|
||||
}
|
||||
|
||||
if (!$avx512ifma && `$ENV{CC} -x c /dev/null -dM -E|grep __clang_major__`
|
||||
=~ /#define __clang_major__.([0-9]+)/) {
|
||||
if ($1) {
|
||||
$avx512ifma = ($1>=11); #icx started with clang 11
|
||||
}
|
||||
}
|
||||
|
||||
open OUT,"| \"$^X\" \"$xlate\" $flavour \"$output\""
|
||||
or die "can't call $xlate: $!";
|
||||
*STDOUT=*OUT;
|
||||
|
||||
@@ -38,6 +38,13 @@ if (!$avxifma && `$ENV{CC} -v 2>&1`
|
||||
$avxifma = ($ver>=16.0);
|
||||
}
|
||||
|
||||
if (!$avxifma && `$ENV{CC} -x c /dev/null -dM -E|grep __clang_major__`
|
||||
=~ /#define __clang_major__.([0-9]+)/) {
|
||||
if ($1) {
|
||||
$avxifma = ($1>=16);
|
||||
}
|
||||
}
|
||||
|
||||
if ($win64 && ($flavour =~ /nasm/ || $ENV{ASM} =~ /nasm/) &&
|
||||
`nasm -v 2>&1` =~ /NASM version ([2-9]\.[0-9]+)(?:\.([0-9]+))?(rc[0-9]+)?/) {
|
||||
$avxifma = ($1>2.16) + ($1==2.16 && ((!defined($2) && !defined($3)) || (defined($2))));
|
||||
|
||||
@@ -73,6 +73,14 @@ if (!$avx && `$ENV{CC} -v 2>&1` =~ /((?:clang|LLVM) version|based on LLVM) ([0-9
|
||||
$addx = ($ver>=3.03);
|
||||
}
|
||||
|
||||
if (!$avx && `$ENV{CC} -x c /dev/null -dM -E|grep __clang_major__`
|
||||
=~ /#define __clang_major__.([0-9]+)/) {
|
||||
if ($1) {
|
||||
$addx = ($1>=11); #icx started with clang 11
|
||||
$avx = ($1>=11);
|
||||
}
|
||||
}
|
||||
|
||||
open OUT,"| \"$^X\" \"$xlate\" $flavour \"$output\""
|
||||
or die "can't call $xlate: $!";
|
||||
*STDOUT = *OUT;
|
||||
|
||||
@@ -90,6 +90,13 @@ if (!$addx && `$ENV{CC} -v 2>&1` =~ /((?:clang|LLVM) version|.*based on LLVM) ([
|
||||
$addx = ($ver>=3.03);
|
||||
}
|
||||
|
||||
if (!$addx && `$ENV{CC} -x c /dev/null -dM -E|grep __clang_major__`
|
||||
=~ /#define __clang_major__.([0-9]+)/) {
|
||||
if ($1) {
|
||||
$addx = ($1>=11); #icx started with clang 11
|
||||
}
|
||||
}
|
||||
|
||||
($out, $inp, $mod) = ("%rdi", "%rsi", "%rbp"); # common internal API
|
||||
{
|
||||
my ($out,$inp,$mod,$n0,$times) = ("%rdi","%rsi","%rdx","%rcx","%r8d");
|
||||
|
||||
@@ -82,6 +82,13 @@ if (!$addx && `$ENV{CC} -v 2>&1` =~ /((?:clang|LLVM) version|.*based on LLVM) ([
|
||||
$addx = ($ver>=3.03);
|
||||
}
|
||||
|
||||
if (!$addx && `$ENV{CC} -x c /dev/null -dM -E|grep __clang_major__`
|
||||
=~ /#define __clang_major__.([0-9]+)/) {
|
||||
if ($1) {
|
||||
$addx = ($1>=11); #icx started with clang 11
|
||||
}
|
||||
}
|
||||
|
||||
# int bn_mul_mont(
|
||||
$rp="%rdi"; # BN_ULONG *rp,
|
||||
$ap="%rsi"; # const BN_ULONG *ap,
|
||||
|
||||
@@ -69,6 +69,13 @@ if (!$addx && `$ENV{CC} -v 2>&1` =~ /((?:clang|LLVM) version|.*based on LLVM) ([
|
||||
$addx = ($ver>=3.03);
|
||||
}
|
||||
|
||||
if (!$addx && `$ENV{CC} -x c /dev/null -dM -E|grep __clang_major__`
|
||||
=~ /#define __clang_major__.([0-9]+)/) {
|
||||
if ($1) {
|
||||
$addx = ($1>=11); #icx started with clang 11
|
||||
}
|
||||
}
|
||||
|
||||
# int bn_mul_mont_gather5(
|
||||
$rp="%rdi"; # BN_ULONG *rp,
|
||||
$ap="%rsi"; # const BN_ULONG *ap,
|
||||
|
||||
@@ -64,6 +64,10 @@ $ymm=1 if ($xmm && !$ymm &&
|
||||
`$ENV{CC} -v 2>&1` =~ /((?:clang|LLVM) version|based on LLVM) ([0-9]+\.[0-9]+)/ &&
|
||||
$2>=3.0); # first version supporting AVX
|
||||
|
||||
$ymm=1 if ($xmm && !$ymm &&
|
||||
`$ENV{CC} -x c /dev/null -dM -E|grep __clang_major__` =~ /#define __clang_major__.([0-9]+)/ &&
|
||||
$1>=11); #icx started with clang 11
|
||||
|
||||
$a="eax";
|
||||
($b,$b_)=("ebx","ebp");
|
||||
($c,$c_)=("ecx","esi");
|
||||
|
||||
@@ -91,6 +91,13 @@ if (!$avx && `$ENV{CC} -v 2>&1` =~ /((?:clang|LLVM) version|.*based on LLVM) ([0
|
||||
$avx = ($2>=3.0) + ($2>3.0);
|
||||
}
|
||||
|
||||
if (!$avx && `$ENV{CC} -x c /dev/null -dM -E|grep __clang_major__`
|
||||
=~ /#define __clang_major__.([0-9]+)/) {
|
||||
if ($1) {
|
||||
$avx = ($1>=11); #icx started with clang 11
|
||||
}
|
||||
}
|
||||
|
||||
open OUT,"| \"$^X\" \"$xlate\" $flavour \"$output\""
|
||||
or die "can't call $xlate: $!";
|
||||
*STDOUT=*OUT;
|
||||
|
||||
@@ -80,6 +80,14 @@ if (!$addx && `$ENV{CC} -v 2>&1` =~ /((?:clang|LLVM) version|.*based on LLVM) ([
|
||||
$addx = ($ver>=3.03);
|
||||
}
|
||||
|
||||
if (!$addx && `$ENV{CC} -x c /dev/null -dM -E|grep __clang_major__`
|
||||
=~ /#define __clang_major__.([0-9]+)/) {
|
||||
if ($1) {
|
||||
$avx = ($1>=11); #icx started with clang 11
|
||||
$addx = ($1>=11);
|
||||
}
|
||||
}
|
||||
|
||||
$code.=<<___;
|
||||
.text
|
||||
.extern OPENSSL_ia32cap_P
|
||||
|
||||
@@ -97,6 +97,13 @@ if (!$addx && `$ENV{CC} -v 2>&1` =~ /((?:clang|LLVM) version|.*based on LLVM) ([
|
||||
$addx = ($ver>=3.03);
|
||||
}
|
||||
|
||||
if (!$addx && `$ENV{CC} -x c /dev/null -dM -E|grep __clang_major__`
|
||||
=~ /#define __clang_major__.([0-9]+)/) {
|
||||
if ($1) {
|
||||
$addx = ($1>=11); #icx started with clang 11
|
||||
}
|
||||
}
|
||||
|
||||
$code.=<<___;
|
||||
.text
|
||||
|
||||
|
||||
@@ -72,6 +72,13 @@ if (!$avx512vaes && `$ENV{CC} -v 2>&1`
|
||||
}
|
||||
}
|
||||
|
||||
if (!$avx512vaes && `$ENV{CC} -x c /dev/null -dM -E|grep __clang_major__`
|
||||
=~ /#define __clang_major__.([0-9]+)/) {
|
||||
if ($1) {
|
||||
$avx512vaes = ($1>=11); #icx started with clang 11
|
||||
}
|
||||
}
|
||||
|
||||
open OUT, "| \"$^X\" \"$xlate\" $flavour \"$output\""
|
||||
or die "can't call $xlate: $!";
|
||||
*STDOUT = *OUT;
|
||||
|
||||
@@ -73,6 +73,13 @@ if (!$avx && `$ENV{CC} -v 2>&1` =~ /((?:clang|LLVM) version|.*based on LLVM) ([0
|
||||
$avx = ($2>=3.0) + ($2>3.0);
|
||||
}
|
||||
|
||||
if (!$avx && `$ENV{CC} -x c /dev/null -dM -E|grep __clang_major__`
|
||||
=~ /#define __clang_major__.([0-9]+)/) {
|
||||
if ($1) {
|
||||
$avx = ($1>=11); #icx started with clang 11
|
||||
}
|
||||
}
|
||||
|
||||
open OUT,"| \"$^X\" \"$xlate\" $flavour \"$output\""
|
||||
or die "can't call $xlate: $!";
|
||||
*STDOUT=*OUT;
|
||||
|
||||
@@ -121,6 +121,13 @@ if (!$avx && `$ENV{CC} -v 2>&1` =~ /((?:clang|LLVM) version|.*based on LLVM) ([0
|
||||
$avx = ($2>=3.0) + ($2>3.0);
|
||||
}
|
||||
|
||||
if (!$avx && `$ENV{CC} -x c /dev/null -dM -E|grep __clang_major__`
|
||||
=~ /#define __clang_major__.([0-9]+)/) {
|
||||
if ($1) {
|
||||
$avx = ($1>=11); #icx started with clang 11
|
||||
}
|
||||
}
|
||||
|
||||
open OUT,"| \"$^X\" \"$xlate\" $flavour \"$output\""
|
||||
or die "can't call $xlate: $!";
|
||||
*STDOUT=*OUT;
|
||||
|
||||
@@ -73,6 +73,13 @@ if ($sse2) {
|
||||
if (!$avx && `$ENV{CC} -v 2>&1` =~ /((?:clang|LLVM) version|based on LLVM) ([0-9]+\.[0-9]+)/) {
|
||||
$avx = ($2>=3.0) + ($2>3.0);
|
||||
}
|
||||
|
||||
if (!$avx && `$ENV{CC} -x c /dev/null -dM -E|grep __clang_major__`
|
||||
=~ /#define __clang_major__.([0-9]+)/) {
|
||||
if ($1) {
|
||||
$avx = ($1>=11); #icx started with clang 11
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
########################################################################
|
||||
|
||||
@@ -95,6 +95,13 @@ if (!$avx && `$ENV{CC} -v 2>&1` =~ /((?:clang|LLVM) version|.*based on LLVM) ([0
|
||||
$avx = ($2>=3.0) + ($2>3.0);
|
||||
}
|
||||
|
||||
if (!$avx && `$ENV{CC} -x c /dev/null -dM -E|grep __clang_major__`
|
||||
=~ /#define __clang_major__.([0-9]+)/) {
|
||||
if ($1) {
|
||||
$avx = ($1>=11); #icx started with clang 11
|
||||
}
|
||||
}
|
||||
|
||||
open OUT,"| \"$^X\" \"$xlate\" $flavour \"$output\""
|
||||
or die "can't call $xlate: $!";
|
||||
*STDOUT=*OUT;
|
||||
|
||||
@@ -146,6 +146,9 @@ $ymm=1 if ($xmm && !$ymm && $ARGV[0] eq "win32" &&
|
||||
$ymm=1 if ($xmm && !$ymm && `$ENV{CC} -v 2>&1` =~ /((?:clang|LLVM) version|based on LLVM) ([0-9]+\.[0-9]+)/ &&
|
||||
$2>=3.0); # first version supporting AVX
|
||||
|
||||
$ymm=1 if ($xmm && !$ymm && `$ENV{CC} -x c /dev/null -dM -E|grep __clang_major__` =~ /#define __clang_major__.([0-9]+)/ &&
|
||||
$1>=11); #icx started with clang 11
|
||||
|
||||
$shaext=$xmm; ### set to zero if compiling for 1.0.1
|
||||
|
||||
&external_label("OPENSSL_ia32cap_P") if ($xmm);
|
||||
|
||||
@@ -76,6 +76,13 @@ if (!$avx && `$ENV{CC} -v 2>&1` =~ /((?:clang|LLVM) version|.*based on LLVM) ([0
|
||||
$avx = ($2>=3.0) + ($2>3.0);
|
||||
}
|
||||
|
||||
if (!$avx && `$ENV{CC} -x c /dev/null -dM -E|grep __clang_major__`
|
||||
=~ /#define __clang_major__.([0-9]+)/) {
|
||||
if ($1) {
|
||||
$avx = ($1>=11); #icx started with clang 11
|
||||
}
|
||||
}
|
||||
|
||||
open OUT,"| \"$^X\" \"$xlate\" $flavour \"$output\""
|
||||
or die "can't call $xlate: $!";
|
||||
*STDOUT=*OUT;
|
||||
|
||||
@@ -124,6 +124,13 @@ if (!$avx && `$ENV{CC} -v 2>&1` =~ /((?:clang|LLVM) version|.*based on LLVM) ([0
|
||||
$avx = ($2>=3.0) + ($2>3.0);
|
||||
}
|
||||
|
||||
if (!$avx && `$ENV{CC} -x c /dev/null -dM -E|grep __clang_major__`
|
||||
=~ /#define __clang_major__.([0-9]+)/) {
|
||||
if ($1) {
|
||||
$avx = ($1>=11); #icx started with clang 11
|
||||
}
|
||||
}
|
||||
|
||||
$shaext=1; ### set to zero if compiling for 1.0.1
|
||||
$avx=1 if (!$shaext && $avx);
|
||||
|
||||
|
||||
@@ -99,6 +99,13 @@ if ($xmm && !$avx && `$ENV{CC} -v 2>&1` =~ /((?:clang|LLVM) version|based on LLV
|
||||
$avx = ($2>=3.0) + ($2>3.0);
|
||||
}
|
||||
|
||||
if ($xmm && !$avx && `$ENV{CC} -x c /dev/null -dM -E|grep __clang_major__`
|
||||
=~ /#define __clang_major__.([0-9]+)/) {
|
||||
if ($1) {
|
||||
$avx = ($1>=11); #icx started with clang 11
|
||||
}
|
||||
}
|
||||
|
||||
$shaext=$xmm; ### set to zero if compiling for 1.0.1
|
||||
|
||||
$unroll_after = 64*4; # If pre-evicted from L1P cache first spin of
|
||||
|
||||
@@ -77,6 +77,13 @@ if (!$avx && `$ENV{CC} -v 2>&1` =~ /((?:clang|LLVM) version|.*based on LLVM) ([0
|
||||
$avx = ($2>=3.0) + ($2>3.0);
|
||||
}
|
||||
|
||||
if (!$avx && `$ENV{CC} -x c /dev/null -dM -E|grep __clang_major__`
|
||||
=~ /#define __clang_major__.([0-9]+)/) {
|
||||
if ($1) {
|
||||
$avx = ($1>=11); #icx started with clang 11
|
||||
}
|
||||
}
|
||||
|
||||
open OUT,"| \"$^X\" \"$xlate\" $flavour \"$output\""
|
||||
or die "can't call $xlate: $!";
|
||||
*STDOUT=*OUT;
|
||||
|
||||
@@ -144,6 +144,13 @@ if (!$avx && `$ENV{CC} -v 2>&1` =~ /((?:clang|LLVM) version|.*based on LLVM) ([0
|
||||
$avx = ($2>=3.0) + ($2>3.0);
|
||||
}
|
||||
|
||||
if (!$avx && `$ENV{CC} -x c /dev/null -dM -E|grep __clang_major__`
|
||||
=~ /#define __clang_major__.([0-9]+)/) {
|
||||
if ($1) {
|
||||
$avx = ($1>=11); #icx started with clang 11
|
||||
}
|
||||
}
|
||||
|
||||
$shaext=1; ### set to zero if compiling for 1.0.1
|
||||
$avx=1 if (!$shaext && $avx);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user