1 ; RUN: opt %loadNPMPolly -passes=polly-opt-isl -polly-pattern-matching-based-opts=false \
2 ; RUN: -debug -polly-tc-opt -disable-output < %s 2>&1 | FileCheck %s
3 ; RUN: opt %loadNPMPolly -passes=polly-opt-isl -polly-pattern-matching-based-opts=true -debug -polly-tc-opt -disable-output < %s 2>&1 | FileCheck %s --check-prefix=PATTERN-MATCHING-OPTS
4 ; RUN: opt %loadNPMPolly '-passes=polly-opt-isl,print<polly-ast>' -polly-pattern-matching-based-opts=true -polly-ast-detect-parallel -disable-output < %s | FileCheck %s --check-prefix=PARALLEL-AST
5 ; RUN: opt %loadNPMPolly -passes=polly-opt-isl -polly-pattern-matching-based-opts=true -stats -disable-output < %s 2>&1 | FileCheck %s --check-prefix=STATS -match-full-lines
8 ; /* C := alpha*A*B + beta*C */
9 ; for (i = 0; i < _PB_NI; i++)
10 ; for (j = 0; j < _PB_NJ; j++)
13 ; for (k = 0; k < _PB_NK; ++k)
14 ; C[i][j] += alpha * A[i][k] * B[k][j];
17 ; CHECK-NOT: The matrix multiplication pattern was detected
18 ; CHECK-NOT: The tensor contraction pattern was detected
19 ; PATTERN-MATCHING-OPTS: The tensor contraction pattern was detected
20 ; PATTERN-MATCHING-OPTS: The matrix multiplication pattern was detected
21 ; PARALLEL-AST-NOT: #pragma known-parallel
22 ; STATS: 1 polly-opt-isl - Number of matrix multiplication patterns detected and optimized
24 target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
25 target triple = "x86_64-unknown-unknown"
27 define internal void @kernel_gemm(i32 %arg, i32 %arg1, i32 %arg2, double %arg3, double %arg4, ptr %arg5, ptr %arg6, ptr %arg7) #0 {
31 bb8: ; preds = %bb29, %bb
32 %tmp = phi i64 [ 0, %bb ], [ %tmp30, %bb29 ]
35 bb9: ; preds = %bb26, %bb8
36 %tmp10 = phi i64 [ 0, %bb8 ], [ %tmp27, %bb26 ]
37 %tmp11 = getelementptr inbounds [1056 x double], ptr %arg5, i64 %tmp, i64 %tmp10
38 %tmp12 = load double, ptr %tmp11, align 8
39 %tmp13 = fmul double %tmp12, %arg4
40 store double %tmp13, ptr %tmp11, align 8
43 Copy_0: ; preds = %Copy_0, %bb9
44 %tmp15 = phi i64 [ 0, %bb9 ], [ %tmp24, %Copy_0 ]
45 %tmp16 = getelementptr inbounds [1024 x double], ptr %arg6, i64 %tmp, i64 %tmp15
46 %tmp17 = load double, ptr %tmp16, align 8
47 %tmp18 = fmul double %tmp17, %arg3
48 %tmp19 = getelementptr inbounds [1056 x double], ptr %arg7, i64 %tmp15, i64 %tmp10
49 %tmp20 = load double, ptr %tmp19, align 8
50 %tmp21 = fmul double %tmp18, %tmp20
51 %tmp22 = load double, ptr %tmp11, align 8
52 %tmp23 = fadd double %tmp22, %tmp21
53 store double %tmp23, ptr %tmp11, align 8
54 %tmp24 = add nuw nsw i64 %tmp15, 1
55 %tmp25 = icmp ne i64 %tmp24, 1024
56 br i1 %tmp25, label %Copy_0, label %bb26
58 bb26: ; preds = %Copy_0
59 %tmp27 = add nuw nsw i64 %tmp10, 1
60 %tmp28 = icmp ne i64 %tmp27, 1056
61 br i1 %tmp28, label %bb9, label %bb29
64 %tmp30 = add nuw nsw i64 %tmp, 1
65 %tmp31 = icmp ne i64 %tmp30, 1056
66 br i1 %tmp31, label %bb8, label %bb32