|
1 |
| -; RUN: opt -S -dxil-op-lower -mtriple=dxil-pc-shadermodel6.3-library %s | FileCheck %s |
| 1 | +; RUN: opt -S -scalarizer -dxil-op-lower -mtriple=dxil-pc-shadermodel6.3-library %s | FileCheck %s |
2 | 2 | ; Make sure the intrinsic dx.saturate is to appropriate DXIL op for half/float/double data types.
|
3 | 3 |
|
4 | 4 | ; CHECK-LABEL: test_saturate_half
|
@@ -28,9 +28,35 @@ entry:
|
28 | 28 | ret double %hlsl.saturate
|
29 | 29 | }
|
30 | 30 |
|
31 |
| -; CHECK: attributes #[[#ATTR]] = {{{.*}} memory(none) {{.*}}} |
| 31 | +; CHECK-LABEL: test_saturate_half4 |
| 32 | +define noundef <4 x half> @test_saturate_half4(<4 x half> noundef %p0) { |
| 33 | +entry: |
| 34 | + ; CHECK: call half @dx.op.unary.f16(i32 7, half |
| 35 | + ; CHECK: call half @dx.op.unary.f16(i32 7, half |
| 36 | + ; CHECK: call half @dx.op.unary.f16(i32 7, half |
| 37 | + ; CHECK: call half @dx.op.unary.f16(i32 7, half |
| 38 | + %hlsl.saturate = call <4 x half> @llvm.dx.saturate.v4f16(<4 x half> %p0) |
| 39 | + ret <4 x half> %hlsl.saturate |
| 40 | +} |
| 41 | + |
| 42 | +; CHECK-LABEL: test_saturate_float3 |
| 43 | +define noundef <3 x float> @test_saturate_float3(<3 x float> noundef %p0) { |
| 44 | +entry: |
| 45 | + ; CHECK: call float @dx.op.unary.f32(i32 7, float |
| 46 | + ; CHECK: call float @dx.op.unary.f32(i32 7, float |
| 47 | + ; CHECK: call float @dx.op.unary.f32(i32 7, float |
| 48 | + %hlsl.saturate = call <3 x float> @llvm.dx.saturate.v3f32(<3 x float> %p0) |
| 49 | + ret <3 x float> %hlsl.saturate |
| 50 | +} |
32 | 51 |
|
33 |
| -declare half @llvm.dx.saturate.f16(half) |
34 |
| -declare float @llvm.dx.saturate.f32(float) |
35 |
| -declare double @llvm.dx.saturate.f64(double) |
| 52 | +; CHECK-LABEL: test_saturate_double2 |
| 53 | +define noundef <2 x double> @test_saturate_double2(<2 x double> noundef %p0) { |
| 54 | +entry: |
| 55 | + ; CHECK: call double @dx.op.unary.f64(i32 7, double |
| 56 | + ; CHECK: call double @dx.op.unary.f64(i32 7, double |
| 57 | + %hlsl.saturate = call <2 x double> @llvm.dx.saturate.v4f64(<2 x double> %p0) |
| 58 | + ret <2 x double> %hlsl.saturate |
| 59 | +} |
36 | 60 |
|
| 61 | + |
| 62 | +; CHECK: attributes #[[#ATTR]] = {{{.*}} memory(none) {{.*}}} |
0 commit comments