[Mesa-dev] [PATCH 1/2] nir: make is_comparison() a non-static helper function
Ian Romanick
idr at freedesktop.org
Thu May 31 00:54:01 UTC 2018
This patch is
Reviewed-by: Ian Romanick <ian.d.romanick at intel.com>
I'm currently running the next patch through shader-db. The initial
results are... interesting.
On 05/30/2018 05:21 AM, Samuel Pitoiset wrote:
> Rename and change the prototype for consistency regarding
> nir_tex_instr_is_query(). This function will be used in the
> following patch.
>
> Signed-off-by: Samuel Pitoiset <samuel.pitoiset at gmail.com>
> ---
> src/compiler/nir/nir.h | 24 +++++++++++++++++++
> src/compiler/nir/nir_opt_move_comparisons.c | 26 +--------------------
> 2 files changed, 25 insertions(+), 25 deletions(-)
>
> diff --git a/src/compiler/nir/nir.h b/src/compiler/nir/nir.h
> index f6086bd6c0..5a1f79515a 100644
> --- a/src/compiler/nir/nir.h
> +++ b/src/compiler/nir/nir.h
> @@ -1374,6 +1374,30 @@ nir_tex_instr_is_query(const nir_tex_instr *instr)
> }
> }
>
> +static inline bool
> +nir_alu_instr_is_comparison(const nir_alu_instr *instr)
> +{
> + switch (instr->op) {
> + case nir_op_flt:
> + case nir_op_fge:
> + case nir_op_feq:
> + case nir_op_fne:
> + case nir_op_ilt:
> + case nir_op_ult:
> + case nir_op_ige:
> + case nir_op_uge:
> + case nir_op_ieq:
> + case nir_op_ine:
> + case nir_op_i2b:
> + case nir_op_f2b:
> + case nir_op_inot:
> + case nir_op_fnot:
> + return true;
> + default:
> + return false;
> + }
> +}
> +
> static inline nir_alu_type
> nir_tex_instr_src_type(const nir_tex_instr *instr, unsigned src)
> {
> diff --git a/src/compiler/nir/nir_opt_move_comparisons.c b/src/compiler/nir/nir_opt_move_comparisons.c
> index 617c2ca998..5da57dc921 100644
> --- a/src/compiler/nir/nir_opt_move_comparisons.c
> +++ b/src/compiler/nir/nir_opt_move_comparisons.c
> @@ -50,30 +50,6 @@
> * lower register pressure.
> */
>
> -static bool
> -is_comparison(nir_op op)
> -{
> - switch (op) {
> - case nir_op_flt:
> - case nir_op_fge:
> - case nir_op_feq:
> - case nir_op_fne:
> - case nir_op_ilt:
> - case nir_op_ult:
> - case nir_op_ige:
> - case nir_op_uge:
> - case nir_op_ieq:
> - case nir_op_ine:
> - case nir_op_i2b:
> - case nir_op_f2b:
> - case nir_op_inot:
> - case nir_op_fnot:
> - return true;
> - default:
> - return false;
> - }
> -}
> -
> static bool
> move_comparison_source(nir_src *src, nir_block *block, nir_instr *before)
> {
> @@ -84,7 +60,7 @@ move_comparison_source(nir_src *src, nir_block *block, nir_instr *before)
>
> if (src_instr->block == block &&
> src_instr->type == nir_instr_type_alu &&
> - is_comparison(nir_instr_as_alu(src_instr)->op)) {
> + nir_alu_instr_is_comparison(nir_instr_as_alu(src_instr))) {
>
> exec_node_remove(&src_instr->node);
>
>
More information about the mesa-dev
mailing list