LLVM OpenMP
shared-var.c
Go to the documentation of this file.
1// RUN: %libomp-compile -fopenmp-version=60 && %libomp-run \
2// RUN: | FileCheck %s --match-full-lines
3
4// Loops of a fused sequence share one iteration variable. After the construct
5// the variable must hold the loop-exit value of the last loop of the sequence,
6// as without the directive, also when that loop is a consumed transformation.
7
8#ifndef HEADER
9#define HEADER
10
11#include <stdio.h>
12#include <stdlib.h>
13
14static void test_reverse_last(void) {
15 int i = -1;
16#pragma omp fuse
17 {
18 for (i = 0; i < 4; i++)
19 ;
20#pragma omp reverse
21 for (i = 0; i < 6; i++)
22 ;
23 }
24 printf("reverse_last: i=%d\n", i);
25}
26
27static void test_unroll_last(void) {
28 int i = -1;
29#pragma omp fuse
30 {
31 for (i = 0; i < 4; i++)
32 ;
33#pragma omp unroll partial(2)
34 for (i = 0; i < 6; i++)
35 ;
36 }
37 printf("unroll_last: i=%d\n", i);
38}
39
40int main(void) {
43 return EXIT_SUCCESS;
44}
45#endif
46
47// CHECK: reverse_last: i=6
48// CHECK-NEXT: unroll_last: i=6
#define i
Definition kmp_stub.cpp:88
static void test_reverse_last(void)
Definition shared-var.c:14
int main(void)
Definition shared-var.c:40
static void test_unroll_last(void)
Definition shared-var.c:27