Re: [Mesa-dev] [PATCH v2 020/103] i965/vec4: don't copy propagate vector opcodes that operate in align1 mode

2016-10-18 Thread Ian Romanick
This patch is

Reviewed-by: Ian Romanick 

On 10/11/2016 02:01 AM, Iago Toral Quiroga wrote:
> Basically, ALIGN1 mode will ignore swizzles on the input vectors so we don't
> want the copy propagation pass to mess with them.
> ---
>  .../drivers/dri/i965/brw_vec4_copy_propagation.cpp | 24 
> ++
>  1 file changed, 24 insertions(+)
> 
> 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 545f4c7..d0045a7 100644
> --- a/src/mesa/drivers/dri/i965/brw_vec4_copy_propagation.cpp
> +++ b/src/mesa/drivers/dri/i965/brw_vec4_copy_propagation.cpp
> @@ -283,6 +283,22 @@ try_constant_propagate(const struct gen_device_info 
> *devinfo,
>  }
>  
>  static bool
> +is_align1_opcode(unsigned opcode)
> +{
> +   switch (opcode) {
> +   case VEC4_OPCODE_DOUBLE_TO_FLOAT:
> +   case VEC4_OPCODE_FLOAT_TO_DOUBLE:
> +   case VEC4_OPCODE_PICK_LOW_32BIT:
> +   case VEC4_OPCODE_PICK_HIGH_32BIT:
> +   case VEC4_OPCODE_SET_LOW_32BIT:
> +   case VEC4_OPCODE_SET_HIGH_32BIT:
> +  return true;
> +   default:
> +  return false;
> +   }
> +}
> +
> +static bool
>  try_copy_propagate(const struct gen_device_info *devinfo,
> vec4_instruction *inst, int arg,
> const copy_entry *entry, int attributes_per_reg)
> @@ -326,6 +342,14 @@ try_copy_propagate(const struct gen_device_info *devinfo,
>  
> unsigned composed_swizzle = brw_compose_swizzle(inst->src[arg].swizzle,
> value.swizzle);
> +
> +   /* Instructions that operate on vectors in ALIGN1 mode will ignore 
> swizzles
> +* so copy-propagation won't be safe if the composed swizzle is anything
> +* other than the identity.
> +*/
> +   if (is_align1_opcode(inst->opcode) && composed_swizzle != 
> BRW_SWIZZLE_XYZW)
> +  return false;
> +
> if (inst->is_3src(devinfo) &&
> (value.file == UNIFORM ||
>  (value.file == ATTR && attributes_per_reg != 1)) &&
> 

___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [PATCH v2 020/103] i965/vec4: don't copy propagate vector opcodes that operate in align1 mode

2016-10-11 Thread Iago Toral Quiroga
Basically, ALIGN1 mode will ignore swizzles on the input vectors so we don't
want the copy propagation pass to mess with them.
---
 .../drivers/dri/i965/brw_vec4_copy_propagation.cpp | 24 ++
 1 file changed, 24 insertions(+)

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 545f4c7..d0045a7 100644
--- a/src/mesa/drivers/dri/i965/brw_vec4_copy_propagation.cpp
+++ b/src/mesa/drivers/dri/i965/brw_vec4_copy_propagation.cpp
@@ -283,6 +283,22 @@ try_constant_propagate(const struct gen_device_info 
*devinfo,
 }
 
 static bool
+is_align1_opcode(unsigned opcode)
+{
+   switch (opcode) {
+   case VEC4_OPCODE_DOUBLE_TO_FLOAT:
+   case VEC4_OPCODE_FLOAT_TO_DOUBLE:
+   case VEC4_OPCODE_PICK_LOW_32BIT:
+   case VEC4_OPCODE_PICK_HIGH_32BIT:
+   case VEC4_OPCODE_SET_LOW_32BIT:
+   case VEC4_OPCODE_SET_HIGH_32BIT:
+  return true;
+   default:
+  return false;
+   }
+}
+
+static bool
 try_copy_propagate(const struct gen_device_info *devinfo,
vec4_instruction *inst, int arg,
const copy_entry *entry, int attributes_per_reg)
@@ -326,6 +342,14 @@ try_copy_propagate(const struct gen_device_info *devinfo,
 
unsigned composed_swizzle = brw_compose_swizzle(inst->src[arg].swizzle,
value.swizzle);
+
+   /* Instructions that operate on vectors in ALIGN1 mode will ignore swizzles
+* so copy-propagation won't be safe if the composed swizzle is anything
+* other than the identity.
+*/
+   if (is_align1_opcode(inst->opcode) && composed_swizzle != BRW_SWIZZLE_XYZW)
+  return false;
+
if (inst->is_3src(devinfo) &&
(value.file == UNIFORM ||
 (value.file == ATTR && attributes_per_reg != 1)) &&
-- 
2.7.4

___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev