1 ; RUN: llc < %s -mtriple=i386-apple-darwin10 -mattr=+fma,-fma4 | FileCheck %s --check-prefix=CHECK-FMA-INST
2 ; RUN: llc < %s -mtriple=i386-apple-darwin10 -mattr=-fma,-fma4 | FileCheck %s --check-prefix=CHECK-FMA-CALL
3 ; RUN: llc < %s -mtriple=x86_64-apple-darwin10 -mattr=+fma,-fma4 | FileCheck %s --check-prefix=CHECK-FMA-INST
4 ; RUN: llc < %s -mtriple=x86_64-apple-darwin10 -mattr=-fma,-fma4 | FileCheck %s --check-prefix=CHECK-FMA-CALL
5 ; RUN: llc < %s -march=x86 -mcpu=bdver2 -mattr=-fma4 | FileCheck %s --check-prefix=CHECK-FMA-INST
6 ; RUN: llc < %s -march=x86 -mcpu=bdver2 -mattr=-fma,-fma4 | FileCheck %s --check-prefix=CHECK-FMA-CALL
9 ; CHECK-FMA-INST: vfmadd213ss
10 ; CHECK-FMA-CALL: fmaf
12 define float @test_f32(float %a, float %b, float %c) nounwind readnone ssp {
14 %call = tail call float @llvm.fma.f32(float %a, float %b, float %c) nounwind readnone
19 ; CHECK-FMA-INST: vfmadd213sd
22 define double @test_f64(double %a, double %b, double %c) nounwind readnone ssp {
24 %call = tail call double @llvm.fma.f64(double %a, double %b, double %c) nounwind readnone
31 define x86_fp80 @test_f80(x86_fp80 %a, x86_fp80 %b, x86_fp80 %c) nounwind readnone ssp {
33 %call = tail call x86_fp80 @llvm.fma.f80(x86_fp80 %a, x86_fp80 %b, x86_fp80 %c) nounwind readnone
39 define float @test_f32_cst() nounwind readnone ssp {
41 %call = tail call float @llvm.fma.f32(float 3.0, float 3.0, float 3.0) nounwind readnone
45 ; Test FMA3 variant selection
46 ; CHECK: fma3_select231:
48 define float @fma3_select231(float %x, float %y, i32 %N) #0 {
51 while.body: ; preds = %while.body, %while.body
52 %acc.01 = phi float [ 0.000000e+00, %entry ], [ %acc, %while.body ]
53 %acc = tail call float @llvm.fma.f32(float %x, float %y, float %acc.01) nounwind readnone
54 %b = fcmp ueq float %acc, 0.0
55 br i1 %b, label %while.body, label %while.end
56 while.end: ; preds = %while.body, %entry
60 declare float @llvm.fma.f32(float, float, float) nounwind readnone
61 declare double @llvm.fma.f64(double, double, double) nounwind readnone
62 declare x86_fp80 @llvm.fma.f80(x86_fp80, x86_fp80, x86_fp80) nounwind readnone