[Mesa-dev] [PATCH] gallivm: Fix build after removal of deprecated attribute API v2

Jan Vesely jan.vesely at rutgers.edu
Mon Nov 7 22:04:13 UTC 2016


On Mon, 2016-11-07 at 21:06 +0000, Tom Stellard wrote:
> v2:
>   Fix adding parameter attributes with LLVM < 4.0.
> ---
>  src/gallium/auxiliary/draw/draw_llvm.c            |  6 +-
>  src/gallium/auxiliary/gallivm/lp_bld_intr.c       | 52 ++++++++++++++++-
>  src/gallium/auxiliary/gallivm/lp_bld_intr.h       | 13 ++++-
>  src/gallium/auxiliary/gallivm/lp_bld_sample_soa.c |  4 +-
>  src/gallium/drivers/radeonsi/si_shader.c          | 69 ++++++++++++-----------
>  src/gallium/drivers/radeonsi/si_shader_tgsi_alu.c | 24 ++++----
>  6 files changed, 116 insertions(+), 52 deletions(-)
> 
> diff --git a/src/gallium/auxiliary/draw/draw_llvm.c b/src/gallium/auxiliary/draw/draw_llvm.c
> index 5b4e2a1..5d87318 100644
> --- a/src/gallium/auxiliary/draw/draw_llvm.c
> +++ b/src/gallium/auxiliary/draw/draw_llvm.c
> @@ -1568,8 +1568,7 @@ draw_llvm_generate(struct draw_llvm *llvm, struct draw_llvm_variant *variant,
>     LLVMSetFunctionCallConv(variant_func, LLVMCCallConv);
>     for (i = 0; i < num_arg_types; ++i)
>        if (LLVMGetTypeKind(arg_types[i]) == LLVMPointerTypeKind)
> -         LLVMAddAttribute(LLVMGetParam(variant_func, i),
> -                          LLVMNoAliasAttribute);
> +         lp_add_function_attr(variant_func, i + 1, "noalias", 7);
>  
>     context_ptr               = LLVMGetParam(variant_func, 0);
>     io_ptr                    = LLVMGetParam(variant_func, 1);
> @@ -2193,8 +2192,7 @@ draw_gs_llvm_generate(struct draw_llvm *llvm,
>  
>     for (i = 0; i < ARRAY_SIZE(arg_types); ++i)
>        if (LLVMGetTypeKind(arg_types[i]) == LLVMPointerTypeKind)
> -         LLVMAddAttribute(LLVMGetParam(variant_func, i),
> -                          LLVMNoAliasAttribute);
> +         lp_add_function_attr(variant_func, i + 1, "noalias", 7);
>  
>     context_ptr               = LLVMGetParam(variant_func, 0);
>     input_array               = LLVMGetParam(variant_func, 1);
> diff --git a/src/gallium/auxiliary/gallivm/lp_bld_intr.c b/src/gallium/auxiliary/gallivm/lp_bld_intr.c
> index f12e735..401e9a2 100644
> --- a/src/gallium/auxiliary/gallivm/lp_bld_intr.c
> +++ b/src/gallium/auxiliary/gallivm/lp_bld_intr.c
> @@ -120,13 +120,57 @@ lp_declare_intrinsic(LLVMModuleRef module,
>  }
>  
>  
> +#if HAVE_LLVM < 0x0400
> +static LLVMAttribute str_to_attr(const char *attr_name, unsigned attr_len)
> +{
> +   if (!strncmp("alwaysinline", attr_name, attr_len)) {
> +      return LLVMAlwaysInlineAttribute;
> +   } else if (!strncmp("byval", attr_name, attr_len)) {
> +      return LLVMByValAttribute;
> +   } else if (!strncmp("inreg", attr_name, attr_len)) {
> +      return LLVMInRegAttribute;
> +   } else if (!strncmp("noalias", attr_name, attr_len)) {
> +      return LLVMNoAlliasAttribute;
> +   } else if (!strncmp("readnone", attr_name, attr_len)) {
> +      return LLVMReadNoneAttribute;
> +   } else if (!strncmp("readonly", attr_name, attr_len)) {
> +      return LLVMReadOnlyAttribute;
> +   } else {
> +      _debug_printf("Unhandled function attribute: %s\n", attr_name);
> +      return 0;
> +   }
> +}
> +#endif
> +
> +void
> +lp_add_function_attr(LLVMValueRef function,
> +                     int attr_idx,
> +                     const char *attr_name,
> +                     unsigned attr_len)

Any reason to pass string length by hand rather than local strlen?

> +{
> +
> +#if HAVE_LLVM < 0x0400
> +   LLVMAttribute attr = str_to_attr(attr_name, attr_len);
> +   if (attr_idx == -1) {
> +      LLVMAddFunctionAttr(function, attr);
> +   } else {
> +      LLVMAddAttribute(LLVMGetParam(function, attr_idx), attr);

I think this needs to be attr_idx - 1. LLVM 4.0 counts parameter
attributes from 1 (0 is the ret value). in the changes below:

-            LLVMAddAttribute(LLVMGetParam(function, i), LLVMNoAliasAttribute);
+
+            lp_add_function_attr(function, i + 1, "noalias", 7);

Jan


> +   }
> +#else
> +   LLVMContextRef context = LLVMGetModuleContext(LLVMGetGlobalParent(function));
> +   unsigned kind_id = LLVMGetEnumAttributeKindForName(attr_name, attr_len);
> +   LLVMAttributeRef attr = LLVMCreateEnumAttribute(context, kind_id, 0);
> +   LLVMAddAttributeAtIndex(function, attr_idx, attr);
> +#endif
> +}
> +
>  LLVMValueRef
>  lp_build_intrinsic(LLVMBuilderRef builder,
>                     const char *name,
>                     LLVMTypeRef ret_type,
>                     LLVMValueRef *args,
>                     unsigned num_args,
> -                   LLVMAttribute attr)
> +                   const char *attr_str)
>  {
>     LLVMModuleRef module = LLVMGetGlobalParent(LLVMGetBasicBlockParent(LLVMGetInsertBlock(builder)));
>     LLVMValueRef function;
> @@ -145,10 +189,14 @@ lp_build_intrinsic(LLVMBuilderRef builder,
>  
>        function = lp_declare_intrinsic(module, name, ret_type, arg_types, num_args);
>  
> +      if (attr_str) {
> +         lp_add_function_attr(function, -1, attr_str, sizeof(attr_str));
> +      }
> +
>        /* NoUnwind indicates that the intrinsic never raises a C++ exception.
>         * Set it for all intrinsics.
>         */
> -      LLVMAddFunctionAttr(function, attr | LLVMNoUnwindAttribute);
> +      lp_add_function_attr(function, -1, "nounwind", 8);
>  
>        if (gallivm_debug & GALLIVM_DEBUG_IR) {
>           lp_debug_dump_value(function);
> diff --git a/src/gallium/auxiliary/gallivm/lp_bld_intr.h b/src/gallium/auxiliary/gallivm/lp_bld_intr.h
> index 7d80ac2..a058de4 100644
> --- a/src/gallium/auxiliary/gallivm/lp_bld_intr.h
> +++ b/src/gallium/auxiliary/gallivm/lp_bld_intr.h
> @@ -60,13 +60,24 @@ lp_declare_intrinsic(LLVMModuleRef module,
>                       LLVMTypeRef *arg_types,
>                       unsigned num_args);
>  
> +void
> +lp_remove_attr(LLVMValueRef value,
> +               const char *attr_name,
> +               unsigned attr_len);
> +
> +void
> +lp_add_function_attr(LLVMValueRef function,
> +                     int attr_idx,
> +                     const char *attr_name,
> +                     unsigned attr_len);
> +
>  LLVMValueRef
>  lp_build_intrinsic(LLVMBuilderRef builder,
>                     const char *name,
>                     LLVMTypeRef ret_type,
>                     LLVMValueRef *args,
>                     unsigned num_args,
> -                   LLVMAttribute attr);
> +                   const char *attr);
>  
>  
>  LLVMValueRef
> diff --git a/src/gallium/auxiliary/gallivm/lp_bld_sample_soa.c b/src/gallium/auxiliary/gallivm/lp_bld_sample_soa.c
> index 1477a72..91e79a2 100644
> --- a/src/gallium/auxiliary/gallivm/lp_bld_sample_soa.c
> +++ b/src/gallium/auxiliary/gallivm/lp_bld_sample_soa.c
> @@ -60,6 +60,7 @@
>  #include "lp_bld_struct.h"
>  #include "lp_bld_quad.h"
>  #include "lp_bld_pack.h"
> +#include "lp_bld_intr.h"
>  
>  
>  /**
> @@ -3316,7 +3317,8 @@ lp_build_sample_soa_func(struct gallivm_state *gallivm,
>  
>        for (i = 0; i < num_param; ++i) {
>           if(LLVMGetTypeKind(arg_types[i]) == LLVMPointerTypeKind) {
> -            LLVMAddAttribute(LLVMGetParam(function, i), LLVMNoAliasAttribute);
> +
> +            lp_add_function_attr(function, i + 1, "noalias", 7);
>           }
>        }
>  
> diff --git a/src/gallium/drivers/radeonsi/si_shader.c b/src/gallium/drivers/radeonsi/si_shader.c
> index b170eb9..ce7b9cc 100644
> --- a/src/gallium/drivers/radeonsi/si_shader.c
> +++ b/src/gallium/drivers/radeonsi/si_shader.c
> @@ -407,7 +407,7 @@ static void declare_input_vs(
>  	args[2] = buffer_index;
>  	input = lp_build_intrinsic(gallivm->builder,
>  		"llvm.SI.vs.load.input", ctx->v4f32, args, 3,
> -		LLVMReadNoneAttribute);
> +		"readnone");
>  
>  	/* Break up the vec4 into individual components */
>  	for (chan = 0; chan < 4; chan++) {
> @@ -841,7 +841,7 @@ static LLVMValueRef build_buffer_load(struct si_shader_context *ctx,
>  		         type_names[func]);
>  
>  		return lp_build_intrinsic(gallivm->builder, name, types[func], args,
> -		                          ARRAY_SIZE(args), LLVMReadOnlyAttribute);
> +		                          ARRAY_SIZE(args), "readonly");
>  	} else {
>  		LLVMValueRef args[] = {
>  			LLVMBuildBitCast(gallivm->builder, rsrc, ctx->v16i8, ""),
> @@ -872,7 +872,7 @@ static LLVMValueRef build_buffer_load(struct si_shader_context *ctx,
>  		         type_names[func], arg_type);
>  
>  		return lp_build_intrinsic(gallivm->builder, name, types[func], args,
> -		                          ARRAY_SIZE(args), LLVMReadOnlyAttribute);
> +		                          ARRAY_SIZE(args), "readonly");
>  	}
>  }
>  
> @@ -1159,14 +1159,14 @@ static LLVMValueRef fetch_input_gs(
>  	value = lp_build_intrinsic(gallivm->builder,
>  				   "llvm.SI.buffer.load.dword.i32.i32",
>  				   ctx->i32, args, 9,
> -				   LLVMReadOnlyAttribute);
> +				   "readonly");
>  	if (tgsi_type_is_64bit(type)) {
>  		LLVMValueRef value2;
>  		args[2] = lp_build_const_int32(gallivm, (param * 4 + swizzle + 1) * 256);
>  		value2 = lp_build_intrinsic(gallivm->builder,
>  					    "llvm.SI.buffer.load.dword.i32.i32",
>  					    ctx->i32, args, 9,
> -					    LLVMReadOnlyAttribute);
> +					    "readonly");
>  		return si_llvm_emit_fetch_64bit(bld_base, type,
>  						value, value2);
>  	}
> @@ -1279,12 +1279,12 @@ static void interp_fs_input(struct si_shader_context *ctx,
>  			args[1] = attr_number;
>  			front = lp_build_intrinsic(gallivm->builder, intr_name,
>  						ctx->f32, args, args[3] ? 4 : 3,
> -						LLVMReadNoneAttribute);
> +						"readnone");
>  
>  			args[1] = back_attr_number;
>  			back = lp_build_intrinsic(gallivm->builder, intr_name,
>  					       ctx->f32, args, args[3] ? 4 : 3,
> -					       LLVMReadNoneAttribute);
> +					       "readnone");
>  
>  			result[chan] = LLVMBuildSelect(gallivm->builder,
>  						is_face_positive,
> @@ -1301,7 +1301,7 @@ static void interp_fs_input(struct si_shader_context *ctx,
>  		args[3] = interp_param;
>  		result[0] = lp_build_intrinsic(gallivm->builder, intr_name,
>  					ctx->f32, args, args[3] ? 4 : 3,
> -					LLVMReadNoneAttribute);
> +					"readnone");
>  		result[1] =
>  		result[2] = lp_build_const_float(gallivm, 0.0f);
>  		result[3] = lp_build_const_float(gallivm, 1.0f);
> @@ -1316,7 +1316,7 @@ static void interp_fs_input(struct si_shader_context *ctx,
>  			args[3] = interp_param;
>  			result[chan] = lp_build_intrinsic(gallivm->builder, intr_name,
>  						ctx->f32, args, args[3] ? 4 : 3,
> -						LLVMReadNoneAttribute);
> +						"readnone");
>  		}
>  	}
>  }
> @@ -1404,18 +1404,18 @@ static LLVMValueRef get_thread_id(struct si_shader_context *ctx)
>  
>  	if (HAVE_LLVM < 0x0308) {
>  		tid = lp_build_intrinsic(gallivm->builder, "llvm.SI.tid",
> -				ctx->i32,   NULL, 0, LLVMReadNoneAttribute);
> +				ctx->i32,   NULL, 0, "readnone");
>  	} else {
>  		LLVMValueRef tid_args[2];
>  		tid_args[0] = lp_build_const_int32(gallivm, 0xffffffff);
>  		tid_args[1] = lp_build_const_int32(gallivm, 0);
>  		tid_args[1] = lp_build_intrinsic(gallivm->builder,
>  					"llvm.amdgcn.mbcnt.lo", ctx->i32,
> -					tid_args, 2, LLVMReadNoneAttribute);
> +					tid_args, 2, "readnone");
>  
>  		tid = lp_build_intrinsic(gallivm->builder,
>  					"llvm.amdgcn.mbcnt.hi", ctx->i32,
> -					tid_args, 2, LLVMReadNoneAttribute);
> +					tid_args, 2, "readnone");
>  	}
>  	set_range_metadata(ctx, tid, 0, 64);
>  	return tid;
> @@ -1432,7 +1432,7 @@ static LLVMValueRef buffer_load_const(struct si_shader_context *ctx,
>  	LLVMValueRef args[2] = {resource, offset};
>  
>  	return lp_build_intrinsic(builder, "llvm.SI.load.const", ctx->f32, args, 2,
> -			       LLVMReadNoneAttribute);
> +			       "readnone");
>  }
>  
>  static LLVMValueRef load_sample_position(struct si_shader_context *radeon_bld, LLVMValueRef sample_id)
> @@ -1670,7 +1670,7 @@ static void declare_system_value(
>  		value = lp_build_intrinsic(gallivm->builder,
>  					   "llvm.amdgcn.ps.live",
>  					   ctx->i1, NULL, 0,
> -					   LLVMReadNoneAttribute);
> +					   "readnone");
>  		value = LLVMBuildNot(gallivm->builder, value, "");
>  		value = LLVMBuildSExt(gallivm->builder, value, ctx->i32, "");
>  		break;
> @@ -1883,7 +1883,7 @@ static void si_llvm_init_export_args(struct lp_build_tgsi_context *bld_base,
>  			packed = lp_build_intrinsic(base->gallivm->builder,
>  						    "llvm.SI.packf16",
>  						    ctx->i32, pack_args, 2,
> -						    LLVMReadNoneAttribute);
> +						    "readnone");
>  			args[chan + 5] =
>  				LLVMBuildBitCast(base->gallivm->builder,
>  						 packed, ctx->f32, "");
> @@ -2028,7 +2028,7 @@ static LLVMValueRef si_scale_alpha_by_sample_mask(struct lp_build_tgsi_context *
>  
>  	coverage = lp_build_intrinsic(gallivm->builder, "llvm.ctpop.i32",
>  				   ctx->i32,
> -				   &coverage, 1, LLVMReadNoneAttribute);
> +				   &coverage, 1, "readnone");
>  
>  	coverage = LLVMBuildUIToFP(gallivm->builder, coverage,
>  				   ctx->f32, "");
> @@ -3469,7 +3469,7 @@ static void load_emit_buffer(struct si_shader_context *ctx,
>  	emit_data->output[emit_data->chan] = lp_build_intrinsic(
>  			builder, intrinsic_name, dst_type,
>  			emit_data->args, emit_data->arg_count,
> -			LLVMReadOnlyAttribute);
> +			"readonly");
>  }
>  
>  static LLVMValueRef get_memory_ptr(struct si_shader_context *ctx,
> @@ -3574,7 +3574,7 @@ static void load_emit(
>  			lp_build_intrinsic(
>  				builder, "llvm.amdgcn.buffer.load.format.v4f32", emit_data->dst_type,
>  				emit_data->args, emit_data->arg_count,
> -				LLVMReadOnlyAttribute);
> +				"readonly");
>  	} else {
>  		get_image_intr_name("llvm.amdgcn.image.load",
>  				emit_data->dst_type,		/* vdata */
> @@ -3586,7 +3586,7 @@ static void load_emit(
>  			lp_build_intrinsic(
>  				builder, intrinsic_name, emit_data->dst_type,
>  				emit_data->args, emit_data->arg_count,
> -				LLVMReadOnlyAttribute);
> +				"readonly");
>  	}
>  }
>  
> @@ -4014,7 +4014,7 @@ static void resq_emit(
>  		out = lp_build_intrinsic(
>  			builder, "llvm.SI.getresinfo.i32", emit_data->dst_type,
>  			emit_data->args, emit_data->arg_count,
> -			LLVMReadNoneAttribute);
> +			"readnone");
>  
>  		/* Divide the number of layers by 6 to get the number of cubes. */
>  		if (inst->Memory.Texture == TGSI_TEXTURE_CUBE_ARRAY) {
> @@ -4248,7 +4248,7 @@ static void txq_emit(const struct lp_build_tgsi_action *action,
>  	emit_data->output[emit_data->chan] = lp_build_intrinsic(
>  		base->gallivm->builder, "llvm.SI.getresinfo.i32",
>  		emit_data->dst_type, emit_data->args, emit_data->arg_count,
> -		LLVMReadNoneAttribute);
> +		"readnone");
>  
>  	/* Divide the number of layers by 6 to get the number of cubes. */
>  	if (target == TGSI_TEXTURE_CUBE_ARRAY ||
> @@ -4666,7 +4666,7 @@ static void si_lower_gather4_integer(struct si_shader_context *ctx,
>  	emit_data->output[emit_data->chan] =
>  		lp_build_intrinsic(builder, intr_name, emit_data->dst_type,
>  				   emit_data->args, emit_data->arg_count,
> -				   LLVMReadNoneAttribute);
> +				   "readnone");
>  }
>  
>  static void build_tex_intrinsic(const struct lp_build_tgsi_action *action,
> @@ -4690,7 +4690,7 @@ static void build_tex_intrinsic(const struct lp_build_tgsi_action *action,
>  			base->gallivm->builder,
>  			"llvm.SI.vs.load.input", emit_data->dst_type,
>  			emit_data->args, emit_data->arg_count,
> -			LLVMReadNoneAttribute);
> +			"readnone");
>  		return;
>  	}
>  
> @@ -4767,7 +4767,7 @@ static void build_tex_intrinsic(const struct lp_build_tgsi_action *action,
>  	emit_data->output[emit_data->chan] = lp_build_intrinsic(
>  		base->gallivm->builder, intr_name, emit_data->dst_type,
>  		emit_data->args, emit_data->arg_count,
> -		LLVMReadNoneAttribute);
> +		"readnone");
>  }
>  
>  static void si_llvm_emit_txqs(
> @@ -4865,13 +4865,13 @@ static void si_llvm_emit_ddxy(
>  		args[1] = val;
>  		tl = lp_build_intrinsic(gallivm->builder,
>  					"llvm.amdgcn.ds.bpermute", ctx->i32,
> -					args, 2, LLVMReadNoneAttribute);
> +					args, 2, "readnone");
>  
>  		args[0] = LLVMBuildMul(gallivm->builder, trbl_tid,
>  				       lp_build_const_int32(gallivm, 4), "");
>  		trbl = lp_build_intrinsic(gallivm->builder,
>  					  "llvm.amdgcn.ds.bpermute", ctx->i32,
> -					  args, 2, LLVMReadNoneAttribute);
> +					  args, 2, "readnone");
>  	} else {
>  		LLVMValueRef store_ptr, load_ptr0, load_ptr1;
>  
> @@ -5054,7 +5054,7 @@ static void build_interp_intrinsic(const struct lp_build_tgsi_action *action,
>  		emit_data->output[chan] =
>  			lp_build_intrinsic(gallivm->builder, intr_name,
>  					   ctx->f32, args, args[3] ? 4 : 3,
> -					   LLVMReadNoneAttribute);
> +					   "readnone");
>  	}
>  }
>  
> @@ -5223,10 +5223,10 @@ static void si_create_function(struct si_shader_context *ctx,
>  		 * SGPR spilling significantly.
>  		 */
>  		if (LLVMGetTypeKind(LLVMTypeOf(P)) == LLVMPointerTypeKind) {
> -			LLVMAddAttribute(P, LLVMByValAttribute);
> +			lp_add_function_attr(ctx->main_fn, i + 1, "byval", 5);
>  			lp_add_attr_dereferenceable(P, UINT64_MAX);
>  		} else
> -			LLVMAddAttribute(P, LLVMInRegAttribute);
> +			lp_add_function_attr(ctx->main_fn, i + 1, "inreg", 5);
>  	}
>  
>  	if (ctx->screen->b.debug_flags & DBG_UNSAFE_MATH) {
> @@ -6177,7 +6177,7 @@ si_generate_gs_copy_shader(struct si_screen *sscreen,
>  						 lp_build_intrinsic(gallivm->builder,
>  								 "llvm.SI.buffer.load.dword.i32.i32",
>  								 ctx.i32, args, 9,
> -								 LLVMReadOnlyAttribute),
> +								 "readonly"),
>  						 ctx.f32, "");
>  		}
>  	}
> @@ -6878,7 +6878,7 @@ static void si_build_wrapper_function(struct si_shader_context *ctx,
>  	unsigned gprs;
>  
>  	for (unsigned i = 0; i < num_parts; ++i) {
> -		LLVMAddFunctionAttr(parts[i], LLVMAlwaysInlineAttribute);
> +		lp_add_function_attr(parts[i], -1, "alwaysinline", 12);
>  		LLVMSetLinkage(parts[i], LLVMPrivateLinkage);
>  	}
>  
> @@ -6989,8 +6989,13 @@ static void si_build_wrapper_function(struct si_shader_context *ctx,
>  			is_sgpr = ac_is_sgpr_param(param);
>  
>  			if (is_sgpr) {
> +#if HAVE_LLVM < 0x0400
>  				LLVMRemoveAttribute(param, LLVMByValAttribute);
> -				LLVMAddAttribute(param, LLVMInRegAttribute);
> +#else
> +				unsigned kind_id = LLVMGetEnumAttributeKindForName("byval", 5);
> +				LLVMRemoveEnumAttributeAtIndex(parts[part], param_idx + 1, kind_id);
> +#endif
> +				lp_add_function_attr(parts[part], param_idx + 1, "inreg", 5);
>  			}
>  
>  			assert(out_idx + param_size <= (is_sgpr ? num_out_sgpr : num_out));
> diff --git a/src/gallium/drivers/radeonsi/si_shader_tgsi_alu.c b/src/gallium/drivers/radeonsi/si_shader_tgsi_alu.c
> index 18e905b..3260a46 100644
> --- a/src/gallium/drivers/radeonsi/si_shader_tgsi_alu.c
> +++ b/src/gallium/drivers/radeonsi/si_shader_tgsi_alu.c
> @@ -399,7 +399,7 @@ static void emit_frac(const struct lp_build_tgsi_action *action,
>  
>  	LLVMValueRef floor = lp_build_intrinsic(builder, intr, emit_data->dst_type,
>  						&emit_data->args[0], 1,
> -						LLVMReadNoneAttribute);
> +						"readnone");
>  	emit_data->output[emit_data->chan] = LLVMBuildFSub(builder,
>  			emit_data->args[0], floor, "");
>  }
> @@ -449,7 +449,7 @@ build_tgsi_intrinsic_nomem(const struct lp_build_tgsi_action *action,
>  	emit_data->output[emit_data->chan] =
>  		lp_build_intrinsic(base->gallivm->builder, action->intr_name,
>  				   emit_data->dst_type, emit_data->args,
> -				   emit_data->arg_count, LLVMReadNoneAttribute);
> +				   emit_data->arg_count, "readnone");
>  }
>  
>  static void emit_bfi(const struct lp_build_tgsi_action *action,
> @@ -507,7 +507,7 @@ static void emit_bfe(const struct lp_build_tgsi_action *action,
>  
>  	bfe_sm5 = lp_build_intrinsic(builder, action->intr_name,
>  				     emit_data->dst_type, emit_data->args,
> -				     emit_data->arg_count, LLVMReadNoneAttribute);
> +				     emit_data->arg_count, "readnone");
>  
>  	/* Correct for GLSL semantics. */
>  	cond = LLVMBuildICmp(builder, LLVMIntUGE, emit_data->args[2],
> @@ -539,7 +539,7 @@ static void emit_lsb(const struct lp_build_tgsi_action *action,
>  	LLVMValueRef lsb =
>  		lp_build_intrinsic(gallivm->builder, "llvm.cttz.i32",
>  				emit_data->dst_type, args, ARRAY_SIZE(args),
> -				LLVMReadNoneAttribute);
> +				"readnone");
>  
>  	/* TODO: We need an intrinsic to skip this conditional. */
>  	/* Check for zero: */
> @@ -566,7 +566,7 @@ static void emit_umsb(const struct lp_build_tgsi_action *action,
>  	LLVMValueRef msb =
>  		lp_build_intrinsic(builder, "llvm.ctlz.i32",
>  				emit_data->dst_type, args, ARRAY_SIZE(args),
> -				LLVMReadNoneAttribute);
> +				"readnone");
>  
>  	/* The HW returns the last bit index from MSB, but TGSI wants
>  	 * the index from LSB. Invert it by doing "31 - msb". */
> @@ -593,7 +593,7 @@ static void emit_imsb(const struct lp_build_tgsi_action *action,
>  	LLVMValueRef msb =
>  		lp_build_intrinsic(builder, "llvm.AMDGPU.flbit.i32",
>  				emit_data->dst_type, &arg, 1,
> -				LLVMReadNoneAttribute);
> +				"readnone");
>  
>  	/* The HW returns the last bit index from MSB, but TGSI wants
>  	 * the index from LSB. Invert it by doing "31 - msb". */
> @@ -917,13 +917,13 @@ static LLVMValueRef build_cube_intrinsic(struct gallivm_state *gallivm,
>  		LLVMValueRef out[4];
>  
>  		out[0] = lp_build_intrinsic(gallivm->builder, "llvm.amdgcn.cubetc",
> -					    f32, in, 3, LLVMReadNoneAttribute);
> +					    f32, in, 3, "readnone");
>  		out[1] = lp_build_intrinsic(gallivm->builder, "llvm.amdgcn.cubesc",
> -					    f32, in, 3, LLVMReadNoneAttribute);
> +					    f32, in, 3, "readnone");
>  		out[2] = lp_build_intrinsic(gallivm->builder, "llvm.amdgcn.cubema",
> -					    f32, in, 3, LLVMReadNoneAttribute);
> +					    f32, in, 3, "readnone");
>  		out[3] = lp_build_intrinsic(gallivm->builder, "llvm.amdgcn.cubeid",
> -					    f32, in, 3, LLVMReadNoneAttribute);
> +					    f32, in, 3, "readnone");
>  
>  		return lp_build_gather_values(gallivm, out, 4);
>  	} else {
> @@ -937,7 +937,7 @@ static LLVMValueRef build_cube_intrinsic(struct gallivm_state *gallivm,
>  
>  		return lp_build_intrinsic(gallivm->builder, "llvm.AMDGPU.cube",
>  					  LLVMTypeOf(vec), &vec, 1,
> -					  LLVMReadNoneAttribute);
> +					  "readnone");
>  	}
>  }
>  
> @@ -959,7 +959,7 @@ static void si_llvm_cube_to_2d_coords(struct lp_build_tgsi_context *bld_base,
>  						    lp_build_const_int32(gallivm, i), "");
>  
>  	coords[2] = lp_build_intrinsic(builder, "llvm.fabs.f32",
> -			type, &coords[2], 1, LLVMReadNoneAttribute);
> +			type, &coords[2], 1, "readnone");
>  	coords[2] = lp_build_emit_llvm_unary(bld_base, TGSI_OPCODE_RCP, coords[2]);
>  
>  	mad_args[1] = coords[2];
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: This is a digitally signed message part
URL: <https://lists.freedesktop.org/archives/mesa-dev/attachments/20161107/e5cd5954/attachment-0001.sig>


More information about the mesa-dev mailing list