1; RUN: llc < %s -O=3 -mtriple=arm64-apple-ios -mcpu=cyclone -enable-unsafe-fp-math | FileCheck %s 2define void @foo_2d(double* %src) { 3entry: 4 %arrayidx1 = getelementptr inbounds double, double* %src, i64 5 5 %arrayidx2 = getelementptr inbounds double, double* %src, i64 11 6 %tmp = bitcast double* %arrayidx1 to <2 x double>* 7 br label %for.body 8 9; CHECK-LABEL: %for.body 10; CHECK: fmls.2d {{v[0-9]+}}, {{v[0-9]+}}, {{v[0-9]+}} 11; CHECK: fmls.2d {{v[0-9]+}}, {{v[0-9]+}}, {{v[0-9]+}}[0] 12; CHECK: fmls.d {{d[0-9]+}}, {{d[0-9]+}}, {{v[0-9]+}}[0] 13for.body: ; preds = %for.body, %entry 14 %indvars.iv = phi i64 [ 0, %entry ], [ %indvars.iv.next, %for.body ] 15 %indvars.iv.next = sub nuw nsw i64 %indvars.iv, 1 16 %arrayidx3 = getelementptr inbounds double, double* %src, i64 %indvars.iv.next 17 %tmp1 = load double, double* %arrayidx3, align 8 18 %add = fadd fast double %tmp1, %tmp1 19 %mul = fmul fast double %add, %add 20 %e1 = insertelement <2 x double> undef, double %add, i32 0 21 %e2 = insertelement <2 x double> %e1, double %add, i32 1 22 %sub2 = fsub fast <2 x double> %e2, <double 3.000000e+00, double -3.000000e+00> 23 %e3 = insertelement <2 x double> undef, double %mul, i32 0 24 %e4 = insertelement <2 x double> %e3, double %mul, i32 1 25 %mul2 = fmul fast <2 x double> %sub2,<double 3.000000e+00, double -3.000000e+00> 26 %e5 = insertelement <2 x double> undef, double %add, i32 0 27 %e6 = insertelement <2 x double> %e5, double %add, i32 1 28 %sub3 = fsub fast <2 x double> <double 3.000000e+00, double -3.000000e+00>, %mul2 29 %mulx = fmul fast <2 x double> %sub2, %e2 30 %subx = fsub fast <2 x double> %e4, %mulx 31 %e7 = insertelement <2 x double> undef, double %mul, i32 0 32 %e8 = insertelement <2 x double> %e7, double %mul, i32 1 33 %e9 = fmul fast <2 x double> %subx, %sub3 34 store <2 x double> %e9, <2 x double>* %tmp, align 8 35 %e10 = extractelement <2 x double> %sub3, i32 0 36 %mul3 = fmul fast double %mul, %e10 37 %sub4 = fsub fast double %mul, %mul3 38 store double %sub4, double* %arrayidx2, align 8 39 %exitcond = icmp eq i64 %indvars.iv.next, 25 40 br i1 %exitcond, label %for.end, label %for.body 41 42for.end: ; preds = %for.body 43 ret void 44} 45define void @foo_2s(float* %src) { 46entry: 47 %arrayidx1 = getelementptr inbounds float, float* %src, i64 5 48 %arrayidx2 = getelementptr inbounds float, float* %src, i64 11 49 %tmp = bitcast float* %arrayidx1 to <2 x float>* 50 br label %for.body 51 52; CHECK-LABEL: %for.body 53; CHECK: fmls.2s {{v[0-9]+}}, {{v[0-9]+}}, {{v[0-9]+}} 54; CHECK: fmls.2s {{v[0-9]+}}, {{v[0-9]+}}, {{v[0-9]+}}[0] 55; CHECK: fmls.s {{s[0-9]+}}, {{s[0-9]+}}, {{v[0-9]+}}[0] 56for.body: ; preds = %for.body, %entry 57 %indvars.iv = phi i64 [ 0, %entry ], [ %indvars.iv.next, %for.body ] 58 %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1 59 %arrayidx3 = getelementptr inbounds float, float* %src, i64 %indvars.iv.next 60 %tmp1 = load float, float* %arrayidx3, align 8 61 %add = fadd fast float %tmp1, %tmp1 62 %mul = fmul fast float %add, %add 63 %e1 = insertelement <2 x float> undef, float %add, i32 0 64 %e2 = insertelement <2 x float> %e1, float %add, i32 1 65 %add2 = fsub fast <2 x float> %e2, <float 3.000000e+00, float -3.000000e+00> 66 %e3 = insertelement <2 x float> undef, float %mul, i32 0 67 %e4 = insertelement <2 x float> %e3, float %mul, i32 1 68 %mul2 = fmul fast <2 x float> %add2,<float 3.000000e+00, float -3.000000e+00> 69 %e5 = insertelement <2 x float> undef, float %add, i32 0 70 %e6 = insertelement <2 x float> %e5, float %add, i32 1 71 %add3 = fsub fast <2 x float> <float 3.000000e+00, float -3.000000e+00>, %mul2 72 %mulx = fmul fast <2 x float> %add2, %e2 73 %addx = fsub fast <2 x float> %e4, %mulx 74 %e7 = insertelement <2 x float> undef, float %mul, i32 0 75 %e8 = insertelement <2 x float> %e7, float %mul, i32 1 76 %e9 = fmul fast <2 x float> %addx, %add3 77 store <2 x float> %e9, <2 x float>* %tmp, align 8 78 %e10 = extractelement <2 x float> %add3, i32 0 79 %mul3 = fmul fast float %mul, %e10 80 %add4 = fsub fast float %mul, %mul3 81 store float %add4, float* %arrayidx2, align 8 82 %exitcond = icmp eq i64 %indvars.iv.next, 25 83 br i1 %exitcond, label %for.end, label %for.body 84 85for.end: ; preds = %for.body 86 ret void 87} 88define void @foo_4s(float* %src) { 89entry: 90 %arrayidx1 = getelementptr inbounds float, float* %src, i64 5 91 %arrayidx2 = getelementptr inbounds float, float* %src, i64 11 92 %tmp = bitcast float* %arrayidx1 to <4 x float>* 93 br label %for.body 94 95; CHECK-LABEL: %for.body 96; CHECK: fmls.4s {{v[0-9]+}}, {{v[0-9]+}}, {{v[0-9]+}} 97; CHECK: fmls.4s {{v[0-9]+}}, {{v[0-9]+}}, {{v[0-9]+}}[0] 98for.body: ; preds = %for.body, %entry 99 %indvars.iv = phi i64 [ 0, %entry ], [ %indvars.iv.next, %for.body ] 100 %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1 101 %arrayidx3 = getelementptr inbounds float, float* %src, i64 %indvars.iv.next 102 %tmp1 = load float, float* %arrayidx3, align 8 103 %add = fadd fast float %tmp1, %tmp1 104 %mul = fmul fast float %add, %add 105 %e1 = insertelement <4 x float> undef, float %add, i32 0 106 %e2 = insertelement <4 x float> %e1, float %add, i32 1 107 %add2 = fadd fast <4 x float> %e2, <float 3.000000e+00, float -3.000000e+00, float 5.000000e+00, float 7.000000e+00> 108 %e3 = insertelement <4 x float> undef, float %mul, i32 0 109 %e4 = insertelement <4 x float> %e3, float %mul, i32 1 110 %mul2 = fmul fast <4 x float> %add2,<float 3.000000e+00, float -3.000000e+00, float 5.000000e+00, float 7.000000e+00> 111 %e5 = insertelement <4 x float> undef, float %add, i32 0 112 %e6 = insertelement <4 x float> %e5, float %add, i32 1 113 %add3 = fsub fast <4 x float> <float 3.000000e+00, float -3.000000e+00, float 5.000000e+00, float 7.000000e+00> , %mul2 114 %mulx = fmul fast <4 x float> %add2, %e2 115 %addx = fsub fast <4 x float> %e4, %mulx 116 %e7 = insertelement <4 x float> undef, float %mul, i32 0 117 %e8 = insertelement <4 x float> %e7, float %mul, i32 1 118 %e9 = fmul fast <4 x float> %addx, %add3 119 store <4 x float> %e9, <4 x float>* %tmp, align 8 120 %e10 = extractelement <4 x float> %add3, i32 0 121 %mul3 = fmul fast float %mul, %e10 122 store float %mul3, float* %arrayidx2, align 8 123 %exitcond = icmp eq i64 %indvars.iv.next, 25 124 br i1 %exitcond, label %for.end, label %for.body 125 126for.end: ; preds = %for.body 127 ret void 128} 129