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
188 lines
9.6 KiB
LLVM
188 lines
9.6 KiB
LLVM
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 6
|
|
; RUN: opt < %s -passes=instcombine -mtriple=x86_64-unknown-unknown -S | FileCheck %s
|
|
|
|
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 <2 x double> @llvm.x86.sse2.max.pd(<2 x double>, <2 x double>)
|
|
declare <2 x double> @llvm.x86.sse2.min.pd(<2 x double>, <2 x double>)
|
|
declare <8 x float> @llvm.x86.avx.max.ps.256(<8 x float>, <8 x float>)
|
|
declare <8 x float> @llvm.x86.avx.min.ps.256(<8 x float>, <8 x float>)
|
|
declare <32 x half> @llvm.x86.avx512fp16.max.ph.512(<32 x half>, <32 x half>, i32)
|
|
declare <32 x half> @llvm.x86.avx512fp16.min.ph.512(<32 x half>, <32 x half>, i32)
|
|
|
|
define <4 x float> @test_sse_max_ps(<4 x i32> %x, <4 x i32> %y) {
|
|
; CHECK-LABEL: define <4 x float> @test_sse_max_ps(
|
|
; CHECK-SAME: <4 x i32> [[X:%.*]], <4 x i32> [[Y:%.*]]) {
|
|
; CHECK-NEXT: [[ENTRY:.*:]]
|
|
; CHECK-NEXT: [[CVT:%.*]] = sitofp <4 x i32> [[X]] to <4 x float>
|
|
; CHECK-NEXT: [[CMP:%.*]] = icmp sgt <4 x i32> [[Y]], splat (i32 -1)
|
|
; CHECK-NEXT: [[SEL:%.*]] = select <4 x i1> [[CMP]], <4 x float> splat (float 1.000000e+00), <4 x float> splat (float -1.000000e+00)
|
|
; CHECK-NEXT: [[MAX:%.*]] = call <4 x float> @llvm.maxnum.v4f32(<4 x float> [[CVT]], <4 x float> [[SEL]])
|
|
; CHECK-NEXT: ret <4 x float> [[MAX]]
|
|
;
|
|
entry:
|
|
%cvt = sitofp <4 x i32> %x to <4 x float>
|
|
%cmp = icmp sgt <4 x i32> %y, splat (i32 -1)
|
|
%sel = select <4 x i1> %cmp, <4 x float> splat (float 1.000000e+00), <4 x float> splat (float -1.000000e+00)
|
|
%max = tail call noundef <4 x float> @llvm.x86.sse.max.ps(<4 x float> %cvt, <4 x float> %sel)
|
|
ret <4 x float> %max
|
|
}
|
|
|
|
define <4 x float> @test_sse_min_ps(<4 x i32> %x, <4 x i32> %y) {
|
|
; CHECK-LABEL: define <4 x float> @test_sse_min_ps(
|
|
; CHECK-SAME: <4 x i32> [[X:%.*]], <4 x i32> [[Y:%.*]]) {
|
|
; CHECK-NEXT: [[ENTRY:.*:]]
|
|
; CHECK-NEXT: [[CVT:%.*]] = sitofp <4 x i32> [[X]] to <4 x float>
|
|
; CHECK-NEXT: [[CMP:%.*]] = icmp sgt <4 x i32> [[Y]], splat (i32 -1)
|
|
; CHECK-NEXT: [[SEL:%.*]] = select <4 x i1> [[CMP]], <4 x float> splat (float 1.000000e+00), <4 x float> splat (float -1.000000e+00)
|
|
; CHECK-NEXT: [[MAX:%.*]] = call <4 x float> @llvm.minnum.v4f32(<4 x float> [[CVT]], <4 x float> [[SEL]])
|
|
; CHECK-NEXT: ret <4 x float> [[MAX]]
|
|
;
|
|
entry:
|
|
%cvt = sitofp <4 x i32> %x to <4 x float>
|
|
%cmp = icmp sgt <4 x i32> %y, splat (i32 -1)
|
|
%sel = select <4 x i1> %cmp, <4 x float> splat (float 1.000000e+00), <4 x float> splat (float -1.000000e+00)
|
|
%max = tail call noundef <4 x float> @llvm.x86.sse.min.ps(<4 x float> %cvt, <4 x float> %sel)
|
|
ret <4 x float> %max
|
|
}
|
|
|
|
define <2 x double> @test_sse2_max_pd(<2 x i64> %x, <2 x i64> %y) {
|
|
; CHECK-LABEL: define <2 x double> @test_sse2_max_pd(
|
|
; CHECK-SAME: <2 x i64> [[X:%.*]], <2 x i64> [[Y:%.*]]) {
|
|
; CHECK-NEXT: [[ENTRY:.*:]]
|
|
; CHECK-NEXT: [[CVT:%.*]] = sitofp <2 x i64> [[X]] to <2 x double>
|
|
; CHECK-NEXT: [[CMP:%.*]] = icmp sgt <2 x i64> [[Y]], splat (i64 -1)
|
|
; CHECK-NEXT: [[SEL:%.*]] = select <2 x i1> [[CMP]], <2 x double> splat (double 1.000000e+00), <2 x double> splat (double -1.000000e+00)
|
|
; CHECK-NEXT: [[MAX:%.*]] = call <2 x double> @llvm.maxnum.v2f64(<2 x double> [[CVT]], <2 x double> [[SEL]])
|
|
; CHECK-NEXT: ret <2 x double> [[MAX]]
|
|
;
|
|
entry:
|
|
%cvt = sitofp <2 x i64> %x to <2 x double>
|
|
%cmp = icmp sgt <2 x i64> %y, splat (i64 -1)
|
|
%sel = select <2 x i1> %cmp, <2 x double> splat (double 1.000000e+00), <2 x double> splat (double -1.000000e+00)
|
|
%max = tail call noundef <2 x double> @llvm.x86.sse2.max.pd(<2 x double> %cvt, <2 x double> %sel)
|
|
ret <2 x double> %max
|
|
}
|
|
|
|
define <2 x double> @test_sse2_min_pd(<2 x i64> %x, <2 x i64> %y) {
|
|
; CHECK-LABEL: define <2 x double> @test_sse2_min_pd(
|
|
; CHECK-SAME: <2 x i64> [[X:%.*]], <2 x i64> [[Y:%.*]]) {
|
|
; CHECK-NEXT: [[ENTRY:.*:]]
|
|
; CHECK-NEXT: [[CVT:%.*]] = sitofp <2 x i64> [[X]] to <2 x double>
|
|
; CHECK-NEXT: [[CMP:%.*]] = icmp sgt <2 x i64> [[Y]], splat (i64 -1)
|
|
; CHECK-NEXT: [[SEL:%.*]] = select <2 x i1> [[CMP]], <2 x double> splat (double 1.000000e+00), <2 x double> splat (double -1.000000e+00)
|
|
; CHECK-NEXT: [[MAX:%.*]] = call <2 x double> @llvm.minnum.v2f64(<2 x double> [[CVT]], <2 x double> [[SEL]])
|
|
; CHECK-NEXT: ret <2 x double> [[MAX]]
|
|
;
|
|
entry:
|
|
%cvt = sitofp <2 x i64> %x to <2 x double>
|
|
%cmp = icmp sgt <2 x i64> %y, splat (i64 -1)
|
|
%sel = select <2 x i1> %cmp, <2 x double> splat (double 1.000000e+00), <2 x double> splat (double -1.000000e+00)
|
|
%max = tail call noundef <2 x double> @llvm.x86.sse2.min.pd(<2 x double> %cvt, <2 x double> %sel)
|
|
ret <2 x double> %max
|
|
}
|
|
|
|
define <8 x float> @test_avx_max_ps(<8 x i32> %x, <8 x i32> %y) {
|
|
; CHECK-LABEL: define <8 x float> @test_avx_max_ps(
|
|
; CHECK-SAME: <8 x i32> [[X:%.*]], <8 x i32> [[Y:%.*]]) {
|
|
; CHECK-NEXT: [[ENTRY:.*:]]
|
|
; CHECK-NEXT: [[CVT:%.*]] = sitofp <8 x i32> [[X]] to <8 x float>
|
|
; CHECK-NEXT: [[CMP:%.*]] = icmp sgt <8 x i32> [[Y]], splat (i32 -1)
|
|
; CHECK-NEXT: [[SEL:%.*]] = select <8 x i1> [[CMP]], <8 x float> splat (float 1.000000e+00), <8 x float> splat (float -1.000000e+00)
|
|
; CHECK-NEXT: [[MAX:%.*]] = call <8 x float> @llvm.maxnum.v8f32(<8 x float> [[CVT]], <8 x float> [[SEL]])
|
|
; CHECK-NEXT: ret <8 x float> [[MAX]]
|
|
;
|
|
entry:
|
|
%cvt = sitofp <8 x i32> %x to <8 x float>
|
|
%cmp = icmp sgt <8 x i32> %y, splat (i32 -1)
|
|
%sel = select <8 x i1> %cmp, <8 x float> splat (float 1.000000e+00), <8 x float> splat (float -1.000000e+00)
|
|
%max = tail call noundef <8 x float> @llvm.x86.avx.max.ps.256(<8 x float> %cvt, <8 x float> %sel)
|
|
ret <8 x float> %max
|
|
}
|
|
|
|
|
|
define <8 x float> @test_avx_min_ps(<8 x i32> %x, <8 x i32> %y) {
|
|
; CHECK-LABEL: define <8 x float> @test_avx_min_ps(
|
|
; CHECK-SAME: <8 x i32> [[X:%.*]], <8 x i32> [[Y:%.*]]) {
|
|
; CHECK-NEXT: [[ENTRY:.*:]]
|
|
; CHECK-NEXT: [[CVT:%.*]] = sitofp <8 x i32> [[X]] to <8 x float>
|
|
; CHECK-NEXT: [[CMP:%.*]] = icmp sgt <8 x i32> [[Y]], splat (i32 -1)
|
|
; CHECK-NEXT: [[SEL:%.*]] = select <8 x i1> [[CMP]], <8 x float> splat (float 1.000000e+00), <8 x float> splat (float -1.000000e+00)
|
|
; CHECK-NEXT: [[MAX:%.*]] = call <8 x float> @llvm.minnum.v8f32(<8 x float> [[CVT]], <8 x float> [[SEL]])
|
|
; CHECK-NEXT: ret <8 x float> [[MAX]]
|
|
;
|
|
entry:
|
|
%cvt = sitofp <8 x i32> %x to <8 x float>
|
|
%cmp = icmp sgt <8 x i32> %y, splat (i32 -1)
|
|
%sel = select <8 x i1> %cmp, <8 x float> splat (float 1.000000e+00), <8 x float> splat (float -1.000000e+00)
|
|
%max = tail call noundef <8 x float> @llvm.x86.avx.min.ps.256(<8 x float> %cvt, <8 x float> %sel)
|
|
ret <8 x float> %max
|
|
}
|
|
|
|
define <32 x half> @test_avx512fp16_max_ph(<32 x i16> %x, <32 x i16> %y) {
|
|
; CHECK-LABEL: define <32 x half> @test_avx512fp16_max_ph(
|
|
; CHECK-SAME: <32 x i16> [[X:%.*]], <32 x i16> [[Y:%.*]]) {
|
|
; CHECK-NEXT: [[ENTRY:.*:]]
|
|
; CHECK-NEXT: [[CVT:%.*]] = sitofp <32 x i16> [[X]] to <32 x half>
|
|
; CHECK-NEXT: [[CMP:%.*]] = icmp sgt <32 x i16> [[Y]], splat (i16 -1)
|
|
; CHECK-NEXT: [[SEL:%.*]] = select <32 x i1> [[CMP]], <32 x half> splat (half 1.000000e+00), <32 x half> splat (half -1.000000e+00)
|
|
; CHECK-NEXT: [[MAX:%.*]] = call <32 x half> @llvm.maxnum.v32f16(<32 x half> [[CVT]], <32 x half> [[SEL]])
|
|
; CHECK-NEXT: ret <32 x half> [[MAX]]
|
|
;
|
|
entry:
|
|
%cvt = sitofp <32 x i16> %x to <32 x half>
|
|
%cmp = icmp sgt <32 x i16> %y, splat (i16 -1)
|
|
%sel = select <32 x i1> %cmp, <32 x half> splat (half 1.000000e+00), <32 x half> splat (half -1.000000e+00)
|
|
%max = tail call noundef <32 x half> @llvm.x86.avx512fp16.max.ph.512(<32 x half> %cvt, <32 x half> %sel, i32 4)
|
|
ret <32 x half> %max
|
|
}
|
|
|
|
define <32 x half> @test_avx512fp16_min_ph(<32 x i16> %x, <32 x i16> %y) {
|
|
; CHECK-LABEL: define <32 x half> @test_avx512fp16_min_ph(
|
|
; CHECK-SAME: <32 x i16> [[X:%.*]], <32 x i16> [[Y:%.*]]) {
|
|
; CHECK-NEXT: [[ENTRY:.*:]]
|
|
; CHECK-NEXT: [[CVT:%.*]] = sitofp <32 x i16> [[X]] to <32 x half>
|
|
; CHECK-NEXT: [[CMP:%.*]] = icmp sgt <32 x i16> [[Y]], splat (i16 -1)
|
|
; CHECK-NEXT: [[SEL:%.*]] = select <32 x i1> [[CMP]], <32 x half> splat (half 1.000000e+00), <32 x half> splat (half -1.000000e+00)
|
|
; CHECK-NEXT: [[MAX:%.*]] = call <32 x half> @llvm.minnum.v32f16(<32 x half> [[CVT]], <32 x half> [[SEL]])
|
|
; CHECK-NEXT: ret <32 x half> [[MAX]]
|
|
;
|
|
entry:
|
|
%cvt = sitofp <32 x i16> %x to <32 x half>
|
|
%cmp = icmp sgt <32 x i16> %y, splat (i16 -1)
|
|
%sel = select <32 x i1> %cmp, <32 x half> splat (half 1.000000e+00), <32 x half> splat (half -1.000000e+00)
|
|
%max = tail call noundef <32 x half> @llvm.x86.avx512fp16.min.ph.512(<32 x half> %cvt, <32 x half> %sel, i32 4)
|
|
ret <32 x half> %max
|
|
}
|
|
|
|
|
|
; Negative Test Cases (Operands Could be NaN)
|
|
|
|
define <4 x float> @test_sse_max_ps_unknown(<4 x i32> %x, <4 x float> %y) {
|
|
; CHECK-LABEL: define <4 x float> @test_sse_max_ps_unknown(
|
|
; CHECK-SAME: <4 x i32> [[X:%.*]], <4 x float> [[Y:%.*]]) {
|
|
; CHECK-NEXT: [[ENTRY:.*:]]
|
|
; CHECK-NEXT: [[CVT:%.*]] = sitofp <4 x i32> [[X]] to <4 x float>
|
|
; CHECK-NEXT: [[MAX:%.*]] = tail call noundef <4 x float> @llvm.x86.sse.max.ps(<4 x float> [[CVT]], <4 x float> [[Y]])
|
|
; CHECK-NEXT: ret <4 x float> [[MAX]]
|
|
;
|
|
entry:
|
|
%cvt = sitofp <4 x i32> %x to <4 x float>
|
|
%max = tail call noundef <4 x float> @llvm.x86.sse.max.ps(<4 x float> %cvt, <4 x float> %y)
|
|
ret <4 x float> %max
|
|
}
|
|
|
|
|
|
define <4 x float> @test_sse_max_ps_both_unknown(<4 x float> %x, <4 x float> %y) {
|
|
; CHECK-LABEL: define <4 x float> @test_sse_max_ps_both_unknown(
|
|
; CHECK-SAME: <4 x float> [[X:%.*]], <4 x float> [[Y:%.*]]) {
|
|
; CHECK-NEXT: [[ENTRY:.*:]]
|
|
; CHECK-NEXT: [[MAX:%.*]] = tail call noundef <4 x float> @llvm.x86.sse.max.ps(<4 x float> [[X]], <4 x float> [[Y]])
|
|
; CHECK-NEXT: ret <4 x float> [[MAX]]
|
|
;
|
|
entry:
|
|
%max = tail call noundef <4 x float> @llvm.x86.sse.max.ps(<4 x float> %x, <4 x float> %y)
|
|
ret <4 x float> %max
|
|
}
|
|
|