[AArch64] Consider instruction-level contract FMFs in combiner patterns.
authorFlorian Hahn <flo@fhahn.com>
Tue, 4 Aug 2020 09:25:16 +0000 (10:25 +0100)
committerFlorian Hahn <flo@fhahn.com>
Tue, 4 Aug 2020 09:25:16 +0000 (10:25 +0100)
commitf7658241cb27491b4160a1f7060ef883bc535d09
tree8dd3ea2726e609e5fcdcd7cbb2b932689908fa3b
parentb7856f9d8ded99045fcc35da8db71bf1e41285f6
[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
llvm/lib/Target/AArch64/AArch64InstrInfo.cpp
llvm/test/CodeGen/AArch64/machine-combiner-instr-fmf.mir
llvm/test/CodeGen/AArch64/neon-fma-FMF.ll