nir: add ford, funord, fneo, fequ, fltu, fgeu

Reviewed-by: Timur Kristóf <timur.kristof@gmail.com>
Reviewed-by: Faith Ekstrand <faith.ekstrand@collabora.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/29467>
This commit is contained in:
Georg Lehmann
2024-05-29 14:56:17 +02:00
committed by Marge Bot
parent 01118a3fbb
commit 99372c1ed7
3 changed files with 18 additions and 0 deletions

View File

@@ -2905,8 +2905,14 @@ nir_alu_instr_is_comparison(const nir_alu_instr *instr)
switch (instr->op) {
CASE_ALL_SIZES(nir_op_flt)
CASE_ALL_SIZES(nir_op_fge)
CASE_ALL_SIZES(nir_op_fltu)
CASE_ALL_SIZES(nir_op_fgeu)
CASE_ALL_SIZES(nir_op_feq)
CASE_ALL_SIZES(nir_op_fneu)
CASE_ALL_SIZES(nir_op_fequ)
CASE_ALL_SIZES(nir_op_fneo)
CASE_ALL_SIZES(nir_op_funord)
CASE_ALL_SIZES(nir_op_ford)
CASE_ALL_SIZES(nir_op_ilt)
CASE_ALL_SIZES(nir_op_ult)
CASE_ALL_SIZES(nir_op_ige)

View File

@@ -4025,6 +4025,12 @@ typedef struct nir_shader_compiler_options {
/* Backend supports fused comapre against zero and csel */
bool has_fused_comp_and_csel;
/* Backend supports fneo, fequ, fltu, fgeu. */
bool has_fneo_fcmpu;
/* Backend supports ford and funord. */
bool has_ford_funord;
/** Backend supports fsub, if not set fsub will automatically be lowered to
* fadd(x, fneg(y)). If true, driver should call nir_opt_algebraic_late(). */
bool has_fsub;

View File

@@ -823,8 +823,14 @@ binop("frem", tfloat, "", "src0 - src1 * truncf(src0 / src1)")
binop_compare_all_sizes("flt", tfloat, "", "src0 < src1")
binop_compare_all_sizes("fge", tfloat, "", "src0 >= src1")
binop_compare_all_sizes("fltu", tfloat, "", "isnan(src0) || isnan(src1) || src0 < src1")
binop_compare_all_sizes("fgeu", tfloat, "", "isnan(src0) || isnan(src1) || src0 >= src1")
binop_compare_all_sizes("feq", tfloat, _2src_commutative, "src0 == src1")
binop_compare_all_sizes("fneu", tfloat, _2src_commutative, "src0 != src1")
binop_compare_all_sizes("fequ", tfloat, _2src_commutative, "isnan(src0) || isnan(src1) || src0 == src1")
binop_compare_all_sizes("fneo", tfloat, _2src_commutative, "!isnan(src0) && !isnan(src1) && src0 != src1")
binop_compare_all_sizes("funord", tfloat, _2src_commutative, "isnan(src0) || isnan(src1)")
binop_compare_all_sizes("ford", tfloat, _2src_commutative, "!isnan(src0) && !isnan(src1)")
binop_compare_all_sizes("ilt", tint, "", "src0 < src1")
binop_compare_all_sizes("ige", tint, "", "src0 >= src1")
binop_compare_all_sizes("ieq", tint, _2src_commutative, "src0 == src1")