On Thu, Aug 15, 2024 at 11:34 AM Roger Sayle <ro...@nextmovesoftware.com> wrote: > > > As requested this patch is split out from my earlier submission. > This patch provides more accurate costs/gains for (wide) immediate > constants in STV, suitably adjusting the costs/gains when the highpart > and lowpart words are the same. One minor complication is that the > middle-end assumes (when generating memset) that SSE constants will > be shared/amortized across multiple consecutive writes. Hence to > avoid testsuite regressions, we add a heuristic that considers an immediate > constant to be very cheap, if that same immediate value occurs in the > previous instruction or in the following instruction. > > This patch has been tested on x86_64-pc-linux-gnu with make bootstrap > and make -k check, both with and without --target_board=unix{-m32} > with no new failures. Ok for mainline? > > > 2024-08-15 Roger Sayle <ro...@nextmovesoftware.com> > > gcc/ChangeLog > * config/i386/i386-features.cc (timode_immed_const_gain): New > function to determine the gain/cost on a CONST_WIDE_INT. > (local_duplicate_constant_p): Helper function to see if the > same immediate constant appears in the previous or next insn. > (timode_scalar_chain::compute_convert_gain): Fix whitespace. > <case CONST_WIDE_INT>: Provide more accurate estimates using > timode_immed_const_gain and local_duplicate_constant_p. > <case AND>: Handle CONSTANT_SCALAR_INT_P (src).
LGTM. Thanks, Uros.