Files
TheRock/compiler/amd-llvm/flang/test/Lower/fp-maxmin-behavior.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

87 lines
3.3 KiB
Fortran

! Test lowering of real MIN/MAX with -ffp-maxmin-behavior (legacy, portable, extremum, extremenum).
! Legacy uses arith.cmpf + arith.select; extremum uses arith.maximumf/minimumf;
! extremenum uses arith.maxnumf/minnumf; portable with -fno-signed-zeros -menable-no-nans uses maxnumf/minnumf.
! bbc: legacy, extremum, extremenum
! RUN: bbc -emit-hlfir -o - %s 2>&1 | FileCheck %s -check-prefix=ALL,LEGACY
! RUN: bbc -emit-hlfir -ffp-maxmin-behavior=legacy -o - %s 2>&1 | FileCheck %s -check-prefix=ALL,LEGACY
! RUN: bbc -emit-hlfir -ffp-maxmin-behavior=extremum -o - %s 2>&1 | FileCheck %s -check-prefix=ALL,EXTREMUM
! RUN: bbc -emit-hlfir -ffp-maxmin-behavior=extremenum -o - %s 2>&1 | FileCheck %s -check-prefix=ALL,EXTREMENUM
! flang -fc1: legacy, extremum, extremenum
! RUN: %flang_fc1 -emit-hlfir -funsigned -o - %s 2>&1 | FileCheck %s -check-prefix=ALL,LEGACY
! RUN: %flang_fc1 -emit-hlfir -ffp-maxmin-behavior=legacy -funsigned -o - %s 2>&1 | FileCheck %s -check-prefix=ALL,LEGACY
! RUN: %flang_fc1 -emit-hlfir -ffp-maxmin-behavior=extremum -funsigned -o - %s 2>&1 | FileCheck %s -check-prefix=ALL,EXTREMUM
! RUN: %flang_fc1 -emit-hlfir -ffp-maxmin-behavior=extremenum -funsigned -o - %s 2>&1 | FileCheck %s -check-prefix=ALL,EXTREMENUM
! portable with -fno-signed-zeros -menable-no-nans => maxnumf/minnumf (flang -fc1 only; bbc does not expose these flags)
! RUN: %flang_fc1 -emit-hlfir -ffp-maxmin-behavior=portable -funsigned -fno-signed-zeros -menable-no-nans -o - %s 2>&1 | FileCheck %s -check-prefix=ALL,PORTABLE-NANNSZ
subroutine real_max(a, b, r)
real :: a, b, r
r = max(a, b)
end subroutine
! LEGACY-LABEL: func.func @_QPreal_max(
! LEGACY: arith.cmpf ogt,
! LEGACY: arith.select
! EXTREMUM-LABEL: func.func @_QPreal_max(
! EXTREMUM: arith.maximumf
! EXTREMENUM-LABEL: func.func @_QPreal_max(
! EXTREMENUM: arith.maxnumf
! PORTABLE-NANNSZ-LABEL: func.func @_QPreal_max(
! PORTABLE-NANNSZ: arith.maxnumf
subroutine real_min(a, b, r)
real :: a, b, r
r = min(a, b)
end subroutine
! LEGACY-LABEL: func.func @_QPreal_min(
! LEGACY: arith.cmpf olt,
! LEGACY: arith.select
! EXTREMUM-LABEL: func.func @_QPreal_min(
! EXTREMUM: arith.minimumf
! EXTREMENUM-LABEL: func.func @_QPreal_min(
! EXTREMENUM: arith.minnumf
! PORTABLE-NANNSZ-LABEL: func.func @_QPreal_min(
! PORTABLE-NANNSZ: arith.minnumf
subroutine signed_max(a, b, r)
integer :: a, b, r
r = max(a, b)
end subroutine signed_max
! ALL-LABEL: func.func @_QPsigned_max(
! ALL: arith.maxsi
subroutine unsigned_max(a, b, r)
unsigned :: a, b, r
r = max(a, b)
end subroutine unsigned_max
! ALL-LABEL: func.func @_QPunsigned_max(
! ALL: %[[CVT1:.*]] = fir.convert %{{.*}} : (ui32) -> i32
! ALL: %[[CVT2:.*]] = fir.convert %{{.*}} : (ui32) -> i32
! ALL: %[[MAX:.*]] = arith.maxui %[[CVT1]], %[[CVT2]] : i32
! ALL: fir.convert %[[MAX]] : (i32) -> ui32
subroutine signed_min(a, b, r)
integer :: a, b, r
r = min(a, b)
end subroutine signed_min
! ALL-LABEL: func.func @_QPsigned_min(
! ALL: arith.minsi
subroutine unsigned_min(a, b, r)
unsigned :: a, b, r
r = min(a, b)
end subroutine unsigned_min
! ALL-LABEL: func.func @_QPunsigned_min(
! ALL: %[[CVT1:.*]] = fir.convert %{{.*}} : (ui32) -> i32
! ALL: %[[CVT2:.*]] = fir.convert %{{.*}} : (ui32) -> i32
! ALL: %[[MIN:.*]] = arith.minui %[[CVT1]], %[[CVT2]] : i32
! ALL: fir.convert %[[MIN]] : (i32) -> ui32