https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63281
--- Comment #14 from Jiu Fu Guo <guojiufu at gcc dot gnu.org> --- For constant like 0x000800004100001, which is using 5 insns, at 'expand' pass, it is treated as preferred to save in memory, while at cse1 pass, it was replaced back to constant. expand: 7: r119:DI=[unspec[`*.LC0',%r2:DI] 47] REG_EQUAL 0x800004100001 8: [r117:DI]=r119:DI cse1: 7: r119:DI=0x800004100001 REG_EQUAL 0x800004100001 8: [r117:DI]=r119:DI This is because: expand_assignment invoke force_const_mem/gen_const_mem under the condition: (num_insns_constant (operands[1], mode) > (TARGET_CMODEL != CMODEL_SMALL ? 3 : 2)) At cse1, when comparing the cost between 'fold_const' and 'src', 'fold_const' is selected 'preferable (src_folded_cost, src_folded_regcost, src_cost, src_regcost) <= 0' src: (mem/u/c:DI (unspec:DI [ (symbol_ref/u:DI ("*.LC0") [flags 0x82]) (reg:DI 2 2) ] UNSPEC_TOCREL) [2 S8 A8]) fold_const: (const_int 140737556512769 [0x800004100001]) It would be a way to keep the data in memory(.rodata) through adjusting the cost of constant.