Automatically downgrade C910V to RISCV64_GENERIC if the compiler lacks vector supporttags/v0.3.21
| @@ -72,7 +72,8 @@ endif | |||||
| getarch : getarch.c cpuid.S dummy $(CPUIDEMU) | getarch : getarch.c cpuid.S dummy $(CPUIDEMU) | ||||
| avx512=$$(perl c_check - - $(CC) $(TARGET_FLAGS) $(CFLAGS) | grep NO_AVX512); \ | avx512=$$(perl c_check - - $(CC) $(TARGET_FLAGS) $(CFLAGS) | grep NO_AVX512); \ | ||||
| $(HOSTCC) $(HOST_CFLAGS) $(EXFLAGS) $${avx512:+-D$${avx512}} -o $(@F) getarch.c cpuid.S $(CPUIDEMU) | |||||
| rv64gv=$$(perl c_check - - $(CC) $(TARGET_FLAGS) $(CFLAGS) | grep NO_RV64GV); \ | |||||
| $(HOSTCC) $(HOST_CFLAGS) $(EXFLAGS) $${avx512:+-D$${avx512}} $${rv64gv:+-D$${rv64gv}} -o $(@F) getarch.c cpuid.S $(CPUIDEMU) | |||||
| getarch_2nd : getarch_2nd.c $(TARGET_CONF) dummy | getarch_2nd : getarch_2nd.c $(TARGET_CONF) dummy | ||||
| ifndef TARGET_CORE | ifndef TARGET_CORE | ||||
| @@ -270,6 +270,29 @@ if (($architecture eq "x86") || ($architecture eq "x86_64")) { | |||||
| } | } | ||||
| } | } | ||||
| $no_rv64gv= 0; | |||||
| if (($architecture eq "riscv64")) { | |||||
| eval "use File::Temp qw(tempfile)"; | |||||
| if ($@){ | |||||
| warn "could not load PERL module File::Temp, so could not check compiler compatibility with the RISCV vector extension"; | |||||
| $no_rv64gv = 0; | |||||
| } else { | |||||
| # $tmpf = new File::Temp( UNLINK => 1 ); | |||||
| ($fh,$tmpf) = tempfile( SUFFIX => '.c' , UNLINK => 1 ); | |||||
| $code = '"vsetvli zero, zero, e8, m1\n"'; | |||||
| print $fh "int main(void){ __asm__ volatile($code); }\n"; | |||||
| $args = " -march=rv64gv -c -o $tmpf.o $tmpf"; | |||||
| my @cmd = ("$compiler_name $flags $args >/dev/null 2>/dev/null"); | |||||
| system(@cmd) == 0; | |||||
| if ($? != 0) { | |||||
| $no_rv64gv = 1; | |||||
| } else { | |||||
| $no_rv64gv = 0; | |||||
| } | |||||
| unlink("$tmpf.o"); | |||||
| } | |||||
| } | |||||
| $c11_atomics = 0; | $c11_atomics = 0; | ||||
| if ($data =~ /HAVE_C11/) { | if ($data =~ /HAVE_C11/) { | ||||
| eval "use File::Temp qw(tempfile)"; | eval "use File::Temp qw(tempfile)"; | ||||
| @@ -392,6 +415,7 @@ print MAKEFILE "CROSS=1\n" if $cross != 0; | |||||
| print MAKEFILE "CEXTRALIB=$linker_L $linker_l $linker_a\n"; | print MAKEFILE "CEXTRALIB=$linker_L $linker_l $linker_a\n"; | ||||
| print MAKEFILE "HAVE_MSA=1\n" if $have_msa eq 1; | print MAKEFILE "HAVE_MSA=1\n" if $have_msa eq 1; | ||||
| print MAKEFILE "MSA_FLAGS=$msa_flags\n" if $have_msa eq 1; | print MAKEFILE "MSA_FLAGS=$msa_flags\n" if $have_msa eq 1; | ||||
| print MAKEFILE "NO_RV64GV=1\n" if $no_rv64gv eq 1; | |||||
| print MAKEFILE "NO_AVX512=1\n" if $no_avx512 eq 1; | print MAKEFILE "NO_AVX512=1\n" if $no_avx512 eq 1; | ||||
| print MAKEFILE "NO_AVX2=1\n" if $no_avx2 eq 1; | print MAKEFILE "NO_AVX2=1\n" if $no_avx2 eq 1; | ||||
| print MAKEFILE "OLDGCC=1\n" if $oldgcc eq 1; | print MAKEFILE "OLDGCC=1\n" if $oldgcc eq 1; | ||||
| @@ -1574,6 +1574,16 @@ USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | |||||
| #ifdef FORCE_C910V | #ifdef FORCE_C910V | ||||
| #define FORCE | #define FORCE | ||||
| #define ARCHITECTURE "RISCV64" | #define ARCHITECTURE "RISCV64" | ||||
| #ifdef NO_RV64GV | |||||
| #define SUBARCHITECTURE "RISCV64_GENERIC" | |||||
| #define SUBDIRNAME "riscv64" | |||||
| #define ARCHCONFIG "-DRISCV64_GENERIC " \ | |||||
| "-DL1_DATA_SIZE=32768 -DL1_DATA_LINESIZE=32 " \ | |||||
| "-DL2_SIZE=1048576 -DL2_LINESIZE=32 " \ | |||||
| "-DDTB_DEFAULT_ENTRIES=128 -DDTB_SIZE=4096 -DL2_ASSOCIATIVE=4 " | |||||
| #define LIBNAME "riscv64_generic" | |||||
| #define CORENAME "RISCV64_GENERIC" | |||||
| #else | |||||
| #define SUBARCHITECTURE "C910V" | #define SUBARCHITECTURE "C910V" | ||||
| #define SUBDIRNAME "riscv64" | #define SUBDIRNAME "riscv64" | ||||
| #define ARCHCONFIG "-DC910V " \ | #define ARCHCONFIG "-DC910V " \ | ||||
| @@ -1582,6 +1592,7 @@ USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | |||||
| "-DDTB_DEFAULT_ENTRIES=128 -DDTB_SIZE=4096 -DL2_ASSOCIATIVE=4 " | "-DDTB_DEFAULT_ENTRIES=128 -DDTB_SIZE=4096 -DL2_ASSOCIATIVE=4 " | ||||
| #define LIBNAME "c910v" | #define LIBNAME "c910v" | ||||
| #define CORENAME "C910V" | #define CORENAME "C910V" | ||||
| #endif | |||||
| #else | #else | ||||
| #endif | #endif | ||||