mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-06 09:28:07 +02:00
brw/lower_regioning: Allow integer conversions in SEL
The Bspec says that SEL sources and destination can be any mix of *B,
*W, and *D. We should allow those. Specifically, without this change,
this instruction
sel.sat.l(8) v548:UD, v899:D, 255d
gets unnecessarily split into two instructions.
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/38978>
This commit is contained in:
parent
dff1e8ae28
commit
31de96d321
3 changed files with 35 additions and 2 deletions
|
|
@ -452,8 +452,16 @@ namespace {
|
|||
switch (inst->opcode) {
|
||||
case BRW_OPCODE_MOV:
|
||||
return false;
|
||||
case BRW_OPCODE_SEL:
|
||||
return inst->dst.type != get_exec_type(inst);
|
||||
case BRW_OPCODE_SEL: {
|
||||
const brw_reg_type exec_type = get_exec_type(inst);
|
||||
|
||||
if (inst->dst.type == exec_type)
|
||||
return false;
|
||||
|
||||
/* SEL can mix integer sizes and signed/unsigned. */
|
||||
return !brw_type_is_int(inst->dst.type) ||
|
||||
!brw_type_is_int(exec_type);
|
||||
}
|
||||
default:
|
||||
/* FIXME: We assume the opcodes not explicitly mentioned before just
|
||||
* work fine with arbitrary conversions, unless they need to be
|
||||
|
|
|
|||
|
|
@ -163,6 +163,7 @@ if with_tests
|
|||
'test_helpers.cpp',
|
||||
'test_helpers.h',
|
||||
'test_insert_load_reg.cpp',
|
||||
'test_lower_regioning.cpp',
|
||||
'test_lower_scoreboard.cpp',
|
||||
'test_opt_algebraic.cpp',
|
||||
'test_opt_cmod_propagation.cpp',
|
||||
|
|
|
|||
24
src/intel/compiler/brw/test_lower_regioning.cpp
Normal file
24
src/intel/compiler/brw/test_lower_regioning.cpp
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
/*
|
||||
* Copyright © 2025 Intel Corporation
|
||||
* SPDX-License-Identifier: MIT
|
||||
*/
|
||||
|
||||
#include "test_helpers.h"
|
||||
#include "brw_builder.h"
|
||||
|
||||
class lower_regioning_test : public brw_shader_pass_test {
|
||||
};
|
||||
|
||||
TEST_F(lower_regioning_test, sel_ud_d_d)
|
||||
{
|
||||
brw_builder bld = make_shader();
|
||||
|
||||
brw_reg dest = vgrf(bld, BRW_TYPE_UD);
|
||||
brw_reg src0 = vgrf(bld, BRW_TYPE_D);
|
||||
brw_reg src1 = vgrf(bld, BRW_TYPE_D);
|
||||
|
||||
bld.SEL(dest, src0, src1)
|
||||
->saturate = true;
|
||||
|
||||
EXPECT_NO_PROGRESS(brw_lower_regioning, bld);
|
||||
}
|
||||
Loading…
Add table
Reference in a new issue