1; NOTE: Assertions have been autogenerated by utils/update_test_checks.py 2; RUN: opt -vector-library=LIBMVEC-X86 -inject-tli-mappings -loop-vectorize -S < %s | FileCheck %s 3 4target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" 5target triple = "x86_64-unknown-linux-gnu" 6 7define void @sin_f64(double* nocapture %varray) { 8; CHECK-LABEL: @sin_f64( 9; CHECK-NEXT: entry: 10; CHECK-NEXT: br i1 false, label [[SCALAR_PH:%.*]], label [[VECTOR_PH:%.*]] 11; CHECK: vector.ph: 12; CHECK-NEXT: br label [[VECTOR_BODY:%.*]] 13; CHECK: vector.body: 14; CHECK-NEXT: [[INDEX:%.*]] = phi i64 [ 0, [[VECTOR_PH]] ], [ [[INDEX_NEXT:%.*]], [[VECTOR_BODY]] ] 15; CHECK-NEXT: [[VEC_IND:%.*]] = phi <4 x i32> [ <i32 0, i32 1, i32 2, i32 3>, [[VECTOR_PH]] ], [ [[VEC_IND_NEXT:%.*]], [[VECTOR_BODY]] ] 16; CHECK-NEXT: [[TMP0:%.*]] = add i64 [[INDEX]], 0 17; CHECK-NEXT: [[TMP1:%.*]] = sitofp <4 x i32> [[VEC_IND]] to <4 x double> 18; CHECK-NEXT: [[TMP2:%.*]] = call <4 x double> @_ZGVdN4v_sin(<4 x double> [[TMP1]]) 19; CHECK-NEXT: [[TMP3:%.*]] = getelementptr inbounds double, double* [[VARRAY:%.*]], i64 [[TMP0]] 20; CHECK-NEXT: [[TMP4:%.*]] = getelementptr inbounds double, double* [[TMP3]], i32 0 21; CHECK-NEXT: [[TMP5:%.*]] = bitcast double* [[TMP4]] to <4 x double>* 22; CHECK-NEXT: store <4 x double> [[TMP2]], <4 x double>* [[TMP5]], align 4 23; CHECK-NEXT: [[INDEX_NEXT]] = add nuw i64 [[INDEX]], 4 24; CHECK-NEXT: [[VEC_IND_NEXT]] = add <4 x i32> [[VEC_IND]], <i32 4, i32 4, i32 4, i32 4> 25; CHECK-NEXT: [[TMP6:%.*]] = icmp eq i64 [[INDEX_NEXT]], 1000 26; CHECK-NEXT: br i1 [[TMP6]], label [[MIDDLE_BLOCK:%.*]], label [[VECTOR_BODY]], !llvm.loop [[LOOP0:![0-9]+]] 27; CHECK: middle.block: 28; CHECK-NEXT: [[CMP_N:%.*]] = icmp eq i64 1000, 1000 29; CHECK-NEXT: br i1 [[CMP_N]], label [[FOR_END:%.*]], label [[SCALAR_PH]] 30; CHECK: scalar.ph: 31; CHECK-NEXT: [[BC_RESUME_VAL:%.*]] = phi i64 [ 1000, [[MIDDLE_BLOCK]] ], [ 0, [[ENTRY:%.*]] ] 32; CHECK-NEXT: br label [[FOR_BODY:%.*]] 33; CHECK: for.body: 34; CHECK-NEXT: [[IV:%.*]] = phi i64 [ [[BC_RESUME_VAL]], [[SCALAR_PH]] ], [ [[IV_NEXT:%.*]], [[FOR_BODY]] ] 35; CHECK-NEXT: [[TMP:%.*]] = trunc i64 [[IV]] to i32 36; CHECK-NEXT: [[CONV:%.*]] = sitofp i32 [[TMP]] to double 37; CHECK-NEXT: [[CALL:%.*]] = tail call double @sin(double [[CONV]]) #[[ATTR2:[0-9]+]] 38; CHECK-NEXT: [[ARRAYIDX:%.*]] = getelementptr inbounds double, double* [[VARRAY]], i64 [[IV]] 39; CHECK-NEXT: store double [[CALL]], double* [[ARRAYIDX]], align 4 40; CHECK-NEXT: [[IV_NEXT]] = add nuw nsw i64 [[IV]], 1 41; CHECK-NEXT: [[EXITCOND:%.*]] = icmp eq i64 [[IV_NEXT]], 1000 42; CHECK-NEXT: br i1 [[EXITCOND]], label [[FOR_END]], label [[FOR_BODY]], !llvm.loop [[LOOP2:![0-9]+]] 43; CHECK: for.end: 44; CHECK-NEXT: ret void 45; 46entry: 47 br label %for.body 48 49for.body: 50 %iv = phi i64 [ 0, %entry ], [ %iv.next, %for.body ] 51 %tmp = trunc i64 %iv to i32 52 %conv = sitofp i32 %tmp to double 53 %call = tail call double @sin(double %conv) 54 %arrayidx = getelementptr inbounds double, double* %varray, i64 %iv 55 store double %call, double* %arrayidx, align 4 56 %iv.next = add nuw nsw i64 %iv, 1 57 %exitcond = icmp eq i64 %iv.next, 1000 58 br i1 %exitcond, label %for.end, label %for.body, !llvm.loop !1 59 60for.end: 61 ret void 62} 63 64!1 = distinct !{!1, !2, !3} 65!2 = !{!"llvm.loop.vectorize.width", i32 4} 66!3 = !{!"llvm.loop.vectorize.enable", i1 true} 67 68 69define void @sin_f32(float* nocapture %varray) { 70; CHECK-LABEL: @sin_f32( 71; CHECK-NEXT: entry: 72; CHECK-NEXT: br i1 false, label [[SCALAR_PH:%.*]], label [[VECTOR_PH:%.*]] 73; CHECK: vector.ph: 74; CHECK-NEXT: br label [[VECTOR_BODY:%.*]] 75; CHECK: vector.body: 76; CHECK-NEXT: [[INDEX:%.*]] = phi i64 [ 0, [[VECTOR_PH]] ], [ [[INDEX_NEXT:%.*]], [[VECTOR_BODY]] ] 77; CHECK-NEXT: [[VEC_IND:%.*]] = phi <4 x i32> [ <i32 0, i32 1, i32 2, i32 3>, [[VECTOR_PH]] ], [ [[VEC_IND_NEXT:%.*]], [[VECTOR_BODY]] ] 78; CHECK-NEXT: [[STEP_ADD:%.*]] = add <4 x i32> [[VEC_IND]], <i32 4, i32 4, i32 4, i32 4> 79; CHECK-NEXT: [[TMP0:%.*]] = add i64 [[INDEX]], 0 80; CHECK-NEXT: [[TMP1:%.*]] = add i64 [[INDEX]], 4 81; CHECK-NEXT: [[TMP2:%.*]] = sitofp <4 x i32> [[VEC_IND]] to <4 x float> 82; CHECK-NEXT: [[TMP3:%.*]] = sitofp <4 x i32> [[STEP_ADD]] to <4 x float> 83; CHECK-NEXT: [[TMP4:%.*]] = call <4 x float> @_ZGVbN4v_sinf(<4 x float> [[TMP2]]) 84; CHECK-NEXT: [[TMP5:%.*]] = call <4 x float> @_ZGVbN4v_sinf(<4 x float> [[TMP3]]) 85; CHECK-NEXT: [[TMP6:%.*]] = getelementptr inbounds float, float* [[VARRAY:%.*]], i64 [[TMP0]] 86; CHECK-NEXT: [[TMP7:%.*]] = getelementptr inbounds float, float* [[VARRAY]], i64 [[TMP1]] 87; CHECK-NEXT: [[TMP8:%.*]] = getelementptr inbounds float, float* [[TMP6]], i32 0 88; CHECK-NEXT: [[TMP9:%.*]] = bitcast float* [[TMP8]] to <4 x float>* 89; CHECK-NEXT: store <4 x float> [[TMP4]], <4 x float>* [[TMP9]], align 4 90; CHECK-NEXT: [[TMP10:%.*]] = getelementptr inbounds float, float* [[TMP6]], i32 4 91; CHECK-NEXT: [[TMP11:%.*]] = bitcast float* [[TMP10]] to <4 x float>* 92; CHECK-NEXT: store <4 x float> [[TMP5]], <4 x float>* [[TMP11]], align 4 93; CHECK-NEXT: [[INDEX_NEXT]] = add nuw i64 [[INDEX]], 8 94; CHECK-NEXT: [[VEC_IND_NEXT]] = add <4 x i32> [[STEP_ADD]], <i32 4, i32 4, i32 4, i32 4> 95; CHECK-NEXT: [[TMP12:%.*]] = icmp eq i64 [[INDEX_NEXT]], 1000 96; CHECK-NEXT: br i1 [[TMP12]], label [[MIDDLE_BLOCK:%.*]], label [[VECTOR_BODY]], !llvm.loop [[LOOP4:![0-9]+]] 97; CHECK: middle.block: 98; CHECK-NEXT: [[CMP_N:%.*]] = icmp eq i64 1000, 1000 99; CHECK-NEXT: br i1 [[CMP_N]], label [[FOR_END:%.*]], label [[SCALAR_PH]] 100; CHECK: scalar.ph: 101; CHECK-NEXT: [[BC_RESUME_VAL:%.*]] = phi i64 [ 1000, [[MIDDLE_BLOCK]] ], [ 0, [[ENTRY:%.*]] ] 102; CHECK-NEXT: br label [[FOR_BODY:%.*]] 103; CHECK: for.body: 104; CHECK-NEXT: [[IV:%.*]] = phi i64 [ [[BC_RESUME_VAL]], [[SCALAR_PH]] ], [ [[IV_NEXT:%.*]], [[FOR_BODY]] ] 105; CHECK-NEXT: [[TMP:%.*]] = trunc i64 [[IV]] to i32 106; CHECK-NEXT: [[CONV:%.*]] = sitofp i32 [[TMP]] to float 107; CHECK-NEXT: [[CALL:%.*]] = tail call float @sinf(float [[CONV]]) #[[ATTR3:[0-9]+]] 108; CHECK-NEXT: [[ARRAYIDX:%.*]] = getelementptr inbounds float, float* [[VARRAY]], i64 [[IV]] 109; CHECK-NEXT: store float [[CALL]], float* [[ARRAYIDX]], align 4 110; CHECK-NEXT: [[IV_NEXT]] = add nuw nsw i64 [[IV]], 1 111; CHECK-NEXT: [[EXITCOND:%.*]] = icmp eq i64 [[IV_NEXT]], 1000 112; CHECK-NEXT: br i1 [[EXITCOND]], label [[FOR_END]], label [[FOR_BODY]], !llvm.loop [[LOOP5:![0-9]+]] 113; CHECK: for.end: 114; CHECK-NEXT: ret void 115; 116entry: 117 br label %for.body 118 119for.body: 120 %iv = phi i64 [ 0, %entry ], [ %iv.next, %for.body ] 121 %tmp = trunc i64 %iv to i32 122 %conv = sitofp i32 %tmp to float 123 %call = tail call float @sinf(float %conv) 124 %arrayidx = getelementptr inbounds float, float* %varray, i64 %iv 125 store float %call, float* %arrayidx, align 4 126 %iv.next = add nuw nsw i64 %iv, 1 127 %exitcond = icmp eq i64 %iv.next, 1000 128 br i1 %exitcond, label %for.end, label %for.body, !llvm.loop !21 129 130for.end: 131 ret void 132} 133 134!21 = distinct !{!21, !22, !23} 135!22 = !{!"llvm.loop.vectorize.width", i32 4} 136!23 = !{!"llvm.loop.vectorize.enable", i1 true} 137 138define void @sin_f64_intrinsic(double* nocapture %varray) { 139; CHECK-LABEL: @sin_f64_intrinsic( 140; CHECK-NEXT: entry: 141; CHECK-NEXT: br i1 false, label [[SCALAR_PH:%.*]], label [[VECTOR_PH:%.*]] 142; CHECK: vector.ph: 143; CHECK-NEXT: br label [[VECTOR_BODY:%.*]] 144; CHECK: vector.body: 145; CHECK-NEXT: [[INDEX:%.*]] = phi i64 [ 0, [[VECTOR_PH]] ], [ [[INDEX_NEXT:%.*]], [[VECTOR_BODY]] ] 146; CHECK-NEXT: [[VEC_IND:%.*]] = phi <4 x i32> [ <i32 0, i32 1, i32 2, i32 3>, [[VECTOR_PH]] ], [ [[VEC_IND_NEXT:%.*]], [[VECTOR_BODY]] ] 147; CHECK-NEXT: [[TMP0:%.*]] = add i64 [[INDEX]], 0 148; CHECK-NEXT: [[TMP1:%.*]] = sitofp <4 x i32> [[VEC_IND]] to <4 x double> 149; CHECK-NEXT: [[TMP2:%.*]] = call <4 x double> @_ZGVdN4v_sin(<4 x double> [[TMP1]]) 150; CHECK-NEXT: [[TMP3:%.*]] = getelementptr inbounds double, double* [[VARRAY:%.*]], i64 [[TMP0]] 151; CHECK-NEXT: [[TMP4:%.*]] = getelementptr inbounds double, double* [[TMP3]], i32 0 152; CHECK-NEXT: [[TMP5:%.*]] = bitcast double* [[TMP4]] to <4 x double>* 153; CHECK-NEXT: store <4 x double> [[TMP2]], <4 x double>* [[TMP5]], align 4 154; CHECK-NEXT: [[INDEX_NEXT]] = add nuw i64 [[INDEX]], 4 155; CHECK-NEXT: [[VEC_IND_NEXT]] = add <4 x i32> [[VEC_IND]], <i32 4, i32 4, i32 4, i32 4> 156; CHECK-NEXT: [[TMP6:%.*]] = icmp eq i64 [[INDEX_NEXT]], 1000 157; CHECK-NEXT: br i1 [[TMP6]], label [[MIDDLE_BLOCK:%.*]], label [[VECTOR_BODY]], !llvm.loop [[LOOP6:![0-9]+]] 158; CHECK: middle.block: 159; CHECK-NEXT: [[CMP_N:%.*]] = icmp eq i64 1000, 1000 160; CHECK-NEXT: br i1 [[CMP_N]], label [[FOR_END:%.*]], label [[SCALAR_PH]] 161; CHECK: scalar.ph: 162; CHECK-NEXT: [[BC_RESUME_VAL:%.*]] = phi i64 [ 1000, [[MIDDLE_BLOCK]] ], [ 0, [[ENTRY:%.*]] ] 163; CHECK-NEXT: br label [[FOR_BODY:%.*]] 164; CHECK: for.body: 165; CHECK-NEXT: [[IV:%.*]] = phi i64 [ [[BC_RESUME_VAL]], [[SCALAR_PH]] ], [ [[IV_NEXT:%.*]], [[FOR_BODY]] ] 166; CHECK-NEXT: [[TMP:%.*]] = trunc i64 [[IV]] to i32 167; CHECK-NEXT: [[CONV:%.*]] = sitofp i32 [[TMP]] to double 168; CHECK-NEXT: [[CALL:%.*]] = tail call double @llvm.sin.f64(double [[CONV]]) #[[ATTR4:[0-9]+]] 169; CHECK-NEXT: [[ARRAYIDX:%.*]] = getelementptr inbounds double, double* [[VARRAY]], i64 [[IV]] 170; CHECK-NEXT: store double [[CALL]], double* [[ARRAYIDX]], align 4 171; CHECK-NEXT: [[IV_NEXT]] = add nuw nsw i64 [[IV]], 1 172; CHECK-NEXT: [[EXITCOND:%.*]] = icmp eq i64 [[IV_NEXT]], 1000 173; CHECK-NEXT: br i1 [[EXITCOND]], label [[FOR_END]], label [[FOR_BODY]], !llvm.loop [[LOOP7:![0-9]+]] 174; CHECK: for.end: 175; CHECK-NEXT: ret void 176; 177entry: 178 br label %for.body 179 180for.body: 181 %iv = phi i64 [ 0, %entry ], [ %iv.next, %for.body ] 182 %tmp = trunc i64 %iv to i32 183 %conv = sitofp i32 %tmp to double 184 %call = tail call double @llvm.sin.f64(double %conv) 185 %arrayidx = getelementptr inbounds double, double* %varray, i64 %iv 186 store double %call, double* %arrayidx, align 4 187 %iv.next = add nuw nsw i64 %iv, 1 188 %exitcond = icmp eq i64 %iv.next, 1000 189 br i1 %exitcond, label %for.end, label %for.body, !llvm.loop !31 190 191for.end: 192 ret void 193} 194 195!31 = distinct !{!31, !32, !33} 196!32 = !{!"llvm.loop.vectorize.width", i32 4} 197!33 = !{!"llvm.loop.vectorize.enable", i1 true} 198 199define void @sin_f32_intrinsic(float* nocapture %varray) { 200; CHECK-LABEL: @sin_f32_intrinsic( 201; CHECK-NEXT: entry: 202; CHECK-NEXT: br i1 false, label [[SCALAR_PH:%.*]], label [[VECTOR_PH:%.*]] 203; CHECK: vector.ph: 204; CHECK-NEXT: br label [[VECTOR_BODY:%.*]] 205; CHECK: vector.body: 206; CHECK-NEXT: [[INDEX:%.*]] = phi i64 [ 0, [[VECTOR_PH]] ], [ [[INDEX_NEXT:%.*]], [[VECTOR_BODY]] ] 207; CHECK-NEXT: [[VEC_IND:%.*]] = phi <4 x i32> [ <i32 0, i32 1, i32 2, i32 3>, [[VECTOR_PH]] ], [ [[VEC_IND_NEXT:%.*]], [[VECTOR_BODY]] ] 208; CHECK-NEXT: [[STEP_ADD:%.*]] = add <4 x i32> [[VEC_IND]], <i32 4, i32 4, i32 4, i32 4> 209; CHECK-NEXT: [[TMP0:%.*]] = add i64 [[INDEX]], 0 210; CHECK-NEXT: [[TMP1:%.*]] = add i64 [[INDEX]], 4 211; CHECK-NEXT: [[TMP2:%.*]] = sitofp <4 x i32> [[VEC_IND]] to <4 x float> 212; CHECK-NEXT: [[TMP3:%.*]] = sitofp <4 x i32> [[STEP_ADD]] to <4 x float> 213; CHECK-NEXT: [[TMP4:%.*]] = call <4 x float> @_ZGVbN4v_sinf(<4 x float> [[TMP2]]) 214; CHECK-NEXT: [[TMP5:%.*]] = call <4 x float> @_ZGVbN4v_sinf(<4 x float> [[TMP3]]) 215; CHECK-NEXT: [[TMP6:%.*]] = getelementptr inbounds float, float* [[VARRAY:%.*]], i64 [[TMP0]] 216; CHECK-NEXT: [[TMP7:%.*]] = getelementptr inbounds float, float* [[VARRAY]], i64 [[TMP1]] 217; CHECK-NEXT: [[TMP8:%.*]] = getelementptr inbounds float, float* [[TMP6]], i32 0 218; CHECK-NEXT: [[TMP9:%.*]] = bitcast float* [[TMP8]] to <4 x float>* 219; CHECK-NEXT: store <4 x float> [[TMP4]], <4 x float>* [[TMP9]], align 4 220; CHECK-NEXT: [[TMP10:%.*]] = getelementptr inbounds float, float* [[TMP6]], i32 4 221; CHECK-NEXT: [[TMP11:%.*]] = bitcast float* [[TMP10]] to <4 x float>* 222; CHECK-NEXT: store <4 x float> [[TMP5]], <4 x float>* [[TMP11]], align 4 223; CHECK-NEXT: [[INDEX_NEXT]] = add nuw i64 [[INDEX]], 8 224; CHECK-NEXT: [[VEC_IND_NEXT]] = add <4 x i32> [[STEP_ADD]], <i32 4, i32 4, i32 4, i32 4> 225; CHECK-NEXT: [[TMP12:%.*]] = icmp eq i64 [[INDEX_NEXT]], 1000 226; CHECK-NEXT: br i1 [[TMP12]], label [[MIDDLE_BLOCK:%.*]], label [[VECTOR_BODY]], !llvm.loop [[LOOP8:![0-9]+]] 227; CHECK: middle.block: 228; CHECK-NEXT: [[CMP_N:%.*]] = icmp eq i64 1000, 1000 229; CHECK-NEXT: br i1 [[CMP_N]], label [[FOR_END:%.*]], label [[SCALAR_PH]] 230; CHECK: scalar.ph: 231; CHECK-NEXT: [[BC_RESUME_VAL:%.*]] = phi i64 [ 1000, [[MIDDLE_BLOCK]] ], [ 0, [[ENTRY:%.*]] ] 232; CHECK-NEXT: br label [[FOR_BODY:%.*]] 233; CHECK: for.body: 234; CHECK-NEXT: [[IV:%.*]] = phi i64 [ [[BC_RESUME_VAL]], [[SCALAR_PH]] ], [ [[IV_NEXT:%.*]], [[FOR_BODY]] ] 235; CHECK-NEXT: [[TMP:%.*]] = trunc i64 [[IV]] to i32 236; CHECK-NEXT: [[CONV:%.*]] = sitofp i32 [[TMP]] to float 237; CHECK-NEXT: [[CALL:%.*]] = tail call float @llvm.sin.f32(float [[CONV]]) #[[ATTR5:[0-9]+]] 238; CHECK-NEXT: [[ARRAYIDX:%.*]] = getelementptr inbounds float, float* [[VARRAY]], i64 [[IV]] 239; CHECK-NEXT: store float [[CALL]], float* [[ARRAYIDX]], align 4 240; CHECK-NEXT: [[IV_NEXT]] = add nuw nsw i64 [[IV]], 1 241; CHECK-NEXT: [[EXITCOND:%.*]] = icmp eq i64 [[IV_NEXT]], 1000 242; CHECK-NEXT: br i1 [[EXITCOND]], label [[FOR_END]], label [[FOR_BODY]], !llvm.loop [[LOOP9:![0-9]+]] 243; CHECK: for.end: 244; CHECK-NEXT: ret void 245; 246entry: 247 br label %for.body 248 249for.body: 250 %iv = phi i64 [ 0, %entry ], [ %iv.next, %for.body ] 251 %tmp = trunc i64 %iv to i32 252 %conv = sitofp i32 %tmp to float 253 %call = tail call float @llvm.sin.f32(float %conv) 254 %arrayidx = getelementptr inbounds float, float* %varray, i64 %iv 255 store float %call, float* %arrayidx, align 4 256 %iv.next = add nuw nsw i64 %iv, 1 257 %exitcond = icmp eq i64 %iv.next, 1000 258 br i1 %exitcond, label %for.end, label %for.body, !llvm.loop !41 259 260for.end: 261 ret void 262} 263 264!41 = distinct !{!41, !42, !43} 265!42 = !{!"llvm.loop.vectorize.width", i32 4} 266!43 = !{!"llvm.loop.vectorize.enable", i1 true} 267 268define void @cos_f64(double* nocapture %varray) { 269; CHECK-LABEL: @cos_f64( 270; CHECK-NEXT: entry: 271; CHECK-NEXT: br i1 false, label [[SCALAR_PH:%.*]], label [[VECTOR_PH:%.*]] 272; CHECK: vector.ph: 273; CHECK-NEXT: br label [[VECTOR_BODY:%.*]] 274; CHECK: vector.body: 275; CHECK-NEXT: [[INDEX:%.*]] = phi i64 [ 0, [[VECTOR_PH]] ], [ [[INDEX_NEXT:%.*]], [[VECTOR_BODY]] ] 276; CHECK-NEXT: [[VEC_IND:%.*]] = phi <4 x i32> [ <i32 0, i32 1, i32 2, i32 3>, [[VECTOR_PH]] ], [ [[VEC_IND_NEXT:%.*]], [[VECTOR_BODY]] ] 277; CHECK-NEXT: [[TMP0:%.*]] = add i64 [[INDEX]], 0 278; CHECK-NEXT: [[TMP1:%.*]] = sitofp <4 x i32> [[VEC_IND]] to <4 x double> 279; CHECK-NEXT: [[TMP2:%.*]] = call <4 x double> @_ZGVdN4v_cos(<4 x double> [[TMP1]]) 280; CHECK-NEXT: [[TMP3:%.*]] = getelementptr inbounds double, double* [[VARRAY:%.*]], i64 [[TMP0]] 281; CHECK-NEXT: [[TMP4:%.*]] = getelementptr inbounds double, double* [[TMP3]], i32 0 282; CHECK-NEXT: [[TMP5:%.*]] = bitcast double* [[TMP4]] to <4 x double>* 283; CHECK-NEXT: store <4 x double> [[TMP2]], <4 x double>* [[TMP5]], align 4 284; CHECK-NEXT: [[INDEX_NEXT]] = add nuw i64 [[INDEX]], 4 285; CHECK-NEXT: [[VEC_IND_NEXT]] = add <4 x i32> [[VEC_IND]], <i32 4, i32 4, i32 4, i32 4> 286; CHECK-NEXT: [[TMP6:%.*]] = icmp eq i64 [[INDEX_NEXT]], 1000 287; CHECK-NEXT: br i1 [[TMP6]], label [[MIDDLE_BLOCK:%.*]], label [[VECTOR_BODY]], !llvm.loop [[LOOP10:![0-9]+]] 288; CHECK: middle.block: 289; CHECK-NEXT: [[CMP_N:%.*]] = icmp eq i64 1000, 1000 290; CHECK-NEXT: br i1 [[CMP_N]], label [[FOR_END:%.*]], label [[SCALAR_PH]] 291; CHECK: scalar.ph: 292; CHECK-NEXT: [[BC_RESUME_VAL:%.*]] = phi i64 [ 1000, [[MIDDLE_BLOCK]] ], [ 0, [[ENTRY:%.*]] ] 293; CHECK-NEXT: br label [[FOR_BODY:%.*]] 294; CHECK: for.body: 295; CHECK-NEXT: [[IV:%.*]] = phi i64 [ [[BC_RESUME_VAL]], [[SCALAR_PH]] ], [ [[IV_NEXT:%.*]], [[FOR_BODY]] ] 296; CHECK-NEXT: [[TMP:%.*]] = trunc i64 [[IV]] to i32 297; CHECK-NEXT: [[CONV:%.*]] = sitofp i32 [[TMP]] to double 298; CHECK-NEXT: [[CALL:%.*]] = tail call double @cos(double [[CONV]]) #[[ATTR6:[0-9]+]] 299; CHECK-NEXT: [[ARRAYIDX:%.*]] = getelementptr inbounds double, double* [[VARRAY]], i64 [[IV]] 300; CHECK-NEXT: store double [[CALL]], double* [[ARRAYIDX]], align 4 301; CHECK-NEXT: [[IV_NEXT]] = add nuw nsw i64 [[IV]], 1 302; CHECK-NEXT: [[EXITCOND:%.*]] = icmp eq i64 [[IV_NEXT]], 1000 303; CHECK-NEXT: br i1 [[EXITCOND]], label [[FOR_END]], label [[FOR_BODY]], !llvm.loop [[LOOP11:![0-9]+]] 304; CHECK: for.end: 305; CHECK-NEXT: ret void 306; 307entry: 308 br label %for.body 309 310for.body: 311 %iv = phi i64 [ 0, %entry ], [ %iv.next, %for.body ] 312 %tmp = trunc i64 %iv to i32 313 %conv = sitofp i32 %tmp to double 314 %call = tail call double @cos(double %conv) 315 %arrayidx = getelementptr inbounds double, double* %varray, i64 %iv 316 store double %call, double* %arrayidx, align 4 317 %iv.next = add nuw nsw i64 %iv, 1 318 %exitcond = icmp eq i64 %iv.next, 1000 319 br i1 %exitcond, label %for.end, label %for.body, !llvm.loop !51 320 321for.end: 322 ret void 323} 324 325!51 = distinct !{!51, !52, !53} 326!52 = !{!"llvm.loop.vectorize.width", i32 4} 327!53 = !{!"llvm.loop.vectorize.enable", i1 true} 328 329define void @cos_f32(float* nocapture %varray) { 330; CHECK-LABEL: @cos_f32( 331; CHECK-NEXT: entry: 332; CHECK-NEXT: br i1 false, label [[SCALAR_PH:%.*]], label [[VECTOR_PH:%.*]] 333; CHECK: vector.ph: 334; CHECK-NEXT: br label [[VECTOR_BODY:%.*]] 335; CHECK: vector.body: 336; CHECK-NEXT: [[INDEX:%.*]] = phi i64 [ 0, [[VECTOR_PH]] ], [ [[INDEX_NEXT:%.*]], [[VECTOR_BODY]] ] 337; CHECK-NEXT: [[VEC_IND:%.*]] = phi <4 x i32> [ <i32 0, i32 1, i32 2, i32 3>, [[VECTOR_PH]] ], [ [[VEC_IND_NEXT:%.*]], [[VECTOR_BODY]] ] 338; CHECK-NEXT: [[STEP_ADD:%.*]] = add <4 x i32> [[VEC_IND]], <i32 4, i32 4, i32 4, i32 4> 339; CHECK-NEXT: [[TMP0:%.*]] = add i64 [[INDEX]], 0 340; CHECK-NEXT: [[TMP1:%.*]] = add i64 [[INDEX]], 4 341; CHECK-NEXT: [[TMP2:%.*]] = sitofp <4 x i32> [[VEC_IND]] to <4 x float> 342; CHECK-NEXT: [[TMP3:%.*]] = sitofp <4 x i32> [[STEP_ADD]] to <4 x float> 343; CHECK-NEXT: [[TMP4:%.*]] = call <4 x float> @_ZGVbN4v_cosf(<4 x float> [[TMP2]]) 344; CHECK-NEXT: [[TMP5:%.*]] = call <4 x float> @_ZGVbN4v_cosf(<4 x float> [[TMP3]]) 345; CHECK-NEXT: [[TMP6:%.*]] = getelementptr inbounds float, float* [[VARRAY:%.*]], i64 [[TMP0]] 346; CHECK-NEXT: [[TMP7:%.*]] = getelementptr inbounds float, float* [[VARRAY]], i64 [[TMP1]] 347; CHECK-NEXT: [[TMP8:%.*]] = getelementptr inbounds float, float* [[TMP6]], i32 0 348; CHECK-NEXT: [[TMP9:%.*]] = bitcast float* [[TMP8]] to <4 x float>* 349; CHECK-NEXT: store <4 x float> [[TMP4]], <4 x float>* [[TMP9]], align 4 350; CHECK-NEXT: [[TMP10:%.*]] = getelementptr inbounds float, float* [[TMP6]], i32 4 351; CHECK-NEXT: [[TMP11:%.*]] = bitcast float* [[TMP10]] to <4 x float>* 352; CHECK-NEXT: store <4 x float> [[TMP5]], <4 x float>* [[TMP11]], align 4 353; CHECK-NEXT: [[INDEX_NEXT]] = add nuw i64 [[INDEX]], 8 354; CHECK-NEXT: [[VEC_IND_NEXT]] = add <4 x i32> [[STEP_ADD]], <i32 4, i32 4, i32 4, i32 4> 355; CHECK-NEXT: [[TMP12:%.*]] = icmp eq i64 [[INDEX_NEXT]], 1000 356; CHECK-NEXT: br i1 [[TMP12]], label [[MIDDLE_BLOCK:%.*]], label [[VECTOR_BODY]], !llvm.loop [[LOOP12:![0-9]+]] 357; CHECK: middle.block: 358; CHECK-NEXT: [[CMP_N:%.*]] = icmp eq i64 1000, 1000 359; CHECK-NEXT: br i1 [[CMP_N]], label [[FOR_END:%.*]], label [[SCALAR_PH]] 360; CHECK: scalar.ph: 361; CHECK-NEXT: [[BC_RESUME_VAL:%.*]] = phi i64 [ 1000, [[MIDDLE_BLOCK]] ], [ 0, [[ENTRY:%.*]] ] 362; CHECK-NEXT: br label [[FOR_BODY:%.*]] 363; CHECK: for.body: 364; CHECK-NEXT: [[IV:%.*]] = phi i64 [ [[BC_RESUME_VAL]], [[SCALAR_PH]] ], [ [[IV_NEXT:%.*]], [[FOR_BODY]] ] 365; CHECK-NEXT: [[TMP:%.*]] = trunc i64 [[IV]] to i32 366; CHECK-NEXT: [[CONV:%.*]] = sitofp i32 [[TMP]] to float 367; CHECK-NEXT: [[CALL:%.*]] = tail call float @cosf(float [[CONV]]) #[[ATTR7:[0-9]+]] 368; CHECK-NEXT: [[ARRAYIDX:%.*]] = getelementptr inbounds float, float* [[VARRAY]], i64 [[IV]] 369; CHECK-NEXT: store float [[CALL]], float* [[ARRAYIDX]], align 4 370; CHECK-NEXT: [[IV_NEXT]] = add nuw nsw i64 [[IV]], 1 371; CHECK-NEXT: [[EXITCOND:%.*]] = icmp eq i64 [[IV_NEXT]], 1000 372; CHECK-NEXT: br i1 [[EXITCOND]], label [[FOR_END]], label [[FOR_BODY]], !llvm.loop [[LOOP13:![0-9]+]] 373; CHECK: for.end: 374; CHECK-NEXT: ret void 375; 376entry: 377 br label %for.body 378 379for.body: 380 %iv = phi i64 [ 0, %entry ], [ %iv.next, %for.body ] 381 %tmp = trunc i64 %iv to i32 382 %conv = sitofp i32 %tmp to float 383 %call = tail call float @cosf(float %conv) 384 %arrayidx = getelementptr inbounds float, float* %varray, i64 %iv 385 store float %call, float* %arrayidx, align 4 386 %iv.next = add nuw nsw i64 %iv, 1 387 %exitcond = icmp eq i64 %iv.next, 1000 388 br i1 %exitcond, label %for.end, label %for.body, !llvm.loop !61 389 390for.end: 391 ret void 392} 393 394!61 = distinct !{!61, !62, !63} 395!62 = !{!"llvm.loop.vectorize.width", i32 4} 396!63 = !{!"llvm.loop.vectorize.enable", i1 true} 397 398define void @cos_f64_intrinsic(double* nocapture %varray) { 399; CHECK-LABEL: @cos_f64_intrinsic( 400; CHECK-NEXT: entry: 401; CHECK-NEXT: br i1 false, label [[SCALAR_PH:%.*]], label [[VECTOR_PH:%.*]] 402; CHECK: vector.ph: 403; CHECK-NEXT: br label [[VECTOR_BODY:%.*]] 404; CHECK: vector.body: 405; CHECK-NEXT: [[INDEX:%.*]] = phi i64 [ 0, [[VECTOR_PH]] ], [ [[INDEX_NEXT:%.*]], [[VECTOR_BODY]] ] 406; CHECK-NEXT: [[VEC_IND:%.*]] = phi <4 x i32> [ <i32 0, i32 1, i32 2, i32 3>, [[VECTOR_PH]] ], [ [[VEC_IND_NEXT:%.*]], [[VECTOR_BODY]] ] 407; CHECK-NEXT: [[TMP0:%.*]] = add i64 [[INDEX]], 0 408; CHECK-NEXT: [[TMP1:%.*]] = sitofp <4 x i32> [[VEC_IND]] to <4 x double> 409; CHECK-NEXT: [[TMP2:%.*]] = call <4 x double> @_ZGVdN4v_cos(<4 x double> [[TMP1]]) 410; CHECK-NEXT: [[TMP3:%.*]] = getelementptr inbounds double, double* [[VARRAY:%.*]], i64 [[TMP0]] 411; CHECK-NEXT: [[TMP4:%.*]] = getelementptr inbounds double, double* [[TMP3]], i32 0 412; CHECK-NEXT: [[TMP5:%.*]] = bitcast double* [[TMP4]] to <4 x double>* 413; CHECK-NEXT: store <4 x double> [[TMP2]], <4 x double>* [[TMP5]], align 4 414; CHECK-NEXT: [[INDEX_NEXT]] = add nuw i64 [[INDEX]], 4 415; CHECK-NEXT: [[VEC_IND_NEXT]] = add <4 x i32> [[VEC_IND]], <i32 4, i32 4, i32 4, i32 4> 416; CHECK-NEXT: [[TMP6:%.*]] = icmp eq i64 [[INDEX_NEXT]], 1000 417; CHECK-NEXT: br i1 [[TMP6]], label [[MIDDLE_BLOCK:%.*]], label [[VECTOR_BODY]], !llvm.loop [[LOOP14:![0-9]+]] 418; CHECK: middle.block: 419; CHECK-NEXT: [[CMP_N:%.*]] = icmp eq i64 1000, 1000 420; CHECK-NEXT: br i1 [[CMP_N]], label [[FOR_END:%.*]], label [[SCALAR_PH]] 421; CHECK: scalar.ph: 422; CHECK-NEXT: [[BC_RESUME_VAL:%.*]] = phi i64 [ 1000, [[MIDDLE_BLOCK]] ], [ 0, [[ENTRY:%.*]] ] 423; CHECK-NEXT: br label [[FOR_BODY:%.*]] 424; CHECK: for.body: 425; CHECK-NEXT: [[IV:%.*]] = phi i64 [ [[BC_RESUME_VAL]], [[SCALAR_PH]] ], [ [[IV_NEXT:%.*]], [[FOR_BODY]] ] 426; CHECK-NEXT: [[TMP:%.*]] = trunc i64 [[IV]] to i32 427; CHECK-NEXT: [[CONV:%.*]] = sitofp i32 [[TMP]] to double 428; CHECK-NEXT: [[CALL:%.*]] = tail call double @llvm.cos.f64(double [[CONV]]) #[[ATTR8:[0-9]+]] 429; CHECK-NEXT: [[ARRAYIDX:%.*]] = getelementptr inbounds double, double* [[VARRAY]], i64 [[IV]] 430; CHECK-NEXT: store double [[CALL]], double* [[ARRAYIDX]], align 4 431; CHECK-NEXT: [[IV_NEXT]] = add nuw nsw i64 [[IV]], 1 432; CHECK-NEXT: [[EXITCOND:%.*]] = icmp eq i64 [[IV_NEXT]], 1000 433; CHECK-NEXT: br i1 [[EXITCOND]], label [[FOR_END]], label [[FOR_BODY]], !llvm.loop [[LOOP15:![0-9]+]] 434; CHECK: for.end: 435; CHECK-NEXT: ret void 436; 437entry: 438 br label %for.body 439 440for.body: 441 %iv = phi i64 [ 0, %entry ], [ %iv.next, %for.body ] 442 %tmp = trunc i64 %iv to i32 443 %conv = sitofp i32 %tmp to double 444 %call = tail call double @llvm.cos.f64(double %conv) 445 %arrayidx = getelementptr inbounds double, double* %varray, i64 %iv 446 store double %call, double* %arrayidx, align 4 447 %iv.next = add nuw nsw i64 %iv, 1 448 %exitcond = icmp eq i64 %iv.next, 1000 449 br i1 %exitcond, label %for.end, label %for.body, !llvm.loop !71 450 451for.end: 452 ret void 453} 454 455!71 = distinct !{!71, !72, !73} 456!72 = !{!"llvm.loop.vectorize.width", i32 4} 457!73 = !{!"llvm.loop.vectorize.enable", i1 true} 458 459define void @cos_f32_intrinsic(float* nocapture %varray) { 460; CHECK-LABEL: @cos_f32_intrinsic( 461; CHECK-NEXT: entry: 462; CHECK-NEXT: br i1 false, label [[SCALAR_PH:%.*]], label [[VECTOR_PH:%.*]] 463; CHECK: vector.ph: 464; CHECK-NEXT: br label [[VECTOR_BODY:%.*]] 465; CHECK: vector.body: 466; CHECK-NEXT: [[INDEX:%.*]] = phi i64 [ 0, [[VECTOR_PH]] ], [ [[INDEX_NEXT:%.*]], [[VECTOR_BODY]] ] 467; CHECK-NEXT: [[VEC_IND:%.*]] = phi <4 x i32> [ <i32 0, i32 1, i32 2, i32 3>, [[VECTOR_PH]] ], [ [[VEC_IND_NEXT:%.*]], [[VECTOR_BODY]] ] 468; CHECK-NEXT: [[STEP_ADD:%.*]] = add <4 x i32> [[VEC_IND]], <i32 4, i32 4, i32 4, i32 4> 469; CHECK-NEXT: [[TMP0:%.*]] = add i64 [[INDEX]], 0 470; CHECK-NEXT: [[TMP1:%.*]] = add i64 [[INDEX]], 4 471; CHECK-NEXT: [[TMP2:%.*]] = sitofp <4 x i32> [[VEC_IND]] to <4 x float> 472; CHECK-NEXT: [[TMP3:%.*]] = sitofp <4 x i32> [[STEP_ADD]] to <4 x float> 473; CHECK-NEXT: [[TMP4:%.*]] = call <4 x float> @_ZGVbN4v_cosf(<4 x float> [[TMP2]]) 474; CHECK-NEXT: [[TMP5:%.*]] = call <4 x float> @_ZGVbN4v_cosf(<4 x float> [[TMP3]]) 475; CHECK-NEXT: [[TMP6:%.*]] = getelementptr inbounds float, float* [[VARRAY:%.*]], i64 [[TMP0]] 476; CHECK-NEXT: [[TMP7:%.*]] = getelementptr inbounds float, float* [[VARRAY]], i64 [[TMP1]] 477; CHECK-NEXT: [[TMP8:%.*]] = getelementptr inbounds float, float* [[TMP6]], i32 0 478; CHECK-NEXT: [[TMP9:%.*]] = bitcast float* [[TMP8]] to <4 x float>* 479; CHECK-NEXT: store <4 x float> [[TMP4]], <4 x float>* [[TMP9]], align 4 480; CHECK-NEXT: [[TMP10:%.*]] = getelementptr inbounds float, float* [[TMP6]], i32 4 481; CHECK-NEXT: [[TMP11:%.*]] = bitcast float* [[TMP10]] to <4 x float>* 482; CHECK-NEXT: store <4 x float> [[TMP5]], <4 x float>* [[TMP11]], align 4 483; CHECK-NEXT: [[INDEX_NEXT]] = add nuw i64 [[INDEX]], 8 484; CHECK-NEXT: [[VEC_IND_NEXT]] = add <4 x i32> [[STEP_ADD]], <i32 4, i32 4, i32 4, i32 4> 485; CHECK-NEXT: [[TMP12:%.*]] = icmp eq i64 [[INDEX_NEXT]], 1000 486; CHECK-NEXT: br i1 [[TMP12]], label [[MIDDLE_BLOCK:%.*]], label [[VECTOR_BODY]], !llvm.loop [[LOOP16:![0-9]+]] 487; CHECK: middle.block: 488; CHECK-NEXT: [[CMP_N:%.*]] = icmp eq i64 1000, 1000 489; CHECK-NEXT: br i1 [[CMP_N]], label [[FOR_END:%.*]], label [[SCALAR_PH]] 490; CHECK: scalar.ph: 491; CHECK-NEXT: [[BC_RESUME_VAL:%.*]] = phi i64 [ 1000, [[MIDDLE_BLOCK]] ], [ 0, [[ENTRY:%.*]] ] 492; CHECK-NEXT: br label [[FOR_BODY:%.*]] 493; CHECK: for.body: 494; CHECK-NEXT: [[IV:%.*]] = phi i64 [ [[BC_RESUME_VAL]], [[SCALAR_PH]] ], [ [[IV_NEXT:%.*]], [[FOR_BODY]] ] 495; CHECK-NEXT: [[TMP:%.*]] = trunc i64 [[IV]] to i32 496; CHECK-NEXT: [[CONV:%.*]] = sitofp i32 [[TMP]] to float 497; CHECK-NEXT: [[CALL:%.*]] = tail call float @llvm.cos.f32(float [[CONV]]) #[[ATTR9:[0-9]+]] 498; CHECK-NEXT: [[ARRAYIDX:%.*]] = getelementptr inbounds float, float* [[VARRAY]], i64 [[IV]] 499; CHECK-NEXT: store float [[CALL]], float* [[ARRAYIDX]], align 4 500; CHECK-NEXT: [[IV_NEXT]] = add nuw nsw i64 [[IV]], 1 501; CHECK-NEXT: [[EXITCOND:%.*]] = icmp eq i64 [[IV_NEXT]], 1000 502; CHECK-NEXT: br i1 [[EXITCOND]], label [[FOR_END]], label [[FOR_BODY]], !llvm.loop [[LOOP17:![0-9]+]] 503; CHECK: for.end: 504; CHECK-NEXT: ret void 505; 506entry: 507 br label %for.body 508 509for.body: 510 %iv = phi i64 [ 0, %entry ], [ %iv.next, %for.body ] 511 %tmp = trunc i64 %iv to i32 512 %conv = sitofp i32 %tmp to float 513 %call = tail call float @llvm.cos.f32(float %conv) 514 %arrayidx = getelementptr inbounds float, float* %varray, i64 %iv 515 store float %call, float* %arrayidx, align 4 516 %iv.next = add nuw nsw i64 %iv, 1 517 %exitcond = icmp eq i64 %iv.next, 1000 518 br i1 %exitcond, label %for.end, label %for.body, !llvm.loop !81 519 520for.end: 521 ret void 522} 523 524!81 = distinct !{!81, !82, !83} 525!82 = !{!"llvm.loop.vectorize.width", i32 4} 526!83 = !{!"llvm.loop.vectorize.enable", i1 true} 527 528 529define void @exp_f32(float* nocapture %varray) { 530; CHECK-LABEL: @exp_f32( 531; CHECK-NEXT: entry: 532; CHECK-NEXT: br i1 false, label [[SCALAR_PH:%.*]], label [[VECTOR_PH:%.*]] 533; CHECK: vector.ph: 534; CHECK-NEXT: br label [[VECTOR_BODY:%.*]] 535; CHECK: vector.body: 536; CHECK-NEXT: [[INDEX:%.*]] = phi i64 [ 0, [[VECTOR_PH]] ], [ [[INDEX_NEXT:%.*]], [[VECTOR_BODY]] ] 537; CHECK-NEXT: [[VEC_IND:%.*]] = phi <4 x i32> [ <i32 0, i32 1, i32 2, i32 3>, [[VECTOR_PH]] ], [ [[VEC_IND_NEXT:%.*]], [[VECTOR_BODY]] ] 538; CHECK-NEXT: [[STEP_ADD:%.*]] = add <4 x i32> [[VEC_IND]], <i32 4, i32 4, i32 4, i32 4> 539; CHECK-NEXT: [[TMP0:%.*]] = add i64 [[INDEX]], 0 540; CHECK-NEXT: [[TMP1:%.*]] = add i64 [[INDEX]], 4 541; CHECK-NEXT: [[TMP2:%.*]] = sitofp <4 x i32> [[VEC_IND]] to <4 x float> 542; CHECK-NEXT: [[TMP3:%.*]] = sitofp <4 x i32> [[STEP_ADD]] to <4 x float> 543; CHECK-NEXT: [[TMP4:%.*]] = call fast <4 x float> @_ZGVbN4v_expf(<4 x float> [[TMP2]]) 544; CHECK-NEXT: [[TMP5:%.*]] = call fast <4 x float> @_ZGVbN4v_expf(<4 x float> [[TMP3]]) 545; CHECK-NEXT: [[TMP6:%.*]] = getelementptr inbounds float, float* [[VARRAY:%.*]], i64 [[TMP0]] 546; CHECK-NEXT: [[TMP7:%.*]] = getelementptr inbounds float, float* [[VARRAY]], i64 [[TMP1]] 547; CHECK-NEXT: [[TMP8:%.*]] = getelementptr inbounds float, float* [[TMP6]], i32 0 548; CHECK-NEXT: [[TMP9:%.*]] = bitcast float* [[TMP8]] to <4 x float>* 549; CHECK-NEXT: store <4 x float> [[TMP4]], <4 x float>* [[TMP9]], align 4 550; CHECK-NEXT: [[TMP10:%.*]] = getelementptr inbounds float, float* [[TMP6]], i32 4 551; CHECK-NEXT: [[TMP11:%.*]] = bitcast float* [[TMP10]] to <4 x float>* 552; CHECK-NEXT: store <4 x float> [[TMP5]], <4 x float>* [[TMP11]], align 4 553; CHECK-NEXT: [[INDEX_NEXT]] = add nuw i64 [[INDEX]], 8 554; CHECK-NEXT: [[VEC_IND_NEXT]] = add <4 x i32> [[STEP_ADD]], <i32 4, i32 4, i32 4, i32 4> 555; CHECK-NEXT: [[TMP12:%.*]] = icmp eq i64 [[INDEX_NEXT]], 1000 556; CHECK-NEXT: br i1 [[TMP12]], label [[MIDDLE_BLOCK:%.*]], label [[VECTOR_BODY]], !llvm.loop [[LOOP18:![0-9]+]] 557; CHECK: middle.block: 558; CHECK-NEXT: [[CMP_N:%.*]] = icmp eq i64 1000, 1000 559; CHECK-NEXT: br i1 [[CMP_N]], label [[FOR_END:%.*]], label [[SCALAR_PH]] 560; CHECK: scalar.ph: 561; CHECK-NEXT: [[BC_RESUME_VAL:%.*]] = phi i64 [ 1000, [[MIDDLE_BLOCK]] ], [ 0, [[ENTRY:%.*]] ] 562; CHECK-NEXT: br label [[FOR_BODY:%.*]] 563; CHECK: for.body: 564; CHECK-NEXT: [[INDVARS_IV:%.*]] = phi i64 [ [[BC_RESUME_VAL]], [[SCALAR_PH]] ], [ [[INDVARS_IV_NEXT:%.*]], [[FOR_BODY]] ] 565; CHECK-NEXT: [[TMP:%.*]] = trunc i64 [[INDVARS_IV]] to i32 566; CHECK-NEXT: [[CONV:%.*]] = sitofp i32 [[TMP]] to float 567; CHECK-NEXT: [[CALL:%.*]] = tail call fast float @expf(float [[CONV]]) #[[ATTR10:[0-9]+]] 568; CHECK-NEXT: [[ARRAYIDX:%.*]] = getelementptr inbounds float, float* [[VARRAY]], i64 [[INDVARS_IV]] 569; CHECK-NEXT: store float [[CALL]], float* [[ARRAYIDX]], align 4 570; CHECK-NEXT: [[INDVARS_IV_NEXT]] = add nuw nsw i64 [[INDVARS_IV]], 1 571; CHECK-NEXT: [[EXITCOND:%.*]] = icmp eq i64 [[INDVARS_IV_NEXT]], 1000 572; CHECK-NEXT: br i1 [[EXITCOND]], label [[FOR_END]], label [[FOR_BODY]], !llvm.loop [[LOOP19:![0-9]+]] 573; CHECK: for.end: 574; CHECK-NEXT: ret void 575; 576entry: 577 br label %for.body 578 579for.body: ; preds = %for.body, %entry 580 %indvars.iv = phi i64 [ 0, %entry ], [ %indvars.iv.next, %for.body ] 581 %tmp = trunc i64 %indvars.iv to i32 582 %conv = sitofp i32 %tmp to float 583 %call = tail call fast float @expf(float %conv) 584 %arrayidx = getelementptr inbounds float, float* %varray, i64 %indvars.iv 585 store float %call, float* %arrayidx, align 4 586 %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1 587 %exitcond = icmp eq i64 %indvars.iv.next, 1000 588 br i1 %exitcond, label %for.end, label %for.body, !llvm.loop !91 589 590for.end: ; preds = %for.body 591 ret void 592} 593 594!91 = distinct !{!91, !92, !93} 595!92 = !{!"llvm.loop.vectorize.width", i32 4} 596!93 = !{!"llvm.loop.vectorize.enable", i1 true} 597 598define void @exp_f32_intrin(float* nocapture %varray) { 599; CHECK-LABEL: @exp_f32_intrin( 600; CHECK-NEXT: entry: 601; CHECK-NEXT: br i1 false, label [[SCALAR_PH:%.*]], label [[VECTOR_PH:%.*]] 602; CHECK: vector.ph: 603; CHECK-NEXT: br label [[VECTOR_BODY:%.*]] 604; CHECK: vector.body: 605; CHECK-NEXT: [[INDEX:%.*]] = phi i64 [ 0, [[VECTOR_PH]] ], [ [[INDEX_NEXT:%.*]], [[VECTOR_BODY]] ] 606; CHECK-NEXT: [[VEC_IND:%.*]] = phi <4 x i32> [ <i32 0, i32 1, i32 2, i32 3>, [[VECTOR_PH]] ], [ [[VEC_IND_NEXT:%.*]], [[VECTOR_BODY]] ] 607; CHECK-NEXT: [[STEP_ADD:%.*]] = add <4 x i32> [[VEC_IND]], <i32 4, i32 4, i32 4, i32 4> 608; CHECK-NEXT: [[TMP0:%.*]] = add i64 [[INDEX]], 0 609; CHECK-NEXT: [[TMP1:%.*]] = add i64 [[INDEX]], 4 610; CHECK-NEXT: [[TMP2:%.*]] = sitofp <4 x i32> [[VEC_IND]] to <4 x float> 611; CHECK-NEXT: [[TMP3:%.*]] = sitofp <4 x i32> [[STEP_ADD]] to <4 x float> 612; CHECK-NEXT: [[TMP4:%.*]] = call fast <4 x float> @_ZGVbN4v_expf(<4 x float> [[TMP2]]) 613; CHECK-NEXT: [[TMP5:%.*]] = call fast <4 x float> @_ZGVbN4v_expf(<4 x float> [[TMP3]]) 614; CHECK-NEXT: [[TMP6:%.*]] = getelementptr inbounds float, float* [[VARRAY:%.*]], i64 [[TMP0]] 615; CHECK-NEXT: [[TMP7:%.*]] = getelementptr inbounds float, float* [[VARRAY]], i64 [[TMP1]] 616; CHECK-NEXT: [[TMP8:%.*]] = getelementptr inbounds float, float* [[TMP6]], i32 0 617; CHECK-NEXT: [[TMP9:%.*]] = bitcast float* [[TMP8]] to <4 x float>* 618; CHECK-NEXT: store <4 x float> [[TMP4]], <4 x float>* [[TMP9]], align 4 619; CHECK-NEXT: [[TMP10:%.*]] = getelementptr inbounds float, float* [[TMP6]], i32 4 620; CHECK-NEXT: [[TMP11:%.*]] = bitcast float* [[TMP10]] to <4 x float>* 621; CHECK-NEXT: store <4 x float> [[TMP5]], <4 x float>* [[TMP11]], align 4 622; CHECK-NEXT: [[INDEX_NEXT]] = add nuw i64 [[INDEX]], 8 623; CHECK-NEXT: [[VEC_IND_NEXT]] = add <4 x i32> [[STEP_ADD]], <i32 4, i32 4, i32 4, i32 4> 624; CHECK-NEXT: [[TMP12:%.*]] = icmp eq i64 [[INDEX_NEXT]], 1000 625; CHECK-NEXT: br i1 [[TMP12]], label [[MIDDLE_BLOCK:%.*]], label [[VECTOR_BODY]], !llvm.loop [[LOOP20:![0-9]+]] 626; CHECK: middle.block: 627; CHECK-NEXT: [[CMP_N:%.*]] = icmp eq i64 1000, 1000 628; CHECK-NEXT: br i1 [[CMP_N]], label [[FOR_END:%.*]], label [[SCALAR_PH]] 629; CHECK: scalar.ph: 630; CHECK-NEXT: [[BC_RESUME_VAL:%.*]] = phi i64 [ 1000, [[MIDDLE_BLOCK]] ], [ 0, [[ENTRY:%.*]] ] 631; CHECK-NEXT: br label [[FOR_BODY:%.*]] 632; CHECK: for.body: 633; CHECK-NEXT: [[INDVARS_IV:%.*]] = phi i64 [ [[BC_RESUME_VAL]], [[SCALAR_PH]] ], [ [[INDVARS_IV_NEXT:%.*]], [[FOR_BODY]] ] 634; CHECK-NEXT: [[TMP:%.*]] = trunc i64 [[INDVARS_IV]] to i32 635; CHECK-NEXT: [[CONV:%.*]] = sitofp i32 [[TMP]] to float 636; CHECK-NEXT: [[CALL:%.*]] = tail call fast float @llvm.exp.f32(float [[CONV]]) #[[ATTR11:[0-9]+]] 637; CHECK-NEXT: [[ARRAYIDX:%.*]] = getelementptr inbounds float, float* [[VARRAY]], i64 [[INDVARS_IV]] 638; CHECK-NEXT: store float [[CALL]], float* [[ARRAYIDX]], align 4 639; CHECK-NEXT: [[INDVARS_IV_NEXT]] = add nuw nsw i64 [[INDVARS_IV]], 1 640; CHECK-NEXT: [[EXITCOND:%.*]] = icmp eq i64 [[INDVARS_IV_NEXT]], 1000 641; CHECK-NEXT: br i1 [[EXITCOND]], label [[FOR_END]], label [[FOR_BODY]], !llvm.loop [[LOOP21:![0-9]+]] 642; CHECK: for.end: 643; CHECK-NEXT: ret void 644; 645entry: 646 br label %for.body 647 648for.body: ; preds = %for.body, %entry 649 %indvars.iv = phi i64 [ 0, %entry ], [ %indvars.iv.next, %for.body ] 650 %tmp = trunc i64 %indvars.iv to i32 651 %conv = sitofp i32 %tmp to float 652 %call = tail call fast float @llvm.exp.f32(float %conv) 653 %arrayidx = getelementptr inbounds float, float* %varray, i64 %indvars.iv 654 store float %call, float* %arrayidx, align 4 655 %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1 656 %exitcond = icmp eq i64 %indvars.iv.next, 1000 657 br i1 %exitcond, label %for.end, label %for.body, !llvm.loop !101 658 659for.end: ; preds = %for.body 660 ret void 661} 662 663!101 = distinct !{!101, !102, !103} 664!102 = !{!"llvm.loop.vectorize.width", i32 4} 665!103 = !{!"llvm.loop.vectorize.enable", i1 true} 666 667 668define void @log_f32(float* nocapture %varray) { 669; CHECK-LABEL: @log_f32( 670; CHECK-NEXT: entry: 671; CHECK-NEXT: br i1 false, label [[SCALAR_PH:%.*]], label [[VECTOR_PH:%.*]] 672; CHECK: vector.ph: 673; CHECK-NEXT: br label [[VECTOR_BODY:%.*]] 674; CHECK: vector.body: 675; CHECK-NEXT: [[INDEX:%.*]] = phi i64 [ 0, [[VECTOR_PH]] ], [ [[INDEX_NEXT:%.*]], [[VECTOR_BODY]] ] 676; CHECK-NEXT: [[VEC_IND:%.*]] = phi <4 x i32> [ <i32 0, i32 1, i32 2, i32 3>, [[VECTOR_PH]] ], [ [[VEC_IND_NEXT:%.*]], [[VECTOR_BODY]] ] 677; CHECK-NEXT: [[STEP_ADD:%.*]] = add <4 x i32> [[VEC_IND]], <i32 4, i32 4, i32 4, i32 4> 678; CHECK-NEXT: [[TMP0:%.*]] = add i64 [[INDEX]], 0 679; CHECK-NEXT: [[TMP1:%.*]] = add i64 [[INDEX]], 4 680; CHECK-NEXT: [[TMP2:%.*]] = sitofp <4 x i32> [[VEC_IND]] to <4 x float> 681; CHECK-NEXT: [[TMP3:%.*]] = sitofp <4 x i32> [[STEP_ADD]] to <4 x float> 682; CHECK-NEXT: [[TMP4:%.*]] = call fast <4 x float> @_ZGVbN4v_logf(<4 x float> [[TMP2]]) 683; CHECK-NEXT: [[TMP5:%.*]] = call fast <4 x float> @_ZGVbN4v_logf(<4 x float> [[TMP3]]) 684; CHECK-NEXT: [[TMP6:%.*]] = getelementptr inbounds float, float* [[VARRAY:%.*]], i64 [[TMP0]] 685; CHECK-NEXT: [[TMP7:%.*]] = getelementptr inbounds float, float* [[VARRAY]], i64 [[TMP1]] 686; CHECK-NEXT: [[TMP8:%.*]] = getelementptr inbounds float, float* [[TMP6]], i32 0 687; CHECK-NEXT: [[TMP9:%.*]] = bitcast float* [[TMP8]] to <4 x float>* 688; CHECK-NEXT: store <4 x float> [[TMP4]], <4 x float>* [[TMP9]], align 4 689; CHECK-NEXT: [[TMP10:%.*]] = getelementptr inbounds float, float* [[TMP6]], i32 4 690; CHECK-NEXT: [[TMP11:%.*]] = bitcast float* [[TMP10]] to <4 x float>* 691; CHECK-NEXT: store <4 x float> [[TMP5]], <4 x float>* [[TMP11]], align 4 692; CHECK-NEXT: [[INDEX_NEXT]] = add nuw i64 [[INDEX]], 8 693; CHECK-NEXT: [[VEC_IND_NEXT]] = add <4 x i32> [[STEP_ADD]], <i32 4, i32 4, i32 4, i32 4> 694; CHECK-NEXT: [[TMP12:%.*]] = icmp eq i64 [[INDEX_NEXT]], 1000 695; CHECK-NEXT: br i1 [[TMP12]], label [[MIDDLE_BLOCK:%.*]], label [[VECTOR_BODY]], !llvm.loop [[LOOP22:![0-9]+]] 696; CHECK: middle.block: 697; CHECK-NEXT: [[CMP_N:%.*]] = icmp eq i64 1000, 1000 698; CHECK-NEXT: br i1 [[CMP_N]], label [[FOR_END:%.*]], label [[SCALAR_PH]] 699; CHECK: scalar.ph: 700; CHECK-NEXT: [[BC_RESUME_VAL:%.*]] = phi i64 [ 1000, [[MIDDLE_BLOCK]] ], [ 0, [[ENTRY:%.*]] ] 701; CHECK-NEXT: br label [[FOR_BODY:%.*]] 702; CHECK: for.body: 703; CHECK-NEXT: [[INDVARS_IV:%.*]] = phi i64 [ [[BC_RESUME_VAL]], [[SCALAR_PH]] ], [ [[INDVARS_IV_NEXT:%.*]], [[FOR_BODY]] ] 704; CHECK-NEXT: [[TMP:%.*]] = trunc i64 [[INDVARS_IV]] to i32 705; CHECK-NEXT: [[CONV:%.*]] = sitofp i32 [[TMP]] to float 706; CHECK-NEXT: [[CALL:%.*]] = tail call fast float @logf(float [[CONV]]) #[[ATTR12:[0-9]+]] 707; CHECK-NEXT: [[ARRAYIDX:%.*]] = getelementptr inbounds float, float* [[VARRAY]], i64 [[INDVARS_IV]] 708; CHECK-NEXT: store float [[CALL]], float* [[ARRAYIDX]], align 4 709; CHECK-NEXT: [[INDVARS_IV_NEXT]] = add nuw nsw i64 [[INDVARS_IV]], 1 710; CHECK-NEXT: [[EXITCOND:%.*]] = icmp eq i64 [[INDVARS_IV_NEXT]], 1000 711; CHECK-NEXT: br i1 [[EXITCOND]], label [[FOR_END]], label [[FOR_BODY]], !llvm.loop [[LOOP23:![0-9]+]] 712; CHECK: for.end: 713; CHECK-NEXT: ret void 714; 715entry: 716 br label %for.body 717 718for.body: ; preds = %for.body, %entry 719 %indvars.iv = phi i64 [ 0, %entry ], [ %indvars.iv.next, %for.body ] 720 %tmp = trunc i64 %indvars.iv to i32 721 %conv = sitofp i32 %tmp to float 722 %call = tail call fast float @logf(float %conv) 723 %arrayidx = getelementptr inbounds float, float* %varray, i64 %indvars.iv 724 store float %call, float* %arrayidx, align 4 725 %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1 726 %exitcond = icmp eq i64 %indvars.iv.next, 1000 727 br i1 %exitcond, label %for.end, label %for.body, !llvm.loop !111 728 729for.end: ; preds = %for.body 730 ret void 731} 732 733!111 = distinct !{!111, !112, !113} 734!112 = !{!"llvm.loop.vectorize.width", i32 4} 735!113 = !{!"llvm.loop.vectorize.enable", i1 true} 736 737define void @pow_f32(float* nocapture %varray, float* nocapture readonly %exp) { 738; CHECK-LABEL: @pow_f32( 739; CHECK-NEXT: entry: 740; CHECK-NEXT: [[VARRAY1:%.*]] = bitcast float* [[VARRAY:%.*]] to i8* 741; CHECK-NEXT: [[EXP3:%.*]] = bitcast float* [[EXP:%.*]] to i8* 742; CHECK-NEXT: br i1 false, label [[SCALAR_PH:%.*]], label [[VECTOR_MEMCHECK:%.*]] 743; CHECK: vector.memcheck: 744; CHECK-NEXT: [[SCEVGEP:%.*]] = getelementptr float, float* [[VARRAY]], i64 1000 745; CHECK-NEXT: [[SCEVGEP2:%.*]] = bitcast float* [[SCEVGEP]] to i8* 746; CHECK-NEXT: [[SCEVGEP4:%.*]] = getelementptr float, float* [[EXP]], i64 1000 747; CHECK-NEXT: [[SCEVGEP45:%.*]] = bitcast float* [[SCEVGEP4]] to i8* 748; CHECK-NEXT: [[BOUND0:%.*]] = icmp ult i8* [[VARRAY1]], [[SCEVGEP45]] 749; CHECK-NEXT: [[BOUND1:%.*]] = icmp ult i8* [[EXP3]], [[SCEVGEP2]] 750; CHECK-NEXT: [[FOUND_CONFLICT:%.*]] = and i1 [[BOUND0]], [[BOUND1]] 751; CHECK-NEXT: br i1 [[FOUND_CONFLICT]], label [[SCALAR_PH]], label [[VECTOR_PH:%.*]] 752; CHECK: vector.ph: 753; CHECK-NEXT: br label [[VECTOR_BODY:%.*]] 754; CHECK: vector.body: 755; CHECK-NEXT: [[INDEX:%.*]] = phi i64 [ 0, [[VECTOR_PH]] ], [ [[INDEX_NEXT:%.*]], [[VECTOR_BODY]] ] 756; CHECK-NEXT: [[VEC_IND:%.*]] = phi <4 x i32> [ <i32 0, i32 1, i32 2, i32 3>, [[VECTOR_PH]] ], [ [[VEC_IND_NEXT:%.*]], [[VECTOR_BODY]] ] 757; CHECK-NEXT: [[STEP_ADD:%.*]] = add <4 x i32> [[VEC_IND]], <i32 4, i32 4, i32 4, i32 4> 758; CHECK-NEXT: [[TMP0:%.*]] = add i64 [[INDEX]], 0 759; CHECK-NEXT: [[TMP1:%.*]] = add i64 [[INDEX]], 4 760; CHECK-NEXT: [[TMP2:%.*]] = sitofp <4 x i32> [[VEC_IND]] to <4 x float> 761; CHECK-NEXT: [[TMP3:%.*]] = sitofp <4 x i32> [[STEP_ADD]] to <4 x float> 762; CHECK-NEXT: [[TMP4:%.*]] = getelementptr inbounds float, float* [[EXP]], i64 [[TMP0]] 763; CHECK-NEXT: [[TMP5:%.*]] = getelementptr inbounds float, float* [[EXP]], i64 [[TMP1]] 764; CHECK-NEXT: [[TMP6:%.*]] = getelementptr inbounds float, float* [[TMP4]], i32 0 765; CHECK-NEXT: [[TMP7:%.*]] = bitcast float* [[TMP6]] to <4 x float>* 766; CHECK-NEXT: [[WIDE_LOAD:%.*]] = load <4 x float>, <4 x float>* [[TMP7]], align 4, !alias.scope !24 767; CHECK-NEXT: [[TMP8:%.*]] = getelementptr inbounds float, float* [[TMP4]], i32 4 768; CHECK-NEXT: [[TMP9:%.*]] = bitcast float* [[TMP8]] to <4 x float>* 769; CHECK-NEXT: [[WIDE_LOAD7:%.*]] = load <4 x float>, <4 x float>* [[TMP9]], align 4, !alias.scope !24 770; CHECK-NEXT: [[TMP10:%.*]] = call fast <4 x float> @_ZGVbN4vv_powf(<4 x float> [[TMP2]], <4 x float> [[WIDE_LOAD]]) 771; CHECK-NEXT: [[TMP11:%.*]] = call fast <4 x float> @_ZGVbN4vv_powf(<4 x float> [[TMP3]], <4 x float> [[WIDE_LOAD7]]) 772; CHECK-NEXT: [[TMP12:%.*]] = getelementptr inbounds float, float* [[VARRAY]], i64 [[TMP0]] 773; CHECK-NEXT: [[TMP13:%.*]] = getelementptr inbounds float, float* [[VARRAY]], i64 [[TMP1]] 774; CHECK-NEXT: [[TMP14:%.*]] = getelementptr inbounds float, float* [[TMP12]], i32 0 775; CHECK-NEXT: [[TMP15:%.*]] = bitcast float* [[TMP14]] to <4 x float>* 776; CHECK-NEXT: store <4 x float> [[TMP10]], <4 x float>* [[TMP15]], align 4, !alias.scope !27, !noalias !24 777; CHECK-NEXT: [[TMP16:%.*]] = getelementptr inbounds float, float* [[TMP12]], i32 4 778; CHECK-NEXT: [[TMP17:%.*]] = bitcast float* [[TMP16]] to <4 x float>* 779; CHECK-NEXT: store <4 x float> [[TMP11]], <4 x float>* [[TMP17]], align 4, !alias.scope !27, !noalias !24 780; CHECK-NEXT: [[INDEX_NEXT]] = add nuw i64 [[INDEX]], 8 781; CHECK-NEXT: [[VEC_IND_NEXT]] = add <4 x i32> [[STEP_ADD]], <i32 4, i32 4, i32 4, i32 4> 782; CHECK-NEXT: [[TMP18:%.*]] = icmp eq i64 [[INDEX_NEXT]], 1000 783; CHECK-NEXT: br i1 [[TMP18]], label [[MIDDLE_BLOCK:%.*]], label [[VECTOR_BODY]], !llvm.loop [[LOOP29:![0-9]+]] 784; CHECK: middle.block: 785; CHECK-NEXT: [[CMP_N:%.*]] = icmp eq i64 1000, 1000 786; CHECK-NEXT: br i1 [[CMP_N]], label [[FOR_END:%.*]], label [[SCALAR_PH]] 787; CHECK: scalar.ph: 788; CHECK-NEXT: [[BC_RESUME_VAL:%.*]] = phi i64 [ 1000, [[MIDDLE_BLOCK]] ], [ 0, [[ENTRY:%.*]] ], [ 0, [[VECTOR_MEMCHECK]] ] 789; CHECK-NEXT: br label [[FOR_BODY:%.*]] 790; CHECK: for.body: 791; CHECK-NEXT: [[INDVARS_IV:%.*]] = phi i64 [ [[BC_RESUME_VAL]], [[SCALAR_PH]] ], [ [[INDVARS_IV_NEXT:%.*]], [[FOR_BODY]] ] 792; CHECK-NEXT: [[TMP:%.*]] = trunc i64 [[INDVARS_IV]] to i32 793; CHECK-NEXT: [[CONV:%.*]] = sitofp i32 [[TMP]] to float 794; CHECK-NEXT: [[ARRAYIDX:%.*]] = getelementptr inbounds float, float* [[EXP]], i64 [[INDVARS_IV]] 795; CHECK-NEXT: [[TMP1:%.*]] = load float, float* [[ARRAYIDX]], align 4 796; CHECK-NEXT: [[TMP2:%.*]] = tail call fast float @powf(float [[CONV]], float [[TMP1]]) #[[ATTR13:[0-9]+]] 797; CHECK-NEXT: [[ARRAYIDX2:%.*]] = getelementptr inbounds float, float* [[VARRAY]], i64 [[INDVARS_IV]] 798; CHECK-NEXT: store float [[TMP2]], float* [[ARRAYIDX2]], align 4 799; CHECK-NEXT: [[INDVARS_IV_NEXT]] = add nuw nsw i64 [[INDVARS_IV]], 1 800; CHECK-NEXT: [[EXITCOND:%.*]] = icmp eq i64 [[INDVARS_IV_NEXT]], 1000 801; CHECK-NEXT: br i1 [[EXITCOND]], label [[FOR_END]], label [[FOR_BODY]], !llvm.loop [[LOOP30:![0-9]+]] 802; CHECK: for.end: 803; CHECK-NEXT: ret void 804; 805entry: 806 br label %for.body 807 808for.body: ; preds = %for.body, %entry 809 %indvars.iv = phi i64 [ 0, %entry ], [ %indvars.iv.next, %for.body ] 810 %tmp = trunc i64 %indvars.iv to i32 811 %conv = sitofp i32 %tmp to float 812 %arrayidx = getelementptr inbounds float, float* %exp, i64 %indvars.iv 813 %tmp1 = load float, float* %arrayidx, align 4 814 %tmp2 = tail call fast float @powf(float %conv, float %tmp1) 815 %arrayidx2 = getelementptr inbounds float, float* %varray, i64 %indvars.iv 816 store float %tmp2, float* %arrayidx2, align 4 817 %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1 818 %exitcond = icmp eq i64 %indvars.iv.next, 1000 819 br i1 %exitcond, label %for.end, label %for.body, !llvm.loop !121 820 821for.end: ; preds = %for.body 822 ret void 823} 824 825!121 = distinct !{!121, !122, !123} 826!122 = !{!"llvm.loop.vectorize.width", i32 4} 827!123 = !{!"llvm.loop.vectorize.enable", i1 true} 828 829define void @pow_f32_intrin(float* nocapture %varray, float* nocapture readonly %exp) { 830; CHECK-LABEL: @pow_f32_intrin( 831; CHECK-NEXT: entry: 832; CHECK-NEXT: [[VARRAY1:%.*]] = bitcast float* [[VARRAY:%.*]] to i8* 833; CHECK-NEXT: [[EXP3:%.*]] = bitcast float* [[EXP:%.*]] to i8* 834; CHECK-NEXT: br i1 false, label [[SCALAR_PH:%.*]], label [[VECTOR_MEMCHECK:%.*]] 835; CHECK: vector.memcheck: 836; CHECK-NEXT: [[SCEVGEP:%.*]] = getelementptr float, float* [[VARRAY]], i64 1000 837; CHECK-NEXT: [[SCEVGEP2:%.*]] = bitcast float* [[SCEVGEP]] to i8* 838; CHECK-NEXT: [[SCEVGEP4:%.*]] = getelementptr float, float* [[EXP]], i64 1000 839; CHECK-NEXT: [[SCEVGEP45:%.*]] = bitcast float* [[SCEVGEP4]] to i8* 840; CHECK-NEXT: [[BOUND0:%.*]] = icmp ult i8* [[VARRAY1]], [[SCEVGEP45]] 841; CHECK-NEXT: [[BOUND1:%.*]] = icmp ult i8* [[EXP3]], [[SCEVGEP2]] 842; CHECK-NEXT: [[FOUND_CONFLICT:%.*]] = and i1 [[BOUND0]], [[BOUND1]] 843; CHECK-NEXT: br i1 [[FOUND_CONFLICT]], label [[SCALAR_PH]], label [[VECTOR_PH:%.*]] 844; CHECK: vector.ph: 845; CHECK-NEXT: br label [[VECTOR_BODY:%.*]] 846; CHECK: vector.body: 847; CHECK-NEXT: [[INDEX:%.*]] = phi i64 [ 0, [[VECTOR_PH]] ], [ [[INDEX_NEXT:%.*]], [[VECTOR_BODY]] ] 848; CHECK-NEXT: [[VEC_IND:%.*]] = phi <4 x i32> [ <i32 0, i32 1, i32 2, i32 3>, [[VECTOR_PH]] ], [ [[VEC_IND_NEXT:%.*]], [[VECTOR_BODY]] ] 849; CHECK-NEXT: [[STEP_ADD:%.*]] = add <4 x i32> [[VEC_IND]], <i32 4, i32 4, i32 4, i32 4> 850; CHECK-NEXT: [[TMP0:%.*]] = add i64 [[INDEX]], 0 851; CHECK-NEXT: [[TMP1:%.*]] = add i64 [[INDEX]], 4 852; CHECK-NEXT: [[TMP2:%.*]] = sitofp <4 x i32> [[VEC_IND]] to <4 x float> 853; CHECK-NEXT: [[TMP3:%.*]] = sitofp <4 x i32> [[STEP_ADD]] to <4 x float> 854; CHECK-NEXT: [[TMP4:%.*]] = getelementptr inbounds float, float* [[EXP]], i64 [[TMP0]] 855; CHECK-NEXT: [[TMP5:%.*]] = getelementptr inbounds float, float* [[EXP]], i64 [[TMP1]] 856; CHECK-NEXT: [[TMP6:%.*]] = getelementptr inbounds float, float* [[TMP4]], i32 0 857; CHECK-NEXT: [[TMP7:%.*]] = bitcast float* [[TMP6]] to <4 x float>* 858; CHECK-NEXT: [[WIDE_LOAD:%.*]] = load <4 x float>, <4 x float>* [[TMP7]], align 4, !alias.scope !31 859; CHECK-NEXT: [[TMP8:%.*]] = getelementptr inbounds float, float* [[TMP4]], i32 4 860; CHECK-NEXT: [[TMP9:%.*]] = bitcast float* [[TMP8]] to <4 x float>* 861; CHECK-NEXT: [[WIDE_LOAD7:%.*]] = load <4 x float>, <4 x float>* [[TMP9]], align 4, !alias.scope !31 862; CHECK-NEXT: [[TMP10:%.*]] = call fast <4 x float> @_ZGVbN4vv_powf(<4 x float> [[TMP2]], <4 x float> [[WIDE_LOAD]]) 863; CHECK-NEXT: [[TMP11:%.*]] = call fast <4 x float> @_ZGVbN4vv_powf(<4 x float> [[TMP3]], <4 x float> [[WIDE_LOAD7]]) 864; CHECK-NEXT: [[TMP12:%.*]] = getelementptr inbounds float, float* [[VARRAY]], i64 [[TMP0]] 865; CHECK-NEXT: [[TMP13:%.*]] = getelementptr inbounds float, float* [[VARRAY]], i64 [[TMP1]] 866; CHECK-NEXT: [[TMP14:%.*]] = getelementptr inbounds float, float* [[TMP12]], i32 0 867; CHECK-NEXT: [[TMP15:%.*]] = bitcast float* [[TMP14]] to <4 x float>* 868; CHECK-NEXT: store <4 x float> [[TMP10]], <4 x float>* [[TMP15]], align 4, !alias.scope !34, !noalias !31 869; CHECK-NEXT: [[TMP16:%.*]] = getelementptr inbounds float, float* [[TMP12]], i32 4 870; CHECK-NEXT: [[TMP17:%.*]] = bitcast float* [[TMP16]] to <4 x float>* 871; CHECK-NEXT: store <4 x float> [[TMP11]], <4 x float>* [[TMP17]], align 4, !alias.scope !34, !noalias !31 872; CHECK-NEXT: [[INDEX_NEXT]] = add nuw i64 [[INDEX]], 8 873; CHECK-NEXT: [[VEC_IND_NEXT]] = add <4 x i32> [[STEP_ADD]], <i32 4, i32 4, i32 4, i32 4> 874; CHECK-NEXT: [[TMP18:%.*]] = icmp eq i64 [[INDEX_NEXT]], 1000 875; CHECK-NEXT: br i1 [[TMP18]], label [[MIDDLE_BLOCK:%.*]], label [[VECTOR_BODY]], !llvm.loop [[LOOP36:![0-9]+]] 876; CHECK: middle.block: 877; CHECK-NEXT: [[CMP_N:%.*]] = icmp eq i64 1000, 1000 878; CHECK-NEXT: br i1 [[CMP_N]], label [[FOR_END:%.*]], label [[SCALAR_PH]] 879; CHECK: scalar.ph: 880; CHECK-NEXT: [[BC_RESUME_VAL:%.*]] = phi i64 [ 1000, [[MIDDLE_BLOCK]] ], [ 0, [[ENTRY:%.*]] ], [ 0, [[VECTOR_MEMCHECK]] ] 881; CHECK-NEXT: br label [[FOR_BODY:%.*]] 882; CHECK: for.body: 883; CHECK-NEXT: [[INDVARS_IV:%.*]] = phi i64 [ [[BC_RESUME_VAL]], [[SCALAR_PH]] ], [ [[INDVARS_IV_NEXT:%.*]], [[FOR_BODY]] ] 884; CHECK-NEXT: [[TMP:%.*]] = trunc i64 [[INDVARS_IV]] to i32 885; CHECK-NEXT: [[CONV:%.*]] = sitofp i32 [[TMP]] to float 886; CHECK-NEXT: [[ARRAYIDX:%.*]] = getelementptr inbounds float, float* [[EXP]], i64 [[INDVARS_IV]] 887; CHECK-NEXT: [[TMP1:%.*]] = load float, float* [[ARRAYIDX]], align 4 888; CHECK-NEXT: [[TMP2:%.*]] = tail call fast float @llvm.pow.f32(float [[CONV]], float [[TMP1]]) #[[ATTR14:[0-9]+]] 889; CHECK-NEXT: [[ARRAYIDX2:%.*]] = getelementptr inbounds float, float* [[VARRAY]], i64 [[INDVARS_IV]] 890; CHECK-NEXT: store float [[TMP2]], float* [[ARRAYIDX2]], align 4 891; CHECK-NEXT: [[INDVARS_IV_NEXT]] = add nuw nsw i64 [[INDVARS_IV]], 1 892; CHECK-NEXT: [[EXITCOND:%.*]] = icmp eq i64 [[INDVARS_IV_NEXT]], 1000 893; CHECK-NEXT: br i1 [[EXITCOND]], label [[FOR_END]], label [[FOR_BODY]], !llvm.loop [[LOOP37:![0-9]+]] 894; CHECK: for.end: 895; CHECK-NEXT: ret void 896; 897entry: 898 br label %for.body 899 900for.body: ; preds = %for.body, %entry 901 %indvars.iv = phi i64 [ 0, %entry ], [ %indvars.iv.next, %for.body ] 902 %tmp = trunc i64 %indvars.iv to i32 903 %conv = sitofp i32 %tmp to float 904 %arrayidx = getelementptr inbounds float, float* %exp, i64 %indvars.iv 905 %tmp1 = load float, float* %arrayidx, align 4 906 %tmp2 = tail call fast float @llvm.pow.f32(float %conv, float %tmp1) 907 %arrayidx2 = getelementptr inbounds float, float* %varray, i64 %indvars.iv 908 store float %tmp2, float* %arrayidx2, align 4 909 %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1 910 %exitcond = icmp eq i64 %indvars.iv.next, 1000 911 br i1 %exitcond, label %for.end, label %for.body, !llvm.loop !131 912 913for.end: ; preds = %for.body 914 ret void 915} 916 917!131 = distinct !{!131, !132, !133} 918!132 = !{!"llvm.loop.vectorize.width", i32 4} 919!133 = !{!"llvm.loop.vectorize.enable", i1 true} 920 921attributes #0 = { nounwind readnone } 922 923declare double @sin(double) #0 924declare float @sinf(float) #0 925declare double @llvm.sin.f64(double) #0 926declare float @llvm.sin.f32(float) #0 927declare double @cos(double) #0 928declare float @cosf(float) #0 929declare double @llvm.cos.f64(double) #0 930declare float @llvm.cos.f32(float) #0 931declare float @expf(float) #0 932declare float @powf(float, float) #0 933declare float @llvm.exp.f32(float) #0 934declare float @logf(float) #0 935declare float @llvm.pow.f32(float, float) #0 936