[Mesa-dev] [PATCH 1/2] radeonsi: Use llvm.amdgcn.mbcnt.* intrinsics instead of llvm.SI.tid

Marek Olšák maraeo at gmail.com
Sat Apr 16 09:41:00 UTC 2016


Since llvm.SI.tid is used in several places, it would be better to add
a helper function that returns tid.

Also Mesa needs to support LLVM 3.6 too.

Marek

On Sat, Apr 16, 2016 at 4:39 AM, Tom Stellard <thomas.stellard at amd.com> wrote:
> We're trying to move to more of the new style intrinsics with include
> the correct target name, and map directly to ISA instructions.
> ---
>  src/gallium/drivers/radeonsi/si_shader.c | 12 ++++++++++--
>  1 file changed, 10 insertions(+), 2 deletions(-)
>
> diff --git a/src/gallium/drivers/radeonsi/si_shader.c b/src/gallium/drivers/radeonsi/si_shader.c
> index c26960b..377ff26 100644
> --- a/src/gallium/drivers/radeonsi/si_shader.c
> +++ b/src/gallium/drivers/radeonsi/si_shader.c
> @@ -4117,14 +4117,22 @@ static void si_llvm_emit_ddxy(
>         LLVMValueRef indices[2];
>         LLVMValueRef store_ptr, load_ptr0, load_ptr1;
>         LLVMValueRef tl, trbl, result[4];
> +       LLVMValueRef tid_args[2];
>         unsigned swizzle[4];
>         unsigned c;
>         int idx;
>         unsigned mask;
>
> +       tid_args[0] = lp_build_const_int32(gallivm, 0xffffffff);
> +       tid_args[1] = bld_base->uint_bld.zero;
> +       tid_args[1] = lp_build_intrinsic(gallivm->builder,
> +                                       "llvm.amdgcn.mbcnt.lo", ctx->i32,
> +                                       tid_args, 2, LLVMReadNoneAttribute);
> +
>         indices[0] = bld_base->uint_bld.zero;
> -       indices[1] = lp_build_intrinsic(gallivm->builder, "llvm.SI.tid", ctx->i32,
> -                                    NULL, 0, LLVMReadNoneAttribute);
> +       indices[1] = lp_build_intrinsic(gallivm->builder,
> +                                       "llvm.amdgcn.mbcnt.hi", ctx->i32,
> +                                       tid_args, 2, LLVMReadNoneAttribute);
>         store_ptr = LLVMBuildGEP(gallivm->builder, ctx->lds,
>                                  indices, 2, "");
>
> --
> 2.1.0
>
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/mesa-dev


More information about the mesa-dev mailing list