Files
TheRock/compiler/amd-llvm/llvm/test/Transforms/ExpandIRInsts/AMDGPU/frem-inf.ll
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

53 lines
2.0 KiB
LLVM

; RUN: opt -mtriple=amdgcn -passes="require<libcall-lowering-info>,expand-ir-insts<O0>" %s -S -o - | FileCheck --check-prefixes CHECK %s
; RUN: opt -mtriple=amdgcn -passes="require<libcall-lowering-info>,expand-ir-insts<O1>" %s -S -o - | FileCheck --check-prefixes CHECK,OPT1 %s
; Check the handling of potentially infinite numerators in the frem
; expansion at different optimization levels and with different
; fast-math flags.
; CHECK-LABEL: define float @frem_x_maybe_inf(float %x, float %y)
; CHECK: 2:
; CHECK: [[FABS:%.*]] = call float @llvm.fabs.f32(float %x)
; CHECK: [[FCMP:%.*]] = fcmp ult float [[FABS]], +inf
; CHECK-NEXT: %ret = select i1 [[FCMP]], float %{{.*}}, float +qnan
; CHECK-NEXT: ret float %ret
; CHECK-LABEL: }
define float @frem_x_maybe_inf(float %x, float %y) {
%ret = frem float %x, %y
ret float %ret
}
; OPT1-LABEL: define float @frem_x_assumed_non_inf(float %x, float %y)
; OPT1: 2:
; OPT1-NOT: call float @llvm.fabs.f32(float %x)
; OPT1-NOT: fcmp ult float [[FABS]], +inf
; OPT1: %ret = select i1 true, float %{{.*}}, float +qnan
; OPT1-NEXT: ret float %ret
; OPT1-LABEL: }
; OPT0-LABEL: define float @frem_x_assumed_non_inf(float %x, float %y)
; OPT0: 2:
; OPT0: [[FABS:%.*]] = call float @llvm.fabs.f32(float %x)
; OPT0: [[FCMP:%.*]] = fcmp ult float [[FABS]], 0x7FF0000000000000
; OPT0-NEXT: %ret = select i1 [[FCMP]], float %{{.*}}, float 0x7FF8000000000000
; OPT0-NEXT: ret float %ret
; OPT0-LABEL: }
define float @frem_x_assumed_non_inf(float %x, float %y) {
%absx = call float @llvm.fabs.f32(float %x)
%noninf = fcmp ult float %absx, 0x7FF0000000000000
call void @llvm.assume(i1 %noninf)
%ret = frem float %x, %y
ret float %ret
}
; CHECK-LABEL: define float @frem_ninf(float %x, float %y)
; CHECK: 2:
; CHECK-NOT: call float @llvm.fabs.f32(float %x)
; CHECK-NOT: fcmp ult float [[FABS]], +inf
; CHECK: %ret = select ninf i1 true, float %{{.*}}, float +qnan
; CHECK-NEXT: ret float %ret
; CHECK-LABEL: }
define float @frem_ninf(float %x, float %y) {
%ret = frem ninf float %x, %y
ret float %ret
}