Mercurial > hg > CbC > CbC_gcc
comparison gcc/testsuite/gcc.dg/tree-ssa/loop-interchange-9.c @ 131:84e7813d76e9
gcc-8.2
author | mir3636 |
---|---|
date | Thu, 25 Oct 2018 07:37:49 +0900 |
parents | |
children | 1830386684a0 |
comparison
equal
deleted
inserted
replaced
111:04ced10e8804 | 131:84e7813d76e9 |
---|---|
1 /* { dg-do run } */ | |
2 /* { dg-options "-O2 -floop-interchange -fdump-tree-linterchange-details" } */ | |
3 /* { dg-skip-if "too big data segment" { avr-*-* visium-*-* } } */ | |
4 | |
5 #define M 256 | |
6 int a[M][M], b[M][M], c[M], d[M]; | |
7 void __attribute__((noinline)) | |
8 simple_reduc_1 (int n) | |
9 { | |
10 for (int j = 0; j < n; j++) | |
11 { | |
12 int sum = c[j]; | |
13 for (int i = 0; i < n; i++) | |
14 sum = sum + a[i][j]*b[i][j]; | |
15 | |
16 c[j] = sum; | |
17 } | |
18 } | |
19 | |
20 void __attribute__((noinline)) | |
21 simple_reduc_2 (int n) | |
22 { | |
23 for (int j = 0; j < n; j++) | |
24 { | |
25 int sum = d[j]; | |
26 for (int i = 0; i < n; i++) | |
27 sum = sum + a[i][j]*b[i][j]; | |
28 | |
29 asm volatile ("" ::: "memory"); | |
30 d[j] = sum; | |
31 } | |
32 } | |
33 | |
34 extern void abort (); | |
35 | |
36 static void __attribute__((noinline)) | |
37 init (int i) | |
38 { | |
39 c[i] = 0; | |
40 d[i] = 0; | |
41 for (int j = 0; j < M; j++) | |
42 { | |
43 a[i][j] = i; | |
44 b[i][j] = j; | |
45 } | |
46 } | |
47 | |
48 int main (void) | |
49 { | |
50 for (int i = 0; i < M; ++i) | |
51 init (i); | |
52 | |
53 simple_reduc_1 (M); | |
54 simple_reduc_2 (M); | |
55 | |
56 for (int i = 0; i < M; ++i) | |
57 if (c[i] != d[i]) | |
58 abort (); | |
59 | |
60 return 0; | |
61 } | |
62 | |
63 /* { dg-final { scan-tree-dump-times "Loop_pair<outer:., inner:.> is interchanged" 1 "linterchange" } } */ |