Skip to content

Commit a5b32ab

Browse files
authored
Merge pull request #2390 from martin-frbg/pgi
Small corrections for compilation with PGI compilers
2 parents 70199d1 + b3cbd60 commit a5b32ab

3 files changed

Lines changed: 13 additions & 4 deletions

File tree

c_check

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -188,13 +188,13 @@ if (($architecture eq "mips") || ($architecture eq "mips64")) {
188188
if ($@){
189189
warn "could not load PERL module File::Temp, so could not check MSA capatibility";
190190
} else {
191-
$tmpf = new File::Temp( UNLINK => 1 );
191+
$tmpf = new File::Temp( SUFFIX => '.c' , UNLINK => 1 );
192192
$code = '"addvi.b $w0, $w1, 1"';
193193
$msa_flags = "-mmsa -mfp64 -msched-weight -mload-store-pairs";
194194
print $tmpf "#include <msa.h>\n\n";
195195
print $tmpf "void main(void){ __asm__ volatile($code); }\n";
196196

197-
$args = "$msa_flags -o $tmpf.o -x c $tmpf";
197+
$args = "$msa_flags -o $tmpf.o $tmpf";
198198
my @cmd = ("$compiler_name $args");
199199
system(@cmd) == 0;
200200
if ($? != 0) {
@@ -229,10 +229,13 @@ if (($architecture eq "x86") || ($architecture eq "x86_64")) {
229229
$no_avx512 = 0;
230230
} else {
231231
# $tmpf = new File::Temp( UNLINK => 1 );
232-
($fh,$tmpf) = tempfile( UNLINK => 1 );
232+
($fh,$tmpf) = tempfile( SUFFIX => '.c' , UNLINK => 1 );
233233
$code = '"vbroadcastss -4 * 4(%rsi), %zmm2"';
234234
print $tmpf "#include <immintrin.h>\n\nint main(void){ __asm__ volatile($code); }\n";
235-
$args = " -march=skylake-avx512 -c -o $tmpf.o -x c $tmpf";
235+
$args = " -march=skylake-avx512 -c -o $tmpf.o $tmpf";
236+
if ($compiler eq "PGI") {
237+
$args = " -tp skylake -c -o $tmpf.o $tmpf";
238+
}
236239
my @cmd = ("$compiler_name $args >/dev/null 2>/dev/null");
237240
system(@cmd) == 0;
238241
if ($? != 0) {
@@ -318,6 +321,7 @@ $linker_a = "";
318321
&& ($flags !~ /kernel32/)
319322
&& ($flags !~ /advapi32/)
320323
&& ($flags !~ /shell32/)
324+
&& ($flags !~ /omp/)
321325
) {
322326
$linker_l .= $flags . " "
323327
}

f_check

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -334,6 +334,7 @@ if ($link ne "") {
334334
&& ($flags !~ /kernel32/)
335335
&& ($flags !~ /advapi32/)
336336
&& ($flags !~ /shell32/)
337+
&& ($flags !~ /omp/)
337338
&& ($flags !~ /^\-l$/)
338339
) {
339340
$linker_l .= $flags . " ";

utest/Makefile

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,10 @@ OBJS += test_fork.o
3131
endif
3232
endif
3333

34+
ifeq ($(C_COMPILER), PGI)
35+
OBJS = utest_main2.o
36+
endif
37+
3438
all : run_test
3539

3640
$(UTESTBIN): $(OBJS)

0 commit comments

Comments
 (0)