[Mesa-dev] [PATCH 20/21] i965/fs: Add users of emit_mul_dw

Ben Widawsky ben at bwidawsk.net
Tue Dec 23 11:43:31 PST 2014


On Mon, Dec 22, 2014 at 07:29:30PM -0800, Ben Widawsky wrote:
> I couldn't find any other callers which have a DW operand in a mul.
> 
> Signed-off-by: Ben Widawsky <ben at bwidawsk.net>
> 
> ---
> It would be good if someone else can take a look
> ---
>  src/mesa/drivers/dri/i965/brw_fs_visitor.cpp | 6 ++++--
>  1 file changed, 4 insertions(+), 2 deletions(-)
> 
> diff --git a/src/mesa/drivers/dri/i965/brw_fs_visitor.cpp b/src/mesa/drivers/dri/i965/brw_fs_visitor.cpp
> index 29117d6..67675e5 100644
> --- a/src/mesa/drivers/dri/i965/brw_fs_visitor.cpp
> +++ b/src/mesa/drivers/dri/i965/brw_fs_visitor.cpp
> @@ -275,7 +275,8 @@ fs_visitor::visit(ir_dereference_array *ir)
>  
>        fs_reg index_reg;
>        index_reg = fs_reg(this, glsl_type::int_type);
> -      emit(BRW_OPCODE_MUL, index_reg, this->result, fs_reg(element_size));
> +      assert(element_size <= USHRT_MAX);
> +      emit_mul_dw(index_reg, this->result, fs_reg(element_size), false, true);

This ends up assertion failing later pre-gen7. I need to go figure out why, but
it will take a couple of days. I assume the same is true on the vec4 side.

>  
>        if (src.reladdr) {
>           emit(BRW_OPCODE_ADD, index_reg, *src.reladdr, index_reg);
> @@ -2805,7 +2806,8 @@ fs_visitor::visit_atomic_counter_intrinsic(ir_call *ir)
>        deref_array->array_index->accept(this);
>  
>        fs_reg tmp(this, glsl_type::uint_type);
> -      emit(MUL(tmp, this->result, fs_reg(ATOMIC_COUNTER_SIZE)));
> +      STATIC_ASSERT(ATOMIC_COUNTER_SIZE <= USHRT_MAX);
> +      emit_mul_dw(tmp, this->result, fs_reg(ATOMIC_COUNTER_SIZE), false, true);
>        emit(ADD(offset, tmp, fs_reg(location->data.atomic.offset)));
>     } else {
>        offset = fs_reg(location->data.atomic.offset);
> -- 
> 2.2.1
> 


More information about the mesa-dev mailing list