[clang] [clang][HLSL] Update DXIL/SPIRV hybird CodeGen tests to use temp var (PR #105930)
Greg Roth via cfe-commits
cfe-commits at lists.llvm.org
Mon Aug 26 10:23:18 PDT 2024
================
@@ -15,70 +15,70 @@
// DXIL_NATIVE_HALF: define noundef half @
// SPIR_NATIVE_HALF: define spir_func noundef half @
-// DXIL_NATIVE_HALF: %hlsl.frac = call half @llvm.dx.frac.f16(
-// SPIR_NATIVE_HALF: %hlsl.frac = call half @llvm.spv.frac.f16(
+// DXIL_NATIVE_HALF: %hlsl.frac = call half @llvm.[[ICF:dx]].frac.f16(
+// SPIR_NATIVE_HALF: %hlsl.frac = call half @llvm.[[ICF:spv]].frac.f16(
// NATIVE_HALF: ret half %hlsl.frac
// DXIL_NO_HALF: define noundef float @
// SPIR_NO_HALF: define spir_func noundef float @
-// DXIL_NO_HALF: %hlsl.frac = call float @llvm.dx.frac.f32(
-// SPIR_NO_HALF: %hlsl.frac = call float @llvm.spv.frac.f32(
+// DXIL_NO_HALF: %hlsl.frac = call float @llvm.[[ICF:dx]].frac.f32(
+// SPIR_NO_HALF: %hlsl.frac = call float @llvm.[[ICF:spv]].frac.f32(
// NO_HALF: ret float %hlsl.frac
half test_frac_half(half p0) { return frac(p0); }
// DXIL_NATIVE_HALF: define noundef <2 x half> @
// SPIR_NATIVE_HALF: define spir_func noundef <2 x half> @
-// DXIL_NATIVE_HALF: %hlsl.frac = call <2 x half> @llvm.dx.frac.v2f16
-// SPIR_NATIVE_HALF: %hlsl.frac = call <2 x half> @llvm.spv.frac.v2f16
+// DXIL_NATIVE_HALF: %hlsl.frac = call <2 x half> @llvm.[[ICF:dx]].frac.v2f16
+// SPIR_NATIVE_HALF: %hlsl.frac = call <2 x half> @llvm.[[ICF:spv]].frac.v2f16
// NATIVE_HALF: ret <2 x half> %hlsl.frac
// DXIL_NO_HALF: define noundef <2 x float> @
// SPIR_NO_HALF: define spir_func noundef <2 x float> @
-// DXIL_NO_HALF: %hlsl.frac = call <2 x float> @llvm.dx.frac.v2f32(
-// SPIR_NO_HALF: %hlsl.frac = call <2 x float> @llvm.spv.frac.v2f32(
+// DXIL_NO_HALF: %hlsl.frac = call <2 x float> @llvm.[[ICF:dx]].frac.v2f32(
+// SPIR_NO_HALF: %hlsl.frac = call <2 x float> @llvm.[[ICF:spv]].frac.v2f32(
// NO_HALF: ret <2 x float> %hlsl.frac
half2 test_frac_half2(half2 p0) { return frac(p0); }
// DXIL_NATIVE_HALF: define noundef <3 x half> @
// SPIR_NATIVE_HALF: define spir_func noundef <3 x half> @
-// DXIL_NATIVE_HALF: %hlsl.frac = call <3 x half> @llvm.dx.frac.v3f16
-// SPIR_NATIVE_HALF: %hlsl.frac = call <3 x half> @llvm.spv.frac.v3f16
+// DXIL_NATIVE_HALF: %hlsl.frac = call <3 x half> @llvm.[[ICF:dx]].frac.v3f16
+// SPIR_NATIVE_HALF: %hlsl.frac = call <3 x half> @llvm.[[ICF:spv]].frac.v3f16
// NATIVE_HALF: ret <3 x half> %hlsl.frac
// DXIL_NO_HALF: define noundef <3 x float> @
// SPIR_NO_HALF: define spir_func noundef <3 x float> @
-// DXIL_NO_HALF: %hlsl.frac = call <3 x float> @llvm.dx.frac.v3f32(
-// SPIR_NO_HALF: %hlsl.frac = call <3 x float> @llvm.spv.frac.v3f32(
+// DXIL_NO_HALF: %hlsl.frac = call <3 x float> @llvm.[[ICF:dx]].frac.v3f32(
+// SPIR_NO_HALF: %hlsl.frac = call <3 x float> @llvm.[[ICF:spv]].frac.v3f32(
// NO_HALF: ret <3 x float> %hlsl.frac
half3 test_frac_half3(half3 p0) { return frac(p0); }
// DXIL_NATIVE_HALF: define noundef <4 x half> @
// SPIR_NATIVE_HALF: define spir_func noundef <4 x half> @
-// DXIL_NATIVE_HALF: %hlsl.frac = call <4 x half> @llvm.dx.frac.v4f16
-// SPIR_NATIVE_HALF: %hlsl.frac = call <4 x half> @llvm.spv.frac.v4f16
+// DXIL_NATIVE_HALF: %hlsl.frac = call <4 x half> @llvm.[[ICF:dx]].frac.v4f16
+// SPIR_NATIVE_HALF: %hlsl.frac = call <4 x half> @llvm.[[ICF:spv]].frac.v4f16
// NATIVE_HALF: ret <4 x half> %hlsl.frac
// DXIL_NO_HALF: define noundef <4 x float> @
// SPIR_NO_HALF: define spir_func noundef <4 x float> @
-// DXIL_NO_HALF: %hlsl.frac = call <4 x float> @llvm.dx.frac.v4f32(
-// SPIR_NO_HALF: %hlsl.frac = call <4 x float> @llvm.spv.frac.v4f32(
+// DXIL_NO_HALF: %hlsl.frac = call <4 x float> @llvm.[[ICF:dx]].frac.v4f32(
+// SPIR_NO_HALF: %hlsl.frac = call <4 x float> @llvm.[[ICF:spv]].frac.v4f32(
// NO_HALF: ret <4 x float> %hlsl.frac
half4 test_frac_half4(half4 p0) { return frac(p0); }
// DXIL_CHECK: define noundef float @
// SPIR_CHECK: define spir_func noundef float @
-// DXIL_CHECK: %hlsl.frac = call float @llvm.dx.frac.f32(
-// SPIR_CHECK: %hlsl.frac = call float @llvm.spv.frac.f32(
+// DXIL_CHECK: %hlsl.frac = call float @llvm.[[ICF:dx]].frac.f32(
+// SPIR_CHECK: %hlsl.frac = call float @llvm.[[ICF:spv]].frac.f32(
// CHECK: ret float %hlsl.frac
float test_frac_float(float p0) { return frac(p0); }
// DXIL_CHECK: define noundef <2 x float> @
// SPIR_CHECK: define spir_func noundef <2 x float> @
-// DXIL_CHECK: %hlsl.frac = call <2 x float> @llvm.dx.frac.v2f32
-// SPIR_CHECK: %hlsl.frac = call <2 x float> @llvm.spv.frac.v2f32
+// DXIL_CHECK: %hlsl.frac = call <2 x float> @llvm.[[ICF:dx]].frac.v2f32
+// SPIR_CHECK: %hlsl.frac = call <2 x float> @llvm.[[ICF:spv]].frac.v2f32
// CHECK: ret <2 x float> %hlsl.frac
float2 test_frac_float2(float2 p0) { return frac(p0); }
// DXIL_CHECK: define noundef <3 x float> @
// SPIR_CHECK: define spir_func noundef <3 x float> @
-// DXIL_CHECK: %hlsl.frac = call <3 x float> @llvm.dx.frac.v3f32
-// SPIR_CHECK: %hlsl.frac = call <3 x float> @llvm.spv.frac.v3f32
+// DXIL_CHECK: %hlsl.frac = call <3 x float> @llvm.[[ICF:dx]].frac.v3f32
+// SPIR_CHECK: %hlsl.frac = call <3 x float> @llvm.[[ICF:spv]].frac.v3f32
// CHECK: ret <3 x float> %hlsl.frac
float3 test_frac_float3(float3 p0) { return frac(p0); }
// DXIL_CHECK: define noundef <4 x float> @
// SPIR_CHECK: define spir_func noundef <4 x float> @
-// DXIL_CHECK: %hlsl.frac = call <4 x float> @llvm.dx.frac.v4f32
-// SPIR_CHECK: %hlsl.frac = call <4 x float> @llvm.spv.frac.v4f32
+// DXIL_CHECK: %hlsl.frac = call <4 x float> @llvm.[[ICF:dx]].frac.v4f32
+// SPIR_CHECK: %hlsl.frac = call <4 x float> @llvm.[[ICF:spv]].frac.v4f32
----------------
pow2clk wrote:
This is probably the most illustrative place to point out that the intent was to capture the ICF string which is either "dx" or "spv" depending on the first lines that will use the `[[ICF:dx]]` or `[[ICF:spv]]` notation. After they are captured, the benefit is that we don't have to duplicate all these lines because we can replace two lines with just one like this:
```suggestion
// DXIL_CHECK: %hlsl.frac = call <4 x float> @llvm.[[ICF]].frac.v4f32
```
So after the first two lines, the `ICF:` part of it is unnecessary and just keeps resetting that "variable" to the values and if we continue to have double lines for each of these, it doesn't give us any benefit.
https://github.com/llvm/llvm-project/pull/105930
More information about the cfe-commits
mailing list