From 6016df211fdd6f1846255ea55d272e1f36881357 Mon Sep 17 00:00:00 2001 From: Jonathan Marek Date: Wed, 8 May 2019 16:22:45 -0400 Subject: [PATCH] nir: improvements to native_integers removal Improvements related to the patch that removed native_integers: * In glsl_to_nir, special cases for i2f,u2f,etc are no longer needed * In prog_to_nir, use sge/slt and let lower_scmp lower it if needed Signed-off-by: Jonathan Marek Reviewed-by: Jason Ekstrand --- src/compiler/glsl/glsl_to_nir.cpp | 10 ---------- src/mesa/program/prog_to_nir.c | 10 ++-------- 2 files changed, 2 insertions(+), 18 deletions(-) diff --git a/src/compiler/glsl/glsl_to_nir.cpp b/src/compiler/glsl/glsl_to_nir.cpp index 59e9764753b..2e0075c2d5e 100644 --- a/src/compiler/glsl/glsl_to_nir.cpp +++ b/src/compiler/glsl/glsl_to_nir.cpp @@ -1877,20 +1877,10 @@ nir_visitor::visit(ir_expression *ir) case ir_unop_exp2: result = nir_fexp2(&b, srcs[0]); break; case ir_unop_log2: result = nir_flog2(&b, srcs[0]); break; case ir_unop_i2f: - result = nir_i2f32(&b, srcs[0]); - break; case ir_unop_u2f: - result = nir_u2f32(&b, srcs[0]); - break; case ir_unop_b2f: - result = nir_b2f32(&b, srcs[0]); - break; case ir_unop_f2i: - result = nir_f2i32(&b, srcs[0]); - break; case ir_unop_f2u: - result = nir_f2u32(&b, srcs[0]); - break; case ir_unop_f2b: case ir_unop_i2b: case ir_unop_b2i: diff --git a/src/mesa/program/prog_to_nir.c b/src/mesa/program/prog_to_nir.c index 269724e13b4..a5ac37af908 100644 --- a/src/mesa/program/prog_to_nir.c +++ b/src/mesa/program/prog_to_nir.c @@ -388,22 +388,16 @@ ptn_scs(nir_builder *b, nir_alu_dest dest, nir_ssa_def **src) ptn_move_dest_masked(b, dest, nir_imm_float(b, 1.0), WRITEMASK_W); } -/** - * Emit SLT. For platforms with integers, prefer b2f(flt(...)). - */ static void ptn_slt(nir_builder *b, nir_alu_dest dest, nir_ssa_def **src) { - ptn_move_dest(b, dest, nir_b2f32(b, nir_flt(b, src[0], src[1]))); + ptn_move_dest(b, dest, nir_slt(b, src[0], src[1])); } -/** - * Emit SGE. For platforms with integers, prefer b2f(fge(...)). - */ static void ptn_sge(nir_builder *b, nir_alu_dest dest, nir_ssa_def **src) { - ptn_move_dest(b, dest, nir_b2f32(b, nir_fge(b, src[0], src[1]))); + ptn_move_dest(b, dest, nir_sge(b, src[0], src[1])); } static void -- 2.30.2