1 ! This test checks lowering of OpenMP DO Directive(Worksharing) with collapse.
3 ! RUN: bbc -fopenmp -emit-fir %s -o - | FileCheck %s
5 program wsloop_collapse
9 ! CHECK: %[[VAL_0:.*]] = fir.alloca i32 {bindc_name = "a", uniq_name = "_QFEa"}
10 ! CHECK: %[[VAL_1:.*]] = fir.alloca i32 {bindc_name = "b", uniq_name = "_QFEb"}
11 ! CHECK: %[[VAL_2:.*]] = fir.alloca i32 {bindc_name = "c", uniq_name = "_QFEc"}
12 ! CHECK: %[[VAL_3:.*]] = fir.alloca i32 {bindc_name = "i", uniq_name = "_QFEi"}
13 ! CHECK: %[[VAL_4:.*]] = fir.alloca i32 {bindc_name = "j", uniq_name = "_QFEj"}
14 ! CHECK: %[[VAL_5:.*]] = fir.alloca i32 {bindc_name = "k", uniq_name = "_QFEk"}
15 ! CHECK: %[[VAL_6:.*]] = fir.alloca i32 {bindc_name = "x", uniq_name = "_QFEx"}
17 ! CHECK: %[[VAL_7:.*]] = arith.constant 3 : i32
18 ! CHECK: fir.store %[[VAL_7]] to %[[VAL_0]] : !fir.ref<i32>
20 ! CHECK: %[[VAL_8:.*]] = arith.constant 2 : i32
21 ! CHECK: fir.store %[[VAL_8]] to %[[VAL_1]] : !fir.ref<i32>
23 ! CHECK: %[[VAL_9:.*]] = arith.constant 5 : i32
24 ! CHECK: fir.store %[[VAL_9]] to %[[VAL_2]] : !fir.ref<i32>
26 ! CHECK: %[[VAL_10:.*]] = arith.constant 0 : i32
27 ! CHECK: fir.store %[[VAL_10]] to %[[VAL_6]] : !fir.ref<i32>
30 ! CHECK: %[[VAL_20:.*]] = arith.constant 1 : i32
31 ! CHECK: %[[VAL_21:.*]] = fir.load %[[VAL_0]] : !fir.ref<i32>
32 ! CHECK: %[[VAL_22:.*]] = arith.constant 1 : i32
33 ! CHECK: %[[VAL_23:.*]] = arith.constant 1 : i32
34 ! CHECK: %[[VAL_24:.*]] = fir.load %[[VAL_1]] : !fir.ref<i32>
35 ! CHECK: %[[VAL_25:.*]] = arith.constant 1 : i32
36 ! CHECK: %[[VAL_26:.*]] = arith.constant 1 : i32
37 ! CHECK: %[[VAL_27:.*]] = fir.load %[[VAL_2]] : !fir.ref<i32>
38 ! CHECK: %[[VAL_28:.*]] = arith.constant 1 : i32
42 ! CHECK: omp.wsloop for (%[[ARG0:.*]], %[[ARG1:.*]], %[[ARG2:.*]]) : i32 = (%[[VAL_20]], %[[VAL_23]], %[[VAL_26]]) to (%[[VAL_21]], %[[VAL_24]], %[[VAL_27]]) inclusive step (%[[VAL_22]], %[[VAL_25]], %[[VAL_28]]) {
43 ! CHECK: fir.store %[[ARG0]] to %[[STORE_IV0:.*]] : !fir.ref<i32>
44 ! CHECK: fir.store %[[ARG1]] to %[[STORE_IV1:.*]] : !fir.ref<i32>
45 ! CHECK: fir.store %[[ARG2]] to %[[STORE_IV2:.*]] : !fir.ref<i32>
46 ! CHECK: %[[VAL_12:.*]] = fir.load %[[VAL_6]] : !fir.ref<i32>
47 ! CHECK: %[[LOAD_IV0:.*]] = fir.load %[[STORE_IV0]] : !fir.ref<i32>
48 ! CHECK: %[[VAL_13:.*]] = arith.addi %[[VAL_12]], %[[LOAD_IV0]] : i32
49 ! CHECK: %[[LOAD_IV1:.*]] = fir.load %[[STORE_IV1]] : !fir.ref<i32>
50 ! CHECK: %[[VAL_14:.*]] = arith.addi %[[VAL_13]], %[[LOAD_IV1]] : i32
51 ! CHECK: %[[LOAD_IV2:.*]] = fir.load %[[STORE_IV2]] : !fir.ref<i32>
52 ! CHECK: %[[VAL_15:.*]] = arith.addi %[[VAL_14]], %[[LOAD_IV2]] : i32
53 ! CHECK: fir.store %[[VAL_15]] to %[[VAL_6]] : !fir.ref<i32>
63 end program wsloop_collapse