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

2016-04-16 Thread Marek Olšák
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  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, 0x);
> +   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@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/mesa-dev
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


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

2016-04-15 Thread Tom Stellard
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, 0x);
+   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@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev