summaryrefslogtreecommitdiffstats
path: root/polly/test/CodeGen/loop_with_condition_nested.c
diff options
context:
space:
mode:
authorTobias Grosser <grosser@fim.uni-passau.de>2011-04-29 06:27:02 +0000
committerTobias Grosser <grosser@fim.uni-passau.de>2011-04-29 06:27:02 +0000
commit758053788bde4747953f5f276ded345cd01323b1 (patch)
tree02f38df95a5327cb8644906d148b5bd8facf63f9 /polly/test/CodeGen/loop_with_condition_nested.c
parent011eae75123217b9125270ae08132a308cee7061 (diff)
downloadbcm5719-llvm-758053788bde4747953f5f276ded345cd01323b1.tar.gz
bcm5719-llvm-758053788bde4747953f5f276ded345cd01323b1.zip
Add initial version of Polly
This version is equivalent to commit ba26ebece8f5be84e9bd6315611d412af797147e in the old git repository. llvm-svn: 130476
Diffstat (limited to 'polly/test/CodeGen/loop_with_condition_nested.c')
-rw-r--r--polly/test/CodeGen/loop_with_condition_nested.c45
1 files changed, 45 insertions, 0 deletions
diff --git a/polly/test/CodeGen/loop_with_condition_nested.c b/polly/test/CodeGen/loop_with_condition_nested.c
new file mode 100644
index 00000000000..b3f743a8c38
--- /dev/null
+++ b/polly/test/CodeGen/loop_with_condition_nested.c
@@ -0,0 +1,45 @@
+#include <string.h>
+#define N 1024
+int A[N];
+int B[N];
+
+void loop_with_condition() {
+ int i;
+
+ __sync_synchronize();
+ for (i = 0; i < N; i++) {
+ if (i <= N / 2) {
+ if (i > 20)
+ A[i] = 1;
+ else
+ A[i] = 2;
+ }
+ B[i] = 3;
+ }
+ __sync_synchronize();
+}
+
+int main () {
+ int i;
+
+ memset(A, 0, sizeof(int) * N);
+ memset(B, 0, sizeof(int) * N);
+
+ loop_with_condition();
+
+ for (i = 0; i < N; i++)
+ if (B[i] != 3)
+ return 1;
+
+ for (i = 0; i < N; i++)
+ if (i <= N / 2 && i > 20 && A[i] != 1)
+ return 1;
+ else if (i > N / 2) {
+ if (i <= 20 && A[i] != 2)
+ return 1;
+ if (i > 20 && A[i] != 0)
+ return 1;
+ }
+ return 0;
+}
+
OpenPOWER on IntegriCloud