[Mesa-dev] [PATCH] nir: Use a switch statement for detecting move-like operations.

Samuel Iglesias Gonsálvez siglesias at igalia.com
Wed Jun 24 03:17:18 PDT 2015


Reviewed-by: Samuel Iglesias Gonsálvez <siglesias at igalia.com>

Sam

On Tuesday 23 June 2015 23:17:53 Kenneth Graunke wrote:
> Suggested by Jason Ekstrand.
> 
> Signed-off-by: Kenneth Graunke <kenneth at whitecape.org>
> ---
>  src/glsl/nir/nir_opt_peephole_select.c |   20 ++++++++++++++------
>  1 file changed, 14 insertions(+), 6 deletions(-)
> 
> diff --git a/src/glsl/nir/nir_opt_peephole_select.c
> b/src/glsl/nir/nir_opt_peephole_select.c index ef7c977..6620e5d 100644
> --- a/src/glsl/nir/nir_opt_peephole_select.c
> +++ b/src/glsl/nir/nir_opt_peephole_select.c
> @@ -82,14 +82,22 @@ block_check_for_allowed_instrs(nir_block *block)
>           break;
> 
>        case nir_instr_type_alu: {
> -         /* It must be a move operation */
>           nir_alu_instr *mov = nir_instr_as_alu(instr);
> -         if (mov->op != nir_op_fmov && mov->op != nir_op_imov &&
> -             mov->op != nir_op_fneg && mov->op != nir_op_ineg &&
> -             mov->op != nir_op_fabs && mov->op != nir_op_iabs &&
> -             mov->op != nir_op_vec2 && mov->op != nir_op_vec3 &&
> -             mov->op != nir_op_vec4)
> +         switch (mov->op) {
> +         case nir_op_fmov:
> +         case nir_op_imov:
> +         case nir_op_fneg:
> +         case nir_op_ineg:
> +         case nir_op_fabs:
> +         case nir_op_iabs:
> +         case nir_op_vec2:
> +         case nir_op_vec3:
> +         case nir_op_vec4:
> +            /* It must be a move-like operation. */
> +            break;
> +         default:
>              return false;
> +         }
> 
>           /* Can't handle saturate */
>           if (mov->dest.saturate)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: This is a digitally signed message part.
URL: <http://lists.freedesktop.org/archives/mesa-dev/attachments/20150624/2481c81a/attachment.sig>


More information about the mesa-dev mailing list