https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113231
--- Comment #5 from GCC Commits <cvs-commit at gcc dot gnu.org> --- The master branch has been updated by Roger Sayle <sa...@gcc.gnu.org>: https://gcc.gnu.org/g:0a8aba760f62e9d66cc5610ecc276c1f0befc651 commit r14-6985-g0a8aba760f62e9d66cc5610ecc276c1f0befc651 Author: Roger Sayle <ro...@nextmovesoftware.com> Date: Sun Jan 7 17:42:00 2024 +0000 i386: PR target/113231: Improved costs in Scalar-To-Vector (STV) pass. This patch improves the cost/gain calculation used during the i386 backend's SImode/DImode scalar-to-vector (STV) conversion pass. The current code handles loads and stores, but doesn't consider that converting other scalar operations with a memory destination, requires an explicit load before and an explicit store after the vector equivalent. To ease the review, the significant change looks like: /* For operations on memory operands, include the overhead of explicit load and store instructions. */ if (MEM_P (dst)) igain += !optimize_insn_for_size_p () ? -COSTS_N_BYTES (8); : (m * (ix86_cost->int_load[2] + ix86_cost->int_store[2]) - (ix86_cost->sse_load[sse_cost_idx] + ix86_cost->sse_store[sse_cost_idx])); however the patch itself is complicated by a change in indentation which leads to a number of lines with only whitespace changes. For architectures where integer load/store costs are the same as vector load/store costs, there should be no change without -Os/-Oz. 2024-01-07 Roger Sayle <ro...@nextmovesoftware.com> Uros Bizjak <ubiz...@gmail.com> gcc/ChangeLog PR target/113231 * config/i386/i386-features.cc (compute_convert_gain): Include the overhead of explicit load and store (movd) instructions when converting non-store scalar operations with memory destinations. Various indentation whitespace fixes. gcc/testsuite/ChangeLog PR target/113231 * gcc.target/i386/pr113231.c: New test case.