[Polly][NewPM] Reenable ScopPassManager unittest
[polly-mirror.git] / test / ScopDetect / intrinsics_1.ll
blob592c29de5f6d01732e4a1e2279eb25ffcc40acc9
1 ; RUN: opt %loadPolly -basicaa -polly-detect -analyze < %s | FileCheck %s
3 ; CHECK: Valid Region for Scop: for.cond => for.end
5 ;    #include "math.h"
7 ;    void jd(int *restrict A, float *restrict B) {
8 ;      for (int i = 0; i < 1024; i++) {
9 ;        A[i] = pow(ceil(log10(sqrt(i))), floor(log2(i)));
10 ;        B[i] = fabs(log(sin(i)) + exp2(cos(i))) + exp(i);
11 ;      }
12 ;    }
14 ; ModuleID = '/home/johannes/repos/polly/test/ScopDetect/intrinsics.ll'
15 target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
17 ; Function Attrs: nounwind uwtable
18 define void @jd(i32* noalias %A, float* noalias %B) #0 {
19 entry:
20   br label %for.cond
22 for.cond:                                         ; preds = %for.inc, %entry
23   %indvars.iv = phi i64 [ %indvars.iv.next, %for.inc ], [ 0, %entry ]
24   %exitcond = icmp ne i64 %indvars.iv, 1024
25   br i1 %exitcond, label %for.body, label %for.end
27 for.body:                                         ; preds = %for.cond
28   %tmp = trunc i64 %indvars.iv to i32
29   %conv = sitofp i32 %tmp to double
30   %tmp1 = call double @llvm.sqrt.f64(double %conv)
31   %call = call double @__log10_finite(double %tmp1) #2
32   %call1 = call double @ceil(double %call) #2
33   %tmp2 = trunc i64 %indvars.iv to i32
34   %conv2 = sitofp i32 %tmp2 to double
35   %call3 = call double @__log2_finite(double %conv2) #2
36   %call4 = call double @floor(double %call3) #2
37   %tmp3 = call double @llvm.pow.f64(double %call1, double %call4)
38   %conv5 = fptosi double %tmp3 to i32
39   %arrayidx = getelementptr inbounds i32, i32* %A, i64 %indvars.iv
40   store i32 %conv5, i32* %arrayidx, align 4
41   %tmp4 = trunc i64 %indvars.iv to i32
42   %conv6 = sitofp i32 %tmp4 to double
43   %call7 = call double @sin(double %conv6) #2
44   %call8 = call double @__log_finite(double %call7) #2
45   %tmp5 = trunc i64 %indvars.iv to i32
46   %conv9 = sitofp i32 %tmp5 to double
47   %call10 = call double @cos(double %conv9) #2
48   %call11 = call double @__exp2_finite(double %call10) #2
49   %add = fadd fast double %call8, %call11
50   %call12 = call double @fabs(double %add) #2
51   %tmp6 = trunc i64 %indvars.iv to i32
52   %conv13 = sitofp i32 %tmp6 to double
53   %call14 = call double @__exp_finite(double %conv13) #2
54   %add15 = fadd fast double %call12, %call14
55   %conv16 = fptrunc double %add15 to float
56   %arrayidx18 = getelementptr inbounds float, float* %B, i64 %indvars.iv
57   store float %conv16, float* %arrayidx18, align 4
58   br label %for.inc
60 for.inc:                                          ; preds = %for.body
61   %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
62   br label %for.cond
64 for.end:                                          ; preds = %for.cond
65   ret void
68 ; Function Attrs: nounwind readnone
69 declare double @ceil(double) #1
71 ; Function Attrs: nounwind readnone
72 declare double @__log10_finite(double) #1
74 ; Function Attrs: nounwind readnone
75 declare double @llvm.sqrt.f64(double) #2
77 ; Function Attrs: nounwind readnone
78 declare double @floor(double) #1
80 ; Function Attrs: nounwind readnone
81 declare double @__log2_finite(double) #1
83 ; Function Attrs: nounwind readnone
84 declare double @llvm.pow.f64(double, double) #2
86 ; Function Attrs: nounwind readnone
87 declare double @fabs(double) #1
89 ; Function Attrs: nounwind readnone
90 declare double @__log_finite(double) #1
92 ; Function Attrs: nounwind readnone
93 declare double @sin(double) #1
95 ; Function Attrs: nounwind readnone
96 declare double @__exp2_finite(double) #1
98 ; Function Attrs: nounwind readnone
99 declare double @cos(double) #1
101 ; Function Attrs: nounwind readnone
102 declare double @__exp_finite(double) #1
104 attributes #0 = { nounwind uwtable "less-precise-fpmad"="false" "no-frame-pointer-elim"="true" "no-frame-pointer-elim-non-leaf" "no-infs-fp-math"="true" "no-nans-fp-math"="true" "stack-protector-buffer-size"="8" "unsafe-fp-math"="true" "use-soft-float"="false" }
105 attributes #1 = { nounwind readnone "less-precise-fpmad"="false" "no-frame-pointer-elim"="true" "no-frame-pointer-elim-non-leaf" "no-infs-fp-math"="true" "no-nans-fp-math"="true" "stack-protector-buffer-size"="8" "unsafe-fp-math"="true" "use-soft-float"="false" }
106 attributes #2 = { nounwind readnone }