mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-07 15:48:36 +02:00
ac/nir: support vector types in the type suffix of overloaded intrinsics
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5003>
This commit is contained in:
parent
e5ea87cde8
commit
b98df7bf50
2 changed files with 17 additions and 13 deletions
|
|
@ -2192,8 +2192,10 @@ ac_build_umsb(struct ac_llvm_context *ctx,
|
|||
LLVMValueRef ac_build_fmin(struct ac_llvm_context *ctx, LLVMValueRef a,
|
||||
LLVMValueRef b)
|
||||
{
|
||||
char name[64];
|
||||
snprintf(name, sizeof(name), "llvm.minnum.f%d", ac_get_elem_bits(ctx, LLVMTypeOf(a)));
|
||||
char name[64], type[64];
|
||||
|
||||
ac_build_type_name_for_intr(LLVMTypeOf(a), type, sizeof(type));
|
||||
snprintf(name, sizeof(name), "llvm.minnum.%s", type);
|
||||
LLVMValueRef args[2] = {a, b};
|
||||
return ac_build_intrinsic(ctx, name, LLVMTypeOf(a), args, 2,
|
||||
AC_FUNC_ATTR_READNONE);
|
||||
|
|
@ -2202,8 +2204,10 @@ LLVMValueRef ac_build_fmin(struct ac_llvm_context *ctx, LLVMValueRef a,
|
|||
LLVMValueRef ac_build_fmax(struct ac_llvm_context *ctx, LLVMValueRef a,
|
||||
LLVMValueRef b)
|
||||
{
|
||||
char name[64];
|
||||
snprintf(name, sizeof(name), "llvm.maxnum.f%d", ac_get_elem_bits(ctx, LLVMTypeOf(a)));
|
||||
char name[64], type[64];
|
||||
|
||||
ac_build_type_name_for_intr(LLVMTypeOf(a), type, sizeof(type));
|
||||
snprintf(name, sizeof(name), "llvm.maxnum.%s", type);
|
||||
LLVMValueRef args[2] = {a, b};
|
||||
return ac_build_intrinsic(ctx, name, LLVMTypeOf(a), args, 2,
|
||||
AC_FUNC_ATTR_READNONE);
|
||||
|
|
|
|||
|
|
@ -194,13 +194,13 @@ static LLVMValueRef emit_intrin_1f_param(struct ac_llvm_context *ctx,
|
|||
LLVMTypeRef result_type,
|
||||
LLVMValueRef src0)
|
||||
{
|
||||
char name[64];
|
||||
char name[64], type[64];
|
||||
LLVMValueRef params[] = {
|
||||
ac_to_float(ctx, src0),
|
||||
};
|
||||
|
||||
ASSERTED const int length = snprintf(name, sizeof(name), "%s.f%d", intrin,
|
||||
ac_get_elem_bits(ctx, result_type));
|
||||
ac_build_type_name_for_intr(LLVMTypeOf(params[0]), type, sizeof(type));
|
||||
ASSERTED const int length = snprintf(name, sizeof(name), "%s.%s", intrin, type);
|
||||
assert(length < sizeof(name));
|
||||
return ac_build_intrinsic(ctx, name, result_type, params, 1, AC_FUNC_ATTR_READNONE);
|
||||
}
|
||||
|
|
@ -210,14 +210,14 @@ static LLVMValueRef emit_intrin_2f_param(struct ac_llvm_context *ctx,
|
|||
LLVMTypeRef result_type,
|
||||
LLVMValueRef src0, LLVMValueRef src1)
|
||||
{
|
||||
char name[64];
|
||||
char name[64], type[64];
|
||||
LLVMValueRef params[] = {
|
||||
ac_to_float(ctx, src0),
|
||||
ac_to_float(ctx, src1),
|
||||
};
|
||||
|
||||
ASSERTED const int length = snprintf(name, sizeof(name), "%s.f%d", intrin,
|
||||
ac_get_elem_bits(ctx, result_type));
|
||||
ac_build_type_name_for_intr(LLVMTypeOf(params[0]), type, sizeof(type));
|
||||
ASSERTED const int length = snprintf(name, sizeof(name), "%s.%s", intrin, type);
|
||||
assert(length < sizeof(name));
|
||||
return ac_build_intrinsic(ctx, name, result_type, params, 2, AC_FUNC_ATTR_READNONE);
|
||||
}
|
||||
|
|
@ -227,15 +227,15 @@ static LLVMValueRef emit_intrin_3f_param(struct ac_llvm_context *ctx,
|
|||
LLVMTypeRef result_type,
|
||||
LLVMValueRef src0, LLVMValueRef src1, LLVMValueRef src2)
|
||||
{
|
||||
char name[64];
|
||||
char name[64], type[64];
|
||||
LLVMValueRef params[] = {
|
||||
ac_to_float(ctx, src0),
|
||||
ac_to_float(ctx, src1),
|
||||
ac_to_float(ctx, src2),
|
||||
};
|
||||
|
||||
ASSERTED const int length = snprintf(name, sizeof(name), "%s.f%d", intrin,
|
||||
ac_get_elem_bits(ctx, result_type));
|
||||
ac_build_type_name_for_intr(LLVMTypeOf(params[0]), type, sizeof(type));
|
||||
ASSERTED const int length = snprintf(name, sizeof(name), "%s.%s", intrin, type);
|
||||
assert(length < sizeof(name));
|
||||
return ac_build_intrinsic(ctx, name, result_type, params, 3, AC_FUNC_ATTR_READNONE);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue