diff options
author | Marek Olšák <[email protected]> | 2018-08-29 00:15:16 -0400 |
---|---|---|
committer | Marek Olšák <[email protected]> | 2018-09-10 15:19:56 -0400 |
commit | cc36ebbdc36681622ac60fda0c0b86ee438b818d (patch) | |
tree | 8f70a1a0583d37f2989ec879179e32785ab9a346 /src | |
parent | bc09c3d59e52136e975a6bb3e23b3178a8d485ce (diff) |
ac: use iN_0/1 constants
Tested-by: Dieter Nützel <[email protected]>
Diffstat (limited to 'src')
-rw-r--r-- | src/amd/common/ac_llvm_build.c | 23 | ||||
-rw-r--r-- | src/amd/common/ac_nir_to_llvm.c | 4 | ||||
-rw-r--r-- | src/gallium/drivers/radeonsi/si_shader.c | 4 | ||||
-rw-r--r-- | src/gallium/drivers/radeonsi/si_shader_tgsi_alu.c | 2 |
4 files changed, 16 insertions, 17 deletions
diff --git a/src/amd/common/ac_llvm_build.c b/src/amd/common/ac_llvm_build.c index 629cd2a7527..1c8d944db74 100644 --- a/src/amd/common/ac_llvm_build.c +++ b/src/amd/common/ac_llvm_build.c @@ -829,11 +829,10 @@ ac_build_gep0(struct ac_llvm_context *ctx, LLVMValueRef index) { LLVMValueRef indices[2] = { - LLVMConstInt(ctx->i32, 0, 0), + ctx->i32_0, index, }; - return LLVMBuildGEP(ctx->builder, base_ptr, - indices, 2, ""); + return LLVMBuildGEP(ctx->builder, base_ptr, indices, 2, ""); } void @@ -944,7 +943,7 @@ ac_build_buffer_store_dword(struct ac_llvm_context *ctx, LLVMValueRef args[] = { ac_to_float(ctx, vdata), LLVMBuildBitCast(ctx->builder, rsrc, ctx->v4i32, ""), - LLVMConstInt(ctx->i32, 0, 0), + ctx->i32_0, offset, LLVMConstInt(ctx->i1, glc, 0), LLVMConstInt(ctx->i1, slc, 0), @@ -972,8 +971,8 @@ ac_build_buffer_store_dword(struct ac_llvm_context *ctx, LLVMValueRef args[] = { vdata, LLVMBuildBitCast(ctx->builder, rsrc, ctx->v4i32, ""), - LLVMConstInt(ctx->i32, 0, 0), - voffset ? voffset : LLVMConstInt(ctx->i32, 0, 0), + ctx->i32_0, + voffset ? voffset : ctx->i32_0, soffset, LLVMConstInt(ctx->i32, inst_offset, 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[] = { LLVMBuildBitCast(ctx->builder, rsrc, ctx->v4i32, ""), - vindex ? vindex : LLVMConstInt(ctx->i32, 0, 0), + vindex ? vindex : ctx->i32_0, voffset, LLVMConstInt(ctx->i1, glc, 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) { 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), ""); LLVMValueRef new_elem_count = LLVMBuildSelect(ctx->builder, @@ -1167,7 +1166,7 @@ ac_get_thread_id(struct ac_llvm_context *ctx) LLVMValueRef tid_args[2]; 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, "llvm.amdgcn.mbcnt.lo", ctx->i32, 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 cond = LLVMBuildOr(ctx->builder, LLVMBuildICmp(ctx->builder, LLVMIntEQ, - arg, LLVMConstInt(ctx->i32, 0, 0), ""), + arg, ctx->i32_0, ""), LLVMBuildICmp(ctx->builder, LLVMIntEQ, arg, all_ones, ""), ""); @@ -2403,7 +2402,7 @@ LLVMValueRef ac_find_lsb(struct ac_llvm_context *ctx, * * The hardware already implements the correct behavior. */ - LLVMConstInt(ctx->i1, 1, false), + ctx->i1true, }; 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; 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)}; if (count == 1) diff --git a/src/amd/common/ac_nir_to_llvm.c b/src/amd/common/ac_nir_to_llvm.c index 61e79ec9138..192ef079215 100644 --- a/src/amd/common/ac_nir_to_llvm.c +++ b/src/amd/common/ac_nir_to_llvm.c @@ -427,7 +427,7 @@ static LLVMValueRef emit_bitfield_extract(struct ac_llvm_context *ctx, /* FIXME: LLVM 7 returns incorrect result when count is 0. * 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 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) { 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) }; unsigned src_elements = ac_get_llvm_num_components(src); diff --git a/src/gallium/drivers/radeonsi/si_shader.c b/src/gallium/drivers/radeonsi/si_shader.c index 8cadcf2079b..36f58e2ce52 100644 --- a/src/gallium/drivers/radeonsi/si_shader.c +++ b/src/gallium/drivers/radeonsi/si_shader.c @@ -2609,7 +2609,7 @@ static void si_alpha_test(struct lp_build_tgsi_context *bld_base, LLVMBuildFCmp(ctx->ac.builder, cond, alpha, alpha_ref, ""); ac_build_kill_if_false(&ctx->ac, alpha_pass); } 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) { ctx->postponed_kill = ac_build_alloca_undef(&ctx->ac, ctx->i1, ""); /* true = don't kill. */ - LLVMBuildStore(ctx->ac.builder, LLVMConstInt(ctx->i1, 1, 0), + LLVMBuildStore(ctx->ac.builder, ctx->i1true, ctx->postponed_kill); } diff --git a/src/gallium/drivers/radeonsi/si_shader_tgsi_alu.c b/src/gallium/drivers/radeonsi/si_shader_tgsi_alu.c index 028ca8b0dd6..f54d025aec0 100644 --- a/src/gallium/drivers/radeonsi/si_shader_tgsi_alu.c +++ b/src/gallium/drivers/radeonsi/si_shader_tgsi_alu.c @@ -71,7 +71,7 @@ static void kil_emit(const struct lp_build_tgsi_action *action, visible = conds[0]; } else { 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); |