@@ -464,7 +464,7 @@ AC_PATH_PROGS([LLVM_CONFIG], [llvmtce-config llvm-config], [$llvmDir/bin])
464464llvmConf=$LLVM_CONFIG
465465] ,
466466[ llvmDir=""
467- AC_PATH_PROGS ( [ LLVM_CONFIG] , [ llvmtce-config] )
467+ AC_PATH_PROGS ( [ LLVM_CONFIG] , [ llvmtce-config llvm-config ] )
468468llvmConf=$LLVM_CONFIG
469469]
470470)
@@ -547,6 +547,8 @@ if test x"$LLVM_INCLUDEDIR" == x/usr/include/llvm; then
547547LLVM_INCLUDEDIR=/usr/include
548548fi
549549
550+ ENABLE_RISCV=true
551+
550552case "$LLVM_VERSION" in
551553 21*)
552554 AC_DEFINE ( [ LLVM_21] , [ ] , "Using LLVM 21" )
@@ -555,12 +557,27 @@ case "$LLVM_VERSION" in
555557 LLVM_SHARED_LIB_FILE=$LLVM_LIBDIR/libLLVM-$LLVM_LIBRARYVERSION$LIBRARY_SUFFIX
556558 LLVM_SHARED_LIB=-lLLVMTCE
557559 LLVM_LDFLAGS="$($llvmConf --ldflags) $LLVM_SHARED_LIB"
558- # This patch should be unnecessary in LLVM 21, it seems to have a wide
559- # range of vector datatypes up to 4096.
560- AC_DEFINE ( [ LLVM_HAS_CUSTOM_VECTOR_EXTENSION] , [ 2] , "LLVM has the wide custom vector extension patch ( wide ) " )
561- AC_SUBST ( [ LLVM_HAS_CUSTOM_VECTOR_EXTENSION] , [ "2"] )
562560;;
563-
561+ 22.*)
562+ AC_DEFINE ( [ LLVM_22] , [ ] , "Using LLVM 22 ( git ) " )
563+ LLVM_VERSION=22
564+ LLVM_LIBRARYVERSION=22git
565+ LLVM_SHARED_LIB_FILE=$LLVM_LIBDIR/libLLVM-$LLVM_LIBRARYVERSION$LIBRARY_SUFFIX
566+ LLVM_SHARED_LIB=-lLLVM-22git
567+ LLVM_LDFLAGS="$($llvmConf --ldflags) $LLVM_SHARED_LIB"
568+ # The upstream LLVM doesn't (yet) have the RISC-V customization support.
569+ ENABLE_RISCV=false
570+ ;;
571+ 23.*)
572+ AC_DEFINE ( [ LLVM_23] , [ ] , "Using LLVM 23 ( git ) " )
573+ LLVM_VERSION=23
574+ LLVM_LIBRARYVERSION=23git
575+ LLVM_SHARED_LIB_FILE=$LLVM_LIBDIR/libLLVM-$LLVM_LIBRARYVERSION$LIBRARY_SUFFIX
576+ LLVM_SHARED_LIB=-lLLVM-23git
577+ LLVM_LDFLAGS="$($llvmConf --ldflags) $LLVM_SHARED_LIB"
578+ # The upstream LLVM doesn't (yet) have the RISC-V customization support.
579+ ENABLE_RISCV=false
580+ ;;
564581 *)
565582 AC_MSG_NOTICE (
566583 [
@@ -577,6 +594,15 @@ AC_MSG_NOTICE([
577594] )
578595
579596
597+ AM_CONDITIONAL([ RISCV] , test x$ENABLE_RISCV = xtrue)
598+
599+
600+ # The patch for SIMD is not needed any more in the recent LLVMs.
601+ # TODO: remove this macro.
602+ AC_DEFINE ( [ LLVM_HAS_CUSTOM_VECTOR_EXTENSION] , [ 2] ,
603+ "LLVM has the wide custom vector extension patch ( wide ) " )
604+ AC_SUBST ( [ LLVM_HAS_CUSTOM_VECTOR_EXTENSION] , [ "2"] )
605+
580606if test ! -e $LLVM_SHARED_LIB_FILE;
581607then
582608 # Try the alternative location where llvm.org/apt packages install it.
@@ -1567,6 +1593,9 @@ $srcdir/newlib-1.17.0/configure --prefix=$prefix --target=tcele64-llvm --disable
156715932>&1 | egrep -v "to force reconfigure";
15681594] )
15691595
1596+ if test x$ENABLE_RISCV = xtrue;
1597+ then
1598+
15701599AC_CONFIG_COMMANDS_POST ([
15711600echo "=== Configuring newlib for riscv =====";
15721601# make srcdir absolute
@@ -1587,6 +1616,16 @@ $srcdir/newlib-1.17.0/configure --prefix=$prefix --target=riscv --disable-multil
158716162>&1 | egrep -v "to force reconfigure";
15881617] )
15891618
1619+ rm -f ../testsuite/systemtest_long/bintools/RISCV/tcetest_custom_ops.sh.disabled
1620+ rm -f ../testsuite/systemtest_long/procgen/RISCV/tcetest_stdlib.sh.disabled
1621+
1622+ else
1623+
1624+ touch ../testsuite/systemtest_long/bintools/RISCV/tcetest_custom_ops.sh.disabled
1625+ touch ../testsuite/systemtest_long/procgen/RISCV/tcetest_stdlib.sh.disabled
1626+
1627+ fi
1628+
15901629# Generate config.status and launch it. config.status then
15911630# performs all configuration actions.
15921631AC_OUTPUT
@@ -1646,7 +1685,7 @@ if test x"$LLVM_VERSION" = x
16461685then
16471686 echo "NOTE! Supported LLVM version not found. Compiling C programs is disabled."
16481687else
1649- echo "Found LLVM version $LLVM_VERSION"
1688+ echo "Found LLVM version $LLVM_VERSION".
16501689fi
16511690
16521691
0 commit comments