MSP430: Implement TARGET_INSN_COST
authorJozef Lawrynowicz <jozef.l@mittosystems.com>
Fri, 13 Nov 2020 15:35:52 +0000 (15:35 +0000)
committerJozef Lawrynowicz <jozef.l@mittosystems.com>
Fri, 13 Nov 2020 15:36:30 +0000 (15:36 +0000)
commit54896b10dbe1d4ac90f097d566b7aa14807cec08
tree06e411434272c328ecedcba249215873ea875e40
parent546c8f955804ad74b0382b012f64e621a02eebde
MSP430: Implement TARGET_INSN_COST

The length of an insn can be used to calculate its cost, when optimizing
for size. When optimizing for speed, this is a good estimate, since the
cycle cost of an MSP430 instruction increases with its length.

gcc/ChangeLog:

* config/msp430/msp430.c (TARGET_INSN_COST): Define.
(msp430_insn_cost): New function.
* config/msp430/msp430.h (BRANCH_COST): Define.
(LOGICAL_OP_NON_SHORT_CIRCUIT): Define.

gcc/testsuite/ChangeLog:

* gcc.target/msp430/rtx-cost-O3-default.c: New test.
* gcc.target/msp430/rtx-cost-O3-f5series.c: New test.
* gcc.target/msp430/rtx-cost-Os-default.c: New test.
* gcc.target/msp430/rtx-cost-Os-f5series.c: New test.
gcc/config/msp430/msp430.c
gcc/config/msp430/msp430.h
gcc/testsuite/gcc.target/msp430/rtx-cost-O3-default.c [new file with mode: 0644]
gcc/testsuite/gcc.target/msp430/rtx-cost-O3-f5series.c [new file with mode: 0644]
gcc/testsuite/gcc.target/msp430/rtx-cost-Os-default.c [new file with mode: 0644]
gcc/testsuite/gcc.target/msp430/rtx-cost-Os-f5series.c [new file with mode: 0644]