i965/vec4: Use abs/negate functions in const propagation.
authorMatt Turner <mattst88@gmail.com>
Fri, 30 Jan 2015 23:13:48 +0000 (15:13 -0800)
committerMatt Turner <mattst88@gmail.com>
Tue, 3 Feb 2015 20:25:14 +0000 (12:25 -0800)
No changes in shader-db.

Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
src/mesa/drivers/dri/i965/brw_vec4_copy_propagation.cpp

index e25c9953c1c9de05e7165cae0e62efbe7059cae2..638d99a4c92244cf47efec04d5e1f669292fc0b0 100644 (file)
@@ -114,23 +114,15 @@ try_constant_propagate(struct brw_context *brw, vec4_instruction *inst,
       return false;
 
    if (inst->src[arg].abs) {
-      if (value.type == BRW_REGISTER_TYPE_F) {
-        value.fixed_hw_reg.dw1.f = fabs(value.fixed_hw_reg.dw1.f);
-      } else if (value.type == BRW_REGISTER_TYPE_VF) {
-         value.fixed_hw_reg.dw1.ud &= ~0x80808080;
-      } else if (value.type == BRW_REGISTER_TYPE_D) {
-        if (value.fixed_hw_reg.dw1.d < 0)
-           value.fixed_hw_reg.dw1.d = -value.fixed_hw_reg.dw1.d;
+      if (!brw_abs_immediate(value.type, &value.fixed_hw_reg)) {
+         return false;
       }
    }
 
    if (inst->src[arg].negate) {
-      if (value.type == BRW_REGISTER_TYPE_F)
-        value.fixed_hw_reg.dw1.f = -value.fixed_hw_reg.dw1.f;
-      else if (value.type == BRW_REGISTER_TYPE_VF)
-         value.fixed_hw_reg.dw1.ud ^= 0x80808080;
-      else
-        value.fixed_hw_reg.dw1.ud = -value.fixed_hw_reg.dw1.ud;
+      if (!brw_negate_immediate(value.type, &value.fixed_hw_reg)) {
+         return false;
+      }
    }
 
    if (value.type == BRW_REGISTER_TYPE_VF)