https://gcc.gnu.org/bugzilla/show_bug.cgi?id=112758
Andrew Pinski <pinskia at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Component|target |rtl-optimization Last reconfirmed| |2023-11-29 Summary|Inconsistent Bitwise AND |[13/14 Regression] |Operation Result between |Inconsistent Bitwise AND |int and long long int on |Operation Result between |Different Optimization |int and long long int |Levels in GCC Trunk | Keywords| |needs-bisection Ever confirmed|0 |1 Target Milestone|--- |13.3 Status|UNCONFIRMED |NEW --- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> --- Trying 21, 18 -> 22: 21: r149:DI=0xffff00ffffffffff 18: r147:DI=sign_extend([r143:DI+low(`globalVar')]) REG_DEAD r143:DI 22: r148:DI=r147:DI&r149:DI REG_DEAD r149:DI REG_DEAD r147:DI REG_EQUAL r147:DI&0xffff00ffffffffff Successfully matched this instruction: (set (reg:DI 148) (zero_extend:DI (mem/c:SI (lo_sum:DI (reg/f:DI 143) (symbol_ref:DI ("globalVar") [flags 0x86] <var_decl 0x7f79b69e8090 globalVar>)) [1 globalVarD.2927+0 S4 A32]))) allowing combination of insns 18, 21 and 22 original costs 32 + 4 + 4 = 40 replacement cost 32 That is almost definitely wrong. Was working in GCC 12 but started to go wrong in GCC 13.