https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102604
Bug ID: 102604
Summary: arm v7m_extra_costs for SFmode inaccurate?
Product: gcc
Version: 12.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: target
Assignee: unassigned at gcc dot gnu.org
Reporter: clyon at gcc dot gnu.org
Target Milestone: ---
I have noticed that gcc.target/arm/vfp-1.c fails when targeting cortex-m7
(-mthumb -mfloat-abi=hard -march=armv7e-m+fp.dp):
FAIL: gcc.target/arm/vfp-1.c scan-assembler vmla.f32
FAIL: gcc.target/arm/vfp-1.c scan-assembler vmls.f32
FAIL: gcc.target/arm/vfp-1.c scan-assembler vnmla.f32
FAIL: gcc.target/arm/vfp-1.c scan-assembler vnmls.f32
The DP (f64) versions PASS.
This is because v7m_extra_costs for SP contains:
COSTS_N_INSNS (2), /* mult. */
COSTS_N_INSNS (5), /* mult_addsub. */
COSTS_N_INSNS (1), /* addsub. */
So when combine tries to replace mutl + addsub into a single mult_addsub, the
cost of the latter is still higher than two separate instructions.
I suppose these values are the result of benchmarking, but it seems to mean
that vmla is never going to be selected by the compiler.