[Mesa-dev] [PATCH] glsl: set old ldexp operand to NULL when lowering

Gert Wollny gw.fossdev at gmail.com
Fri Aug 18 05:58:57 UTC 2017


Am Freitag, den 18.08.2017, 09:43 +1000 schrieb Timothy Arceri:
> This fixes an assert during IR validation in LLVMpipe.
> 
> Fixes: e2e2c5abd279 (glsl: calculate number of operands in an
> expression once)
> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=102274
> Cc: Brian Paul <brianp at vmware.com>
> ---
>  src/compiler/glsl/lower_instructions.cpp | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/src/compiler/glsl/lower_instructions.cpp
> b/src/compiler/glsl/lower_instructions.cpp
> index dfce900a16..0c1408911d 100644
> --- a/src/compiler/glsl/lower_instructions.cpp
> +++ b/src/compiler/glsl/lower_instructions.cpp
> @@ -475,20 +475,21 @@
> lower_instructions_visitor::ldexp_to_arith(ir_expression *ir)
>        ir->init_num_operands();
>        ir->operands[0] = bitfield_insert(bitcast_f2i(x),
> resulting_biased_exp,
>                                          exp_shift_clone, exp_width);
>        ir->operands[1] = NULL;
>     } else {
>        ir_constant *sign_mantissa_mask = new(ir)
> ir_constant(0x807fffffu, vec_elem);
>        ir->operation = ir_unop_bitcast_u2f;
>        ir->init_num_operands();
>        ir->operands[0] = bit_or(bit_and(bitcast_f2u(x),
> sign_mantissa_mask),
>                                 lshift(i2u(resulting_biased_exp),
> exp_shift_clone));
> +      ir->operands[1] = NULL;
>     }

Just a cosmetic thing, but since it is now done unconditionally, why
not move  "ir->operands[1] = NULL" out of the conditional branches,
like 

 lower_instructions_visitor::ldexp_to_arith(ir_expression *ir)
        ir->init_num_operands();
        ir->operands[0] =  bitfield_insert(bitcast_f2i(x),
                                           resulting_biased_exp,
                                           exp_shift_clone, exp_width);
-       ir->operands[1] = NULL;
     } else {
        ir_constant *sign_mantissa_mask = new(ir)      
                                  ir_constant(0x807fffffu, vec_elem); 
        ir->operation = ir_unop_bitcast_u2f;
        ir->init_num_operands();
        ir->operands[0] = bit_or(bit_and(bitcast_f2u(x),
                                 sign_mantissa_mask),
                                 lshift(i2u(resulting_biased_exp),
                                 exp_shift_clone));
     }
+    ir->operands[1] = NULL;



>  
>     this->progress = true;
>  }
>  
>  void
>  lower_instructions_visitor::dldexp_to_arith(ir_expression *ir)
>  {
>     /* See ldexp_to_arith for structure. Uses frexp_exp to extract
> the exponent
>      * from the significand.


More information about the mesa-dev mailing list