1 ; RUN: opt < %s -basicaa -slp-vectorizer -slp-threshold=-999 -dce -S -mtriple=x86_64-apple-macosx10.8.0 -mcpu=corei7-avx | FileCheck %s
3 target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64-S128"
4 target triple = "x86_64-apple-macosx10.8.0"
6 declare double @sin(double)
7 declare double @cos(double)
8 declare double @pow(double, double)
9 declare double @exp2(double)
10 declare i64 @round(i64)
14 ; CHECK: call <2 x double> @llvm.sin.v2f64
16 define void @sin_libm(double* %a, double* %b, double* %c) {
18 %i0 = load double, double* %a, align 8
19 %i1 = load double, double* %b, align 8
20 %mul = fmul double %i0, %i1
21 %call = tail call double @sin(double %mul) nounwind readnone
22 %arrayidx3 = getelementptr inbounds double, double* %a, i64 1
23 %i3 = load double, double* %arrayidx3, align 8
24 %arrayidx4 = getelementptr inbounds double, double* %b, i64 1
25 %i4 = load double, double* %arrayidx4, align 8
26 %mul5 = fmul double %i3, %i4
27 %call5 = tail call double @sin(double %mul5) nounwind readnone
28 store double %call, double* %c, align 8
29 %arrayidx5 = getelementptr inbounds double, double* %c, i64 1
30 store double %call5, double* %arrayidx5, align 8
35 ; CHECK: call <2 x double> @llvm.cos.v2f64
37 define void @cos_libm(double* %a, double* %b, double* %c) {
39 %i0 = load double, double* %a, align 8
40 %i1 = load double, double* %b, align 8
41 %mul = fmul double %i0, %i1
42 %call = tail call double @cos(double %mul) nounwind readnone
43 %arrayidx3 = getelementptr inbounds double, double* %a, i64 1
44 %i3 = load double, double* %arrayidx3, align 8
45 %arrayidx4 = getelementptr inbounds double, double* %b, i64 1
46 %i4 = load double, double* %arrayidx4, align 8
47 %mul5 = fmul double %i3, %i4
48 %call5 = tail call double @cos(double %mul5) nounwind readnone
49 store double %call, double* %c, align 8
50 %arrayidx5 = getelementptr inbounds double, double* %c, i64 1
51 store double %call5, double* %arrayidx5, align 8
56 ; CHECK: call <2 x double> @llvm.pow.v2f64
58 define void @pow_libm(double* %a, double* %b, double* %c) {
60 %i0 = load double, double* %a, align 8
61 %i1 = load double, double* %b, align 8
62 %mul = fmul double %i0, %i1
63 %call = tail call double @pow(double %mul,double %mul) nounwind readnone
64 %arrayidx3 = getelementptr inbounds double, double* %a, i64 1
65 %i3 = load double, double* %arrayidx3, align 8
66 %arrayidx4 = getelementptr inbounds double, double* %b, i64 1
67 %i4 = load double, double* %arrayidx4, align 8
68 %mul5 = fmul double %i3, %i4
69 %call5 = tail call double @pow(double %mul5,double %mul5) nounwind readnone
70 store double %call, double* %c, align 8
71 %arrayidx5 = getelementptr inbounds double, double* %c, i64 1
72 store double %call5, double* %arrayidx5, align 8
78 ; CHECK: call <2 x double> @llvm.exp2.v2f64
80 define void @exp2_libm(double* %a, double* %b, double* %c) {
82 %i0 = load double, double* %a, align 8
83 %i1 = load double, double* %b, align 8
84 %mul = fmul double %i0, %i1
85 %call = tail call double @exp2(double %mul) nounwind readnone
86 %arrayidx3 = getelementptr inbounds double, double* %a, i64 1
87 %i3 = load double, double* %arrayidx3, align 8
88 %arrayidx4 = getelementptr inbounds double, double* %b, i64 1
89 %i4 = load double, double* %arrayidx4, align 8
90 %mul5 = fmul double %i3, %i4
91 %call5 = tail call double @exp2(double %mul5) nounwind readnone
92 store double %call, double* %c, align 8
93 %arrayidx5 = getelementptr inbounds double, double* %c, i64 1
94 store double %call5, double* %arrayidx5, align 8
100 ; CHECK: round_custom
101 ; CHECK-NOT: load <4 x i64>
103 define void @round_custom(i64* %a, i64* %b, i64* %c) {
105 %i0 = load i64, i64* %a, align 8
106 %i1 = load i64, i64* %b, align 8
107 %mul = mul i64 %i0, %i1
108 %call = tail call i64 @round(i64 %mul) nounwind readnone
109 %arrayidx3 = getelementptr inbounds i64, i64* %a, i64 1
110 %i3 = load i64, i64* %arrayidx3, align 8
111 %arrayidx4 = getelementptr inbounds i64, i64* %b, i64 1
112 %i4 = load i64, i64* %arrayidx4, align 8
113 %mul5 = mul i64 %i3, %i4
114 %call5 = tail call i64 @round(i64 %mul5) nounwind readnone
115 store i64 %call, i64* %c, align 8
116 %arrayidx5 = getelementptr inbounds i64, i64* %c, i64 1
117 store i64 %call5, i64* %arrayidx5, align 8
122 ; CHECK: declare <2 x double> @llvm.sin.v2f64(<2 x double>) [[ATTR0:#[0-9]+]]
123 ; CHECK: declare <2 x double> @llvm.cos.v2f64(<2 x double>) [[ATTR0]]
124 ; CHECK: declare <2 x double> @llvm.pow.v2f64(<2 x double>, <2 x double>) [[ATTR0]]
125 ; CHECK: declare <2 x double> @llvm.exp2.v2f64(<2 x double>) [[ATTR0]]
127 ; CHECK: attributes [[ATTR0]] = { nounwind readnone }