[llvm] [DirectX] Scalarize the dx.saturate intrinsic (PR #134381)
Farzon Lotfi via llvm-commits
llvm-commits at lists.llvm.org
Mon Apr 7 11:00:32 PDT 2025
================
@@ -28,9 +28,35 @@ entry:
ret double %hlsl.saturate
}
-; CHECK: attributes #[[#ATTR]] = {{{.*}} memory(none) {{.*}}}
+; CHECK-LABEL: test_saturate_half4
+define noundef <4 x half> @test_saturate_half4(<4 x half> noundef %p0) {
+entry:
+ ; CHECK: call half @dx.op.unary.f16(i32 7, half
+ ; CHECK: call half @dx.op.unary.f16(i32 7, half
+ ; CHECK: call half @dx.op.unary.f16(i32 7, half
+ ; CHECK: call half @dx.op.unary.f16(i32 7, half
+ %hlsl.saturate = call <4 x half> @llvm.dx.saturate.v4f16(<4 x half> %p0)
+ ret <4 x half> %hlsl.saturate
+}
+
+; CHECK-LABEL: test_saturate_float3
+define noundef <3 x float> @test_saturate_float3(<3 x float> noundef %p0) {
+entry:
+ ; CHECK: call float @dx.op.unary.f32(i32 7, float
+ ; CHECK: call float @dx.op.unary.f32(i32 7, float
+ ; CHECK: call float @dx.op.unary.f32(i32 7, float
+ %hlsl.saturate = call <3 x float> @llvm.dx.saturate.v3f32(<3 x float> %p0)
+ ret <3 x float> %hlsl.saturate
+}
-declare half @llvm.dx.saturate.f16(half)
----------------
farzonl wrote:
Not sure why we removed these. Were they causing an error? If you want to make sure they are gone we could do a `CHECK-NOT:` for these intrinsics?
https://github.com/llvm/llvm-project/pull/134381
More information about the llvm-commits
mailing list