https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80706
Jakub Jelinek <jakub at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |uros at gcc dot gnu.org
--- Comment #3 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
So peephole2 does here:
- fstpl 24(%esp)
- movq 24(%esp), %xmm0
- movq %xmm0, 32(%esp)
+ fstpl 32(%esp)
movl $0, 32(%esp)
That is a nice simplification, but has one extra requirement not checked (and
hard to check) in the peephole2 patterns - that the memory slot stored in the
first store is a scratch memory not used afterwards (or overwritten first, i.e.
dead). While we have peep2_reg_dead_p predicates, we don't have
peep2_mem_dead_p and implementing that would be hard, only DSE has
infrastructure to do that, but dse2 is run before peephole2 pass.
All we could do is simplify the mem[sp+24]=st; xmm0=[sp+24]; [sp+32]=xmm0;
into mem[sp+24]=st; mem[sp+32]=st; and let the regstack pass figure out
something with it - fstl 24(%esp); fstpl 32(%esp) ?). DSE isn't run
afterwards, so it would be nice to do that earlier though.