]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - test/Transforms/SLPVectorizer/X86/call.ll
Vendor import of llvm RELEASE_350/final tag r216957 (effectively, 3.5.0 release):
[FreeBSD/FreeBSD.git] / test / Transforms / SLPVectorizer / X86 / call.ll
1 ; RUN: opt < %s -basicaa -slp-vectorizer -slp-threshold=-999 -dce -S -mtriple=x86_64-apple-macosx10.8.0 -mcpu=corei7-avx | FileCheck %s
2
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"
5
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)
11
12
13 ; CHECK: sin_libm
14 ; CHECK: call <2 x double> @llvm.sin.v2f64
15 ; CHECK: ret void
16 define void @sin_libm(double* %a, double* %b, double* %c) {
17 entry:
18   %i0 = load double* %a, align 8
19   %i1 = load 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* %a, i64 1
23   %i3 = load double* %arrayidx3, align 8
24   %arrayidx4 = getelementptr inbounds double* %b, i64 1
25   %i4 = load 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* %c, i64 1
30   store double %call5, double* %arrayidx5, align 8
31   ret void
32 }
33
34 ; CHECK: cos_libm
35 ; CHECK: call <2 x double> @llvm.cos.v2f64
36 ; CHECK: ret void
37 define void @cos_libm(double* %a, double* %b, double* %c) {
38 entry:
39   %i0 = load double* %a, align 8
40   %i1 = load 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* %a, i64 1
44   %i3 = load double* %arrayidx3, align 8
45   %arrayidx4 = getelementptr inbounds double* %b, i64 1
46   %i4 = load 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* %c, i64 1
51   store double %call5, double* %arrayidx5, align 8
52   ret void
53 }
54
55 ; CHECK: pow_libm
56 ; CHECK: call <2 x double> @llvm.pow.v2f64
57 ; CHECK: ret void
58 define void @pow_libm(double* %a, double* %b, double* %c) {
59 entry:
60   %i0 = load double* %a, align 8
61   %i1 = load 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* %a, i64 1
65   %i3 = load double* %arrayidx3, align 8
66   %arrayidx4 = getelementptr inbounds double* %b, i64 1
67   %i4 = load 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* %c, i64 1
72   store double %call5, double* %arrayidx5, align 8
73   ret void
74 }
75
76
77 ; CHECK: exp2_libm
78 ; CHECK: call <2 x double> @llvm.exp2.v2f64
79 ; CHECK: ret void
80 define void @exp2_libm(double* %a, double* %b, double* %c) {
81 entry:
82   %i0 = load double* %a, align 8
83   %i1 = load 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* %a, i64 1
87   %i3 = load double* %arrayidx3, align 8
88   %arrayidx4 = getelementptr inbounds double* %b, i64 1
89   %i4 = load 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* %c, i64 1
94   store double %call5, double* %arrayidx5, align 8
95   ret void
96 }
97
98
99 ; Negative test case
100 ; CHECK: round_custom
101 ; CHECK-NOT: load <4 x i64>
102 ; CHECK: ret void
103 define void @round_custom(i64* %a, i64* %b, i64* %c) {
104 entry:
105   %i0 = load i64* %a, align 8
106   %i1 = load 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* %a, i64 1
110   %i3 = load i64* %arrayidx3, align 8
111   %arrayidx4 = getelementptr inbounds i64* %b, i64 1
112   %i4 = load 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* %c, i64 1
117   store i64 %call5, i64* %arrayidx5, align 8
118   ret void
119 }
120
121
122 ; CHECK: declare <2 x double> @llvm.sin.v2f64(<2 x double>) #0
123 ; CHECK: declare <2 x double> @llvm.cos.v2f64(<2 x double>) #0
124 ; CHECK: declare <2 x double> @llvm.pow.v2f64(<2 x double>, <2 x double>) #0
125 ; CHECK: declare <2 x double> @llvm.exp2.v2f64(<2 x double>) #0
126
127 ; CHECK: attributes #0 = { nounwind readnone }
128