From 139398f124c1559e77dbd465222aa08c66226a25 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: (cherry picked from commit 51c85e03632c85da64a65d925bbfc30e3908dbb3) --- .pick_status.json | 2 +- src/intel/compiler/brw_fs_copy_propagation.cpp | 11 +---------- 2 files changed, 2 insertions(+), 11 deletions(-) diff --git a/.pick_status.json b/.pick_status.json index 53e6229dd28..ea17d43fb81 100644 --- a/.pick_status.json +++ b/.pick_status.json @@ -584,7 +584,7 @@ "description": "intel/brw: Drop misguided sign extension attempts in extract_imm()", "nominated": true, "nomination_type": 1, - "resolution": 0, + "resolution": 1, "main_sha": null, "because_sha": "580e1c592d90392a30185d8059499498748909fd", "notes": null diff --git a/src/intel/compiler/brw_fs_copy_propagation.cpp b/src/intel/compiler/brw_fs_copy_propagation.cpp index afb976b8430..c1064051054 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; }