|
232 | 232 | } |
233 | 233 | } |
234 | 234 |
|
| 235 | +$no_lsx = 0; |
| 236 | +$no_lasx = 0; |
| 237 | +if (($architecture eq "loongarch64")) { |
| 238 | + eval "use File::Temp qw(tempfile)"; |
| 239 | + if ($@){ |
| 240 | + warn "could not load PERL module File::Temp, so could not check LSX and LASX capatibility"; |
| 241 | + } else { |
| 242 | + $tmplsx = new File::Temp( SUFFIX => '.c' , UNLINK => 1 ); |
| 243 | + $codelsx = '"vadd.b $vr0, $vr0, $vr0"'; |
| 244 | + $lsx_flags = "-march=loongarch64 -mlsx"; |
| 245 | + print $tmplsx "#include <lsxintrin.h>\n\n"; |
| 246 | + print $tmplsx "void main(void){ __asm__ volatile($codelsx); }\n"; |
| 247 | + |
| 248 | + $args = "$lsx_flags -o $tmplsx.o $tmplsx"; |
| 249 | + my @cmd = ("$compiler_name $flags $args >/dev/null 2>/dev/null"); |
| 250 | + system(@cmd) == 0; |
| 251 | + if ($? != 0) { |
| 252 | + $no_lsx = 1; |
| 253 | + } else { |
| 254 | + $no_lsx = 0; |
| 255 | + } |
| 256 | + unlink("$tmplsx.o"); |
| 257 | + |
| 258 | + $tmplasx = new File::Temp( SUFFIX => '.c' , UNLINK => 1 ); |
| 259 | + $codelasx = '"xvadd.b $xr0, $xr0, $xr0"'; |
| 260 | + $lasx_flags = "-march=loongarch64 -mlasx"; |
| 261 | + print $tmplasx "#include <lasxintrin.h>\n\n"; |
| 262 | + print $tmplasx "void main(void){ __asm__ volatile($codelasx); }\n"; |
| 263 | + |
| 264 | + $args = "$lasx_flags -o $tmplasx.o $tmplasx"; |
| 265 | + my @cmd = ("$compiler_name $flags $args >/dev/null 2>/dev/null"); |
| 266 | + system(@cmd) == 0; |
| 267 | + if ($? != 0) { |
| 268 | + $no_lasx = 1; |
| 269 | + } else { |
| 270 | + $no_lasx = 0; |
| 271 | + } |
| 272 | + unlink("$tmplasx.o"); |
| 273 | + } |
| 274 | +} |
| 275 | + |
235 | 276 | $architecture = x86 if ($data =~ /ARCH_X86/); |
236 | 277 | $architecture = x86_64 if ($data =~ /ARCH_X86_64/); |
237 | 278 | $architecture = e2k if ($data =~ /ARCH_E2K/); |
|
424 | 465 | print MAKEFILE "NO_AVX512=1\n" if $no_avx512 eq 1; |
425 | 466 | print MAKEFILE "NO_AVX2=1\n" if $no_avx2 eq 1; |
426 | 467 | print MAKEFILE "OLDGCC=1\n" if $oldgcc eq 1; |
| 468 | +print MAKEFILE "NO_LSX=1\n" if $no_lsx eq 1; |
| 469 | +print MAKEFILE "NO_LASX=1\n" if $no_lasx eq 1; |
427 | 470 |
|
428 | 471 | $os =~ tr/[a-z]/[A-Z]/; |
429 | 472 | $architecture =~ tr/[a-z]/[A-Z]/; |
|
437 | 480 | print CONFFILE "#define FUNDERSCORE\t$need_fu\n" if $need_fu ne ""; |
438 | 481 | print CONFFILE "#define HAVE_MSA\t1\n" if $have_msa eq 1; |
439 | 482 | print CONFFILE "#define HAVE_C11\t1\n" if $c11_atomics eq 1; |
| 483 | +print CONFFILE "#define NO_LSX\t1\n" if $no_lsx eq 1; |
| 484 | +print CONFFILE "#define NO_LASX\t1\n" if $no_lasx eq 1; |
440 | 485 |
|
441 | 486 |
|
442 | 487 | if ($os eq "LINUX") { |
|
0 commit comments