nir: remove redundant opcode u2ump
Reviewed-by: Rob Clark <robdclark@chromium.org> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6283>
This commit is contained in:
@@ -1990,7 +1990,7 @@ nir_visitor::visit(ir_expression *ir)
|
||||
}
|
||||
|
||||
case ir_unop_u2ump: {
|
||||
result = nir_build_alu(&b, nir_op_u2ump, srcs[0], NULL, NULL, NULL);
|
||||
result = nir_build_alu(&b, nir_op_i2imp, srcs[0], NULL, NULL, NULL);
|
||||
break;
|
||||
}
|
||||
|
||||
|
@@ -274,7 +274,8 @@ for src_t in [tint, tuint, tfloat, tbool]:
|
||||
# precision.
|
||||
unop_numeric_convert("f2fmp", tfloat16, tfloat, opcodes["f2f16"].const_expr)
|
||||
unop_numeric_convert("i2imp", tint16, tint, opcodes["i2i16"].const_expr)
|
||||
unop_numeric_convert("u2ump", tuint16, tuint, opcodes["u2u16"].const_expr)
|
||||
# u2ump isn't defined, because the behavior is equal to i2imp if src has more
|
||||
# than 16 bits.
|
||||
|
||||
# Unary floating-point rounding operations.
|
||||
|
||||
|
@@ -967,15 +967,15 @@ optimizations.extend([
|
||||
# Conversions from 16 bits to 32 bits and back can always be removed
|
||||
(('f2fmp', ('f2f32', 'a@16')), a),
|
||||
(('i2imp', ('i2i32', 'a@16')), a),
|
||||
(('u2ump', ('u2u32', 'a@16')), a),
|
||||
(('i2imp', ('u2u32', 'a@16')), a),
|
||||
(('f2fmp', ('b2f32', 'a@1')), ('b2f16', a)),
|
||||
(('i2imp', ('b2i32', 'a@1')), ('b2i16', a)),
|
||||
(('u2ump', ('b2i32', 'a@1')), ('b2i16', a)),
|
||||
(('i2imp', ('b2i32', 'a@1')), ('b2i16', a)),
|
||||
# Conversions to 16 bits would be lossy so they should only be removed if
|
||||
# the instruction was generated by the precision lowering pass.
|
||||
(('f2f32', ('f2fmp', 'a@32')), a),
|
||||
(('i2i32', ('i2imp', 'a@32')), a),
|
||||
(('u2u32', ('u2ump', 'a@32')), a),
|
||||
(('u2u32', ('i2imp', 'a@32')), a),
|
||||
|
||||
(('ffloor', 'a(is_integral)'), a),
|
||||
(('fceil', 'a(is_integral)'), a),
|
||||
@@ -1899,8 +1899,12 @@ for i in range(2, 4 + 1):
|
||||
|
||||
optimizations += [
|
||||
((to_16, vec_inst + suffix_in), vec_inst + out_16, '!options->vectorize_vec2_16bit'),
|
||||
((to_mp, vec_inst + suffix_in), vec_inst + out_mp, '!options->vectorize_vec2_16bit')
|
||||
]
|
||||
# u2ump doesn't exist, because it's equal to i2imp
|
||||
if T in ['f', 'i']:
|
||||
optimizations += [
|
||||
((to_mp, vec_inst + suffix_in), vec_inst + out_mp, '!options->vectorize_vec2_16bit')
|
||||
]
|
||||
|
||||
# This section contains "late" optimizations that should be run before
|
||||
# creating ffmas and calling regular optimizations for the final time.
|
||||
@@ -2065,7 +2069,7 @@ late_optimizations = [
|
||||
# nir_opt_algebraic so any remaining ones are required.
|
||||
(('f2fmp', a), ('f2f16', a)),
|
||||
(('i2imp', a), ('i2i16', a)),
|
||||
(('u2ump', a), ('u2u16', a)),
|
||||
(('i2imp', a), ('u2u16', a)),
|
||||
|
||||
# Section 8.8 (Integer Functions) of the GLSL 4.60 spec says:
|
||||
#
|
||||
|
Reference in New Issue
Block a user