07dc1d4043
The condition modifier on SEL means something completely different than
it means on MOV. On MOV it means to modify the flags based on the value
written to the destination. On SEL it means to compare the sources using
that mode and pick the result (i.e., as min() or max()) without
modifying the flags.
The resulting MOV should not have a condition modifier for the same
reason it (already) doesn't have a predicate. This bug was found by
inspection, so I added a unit test.
No shader-db or shader-db changes on any Intel platform.
Fixes: fab92fa1cb ("i965/fs: Optimize SEL with the same sources into a MOV.")
Reviewed-by: Ivan Briano <ivan.briano@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/34192>
27 lines
599 B
C++
27 lines
599 B
C++
/*
|
|
* Copyright 2025 Intel Corporation
|
|
* SPDX-License-Identifier: MIT
|
|
*/
|
|
|
|
#include "test_helpers.h"
|
|
#include "brw_builder.h"
|
|
|
|
class algebraic_test : public brw_shader_pass_test {};
|
|
|
|
TEST_F(algebraic_test, imax_a_a)
|
|
{
|
|
brw_builder bld = make_shader(MESA_SHADER_FRAGMENT, 16);
|
|
brw_builder exp = make_shader(MESA_SHADER_FRAGMENT, 16);
|
|
|
|
brw_reg dst0 = vgrf(bld, exp, BRW_TYPE_D);
|
|
brw_reg src0 = vgrf(bld, exp, BRW_TYPE_D);
|
|
|
|
bld.emit_minmax(dst0, src0, src0, BRW_CONDITIONAL_GE);
|
|
|
|
EXPECT_PROGRESS(brw_opt_algebraic, bld);
|
|
|
|
exp.MOV(dst0, src0);
|
|
|
|
EXPECT_SHADERS_MATCH(bld, exp);
|
|
}
|