1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py 2 ; RUN: llc < %s -mtriple=x86_64-unknown-unknown -mattr=fma -enable-unsafe-fp-math -enable-fmf-dag=1 | FileCheck %s 3 4 ; If fast-math-flags are propagated correctly, the mul1 expression 5 ; should be recognized as a factor in the last fsub, so we should 6 ; see a mul and add, not a mul and fma: 7 ; a * b - (-a * b) ---> (a * b) + (a * b) 8 9 define float @fmf_should_not_break_cse(float %a, float %b) { 10 ; CHECK-LABEL: fmf_should_not_break_cse: 11 ; CHECK: # BB#0: 12 ; CHECK-NEXT: vmulss %xmm1, %xmm0, %xmm0 13 ; CHECK-NEXT: vaddss %xmm0, %xmm0, %xmm0 14 ; CHECK-NEXT: retq 15 16 %mul1 = fmul fast float %a, %b 17 %nega = fsub fast float 0.0, %a 18 %mul2 = fmul fast float %nega, %b 19 %abx2 = fsub fast float %mul1, %mul2 20 ret float %abx2 21 } 22 23