Files
TheRock/compiler/amd-llvm/flang/test/Lower/Intrinsics/selected_int_kind.f90
T
derek.holloway 7502bf64a4
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
Flatten subprojects into a single base monorepo
2026-09-02 16:34:47 -07:00

81 lines
4.3 KiB
Fortran

! RUN: %flang_fc1 -emit-hlfir %s -o - | FileCheck %s
! CHECK-LABEL: func.func @_QPselected_int_kind_test1(
! CHECK-SAME: %[[VAL_0:.*]]: !fir.ref<i8> {fir.bindc_name = "a"}) {
! CHECK: %[[DECL:.*]]:2 = hlfir.declare %[[VAL_0]] {{.*}} : (!fir.ref<i8>, !fir.dscope) -> (!fir.ref<i8>, !fir.ref<i8>)
! CHECK: %[[KIND:.*]] = arith.constant 1 : i32
! CHECK: %[[APTR:.*]] = fir.convert %[[DECL]]#0 : (!fir.ref<i8>) -> !fir.llvm_ptr<i8>
! CHECK: %[[RES:.*]] = fir.call @_FortranASelectedIntKind(%{{.*}}, %{{.*}}, %[[APTR]], %[[KIND]]) {{.*}}: (!fir.ref<i8>, i32, !fir.llvm_ptr<i8>, i32) -> i32
! CHECK: %[[CONV:.*]] = fir.convert %[[RES]] : (i32) -> i8
! CHECK: hlfir.assign %[[CONV]] to %{{.*}} : i8, !fir.ref<i8>
! CHECK: return
! CHECK: }
subroutine selected_int_kind_test1(a)
integer(1) :: a, res
res = selected_int_kind(a)
end
! CHECK-LABEL: func.func @_QPselected_int_kind_test2(
! CHECK-SAME: %[[VAL_0:.*]]: !fir.ref<i16> {fir.bindc_name = "a"}) {
! CHECK: %[[DECL:.*]]:2 = hlfir.declare %[[VAL_0]] {{.*}} : (!fir.ref<i16>, !fir.dscope) -> (!fir.ref<i16>, !fir.ref<i16>)
! CHECK: %[[KIND:.*]] = arith.constant 2 : i32
! CHECK: %[[APTR:.*]] = fir.convert %[[DECL]]#0 : (!fir.ref<i16>) -> !fir.llvm_ptr<i8>
! CHECK: %[[RES:.*]] = fir.call @_FortranASelectedIntKind(%{{.*}}, %{{.*}}, %[[APTR]], %[[KIND]]) {{.*}}: (!fir.ref<i8>, i32, !fir.llvm_ptr<i8>, i32) -> i32
! CHECK: %[[CONV:.*]] = fir.convert %[[RES]] : (i32) -> i16
! CHECK: hlfir.assign %[[CONV]] to %{{.*}} : i16, !fir.ref<i16>
! CHECK: return
! CHECK: }
subroutine selected_int_kind_test2(a)
integer(2) :: a, res
res = selected_int_kind(a)
end
! CHECK-LABEL: func.func @_QPselected_int_kind_test4(
! CHECK-SAME: %[[VAL_0:.*]]: !fir.ref<i32> {fir.bindc_name = "a"}) {
! CHECK: %[[DECL:.*]]:2 = hlfir.declare %[[VAL_0]] {{.*}} : (!fir.ref<i32>, !fir.dscope) -> (!fir.ref<i32>, !fir.ref<i32>)
! CHECK: %[[KIND:.*]] = arith.constant 4 : i32
! CHECK: %[[APTR:.*]] = fir.convert %[[DECL]]#0 : (!fir.ref<i32>) -> !fir.llvm_ptr<i8>
! CHECK: %[[RES:.*]] = fir.call @_FortranASelectedIntKind(%{{.*}}, %{{.*}}, %[[APTR]], %[[KIND]]) {{.*}}: (!fir.ref<i8>, i32, !fir.llvm_ptr<i8>, i32) -> i32
! CHECK: hlfir.assign %[[RES]] to %{{.*}} : i32, !fir.ref<i32>
! CHECK: return
! CHECK: }
subroutine selected_int_kind_test4(a)
integer(4) :: a, res
res = selected_int_kind(a)
end
! CHECK-LABEL: func.func @_QPselected_int_kind_test8(
! CHECK-SAME: %[[VAL_0:.*]]: !fir.ref<i64> {fir.bindc_name = "a"}) {
! CHECK: %[[DECL:.*]]:2 = hlfir.declare %[[VAL_0]] {{.*}} : (!fir.ref<i64>, !fir.dscope) -> (!fir.ref<i64>, !fir.ref<i64>)
! CHECK: %[[KIND:.*]] = arith.constant 8 : i32
! CHECK: %[[APTR:.*]] = fir.convert %[[DECL]]#0 : (!fir.ref<i64>) -> !fir.llvm_ptr<i8>
! CHECK: %[[RES:.*]] = fir.call @_FortranASelectedIntKind(%{{.*}}, %{{.*}}, %[[APTR]], %[[KIND]]) {{.*}}: (!fir.ref<i8>, i32, !fir.llvm_ptr<i8>, i32) -> i32
! CHECK: %[[CONV:.*]] = fir.convert %[[RES]] : (i32) -> i64
! CHECK: hlfir.assign %[[CONV]] to %{{.*}} : i64, !fir.ref<i64>
! CHECK: return
! CHECK: }
subroutine selected_int_kind_test8(a)
integer(8) :: a, res
res = selected_int_kind(a)
end
! CHECK-LABEL: func.func @_QPselected_int_kind_test16(
! CHECK-SAME: %[[VAL_0:.*]]: !fir.ref<i128> {fir.bindc_name = "a"}) {
! CHECK: %[[DECL:.*]]:2 = hlfir.declare %[[VAL_0]] {{.*}} : (!fir.ref<i128>, !fir.dscope) -> (!fir.ref<i128>, !fir.ref<i128>)
! CHECK: %[[KIND:.*]] = arith.constant 16 : i32
! CHECK: %[[APTR:.*]] = fir.convert %[[DECL]]#0 : (!fir.ref<i128>) -> !fir.llvm_ptr<i8>
! CHECK: %[[RES:.*]] = fir.call @_FortranASelectedIntKind(%{{.*}}, %{{.*}}, %[[APTR]], %[[KIND]]) {{.*}}: (!fir.ref<i8>, i32, !fir.llvm_ptr<i8>, i32) -> i32
! CHECK: %[[CONV:.*]] = fir.convert %[[RES]] : (i32) -> i128
! CHECK: hlfir.assign %[[CONV]] to %{{.*}} : i128, !fir.ref<i128>
! CHECK: return
! CHECK: }
subroutine selected_int_kind_test16(a)
integer(16) :: a, res
res = selected_int_kind(a)
end