From 51c85e03632c85da64a65d925bbfc30e3908dbb3 Mon Sep 17 00:00:00 2001 From: Kenneth Graunke Date: Mon, 12 Aug 2024 13:13:48 -0700 Subject: [PATCH] intel/brw: Drop misguided sign extension attempts in extract_imm() This function never expands a type - it only narrows it. As such, we don't need to ever sign extend to fill additional new bits. I think this code was left over from earlier versions of my optimization pass that was buggy and trying to handle cases it should not have. Fixes: 580e1c592d90 ("intel/brw: Introduce a new SSA-based copy propagation pass") Reviewed-by: Caio Oliveira Reviewed-by: Ian Romanick Part-of: --- src/intel/compiler/brw_fs_copy_propagation.cpp | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) diff --git a/src/intel/compiler/brw_fs_copy_propagation.cpp b/src/intel/compiler/brw_fs_copy_propagation.cpp index d1cf1b60527..e6375605bad 100644 --- a/src/intel/compiler/brw_fs_copy_propagation.cpp +++ b/src/intel/compiler/brw_fs_copy_propagation.cpp @@ -1740,16 +1740,7 @@ extract_imm(brw_reg val, brw_reg_type type, unsigned offset) assert(bitsize < brw_type_size_bits(val.type)); - switch (val.type) { - case BRW_TYPE_UD: - val.ud = (val.ud >> (bitsize * offset)) & ((1u << bitsize) - 1); - break; - case BRW_TYPE_D: - val.d = (val.d << (bitsize * (32/bitsize - 1 - offset))) >> ((32/bitsize - 1) * bitsize); - break; - default: - return brw_reg(); - } + val.ud = (val.ud >> (bitsize * offset)) & ((1u << bitsize) - 1); return val; }