blob: 8704f3f138cc7bcfdb182b4129ffd34b16c83889 [file] [edit]
// RUN: cir-opt %s --cir-to-llvm | FileCheck %s
// Verify that OpenMP operations have their CIR types properly converted to
// LLVM types during CIR-to-LLVM lowering. Without the OpenMP-to-LLVM
// conversion patterns, this would fail with unrealized_conversion_cast errors.
!s32i = !cir.int<s, 32>
module {
// CHECK-LABEL: llvm.func @target_map_from
cir.func @target_map_from(%arg0 : !s32i) {
%0 = cir.alloca "x" align(4) init : !cir.ptr<!s32i>
cir.store %arg0, %0 : !s32i, !cir.ptr<!s32i>
// CHECK: %[[ALLOCA:.*]] = llvm.alloca {{.*}} x i32
// CHECK: %[[MAP:.*]] = omp.map.info var_ptr(%[[ALLOCA]] : !llvm.ptr, i32) map_clauses(from) capture(ByRef) -> !llvm.ptr {name = "x"}
%1 = omp.map.info var_ptr(%0 : !cir.ptr<!s32i>, !s32i) map_clauses(from) capture(ByRef) -> !cir.ptr<!s32i> {name = "x"}
// CHECK: omp.target kernel_type(generic) map_entries(%[[MAP]] -> %[[ARG:.*]] : !llvm.ptr)
omp.target kernel_type(generic) map_entries(%1 -> %arg1 : !cir.ptr<!s32i>) {
// CHECK: %[[C10:.*]] = llvm.mlir.constant(10 : i32) : i32
// CHECK: llvm.store %[[C10]], %[[ARG]]
%c10 = cir.const #cir.int<10> : !s32i
cir.store %c10, %arg1 : !s32i, !cir.ptr<!s32i>
// CHECK: omp.terminator
omp.terminator
}
cir.return
}
}