brintos

brintos / llvm-project-archived public Read only

0
0
Text · 15.3 KiB · 91d5c52 Raw
489 lines · plain
1; RUN: opt -vector-library=LIBMVEC -passes=inject-tli-mappings,loop-vectorize -S < %s | FileCheck %s2 3target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"4target triple = "x86_64-unknown-linux-gnu"5 6define void @sin_f64(ptr nocapture %varray) {7; CHECK-LABEL: @sin_f64(8; CHECK-LABEL:    vector.body9; CHECK:    [[TMP5:%.*]] = call <2 x double> @_ZGVbN2v_sin(<2 x double> [[TMP4:%.*]])10;11entry:12  br label %for.body13 14for.body:15  %iv = phi i64 [ 0, %entry ], [ %iv.next, %for.body ]16  %tmp = trunc i64 %iv to i3217  %conv = sitofp i32 %tmp to double18  %call = tail call double @sin(double %conv)19  %arrayidx = getelementptr inbounds double, ptr %varray, i64 %iv20  store double %call, ptr %arrayidx, align 421  %iv.next = add nuw nsw i64 %iv, 122  %exitcond = icmp eq i64 %iv.next, 100023  br i1 %exitcond, label %for.end, label %for.body, !llvm.loop !124 25for.end:26  ret void27}28 29!1 = distinct !{!1, !2, !3}30!2 = !{!"llvm.loop.vectorize.width", i32 2}31!3 = !{!"llvm.loop.vectorize.enable", i1 true}32 33 34define void @sin_f32(ptr nocapture %varray) {35; CHECK-LABEL: @sin_f32(36; CHECK-LABEL:    vector.body37; CHECK:    [[TMP5:%.*]] = call <8 x float> @_ZGVdN8v_sinf(<8 x float> [[TMP4:%.*]])38;39entry:40  br label %for.body41 42for.body:43  %iv = phi i64 [ 0, %entry ], [ %iv.next, %for.body ]44  %tmp = trunc i64 %iv to i3245  %conv = sitofp i32 %tmp to float46  %call = tail call float @sinf(float %conv)47  %arrayidx = getelementptr inbounds float, ptr %varray, i64 %iv48  store float %call, ptr %arrayidx, align 449  %iv.next = add nuw nsw i64 %iv, 150  %exitcond = icmp eq i64 %iv.next, 100051  br i1 %exitcond, label %for.end, label %for.body, !llvm.loop !2152 53for.end:54  ret void55}56 57!21 = distinct !{!21, !22, !23}58!22 = !{!"llvm.loop.vectorize.width", i32 8}59!23 = !{!"llvm.loop.vectorize.enable", i1 true}60 61define void @sin_f64_intrinsic(ptr nocapture %varray) {62; CHECK-LABEL: @sin_f64_intrinsic(63; CHECK-LABEL:    vector.body64; CHECK:    [[TMP5:%.*]] = call <2 x double> @_ZGVbN2v_sin(<2 x double> [[TMP4:%.*]])65;66entry:67  br label %for.body68 69for.body:70  %iv = phi i64 [ 0, %entry ], [ %iv.next, %for.body ]71  %tmp = trunc i64 %iv to i3272  %conv = sitofp i32 %tmp to double73  %call = tail call double @llvm.sin.f64(double %conv)74  %arrayidx = getelementptr inbounds double, ptr %varray, i64 %iv75  store double %call, ptr %arrayidx, align 476  %iv.next = add nuw nsw i64 %iv, 177  %exitcond = icmp eq i64 %iv.next, 100078  br i1 %exitcond, label %for.end, label %for.body, !llvm.loop !3179 80for.end:81  ret void82}83 84!31 = distinct !{!31, !32, !33}85!32 = !{!"llvm.loop.vectorize.width", i32 2}86!33 = !{!"llvm.loop.vectorize.enable", i1 true}87 88define void @sin_f32_intrinsic(ptr nocapture %varray) {89; CHECK-LABEL: @sin_f32_intrinsic(90; CHECK-LABEL:    vector.body91; CHECK:    [[TMP5:%.*]] = call <8 x float> @_ZGVdN8v_sinf(<8 x float> [[TMP4:%.*]])92;93entry:94  br label %for.body95 96for.body:97  %iv = phi i64 [ 0, %entry ], [ %iv.next, %for.body ]98  %tmp = trunc i64 %iv to i3299  %conv = sitofp i32 %tmp to float100  %call = tail call float @llvm.sin.f32(float %conv)101  %arrayidx = getelementptr inbounds float, ptr %varray, i64 %iv102  store float %call, ptr %arrayidx, align 4103  %iv.next = add nuw nsw i64 %iv, 1104  %exitcond = icmp eq i64 %iv.next, 1000105  br i1 %exitcond, label %for.end, label %for.body, !llvm.loop !41106 107for.end:108  ret void109}110 111!41 = distinct !{!41, !42, !43}112!42 = !{!"llvm.loop.vectorize.width", i32 8}113!43 = !{!"llvm.loop.vectorize.enable", i1 true}114 115define void @cos_f64(ptr nocapture %varray) {116; CHECK-LABEL: @cos_f64(117; CHECK-LABEL:    vector.body118; CHECK:    [[TMP5:%.*]] = call <2 x double> @_ZGVbN2v_cos(<2 x double> [[TMP4:%.*]])119;120entry:121  br label %for.body122 123for.body:124  %iv = phi i64 [ 0, %entry ], [ %iv.next, %for.body ]125  %tmp = trunc i64 %iv to i32126  %conv = sitofp i32 %tmp to double127  %call = tail call double @cos(double %conv)128  %arrayidx = getelementptr inbounds double, ptr %varray, i64 %iv129  store double %call, ptr %arrayidx, align 4130  %iv.next = add nuw nsw i64 %iv, 1131  %exitcond = icmp eq i64 %iv.next, 1000132  br i1 %exitcond, label %for.end, label %for.body, !llvm.loop !51133 134for.end:135  ret void136}137 138!51 = distinct !{!51, !52, !53}139!52 = !{!"llvm.loop.vectorize.width", i32 2}140!53 = !{!"llvm.loop.vectorize.enable", i1 true}141 142define void @cos_f32(ptr nocapture %varray) {143; CHECK-LABEL: @cos_f32(144; CHECK-LABEL:    vector.body145; CHECK:    [[TMP5:%.*]] = call <8 x float> @_ZGVdN8v_cosf(<8 x float> [[TMP4:%.*]])146;147entry:148  br label %for.body149 150for.body:151  %iv = phi i64 [ 0, %entry ], [ %iv.next, %for.body ]152  %tmp = trunc i64 %iv to i32153  %conv = sitofp i32 %tmp to float154  %call = tail call float @cosf(float %conv)155  %arrayidx = getelementptr inbounds float, ptr %varray, i64 %iv156  store float %call, ptr %arrayidx, align 4157  %iv.next = add nuw nsw i64 %iv, 1158  %exitcond = icmp eq i64 %iv.next, 1000159  br i1 %exitcond, label %for.end, label %for.body, !llvm.loop !61160 161for.end:162  ret void163}164 165!61 = distinct !{!61, !62, !63}166!62 = !{!"llvm.loop.vectorize.width", i32 8}167!63 = !{!"llvm.loop.vectorize.enable", i1 true}168 169define void @cos_f64_intrinsic(ptr nocapture %varray) {170; CHECK-LABEL: @cos_f64_intrinsic(171; CHECK-LABEL:    vector.body172; CHECK:    [[TMP5:%.*]] = call <2 x double> @_ZGVbN2v_cos(<2 x double> [[TMP4:%.*]])173;174entry:175  br label %for.body176 177for.body:178  %iv = phi i64 [ 0, %entry ], [ %iv.next, %for.body ]179  %tmp = trunc i64 %iv to i32180  %conv = sitofp i32 %tmp to double181  %call = tail call double @llvm.cos.f64(double %conv)182  %arrayidx = getelementptr inbounds double, ptr %varray, i64 %iv183  store double %call, ptr %arrayidx, align 4184  %iv.next = add nuw nsw i64 %iv, 1185  %exitcond = icmp eq i64 %iv.next, 1000186  br i1 %exitcond, label %for.end, label %for.body, !llvm.loop !71187 188for.end:189  ret void190}191 192!71 = distinct !{!71, !72, !73}193!72 = !{!"llvm.loop.vectorize.width", i32 2}194!73 = !{!"llvm.loop.vectorize.enable", i1 true}195 196define void @cos_f32_intrinsic(ptr nocapture %varray) {197; CHECK-LABEL: @cos_f32_intrinsic(198; CHECK-LABEL:    vector.body199; CHECK:    [[TMP5:%.*]] = call <8 x float> @_ZGVdN8v_cosf(<8 x float> [[TMP4:%.*]])200;201entry:202  br label %for.body203 204for.body:205  %iv = phi i64 [ 0, %entry ], [ %iv.next, %for.body ]206  %tmp = trunc i64 %iv to i32207  %conv = sitofp i32 %tmp to float208  %call = tail call float @llvm.cos.f32(float %conv)209  %arrayidx = getelementptr inbounds float, ptr %varray, i64 %iv210  store float %call, ptr %arrayidx, align 4211  %iv.next = add nuw nsw i64 %iv, 1212  %exitcond = icmp eq i64 %iv.next, 1000213  br i1 %exitcond, label %for.end, label %for.body, !llvm.loop !81214 215for.end:216  ret void217}218 219!81 = distinct !{!81, !82, !83}220!82 = !{!"llvm.loop.vectorize.width", i32 8}221!83 = !{!"llvm.loop.vectorize.enable", i1 true}222 223 224define void @exp_f32(ptr nocapture %varray) {225; CHECK-LABEL: @exp_f32226; CHECK-LABEL:    vector.body227; CHECK: <8 x float> @_ZGVdN8v_expf228entry:229  br label %for.body230 231for.body:                                         ; preds = %for.body, %entry232  %indvars.iv = phi i64 [ 0, %entry ], [ %indvars.iv.next, %for.body ]233  %tmp = trunc i64 %indvars.iv to i32234  %conv = sitofp i32 %tmp to float235  %call = tail call fast float @expf(float %conv)236  %arrayidx = getelementptr inbounds float, ptr %varray, i64 %indvars.iv237  store float %call, ptr %arrayidx, align 4238  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1239  %exitcond = icmp eq i64 %indvars.iv.next, 1000240  br i1 %exitcond, label %for.end, label %for.body, !llvm.loop !91241 242for.end:                                          ; preds = %for.body243  ret void244}245 246!91 = distinct !{!91, !92, !93}247!92 = !{!"llvm.loop.vectorize.width", i32 8}248!93 = !{!"llvm.loop.vectorize.enable", i1 true}249 250define void @exp_f32_intrin(ptr nocapture %varray) {251; CHECK-LABEL: @exp_f32_intrin252; CHECK-LABEL: vector.body253; CHECK: <8 x float> @_ZGVdN8v_expf254entry:255  br label %for.body256 257for.body:                                         ; preds = %for.body, %entry258  %indvars.iv = phi i64 [ 0, %entry ], [ %indvars.iv.next, %for.body ]259  %tmp = trunc i64 %indvars.iv to i32260  %conv = sitofp i32 %tmp to float261  %call = tail call fast float @llvm.exp.f32(float %conv)262  %arrayidx = getelementptr inbounds float, ptr %varray, i64 %indvars.iv263  store float %call, ptr %arrayidx, align 4264  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1265  %exitcond = icmp eq i64 %indvars.iv.next, 1000266  br i1 %exitcond, label %for.end, label %for.body, !llvm.loop !101267 268for.end:                                          ; preds = %for.body269  ret void270}271 272!101 = distinct !{!101, !102, !103}273!102 = !{!"llvm.loop.vectorize.width", i32 8}274!103 = !{!"llvm.loop.vectorize.enable", i1 true}275 276 277define void @log_f32(ptr nocapture %varray) {278; CHECK-LABEL: @log_f32279; CHECK-LABEL: vector.body280; CHECK: <8 x float> @_ZGVdN8v_logf281entry:282  br label %for.body283 284for.body:                                         ; preds = %for.body, %entry285  %indvars.iv = phi i64 [ 0, %entry ], [ %indvars.iv.next, %for.body ]286  %tmp = trunc i64 %indvars.iv to i32287  %conv = sitofp i32 %tmp to float288  %call = tail call fast float @logf(float %conv)289  %arrayidx = getelementptr inbounds float, ptr %varray, i64 %indvars.iv290  store float %call, ptr %arrayidx, align 4291  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1292  %exitcond = icmp eq i64 %indvars.iv.next, 1000293  br i1 %exitcond, label %for.end, label %for.body, !llvm.loop !111294 295for.end:                                          ; preds = %for.body296  ret void297}298 299!111 = distinct !{!111, !112, !113}300!112 = !{!"llvm.loop.vectorize.width", i32 8}301!113 = !{!"llvm.loop.vectorize.enable", i1 true}302 303define void @pow_f32(ptr nocapture %varray, ptr nocapture readonly %exp) {304; CHECK-LABEL: @pow_f32305; CHECK-LABEL:    vector.body306; CHECK: <8 x float> @_ZGVdN8vv_powf307entry:308  br label %for.body309 310for.body:                                         ; preds = %for.body, %entry311  %indvars.iv = phi i64 [ 0, %entry ], [ %indvars.iv.next, %for.body ]312  %tmp = trunc i64 %indvars.iv to i32313  %conv = sitofp i32 %tmp to float314  %arrayidx = getelementptr inbounds float, ptr %exp, i64 %indvars.iv315  %tmp1 = load float, ptr %arrayidx, align 4316  %tmp2 = tail call fast float @powf(float %conv, float %tmp1)317  %arrayidx2 = getelementptr inbounds float, ptr %varray, i64 %indvars.iv318  store float %tmp2, ptr %arrayidx2, align 4319  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1320  %exitcond = icmp eq i64 %indvars.iv.next, 1000321  br i1 %exitcond, label %for.end, label %for.body, !llvm.loop !121322 323for.end:                                          ; preds = %for.body324  ret void325}326 327!121 = distinct !{!121, !122, !123}328!122 = !{!"llvm.loop.vectorize.width", i32 8}329!123 = !{!"llvm.loop.vectorize.enable", i1 true}330 331define void @pow_f32_intrin(ptr nocapture %varray, ptr nocapture readonly %exp) {332; CHECK-LABEL: @pow_f32_intrin333; CHECK-LABEL:    vector.body334; CHECK: <8 x float> @_ZGVdN8vv_powf335entry:336  br label %for.body337 338for.body:                                         ; preds = %for.body, %entry339  %indvars.iv = phi i64 [ 0, %entry ], [ %indvars.iv.next, %for.body ]340  %tmp = trunc i64 %indvars.iv to i32341  %conv = sitofp i32 %tmp to float342  %arrayidx = getelementptr inbounds float, ptr %exp, i64 %indvars.iv343  %tmp1 = load float, ptr %arrayidx, align 4344  %tmp2 = tail call fast float @llvm.pow.f32(float %conv, float %tmp1)345  %arrayidx2 = getelementptr inbounds float, ptr %varray, i64 %indvars.iv346  store float %tmp2, ptr %arrayidx2, align 4347  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1348  %exitcond = icmp eq i64 %indvars.iv.next, 1000349  br i1 %exitcond, label %for.end, label %for.body, !llvm.loop !131350 351for.end:                                          ; preds = %for.body352  ret void353}354 355!131 = distinct !{!131, !132, !133}356!132 = !{!"llvm.loop.vectorize.width", i32 8}357!133 = !{!"llvm.loop.vectorize.enable", i1 true}358 359define void @tan_f64(ptr nocapture %varray) {360; CHECK-LABEL: @tan_f64(361; CHECK-LABEL:    vector.body362; CHECK:    [[TMP5:%.*]] = call <2 x double> @_ZGVbN2v_tan(<2 x double> [[TMP4:%.*]])363;364entry:365  br label %for.body366 367for.body:368  %iv = phi i64 [ 0, %entry ], [ %iv.next, %for.body ]369  %tmp = trunc i64 %iv to i32370  %conv = sitofp i32 %tmp to double371  %call = tail call double @tan(double %conv)372  %arrayidx = getelementptr inbounds double, ptr %varray, i64 %iv373  store double %call, ptr %arrayidx, align 4374  %iv.next = add nuw nsw i64 %iv, 1375  %exitcond = icmp eq i64 %iv.next, 1000376  br i1 %exitcond, label %for.end, label %for.body, !llvm.loop !1377 378for.end:379  ret void380}381 382!141 = distinct !{!141, !142, !143}383!142 = !{!"llvm.loop.vectorize.width", i32 2}384!143 = !{!"llvm.loop.vectorize.enable", i1 true}385 386 387define void @tan_f32(ptr nocapture %varray) {388; CHECK-LABEL: @tan_f32(389; CHECK-LABEL:    vector.body390; CHECK:    [[TMP5:%.*]] = call <8 x float> @_ZGVdN8v_tanf(<8 x float> [[TMP4:%.*]])391;392entry:393  br label %for.body394 395for.body:396  %iv = phi i64 [ 0, %entry ], [ %iv.next, %for.body ]397  %tmp = trunc i64 %iv to i32398  %conv = sitofp i32 %tmp to float399  %call = tail call float @tanf(float %conv)400  %arrayidx = getelementptr inbounds float, ptr %varray, i64 %iv401  store float %call, ptr %arrayidx, align 4402  %iv.next = add nuw nsw i64 %iv, 1403  %exitcond = icmp eq i64 %iv.next, 1000404  br i1 %exitcond, label %for.end, label %for.body, !llvm.loop !21405 406for.end:407  ret void408}409 410!151 = distinct !{!151, !152, !153}411!152 = !{!"llvm.loop.vectorize.width", i32 8}412!153 = !{!"llvm.loop.vectorize.enable", i1 true}413 414define void @tan_f64_intrinsic(ptr nocapture %varray) {415; CHECK-LABEL: @tan_f64_intrinsic(416; CHECK-LABEL:    vector.body417; CHECK:    [[TMP5:%.*]] = call <2 x double> @_ZGVbN2v_tan(<2 x double> [[TMP4:%.*]])418;419entry:420  br label %for.body421 422for.body:423  %iv = phi i64 [ 0, %entry ], [ %iv.next, %for.body ]424  %tmp = trunc i64 %iv to i32425  %conv = sitofp i32 %tmp to double426  %call = tail call double @llvm.tan.f64(double %conv)427  %arrayidx = getelementptr inbounds double, ptr %varray, i64 %iv428  store double %call, ptr %arrayidx, align 4429  %iv.next = add nuw nsw i64 %iv, 1430  %exitcond = icmp eq i64 %iv.next, 1000431  br i1 %exitcond, label %for.end, label %for.body, !llvm.loop !31432 433for.end:434  ret void435}436 437!161 = distinct !{!161, !162, !163}438!162 = !{!"llvm.loop.vectorize.width", i32 2}439!163 = !{!"llvm.loop.vectorize.enable", i1 true}440 441define void @tan_f32_intrinsic(ptr nocapture %varray) {442; CHECK-LABEL: @tan_f32_intrinsic(443; CHECK-LABEL:    vector.body444; CHECK:    [[TMP5:%.*]] = call <8 x float> @_ZGVdN8v_tanf(<8 x float> [[TMP4:%.*]])445;446entry:447  br label %for.body448 449for.body:450  %iv = phi i64 [ 0, %entry ], [ %iv.next, %for.body ]451  %tmp = trunc i64 %iv to i32452  %conv = sitofp i32 %tmp to float453  %call = tail call float @llvm.tan.f32(float %conv)454  %arrayidx = getelementptr inbounds float, ptr %varray, i64 %iv455  store float %call, ptr %arrayidx, align 4456  %iv.next = add nuw nsw i64 %iv, 1457  %exitcond = icmp eq i64 %iv.next, 1000458  br i1 %exitcond, label %for.end, label %for.body, !llvm.loop !41459 460for.end:461  ret void462}463 464 465 466!171 = distinct !{!171, !172, !173}467!172 = !{!"llvm.loop.vectorize.width", i32 8}468!173 = !{!"llvm.loop.vectorize.enable", i1 true}469 470attributes #0 = { nounwind readnone }471 472declare double @sin(double) #0473declare float @sinf(float) #0474declare double @llvm.sin.f64(double) #0475declare float @llvm.sin.f32(float) #0476declare double @cos(double) #0477declare float @cosf(float) #0478declare double @llvm.cos.f64(double) #0479declare float @llvm.cos.f32(float) #0480declare double @tan(double) #0481declare float @tanf(float) #0482declare double @llvm.tan.f64(double) #0483declare float @llvm.tan.f32(float) #0484declare float @expf(float) #0485declare float @powf(float, float) #0486declare float @llvm.exp.f32(float) #0487declare float @logf(float) #0488declare float @llvm.pow.f32(float, float) #0489