You can also set lower_fdiv in nir_shader_compiler_options, and then NIR will do this for you, plus NIR's algebraic optimizations will have the chance to work on the lowered form. Your choice though.
On Sat, Apr 22, 2017 at 3:55 PM, Bas Nieuwenhuizen <[email protected]> wrote: > Moves from accurate divides to rcp and rsq. No new CTS failures. > > Signed-off-by: Bas Nieuwenhuizen <[email protected]> > --- > src/amd/common/ac_nir_to_llvm.c | 4 +++- > 1 file changed, 3 insertions(+), 1 deletion(-) > > diff --git a/src/amd/common/ac_nir_to_llvm.c b/src/amd/common/ac_nir_to_llvm.c > index 514c9e9ca35..081a2c2d26e 100644 > --- a/src/amd/common/ac_nir_to_llvm.c > +++ b/src/amd/common/ac_nir_to_llvm.c > @@ -1588,7 +1588,9 @@ static void visit_alu(struct nir_to_llvm_context *ctx, > nir_alu_instr *instr) > case nir_op_fdiv: > src[0] = to_float(ctx, src[0]); > src[1] = to_float(ctx, src[1]); > - result = ac_build_fdiv(&ctx->ac, src[0], src[1]); > + > + result = ac_build_fdiv(&ctx->ac, ctx->f32one, src[1]); > + result = LLVMBuildFMul(ctx->builder, src[0], result, ""); > break; > case nir_op_frcp: > src[0] = to_float(ctx, src[0]); > -- > 2.12.2 > > _______________________________________________ > mesa-dev mailing list > [email protected] > https://lists.freedesktop.org/mailman/listinfo/mesa-dev _______________________________________________ mesa-dev mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/mesa-dev
