i965/fs: retype offset_reg to UD at load_ssbo
authorJose Maria Casanova Crespo <jmcasanova@igalia.com>
Mon, 19 Mar 2018 14:03:17 +0000 (15:03 +0100)
committerJose Maria Casanova Crespo <jmcasanova@igalia.com>
Fri, 20 Apr 2018 11:30:12 +0000 (13:30 +0200)
All operations with offset_reg at do_vector_read are done
with UD type. So copy propagation was not working through
the generated MOVs:

mov(8) vgrf9:UD, vgrf7:D

This change allows removing the MOV generated for reading the
first components for 16-bit and 64-bit ssbo reads with
non-constant offsets.

Reviewed-by: Iago Toral Quiroga <itoral@igalia.com>
src/intel/compiler/brw_fs_nir.cpp

index a830bb9fcd68775025f942234ad41520c87e22b4..9698a0111efe20434ceb70a191da2df31ce394cc 100644 (file)
@@ -4146,7 +4146,7 @@ fs_visitor::nir_emit_intrinsic(const fs_builder &bld, nir_intrinsic_instr *instr
       if (const_offset) {
          offset_reg = brw_imm_ud(const_offset->u32[0]);
       } else {
-         offset_reg = get_nir_src(instr->src[1]);
+         offset_reg = retype(get_nir_src(instr->src[1]), BRW_REGISTER_TYPE_UD);
       }
 
       /* Read the vector */