ac: use iN_0/1 constants
Tested-by: Dieter Nützel <Dieter@nuetzel-hh.de>
This commit is contained in:
parent
bc09c3d59e
commit
cc36ebbdc3
|
@ -829,11 +829,10 @@ ac_build_gep0(struct ac_llvm_context *ctx,
|
||||||
LLVMValueRef index)
|
LLVMValueRef index)
|
||||||
{
|
{
|
||||||
LLVMValueRef indices[2] = {
|
LLVMValueRef indices[2] = {
|
||||||
LLVMConstInt(ctx->i32, 0, 0),
|
ctx->i32_0,
|
||||||
index,
|
index,
|
||||||
};
|
};
|
||||||
return LLVMBuildGEP(ctx->builder, base_ptr,
|
return LLVMBuildGEP(ctx->builder, base_ptr, indices, 2, "");
|
||||||
indices, 2, "");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -944,7 +943,7 @@ ac_build_buffer_store_dword(struct ac_llvm_context *ctx,
|
||||||
LLVMValueRef args[] = {
|
LLVMValueRef args[] = {
|
||||||
ac_to_float(ctx, vdata),
|
ac_to_float(ctx, vdata),
|
||||||
LLVMBuildBitCast(ctx->builder, rsrc, ctx->v4i32, ""),
|
LLVMBuildBitCast(ctx->builder, rsrc, ctx->v4i32, ""),
|
||||||
LLVMConstInt(ctx->i32, 0, 0),
|
ctx->i32_0,
|
||||||
offset,
|
offset,
|
||||||
LLVMConstInt(ctx->i1, glc, 0),
|
LLVMConstInt(ctx->i1, glc, 0),
|
||||||
LLVMConstInt(ctx->i1, slc, 0),
|
LLVMConstInt(ctx->i1, slc, 0),
|
||||||
|
@ -972,8 +971,8 @@ ac_build_buffer_store_dword(struct ac_llvm_context *ctx,
|
||||||
LLVMValueRef args[] = {
|
LLVMValueRef args[] = {
|
||||||
vdata,
|
vdata,
|
||||||
LLVMBuildBitCast(ctx->builder, rsrc, ctx->v4i32, ""),
|
LLVMBuildBitCast(ctx->builder, rsrc, ctx->v4i32, ""),
|
||||||
LLVMConstInt(ctx->i32, 0, 0),
|
ctx->i32_0,
|
||||||
voffset ? voffset : LLVMConstInt(ctx->i32, 0, 0),
|
voffset ? voffset : ctx->i32_0,
|
||||||
soffset,
|
soffset,
|
||||||
LLVMConstInt(ctx->i32, inst_offset, 0),
|
LLVMConstInt(ctx->i32, inst_offset, 0),
|
||||||
LLVMConstInt(ctx->i32, dfmt[num_channels - 1], 0),
|
LLVMConstInt(ctx->i32, dfmt[num_channels - 1], 0),
|
||||||
|
@ -1005,7 +1004,7 @@ ac_build_buffer_load_common(struct ac_llvm_context *ctx,
|
||||||
{
|
{
|
||||||
LLVMValueRef args[] = {
|
LLVMValueRef args[] = {
|
||||||
LLVMBuildBitCast(ctx->builder, rsrc, ctx->v4i32, ""),
|
LLVMBuildBitCast(ctx->builder, rsrc, ctx->v4i32, ""),
|
||||||
vindex ? vindex : LLVMConstInt(ctx->i32, 0, 0),
|
vindex ? vindex : ctx->i32_0,
|
||||||
voffset,
|
voffset,
|
||||||
LLVMConstInt(ctx->i1, glc, 0),
|
LLVMConstInt(ctx->i1, glc, 0),
|
||||||
LLVMConstInt(ctx->i1, slc, 0)
|
LLVMConstInt(ctx->i1, slc, 0)
|
||||||
|
@ -1100,7 +1099,7 @@ LLVMValueRef ac_build_buffer_load_format_gfx9_safe(struct ac_llvm_context *ctx,
|
||||||
bool can_speculate)
|
bool can_speculate)
|
||||||
{
|
{
|
||||||
LLVMValueRef elem_count = LLVMBuildExtractElement(ctx->builder, rsrc, LLVMConstInt(ctx->i32, 2, 0), "");
|
LLVMValueRef elem_count = LLVMBuildExtractElement(ctx->builder, rsrc, LLVMConstInt(ctx->i32, 2, 0), "");
|
||||||
LLVMValueRef stride = LLVMBuildExtractElement(ctx->builder, rsrc, LLVMConstInt(ctx->i32, 1, 0), "");
|
LLVMValueRef stride = LLVMBuildExtractElement(ctx->builder, rsrc, ctx->i32_1, "");
|
||||||
stride = LLVMBuildLShr(ctx->builder, stride, LLVMConstInt(ctx->i32, 16, 0), "");
|
stride = LLVMBuildLShr(ctx->builder, stride, LLVMConstInt(ctx->i32, 16, 0), "");
|
||||||
|
|
||||||
LLVMValueRef new_elem_count = LLVMBuildSelect(ctx->builder,
|
LLVMValueRef new_elem_count = LLVMBuildSelect(ctx->builder,
|
||||||
|
@ -1167,7 +1166,7 @@ ac_get_thread_id(struct ac_llvm_context *ctx)
|
||||||
|
|
||||||
LLVMValueRef tid_args[2];
|
LLVMValueRef tid_args[2];
|
||||||
tid_args[0] = LLVMConstInt(ctx->i32, 0xffffffff, false);
|
tid_args[0] = LLVMConstInt(ctx->i32, 0xffffffff, false);
|
||||||
tid_args[1] = LLVMConstInt(ctx->i32, 0, false);
|
tid_args[1] = ctx->i32_0;
|
||||||
tid_args[1] = ac_build_intrinsic(ctx,
|
tid_args[1] = ac_build_intrinsic(ctx,
|
||||||
"llvm.amdgcn.mbcnt.lo", ctx->i32,
|
"llvm.amdgcn.mbcnt.lo", ctx->i32,
|
||||||
tid_args, 2, AC_FUNC_ATTR_READNONE);
|
tid_args, 2, AC_FUNC_ATTR_READNONE);
|
||||||
|
@ -1334,7 +1333,7 @@ ac_build_imsb(struct ac_llvm_context *ctx,
|
||||||
LLVMValueRef all_ones = LLVMConstInt(ctx->i32, -1, true);
|
LLVMValueRef all_ones = LLVMConstInt(ctx->i32, -1, true);
|
||||||
LLVMValueRef cond = LLVMBuildOr(ctx->builder,
|
LLVMValueRef cond = LLVMBuildOr(ctx->builder,
|
||||||
LLVMBuildICmp(ctx->builder, LLVMIntEQ,
|
LLVMBuildICmp(ctx->builder, LLVMIntEQ,
|
||||||
arg, LLVMConstInt(ctx->i32, 0, 0), ""),
|
arg, ctx->i32_0, ""),
|
||||||
LLVMBuildICmp(ctx->builder, LLVMIntEQ,
|
LLVMBuildICmp(ctx->builder, LLVMIntEQ,
|
||||||
arg, all_ones, ""), "");
|
arg, all_ones, ""), "");
|
||||||
|
|
||||||
|
@ -2403,7 +2402,7 @@ LLVMValueRef ac_find_lsb(struct ac_llvm_context *ctx,
|
||||||
*
|
*
|
||||||
* The hardware already implements the correct behavior.
|
* The hardware already implements the correct behavior.
|
||||||
*/
|
*/
|
||||||
LLVMConstInt(ctx->i1, 1, false),
|
ctx->i1true,
|
||||||
};
|
};
|
||||||
|
|
||||||
LLVMValueRef lsb = ac_build_intrinsic(ctx, intrin_name, type,
|
LLVMValueRef lsb = ac_build_intrinsic(ctx, intrin_name, type,
|
||||||
|
@ -2657,7 +2656,7 @@ LLVMValueRef ac_trim_vector(struct ac_llvm_context *ctx, LLVMValueRef value,
|
||||||
return value;
|
return value;
|
||||||
|
|
||||||
LLVMValueRef masks[] = {
|
LLVMValueRef masks[] = {
|
||||||
LLVMConstInt(ctx->i32, 0, false), LLVMConstInt(ctx->i32, 1, false),
|
ctx->i32_0, ctx->i32_1,
|
||||||
LLVMConstInt(ctx->i32, 2, false), LLVMConstInt(ctx->i32, 3, false)};
|
LLVMConstInt(ctx->i32, 2, false), LLVMConstInt(ctx->i32, 3, false)};
|
||||||
|
|
||||||
if (count == 1)
|
if (count == 1)
|
||||||
|
|
|
@ -427,7 +427,7 @@ static LLVMValueRef emit_bitfield_extract(struct ac_llvm_context *ctx,
|
||||||
/* FIXME: LLVM 7 returns incorrect result when count is 0.
|
/* FIXME: LLVM 7 returns incorrect result when count is 0.
|
||||||
* https://bugs.freedesktop.org/show_bug.cgi?id=107276
|
* https://bugs.freedesktop.org/show_bug.cgi?id=107276
|
||||||
*/
|
*/
|
||||||
LLVMValueRef zero = LLVMConstInt(ctx->i32, 0, false);
|
LLVMValueRef zero = ctx->i32_0;
|
||||||
LLVMValueRef icond1 = LLVMBuildICmp(ctx->builder, LLVMIntEQ, srcs[2], LLVMConstInt(ctx->i32, 32, false), "");
|
LLVMValueRef icond1 = LLVMBuildICmp(ctx->builder, LLVMIntEQ, srcs[2], LLVMConstInt(ctx->i32, 32, false), "");
|
||||||
LLVMValueRef icond2 = LLVMBuildICmp(ctx->builder, LLVMIntEQ, srcs[2], zero, "");
|
LLVMValueRef icond2 = LLVMBuildICmp(ctx->builder, LLVMIntEQ, srcs[2], zero, "");
|
||||||
|
|
||||||
|
@ -1435,7 +1435,7 @@ static LLVMValueRef extract_vector_range(struct ac_llvm_context *ctx, LLVMValueR
|
||||||
unsigned start, unsigned count)
|
unsigned start, unsigned count)
|
||||||
{
|
{
|
||||||
LLVMValueRef mask[] = {
|
LLVMValueRef mask[] = {
|
||||||
LLVMConstInt(ctx->i32, 0, false), LLVMConstInt(ctx->i32, 1, false),
|
ctx->i32_0, ctx->i32_1,
|
||||||
LLVMConstInt(ctx->i32, 2, false), LLVMConstInt(ctx->i32, 3, false) };
|
LLVMConstInt(ctx->i32, 2, false), LLVMConstInt(ctx->i32, 3, false) };
|
||||||
|
|
||||||
unsigned src_elements = ac_get_llvm_num_components(src);
|
unsigned src_elements = ac_get_llvm_num_components(src);
|
||||||
|
|
|
@ -2609,7 +2609,7 @@ static void si_alpha_test(struct lp_build_tgsi_context *bld_base,
|
||||||
LLVMBuildFCmp(ctx->ac.builder, cond, alpha, alpha_ref, "");
|
LLVMBuildFCmp(ctx->ac.builder, cond, alpha, alpha_ref, "");
|
||||||
ac_build_kill_if_false(&ctx->ac, alpha_pass);
|
ac_build_kill_if_false(&ctx->ac, alpha_pass);
|
||||||
} else {
|
} else {
|
||||||
ac_build_kill_if_false(&ctx->ac, LLVMConstInt(ctx->i1, 0, 0));
|
ac_build_kill_if_false(&ctx->ac, ctx->i1false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -6154,7 +6154,7 @@ static bool si_compile_tgsi_main(struct si_shader_context *ctx)
|
||||||
if (sel->force_correct_derivs_after_kill) {
|
if (sel->force_correct_derivs_after_kill) {
|
||||||
ctx->postponed_kill = ac_build_alloca_undef(&ctx->ac, ctx->i1, "");
|
ctx->postponed_kill = ac_build_alloca_undef(&ctx->ac, ctx->i1, "");
|
||||||
/* true = don't kill. */
|
/* true = don't kill. */
|
||||||
LLVMBuildStore(ctx->ac.builder, LLVMConstInt(ctx->i1, 1, 0),
|
LLVMBuildStore(ctx->ac.builder, ctx->i1true,
|
||||||
ctx->postponed_kill);
|
ctx->postponed_kill);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -71,7 +71,7 @@ static void kil_emit(const struct lp_build_tgsi_action *action,
|
||||||
visible = conds[0];
|
visible = conds[0];
|
||||||
} else {
|
} else {
|
||||||
assert(emit_data->inst->Instruction.Opcode == TGSI_OPCODE_KILL);
|
assert(emit_data->inst->Instruction.Opcode == TGSI_OPCODE_KILL);
|
||||||
visible = LLVMConstInt(ctx->i1, false, 0);
|
visible = ctx->i1false;
|
||||||
}
|
}
|
||||||
|
|
||||||
si_llvm_emit_kill(&ctx->abi, visible);
|
si_llvm_emit_kill(&ctx->abi, visible);
|
||||||
|
|
Loading…
Reference in New Issue