LLVMValueRef voffset,
LLVMValueRef soffset,
unsigned num_channels,
+ LLVMTypeRef return_channel_type,
bool glc,
bool slc,
bool writeonly_memory,
args[idx++] = voffset ? voffset : ctx->i32_0;
args[idx++] = soffset ? soffset : ctx->i32_0;
args[idx++] = LLVMConstInt(ctx->i32, (glc ? 1 : 0) + (slc ? 2 : 0), 0);
- unsigned func = CLAMP(num_channels, 1, 3) - 1;
-
- const char *type_names[] = {"f32", "v2f32", "v4f32"};
+ unsigned func = num_channels == 3 ? 4 : num_channels;
const char *indexing_kind = structurized ? "struct" : "raw";
- char name[256];
+ char name[256], type_name[8];
+
+ LLVMTypeRef type = func > 1 ? LLVMVectorType(return_channel_type, func) : return_channel_type;
+ ac_build_type_name_for_intr(type, type_name, sizeof(type_name));
if (use_format) {
snprintf(name, sizeof(name), "llvm.amdgcn.%s.buffer.store.format.%s",
- indexing_kind, type_names[func]);
+ indexing_kind, type_name);
} else {
snprintf(name, sizeof(name), "llvm.amdgcn.%s.buffer.store.%s",
- indexing_kind, type_names[func]);
+ indexing_kind, type_name);
}
ac_build_intrinsic(ctx, name, ctx->voidt, args, idx,
if (HAVE_LLVM >= 0x800) {
ac_build_llvm8_buffer_store_common(ctx, rsrc, data, vindex,
voffset, NULL, num_channels,
- glc, false, writeonly_memory,
- true, true);
+ ctx->f32, glc, false,
+ writeonly_memory, true, true);
} else {
ac_build_buffer_store_common(ctx, rsrc, data, vindex, voffset,
num_channels, glc, false,
ctx->i32_0,
voffset, offset,
num_channels,
+ ctx->f32,
glc, slc,
writeonly_memory,
false, false);
LLVMValueRef voffset,
LLVMValueRef soffset,
unsigned num_channels,
+ LLVMTypeRef channel_type,
bool glc,
bool slc,
bool can_speculate,
args[idx++] = voffset ? voffset : ctx->i32_0;
args[idx++] = soffset ? soffset : ctx->i32_0;
args[idx++] = LLVMConstInt(ctx->i32, (glc ? 1 : 0) + (slc ? 2 : 0), 0);
- unsigned func = CLAMP(num_channels, 1, 3) - 1;
-
- LLVMTypeRef types[] = {ctx->f32, ctx->v2f32, ctx->v4f32};
- const char *type_names[] = {"f32", "v2f32", "v4f32"};
+ unsigned func = num_channels == 3 ? 4 : num_channels;
const char *indexing_kind = structurized ? "struct" : "raw";
- char name[256];
+ char name[256], type_name[8];
+
+ LLVMTypeRef type = func > 1 ? LLVMVectorType(channel_type, func) : channel_type;
+ ac_build_type_name_for_intr(type, type_name, sizeof(type_name));
if (use_format) {
snprintf(name, sizeof(name), "llvm.amdgcn.%s.buffer.load.format.%s",
- indexing_kind, type_names[func]);
+ indexing_kind, type_name);
} else {
snprintf(name, sizeof(name), "llvm.amdgcn.%s.buffer.load.%s",
- indexing_kind, type_names[func]);
+ indexing_kind, type_name);
}
- return ac_build_intrinsic(ctx, name, types[func], args,
- idx,
+ return ac_build_intrinsic(ctx, name, type, args, idx,
ac_get_load_intr_attribs(can_speculate));
}
if (HAVE_LLVM >= 0x0800) {
return ac_build_llvm8_buffer_load_common(ctx, rsrc, vindex,
offset, ctx->i32_0,
- num_channels, glc, slc,
+ num_channels, ctx->f32,
+ glc, slc,
can_speculate, false,
false);
}
{
if (HAVE_LLVM >= 0x800) {
return ac_build_llvm8_buffer_load_common(ctx, rsrc, vindex, voffset, ctx->i32_0,
- num_channels, glc, false,
+ num_channels, ctx->f32,
+ glc, false,
can_speculate, true, true);
}
return ac_build_buffer_load_common(ctx, rsrc, vindex, voffset,
{
if (HAVE_LLVM >= 0x800) {
return ac_build_llvm8_buffer_load_common(ctx, rsrc, vindex, voffset, ctx->i32_0,
- num_channels, glc, false,
+ num_channels, ctx->f32,
+ glc, false,
can_speculate, true, true);
}