https://gcc.gnu.org/bugzilla/show_bug.cgi?id=120434
Andrew Pinski <pinskia at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Last reconfirmed| |2025-05-26 Severity|normal |enhancement Status|UNCONFIRMED |NEW Summary|(x86-64) GCC uses 'movsxd' |GCC uses signed extend |for positive variables |(movsxd) for known positive |which is larger code than |variables rather than zero |'mov' |extend 'mov' Ever confirmed|0 |1 CC| |pinskia at gcc dot gnu.org Component|target |middle-end --- Comment #3 from Andrew Pinski <pinskia at gcc dot gnu.org> --- Right now GCC don't change extensions. There was an idea to introduce ZERO_EXTEND/SIGN_EXTEND to the gimple and use those explicitly to improve middle-end but I don't know what happened to that. We do some signed vs unsigned changes for division currently though. I am going to change this to middle-end because in some cases zero-extends (like in this case) can be "free" even without worrying about size (aarch64 it is true too for zeroing extending from 32bit to 64bit too). There might be another bug requesting a similar thing too.