brintos

brintos / llvm-project-archived public Read only

0
0
Text · 2.1 KiB · 91f7c9d Raw
56 lines · plain
1; RUN: opt %loadNPMPolly -aa-pipeline=basic-aa '-passes=polly-custom<ast>' -polly-print-ast -polly-ast-detect-parallel -disable-output < %s | FileCheck %s2;3; CHECK: #pragma simd reduction (+ : MemRef_sum{{[1,2]}}, MemRef_sum{{[1,2]}}) reduction (* : MemRef_prod) reduction (| : MemRef_or) reduction (& : MemRef_and)4; CHECK: #pragma known-parallel reduction (+ : MemRef_sum{{[1,2]}}, MemRef_sum{{[1,2]}}) reduction (* : MemRef_prod) reduction (| : MemRef_or) reduction (& : MemRef_and)5; CHECK: for (int c0 = 0; c0 < N; c0 += 1)6; CHECK:   Stmt_for_body(c0);7;8;    void f(int N, int *restrict sum1, int *restrict sum2, int *restrict prod,9;           int *restrict and, int *restrict or ) {10;      for (int i = 0; i < N; i++) {11;        *sum1 += i;12;        *sum2 += i + 1;13;        *prod *= i;14;        *and &= i;15;        * or |= i;16;      }17;    }18;19target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"20 21define void @f(i32 %N, ptr noalias %sum1, ptr noalias %sum2, ptr noalias %prod, ptr noalias %and, ptr noalias %or) {22entry:23  br label %for.cond24 25for.cond:                                         ; preds = %for.inc, %entry26  %i.0 = phi i32 [ 0, %entry ], [ %inc, %for.inc ]27  %cmp = icmp slt i32 %i.0, %N28  br i1 %cmp, label %for.body, label %for.end29 30for.body:                                         ; preds = %for.cond31  %tmp = load i32, ptr %sum1, align 432  %add = add nsw i32 %tmp, %i.033  store i32 %add, ptr %sum1, align 434  %add1 = add nsw i32 %i.0, 135  %tmp1 = load i32, ptr %sum2, align 436  %add2 = add nsw i32 %tmp1, %add137  store i32 %add2, ptr %sum2, align 438  %tmp2 = load i32, ptr %prod, align 439  %mul = mul nsw i32 %tmp2, %i.040  store i32 %mul, ptr %prod, align 441  %tmp3 = load i32, ptr %and, align 442  %and3 = and i32 %tmp3, %i.043  store i32 %and3, ptr %and, align 444  %tmp4 = load i32, ptr %or, align 445  %or4 = or i32 %tmp4, %i.046  store i32 %or4, ptr %or, align 447  br label %for.inc48 49for.inc:                                          ; preds = %for.body50  %inc = add nsw i32 %i.0, 151  br label %for.cond52 53for.end:                                          ; preds = %for.cond54  ret void55}56