https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104914
Roger Sayle <roger at nextmovesoftware dot com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |roger at nextmovesoftware dot com --- Comment #15 from Roger Sayle <roger at nextmovesoftware dot com> --- Is MIPS64 actually a TRULY_NOOP_TRUNCATION_TARGET? If SImode is implicitly assumed to be (sign?) extended, then an arbitrary DImode value/register can't be used as an SImode value without appropriately setting/clearing the upper bits. i.e. thus this integer truncation isn't a no-op. I suspect that the underlying problem is that the backend is relying on implicit invariants, not explicitly represented in the RTL, and then surprised when valid RTL transformations don't preserve those invariants/assumptions. I wonder why the zero_extract followed by sign_extend example mentioned in https://gcc.gnu.org/pipermail/gcc-patches/2023-August/626137.html isn't already being considered as a try_combine candidate, allowing the backend to simply recognize or split it. I'll investigate.