HomePhabricator

[AArch64] Consider instruction-level contract FMFs in combiner patterns.

Authored by fhahn on Aug 4 2020, 2:25 AM.

Description

[AArch64] Consider instruction-level contract FMFs in combiner patterns.

Currently, instruction level fast math flags are not considered when
generating patterns for the machine combiner.

This currently leads to some missed opportunities to generate FMAs in
combination with #pragma clang fp contract (fast).

For example, when building the example below with -O3 for AArch64, no
FMADD is generated. If built with -O2 and the DAGCombiner is used
instead of the MachineCombiner for FMAs, an FMADD is generated.

With this patch, the same code is generated in both cases.

float madd_contract(float a, float b, float c) {
#pragma clang fp contract (fast)
  return (a * b) + c;
}

Reviewed By: dmgreen

Differential Revision: https://reviews.llvm.org/D84930