brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.9 KiB · 67139bb Raw
65 lines · plain
1; RUN: opt %loadNPMPolly '-passes=polly-custom<scops>' -polly-print-scops -disable-output < %s 2>&1 | FileCheck %s2;3; CHECK: Function: f_no_fast_math4; CHECK: Reduction Type: NONE5; CHECK: Function: f_fast_math6; CHECK: Reduction Type: +7;8; void f(float *sum) {9;   for (int i = 0; i < 100; i++)10;     *sum += 3.41 * i;11; }12target datalayout = "e-m:e-p:32:32-i64:64-v128:64:128-n32-S64"13 14define void @f_no_fast_math(ptr %sum) {15entry:16  br label %for.cond17 18for.cond:                                         ; preds = %for.inc, %entry19  %i.0 = phi i32 [ 0, %entry ], [ %inc, %for.inc ]20  %exitcond = icmp ne i32 %i.0, 10021  br i1 %exitcond, label %for.body, label %for.end22 23for.body:                                         ; preds = %for.cond24  %conv = sitofp i32 %i.0 to float25  %pi = fptrunc double 3.41 to float26  %mul = fmul float %conv, %pi27  %tmp = load float, ptr %sum, align 428  %add = fadd float %tmp, %mul29  store float %add, ptr %sum, align 430  br label %for.inc31 32for.inc:                                          ; preds = %for.body33  %inc = add nsw i32 %i.0, 134  br label %for.cond35 36for.end:                                          ; preds = %for.cond37  ret void38}39 40define void @f_fast_math(ptr %sum) {41entry:42  br label %for.cond43 44for.cond:                                         ; preds = %for.inc, %entry45  %i.0 = phi i32 [ 0, %entry ], [ %inc, %for.inc ]46  %exitcond = icmp ne i32 %i.0, 10047  br i1 %exitcond, label %for.body, label %for.end48 49for.body:                                         ; preds = %for.cond50  %conv = sitofp i32 %i.0 to float51  %pi = fptrunc double 3.41 to float52  %mul = fmul fast float %conv, %pi53  %tmp = load float, ptr %sum, align 454  %add = fadd fast float %tmp, %mul55  store float %add, ptr %sum, align 456  br label %for.inc57 58for.inc:                                          ; preds = %for.body59  %inc = add nsw i32 %i.0, 160  br label %for.cond61 62for.end:                                          ; preds = %for.cond63  ret void64}65