https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92398
--- Comment #6 from Xiong Hu XS Luo <luoxhu at cn dot ibm.com> ---
Power9 genrates different code than Power8LE is because of reg cost in sched1,
r120 from P9 of instruction 8 is a memory instruction while r120 of P8 of
instruction 13 is not, which will cause different register cost value in
function ira-cost.c:record_operand_costs(), the 2000 is P9's r120 BASE_REGS
cost, it is 0 for P8:
p op_costs[1][0]
$453 = {mem_cost = 4000, cost = {2000}}
sched1, For Power9:
P9 r120 costs: BASE_REGS:2000 GENERAL_REGS:2000 FLOAT_REGS:0 ALTIVEC_REGS:0
VSX_REGS:0 GEN_OR_FLOAT_REGS:12000 GEN_OR_VSX_REGS:12000 MEM:8000
;; basic block 2, loop depth 0
;; pred: ENTRY
5: NOTE_INSN_BASIC_BLOCK 2
11: r121:DI=%3:DI
REG_DEAD %3:DI
2: NOTE_INSN_DELETED
12: r122:TI=%4:TI
REG_DEAD %4:TI
3: NOTE_INSN_DELETED
4: NOTE_INSN_FUNCTION_BEG
7: r120:TI=~r122:TI
REG_DEAD r122:TI
8: [r121:DI]=r120:TI
REG_DEAD r121:DI
REG_DEAD r120:TI
;; succ: EXIT
sched1, For Power8LE:
r120 costs: BASE_REGS:0 GENERAL_REGS:0 FLOAT_REGS:0 ALTIVEC_REGS:0 VSX_REGS:0
GEN_OR_FLOAT_REGS:16000 GEN_OR_VSX_REGS:16000 MEM:5000
1: NOTE_INSN_DELETED
5: NOTE_INSN_BASIC_BLOCK 2
2: NOTE_INSN_DELETED
3: NOTE_INSN_DELETED
4: NOTE_INSN_FUNCTION_BEG
12: r122:TI=%4:TI
REG_DEAD %4:TI
11: r121:DI=%3:DI
REG_DEAD %3:DI
7: r120:TI=~r122:TI
REG_DEAD r122:TI
13: r123:TI=r120:TI<-<0x40
REG_DEAD r120:TI
14: [r121:DI]=r123:TI<-<0x40
REG_DEAD r123:TI
REG_DEAD r121:DI
15: NOTE_INSN_DELETED