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
121 lines
5.8 KiB
Fortran
121 lines
5.8 KiB
Fortran
! RUN: %flang_fc1 -emit-hlfir %s -o - | FileCheck %s
|
|
|
|
! CHECK-LABEL: shiftr1_test
|
|
! CHECK-SAME: %[[A:.*]]: !fir.ref<i8>{{.*}}, %[[B:.*]]: !fir.ref<i32>{{.*}}, %[[C:.*]]: !fir.ref<i8>{{.*}}
|
|
subroutine shiftr1_test(a, b, c)
|
|
integer(kind=1) :: a
|
|
integer :: b
|
|
integer(kind=1) :: c
|
|
|
|
! CHECK-DAG: %[[A_DECL:.*]]:2 = hlfir.declare %[[A]]
|
|
! CHECK-DAG: %[[B_DECL:.*]]:2 = hlfir.declare %[[B]]
|
|
! CHECK-DAG: %[[C_DECL:.*]]:2 = hlfir.declare %[[C]]
|
|
! CHECK-DAG: %[[A_VAL:.*]] = fir.load %[[A_DECL]]#0 : !fir.ref<i8>
|
|
! CHECK-DAG: %[[B_VAL:.*]] = fir.load %[[B_DECL]]#0 : !fir.ref<i32>
|
|
c = shiftr(a, b)
|
|
! CHECK: %[[C_BITS:.*]] = arith.constant 8 : i8
|
|
! CHECK: %[[C_0:.*]] = arith.constant 0 : i8
|
|
! CHECK: %[[B_CONV:.*]] = fir.convert %[[B_VAL]] : (i32) -> i8
|
|
! CHECK: %[[UNDER:.*]] = arith.cmpi slt, %[[B_CONV]], %[[C_0]] : i8
|
|
! CHECK: %[[OVER:.*]] = arith.cmpi sge, %[[B_CONV]], %[[C_BITS]] : i8
|
|
! CHECK: %[[INVALID:.*]] = arith.ori %[[UNDER]], %[[OVER]] : i1
|
|
! CHECK: %[[SHIFT:.*]] = arith.shrui %[[A_VAL]], %[[B_CONV]] : i8
|
|
! CHECK: %[[RES:.*]] = arith.select %[[INVALID]], %[[C_0]], %[[SHIFT]] : i8
|
|
! CHECK: hlfir.assign %[[RES]] to %[[C_DECL]]#0 : i8, !fir.ref<i8>
|
|
end subroutine shiftr1_test
|
|
|
|
! CHECK-LABEL: shiftr2_test
|
|
! CHECK-SAME: %[[A:.*]]: !fir.ref<i16>{{.*}}, %[[B:.*]]: !fir.ref<i32>{{.*}}, %[[C:.*]]: !fir.ref<i16>{{.*}}
|
|
subroutine shiftr2_test(a, b, c)
|
|
integer(kind=2) :: a
|
|
integer :: b
|
|
integer(kind=2) :: c
|
|
|
|
! CHECK-DAG: %[[A_DECL:.*]]:2 = hlfir.declare %[[A]]
|
|
! CHECK-DAG: %[[B_DECL:.*]]:2 = hlfir.declare %[[B]]
|
|
! CHECK-DAG: %[[C_DECL:.*]]:2 = hlfir.declare %[[C]]
|
|
! CHECK-DAG: %[[A_VAL:.*]] = fir.load %[[A_DECL]]#0 : !fir.ref<i16>
|
|
! CHECK-DAG: %[[B_VAL:.*]] = fir.load %[[B_DECL]]#0 : !fir.ref<i32>
|
|
c = shiftr(a, b)
|
|
! CHECK: %[[C_BITS:.*]] = arith.constant 16 : i16
|
|
! CHECK: %[[C_0:.*]] = arith.constant 0 : i16
|
|
! CHECK: %[[B_CONV:.*]] = fir.convert %[[B_VAL]] : (i32) -> i16
|
|
! CHECK: %[[UNDER:.*]] = arith.cmpi slt, %[[B_CONV]], %[[C_0]] : i16
|
|
! CHECK: %[[OVER:.*]] = arith.cmpi sge, %[[B_CONV]], %[[C_BITS]] : i16
|
|
! CHECK: %[[INVALID:.*]] = arith.ori %[[UNDER]], %[[OVER]] : i1
|
|
! CHECK: %[[SHIFT:.*]] = arith.shrui %[[A_VAL]], %[[B_CONV]] : i16
|
|
! CHECK: %[[RES:.*]] = arith.select %[[INVALID]], %[[C_0]], %[[SHIFT]] : i16
|
|
! CHECK: hlfir.assign %[[RES]] to %[[C_DECL]]#0 : i16, !fir.ref<i16>
|
|
end subroutine shiftr2_test
|
|
|
|
! CHECK-LABEL: shiftr4_test
|
|
! CHECK-SAME: %[[A:.*]]: !fir.ref<i32>{{.*}}, %[[B:.*]]: !fir.ref<i32>{{.*}}, %[[C:.*]]: !fir.ref<i32>{{.*}}
|
|
subroutine shiftr4_test(a, b, c)
|
|
integer(kind=4) :: a
|
|
integer :: b
|
|
integer(kind=4) :: c
|
|
|
|
! CHECK-DAG: %[[A_DECL:.*]]:2 = hlfir.declare %[[A]]
|
|
! CHECK-DAG: %[[B_DECL:.*]]:2 = hlfir.declare %[[B]]
|
|
! CHECK-DAG: %[[C_DECL:.*]]:2 = hlfir.declare %[[C]]
|
|
! CHECK-DAG: %[[A_VAL:.*]] = fir.load %[[A_DECL]]#0 : !fir.ref<i32>
|
|
! CHECK-DAG: %[[B_VAL:.*]] = fir.load %[[B_DECL]]#0 : !fir.ref<i32>
|
|
c = shiftr(a, b)
|
|
! CHECK: %[[C_BITS:.*]] = arith.constant 32 : i32
|
|
! CHECK: %[[C_0:.*]] = arith.constant 0 : i32
|
|
! CHECK: %[[UNDER:.*]] = arith.cmpi slt, %[[B_VAL]], %[[C_0]] : i32
|
|
! CHECK: %[[OVER:.*]] = arith.cmpi sge, %[[B_VAL]], %[[C_BITS]] : i32
|
|
! CHECK: %[[INVALID:.*]] = arith.ori %[[UNDER]], %[[OVER]] : i1
|
|
! CHECK: %[[SHIFT:.*]] = arith.shrui %[[A_VAL]], %[[B_VAL]] : i32
|
|
! CHECK: %[[RES:.*]] = arith.select %[[INVALID]], %[[C_0]], %[[SHIFT]] : i32
|
|
! CHECK: hlfir.assign %[[RES]] to %[[C_DECL]]#0 : i32, !fir.ref<i32>
|
|
end subroutine shiftr4_test
|
|
|
|
! CHECK-LABEL: shiftr8_test
|
|
! CHECK-SAME: %[[A:.*]]: !fir.ref<i64>{{.*}}, %[[B:.*]]: !fir.ref<i32>{{.*}}, %[[C:.*]]: !fir.ref<i64>{{.*}}
|
|
subroutine shiftr8_test(a, b, c)
|
|
integer(kind=8) :: a
|
|
integer :: b
|
|
integer(kind=8) :: c
|
|
|
|
! CHECK-DAG: %[[A_DECL:.*]]:2 = hlfir.declare %[[A]]
|
|
! CHECK-DAG: %[[B_DECL:.*]]:2 = hlfir.declare %[[B]]
|
|
! CHECK-DAG: %[[C_DECL:.*]]:2 = hlfir.declare %[[C]]
|
|
! CHECK-DAG: %[[A_VAL:.*]] = fir.load %[[A_DECL]]#0 : !fir.ref<i64>
|
|
! CHECK-DAG: %[[B_VAL:.*]] = fir.load %[[B_DECL]]#0 : !fir.ref<i32>
|
|
c = shiftr(a, b)
|
|
! CHECK: %[[C_BITS:.*]] = arith.constant 64 : i64
|
|
! CHECK: %[[C_0:.*]] = arith.constant 0 : i64
|
|
! CHECK: %[[B_CONV:.*]] = fir.convert %[[B_VAL]] : (i32) -> i64
|
|
! CHECK: %[[UNDER:.*]] = arith.cmpi slt, %[[B_CONV]], %[[C_0]] : i64
|
|
! CHECK: %[[OVER:.*]] = arith.cmpi sge, %[[B_CONV]], %[[C_BITS]] : i64
|
|
! CHECK: %[[INVALID:.*]] = arith.ori %[[UNDER]], %[[OVER]] : i1
|
|
! CHECK: %[[SHIFT:.*]] = arith.shrui %[[A_VAL]], %[[B_CONV]] : i64
|
|
! CHECK: %[[RES:.*]] = arith.select %[[INVALID]], %[[C_0]], %[[SHIFT]] : i64
|
|
! CHECK: hlfir.assign %[[RES]] to %[[C_DECL]]#0 : i64, !fir.ref<i64>
|
|
end subroutine shiftr8_test
|
|
|
|
! CHECK-LABEL: shiftr16_test
|
|
! CHECK-SAME: %[[A:.*]]: !fir.ref<i128>{{.*}}, %[[B:.*]]: !fir.ref<i32>{{.*}}, %[[C:.*]]: !fir.ref<i128>{{.*}}
|
|
subroutine shiftr16_test(a, b, c)
|
|
integer(kind=16) :: a
|
|
integer :: b
|
|
integer(kind=16) :: c
|
|
|
|
! CHECK-DAG: %[[A_DECL:.*]]:2 = hlfir.declare %[[A]]
|
|
! CHECK-DAG: %[[B_DECL:.*]]:2 = hlfir.declare %[[B]]
|
|
! CHECK-DAG: %[[C_DECL:.*]]:2 = hlfir.declare %[[C]]
|
|
! CHECK-DAG: %[[A_VAL:.*]] = fir.load %[[A_DECL]]#0 : !fir.ref<i128>
|
|
! CHECK-DAG: %[[B_VAL:.*]] = fir.load %[[B_DECL]]#0 : !fir.ref<i32>
|
|
c = shiftr(a, b)
|
|
! CHECK: %[[C_BITS:.*]] = arith.constant 128 : i128
|
|
! CHECK: %[[C_0:.*]] = arith.constant 0 : i128
|
|
! CHECK: %[[B_CONV:.*]] = fir.convert %[[B_VAL]] : (i32) -> i128
|
|
! CHECK: %[[UNDER:.*]] = arith.cmpi slt, %[[B_CONV]], %[[C_0]] : i128
|
|
! CHECK: %[[OVER:.*]] = arith.cmpi sge, %[[B_CONV]], %[[C_BITS]] : i128
|
|
! CHECK: %[[INVALID:.*]] = arith.ori %[[UNDER]], %[[OVER]] : i1
|
|
! CHECK: %[[SHIFT:.*]] = arith.shrui %[[A_VAL]], %[[B_CONV]] : i128
|
|
! CHECK: %[[RES:.*]] = arith.select %[[INVALID]], %[[C_0]], %[[SHIFT]] : i128
|
|
! CHECK: hlfir.assign %[[RES]] to %[[C_DECL]]#0 : i128, !fir.ref<i128>
|
|
end subroutine shiftr16_test
|