[PATCH] gcc/configure.ac: fix register issue for global_load assembler functions

Julian Brown julian@codesourcery.com
Wed Jun 16 16:01:35 GMT 2021


At the risk of overstepping my GCN backend review remit...

On Wed, 16 Jun 2021 11:34:53 +0200
Marcel Vollweiler <marcel@codesourcery.com> wrote:

> index d9fc3c2..e179ce1 100644
> --- a/gcc/configure.ac
> +++ b/gcc/configure.ac
> @@ -5357,6 +5357,30 @@ case "$target" in
>      ;;
>  esac
>  
> +# This tests if the assembler supports two registers for global_load
> functions +# (like in LLVM versions <12) or one register (like in
> LLVM 12). +case "$target" in
> +  amdgcn-* | gcn-*)
> +    AC_MSG_CHECKING(assembler fix for global_load functions)
> +    gcc_cv_as_gcn_global_load_fixed=yes
> +    if test x$gcc_cv_as != x; then
> +      cat > conftest.s <<EOF
> +	global_store_dwordx2    v[[1:2]], v[[4:5]], s[[14:15]]
> +EOF
> +      if $gcc_cv_as -triple=amdgcn--amdhsa -filetype=obj
> -mcpu=gfx900 -o conftest.o conftest.s > /dev/null 2>&1; then
> +        gcc_cv_as_gcn_global_load_fixed=no
> +      fi
> +      rm -f conftest.s conftest.o conftest
> +    fi
> +    if test x$gcc_cv_as_gcn_global_load_fixed = xyes; then
> +      AC_DEFINE(HAVE_GCN_ASM_GLOBAL_LOAD_FIXED, 1, [Define if your
> assembler has fixed global_load functions.])
> +    else
> +      AC_DEFINE(HAVE_GCN_ASM_GLOBAL_LOAD_FIXED, 0, [Define if your
> assembler has fixed global_load functions.])
> +    fi
> +    AC_MSG_RESULT($gcc_cv_as_gcn_global_load_fixed)
> +    ;;
> +esac

I think the more-common idiom seems to be just having a single
AC_DEFINE if the feature is present -- like (as a random example)
HAVE_AS_IX86_REP_LOCK_PREFIX, which omits the "define ... 0" case you
have here. (You'd use "#ifdef ..." instead of "#if ... == 1" to check
the feature then, of course).

Then OK with that change (as long as a global maintainer doesn't object
in, say, the next 24 hours?) -- but please watch the mailing list for
configuration problems that might spring up on other targets.

Thanks,

Julian


More information about the Gcc-patches mailing list