ac/llvm,radeonsi: lower idiv in nir
aco does not implement these idiv ops. nir_lower_idiv is for idiv ops <= 32bit and ported from llvm amdgpu, so llvm do the same. nir_lower_divmod64 is for 64bit idiv ops. Reviewed-by: Marek Olšák <marek.olsak@amd.com> Signed-off-by: Qiang Yu <yuq825@gmail.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22573>
This commit is contained in:
@@ -673,21 +673,6 @@ static bool visit_alu(struct ac_nir_context *ctx, const nir_alu_instr *instr)
|
||||
else
|
||||
result = LLVMBuildMul(ctx->ac.builder, src[0], src[1], "");
|
||||
break;
|
||||
case nir_op_imod:
|
||||
result = LLVMBuildSRem(ctx->ac.builder, src[0], src[1], "");
|
||||
break;
|
||||
case nir_op_umod:
|
||||
result = LLVMBuildURem(ctx->ac.builder, src[0], src[1], "");
|
||||
break;
|
||||
case nir_op_irem:
|
||||
result = LLVMBuildSRem(ctx->ac.builder, src[0], src[1], "");
|
||||
break;
|
||||
case nir_op_idiv:
|
||||
result = LLVMBuildSDiv(ctx->ac.builder, src[0], src[1], "");
|
||||
break;
|
||||
case nir_op_udiv:
|
||||
result = LLVMBuildUDiv(ctx->ac.builder, src[0], src[1], "");
|
||||
break;
|
||||
case nir_op_fmul:
|
||||
src[0] = ac_to_float(&ctx->ac, src[0]);
|
||||
src[1] = ac_to_float(&ctx->ac, src[1]);
|
||||
|
||||
@@ -1328,6 +1328,7 @@ void si_init_screen_get_functions(struct si_screen *sscreen)
|
||||
.support_indirect_inputs = BITFIELD_BIT(MESA_SHADER_TESS_CTRL) |
|
||||
BITFIELD_BIT(MESA_SHADER_TESS_EVAL),
|
||||
.support_indirect_outputs = BITFIELD_BIT(MESA_SHADER_TESS_CTRL),
|
||||
.lower_int64_options = nir_lower_divmod64,
|
||||
};
|
||||
sscreen->nir_options = nir_options;
|
||||
}
|
||||
|
||||
@@ -2243,6 +2243,12 @@ struct nir_shader *si_get_nir_shader(struct si_shader *shader,
|
||||
progress2 = true;
|
||||
}
|
||||
|
||||
NIR_PASS(progress2, nir, nir_opt_idiv_const, 8);
|
||||
NIR_PASS(progress2, nir, nir_lower_idiv,
|
||||
&(nir_lower_idiv_options){
|
||||
.allow_fp16 = sel->screen->info.gfx_level >= GFX9,
|
||||
});
|
||||
|
||||
NIR_PASS(progress2, nir, si_nir_lower_abi, shader, args);
|
||||
|
||||
if (progress2 || opt_offsets)
|
||||
|
||||
Reference in New Issue
Block a user