mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-07 04:58:05 +02:00
nir/tests: fix NaN/inf checks in skip_test()
Signed-off-by: Rhys Perry <pendingchaos02@gmail.com> Reviewed-by: Georg Lehmann <dadschoorse@gmail.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/40740>
This commit is contained in:
parent
72f2b8a034
commit
f52dace6e8
2 changed files with 10 additions and 7 deletions
|
|
@ -1507,7 +1507,7 @@ optimizations.extend([
|
|||
|
||||
# Vulkan allows us to use any rounding mode, so choose rtz because it's simple.
|
||||
# Avoid some NaNs being converted to Inf if the lsb are cut off.
|
||||
(('f2bf', a), ('bcsel', ('fneu(preserve_nan_inf)', a, a), -1, ('unpack_32_2x16_split_y', a)), 'options->lower_bfloat16_conversions', TestStatus.UNSUPPORTED), # all test inputs skipped
|
||||
(('f2bf', a), ('bcsel', ('fneu(preserve_nan_inf)', a, a), -1, ('unpack_32_2x16_split_y', a)), 'options->lower_bfloat16_conversions'),
|
||||
(('bf2f', a), ('pack_32_2x16', ('vec2', 0, a)), 'options->lower_bfloat16_conversions'),
|
||||
])
|
||||
|
||||
|
|
@ -3195,9 +3195,9 @@ def ldexp(f, exp, bits):
|
|||
return ('!fmul', ('!fmul', f, pow2_1), pow2_2)
|
||||
|
||||
optimizations += [
|
||||
(('ldexp@16', 'x', 'exp'), ldexp('x', 'exp', 16), '!options->has_ldexp', TestStatus.UNSUPPORTED), # All test inputs skipped.
|
||||
(('ldexp@32', 'x', 'exp'), ldexp('x', 'exp', 32), '!options->has_ldexp', TestStatus.UNSUPPORTED), # All test inputs skipped.
|
||||
(('ldexp@64', 'x', 'exp'), ldexp('x', 'exp', 64), '!options->has_ldexp', TestStatus.UNSUPPORTED), # All test inputs skipped.
|
||||
(('ldexp@16', 'x', 'exp'), ldexp('x', 'exp', 16), '!options->has_ldexp'),
|
||||
(('ldexp@32', 'x', 'exp'), ldexp('x', 'exp', 32), '!options->has_ldexp'),
|
||||
(('ldexp@64', 'x', 'exp'), ldexp('x', 'exp', 64), '!options->has_ldexp'),
|
||||
(('fexp2(contract)', ('i2f', 'a@8')), ('ldexp', 1.0, ('i2i32', a)), 'options->has_ldexp'),
|
||||
(('fexp2(contract)', ('i2f', 'a@16')), ('ldexp', 1.0, ('i2i32', a)), 'options->has_ldexp'),
|
||||
(('fexp2(contract)', ('i2f', 'a@32')), ('ldexp', 1.0, a), 'options->has_ldexp'),
|
||||
|
|
|
|||
|
|
@ -237,11 +237,14 @@ nir_algebraic_pattern_test::skip_test(nir_alu_instr *alu, uint32_t bit_size,
|
|||
nir_const_value tmp, int32_t src_index)
|
||||
{
|
||||
/* Always pass the test for signed zero/nan/inf sources if they are not preserved. */
|
||||
if (bit_size >= 16) {
|
||||
const nir_op_info *info = &nir_op_infos[alu->op];
|
||||
nir_alu_type type = src_index >= 0 ? info->input_types[src_index] : info->output_type;
|
||||
if (bit_size >= 16 && nir_alu_type_get_base_type(type) == nir_type_float) {
|
||||
double val = nir_const_value_as_float(tmp, bit_size);
|
||||
if ((!exact || !(fp_math_ctrl & nir_fp_preserve_nan)) && isnan(val))
|
||||
unsigned ctrl = fp_math_ctrl | ~info->valid_fp_math_ctrl;
|
||||
if ((!exact || !(ctrl & nir_fp_preserve_nan)) && isnan(val))
|
||||
return true;
|
||||
if ((!exact || !(fp_math_ctrl & nir_fp_preserve_inf)) && isinf(val))
|
||||
if ((!exact || !(ctrl & nir_fp_preserve_inf)) && isinf(val))
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue