brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.5 KiB · d37b21f Raw
34 lines · plain
1// RUN: mlir-translate -mlir-to-llvmir %s | FileCheck %s2 3// This test the generation of additional load operations for declare target link variables4// inside of target op regions when lowering to IR for device. Unfortunately as the host file is not5// passed as a module attribute, we miss out on the metadata and entryinfo.6//7// Unfortunately, only so much can be tested as the device side is dependent on a *.bc8// file created by the host and appended as an attribute to the module.9 10module attributes {llvm.target_triple = "amdgcn-amd-amdhsa", omp.is_target_device = true} {11  // CHECK-DAG: @_QMtest_0Esp_decl_tgt_ref_ptr = weak global ptr null, align 812  llvm.mlir.global external @_QMtest_0Esp() {addr_space = 0 : i32, omp.declare_target = #omp.declaretarget<device_type = (any), capture_clause = (link)>} : i32 {13    %0 = llvm.mlir.constant(0 : i32) : i3214    llvm.return %0 : i3215  }16 17  llvm.func @_QQmain() attributes {} {18    %0 = llvm.mlir.addressof @_QMtest_0Esp : !llvm.ptr19 20  // CHECK-DAG:   omp.target:                                       ; preds = %outlined.body21  // CHECK-DAG: %[[V:.*]] = load ptr, ptr @_QMtest_0Esp_decl_tgt_ref_ptr, align 822  // CHECK-DAG: store i32 1, ptr %[[V]], align 423  // CHECK-DAG: br label %omp.region.cont24    %map = omp.map.info var_ptr(%0 : !llvm.ptr, i32)   map_clauses(tofrom) capture(ByRef) -> !llvm.ptr {name = ""}25    omp.target   map_entries(%map -> %arg0 : !llvm.ptr) {26      %1 = llvm.mlir.constant(1 : i32) : i3227      llvm.store %1, %arg0 : i32, !llvm.ptr28      omp.terminator29    }30 31    llvm.return32  }33}34