On 4/6/23 04:31, Jakub Jelinek wrote:


If we want to fix it in the combiner, I think the fix would be following.
The optimization is about
(and:SI (subreg:SI (reg:HI xxx) 0) (const_int 0x84c))
and IMHO we can only optimize it into
(subreg:SI (and:HI (reg:HI xxx) (const_int 0x84c)) 0)
if we know that the upper bits of the REG are zeros.
But in WORD_REGISTER_OPERATIONS, that inner AND variant operates on a full word. So I think they're equivalent. But maybe I'm getting myself confused again.




Now, this patch fixes the PR, but certainly generates worse (but correct)
code than the dse.cc patch.  So perhaps we want both of them?
I think the dse patch has value independently of this discussion, though I think it's more of a gcc-14 thing.


As before, I unfortunately can't test it on riscv-linux (could perhaps try
that on sparc-solaris on GCC Farm which is another WORD_REGISTER_OPERATIONS
target, but last my bootstrap attempt there failed miserably because of the
Don't bootstrap at midnight issue in cp/Make-lang.in; I'll post a patch
for that once I test it).
I can spin it here when the time comes.

jeff


Reply via email to