63 lines · plain
1; RUN: opt -S -scalarizer -dxil-op-lower -mtriple=dxil-pc-shadermodel6.3-library %s | FileCheck %s2; Make sure the intrinsic dx.saturate is to appropriate DXIL op for half/float/double data types.3 4; CHECK-LABEL: test_saturate_half5define noundef half @test_saturate_half(half noundef %p0) {6entry:7 ; CHECK: call half @dx.op.unary.f16(i32 7, half %p0) #[[#ATTR:]]8 %hlsl.saturate = call half @llvm.dx.saturate.f16(half %p0)9 ; CHECK: ret half10 ret half %hlsl.saturate11}12 13; CHECK-LABEL: test_saturate_float14define noundef float @test_saturate_float(float noundef %p0) {15entry:16 ; CHECK: call float @dx.op.unary.f32(i32 7, float %p0) #[[#ATTR]]17 %hlsl.saturate = call float @llvm.dx.saturate.f32(float %p0)18 ; CHECK: ret float19 ret float %hlsl.saturate20}21 22; CHECK-LABEL: test_saturate_double23define noundef double @test_saturate_double(double noundef %p0) {24entry:25 ; CHECK: call double @dx.op.unary.f64(i32 7, double %p0) #[[#ATTR]]26 %hlsl.saturate = call double @llvm.dx.saturate.f64(double %p0)27 ; CHECK: ret double28 ret double %hlsl.saturate29}30 31; CHECK-LABEL: test_saturate_half432define noundef <4 x half> @test_saturate_half4(<4 x half> noundef %p0) {33entry:34 ; CHECK: call half @dx.op.unary.f16(i32 7, half35 ; CHECK: call half @dx.op.unary.f16(i32 7, half36 ; CHECK: call half @dx.op.unary.f16(i32 7, half37 ; CHECK: call half @dx.op.unary.f16(i32 7, half38 %hlsl.saturate = call <4 x half> @llvm.dx.saturate.v4f16(<4 x half> %p0)39 ret <4 x half> %hlsl.saturate40}41 42; CHECK-LABEL: test_saturate_float343define noundef <3 x float> @test_saturate_float3(<3 x float> noundef %p0) {44entry:45 ; CHECK: call float @dx.op.unary.f32(i32 7, float46 ; CHECK: call float @dx.op.unary.f32(i32 7, float47 ; CHECK: call float @dx.op.unary.f32(i32 7, float48 %hlsl.saturate = call <3 x float> @llvm.dx.saturate.v3f32(<3 x float> %p0)49 ret <3 x float> %hlsl.saturate50}51 52; CHECK-LABEL: test_saturate_double253define noundef <2 x double> @test_saturate_double2(<2 x double> noundef %p0) {54entry:55 ; CHECK: call double @dx.op.unary.f64(i32 7, double56 ; CHECK: call double @dx.op.unary.f64(i32 7, double57 %hlsl.saturate = call <2 x double> @llvm.dx.saturate.v4f64(<2 x double> %p0)58 ret <2 x double> %hlsl.saturate59}60 61 62; CHECK: attributes #[[#ATTR]] = {{{.*}} memory(none) {{.*}}}63