blob: a2d11fb3229f23b7ad7e3302d11d610a2c51ea8b [file] [log] [blame]
Roman Gareev75037412017-07-19 16:59:061; RUN: opt %loadPolly -polly-import-jscop \
Roman Gareev6531df42017-07-19 17:33:422; RUN: -polly-import-jscop-postfix=transformed \
3; RUN: -polly-pattern-matching-based-opts=true \
4; RUN: -polly-target-throughput-vector-fma=1 \
5; RUN: -polly-target-latency-vector-fma=8 \
6; RUN: -polly-target-1st-cache-level-associativity=8 \
7; RUN: -polly-target-2nd-cache-level-associativity=8 \
8; RUN: -polly-target-1st-cache-level-size=32768 \
9; RUN: -polly-target-vector-register-bitwidth=256 \
10; RUN: -polly-target-2nd-cache-level-size=262144 \
11; RUN: -polly-opt-isl -debug < %s 2>&1 \
12; RUN: | FileCheck %s
Roman Gareev5abea0c2017-07-19 18:01:5113; REQUIRES: asserts
Roman Gareev75037412017-07-19 16:59:0614;
15; Check that the pattern matching detects the matrix multiplication pattern
16; in case scalar memory accesses were replaced by accesses to newly created
17; arrays.
18;
19; CHECK: The matrix multiplication pattern was detected
20;
Roman Gareev6531df42017-07-19 17:33:4221target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
22target triple = "x86_64-unknown-unknown"
23
Roman Gareev75037412017-07-19 16:59:0624define void @kernel_gemm(i32 %ni, i32 %nj, i32 %nk, double %A, [1024 x double]* %B, [1024 x double]* %C) {
25entry:
26 br label %entry.split
27
28entry.split: ; preds = %entry
29 br label %for.cond1.preheader
30
31for.cond1.preheader: ; preds = %for.inc16, %entry.split
32 %indvars.iv35 = phi i64 [ 0, %entry.split ], [ %indvars.iv.next36, %for.inc16 ]
33 br label %for.cond4.preheader
34
35for.cond4.preheader: ; preds = %for.inc13, %for.cond1.preheader
36 %indvars.iv32 = phi i64 [ 0, %for.cond1.preheader ], [ %indvars.iv.next33, %for.inc13 ]
37 br label %for.body6
38
39for.body6: ; preds = %for.body6, %for.cond4.preheader
40 %indvars.iv = phi i64 [ 0, %for.cond4.preheader ], [ %indvars.iv.next, %for.body6 ]
41 %arrayidx8 = getelementptr inbounds [1024 x double], [1024 x double]* %B, i64 %indvars.iv, i64 %indvars.iv32
42 %tmp = load double, double* %arrayidx8, align 8
43 %mul = fmul double %tmp, %A
44 %arrayidx12 = getelementptr inbounds [1024 x double], [1024 x double]* %C, i64 %indvars.iv35, i64 %indvars.iv32
45 %tmp1 = load double, double* %arrayidx12, align 8
46 %add = fadd double %tmp1, %mul
47 store double %add, double* %arrayidx12, align 8
48 %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
49 %exitcond = icmp ne i64 %indvars.iv.next, 1024
50 br i1 %exitcond, label %for.body6, label %for.inc13
51
52for.inc13: ; preds = %for.body6
53 %indvars.iv.next33 = add nuw nsw i64 %indvars.iv32, 1
54 %exitcond34 = icmp ne i64 %indvars.iv.next33, 1024
55 br i1 %exitcond34, label %for.cond4.preheader, label %for.inc16
56
57for.inc16: ; preds = %for.inc13
58 %indvars.iv.next36 = add nuw nsw i64 %indvars.iv35, 1
59 %exitcond37 = icmp ne i64 %indvars.iv.next36, 1024
60 br i1 %exitcond37, label %for.cond1.preheader, label %for.end18
61
62for.end18: ; preds = %for.inc16
63 ret void
64}