https://gcc.gnu.org/bugzilla/show_bug.cgi?id=128035
--- Comment #2 from GCC Commits <cvs-commit at gcc dot gnu.org> --- The master branch has been updated by hongtao Liu <[email protected]>: https://gcc.gnu.org/g:d139f7421dea271737d9085424fad84210c43b5e commit r17-5498-gd139f7421dea271737d9085424fad84210c43b5e Author: liuhongt <[email protected]> Date: Thu Oct 22 04:25:00 2026 -0700 i386: Increase COMPARE_BY_PIECES threshold for word-sized pieces [PR128035] When COMPARE_MAX_PIECES is UNITS_PER_WORD (no SSE2, or SSE2 tunings without fast unaligned SSE loads/stores such as core2), every word piece gets its own compare and branch, so memcmp is only inlined up to 32 bytes for 64-bit and 16 bytes for ia32. Use a branch ratio of 2 for word_mode pieces and halve SIZE in the cost estimate when optimizing for speed, so the thresholds match the SSE2 ones: 64 bytes for 64-bit, 32 bytes for ia32. Each pair of word pieces is then compared with a sequence similar to the SSE2 double-word compare: two loads, two subs, one or and one branch. gcc/ChangeLog: PR target/128035 * config/i386/i386.cc (ix86_use_by_pieces_infrastructure_p): Halve SIZE for COMPARE_BY_PIECES when COMPARE_MAX_PIECES is UNITS_PER_WORD and optimizing for speed. (ix86_compare_by_pieces_branch_ratio): New function. (TARGET_COMPARE_BY_PIECES_BRANCH_RATIO): Define. gcc/testsuite/ChangeLog: PR target/128035 * gcc.target/i386/pr128035.c: New test. * gcc.target/i386/pr128035-2.c: New test.
