|
| 1 | +// Use --mlir-disable-threading so that the diagnostic printing is serialized. |
| 2 | +// RUN: fir-opt %s -pass-pipeline='builtin.module(test-fir-openacc-interfaces)' -split-input-file --mlir-disable-threading 2>&1 | FileCheck %s |
| 3 | + |
| 4 | +module { |
| 5 | + fir.global linkonce @test_string constant : !fir.char<1,26> { |
| 6 | + %0 = fir.string_lit "hello_world_test_string\00"(26) : !fir.char<1,26> |
| 7 | + fir.has_value %0 : !fir.char<1,26> |
| 8 | + } |
| 9 | + |
| 10 | + // Test global constant string with pointer conversion |
| 11 | + func.func @_QPtest_global_string_ptr() { |
| 12 | + %0 = fir.address_of(@test_string) : !fir.ref<!fir.char<1,26>> |
| 13 | + %1 = fir.convert %0 : (!fir.ref<!fir.char<1,26>>) -> !fir.ref<i8> |
| 14 | + %2 = acc.copyin varPtr(%1 : !fir.ref<i8>) -> !fir.ref<i8> {name = "test_string", structured = false} |
| 15 | + acc.enter_data dataOperands(%2 : !fir.ref<i8>) |
| 16 | + return |
| 17 | + } |
| 18 | + |
| 19 | + // CHECK: Visiting: %{{.*}} = acc.copyin varPtr(%{{.*}} : !fir.ref<i8>) -> !fir.ref<i8> {name = "test_string", structured = false} |
| 20 | + // CHECK: Pointer-like and Mappable: !fir.ref<i8> |
| 21 | + // CHECK: Type category: nonscalar |
| 22 | + |
| 23 | + // Test array with pointer conversion |
| 24 | + func.func @_QPtest_alloca_array_ptr() { |
| 25 | + %c10 = arith.constant 10 : index |
| 26 | + %0 = fir.alloca !fir.array<10xf32> {bindc_name = "local_array", uniq_name = "_QFtest_alloca_array_ptrElocal_array"} |
| 27 | + %1 = fir.convert %0 : (!fir.ref<!fir.array<10xf32>>) -> !fir.ref<i8> |
| 28 | + %2 = acc.copyin varPtr(%1 : !fir.ref<i8>) -> !fir.ref<i8> {name = "local_array", structured = false} |
| 29 | + acc.enter_data dataOperands(%2 : !fir.ref<i8>) |
| 30 | + return |
| 31 | + } |
| 32 | + |
| 33 | + // CHECK: Visiting: %{{.*}} = acc.copyin varPtr(%{{.*}} : !fir.ref<i8>) -> !fir.ref<i8> {name = "local_array", structured = false} |
| 34 | + // CHECK: Pointer-like and Mappable: !fir.ref<i8> |
| 35 | + // CHECK: Type category: array |
| 36 | +} |
0 commit comments