1 // RUN: mlir-translate -mlir-to-llvmir %s | FileCheck %s
3 module attributes {llvm.target_triple = "amdgcn-amd-amdhsa", omp.is_target_device = true, omp.is_gpu = true} {
4 llvm.func @omp_target_region_() {
5 %0 = llvm.mlir.constant(20 : i32) : i32
6 %1 = llvm.mlir.constant(10 : i32) : i32
7 %2 = llvm.mlir.constant(1 : i64) : i64
8 %3 = llvm.alloca %2 x i32 {bindc_name = "a", in_type = i32, operandSegmentSizes = array<i32: 0, 0>, uniq_name = "_QFomp_target_regionEa"} : (i64) -> !llvm.ptr
9 %4 = llvm.mlir.constant(1 : i64) : i64
10 %5 = llvm.alloca %4 x i32 {bindc_name = "b", in_type = i32, operandSegmentSizes = array<i32: 0, 0>, uniq_name = "_QFomp_target_regionEb"} : (i64) -> !llvm.ptr
11 %6 = llvm.mlir.constant(1 : i64) : i64
12 %7 = llvm.alloca %6 x i32 {bindc_name = "c", in_type = i32, operandSegmentSizes = array<i32: 0, 0>, uniq_name = "_QFomp_target_regionEc"} : (i64) -> !llvm.ptr
13 llvm.store %1, %3 : i32, !llvm.ptr
14 llvm.store %0, %5 : i32, !llvm.ptr
16 %map1 = omp.map.info var_ptr(%3 : !llvm.ptr, i32) map_clauses(tofrom) capture(ByRef) -> !llvm.ptr {name = ""}
17 %map2 = omp.map.info var_ptr(%5 : !llvm.ptr, i32) map_clauses(tofrom) capture(ByRef) -> !llvm.ptr {name = ""}
18 %map3 = omp.map.info var_ptr(%7 : !llvm.ptr, i32) map_clauses(tofrom) capture(ByRef) -> !llvm.ptr {name = ""}
19 omp.target map_entries(%map1 -> %arg0, %map2 -> %arg1, %map3 -> %arg2 : !llvm.ptr, !llvm.ptr, !llvm.ptr) {
20 %8 = llvm.load %arg0 : !llvm.ptr -> i32
21 %9 = llvm.load %arg1 : !llvm.ptr -> i32
22 %10 = llvm.add %8, %9 : i32
23 llvm.store %10, %arg2 : i32, !llvm.ptr
31 llvm.func @omp_target_no_map() {
39 // CHECK: define weak_odr protected amdgpu_kernel void @__omp_offloading_{{.*}}_{{.*}}_omp_target_region__l19