https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87031
Bug ID: 87031 Summary: nios2 optimization for size - two cases of regression relatively to 5.3.0 Product: gcc Version: 8.2.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: target Assignee: unassigned at gcc dot gnu.org Reporter: already5chosen at yahoo dot com Target Milestone: --- Created attachment 44563 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=44563&action=edit first case - shifts instead of mulx Here are two cases of significant regression in optimization for size between 5.3.0 (a version supplied in Altera Nios2 SDK) and 8.2.0. Both cases compiled with -Wall -Os -ffreestanding -fbuiltin -mhw-div -mhw-mul -mhw-mulx It looks like in the first case -Os flag caused to compiler to forget that hw-mulx is present. The the second case, in addition to the same problem as in the first case, compiler decided to unroll the loop. An exact opposite of what one expects from '-s'. I checked if the problems appear with similar back ends ('riscv -mabi=ilp32 -march=rv32im' and 'mips -mabi=32 -mips32r6 -mcompact-branches=always'). The first problem (shifts instead of mulx) appear unique to nios2. The second problem (unrolling) shows up on all three architectures.