CodeQL / Analyze (actions) (push) Canceled after 0s
CodeQL / Analyze (python) (push) Canceled after 0s
pre-commit / pre-commit (push) Canceled after 0s
Multi-Arch CI / setup (push) Canceled after 0s
Publish build_manylinux_x86_64 images / publish_build_manylinux_x86_64 (push) Canceled after 0s
Setup (Multi-Arch) / setup (push) Canceled after 0s
Multi-Arch CI / Linux::${{ fromJSON(needs.setup.outputs.linux_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubi10 image / publish_no_rocm_image_ubi10 (push) Canceled after 0s
Multi-Arch CI / Windows::${{ fromJSON(needs.setup.outputs.windows_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Multi-Arch CI / Manifest Diff (push) Canceled after 0s
TheRock Manifest Diff Report / Generate Manifest Diff Report (push) Canceled after 0s
Multi-Arch CI / CI Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_ocl_rt images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_rocgdb images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Unit Tests / Unit Tests :: ubuntu-24.04 (push) Canceled after 0s
Unit Tests / Unit Tests :: windows-2022 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_media (push) Canceled after 0s
Unit Tests / Unit Tests Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_openmpi (push) Canceled after 0s
60 lines
3.1 KiB
Plaintext
60 lines
3.1 KiB
Plaintext
// Test that bind_c derived type results are not moved to a hidden argument
|
|
// by the abstract-result pass. They will be dealt with according to the C
|
|
// struct returning ABI for the target in the target-rewrite pass.
|
|
// RUN: fir-opt %s --abstract-result | FileCheck %s
|
|
|
|
!t = !fir.type<t{i:f32, j: i32, k: f32}>
|
|
!cptr = !fir.type<_QM__fortran_builtinsT__builtin_c_ptr{__address:i64}>
|
|
|
|
func.func private @foo() -> !t attributes {fir.proc_attrs = #fir.proc_attrs<bind_c>}
|
|
|
|
func.func @test_call(%x: !fir.ref<!t>) {
|
|
%0 = fir.call @foo() proc_attrs<bind_c> : () -> !t
|
|
fir.save_result %0 to %x : !t, !fir.ref<!t>
|
|
return
|
|
}
|
|
|
|
func.func @test_addr_of() -> (() -> !t) {
|
|
%0 = fir.address_of(@foo) : () -> !t
|
|
return %0 : () -> !t
|
|
}
|
|
|
|
func.func @test_dispatch(%x: !fir.ref<!t>, %y : !fir.class<!fir.type<somet>>) {
|
|
%0 = fir.dispatch "bar"(%y : !fir.class<!fir.type<somet>>) (%y : !fir.class<!fir.type<somet>>) -> !t proc_attrs<bind_c> {pass_arg_pos = 0 : i32}
|
|
fir.save_result %0 to %x : !t, !fir.ref<!t>
|
|
return
|
|
}
|
|
|
|
|
|
func.func private @return_cptr() -> !cptr attributes {fir.proc_attrs = #fir.proc_attrs<bind_c>}
|
|
func.func @test_return_cptr(%x: !fir.ref<!cptr>) {
|
|
%0 = fir.call @return_cptr() proc_attrs<bind_c> : () -> !cptr
|
|
fir.save_result %0 to %x : !cptr, !fir.ref<!cptr>
|
|
return
|
|
}
|
|
|
|
|
|
// CHECK-LABEL: func.func @test_call(
|
|
// CHECK-SAME: %[[VAL_0:.*]]: !fir.ref<!fir.type<t{i:f32,j:i32,k:f32}>>) {
|
|
// CHECK: %[[VAL_1:.*]] = fir.call @foo() proc_attrs<bind_c> : () -> !fir.type<t{i:f32,j:i32,k:f32}>
|
|
// CHECK: fir.store %[[VAL_1]] to %[[VAL_0]] : !fir.ref<!fir.type<t{i:f32,j:i32,k:f32}>>
|
|
// CHECK: return
|
|
// CHECK: }
|
|
// CHECK-LABEL: func.func @test_addr_of() -> (() -> !fir.type<t{i:f32,j:i32,k:f32}>) {
|
|
// CHECK: %[[VAL_0:.*]] = fir.address_of(@foo) : () -> !fir.type<t{i:f32,j:i32,k:f32}>
|
|
// CHECK: return %[[VAL_0]] : () -> !fir.type<t{i:f32,j:i32,k:f32}>
|
|
// CHECK: }
|
|
// CHECK-LABEL: func.func @test_dispatch(
|
|
// CHECK-SAME: %[[VAL_0:.*]]: !fir.ref<!fir.type<t{i:f32,j:i32,k:f32}>>,
|
|
// CHECK-SAME: %[[VAL_1:.*]]: !fir.class<!fir.type<somet>>) {
|
|
// CHECK: %[[VAL_2:.*]] = fir.dispatch "bar"(%[[VAL_1]] : !fir.class<!fir.type<somet>>) (%[[VAL_1]] : !fir.class<!fir.type<somet>>) -> !fir.type<t{i:f32,j:i32,k:f32}> proc_attrs <bind_c> {pass_arg_pos = 0 : i32}
|
|
// CHECK: fir.store %[[VAL_2]] to %[[VAL_0]] : !fir.ref<!fir.type<t{i:f32,j:i32,k:f32}>>
|
|
// CHECK: return
|
|
// CHECK: }
|
|
// CHECK-LABEL: func.func @test_return_cptr(
|
|
// CHECK-SAME: %[[VAL_0:.*]]: !fir.ref<!fir.type<_QM__fortran_builtinsT__builtin_c_ptr{__address:i64}>>) {
|
|
// CHECK: %[[VAL_1:.*]] = fir.call @return_cptr() : () -> !fir.ref<none>
|
|
// CHECK: %[[VAL_3:.*]] = fir.coordinate_of %[[VAL_0]], __address : (!fir.ref<!fir.type<_QM__fortran_builtinsT__builtin_c_ptr{__address:i64}>>) -> !fir.ref<i64>
|
|
// CHECK: %[[VAL_4:.*]] = fir.convert %[[VAL_1]] : (!fir.ref<none>) -> i64
|
|
// CHECK: fir.store %[[VAL_4]] to %[[VAL_3]] : !fir.ref<i64>
|