Add an intrinsic and codegen support for fused multiply-accumulate. The intent
[oota-llvm.git] / test / CodeGen / X86 / fma.ll
1 ; RUN: llc < %s -mtriple=i386-apple-darwin10 | FileCheck %s
2 ; RUN: llc < %s -mtriple=x86_64-apple-darwin10 | FileCheck %s
3
4 ; CHECK: test_f32
5 ; CHECK: _fmaf
6
7 define float @test_f32(float %a, float %b, float %c) nounwind readnone ssp {
8 entry:
9   %call = tail call float @llvm.fma.f32(float %a, float %b, float %c) nounwind readnone
10   ret float %call
11 }
12
13 ; CHECK: test_f64
14 ; CHECK: _fma
15
16 define double @test_f64(double %a, double %b, double %c) nounwind readnone ssp {
17 entry:
18   %call = tail call double @llvm.fma.f64(double %a, double %b, double %c) nounwind readnone
19   ret double %call
20 }
21
22 ; CHECK: test_f80
23 ; CHECK: _fmal
24
25 define x86_fp80 @test_f80(x86_fp80 %a, x86_fp80 %b, x86_fp80 %c) nounwind readnone ssp {
26 entry:
27   %call = tail call x86_fp80 @llvm.fma.f80(x86_fp80 %a, x86_fp80 %b, x86_fp80 %c) nounwind readnone
28   ret x86_fp80 %call
29 }
30
31 declare float @llvm.fma.f32(float, float, float) nounwind readnone
32 declare double @llvm.fma.f64(double, double, double) nounwind readnone
33 declare x86_fp80 @llvm.fma.f80(x86_fp80, x86_fp80, x86_fp80) nounwind readnone