radeonsi: don't use lp_build_if (in most common places)

This commit is contained in:
Marek Olšák 2019-07-23 20:41:55 -04:00
parent 3406a57ff3
commit 6ec7d603f5
2 changed files with 22 additions and 29 deletions

View file

@ -537,7 +537,6 @@ void gfx10_emit_ngg_epilogue(struct ac_shader_abi *abi,
struct tgsi_shader_info *info = &sel->info;
struct si_shader_output_values outputs[PIPE_MAX_SHADER_OUTPUTS];
LLVMBuilderRef builder = ctx->ac.builder;
struct lp_build_if_state if_state;
LLVMValueRef tmp, tmp2;
assert(!ctx->shader->is_gs_copy_shader);
@ -739,7 +738,7 @@ void gfx10_emit_ngg_epilogue(struct ac_shader_abi *abi,
* TODO: culling depends on the primitive type, so can have some
* interaction here.
*/
lp_build_if(&if_state, &ctx->gallivm, is_gs_thread);
ac_build_ifcc(&ctx->ac, is_gs_thread, 6001);
{
struct ngg_prim prim = {};
@ -766,10 +765,10 @@ void gfx10_emit_ngg_epilogue(struct ac_shader_abi *abi,
build_export_prim(ctx, &prim);
}
lp_build_endif(&if_state);
ac_build_endif(&ctx->ac, 6001);
/* Export per-vertex data (positions and parameters). */
lp_build_if(&if_state, &ctx->gallivm, is_es_thread);
ac_build_ifcc(&ctx->ac, is_es_thread, 6002);
{
unsigned i;
@ -810,7 +809,7 @@ void gfx10_emit_ngg_epilogue(struct ac_shader_abi *abi,
si_llvm_export_vs(ctx, outputs, i);
}
lp_build_endif(&if_state);
ac_build_endif(&ctx->ac, 6002);
}
static LLVMValueRef
@ -902,7 +901,6 @@ void gfx10_ngg_gs_emit_vertex(struct si_shader_context *ctx,
const struct si_shader_selector *sel = ctx->shader->selector;
const struct tgsi_shader_info *info = &sel->info;
LLVMBuilderRef builder = ctx->ac.builder;
struct lp_build_if_state if_state;
LLVMValueRef tmp;
const LLVMValueRef vertexidx =
LLVMBuildLoad(builder, ctx->gs_next_vertex[stream], "");
@ -919,7 +917,7 @@ void gfx10_ngg_gs_emit_vertex(struct si_shader_context *ctx,
tmp = LLVMBuildSelect(builder, can_emit, tmp, vertexidx, "");
LLVMBuildStore(builder, tmp, ctx->gs_next_vertex[stream]);
lp_build_if(&if_state, &ctx->gallivm, can_emit);
ac_build_ifcc(&ctx->ac, can_emit, 9001);
const LLVMValueRef vertexptr =
ngg_gs_emit_vertex_ptr(ctx, get_thread_id_in_tg(ctx), vertexidx);
@ -969,7 +967,7 @@ void gfx10_ngg_gs_emit_vertex(struct si_shader_context *ctx,
tmp = LLVMBuildAdd(builder, tmp, LLVMBuildZExt(builder, iscompleteprim, ctx->ac.i32, ""), "");
LLVMBuildStore(builder, tmp, ctx->gs_generated_prims[stream]);
lp_build_endif(&if_state);
ac_build_endif(&ctx->ac, 9001);
}
void gfx10_ngg_gs_emit_prologue(struct si_shader_context *ctx)

View file

@ -2712,7 +2712,6 @@ static void si_llvm_emit_streamout(struct si_shader_context *ctx,
struct pipe_stream_output_info *so = &sel->so;
LLVMBuilderRef builder = ctx->ac.builder;
int i;
struct lp_build_if_state if_ctx;
/* Get bits [22:16], i.e. (so_param >> 16) & 127; */
LLVMValueRef so_vtx_count =
@ -2727,7 +2726,7 @@ static void si_llvm_emit_streamout(struct si_shader_context *ctx,
/* Emit the streamout code conditionally. This actually avoids
* out-of-bounds buffer access. The hw tells us via the SGPR
* (so_vtx_count) which threads are allowed to emit streamout data. */
lp_build_if(&if_ctx, &ctx->gallivm, can_emit);
ac_build_ifcc(&ctx->ac, can_emit, 6501);
{
/* The buffer offset is computed as follows:
* ByteOffset = streamout_offset[buffer_id]*4 +
@ -2781,7 +2780,7 @@ static void si_llvm_emit_streamout(struct si_shader_context *ctx,
&so->output[i], &outputs[reg]);
}
}
lp_build_endif(&if_ctx);
ac_build_endif(&ctx->ac, 6501);
}
static void si_export_param(struct si_shader_context *ctx, unsigned index,
@ -2876,8 +2875,7 @@ static void si_vertex_color_clamping(struct si_shader_context *ctx,
LLVMValueRef cond = LLVMGetParam(ctx->main_fn, ctx->param_vs_state_bits);
cond = LLVMBuildTrunc(ctx->ac.builder, cond, ctx->i1, "");
struct lp_build_if_state if_ctx;
lp_build_if(&if_ctx, &ctx->gallivm, cond);
ac_build_ifcc(&ctx->ac, cond, 6502);
/* Store clamped colors to alloca variables within the conditional block. */
for (unsigned i = 0; i < noutput; i++) {
@ -2891,7 +2889,7 @@ static void si_vertex_color_clamping(struct si_shader_context *ctx,
addr[i][j]);
}
}
lp_build_endif(&if_ctx);
ac_build_endif(&ctx->ac, 6502);
/* Load clamped colors */
for (unsigned i = 0; i < noutput; i++) {
@ -3118,7 +3116,6 @@ static void si_write_tess_factors(struct lp_build_tgsi_context *bld_base,
LLVMValueRef lds_base, lds_inner, lds_outer, byteoffset, buffer;
LLVMValueRef out[6], vec0, vec1, tf_base, inner[4], outer[4];
unsigned stride, outer_comps, inner_comps, i, offset;
struct lp_build_if_state if_ctx, inner_if_ctx;
/* Add a barrier before loading tess factors from LDS. */
if (!shader->key.part.tcs.epilog.invoc0_tess_factors_are_def)
@ -3130,9 +3127,9 @@ static void si_write_tess_factors(struct lp_build_tgsi_context *bld_base,
* This can't jump, because invocation 0 executes this. It should
* at least mask out the loads and stores for other invocations.
*/
lp_build_if(&if_ctx, &ctx->gallivm,
LLVMBuildICmp(ctx->ac.builder, LLVMIntEQ,
invocation_id, ctx->i32_0, ""));
ac_build_ifcc(&ctx->ac,
LLVMBuildICmp(ctx->ac.builder, LLVMIntEQ,
invocation_id, ctx->i32_0, ""), 6503);
/* Determine the layout of one tess factor element in the buffer. */
switch (shader->key.part.tcs.epilog.prim_mode) {
@ -3217,9 +3214,9 @@ static void si_write_tess_factors(struct lp_build_tgsi_context *bld_base,
byteoffset = LLVMBuildMul(ctx->ac.builder, rel_patch_id,
LLVMConstInt(ctx->i32, 4 * stride, 0), "");
lp_build_if(&inner_if_ctx, &ctx->gallivm,
LLVMBuildICmp(ctx->ac.builder, LLVMIntEQ,
rel_patch_id, ctx->i32_0, ""));
ac_build_ifcc(&ctx->ac,
LLVMBuildICmp(ctx->ac.builder, LLVMIntEQ,
rel_patch_id, ctx->i32_0, ""), 6504);
/* Store the dynamic HS control word. */
offset = 0;
@ -3231,7 +3228,7 @@ static void si_write_tess_factors(struct lp_build_tgsi_context *bld_base,
offset += 4;
}
lp_build_endif(&inner_if_ctx);
ac_build_endif(&ctx->ac, 6504);
/* Store the tessellation factors. */
ac_build_buffer_store_dword(&ctx->ac, buffer, vec0,
@ -3279,7 +3276,7 @@ static void si_write_tess_factors(struct lp_build_tgsi_context *bld_base,
}
}
lp_build_endif(&if_ctx);
ac_build_endif(&ctx->ac, 6503);
}
static LLVMValueRef
@ -4266,7 +4263,6 @@ static void si_llvm_emit_vertex(struct ac_shader_abi *abi,
struct tgsi_shader_info *info = &ctx->shader->selector->info;
struct si_shader *shader = ctx->shader;
struct lp_build_if_state if_state;
LLVMValueRef soffset = LLVMGetParam(ctx->main_fn,
ctx->param_gs2vs_offset);
LLVMValueRef gs_next_vertex;
@ -4295,7 +4291,7 @@ static void si_llvm_emit_vertex(struct ac_shader_abi *abi,
if (use_kill) {
ac_build_kill_if_false(&ctx->ac, can_emit);
} else {
lp_build_if(&if_state, &ctx->gallivm, can_emit);
ac_build_ifcc(&ctx->ac, can_emit, 6505);
}
offset = 0;
@ -4335,7 +4331,7 @@ static void si_llvm_emit_vertex(struct ac_shader_abi *abi,
}
if (!use_kill)
lp_build_endif(&if_state);
ac_build_endif(&ctx->ac, 6505);
}
/* Emit one vertex from the geometry shader */
@ -6654,7 +6650,6 @@ static void si_build_wrapper_function(struct si_shader_context *ctx,
MAYBE_UNUSED unsigned initial_num_out_sgpr; /* used in debug checks */
unsigned num_sgprs, num_vgprs;
unsigned gprs;
struct lp_build_if_state if_state;
si_init_function_info(&fninfo);
@ -6788,7 +6783,7 @@ static void si_build_wrapper_function(struct si_shader_context *ctx,
LLVMConstInt(ctx->i32, 0x7f, 0), "");
ena = LLVMBuildICmp(builder, LLVMIntULT,
ac_get_thread_id(&ctx->ac), count, "");
lp_build_if(&if_state, &ctx->gallivm, ena);
ac_build_ifcc(&ctx->ac, ena, 6506);
}
/* Derive arguments for the next part from outputs of the
@ -6845,7 +6840,7 @@ static void si_build_wrapper_function(struct si_shader_context *ctx,
if (is_multi_part_shader(ctx) &&
part + 1 == next_shader_first_part) {
lp_build_endif(&if_state);
ac_build_endif(&ctx->ac, 6506);
/* The second half of the merged shader should use
* the inputs from the toplevel (wrapper) function,