• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1; RUN: llc < %s -mtriple=i386-apple-darwin10  -mattr=+fma,-fma4  | FileCheck %s
2; RUN: llc < %s -mtriple=x86_64-apple-darwin10 -mattr=+fma,-fma4 | FileCheck %s
3; RUN: llc < %s -mtriple=i686-- -mcpu=bdver2 -mattr=-fma4  | FileCheck %s
4
5; Test FMA3 variant selection
6
7; CHECK-LABEL: fma3_select231ssX:
8; CHECK: vfmadd231ss %xmm
9define float @fma3_select231ssX(float %x, float %y) {
10entry:
11  br label %while.body
12while.body:
13  %acc.01 = phi float [ 0.000000e+00, %entry ], [ %acc, %while.body ]
14  %acc = call float @llvm.fma.f32(float %x, float %y, float %acc.01)
15  %b = fcmp ueq float %acc, 0.0
16  br i1 %b, label %while.body, label %while.end
17while.end:
18  ret float %acc
19}
20
21; CHECK-LABEL: fma3_select231pdY:
22; CHECK: vfmadd231pd %ymm
23define <4 x double> @fma3_select231pdY(<4 x double> %x, <4 x double> %y) {
24entry:
25  br label %while.body
26while.body:
27  %acc.04 = phi <4 x double> [ zeroinitializer, %entry ], [ %add, %while.body ]
28  %add = call <4 x double> @llvm.fma.v4f64(<4 x double> %x, <4 x double> %y, <4 x double> %acc.04)
29  %vecext = extractelement <4 x double> %add, i32 0
30  %cmp = fcmp oeq double %vecext, 0.000000e+00
31  br i1 %cmp, label %while.body, label %while.end
32while.end:
33  ret <4 x double> %add
34}
35
36declare float @llvm.fma.f32(float, float, float)
37declare <4 x double> @llvm.fma.v4f64(<4 x double>, <4 x double>, <4 x double>)
38