i965/vec4: fill src_reg type using the constructor type parameter
authorAlejandro Piñeiro <apinheiro@igalia.com>
Tue, 1 Sep 2015 15:02:20 +0000 (17:02 +0200)
committerIago Toral Quiroga <itoral@igalia.com>
Wed, 2 Sep 2015 07:59:47 +0000 (09:59 +0200)
The src_reg constructor that received the glsl_type was using it
only to build the swizzle, but not to fill this->type as dst_reg
is doing.

This caused some type mismatch between movs and alu operations
on the NIR path, so copy propagation optimization was not applied
to remove unneeded movs if negate modifier was involved. This was
first detected on minus (negate+add) operations.

Shader DB results (taking into account only vec4):

total instructions in shared programs: 20019 -> 19934 (-0.42%)
instructions in affected programs:     2918 -> 2833 (-2.91%)
helped:                                79
HURT:                                  0
GAINED:                                0
LOST:                                  0

Reviewed-by: Matt Turner <mattst88@gmail.com>
src/mesa/drivers/dri/i965/brw_vec4.cpp

index b97b6c13a13d3646504a37cd0cd231ce63086964..501461c6d948b6ea5357f9fe195f9cc80256f6f1 100644 (file)
@@ -61,6 +61,8 @@ src_reg::src_reg(register_file file, int reg, const glsl_type *type)
       this->swizzle = brw_swizzle_for_size(type->vector_elements);
    else
       this->swizzle = BRW_SWIZZLE_XYZW;
+   if (type)
+      this->type = brw_type_for_base_type(type);
 }
 
 /** Generic unset register constructor. */