[Mesa-dev] [PATCH 10/24] radeonsi: replace SI.packf16 with amdgcn.cvt.pkrtz

Matt Arsenault arsenm2 at gmail.com
Sun Feb 26 01:18:32 UTC 2017


> On Feb 25, 2017, at 15:58, Marek Olšák <maraeo at gmail.com> wrote:
> 
> }
> +
> +LLVMValueRef ac_emit_cvt_pkrtz_f16(struct ac_llvm_context *ctx,
> +				   LLVMValueRef args[2])
> +{
> +	if (HAVE_LLVM >= 0x0500) {
> +		LLVMTypeRef v2f16 =
> +			LLVMVectorType(LLVMHalfTypeInContext(ctx->context), 2);
> +		LLVMValueRef res =
> +			ac_emit_llvm_intrinsic(ctx, "llvm.amdgcn.cvt.pkrtz",
> +					       v2f16, args, 2,
> +					       AC_FUNC_ATTR_READNONE);
> +		return LLVMBuildBitCast(ctx->builder, res, ctx->i32, "");
> +	}
> +
> +	return ac_emit_llvm_intrinsic(ctx, "llvm.SI.packf16", ctx->i32, args, 2,
> +				      AC_FUNC_ATTR_READNONE |
> +				      AC_FUNC_ATTR_LEGACY);
> +}
> diff --git a/src/amd/common/ac_llvm_build.h b/src/amd/common/ac_llvm_build.h
> index f57acc2..e6bb

I would probably swap where you do the bitcast here, and cast the legacy intrinsic to <2 x half>. With the pkrtz -> exp.compr, pattern you’ll be emitting a cast to i32 and back. While that will be cleaned up, you’re wasting some compile time/memory doing so.

-Matt
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/mesa-dev/attachments/20170225/8777c76b/attachment-0001.html>


More information about the mesa-dev mailing list