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