From: Tobias Burnus Date: Sun, 26 Jul 2020 05:20:24 +0000 (+0200) Subject: libgfortran: Skip integer-kind=16 check for amdgcn X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=2e764ae1d666002b136726e6548481013527197d;p=gcc.git libgfortran: Skip integer-kind=16 check for amdgcn libgfortran/ChangeLog: PR target/96306 * configure.ac: Add LIBGOMP_CHECKED_INT_KINDS and LIBGOMP_CHECKED_REAL_KINDS and use it for to skip integer kind=16 checks for amdgcn. * Makefile.am (kinds.h, selected_int_kind.inc, selected_real_kind.inc): Pass them on. * mk-kinds-h.sh: Takes to-be-check kinds as argument. * mk-sik-inc.sh: Likewise. * mk-srk-inc.sh: Likewise. * Makefile.in: Regenerate. * configure: Regenerate. --- diff --git a/libgfortran/Makefile.am b/libgfortran/Makefile.am index 36b204e1aa3..61bf05dd40d 100644 --- a/libgfortran/Makefile.am +++ b/libgfortran/Makefile.am @@ -1054,7 +1054,7 @@ I_M4_DEPS8=$(I_M4_DEPS) m4/ifindloc1.m4 I_M4_DEPS9=$(I_M4_DEPS) m4/ifindloc2.m4 kinds.h: $(srcdir)/mk-kinds-h.sh - $(SHELL) $(srcdir)/mk-kinds-h.sh '$(FCCOMPILE)' > $@ || rm $@ + $(SHELL) $(srcdir)/mk-kinds-h.sh '@LIBGOMP_CHECKED_INT_KINDS@' '@LIBGOMP_CHECKED_REAL_KINDS@' '$(FCCOMPILE)' > $@ || rm $@ kinds.inc: kinds.h grep '^#' < kinds.h > $@ @@ -1063,10 +1063,10 @@ c99_protos.inc: $(srcdir)/c99_protos.h grep '^#' < $(srcdir)/c99_protos.h > $@ selected_int_kind.inc: $(srcdir)/mk-sik-inc.sh - $(SHELL) $(srcdir)/mk-sik-inc.sh '$(FCCOMPILE)' > $@ || rm $@ + $(SHELL) $(srcdir)/mk-sik-inc.sh '@LIBGOMP_CHECKED_INT_KINDS@' '$(FCCOMPILE)' > $@ || rm $@ selected_real_kind.inc: $(srcdir)/mk-srk-inc.sh - $(SHELL) $(srcdir)/mk-srk-inc.sh '$(FCCOMPILE)' > $@ || rm $@ + $(SHELL) $(srcdir)/mk-srk-inc.sh '@LIBGOMP_CHECKED_REAL_KINDS@' '$(FCCOMPILE)' > $@ || rm $@ fpu-target.h: $(srcdir)/$(FPU_HOST_HEADER) cp $(srcdir)/$(FPU_HOST_HEADER) $@ diff --git a/libgfortran/Makefile.in b/libgfortran/Makefile.in index fe063e7ff91..3d043aaa924 100644 --- a/libgfortran/Makefile.in +++ b/libgfortran/Makefile.in @@ -608,6 +608,8 @@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LD = @LD@ LDFLAGS = @LDFLAGS@ +LIBGOMP_CHECKED_INT_KINDS = @LIBGOMP_CHECKED_INT_KINDS@ +LIBGOMP_CHECKED_REAL_KINDS = @LIBGOMP_CHECKED_REAL_KINDS@ LIBOBJS = @LIBOBJS@ LIBQUADINCLUDE = @LIBQUADINCLUDE@ LIBQUADLIB = @LIBQUADLIB@ @@ -7017,7 +7019,7 @@ ieee_arithmetic.mod: ieee_arithmetic.lo @onestep_TRUE@ $(LTCOMPILE) -c -o $@ $^ -combine kinds.h: $(srcdir)/mk-kinds-h.sh - $(SHELL) $(srcdir)/mk-kinds-h.sh '$(FCCOMPILE)' > $@ || rm $@ + $(SHELL) $(srcdir)/mk-kinds-h.sh '@LIBGOMP_CHECKED_INT_KINDS@' '@LIBGOMP_CHECKED_REAL_KINDS@' '$(FCCOMPILE)' > $@ || rm $@ kinds.inc: kinds.h grep '^#' < kinds.h > $@ @@ -7026,10 +7028,10 @@ c99_protos.inc: $(srcdir)/c99_protos.h grep '^#' < $(srcdir)/c99_protos.h > $@ selected_int_kind.inc: $(srcdir)/mk-sik-inc.sh - $(SHELL) $(srcdir)/mk-sik-inc.sh '$(FCCOMPILE)' > $@ || rm $@ + $(SHELL) $(srcdir)/mk-sik-inc.sh '@LIBGOMP_CHECKED_INT_KINDS@' '$(FCCOMPILE)' > $@ || rm $@ selected_real_kind.inc: $(srcdir)/mk-srk-inc.sh - $(SHELL) $(srcdir)/mk-srk-inc.sh '$(FCCOMPILE)' > $@ || rm $@ + $(SHELL) $(srcdir)/mk-srk-inc.sh '@LIBGOMP_CHECKED_REAL_KINDS@' '$(FCCOMPILE)' > $@ || rm $@ fpu-target.h: $(srcdir)/$(FPU_HOST_HEADER) cp $(srcdir)/$(FPU_HOST_HEADER) $@ diff --git a/libgfortran/configure b/libgfortran/configure index 854656960c4..99cca966021 100755 --- a/libgfortran/configure +++ b/libgfortran/configure @@ -679,6 +679,8 @@ LD FGREP SED SECTION_FLAGS +LIBGOMP_CHECKED_REAL_KINDS +LIBGOMP_CHECKED_INT_KINDS LIBGFOR_MINIMAL_FALSE LIBGFOR_MINIMAL_TRUE LIBGFOR_USE_SYMVER_SUN_FALSE @@ -6208,6 +6210,19 @@ else fi +# Some compiler target support may have limited support for integer +# or floating point numbers – or may want to reduce the libgfortran size +# although they do have the support. +LIBGOMP_CHECKED_INT_KINDS="1 2 4 8 16" +LIBGOMP_CHECKED_REAL_KINDS="4 8 10 16" + +if test "x${target_cpu}" = xamdgcn; then + # amdgcn only has limited support for __int128. + LIBGOMP_CHECKED_INT_KINDS="1 2 4 8" +fi + + + # Figure out whether the compiler supports "-ffunction-sections -fdata-sections", # similarly to how libstdc++ does it ac_test_CFLAGS="${CFLAGS+set}" @@ -12724,7 +12739,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF -#line 12727 "configure" +#line 12742 "configure" #include "confdefs.h" #if HAVE_DLFCN_H @@ -12830,7 +12845,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF -#line 12833 "configure" +#line 12848 "configure" #include "confdefs.h" #if HAVE_DLFCN_H diff --git a/libgfortran/configure.ac b/libgfortran/configure.ac index 4109d0fefae..8961e314d82 100644 --- a/libgfortran/configure.ac +++ b/libgfortran/configure.ac @@ -216,6 +216,19 @@ AM_CONDITIONAL(LIBGFOR_USE_SYMVER_SUN, [test "x$gfortran_use_symver" = xsun]) AM_CONDITIONAL(LIBGFOR_MINIMAL, [test "x${target_cpu}" = xnvptx]) +# Some compiler target support may have limited support for integer +# or floating point numbers – or may want to reduce the libgfortran size +# although they do have the support. +LIBGOMP_CHECKED_INT_KINDS="1 2 4 8 16" +LIBGOMP_CHECKED_REAL_KINDS="4 8 10 16" + +if test "x${target_cpu}" = xamdgcn; then + # amdgcn only has limited support for __int128. + LIBGOMP_CHECKED_INT_KINDS="1 2 4 8" +fi +AC_SUBST(LIBGOMP_CHECKED_INT_KINDS) +AC_SUBST(LIBGOMP_CHECKED_REAL_KINDS) + # Figure out whether the compiler supports "-ffunction-sections -fdata-sections", # similarly to how libstdc++ does it ac_test_CFLAGS="${CFLAGS+set}" diff --git a/libgfortran/mk-kinds-h.sh b/libgfortran/mk-kinds-h.sh index 98a95ab54a7..249619061c6 100755 --- a/libgfortran/mk-kinds-h.sh +++ b/libgfortran/mk-kinds-h.sh @@ -2,12 +2,15 @@ LC_ALL=C export LC_ALL -compile="$1" - -# Possible types must be listed in ascending order -possible_integer_kinds="1 2 4 8 16" -possible_real_kinds="4 8 10 16" +if test "$#" -ne 3; then + echo "Usage $0 int_kinds real_kinds compile" + exit 1 +fi +# Possible kinds must be listed in ascending order +possible_integer_kinds="$1" +possible_real_kinds="$2" +compile="$3" largest="" smallest="" @@ -112,7 +115,7 @@ for k in $possible_real_kinds; do done -# After this, we include a header that can override some of the +# After this, we include a header that can override some of the # autodetected settings. echo '#include "kinds-override.h"' diff --git a/libgfortran/mk-sik-inc.sh b/libgfortran/mk-sik-inc.sh index 68c042f68bc..e7f237ec526 100755 --- a/libgfortran/mk-sik-inc.sh +++ b/libgfortran/mk-sik-inc.sh @@ -1,11 +1,18 @@ #!/bin/sh -compile="$1" +if test "$#" -ne 2; then + echo "Usage $0 int_kinds compile" + exit 1 +fi + +# Possible kinds must be listed in ascending order +possible_integer_kinds="$1" +compile="$2" + kinds="" -possible_kinds="1 2 4 8 16" c=0 -for k in $possible_kinds; do +for k in $possible_integer_kinds; do echo " integer (kind=$k) :: x" > tmp$$.f90 echo " x = 1_$k" >> tmp$$.f90 echo " end" >> tmp$$.f90 diff --git a/libgfortran/mk-srk-inc.sh b/libgfortran/mk-srk-inc.sh index 402441ce6f2..d9f2137f89d 100755 --- a/libgfortran/mk-srk-inc.sh +++ b/libgfortran/mk-srk-inc.sh @@ -1,11 +1,18 @@ #!/bin/sh -compile="$1" +if test "$#" -ne 2; then + echo "Usage $0 real_kinds compile" + exit 1 +fi + +# Possible kinds must be listed in ascending order +possible_real_kinds="$1" +compile="$2" + kinds="" -possible_kinds="4 8 10 16" c=0 -for k in $possible_kinds; do +for k in $possible_real_kinds; do echo " real (kind=$k) :: x" > tmp$$.f90 echo " x = 1.0_$k" >> tmp$$.f90 echo " end" >> tmp$$.f90