1 ; RUN: llc < %s -mtriple=x86_64-unknown-unknown -mattr=fma -enable-unsafe-fp-math -enable-fmf-dag=1 | FileCheck %s
3 ; If fast-math-flags are propagated correctly, the mul1 expression
4 ; should be recognized as a factor in the last fsub, so we should
5 ; see a mul and add, not a mul and fma:
6 ; a * b - (-a * b) ---> (a * b) + (a * b)
8 define float @fmf_should_not_break_cse(float %a, float %b) {
9 ; CHECK-LABEL: fmf_should_not_break_cse:
11 ; CHECK-NEXT: vmulss %xmm1, %xmm0, %xmm0
12 ; CHECK-NEXT: vaddss %xmm0, %xmm0, %xmm0
15 %mul1 = fmul fast float %a, %b
16 %nega = fsub fast float 0.0, %a
17 %mul2 = fmul fast float %nega, %b
18 %abx2 = fsub fast float %mul1, %mul2