1 // RUN: mlir-opt -convert-openmp-to-llvm %s -split-input-file | FileCheck %s
3 // CHECK-LABEL: llvm.func @master_block_arg
4 func @master_block_arg() {
7 // CHECK-NEXT: ^[[BB0:.*]](%[[ARG1:.*]]: i64, %[[ARG2:.*]]: i64):
8 ^bb0(%arg1: index, %arg2: index):
9 // CHECK-DAG: %[[CAST_ARG1:.*]] = builtin.unrealized_conversion_cast %[[ARG1]] : i64 to index
10 // CHECK-DAG: %[[CAST_ARG2:.*]] = builtin.unrealized_conversion_cast %[[ARG2]] : i64 to index
11 // CHECK-NEXT: "test.payload"(%[[CAST_ARG1]], %[[CAST_ARG2]]) : (index, index) -> ()
12 "test.payload"(%arg1, %arg2) : (index, index) -> ()
18 // CHECK-LABEL: llvm.func @branch_loop
20 %start = arith.constant 0 : index
21 %end = arith.constant 0 : index
22 // CHECK: omp.parallel
24 // CHECK-NEXT: llvm.br ^[[BB1:.*]](%{{[0-9]+}}, %{{[0-9]+}} : i64, i64
25 br ^bb1(%start, %end : index, index)
26 // CHECK-NEXT: ^[[BB1]](%[[ARG1:[0-9]+]]: i64, %[[ARG2:[0-9]+]]: i64):{{.*}}
27 ^bb1(%0: index, %1: index):
28 // CHECK-NEXT: %[[CMP:[0-9]+]] = llvm.icmp "slt" %[[ARG1]], %[[ARG2]] : i64
29 %2 = arith.cmpi slt, %0, %1 : index
30 // CHECK-NEXT: llvm.cond_br %[[CMP]], ^[[BB2:.*]](%{{[0-9]+}}, %{{[0-9]+}} : i64, i64), ^[[BB3:.*]]
31 cond_br %2, ^bb2(%end, %end : index, index), ^bb3
32 // CHECK-NEXT: ^[[BB2]](%[[ARG3:[0-9]+]]: i64, %[[ARG4:[0-9]+]]: i64):
33 ^bb2(%3: index, %4: index):
34 // CHECK-NEXT: llvm.br ^[[BB1]](%[[ARG3]], %[[ARG4]] : i64, i64)
35 br ^bb1(%3, %4 : index, index)
36 // CHECK-NEXT: ^[[BB3]]:
47 // CHECK-LABEL: @wsloop
48 // CHECK: (%[[ARG0:.*]]: i64, %[[ARG1:.*]]: i64, %[[ARG2:.*]]: i64, %[[ARG3:.*]]: i64, %[[ARG4:.*]]: i64, %[[ARG5:.*]]: i64)
49 func @wsloop(%arg0: index, %arg1: index, %arg2: index, %arg3: index, %arg4: index, %arg5: index) {
50 // CHECK: omp.parallel
52 // CHECK: omp.wsloop (%[[ARG6:.*]], %[[ARG7:.*]]) : i64 = (%[[ARG0]], %[[ARG1]]) to (%[[ARG2]], %[[ARG3]]) step (%[[ARG4]], %[[ARG5]]) {
53 "omp.wsloop"(%arg0, %arg1, %arg2, %arg3, %arg4, %arg5) ( {
54 ^bb0(%arg6: index, %arg7: index): // no predecessors
55 // CHECK-DAG: %[[CAST_ARG6:.*]] = builtin.unrealized_conversion_cast %[[ARG6]] : i64 to index
56 // CHECK-DAG: %[[CAST_ARG7:.*]] = builtin.unrealized_conversion_cast %[[ARG7]] : i64 to index
57 // CHECK: "test.payload"(%[[CAST_ARG6]], %[[CAST_ARG7]]) : (index, index) -> ()
58 "test.payload"(%arg6, %arg7) : (index, index) -> ()
60 }) {operand_segment_sizes = dense<[2, 2, 2, 0, 0, 0, 0, 0, 0, 0]> : vector<10xi32>} : (index, index, index, index, index, index) -> ()