xref: /llvm-project/flang/test/Transforms/generic-loop-rewriting-todo.mlir (revision 1e2d5f7943d09d658a5fbacf661d2c6c361f857c)
1// RUN: fir-opt --omp-generic-loop-conversion -verify-diagnostics %s
2
3func.func @_QPparallel_loop() {
4  omp.parallel {
5    %c0 = arith.constant 0 : i32
6    %c10 = arith.constant 10 : i32
7    %c1 = arith.constant 1 : i32
8    // expected-error@below {{not yet implemented: Combined `parallel loop` directive}}
9    omp.loop {
10      omp.loop_nest (%arg3) : i32 = (%c0) to (%c10) inclusive step (%c1) {
11        omp.yield
12      }
13    }
14    omp.terminator
15  }
16  return
17}
18
19func.func @_QPloop_bind() {
20  omp.teams {
21    %c0 = arith.constant 0 : i32
22    %c10 = arith.constant 10 : i32
23    %c1 = arith.constant 1 : i32
24    // expected-error@below {{not yet implemented: Unhandled clause bind in omp.loop operation}}
25    omp.loop bind(thread) {
26      omp.loop_nest (%arg3) : i32 = (%c0) to (%c10) inclusive step (%c1) {
27        omp.yield
28      }
29    }
30    omp.terminator
31  }
32  return
33}
34
35omp.declare_reduction @add_reduction_i32 : i32 init {
36  ^bb0(%arg0: i32):
37    %c0_i32 = arith.constant 0 : i32
38    omp.yield(%c0_i32 : i32)
39  } combiner {
40  ^bb0(%arg0: i32, %arg1: i32):
41    %0 = arith.addi %arg0, %arg1 : i32
42    omp.yield(%0 : i32)
43  }
44
45func.func @_QPloop_order() {
46  omp.teams {
47    %c0 = arith.constant 0 : i32
48    %c10 = arith.constant 10 : i32
49    %c1 = arith.constant 1 : i32
50    %sum = fir.alloca i32 {bindc_name = "i", uniq_name = "_QFtest_orderEi"}
51
52    // expected-error@below {{not yet implemented: Unhandled clause reduction in omp.loop operation}}
53    omp.loop reduction(@add_reduction_i32 %sum -> %arg2 : !fir.ref<i32>) {
54      omp.loop_nest (%arg3) : i32 = (%c0) to (%c10) inclusive step (%c1) {
55        omp.yield
56      }
57    }
58    omp.terminator
59  }
60  return
61}
62