Merge pull request #2390 from martin-frbg/pgi

Small corrections for compilation with PGI compilers
This commit is contained in:
Martin Kroeker 2020-02-09 00:13:40 +01:00 committed by GitHub
commit a5b32ab06c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 13 additions and 4 deletions

12
c_check
View File

@ -188,13 +188,13 @@ if (($architecture eq "mips") || ($architecture eq "mips64")) {
if ($@){ if ($@){
warn "could not load PERL module File::Temp, so could not check MSA capatibility"; warn "could not load PERL module File::Temp, so could not check MSA capatibility";
} else { } else {
$tmpf = new File::Temp( UNLINK => 1 ); $tmpf = new File::Temp( SUFFIX => '.c' , UNLINK => 1 );
$code = '"addvi.b $w0, $w1, 1"'; $code = '"addvi.b $w0, $w1, 1"';
$msa_flags = "-mmsa -mfp64 -msched-weight -mload-store-pairs"; $msa_flags = "-mmsa -mfp64 -msched-weight -mload-store-pairs";
print $tmpf "#include <msa.h>\n\n"; print $tmpf "#include <msa.h>\n\n";
print $tmpf "void main(void){ __asm__ volatile($code); }\n"; print $tmpf "void main(void){ __asm__ volatile($code); }\n";
$args = "$msa_flags -o $tmpf.o -x c $tmpf"; $args = "$msa_flags -o $tmpf.o $tmpf";
my @cmd = ("$compiler_name $args"); my @cmd = ("$compiler_name $args");
system(@cmd) == 0; system(@cmd) == 0;
if ($? != 0) { if ($? != 0) {
@ -229,10 +229,13 @@ if (($architecture eq "x86") || ($architecture eq "x86_64")) {
$no_avx512 = 0; $no_avx512 = 0;
} else { } else {
# $tmpf = new File::Temp( UNLINK => 1 ); # $tmpf = new File::Temp( UNLINK => 1 );
($fh,$tmpf) = tempfile( UNLINK => 1 ); ($fh,$tmpf) = tempfile( SUFFIX => '.c' , UNLINK => 1 );
$code = '"vbroadcastss -4 * 4(%rsi), %zmm2"'; $code = '"vbroadcastss -4 * 4(%rsi), %zmm2"';
print $tmpf "#include <immintrin.h>\n\nint main(void){ __asm__ volatile($code); }\n"; print $tmpf "#include <immintrin.h>\n\nint main(void){ __asm__ volatile($code); }\n";
$args = " -march=skylake-avx512 -c -o $tmpf.o -x c $tmpf"; $args = " -march=skylake-avx512 -c -o $tmpf.o $tmpf";
if ($compiler eq "PGI") {
$args = " -tp skylake -c -o $tmpf.o $tmpf";
}
my @cmd = ("$compiler_name $args >/dev/null 2>/dev/null"); my @cmd = ("$compiler_name $args >/dev/null 2>/dev/null");
system(@cmd) == 0; system(@cmd) == 0;
if ($? != 0) { if ($? != 0) {
@ -318,6 +321,7 @@ $linker_a = "";
&& ($flags !~ /kernel32/) && ($flags !~ /kernel32/)
&& ($flags !~ /advapi32/) && ($flags !~ /advapi32/)
&& ($flags !~ /shell32/) && ($flags !~ /shell32/)
&& ($flags !~ /omp/)
) { ) {
$linker_l .= $flags . " " $linker_l .= $flags . " "
} }

View File

@ -334,6 +334,7 @@ if ($link ne "") {
&& ($flags !~ /kernel32/) && ($flags !~ /kernel32/)
&& ($flags !~ /advapi32/) && ($flags !~ /advapi32/)
&& ($flags !~ /shell32/) && ($flags !~ /shell32/)
&& ($flags !~ /omp/)
&& ($flags !~ /^\-l$/) && ($flags !~ /^\-l$/)
) { ) {
$linker_l .= $flags . " "; $linker_l .= $flags . " ";

View File

@ -31,6 +31,10 @@ OBJS += test_fork.o
endif endif
endif endif
ifeq ($(C_COMPILER), PGI)
OBJS = utest_main2.o
endif
all : run_test all : run_test
$(UTESTBIN): $(OBJS) $(UTESTBIN): $(OBJS)