[Mesa-dev] [PATCH 1/2] nir: Replace fcsel with fmov instead of imov in nir_opt_undef

Matt Turner mattst88 at gmail.com
Fri Aug 21 14:36:37 PDT 2015


On Fri, Aug 21, 2015 at 6:42 AM, Boyan Ding <boyan.j.ding at gmail.com> wrote:
> Signed-off-by: Boyan Ding <boyan.j.ding at gmail.com>
> ---
>  src/glsl/nir/nir_opt_undef.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/src/glsl/nir/nir_opt_undef.c b/src/glsl/nir/nir_opt_undef.c
> index 4ab27a8..fb9c6bb 100644
> --- a/src/glsl/nir/nir_opt_undef.c
> +++ b/src/glsl/nir/nir_opt_undef.c
> @@ -63,7 +63,7 @@ opt_undef_alu(nir_alu_instr *instr)
>        memset(&empty_src, 0, sizeof(empty_src));
>        nir_instr_rewrite_src(&instr->instr, &instr->src[1].src, empty_src);
>        nir_instr_rewrite_src(&instr->instr, &instr->src[2].src, empty_src);
> -      instr->op = nir_op_imov;
> +      instr->op = instr->op == nir_op_bcsel ? nir_op_imov : nir_op_fmov;
>
>        return true;
>     }
> --

I don't think this is right (or was a problem). The b in bcsel simply
means that the condition in a boolean, whereas fcsel means that the
condition is a float (i.e., it performs the operation (src0 != 0.0f) ?
src1 : src2). So you cannot determine the types of src1 or src2 from
this.


More information about the mesa-dev mailing list