[Mesa-dev] [PATCH 4/5] i965/vec4: Use abs/negate functions in const propagation.
Matt Turner
mattst88 at gmail.com
Fri Jan 30 15:54:31 PST 2015
No changes in shader-db.
---
.../drivers/dri/i965/brw_vec4_copy_propagation.cpp | 18 +++++-------------
1 file changed, 5 insertions(+), 13 deletions(-)
diff --git a/src/mesa/drivers/dri/i965/brw_vec4_copy_propagation.cpp b/src/mesa/drivers/dri/i965/brw_vec4_copy_propagation.cpp
index bf15941..5277878 100644
--- a/src/mesa/drivers/dri/i965/brw_vec4_copy_propagation.cpp
+++ b/src/mesa/drivers/dri/i965/brw_vec4_copy_propagation.cpp
@@ -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)
--
2.0.4
More information about the mesa-dev
mailing list