}
static void
-ac_build_llvm8_buffer_store_common(struct ac_llvm_context *ctx,
- LLVMValueRef rsrc,
- LLVMValueRef data,
- LLVMValueRef vindex,
- LLVMValueRef voffset,
- LLVMValueRef soffset,
- unsigned num_channels,
- LLVMTypeRef return_channel_type,
- unsigned cache_policy,
- bool use_format,
- bool structurized)
+ac_build_buffer_store_common(struct ac_llvm_context *ctx,
+ LLVMValueRef rsrc,
+ LLVMValueRef data,
+ LLVMValueRef vindex,
+ LLVMValueRef voffset,
+ LLVMValueRef soffset,
+ unsigned num_channels,
+ LLVMTypeRef return_channel_type,
+ unsigned cache_policy,
+ bool use_format,
+ bool structurized)
{
LLVMValueRef args[6];
int idx = 0;
unsigned num_channels,
unsigned cache_policy)
{
- ac_build_llvm8_buffer_store_common(ctx, rsrc, data, vindex,
- voffset, NULL, num_channels,
- ctx->f32, cache_policy,
- true, true);
+ ac_build_buffer_store_common(ctx, rsrc, data, vindex,
+ voffset, NULL, num_channels,
+ ctx->f32, cache_policy,
+ true, true);
}
/* TBUFFER_STORE_FORMAT_{X,XY,XYZ,XYZW} <- the suffix is selected by num_channels=1..4.
offset = LLVMBuildAdd(ctx->builder, offset,
LLVMConstInt(ctx->i32, inst_offset, 0), "");
- ac_build_llvm8_buffer_store_common(ctx, rsrc,
- ac_to_float(ctx, vdata),
- ctx->i32_0,
- voffset, offset,
- num_channels,
- ctx->f32,
- cache_policy,
- false, false);
+ ac_build_buffer_store_common(ctx, rsrc, ac_to_float(ctx, vdata),
+ ctx->i32_0, voffset, offset,
+ num_channels, ctx->f32,
+ cache_policy, false, false);
return;
}
}
static LLVMValueRef
-ac_build_llvm8_buffer_load_common(struct ac_llvm_context *ctx,
- LLVMValueRef rsrc,
- LLVMValueRef vindex,
- LLVMValueRef voffset,
- LLVMValueRef soffset,
- unsigned num_channels,
- LLVMTypeRef channel_type,
- unsigned cache_policy,
- bool can_speculate,
- bool use_format,
- bool structurized)
+ac_build_buffer_load_common(struct ac_llvm_context *ctx,
+ LLVMValueRef rsrc,
+ LLVMValueRef vindex,
+ LLVMValueRef voffset,
+ LLVMValueRef soffset,
+ unsigned num_channels,
+ LLVMTypeRef channel_type,
+ unsigned cache_policy,
+ bool can_speculate,
+ bool use_format,
+ bool structurized)
{
LLVMValueRef args[5];
int idx = 0;
return ac_build_gather_values(ctx, result, num_channels);
}
- return ac_build_llvm8_buffer_load_common(ctx, rsrc, vindex,
- offset, ctx->i32_0,
- num_channels, ctx->f32,
- cache_policy,
- can_speculate, false, false);
+ return ac_build_buffer_load_common(ctx, rsrc, vindex,
+ offset, ctx->i32_0,
+ num_channels, ctx->f32,
+ cache_policy,
+ can_speculate, false, false);
}
LLVMValueRef ac_build_buffer_load_format(struct ac_llvm_context *ctx,
unsigned cache_policy,
bool can_speculate)
{
- return ac_build_llvm8_buffer_load_common(ctx, rsrc, vindex, voffset, ctx->i32_0,
- num_channels, ctx->f32,
- cache_policy, can_speculate, true, true);
+ return ac_build_buffer_load_common(ctx, rsrc, vindex, voffset,
+ ctx->i32_0, num_channels, ctx->f32,
+ cache_policy, can_speculate,
+ true, true);
}
/// Translate a (dfmt, nfmt) pair into a chip-appropriate combined format
}
static LLVMValueRef
-ac_build_llvm8_tbuffer_load(struct ac_llvm_context *ctx,
+ac_build_tbuffer_load(struct ac_llvm_context *ctx,
LLVMValueRef rsrc,
LLVMValueRef vindex,
LLVMValueRef voffset,
LLVMValueRef soffset,
+ LLVMValueRef immoffset,
unsigned num_channels,
unsigned dfmt,
unsigned nfmt,
bool can_speculate,
bool structurized)
{
+ voffset = LLVMBuildAdd(ctx->builder, voffset, immoffset, "");
+
LLVMValueRef args[6];
int idx = 0;
args[idx++] = LLVMBuildBitCast(ctx->builder, rsrc, ctx->v4i32, "");
ac_get_load_intr_attribs(can_speculate));
}
-static LLVMValueRef
-ac_build_tbuffer_load(struct ac_llvm_context *ctx,
- LLVMValueRef rsrc,
- LLVMValueRef vindex,
- LLVMValueRef voffset,
- LLVMValueRef soffset,
- LLVMValueRef immoffset,
- unsigned num_channels,
- unsigned dfmt,
- unsigned nfmt,
- unsigned cache_policy,
- bool can_speculate,
- bool structurized) /* only matters for LLVM 8+ */
-{
- voffset = LLVMBuildAdd(ctx->builder, voffset, immoffset, "");
-
- return ac_build_llvm8_tbuffer_load(ctx, rsrc, vindex, voffset,
- soffset, num_channels,
- dfmt, nfmt, cache_policy,
- can_speculate, structurized);
-}
-
LLVMValueRef
ac_build_struct_tbuffer_load(struct ac_llvm_context *ctx,
LLVMValueRef rsrc,
voffset = LLVMBuildAdd(ctx->builder, voffset, immoffset, "");
/* LLVM 9+ supports i8/i16 with struct/raw intrinsics. */
- res = ac_build_llvm8_buffer_load_common(ctx, rsrc, NULL,
- voffset, soffset,
- 1, ctx->i16, cache_policy,
- false, false, false);
+ res = ac_build_buffer_load_common(ctx, rsrc, NULL,
+ voffset, soffset,
+ 1, ctx->i16, cache_policy,
+ false, false, false);
} else {
unsigned dfmt = V_008F0C_BUF_DATA_FORMAT_16;
unsigned nfmt = V_008F0C_BUF_NUM_FORMAT_UINT;
voffset = LLVMBuildAdd(ctx->builder, voffset, immoffset, "");
/* LLVM 9+ supports i8/i16 with struct/raw intrinsics. */
- res = ac_build_llvm8_buffer_load_common(ctx, rsrc, NULL,
- voffset, soffset,
- 1, ctx->i8, cache_policy,
- false, false, false);
+ res = ac_build_buffer_load_common(ctx, rsrc, NULL,
+ voffset, soffset,
+ 1, ctx->i8, cache_policy,
+ false, false, false);
} else {
unsigned dfmt = V_008F0C_BUF_DATA_FORMAT_8;
unsigned nfmt = V_008F0C_BUF_NUM_FORMAT_UINT;
LLVMTypeRef channel_type = load_log_size == 0 ? ctx->i8 :
load_log_size == 1 ? ctx->i16 : ctx->i32;
unsigned num_channels = 1 << (MAX2(load_log_size, 2) - 2);
- loads[i] = ac_build_llvm8_buffer_load_common(
+ loads[i] = ac_build_buffer_load_common(
ctx, rsrc, vindex, voffset, tmp,
num_channels, channel_type, cache_policy,
can_speculate, false, true);
}
static void
-ac_build_llvm8_tbuffer_store(struct ac_llvm_context *ctx,
- LLVMValueRef rsrc,
- LLVMValueRef vdata,
- LLVMValueRef vindex,
- LLVMValueRef voffset,
- LLVMValueRef soffset,
- unsigned num_channels,
- unsigned dfmt,
- unsigned nfmt,
- unsigned cache_policy,
- bool structurized)
+ac_build_tbuffer_store(struct ac_llvm_context *ctx,
+ LLVMValueRef rsrc,
+ LLVMValueRef vdata,
+ LLVMValueRef vindex,
+ LLVMValueRef voffset,
+ LLVMValueRef soffset,
+ LLVMValueRef immoffset,
+ unsigned num_channels,
+ unsigned dfmt,
+ unsigned nfmt,
+ unsigned cache_policy,
+ bool structurized)
{
+ voffset = LLVMBuildAdd(ctx->builder, voffset ? voffset : ctx->i32_0,
+ immoffset, "");
+
LLVMValueRef args[7];
int idx = 0;
args[idx++] = vdata;
AC_FUNC_ATTR_INACCESSIBLE_MEM_ONLY);
}
-static void
-ac_build_tbuffer_store(struct ac_llvm_context *ctx,
- LLVMValueRef rsrc,
- LLVMValueRef vdata,
- LLVMValueRef vindex,
- LLVMValueRef voffset,
- LLVMValueRef soffset,
- LLVMValueRef immoffset,
- unsigned num_channels,
- unsigned dfmt,
- unsigned nfmt,
- unsigned cache_policy,
- bool structurized) /* only matters for LLVM 8+ */
-{
- voffset = LLVMBuildAdd(ctx->builder, voffset ? voffset : ctx->i32_0,
- immoffset, "");
-
- ac_build_llvm8_tbuffer_store(ctx, rsrc, vdata, vindex, voffset,
- soffset, num_channels, dfmt, nfmt,
- cache_policy, structurized);
-}
-
void
ac_build_struct_tbuffer_store(struct ac_llvm_context *ctx,
LLVMValueRef rsrc,
if (HAVE_LLVM >= 0x900) {
/* LLVM 9+ supports i8/i16 with struct/raw intrinsics. */
- ac_build_llvm8_buffer_store_common(ctx, rsrc, vdata, NULL,
- voffset, soffset, 1,
- ctx->i16, cache_policy,
- false, false);
+ ac_build_buffer_store_common(ctx, rsrc, vdata, NULL,
+ voffset, soffset, 1,
+ ctx->i16, cache_policy,
+ false, false);
} else {
unsigned dfmt = V_008F0C_BUF_DATA_FORMAT_16;
unsigned nfmt = V_008F0C_BUF_NUM_FORMAT_UINT;
if (HAVE_LLVM >= 0x900) {
/* LLVM 9+ supports i8/i16 with struct/raw intrinsics. */
- ac_build_llvm8_buffer_store_common(ctx, rsrc, vdata, NULL,
- voffset, soffset, 1,
- ctx->i8, cache_policy,
- false, false);
+ ac_build_buffer_store_common(ctx, rsrc, vdata, NULL,
+ voffset, soffset, 1,
+ ctx->i8, cache_policy,
+ false, false);
} else {
unsigned dfmt = V_008F0C_BUF_DATA_FORMAT_8;
unsigned nfmt = V_008F0C_BUF_NUM_FORMAT_UINT;