On 11/29/23 19:39, Joern Rennecke wrote:
On Wed, 29 Nov 2023 at 20:05, Joern Rennecke
<joern.renne...@embecosm.com> wrote:
I suspect it'd be more useful to add handling of LSHIFTRT and ASHIFTRT
. Some ports do
a lot of static shifting.
+ case SS_ASHIFT:
+ case US_ASHIFT:
+ if (!mask || XEXP (x, 1) == const0_rtx)
+ return 0;
P.S.: I just realize that this is a pasto: in the case of a const0_rtx
shift count,
we returning 0 will usually be wrong.
I've attached my current patch version.
tmp.txt
ext-dce.cc: handle vector modes.
* ext-dce.cc: Amend comment to explain how liveness of vectors is tracked.
(carry_backpropagate): Use GET_MODE_INNER.
(ext_dce_process_sets): Likewise. Only apply big endian correction for
subregs if they don't have a vector mode.
(ext_cde_process_uses): Likewise.
* ext-dce.cc: carry_backpropagate: [US]S_ASHIFT fix, handle [LA]SHIFTRT
* ext-dce.cc (safe_for_live_propagation): Add LSHIFTRT and ASHIFTRT.
(carry_backpropagate): Reformat top comment.
Add handling of LSHIFTRT and ASHIFTRT.
Fix bit count for [SU]MUL_HIGHPART.
Fix pasto for [SU]S_ASHIFT.
* ext-dce.c: Fixes for carry handling.
* ext-dce.c (safe_for_live_propagation): Handle MINUS.
(ext_dce_process_uses): Break out carry handling into ..
(carry_backpropagate): This new function.
Better handling of ASHIFT.
Add handling of SMUL_HIGHPART, UMUL_HIGHPART, SIGN_EXTEND, SS_ASHIFT and
US_ASHIFT.
* ext-dce.c: fix SUBREG_BYTE test
As mentioned in
https://gcc.gnu.org/pipermail/gcc-patches/2023-November/637486.html
and
https://gcc.gnu.org/pipermail/gcc-patches/2023-November/638473.html
diff --git a/gcc/ext-dce.cc b/gcc/ext-dce.cc
index 4e4c57de117..228c50e8b73 100644
--- a/gcc/ext-dce.cc
+++ b/gcc/ext-dce.cc
@@ -38,7 +38,10 @@ along with GCC; see the file COPYING3. If not see
bit 0..7 (least significant byte)
bit 8..15 (second least significant byte)
bit 16..31
- bit 32..BITS_PER_WORD-1 */
+ bit 32..BITS_PER_WORD-1
+
+ For vector modes, we apply these bit groups to every lane; if any of the
+ bits in the group are live in any lane, we consider this group live. */
Why add vector modes now? I realize it might help a vectorized sub*_dct
from x264, but I was thinking that would be more of a gcc-15 improvement.
Was this in fact to help sub*_dct or something else concrete? Unless
it's concrete and significant, I'd lean towards deferring the
enhancement until gcc-15.
/* Note this pass could be used to narrow memory loads too. It's
not clear if that's profitable or not in general. */
@@ -96,6 +100,8 @@ safe_for_live_propagation (rtx_code code)
case SS_ASHIFT:
case US_ASHIFT:
case ASHIFT:
+ case LSHIFTRT:
+ case ASHIFTRT:
return true;
So this starts to touch on a cleanup Richard mentioned. The codes in
there until now were supposed to be safe across the board. As we add
things like LSHIFTRT, we need to describe how to handle liveness
transfer from the destination into the source(s). I think what Richard
is asking for is to just have one place which handles both.
Anyway, my current plan would be to pull in the formatting fixes, the
back propagation without the vector enhancement. We've already fixed
the subreg thingie locally.
jeff