1 ; RUN: llc < %s -mtriple=i386-apple-darwin10 -mattr=+fma,-fma4 | FileCheck %s --check-prefix=CHECK --check-prefix=CHECK-FMA-INST 2 ; RUN: llc < %s -mtriple=i386-apple-darwin10 -mattr=-fma,-fma4 | FileCheck %s --check-prefix=CHECK --check-prefix=CHECK-FMA-CALL 3 ; RUN: llc < %s -mtriple=x86_64-apple-darwin10 -mattr=+fma,-fma4 | FileCheck %s --check-prefix=CHECK --check-prefix=CHECK-FMA-INST 4 ; RUN: llc < %s -mtriple=x86_64-apple-darwin10 -mattr=-fma,-fma4 | FileCheck %s --check-prefix=CHECK --check-prefix=CHECK-FMA-CALL 5 ; RUN: llc < %s -mtriple=x86_64-apple-darwin10 -mattr=+avx512f,-fma,-fma4 | FileCheck %s --check-prefix=CHECK --check-prefix=CHECK-FMA-INST 6 ; RUN: llc < %s -march=x86 -mcpu=bdver2 -mattr=-fma4 | FileCheck %s --check-prefix=CHECK --check-prefix=CHECK-FMA-INST 7 ; RUN: llc < %s -march=x86 -mcpu=bdver2 -mattr=-fma,-fma4 | FileCheck %s --check-prefix=CHECK --check-prefix=CHECK-FMA-CALL 8 9 ; CHECK-LABEL: test_f32: 10 ; CHECK-FMA-INST: vfmadd213ss 11 ; CHECK-FMA-CALL: fmaf 12 define float @test_f32(float %a, float %b, float %c) #0 { 13 entry: 14 %call = call float @llvm.fma.f32(float %a, float %b, float %c) 15 ret float %call 16 } 17 18 ; CHECK-LABEL: test_f64: 19 ; CHECK-FMA-INST: vfmadd213sd 20 ; CHECK-FMA-CALL: fma 21 define double @test_f64(double %a, double %b, double %c) #0 { 22 entry: 23 %call = call double @llvm.fma.f64(double %a, double %b, double %c) 24 ret double %call 25 } 26 27 ; CHECK-LABEL: test_f80: 28 ; CHECK: fmal 29 define x86_fp80 @test_f80(x86_fp80 %a, x86_fp80 %b, x86_fp80 %c) #0 { 30 entry: 31 %call = call x86_fp80 @llvm.fma.f80(x86_fp80 %a, x86_fp80 %b, x86_fp80 %c) 32 ret x86_fp80 %call 33 } 34 35 ; CHECK-LABEL: test_f32_cst: 36 ; CHECK-NOT: vfmadd 37 define float @test_f32_cst() #0 { 38 entry: 39 %call = call float @llvm.fma.f32(float 3.0, float 3.0, float 3.0) 40 ret float %call 41 } 42 43 declare float @llvm.fma.f32(float, float, float) 44 declare double @llvm.fma.f64(double, double, double) 45 declare x86_fp80 @llvm.fma.f80(x86_fp80, x86_fp80, x86_fp80) 46 47 attributes #0 = { nounwind } 48