Files
TheRock/compiler/amd-llvm/llvm/test/CodeGen/DirectX/isnan.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

60 lines
2.8 KiB
LLVM

; RUN: opt -S -dxil-intrinsic-expansion -scalarizer -dxil-op-lower -mtriple=dxil-pc-shadermodel6.9-library %s | FileCheck %s --check-prefixes=CHECK,SM69CHECK
; RUN: opt -S -dxil-intrinsic-expansion -mtriple=dxil-pc-shadermodel6.8-library %s | FileCheck %s --check-prefixes=CHECK,SMOLDCHECK
; Make sure dxil operation function calls for isnan are generated for float and half.
define noundef i1 @isnan_float(float noundef %a) {
entry:
; CHECK-LABEL: @isnan_float
; SM69CHECK: call i1 @dx.op.isSpecialFloat.f32(i32 8, float %{{.*}})
; SMOLDCHECK: call i1 @llvm.dx.isnan.f32(float %{{.*}})
%dx.isnan = call i1 @llvm.dx.isnan.f32(float %a)
ret i1 %dx.isnan
}
define noundef i1 @isnan_half(half noundef %a) {
entry:
; CHECK-LABEL: @isnan_half
; SM69CHECK: call i1 @dx.op.isSpecialFloat.f16(i32 8, half %{{.*}})
; SMOLDCHECK: [[BITCAST:%.*]] = bitcast half %{{.*}} to i16
; SMOLDCHECK: [[ANDHIGH:%.*]] = and i16 [[BITCAST]], 31744
; SMOLDCHECK: [[CMPHIGH:%.*]] = icmp eq i16 [[ANDHIGH]], 31744
; SMOLDCHECK: [[ANDLOW:%.*]] = and i16 [[BITCAST]], 1023
; SMOLDCHECK: [[CMPLOW:%.*]] = icmp ne i16 [[ANDLOW]], 0
; SMOLDCHECK: [[AND:%.*]] = and i1 [[CMPHIGH]], [[CMPLOW]]
%dx.isnan = call i1 @llvm.dx.isnan.f16(half %a)
ret i1 %dx.isnan
}
define noundef <4 x i1> @isnan_half4(<4 x half> noundef %p0) {
entry:
; CHECK-LABEL: @isnan_half4
; SM69CHECK: call i1 @dx.op.isSpecialFloat.f16(i32 8, half
; SM69CHECK: call i1 @dx.op.isSpecialFloat.f16(i32 8, half
; SM69CHECK: call i1 @dx.op.isSpecialFloat.f16(i32 8, half
; SM69CHECK: call i1 @dx.op.isSpecialFloat.f16(i32 8, half
; SMOLDCHECK: [[BITCAST:%.*]] = bitcast <4 x half> %{{.*}} to <4 x i16>
; SMOLDCHECK: [[ANDHIGH:%.*]] = and <4 x i16> [[BITCAST]], splat (i16 31744)
; SMOLDCHECK: [[CMPHIGH:%.*]] = icmp eq <4 x i16> [[ANDHIGH]], splat (i16 31744)
; SMOLDCHECK: [[ANDLOW:%.*]] = and <4 x i16> [[BITCAST]], splat (i16 1023)
; SMOLDCHECK: [[CMPLOW:%.*]] = icmp ne <4 x i16> [[ANDLOW]], zeroinitializer
; SMOLDCHECK: [[AND:%.*]] = and <4 x i1> [[CMPHIGH]], [[CMPLOW]]
%hlsl.isnan = call <4 x i1> @llvm.dx.isnan.v4f16(<4 x half> %p0)
ret <4 x i1> %hlsl.isnan
}
define noundef <3 x i1> @isnan_float3(<3 x float> noundef %p0) {
entry:
; CHECK-LABEL: @isnan_float3
; SM69CHECK: call i1 @dx.op.isSpecialFloat.f32(i32 8, float
; SM69CHECK: call i1 @dx.op.isSpecialFloat.f32(i32 8, float
; SM69CHECK: call i1 @dx.op.isSpecialFloat.f32(i32 8, float
; SMOLDCHECK: = call <3 x i1> @llvm.dx.isnan.v3f32(<3 x float>
%hlsl.isnan = call <3 x i1> @llvm.dx.isnan.v3f32(<3 x float> %p0)
ret <3 x i1> %hlsl.isnan
}
; SM69CHECK-DAG: declare i1 @dx.op.isSpecialFloat.f32(i32, float) #[[#ATTR0:]]
; SM69CHECK-DAG: declare i1 @dx.op.isSpecialFloat.f16(i32, half) #[[#ATTR0]]
; SM69CHECK: attributes #[[#ATTR0]] = { nounwind memory(none) }