Files
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

99 lines
3.1 KiB
LLVM

; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
; RUN: opt < %s -passes=instcombine -S | FileCheck %s
declare float @llvm.minimum.f32(float %Val0, float %Val1)
declare float @llvm.maximum.f32(float %Val0, float %Val1)
declare <4 x float> @llvm.minimum.v4f32(<4 x float> %Val0, <4 x float> %Val1)
declare <4 x float> @llvm.maximum.v4f32(<4 x float> %Val0, <4 x float> %Val1)
define float @test(float %a, float %b) {
; CHECK-LABEL: @test(
; CHECK-NEXT: entry:
; CHECK-NEXT: [[RES:%.*]] = fadd float [[A:%.*]], [[B:%.*]]
; CHECK-NEXT: ret float [[RES]]
;
entry:
%min = call float @llvm.minimum.f32(float %a, float %b)
%max = call float @llvm.maximum.f32(float %a, float %b)
%res = fadd float %min, %max
ret float %res
}
define float @test_comm1(float %a, float %b) {
; CHECK-LABEL: @test_comm1(
; CHECK-NEXT: entry:
; CHECK-NEXT: [[RES:%.*]] = fadd float [[A:%.*]], [[B:%.*]]
; CHECK-NEXT: ret float [[RES]]
;
entry:
%min = call float @llvm.minimum.f32(float %a, float %b)
%max = call float @llvm.maximum.f32(float %a, float %b)
%res = fadd float %max, %min
ret float %res
}
define float @test_comm2(float %a, float %b) {
; CHECK-LABEL: @test_comm2(
; CHECK-NEXT: entry:
; CHECK-NEXT: [[RES:%.*]] = fadd float [[B:%.*]], [[A:%.*]]
; CHECK-NEXT: ret float [[RES]]
;
entry:
%min = call float @llvm.minimum.f32(float %a, float %b)
%max = call float @llvm.maximum.f32(float %b, float %a)
%res = fadd float %min, %max
ret float %res
}
define float @test_comm3(float %a, float %b) {
; CHECK-LABEL: @test_comm3(
; CHECK-NEXT: entry:
; CHECK-NEXT: [[RES:%.*]] = fadd float [[B:%.*]], [[A:%.*]]
; CHECK-NEXT: ret float [[RES]]
;
entry:
%min = call float @llvm.minimum.f32(float %a, float %b)
%max = call float @llvm.maximum.f32(float %b, float %a)
%res = fadd float %max, %min
ret float %res
}
define <4 x float> @test_vect(<4 x float> %a, <4 x float> %b) {
; CHECK-LABEL: @test_vect(
; CHECK-NEXT: entry:
; CHECK-NEXT: [[RES:%.*]] = fadd <4 x float> [[B:%.*]], [[A:%.*]]
; CHECK-NEXT: ret <4 x float> [[RES]]
;
entry:
%min = call <4 x float> @llvm.minimum.v4f32(<4 x float> %a, <4 x float> %b)
%max = call <4 x float> @llvm.maximum.v4f32(<4 x float> %b, <4 x float> %a)
%res = fadd <4 x float> %min, %max
ret <4 x float> %res
}
define float @test_flags(float %a, float %b) {
; CHECK-LABEL: @test_flags(
; CHECK-NEXT: entry:
; CHECK-NEXT: [[RES:%.*]] = fadd fast float [[A:%.*]], [[B:%.*]]
; CHECK-NEXT: ret float [[RES]]
;
entry:
%min = call float @llvm.minimum.f32(float %a, float %b)
%max = call float @llvm.maximum.f32(float %a, float %b)
%res = fadd fast float %min, %max
ret float %res
}
define float @test_flags2(float %a, float %b) {
; CHECK-LABEL: @test_flags2(
; CHECK-NEXT: entry:
; CHECK-NEXT: [[RES:%.*]] = fadd reassoc nsz arcp contract afn float [[A:%.*]], [[B:%.*]]
; CHECK-NEXT: ret float [[RES]]
;
entry:
%min = call float @llvm.minimum.f32(float %a, float %b)
%max = call float @llvm.maximum.f32(float %a, float %b)
%res = fadd reassoc ninf nsz arcp contract afn float %min, %max
ret float %res
}