The old function treats high values as negative, which LLVM interprets as 0.
void
ac_llvm_add_target_dep_function_attr(LLVMValueRef F,
- const char *name, int value)
+ const char *name, unsigned value)
{
char str[16];
- snprintf(str, sizeof(str), "%i", value);
+ snprintf(str, sizeof(str), "0x%x", value);
LLVMAddTargetDependentFunctionAttr(F, name, str);
}
void
ac_llvm_add_target_dep_function_attr(LLVMValueRef F,
- const char *name, int value);
+ const char *name, unsigned value);
static inline unsigned
ac_get_load_intr_attribs(bool can_speculate)
*fninfo->assign[i] = LLVMGetParam(ctx->main_fn, i);
}
- si_llvm_add_attribute(ctx->main_fn, "amdgpu-32bit-address-high-bits",
- ctx->screen->info.address32_hi);
+ if (ctx->screen->info.address32_hi) {
+ ac_llvm_add_target_dep_function_attr(ctx->main_fn,
+ "amdgpu-32bit-address-high-bits",
+ ctx->screen->info.address32_hi);
+ }
if (max_workgroup_size) {
si_llvm_add_attribute(ctx->main_fn, "amdgpu-max-work-group-size",