Home | History | Annotate | Download | only in PowerPC
      1 ; RUN: llc < %s -mcpu=ppc | FileCheck %s
      2 
      3 target datalayout = "E-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v128:128:128-n32"
      4 target triple = "powerpc-unknown-linux-gnu"
      5 
      6 define i64 @foo(double* nocapture %n) nounwind readonly {
      7 entry:
      8   br label %for.body
      9 
     10 for.body:                                         ; preds = %for.body, %entry
     11   %i.06 = phi i32 [ 0, %entry ], [ %inc, %for.body ]
     12   %x.05 = phi i64 [ 0, %entry ], [ %conv1, %for.body ]
     13   %arrayidx = getelementptr inbounds double* %n, i32 %i.06
     14   %0 = load double* %arrayidx, align 8
     15   %conv = sitofp i64 %x.05 to double
     16   %add = fadd double %conv, %0
     17   %conv1 = fptosi double %add to i64
     18   %inc = add nsw i32 %i.06, 1
     19   %exitcond = icmp eq i32 %inc, 2048
     20   br i1 %exitcond, label %for.end, label %for.body
     21 
     22 for.end:                                          ; preds = %for.body
     23   ret i64 %conv1
     24 }
     25 
     26 ; CHECK: @foo
     27 ; CHECK-NOT: mtctr
     28 
     29 @init_value = global double 1.000000e+00, align 8
     30 @data64 = global [8000 x i64] zeroinitializer, align 8
     31 
     32 define i32 @main(i32 %argc, i8** nocapture %argv) {
     33 entry:
     34   %0 = load double* @init_value, align 8
     35   %conv = fptosi double %0 to i64
     36   %broadcast.splatinsert.i = insertelement <2 x i64> undef, i64 %conv, i32 0
     37   %broadcast.splat.i = shufflevector <2 x i64> %broadcast.splatinsert.i, <2 x i64> undef, <2 x i32> zeroinitializer
     38   br label %vector.body.i
     39 
     40 vector.body.i:                                    ; preds = %vector.body.i, %entry
     41   %index.i = phi i32 [ 0, %entry ], [ %index.next.i, %vector.body.i ]
     42   %next.gep.i = getelementptr [8000 x i64]* @data64, i32 0, i32 %index.i
     43   %1 = bitcast i64* %next.gep.i to <2 x i64>*
     44   store <2 x i64> %broadcast.splat.i, <2 x i64>* %1, align 8
     45   %next.gep.sum24.i = or i32 %index.i, 2
     46   %2 = getelementptr [8000 x i64]* @data64, i32 0, i32 %next.gep.sum24.i
     47   %3 = bitcast i64* %2 to <2 x i64>*
     48   store <2 x i64> %broadcast.splat.i, <2 x i64>* %3, align 8
     49   %index.next.i = add i32 %index.i, 4
     50   %4 = icmp eq i32 %index.next.i, 8000
     51   br i1 %4, label %_Z4fillIPxxEvT_S1_T0_.exit, label %vector.body.i
     52 
     53 _Z4fillIPxxEvT_S1_T0_.exit:                       ; preds = %vector.body.i
     54   ret i32 0
     55 }
     56 
     57 ; CHECK: @main
     58 ; CHECK: __fixdfdi
     59 ; CHECK: mtctr
     60 
     61