1 ; RUN: opt -S -dxil-op-lower -mtriple=dxil-pc-shadermodel6.3-library %s | FileCheck %s
2 ; Make sure the intrinsic dx.saturate is to appropriate DXIL op for half/float/double data types.
4 ; CHECK-LABEL: test_saturate_half
5 define noundef half @test_saturate_half(half noundef %p0) {
7 ; CHECK: call half @dx.op.unary.f16(i32 7, half %p0)
8 %hlsl.saturate = call half @llvm.dx.saturate.f16(half %p0)
10 ret half %hlsl.saturate
13 ; CHECK-LABEL: test_saturate_float
14 define noundef float @test_saturate_float(float noundef %p0) {
16 ; CHECK: call float @dx.op.unary.f32(i32 7, float %p0)
17 %hlsl.saturate = call float @llvm.dx.saturate.f32(float %p0)
19 ret float %hlsl.saturate
22 ; CHECK-LABEL: test_saturate_double
23 define noundef double @test_saturate_double(double noundef %p0) {
25 ; CHECK: call double @dx.op.unary.f64(i32 7, double %p0)
26 %hlsl.saturate = call double @llvm.dx.saturate.f64(double %p0)
28 ret double %hlsl.saturate
31 declare half @llvm.dx.saturate.f16(half)
32 declare float @llvm.dx.saturate.f32(float)
33 declare double @llvm.dx.saturate.f64(double)