brintos

brintos / llvm-project-archived public Read only

0
0
Text · 3.3 KiB · 53c9b4f Raw
63 lines · plain
1// RUN: mlir-translate -mlir-to-llvmir %s | FileCheck %s2 3// This tests checks that a target op inside a data op4// We are only interested in ensuring that the -mlir-to-llmvir pass doesn't crash.5// CHECK: {{.*}} = add i32 {{.*}}, 16module attributes {omp.target_triples = ["amdgcn-amd-amdhsa"]} {7  llvm.mlir.global weak_odr hidden local_unnamed_addr constant @__oclc_ABI_version(400 : i32) {addr_space = 4 : i32} : i328  llvm.func @_QQmain() attributes {fir.bindc_name = "main", omp.declare_target = #omp.declaretarget<device_type = (host), capture_clause = (to)>} {9    %0 = llvm.mlir.constant(99 : index) : i6410    %1 = llvm.mlir.constant(0 : index) : i6411    %2 = llvm.mlir.constant(1 : index) : i6412    %3 = llvm.mlir.constant(100 : index) : i6413    %4 = llvm.mlir.constant(1 : i64) : i6414    %5 = llvm.alloca %4 x i32 {bindc_name = "array_length"} : (i64) -> !llvm.ptr<5>15    %6 = llvm.addrspacecast %5 : !llvm.ptr<5> to !llvm.ptr16    %7 = llvm.mlir.constant(1 : i64) : i6417    %8 = llvm.alloca %7 x i32 {bindc_name = "index_"} : (i64) -> !llvm.ptr<5>18    %9 = llvm.addrspacecast %8 : !llvm.ptr<5> to !llvm.ptr19    %10 = llvm.mlir.addressof @_QFEint_array : !llvm.ptr20    %11 = omp.map.bounds lower_bound(%1 : i64) upper_bound(%0 : i64) extent(%3 : i64) stride(%2 : i64) start_idx(%2 : i64)21    %12 = omp.map.info var_ptr(%10 : !llvm.ptr, !llvm.array<100 x i32>) map_clauses(from) capture(ByRef) bounds(%11) -> !llvm.ptr {name = "int_array"}22    omp.target_data map_entries(%12 : !llvm.ptr) {23      %13 = omp.map.info var_ptr(%10 : !llvm.ptr, !llvm.array<100 x i32>) map_clauses(from) capture(ByRef) bounds(%11) -> !llvm.ptr {name = "int_array"}24      %14 = omp.map.info var_ptr(%9 : !llvm.ptr, i32) map_clauses(implicit, exit_release_or_enter_alloc) capture(ByCopy) -> !llvm.ptr {name = "index_"}25      omp.target map_entries(%13 -> %arg0, %14 -> %arg1 : !llvm.ptr, !llvm.ptr) {26        %15 = llvm.mlir.constant(100 : i32) : i3227        %16 = llvm.mlir.constant(1 : i32) : i3228        %17 = llvm.mlir.constant(100 : index) : i6429        omp.parallel {30          %18 = llvm.mlir.constant(1 : i64) : i6431          %19 = llvm.alloca %18 x i32 {pinned} : (i64) -> !llvm.ptr<5>32          %20 = llvm.addrspacecast %19 : !llvm.ptr<5> to !llvm.ptr33          omp.wsloop {34            omp.loop_nest (%arg2) : i32 = (%16) to (%15) inclusive step (%16) {35              llvm.store %arg2, %20 : i32, !llvm.ptr36              %21 = llvm.load %20 : !llvm.ptr -> i3237              %22 = llvm.sext %21 : i32 to i6438              %23 = llvm.mlir.constant(1 : i64) : i6439              %24 = llvm.mlir.constant(0 : i64) : i6440              %25 = llvm.sub %22, %23 overflow<nsw>  : i6441              %26 = llvm.mul %25, %23 overflow<nsw>  : i6442              %27 = llvm.mul %26, %23 overflow<nsw>  : i6443              %28 = llvm.add %27, %24 overflow<nsw>  : i6444              %29 = llvm.mul %23, %17 overflow<nsw>  : i6445              %30 = llvm.getelementptr %arg0[%28] : (!llvm.ptr, i64) -> !llvm.ptr, i3246              llvm.store %21, %30 : i32, !llvm.ptr47              omp.yield48            }49          }50          omp.terminator51        }52        omp.terminator53      }54      omp.terminator55    }56    llvm.return57  }58  llvm.mlir.global internal @_QFEint_array() {addr_space = 0 : i32} : !llvm.array<100 x i32> {59    %0 = llvm.mlir.zero : !llvm.array<100 x i32>60    llvm.return %0 : !llvm.array<100 x i32>61  }62}63