280 lines · plain
1; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --filter "(:|sincos|modf|extract|store)" --version 52; RUN: opt -passes=loop-vectorize -force-vector-interleave=1 -force-vector-width=2 < %s -S -o - | FileCheck %s3 4define void @sincos_f32(ptr noalias %in, ptr noalias writeonly %out_a, ptr noalias writeonly %out_b) {5; CHECK-LABEL: define void @sincos_f32(6; CHECK-SAME: ptr noalias [[IN:%.*]], ptr noalias writeonly [[OUT_A:%.*]], ptr noalias writeonly [[OUT_B:%.*]]) {7; CHECK: [[ENTRY:.*:]]8; CHECK: [[VECTOR_PH:.*:]]9; CHECK: [[VECTOR_BODY:.*:]]10; CHECK: [[TMP3:%.*]] = call { <2 x float>, <2 x float> } @llvm.sincos.v2f32(<2 x float> [[WIDE_LOAD:%.*]])11; CHECK: [[TMP4:%.*]] = extractvalue { <2 x float>, <2 x float> } [[TMP3]], 012; CHECK: [[TMP5:%.*]] = extractvalue { <2 x float>, <2 x float> } [[TMP3]], 113; CHECK: store <2 x float> [[TMP4]], ptr [[TMP7:%.*]], align 414; CHECK: store <2 x float> [[TMP5]], ptr [[TMP9:%.*]], align 415; CHECK: [[FOR_BODY:.*:]]16; CHECK: [[EXIT:.*:]]17;18entry:19 br label %for.body20 21for.body:22 %iv = phi i64 [ 0, %entry ], [ %iv.next, %for.body ]23 %arrayidx = getelementptr inbounds float, ptr %in, i64 %iv24 %in_val = load float, ptr %arrayidx, align 425 %call = tail call { float, float } @llvm.sincos.f32(float %in_val)26 %extract_a = extractvalue { float, float } %call, 027 %extract_b = extractvalue { float, float } %call, 128 %arrayidx2 = getelementptr inbounds float, ptr %out_a, i64 %iv29 store float %extract_a, ptr %arrayidx2, align 430 %arrayidx4 = getelementptr inbounds float, ptr %out_b, i64 %iv31 store float %extract_b, ptr %arrayidx4, align 432 %iv.next = add nuw nsw i64 %iv, 133 %exitcond.not = icmp eq i64 %iv.next, 102434 br i1 %exitcond.not, label %exit, label %for.body35 36exit:37 ret void38}39 40define void @sincos_f64(ptr noalias %in, ptr noalias writeonly %out_a, ptr noalias writeonly %out_b) {41; CHECK-LABEL: define void @sincos_f64(42; CHECK-SAME: ptr noalias [[IN:%.*]], ptr noalias writeonly [[OUT_A:%.*]], ptr noalias writeonly [[OUT_B:%.*]]) {43; CHECK: [[ENTRY:.*:]]44; CHECK: [[VECTOR_PH:.*:]]45; CHECK: [[VECTOR_BODY:.*:]]46; CHECK: [[TMP3:%.*]] = call { <2 x double>, <2 x double> } @llvm.sincos.v2f64(<2 x double> [[WIDE_LOAD:%.*]])47; CHECK: [[TMP4:%.*]] = extractvalue { <2 x double>, <2 x double> } [[TMP3]], 048; CHECK: [[TMP5:%.*]] = extractvalue { <2 x double>, <2 x double> } [[TMP3]], 149; CHECK: store <2 x double> [[TMP4]], ptr [[TMP7:%.*]], align 850; CHECK: store <2 x double> [[TMP5]], ptr [[TMP9:%.*]], align 851; CHECK: [[FOR_BODY:.*:]]52; CHECK: [[EXIT:.*:]]53;54entry:55 br label %for.body56 57for.body:58 %iv = phi i64 [ 0, %entry ], [ %iv.next, %for.body ]59 %arrayidx = getelementptr inbounds double, ptr %in, i64 %iv60 %in_val = load double, ptr %arrayidx, align 861 %call = tail call { double, double } @llvm.sincos.f64(double %in_val)62 %extract_a = extractvalue { double, double } %call, 063 %extract_b = extractvalue { double, double } %call, 164 %arrayidx2 = getelementptr inbounds double, ptr %out_a, i64 %iv65 store double %extract_a, ptr %arrayidx2, align 866 %arrayidx4 = getelementptr inbounds double, ptr %out_b, i64 %iv67 store double %extract_b, ptr %arrayidx4, align 868 %iv.next = add nuw nsw i64 %iv, 169 %exitcond.not = icmp eq i64 %iv.next, 102470 br i1 %exitcond.not, label %exit, label %for.body71 72exit:73 ret void74}75 76define void @predicated_sincos(float %x, ptr noalias %in, ptr noalias writeonly %out_a, ptr noalias writeonly %out_b) {77; CHECK-LABEL: define void @predicated_sincos(78; CHECK-SAME: float [[X:%.*]], ptr noalias [[IN:%.*]], ptr noalias writeonly [[OUT_A:%.*]], ptr noalias writeonly [[OUT_B:%.*]]) {79; CHECK: [[ENTRY:.*:]]80; CHECK: [[VECTOR_BODY:.*]]:81; CHECK: [[VECTOR_BODY1:.*:]]82; CHECK: [[INDEX:%.*]] = phi i64 [ 0, %[[VECTOR_BODY]] ], [ [[INDEX_NEXT:%.*]], %[[IF_THEN1:.*]] ]83; CHECK: [[TMP4:%.*]] = call { <2 x float>, <2 x float> } @llvm.sincos.v2f32(<2 x float> [[WIDE_LOAD:%.*]])84; CHECK: [[TMP5:%.*]] = extractvalue { <2 x float>, <2 x float> } [[TMP4]], 085; CHECK: [[TMP6:%.*]] = extractvalue { <2 x float>, <2 x float> } [[TMP4]], 186; CHECK: [[TMP7:%.*]] = extractelement <2 x i1> [[TMP3:%.*]], i32 087; CHECK: br i1 [[TMP7]], label %[[PRED_STORE_IF:.*]], label %[[PRED_STORE_CONTINUE:.*]]88; CHECK: [[PRED_STORE_IF]]:89; CHECK: [[TMP9:%.*]] = extractelement <2 x float> [[TMP5]], i32 090; CHECK: store float [[TMP9]], ptr [[TMP8:%.*]], align 491; CHECK: [[TMP11:%.*]] = extractelement <2 x float> [[TMP6]], i32 092; CHECK: store float [[TMP11]], ptr [[TMP10:%.*]], align 493; CHECK: br label %[[PRED_STORE_CONTINUE]]94; CHECK: [[PRED_STORE_CONTINUE]]:95; CHECK: [[TMP12:%.*]] = extractelement <2 x i1> [[TMP3]], i32 196; CHECK: br i1 [[TMP12]], label %[[PRED_STORE_IF1:.*]], label %[[IF_THEN1]]97; CHECK: [[PRED_STORE_IF1]]:98; CHECK: [[TMP15:%.*]] = extractelement <2 x float> [[TMP5]], i32 199; CHECK: store float [[TMP15]], ptr [[TMP14:%.*]], align 4100; CHECK: [[TMP17:%.*]] = extractelement <2 x float> [[TMP6]], i32 1101; CHECK: store float [[TMP17]], ptr [[TMP16:%.*]], align 4102; CHECK: br label %[[IF_THEN1]]103; CHECK: [[IF_THEN1]]:104; CHECK: [[IF_MERGE:.*:]]105; CHECK: [[FOR_END:.*:]]106;107entry:108 br label %for.body109 110for.body:111 %iv = phi i64 [ %iv.next, %if.merge ], [ 0, %entry ]112 %arrayidx = getelementptr inbounds float, ptr %in, i64 %iv113 %in_val = load float, ptr %arrayidx, align 4114 %if_cond = fcmp olt float %in_val, %x115 br i1 %if_cond, label %if.then, label %if.merge116 117if.then:118 %call = tail call { float, float } @llvm.sincos.f32(float %in_val)119 %extract_a = extractvalue { float, float } %call, 0120 %extract_b = extractvalue { float, float } %call, 1121 %arrayidx2 = getelementptr inbounds float, ptr %out_a, i64 %iv122 store float %extract_a, ptr %arrayidx2, align 4123 %arrayidx4 = getelementptr inbounds float, ptr %out_b, i64 %iv124 store float %extract_b, ptr %arrayidx4, align 4125 br label %if.merge126 127if.merge:128 %iv.next = add nuw nsw i64 %iv, 1129 %cond = icmp slt i64 %iv.next, 1024130 br i1 %cond, label %for.body, label %for.end131 132for.end:133 ret void134}135 136define void @modf_f32(ptr noalias %in, ptr noalias writeonly %out_a, ptr noalias writeonly %out_b) {137; CHECK-LABEL: define void @modf_f32(138; CHECK-SAME: ptr noalias [[IN:%.*]], ptr noalias writeonly [[OUT_A:%.*]], ptr noalias writeonly [[OUT_B:%.*]]) {139; CHECK: [[ENTRY:.*:]]140; CHECK: [[VECTOR_PH:.*:]]141; CHECK: [[VECTOR_BODY:.*:]]142; CHECK: [[TMP3:%.*]] = call { <2 x float>, <2 x float> } @llvm.modf.v2f32(<2 x float> [[WIDE_LOAD:%.*]])143; CHECK: [[TMP4:%.*]] = extractvalue { <2 x float>, <2 x float> } [[TMP3]], 0144; CHECK: [[TMP5:%.*]] = extractvalue { <2 x float>, <2 x float> } [[TMP3]], 1145; CHECK: store <2 x float> [[TMP4]], ptr [[TMP7:%.*]], align 4146; CHECK: store <2 x float> [[TMP5]], ptr [[TMP9:%.*]], align 4147; CHECK: [[FOR_BODY:.*:]]148; CHECK: [[EXIT:.*:]]149;150entry:151 br label %for.body152 153for.body:154 %iv = phi i64 [ 0, %entry ], [ %iv.next, %for.body ]155 %arrayidx = getelementptr inbounds float, ptr %in, i64 %iv156 %in_val = load float, ptr %arrayidx, align 4157 %call = tail call { float, float } @llvm.modf.f32(float %in_val)158 %extract_a = extractvalue { float, float } %call, 0159 %extract_b = extractvalue { float, float } %call, 1160 %arrayidx2 = getelementptr inbounds float, ptr %out_a, i64 %iv161 store float %extract_a, ptr %arrayidx2, align 4162 %arrayidx4 = getelementptr inbounds float, ptr %out_b, i64 %iv163 store float %extract_b, ptr %arrayidx4, align 4164 %iv.next = add nuw nsw i64 %iv, 1165 %exitcond.not = icmp eq i64 %iv.next, 1024166 br i1 %exitcond.not, label %exit, label %for.body167 168exit:169 ret void170}171 172define void @modf_f64(ptr noalias %in, ptr noalias writeonly %out_a, ptr noalias writeonly %out_b) {173; CHECK-LABEL: define void @modf_f64(174; CHECK-SAME: ptr noalias [[IN:%.*]], ptr noalias writeonly [[OUT_A:%.*]], ptr noalias writeonly [[OUT_B:%.*]]) {175; CHECK: [[ENTRY:.*:]]176; CHECK: [[VECTOR_PH:.*:]]177; CHECK: [[VECTOR_BODY:.*:]]178; CHECK: [[TMP3:%.*]] = call { <2 x double>, <2 x double> } @llvm.modf.v2f64(<2 x double> [[WIDE_LOAD:%.*]])179; CHECK: [[TMP4:%.*]] = extractvalue { <2 x double>, <2 x double> } [[TMP3]], 0180; CHECK: [[TMP5:%.*]] = extractvalue { <2 x double>, <2 x double> } [[TMP3]], 1181; CHECK: store <2 x double> [[TMP4]], ptr [[TMP7:%.*]], align 8182; CHECK: store <2 x double> [[TMP5]], ptr [[TMP9:%.*]], align 8183; CHECK: [[FOR_BODY:.*:]]184; CHECK: [[EXIT:.*:]]185;186entry:187 br label %for.body188 189for.body:190 %iv = phi i64 [ 0, %entry ], [ %iv.next, %for.body ]191 %arrayidx = getelementptr inbounds double, ptr %in, i64 %iv192 %in_val = load double, ptr %arrayidx, align 8193 %call = tail call { double, double } @llvm.modf.f64(double %in_val)194 %extract_a = extractvalue { double, double } %call, 0195 %extract_b = extractvalue { double, double } %call, 1196 %arrayidx2 = getelementptr inbounds double, ptr %out_a, i64 %iv197 store double %extract_a, ptr %arrayidx2, align 8198 %arrayidx4 = getelementptr inbounds double, ptr %out_b, i64 %iv199 store double %extract_b, ptr %arrayidx4, align 8200 %iv.next = add nuw nsw i64 %iv, 1201 %exitcond.not = icmp eq i64 %iv.next, 1024202 br i1 %exitcond.not, label %exit, label %for.body203 204exit:205 ret void206}207 208define void @sincospi_f32(ptr noalias %in, ptr noalias writeonly %out_a, ptr noalias writeonly %out_b) {209; CHECK-LABEL: define void @sincospi_f32(210; CHECK-SAME: ptr noalias [[IN:%.*]], ptr noalias writeonly [[OUT_A:%.*]], ptr noalias writeonly [[OUT_B:%.*]]) {211; CHECK: [[ENTRY:.*:]]212; CHECK: [[VECTOR_PH:.*:]]213; CHECK: [[VECTOR_BODY:.*:]]214; CHECK: [[TMP3:%.*]] = call { <2 x float>, <2 x float> } @llvm.sincospi.v2f32(<2 x float> [[WIDE_LOAD:%.*]])215; CHECK: [[TMP4:%.*]] = extractvalue { <2 x float>, <2 x float> } [[TMP3]], 0216; CHECK: [[TMP5:%.*]] = extractvalue { <2 x float>, <2 x float> } [[TMP3]], 1217; CHECK: store <2 x float> [[TMP4]], ptr [[TMP7:%.*]], align 4218; CHECK: store <2 x float> [[TMP5]], ptr [[TMP9:%.*]], align 4219; CHECK: [[FOR_BODY:.*:]]220; CHECK: [[EXIT:.*:]]221;222entry:223 br label %for.body224 225for.body:226 %iv = phi i64 [ 0, %entry ], [ %iv.next, %for.body ]227 %arrayidx = getelementptr inbounds float, ptr %in, i64 %iv228 %in_val = load float, ptr %arrayidx, align 4229 %call = tail call { float, float } @llvm.sincospi.f32(float %in_val)230 %extract_a = extractvalue { float, float } %call, 0231 %extract_b = extractvalue { float, float } %call, 1232 %arrayidx2 = getelementptr inbounds float, ptr %out_a, i64 %iv233 store float %extract_a, ptr %arrayidx2, align 4234 %arrayidx4 = getelementptr inbounds float, ptr %out_b, i64 %iv235 store float %extract_b, ptr %arrayidx4, align 4236 %iv.next = add nuw nsw i64 %iv, 1237 %exitcond.not = icmp eq i64 %iv.next, 1024238 br i1 %exitcond.not, label %exit, label %for.body239 240exit:241 ret void242}243 244define void @sincospi_f64(ptr noalias %in, ptr noalias writeonly %out_a, ptr noalias writeonly %out_b) {245; CHECK-LABEL: define void @sincospi_f64(246; CHECK-SAME: ptr noalias [[IN:%.*]], ptr noalias writeonly [[OUT_A:%.*]], ptr noalias writeonly [[OUT_B:%.*]]) {247; CHECK: [[ENTRY:.*:]]248; CHECK: [[VECTOR_PH:.*:]]249; CHECK: [[VECTOR_BODY:.*:]]250; CHECK: [[TMP3:%.*]] = call { <2 x double>, <2 x double> } @llvm.sincospi.v2f64(<2 x double> [[WIDE_LOAD:%.*]])251; CHECK: [[TMP4:%.*]] = extractvalue { <2 x double>, <2 x double> } [[TMP3]], 0252; CHECK: [[TMP5:%.*]] = extractvalue { <2 x double>, <2 x double> } [[TMP3]], 1253; CHECK: store <2 x double> [[TMP4]], ptr [[TMP7:%.*]], align 8254; CHECK: store <2 x double> [[TMP5]], ptr [[TMP9:%.*]], align 8255; CHECK: [[FOR_BODY:.*:]]256; CHECK: [[EXIT:.*:]]257;258entry:259 br label %for.body260 261for.body:262 %iv = phi i64 [ 0, %entry ], [ %iv.next, %for.body ]263 %arrayidx = getelementptr inbounds double, ptr %in, i64 %iv264 %in_val = load double, ptr %arrayidx, align 8265 %call = tail call { double, double } @llvm.sincospi.f64(double %in_val)266 %extract_a = extractvalue { double, double } %call, 0267 %extract_b = extractvalue { double, double } %call, 1268 %arrayidx2 = getelementptr inbounds double, ptr %out_a, i64 %iv269 store double %extract_a, ptr %arrayidx2, align 8270 %arrayidx4 = getelementptr inbounds double, ptr %out_b, i64 %iv271 store double %extract_b, ptr %arrayidx4, align 8272 %iv.next = add nuw nsw i64 %iv, 1273 %exitcond.not = icmp eq i64 %iv.next, 1024274 br i1 %exitcond.not, label %exit, label %for.body275 276exit:277 ret void278}279 280