https://gcc.gnu.org/bugzilla/show_bug.cgi?id=127020
--- Comment #5 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:abaf4268958a49d7dfd5f0d36bdb65983582b9d5 commit r17-5244-gabaf4268958a49d7dfd5f0d36bdb65983582b9d5 Author: liuhongt <[email protected]> Date: Mon Oct 12 23:10:04 2026 -0700 i386: Fix double-word zero-extension cost [PR127020] The zero movzx cost in Skylake and Ice Lake tunings makes CSE duplicate double-word zero extensions into stores, preventing STV conversion. Use the add cost for standalone double-word zero extensions when optimizing for speed, since clearing the upper word requires an extra instruction. Similarly for double-word sign_extend, but cost it one more than zero_extend, so that when a value is known non-negative, zero_extend is preferred to sign_extend: zero_extend needs an extra xor, while sign_extend needs an extra cdq. gcc/ChangeLog: PR target/127020 * config/i386/i386.cc (ix86_rtx_costs): Use the add cost for standalone double-word zero extensions when optimizing for speed. Cost standalone double-word sign extensions one more than that. gcc/testsuite/ChangeLog: PR target/127020 * gcc.target/i386/pr127020.c: New test. * gcc.target/i386/pr127020-2.c: New test. Co-authored-by: H.J. Lu <[email protected]>
