Files
TheRock/compiler/amd-llvm/llvm/test/Transforms/InstCombine/X86/x86-fp-minmax-negzero.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

103 lines
5.1 KiB
LLVM

; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 6
; RUN: opt -passes=instcombine -mtriple=x86_64-unknown-unknown < %s -S | FileCheck %s
; Test relaxed negzero handling for X86 max/min intrinsics.
declare <4 x float> @llvm.x86.sse.max.ps(<4 x float>, <4 x float>)
declare <4 x float> @llvm.x86.sse.min.ps(<4 x float>, <4 x float>)
declare <4 x float> @llvm.x86.sse.max.ss(<4 x float>, <4 x float>)
declare <4 x float> @llvm.x86.sse.min.ss(<4 x float>, <4 x float>)
; For maxnum, allow -0.0 in the first operand only.
define <4 x float> @test_max_allow_negzero_first() {
; CHECK-LABEL: define <4 x float> @test_max_allow_negzero_first() {
; CHECK-NEXT: [[ENTRY:.*:]]
; CHECK-NEXT: ret <4 x float> splat (float 1.000000e+00)
;
entry:
%r = call <4 x float> @llvm.x86.sse.max.ps(<4 x float> <float -0.0, float -0.0, float -0.0, float -0.0>, <4 x float> <float 1.0, float 1.0, float 1.0, float 1.0>)
ret <4 x float> %r
}
; For minnum, allow -0.0 in the second operand only.
define <4 x float> @test_min_allow_negzero_second() {
; CHECK-LABEL: define <4 x float> @test_min_allow_negzero_second() {
; CHECK-NEXT: [[ENTRY:.*:]]
; CHECK-NEXT: ret <4 x float> splat (float -0.000000e+00)
;
entry:
%r = call <4 x float> @llvm.x86.sse.min.ps(<4 x float> <float 1.0, float 1.0, float 1.0, float 1.0>, <4 x float> <float -0.0, float -0.0, float -0.0, float -0.0>)
ret <4 x float> %r
}
; Negative test: max should not fold when -0.0 is in the second operand.
define <4 x float> @test_max_disallow_negzero_second() {
; CHECK-LABEL: define <4 x float> @test_max_disallow_negzero_second() {
; CHECK-NEXT: [[ENTRY:.*:]]
; CHECK-NEXT: [[R:%.*]] = call <4 x float> @llvm.x86.sse.max.ps(<4 x float> splat (float 1.000000e+00), <4 x float> splat (float -0.000000e+00))
; CHECK-NEXT: ret <4 x float> [[R]]
;
entry:
%r = call <4 x float> @llvm.x86.sse.max.ps(<4 x float> <float 1.0, float 1.0, float 1.0, float 1.0>, <4 x float> <float -0.0, float -0.0, float -0.0, float -0.0>)
ret <4 x float> %r
}
; Negative test: min should not fold when -0.0 is in the first operand.
define <4 x float> @test_min_disallow_negzero_first() {
; CHECK-LABEL: define <4 x float> @test_min_disallow_negzero_first() {
; CHECK-NEXT: [[ENTRY:.*:]]
; CHECK-NEXT: [[R:%.*]] = call <4 x float> @llvm.x86.sse.min.ps(<4 x float> splat (float -0.000000e+00), <4 x float> splat (float 1.000000e+00))
; CHECK-NEXT: ret <4 x float> [[R]]
;
entry:
%r = call <4 x float> @llvm.x86.sse.min.ps(<4 x float> <float -0.0, float -0.0, float -0.0, float -0.0>, <4 x float> <float 1.0, float 1.0, float 1.0, float 1.0>)
ret <4 x float> %r
}
; Scalar: only lane 0 is semantically constrained.
define <4 x float> @test_max_ss_allow_negzero_first() {
; CHECK-LABEL: define <4 x float> @test_max_ss_allow_negzero_first() {
; CHECK-NEXT: [[ENTRY:.*:]]
; CHECK-NEXT: ret <4 x float> <float 1.000000e+00, float +qnan, float +qnan, float +qnan>
;
entry:
%r = call <4 x float> @llvm.x86.sse.max.ss(<4 x float> <float -0.0, float 0x7FF8000000000000, float 0x7FF8000000000000, float 0x7FF8000000000000>, <4 x float> <float 1.0, float 0x7FF8000000000000, float 0x7FF8000000000000, float 0x7FF8000000000000>)
ret <4 x float> %r
}
define <4 x float> @test_max_ss_disallow_negzero_second() {
; CHECK-LABEL: define <4 x float> @test_max_ss_disallow_negzero_second() {
; CHECK-NEXT: [[ENTRY:.*:]]
; CHECK-NEXT: [[R:%.*]] = call <4 x float> @llvm.x86.sse.max.ss(<4 x float> <float 1.000000e+00, float +qnan, float +qnan, float +qnan>, <4 x float> <float -0.000000e+00, float poison, float poison, float poison>)
; CHECK-NEXT: ret <4 x float> [[R]]
;
entry:
%r = call <4 x float> @llvm.x86.sse.max.ss(<4 x float> <float 1.0, float 0x7FF8000000000000, float 0x7FF8000000000000, float 0x7FF8000000000000>, <4 x float> <float -0.0, float 0x7FF8000000000000, float 0x7FF8000000000000, float 0x7FF8000000000000>)
ret <4 x float> %r
}
define <4 x float> @test_min_ss_allow_negzero_second() {
; CHECK-LABEL: define <4 x float> @test_min_ss_allow_negzero_second() {
; CHECK-NEXT: [[ENTRY:.*:]]
; CHECK-NEXT: ret <4 x float> <float -0.000000e+00, float +qnan, float +qnan, float +qnan>
;
entry:
%r = call <4 x float> @llvm.x86.sse.min.ss(<4 x float> <float 1.0, float 0x7FF8000000000000, float 0x7FF8000000000000, float 0x7FF8000000000000>, <4 x float> <float -0.0, float 0x7FF8000000000000, float 0x7FF8000000000000, float 0x7FF8000000000000>)
ret <4 x float> %r
}
define <4 x float> @test_min_ss_disallow_negzero_first() {
; CHECK-LABEL: define <4 x float> @test_min_ss_disallow_negzero_first() {
; CHECK-NEXT: [[ENTRY:.*:]]
; CHECK-NEXT: [[R:%.*]] = call <4 x float> @llvm.x86.sse.min.ss(<4 x float> <float -0.000000e+00, float +qnan, float +qnan, float +qnan>, <4 x float> <float 1.000000e+00, float poison, float poison, float poison>)
; CHECK-NEXT: ret <4 x float> [[R]]
;
entry:
%r = call <4 x float> @llvm.x86.sse.min.ss(<4 x float> <float -0.0, float 0x7FF8000000000000, float 0x7FF8000000000000, float 0x7FF8000000000000>, <4 x float> <float 1.0, float 0x7FF8000000000000, float 0x7FF8000000000000, float 0x7FF8000000000000>)
ret <4 x float> %r
}