Files
TheRock/compiler/amd-llvm/flang/test/Lower/Intrinsics/ieee_copy_sign.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

36 lines
1.8 KiB
Fortran

! RUN: %flang_fc1 -emit-hlfir %s -o - | FileCheck %s
! CHECK-LABEL: func.func @_QQmain()
use ieee_arithmetic
real(4) :: x = -2.0, y = huge(y)
real(8) :: z = 2.0
! CHECK-DAG: %[[X_ADDR:.*]] = fir.address_of(@_QFEx) : !fir.ref<f32>
! CHECK-DAG: %[[X_DECL:.*]]:2 = hlfir.declare %[[X_ADDR]] {uniq_name = "_QFEx"}
! CHECK-DAG: %[[Y_ADDR:.*]] = fir.address_of(@_QFEy) : !fir.ref<f32>
! CHECK-DAG: %[[Y_DECL:.*]]:2 = hlfir.declare %[[Y_ADDR]] {uniq_name = "_QFEy"}
! CHECK-DAG: %[[Z_ADDR:.*]] = fir.address_of(@_QFEz) : !fir.ref<f64>
! CHECK-DAG: %[[Z_DECL:.*]]:2 = hlfir.declare %[[Z_ADDR]] {uniq_name = "_QFEz"}
! CHECK-DAG: %[[X_VAL:.*]] = fir.load %[[X_DECL]]#0 : !fir.ref<f32>
! CHECK-DAG: %[[Y_VAL:.*]] = fir.load %[[Y_DECL]]#0 : !fir.ref<f32>
! CHECK: %[[CS1:.*]] = math.copysign %[[X_VAL]], %[[Y_VAL]] fastmath<contract> : f32
! CHECK: fir.call @_FortranAioOutputReal32({{.*}}, %[[CS1]])
! CHECK-DAG: %[[Z_VAL:.*]] = fir.load %[[Z_DECL]]#0 : !fir.ref<f64>
! CHECK-DAG: %[[Y_VAL2:.*]] = fir.load %[[Y_DECL]]#0 : !fir.ref<f32>
! CHECK: %[[BIT_Z:.*]] = arith.bitcast %[[Z_VAL]] : f64 to i64
! CHECK: %[[BIT_Y:.*]] = arith.bitcast %[[Y_VAL2]] : f32 to i32
! CHECK: %[[S_Y:.*]] = arith.shrui %[[BIT_Y]], %c31{{.*}} : i32
! CHECK: %[[SL_Z:.*]] = arith.shli %[[BIT_Z]], %c1{{.*}} : i64
! CHECK: %[[SR_Z:.*]] = arith.shrui %[[SL_Z]], %c1{{.*}} : i64
! CHECK-DAG: %[[S_BIT:.*]] = arith.shli %c1{{.*}}, %c63{{.*}} : i64
! CHECK-DAG: %[[IS_P:.*]] = arith.cmpi eq, %[[S_Y]], %c0{{.*}} : i32
! CHECK: %[[S_VAL:.*]] = arith.select %[[IS_P]], %c0{{.*}}, %[[S_BIT]] : i64
! CHECK: %[[RES_BIT:.*]] = arith.ori %[[SR_Z]], %[[S_VAL]] : i64
! CHECK: %[[RES:.*]] = arith.bitcast %[[RES_BIT]] : i64 to f64
! CHECK: fir.call @_FortranAioOutputReal64({{.*}}, %[[RES]])
print*, ieee_copy_sign(x,y), ieee_copy_sign(z,y)
end