mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-05 07:28:11 +02:00
ac/llvm: fix overloading of intrinsic names
Signed-off-by: Rhys Perry <pendingchaos02@gmail.com> Backport-to: 25.1 Reviewed-by: Georg Lehmann <dadschoorse@gmail.com> Reviewed-by: Marek Olšák <maraeo@gmail.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/35489>
This commit is contained in:
parent
ac2e36b377
commit
3c2b3fbd03
2 changed files with 31 additions and 10 deletions
|
|
@ -1591,7 +1591,7 @@ static const char *get_atomic_name(enum ac_atomic_op op)
|
|||
|
||||
LLVMValueRef ac_build_image_opcode(struct ac_llvm_context *ctx, struct ac_image_args *a)
|
||||
{
|
||||
const char *overload[3] = {"", "", ""};
|
||||
const char *overload[5] = {"", "", "", "", ""};
|
||||
unsigned num_overloads = 0;
|
||||
LLVMValueRef args[18];
|
||||
unsigned num_args = 0;
|
||||
|
|
@ -1709,9 +1709,15 @@ LLVMValueRef ac_build_image_opcode(struct ac_llvm_context *ctx, struct ac_image_
|
|||
overload[num_overloads++] = sample ? (a->a16 ? ".f16" : ".f32") : (a->a16 ? ".i16" : ".i32");
|
||||
|
||||
args[num_args++] = a->resource;
|
||||
#if LLVM_VERSION_MAJOR >= 20
|
||||
overload[num_overloads++] = ".v8i32";
|
||||
#endif
|
||||
if (sample) {
|
||||
args[num_args++] = a->sampler;
|
||||
args[num_args++] = LLVMConstInt(ctx->i1, a->unorm, false);
|
||||
#if LLVM_VERSION_MAJOR >= 20
|
||||
overload[num_overloads++] = ".v4i32";
|
||||
#endif
|
||||
}
|
||||
|
||||
args[num_args++] = a->tfe ? ctx->i32_1 : ctx->i32_0; /* texfailctrl */
|
||||
|
|
@ -1798,11 +1804,11 @@ LLVMValueRef ac_build_image_opcode(struct ac_llvm_context *ctx, struct ac_image_
|
|||
snprintf(intr_name, sizeof(intr_name),
|
||||
"llvm.amdgcn.image.%s%s" /* base name */
|
||||
"%s%s%s%s" /* sample/gather modifiers */
|
||||
".%s.%s%s%s%s", /* dimension and type overloads */
|
||||
".%s.%s%s%s%s%s%s", /* dimension and type overloads */
|
||||
name, atomic_subop, a->compare ? ".c" : "",
|
||||
a->bias ? ".b" : lod_suffix ? ".l" : a->derivs[0] ? ".d" : a->level_zero ? ".lz" : "",
|
||||
a->min_lod ? ".cl" : "", a->offset ? ".o" : "", dimname,
|
||||
data_type_str, overload[0], overload[1], overload[2]);
|
||||
data_type_str, overload[0], overload[1], overload[2], overload[3], overload[4]);
|
||||
|
||||
LLVMTypeRef retty;
|
||||
if (a->opcode == ac_image_store || a->opcode == ac_image_store_mip)
|
||||
|
|
@ -2557,8 +2563,13 @@ static LLVMValueRef _ac_build_readlane(struct ac_llvm_context *ctx, LLVMValueRef
|
|||
if (lane)
|
||||
lane = LLVMBuildZExt(ctx->builder, lane, ctx->i32, "");
|
||||
|
||||
#if LLVM_VERSION_MAJOR >= 19
|
||||
const char *intr_name = lane == NULL ? "llvm.amdgcn.readfirstlane.i32" : "llvm.amdgcn.readlane.i32";
|
||||
#else
|
||||
const char *intr_name = lane == NULL ? "llvm.amdgcn.readfirstlane" : "llvm.amdgcn.readlane";
|
||||
#endif
|
||||
result =
|
||||
ac_build_intrinsic(ctx, lane == NULL ? "llvm.amdgcn.readfirstlane" : "llvm.amdgcn.readlane",
|
||||
ac_build_intrinsic(ctx, intr_name,
|
||||
ctx->i32, (LLVMValueRef[]){src, lane}, lane == NULL ? 1 : 2, 0);
|
||||
|
||||
return LLVMBuildTrunc(ctx->builder, result, type, "");
|
||||
|
|
@ -2604,7 +2615,8 @@ LLVMValueRef ac_build_readlane(struct ac_llvm_context *ctx, LLVMValueRef src, LL
|
|||
LLVMValueRef ac_build_writelane(struct ac_llvm_context *ctx, LLVMValueRef src, LLVMValueRef value,
|
||||
LLVMValueRef lane)
|
||||
{
|
||||
return ac_build_intrinsic(ctx, "llvm.amdgcn.writelane", ctx->i32,
|
||||
const char *intr_name = LLVM_VERSION_MAJOR >= 19 ? "llvm.amdgcn.writelane.i32" : "llvm.amdgcn.writelane";
|
||||
return ac_build_intrinsic(ctx, intr_name, ctx->i32,
|
||||
(LLVMValueRef[]){value, lane, src}, 3, 0);
|
||||
}
|
||||
|
||||
|
|
@ -2745,8 +2757,13 @@ static LLVMValueRef _ac_build_permlane16(struct ac_llvm_context *ctx, LLVMValueR
|
|||
bound_ctrl ? ctx->i1true : ctx->i1false,
|
||||
};
|
||||
|
||||
#if LLVM_VERSION_MAJOR >= 19
|
||||
const char *intr_name = exchange_rows ? "llvm.amdgcn.permlanex16.i32" : "llvm.amdgcn.permlane16.i32";
|
||||
#else
|
||||
const char *intr_name = exchange_rows ? "llvm.amdgcn.permlanex16" : "llvm.amdgcn.permlane16";
|
||||
#endif
|
||||
result =
|
||||
ac_build_intrinsic(ctx, exchange_rows ? "llvm.amdgcn.permlanex16" : "llvm.amdgcn.permlane16",
|
||||
ac_build_intrinsic(ctx, intr_name,
|
||||
ctx->i32, args, 6, 0);
|
||||
|
||||
return LLVMBuildTrunc(ctx->builder, result, type, "");
|
||||
|
|
|
|||
|
|
@ -2739,7 +2739,8 @@ static bool visit_intrinsic(struct ac_nir_context *ctx, nir_intrinsic_instr *ins
|
|||
LLVMTypeRef src_type = LLVMIntTypeInContext(ctx->ac.context, ctx->ac.wave_size);
|
||||
src = LLVMBuildTrunc(ctx->ac.builder, src, src_type, "");
|
||||
}
|
||||
result = ac_build_intrinsic(&ctx->ac, "llvm.amdgcn.inverse.ballot", ctx->ac.i1, &src, 1, 0);
|
||||
const char *intr_name = ctx->ac.wave_size == 64 ? "llvm.amdgcn.inverse.ballot.i64" : "llvm.amdgcn.inverse.ballot.i32";
|
||||
result = ac_build_intrinsic(&ctx->ac, intr_name, ctx->ac.i1, &src, 1, 0);
|
||||
break;
|
||||
}
|
||||
case nir_intrinsic_read_invocation:
|
||||
|
|
@ -2947,7 +2948,8 @@ static bool visit_intrinsic(struct ac_nir_context *ctx, nir_intrinsic_instr *ins
|
|||
|
||||
src = LLVMBuildZExt(ctx->ac.builder, src, ctx->ac.i32, "");
|
||||
|
||||
result = ac_build_intrinsic(&ctx->ac, "llvm.amdgcn.readlane", ctx->ac.i32,
|
||||
const char *intr_name = LLVM_VERSION_MAJOR >= 19 ? "llvm.amdgcn.readlane.i32" : "llvm.amdgcn.readlane";
|
||||
result = ac_build_intrinsic(&ctx->ac, intr_name, ctx->ac.i32,
|
||||
(LLVMValueRef[]){src, index_val}, 2, 0);
|
||||
|
||||
result = LLVMBuildTrunc(ctx->ac.builder, result, type, "");
|
||||
|
|
@ -3180,8 +3182,9 @@ static bool visit_intrinsic(struct ac_nir_context *ctx, nir_intrinsic_instr *ins
|
|||
result = LLVMBuildICmp(ctx->ac.builder, LLVMIntEQ, visit_first_invocation(ctx),
|
||||
ac_get_thread_id(&ctx->ac), "");
|
||||
break;
|
||||
case nir_intrinsic_lane_permute_16_amd:
|
||||
result = ac_build_intrinsic(&ctx->ac, "llvm.amdgcn.permlane16", ctx->ac.i32,
|
||||
case nir_intrinsic_lane_permute_16_amd: {
|
||||
const char *intr_name = LLVM_VERSION_MAJOR >= 19 ? "llvm.amdgcn.permlane16.i32" : "llvm.amdgcn.permlane16";
|
||||
result = ac_build_intrinsic(&ctx->ac, intr_name, ctx->ac.i32,
|
||||
(LLVMValueRef[]){get_src(ctx, instr->src[0]),
|
||||
get_src(ctx, instr->src[0]),
|
||||
get_src(ctx, instr->src[1]),
|
||||
|
|
@ -3189,6 +3192,7 @@ static bool visit_intrinsic(struct ac_nir_context *ctx, nir_intrinsic_instr *ins
|
|||
ctx->ac.i1false,
|
||||
ctx->ac.i1false}, 6, 0);
|
||||
break;
|
||||
}
|
||||
case nir_intrinsic_load_scalar_arg_amd:
|
||||
case nir_intrinsic_load_vector_arg_amd: {
|
||||
assert(nir_intrinsic_base(instr) < AC_MAX_ARGS);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue