1 ; RUN: opt -vector-library=LIBMVEC-X86 -passes=inject-tli-mappings,loop-vectorize -S < %s | FileCheck %s
2 target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
3 target triple = "x86_64-unknown-linux-gnu"
5 define void @exp_f32(ptr nocapture %varray) {
6 ; CHECK-LABEL: @exp_f32
7 ; CHECK-LABEL: vector.body
8 ; CHECK: <4 x float> @_ZGVbN4v___expf_finite
13 for.body: ; preds = %for.body, %entry
14 %indvars.iv = phi i64 [ 0, %entry ], [ %indvars.iv.next, %for.body ]
15 %tmp = trunc i64 %indvars.iv to i32
16 %conv = sitofp i32 %tmp to float
17 %call = tail call fast float @__expf_finite(float %conv)
18 %arrayidx = getelementptr inbounds float, ptr %varray, i64 %indvars.iv
19 store float %call, ptr %arrayidx, align 4
20 %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
21 %exitcond = icmp eq i64 %indvars.iv.next, 1000
22 br i1 %exitcond, label %for.end, label %for.body, !llvm.loop !1
24 for.end: ; preds = %for.body
28 !1 = distinct !{!1, !2, !3}
29 !2 = !{!"llvm.loop.vectorize.width", i32 4}
30 !3 = !{!"llvm.loop.vectorize.enable", i1 true}
32 define void @exp_f64(ptr nocapture %varray) {
33 ; CHECK-LABEL: @exp_f64
34 ; CHECK-LABEL: vector.body
35 ; CHECK: <4 x double> @_ZGVdN4v___exp_finite
40 for.body: ; preds = %for.body, %entry
41 %indvars.iv = phi i64 [ 0, %entry ], [ %indvars.iv.next, %for.body ]
42 %tmp = trunc i64 %indvars.iv to i32
43 %conv = sitofp i32 %tmp to double
44 %call = tail call fast double @__exp_finite(double %conv)
45 %arrayidx = getelementptr inbounds double, ptr %varray, i64 %indvars.iv
46 store double %call, ptr %arrayidx, align 4
47 %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
48 %exitcond = icmp eq i64 %indvars.iv.next, 1000
49 br i1 %exitcond, label %for.end, label %for.body, !llvm.loop !11
51 for.end: ; preds = %for.body
55 !11 = distinct !{!11, !12, !13}
56 !12 = !{!"llvm.loop.vectorize.width", i32 4}
57 !13 = !{!"llvm.loop.vectorize.enable", i1 true}
59 define void @log_f32(ptr nocapture %varray) {
60 ; CHECK-LABEL: @log_f32
61 ; CHECK-LABEL: vector.body
62 ; CHECK: <4 x float> @_ZGVbN4v___logf_finite
67 for.body: ; preds = %for.body, %entry
68 %indvars.iv = phi i64 [ 0, %entry ], [ %indvars.iv.next, %for.body ]
69 %tmp = trunc i64 %indvars.iv to i32
70 %conv = sitofp i32 %tmp to float
71 %call = tail call fast float @__logf_finite(float %conv)
72 %arrayidx = getelementptr inbounds float, ptr %varray, i64 %indvars.iv
73 store float %call, ptr %arrayidx, align 4
74 %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
75 %exitcond = icmp eq i64 %indvars.iv.next, 1000
76 br i1 %exitcond, label %for.end, label %for.body, !llvm.loop !21
78 for.end: ; preds = %for.body
82 !21 = distinct !{!21, !22, !23}
83 !22 = !{!"llvm.loop.vectorize.width", i32 4}
84 !23 = !{!"llvm.loop.vectorize.enable", i1 true}
86 define void @log_f64(ptr nocapture %varray) {
87 ; CHECK-LABEL: @log_f64
88 ; CHECK-LABEL: vector.body
89 ; CHECK: <4 x double> @_ZGVdN4v___log_finite
94 for.body: ; preds = %for.body, %entry
95 %indvars.iv = phi i64 [ 0, %entry ], [ %indvars.iv.next, %for.body ]
96 %tmp = trunc i64 %indvars.iv to i32
97 %conv = sitofp i32 %tmp to double
98 %call = tail call fast double @__log_finite(double %conv)
99 %arrayidx = getelementptr inbounds double, ptr %varray, i64 %indvars.iv
100 store double %call, ptr %arrayidx, align 4
101 %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
102 %exitcond = icmp eq i64 %indvars.iv.next, 1000
103 br i1 %exitcond, label %for.end, label %for.body, !llvm.loop !31
105 for.end: ; preds = %for.body
109 !31 = distinct !{!31, !32, !33}
110 !32 = !{!"llvm.loop.vectorize.width", i32 4}
111 !33 = !{!"llvm.loop.vectorize.enable", i1 true}
113 define void @pow_f32(ptr nocapture %varray, ptr nocapture readonly %exp) {
114 ; CHECK-LABEL: @pow_f32
115 ; CHECK-LABEL: vector.body
116 ; CHECK: <4 x float> @_ZGVbN4vv___powf_finite
121 for.body: ; preds = %for.body, %entry
122 %indvars.iv = phi i64 [ 0, %entry ], [ %indvars.iv.next, %for.body ]
123 %tmp = trunc i64 %indvars.iv to i32
124 %conv = sitofp i32 %tmp to float
125 %arrayidx = getelementptr inbounds float, ptr %exp, i64 %indvars.iv
126 %tmp1 = load float, ptr %arrayidx, align 4
127 %tmp2 = tail call fast float @__powf_finite(float %conv, float %tmp1)
128 %arrayidx2 = getelementptr inbounds float, ptr %varray, i64 %indvars.iv
129 store float %tmp2, ptr %arrayidx2, align 4
130 %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
131 %exitcond = icmp eq i64 %indvars.iv.next, 1000
132 br i1 %exitcond, label %for.end, label %for.body, !llvm.loop !41
134 for.end: ; preds = %for.body
138 !41 = distinct !{!41, !42, !43}
139 !42 = !{!"llvm.loop.vectorize.width", i32 4}
140 !43 = !{!"llvm.loop.vectorize.enable", i1 true}
142 define void @pow_f64(ptr nocapture %varray, ptr nocapture readonly %exp) {
143 ; CHECK-LABEL: @pow_f64
144 ; CHECK-LABEL: vector.body
145 ; CHECK: <4 x double> @_ZGVdN4vv___pow_finite
150 for.body: ; preds = %for.body, %entry
151 %indvars.iv = phi i64 [ 0, %entry ], [ %indvars.iv.next, %for.body ]
152 %tmp = trunc i64 %indvars.iv to i32
153 %conv = sitofp i32 %tmp to double
154 %arrayidx = getelementptr inbounds double, ptr %exp, i64 %indvars.iv
155 %tmp1 = load double, ptr %arrayidx, align 4
156 %tmp2 = tail call fast double @__pow_finite(double %conv, double %tmp1)
157 %arrayidx2 = getelementptr inbounds double, ptr %varray, i64 %indvars.iv
158 store double %tmp2, ptr %arrayidx2, align 4
159 %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
160 %exitcond = icmp eq i64 %indvars.iv.next, 1000
161 br i1 %exitcond, label %for.end, label %for.body, !llvm.loop !51
163 for.end: ; preds = %for.body
167 !51 = distinct !{!51, !52, !53}
168 !52 = !{!"llvm.loop.vectorize.width", i32 4}
169 !53 = !{!"llvm.loop.vectorize.enable", i1 true}
171 declare float @__expf_finite(float) #0
172 declare double @__exp_finite(double) #0
173 declare float @__logf_finite(float) #0
174 declare double @__log_finite(double) #0
175 declare float @__powf_finite(float, float) #0
176 declare double @__pow_finite(double, double) #0