[Mesa-dev] [PATCH] radeon/llvm: improve select_cc lowering to generate CND* more often
Tom Stellard
tom at stellard.net
Wed Sep 26 12:15:37 PDT 2012
> > diff --git a/src/gallium/drivers/radeon/radeon_setup_tgsi_llvm.c b/src/gallium/drivers/radeon/radeon_setup_tgsi_llvm.c
> > index 04469e2..bb37154 100644
> > --- a/src/gallium/drivers/radeon/radeon_setup_tgsi_llvm.c
> > +++ b/src/gallium/drivers/radeon/radeon_setup_tgsi_llvm.c
> > @@ -934,6 +934,20 @@ static void emit_u2f(
> > emit_data->args[0], bld_base->base.elem_type, "");
> > }
> >
> > +static void emit_cndlt(
> > + const struct lp_build_tgsi_action * action,
> > + struct lp_build_tgsi_context * bld_base,
> > + struct lp_build_emit_data * emit_data)
> > +{
> > + LLVMBuilderRef builder = bld_base->base.gallivm->builder;
> > + LLVMValueRef float_zero = lp_build_const_float(
> > + bld_base->base.gallivm, 0.0f);
> > + LLVMValueRef cmp = LLVMBuildFCmp(
> > + builder, LLVMRealULT, emit_data->args[0], float_zero, "");
> > + emit_data->output[emit_data->chan] = LLVMBuildSelect(builder,
> > + cmp, emit_data->args[1], emit_data->args[2], "");
> > +}
> > +
> > static void emit_immediate(struct lp_build_tgsi_context * bld_base,
> > const struct tgsi_full_immediate *imm)
> > {
> > @@ -1115,8 +1129,7 @@ void radeon_llvm_context_init(struct radeon_llvm_context * ctx)
> > bld_base->op_actions[TGSI_OPCODE_CONT].emit = cont_emit;
> > bld_base->op_actions[TGSI_OPCODE_CLAMP].emit = build_tgsi_intrinsic_nomem;
> > bld_base->op_actions[TGSI_OPCODE_CLAMP].intr_name = "llvm.AMDIL.clamp.";
> > - bld_base->op_actions[TGSI_OPCODE_CMP].emit = build_tgsi_intrinsic_nomem;
> > - bld_base->op_actions[TGSI_OPCODE_CMP].intr_name = "llvm.AMDGPU.cndlt";
> > + bld_base->op_actions[TGSI_OPCODE_CMP].emit = emit_cndlt;
> > bld_base->op_actions[TGSI_OPCODE_COS].emit = build_tgsi_intrinsic_nomem;
> > bld_base->op_actions[TGSI_OPCODE_COS].intr_name = "llvm.AMDGPU.cos";
> > bld_base->op_actions[TGSI_OPCODE_DIV].emit = build_tgsi_intrinsic_nomem;
>
> It would be nice if you could also remove the llvm.AMDGPU.cndlt
> intrinsic and also delete the SI pseudo instruction that uses it. I can
> test on SI for you.
>
Unfortunately, removing this intrinsic from SI uncovers a bug that may
be difficult to solve, so for now just leave the intrinsic, so SI can
use it.
-Tom
>
> > --
> > 1.7.11.4
> >
> > _______________________________________________
> > mesa-dev mailing list
> > mesa-dev at lists.freedesktop.org
> > http://lists.freedesktop.org/mailman/listinfo/mesa-dev
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/mesa-dev
More information about the mesa-dev
mailing list