https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66731
Bug ID: 66731 Summary: vnmul, fnmul patterns incorrect for -frounding-math Product: gcc Version: 4.9.0 Status: UNCONFIRMED Keywords: wrong-code Severity: normal Priority: P3 Component: target Assignee: unassigned at gcc dot gnu.org Reporter: jsm28 at gcc dot gnu.org Target Milestone: --- Target: arm*-*-* aarch64*-*-* config/arm/vfp.md has patterns: (define_insn "*mulsf3negsf_vfp" [(set (match_operand:SF 0 "s_register_operand" "=t") (mult:SF (neg:SF (match_operand:SF 1 "s_register_operand" "t")) (match_operand:SF 2 "s_register_operand" "t")))] "TARGET_32BIT && TARGET_HARD_FLOAT && TARGET_VFP" "vnmul%?.f32\\t%0, %1, %2" [(set_attr "predicable" "yes") (set_attr "predicable_short_it" "no") (set_attr "type" "fmuls")] ) (define_insn "*muldf3negdf_vfp" [(set (match_operand:DF 0 "s_register_operand" "=w") (mult:DF (neg:DF (match_operand:DF 1 "s_register_operand" "w")) (match_operand:DF 2 "s_register_operand" "w")))] "TARGET_32BIT && TARGET_HARD_FLOAT && TARGET_VFP_DOUBLE" "vnmul%?.f64\\t%P0, %P1, %P2" [(set_attr "predicable" "yes") (set_attr "predicable_short_it" "no") (set_attr "type" "fmuld")] ) These describe the vnmul instruction as (-a) * b. It's actually -(a * b). The two are different in round-upwards and round-downwards modes. This is resulting in miscompilation of tgamma from current glibc git (which uses (-a) * b, expecting that actual multiplication), and consequent test failures. On inspection, AArch64 fnmul is similarly misdescribed, although I haven't done any testing there.