-
Notifications
You must be signed in to change notification settings - Fork 11.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[clang][HLSL] Update DXIL/SPIRV hybird CodeGen tests to use temp var #105930
Conversation
@llvm/pr-subscribers-hlsl @llvm/pr-subscribers-clang Author: Amr Hesham (AmrDeveloper) ChangesUpdate all hybird DXIL/SPIRV codegen tests to use temp variable representing interchange target Fixes: #105710 Patch is 101.99 KiB, truncated to 20.00 KiB below, full version: https://github.com/llvm/llvm-project/pull/105930.diff 20 Files Affected:
diff --git a/clang/test/CodeGenHLSL/GlobalConstructorFunction.hlsl b/clang/test/CodeGenHLSL/GlobalConstructorFunction.hlsl
index f954c9d2f029f2..6856cccb3fc3eb 100644
--- a/clang/test/CodeGenHLSL/GlobalConstructorFunction.hlsl
+++ b/clang/test/CodeGenHLSL/GlobalConstructorFunction.hlsl
@@ -25,7 +25,7 @@ void main(unsigned GI : SV_GroupIndex) {}
//CHECK-NEXT: entry:
//CHECK-NEXT: call void @"?call_me_first@@YAXXZ"()
//CHECK-NEXT: call void @"?then_call_me@@YAXXZ"()
-//CHECK-NEXT: %0 = call i32 @llvm.dx.flattened.thread.id.in.group()
+//CHECK-NEXT: %0 = call i32 @llvm.[[ICF:dx]].flattened.thread.id.in.group()
//CHECK-NEXT: call void @"?main@@YAXI@Z"(i32 %0)
//CHECK-NEXT: call void @"?call_me_last@@YAXXZ"(
//CHECK-NEXT: ret void
diff --git a/clang/test/CodeGenHLSL/GlobalConstructors.hlsl b/clang/test/CodeGenHLSL/GlobalConstructors.hlsl
index 7e2f288726c954..676a24b2467c18 100644
--- a/clang/test/CodeGenHLSL/GlobalConstructors.hlsl
+++ b/clang/test/CodeGenHLSL/GlobalConstructors.hlsl
@@ -11,6 +11,6 @@ void main(unsigned GI : SV_GroupIndex) {}
//CHECK: define void @main()
//CHECK-NEXT: entry:
//CHECK-NEXT: call void @_GLOBAL__sub_I_GlobalConstructors.hlsl()
-//CHECK-NEXT: %0 = call i32 @llvm.dx.flattened.thread.id.in.group()
+//CHECK-NEXT: %0 = call i32 @llvm.[[ICF:dx]].flattened.thread.id.in.group()
//CHECK-NEXT: call void @"?main@@YAXI@Z"(i32 %0)
//CHECK-NEXT: ret void
diff --git a/clang/test/CodeGenHLSL/GlobalDestructors.hlsl b/clang/test/CodeGenHLSL/GlobalDestructors.hlsl
index 24c3c039fc6192..d98a54bbc49fe8 100644
--- a/clang/test/CodeGenHLSL/GlobalDestructors.hlsl
+++ b/clang/test/CodeGenHLSL/GlobalDestructors.hlsl
@@ -52,7 +52,7 @@ void main(unsigned GI : SV_GroupIndex) {
//CHECK: define void @main()
//CHECK-NEXT: entry:
//CHECK-NEXT: call void @_GLOBAL__sub_I_GlobalDestructors.hlsl()
-//CHECK-NEXT: %0 = call i32 @llvm.dx.flattened.thread.id.in.group()
+//CHECK-NEXT: %0 = call i32 @llvm.[[ICF:dx]].flattened.thread.id.in.group()
//CHECK-NEXT: call void @"?main@@YAXI@Z"(i32 %0)
//CHECK-NEXT: call void @_GLOBAL__D_a()
//CHECK-NEXT: ret void
diff --git a/clang/test/CodeGenHLSL/builtins/RWBuffer-constructor.hlsl b/clang/test/CodeGenHLSL/builtins/RWBuffer-constructor.hlsl
index e51eac7f57c2d3..1a2e9aa490709c 100644
--- a/clang/test/CodeGenHLSL/builtins/RWBuffer-constructor.hlsl
+++ b/clang/test/CodeGenHLSL/builtins/RWBuffer-constructor.hlsl
@@ -1,12 +1,13 @@
-// RUN: %clang_cc1 -triple spirv-vulkan-library -x hlsl -emit-llvm -disable-llvm-passes -o - %s | FileCheck %s --check-prefix=CHECK-SPIRV
+// RUN: %clang_cc1 -triple dxil-pc-shadermodel6.3-library -x hlsl -emit-llvm -disable-llvm-passes -o - %s | FileCheck %s --check-prefixes=DXCHECK
+
+// RUN: %clang_cc1 -triple spirv-vulkan-library -x hlsl -emit-llvm -disable-llvm-passes -o - %s | FileCheck %s --check-prefixes=SPVCHECK
RWBuffer<float> Buf;
// CHECK: define linkonce_odr noundef ptr @"??0?$RWBuffer@M@hlsl@@QAA@XZ"
// CHECK-NEXT: entry:
-// CHECK: %[[HandleRes:[0-9]+]] = call ptr @llvm.dx.create.handle(i8 1)
+// DXCHECK: %[[HandleRes:[0-9]+]] = call ptr @llvm.[[ICF:dx]].create.handle(i8 1)
+// SPVCHECK: %[[HandleRes:[0-9]+]] = call ptr @llvm.[[ICF:spv]].create.handle(i8 1)
// CHECK: store ptr %[[HandleRes]], ptr %h, align 4
-// CHECK-SPIRV: %[[HandleRes:[0-9]+]] = call ptr @llvm.spv.create.handle(i8 1)
-// CHECK-SPIRV: store ptr %[[HandleRes]], ptr %h, align 8
diff --git a/clang/test/CodeGenHLSL/builtins/all.hlsl b/clang/test/CodeGenHLSL/builtins/all.hlsl
index b48daa287480ff..5907584b639b6c 100644
--- a/clang/test/CodeGenHLSL/builtins/all.hlsl
+++ b/clang/test/CodeGenHLSL/builtins/all.hlsl
@@ -16,262 +16,262 @@
#ifdef __HLSL_ENABLE_16_BIT
// DXIL_NATIVE_HALF: define noundef i1 @
// SPIR_NATIVE_HALF: define spir_func noundef i1 @
-// DXIL_NATIVE_HALF: %hlsl.all = call i1 @llvm.dx.all.i16
-// SPIR_NATIVE_HALF: %hlsl.all = call i1 @llvm.spv.all.i16
+// DXIL_NATIVE_HALF: %hlsl.all = call i1 @llvm.[[ICF:dx]].all.i16
+// SPIR_NATIVE_HALF: %hlsl.all = call i1 @llvm.[[ICF:spv]].all.i16
// NATIVE_HALF: ret i1 %hlsl.all
bool test_all_int16_t(int16_t p0) { return all(p0); }
// DXIL_NATIVE_HALF: define noundef i1 @
// SPIR_NATIVE_HALF: define spir_func noundef i1 @
-// DXIL_NATIVE_HALF: %hlsl.all = call i1 @llvm.dx.all.v2i16
-// SPIR_NATIVE_HALF: %hlsl.all = call i1 @llvm.spv.all.v2i16
+// DXIL_NATIVE_HALF: %hlsl.all = call i1 @llvm.[[ICF:dx]].all.v2i16
+// SPIR_NATIVE_HALF: %hlsl.all = call i1 @llvm.[[ICF:spv]].all.v2i16
// NATIVE_HALF: ret i1 %hlsl.all
bool test_all_int16_t2(int16_t2 p0) { return all(p0); }
// DXIL_NATIVE_HALF: define noundef i1 @
// SPIR_NATIVE_HALF: define spir_func noundef i1 @
-// DXIL_NATIVE_HALF: %hlsl.all = call i1 @llvm.dx.all.v3i16
-// SPIR_NATIVE_HALF: %hlsl.all = call i1 @llvm.spv.all.v3i16
+// DXIL_NATIVE_HALF: %hlsl.all = call i1 @llvm.[[ICF:dx]].all.v3i16
+// SPIR_NATIVE_HALF: %hlsl.all = call i1 @llvm.[[ICF:spv]].all.v3i16
// NATIVE_HALF: ret i1 %hlsl.all
bool test_all_int16_t3(int16_t3 p0) { return all(p0); }
// DXIL_NATIVE_HALF: define noundef i1 @
// SPIR_NATIVE_HALF: define spir_func noundef i1 @
-// DXIL_NATIVE_HALF: %hlsl.all = call i1 @llvm.dx.all.v4i16
-// SPIR_NATIVE_HALF: %hlsl.all = call i1 @llvm.spv.all.v4i16
+// DXIL_NATIVE_HALF: %hlsl.all = call i1 @llvm.[[ICF:dx]].all.v4i16
+// SPIR_NATIVE_HALF: %hlsl.all = call i1 @llvm.[[ICF:spv]].all.v4i16
// NATIVE_HALF: ret i1 %hlsl.all
bool test_all_int16_t4(int16_t4 p0) { return all(p0); }
// DXIL_NATIVE_HALF: define noundef i1 @
// SPIR_NATIVE_HALF: define spir_func noundef i1 @
-// DXIL_NATIVE_HALF: %hlsl.all = call i1 @llvm.dx.all.i16
-// SPIR_NATIVE_HALF: %hlsl.all = call i1 @llvm.spv.all.i16
+// DXIL_NATIVE_HALF: %hlsl.all = call i1 @llvm.[[ICF:dx]].all.i16
+// SPIR_NATIVE_HALF: %hlsl.all = call i1 @llvm.[[ICF:spv]].all.i16
// NATIVE_HALF: ret i1 %hlsl.all
bool test_all_uint16_t(uint16_t p0) { return all(p0); }
// DXIL_NATIVE_HALF: define noundef i1 @
// SPIR_NATIVE_HALF: define spir_func noundef i1 @
-// DXIL_NATIVE_HALF: %hlsl.all = call i1 @llvm.dx.all.v2i16
-// SPIR_NATIVE_HALF: %hlsl.all = call i1 @llvm.spv.all.v2i16
+// DXIL_NATIVE_HALF: %hlsl.all = call i1 @llvm.[[ICF:dx]].all.v2i16
+// SPIR_NATIVE_HALF: %hlsl.all = call i1 @llvm.[[ICF:spv]].all.v2i16
// NATIVE_HALF: ret i1 %hlsl.all
bool test_all_uint16_t2(uint16_t2 p0) { return all(p0); }
// DXIL_NATIVE_HALF: define noundef i1 @
// SPIR_NATIVE_HALF: define spir_func noundef i1 @
-// DXIL_NATIVE_HALF: %hlsl.all = call i1 @llvm.dx.all.v3i16
-// SPIR_NATIVE_HALF: %hlsl.all = call i1 @llvm.spv.all.v3i16
+// DXIL_NATIVE_HALF: %hlsl.all = call i1 @llvm.[[ICF:dx]].all.v3i16
+// SPIR_NATIVE_HALF: %hlsl.all = call i1 @llvm.[[ICF:spv]].all.v3i16
// NATIVE_HALF: ret i1 %hlsl.all
bool test_all_uint16_t3(uint16_t3 p0) { return all(p0); }
// DXIL_NATIVE_HALF: define noundef i1 @
// SPIR_NATIVE_HALF: define spir_func noundef i1 @
-// DXIL_NATIVE_HALF: %hlsl.all = call i1 @llvm.dx.all.v4i16
-// SPIR_NATIVE_HALF: %hlsl.all = call i1 @llvm.spv.all.v4i16
+// DXIL_NATIVE_HALF: %hlsl.all = call i1 @llvm.[[ICF:dx]].all.v4i16
+// SPIR_NATIVE_HALF: %hlsl.all = call i1 @llvm.[[ICF:spv]].all.v4i16
// NATIVE_HALF: ret i1 %hlsl.all
bool test_all_uint16_t4(uint16_t4 p0) { return all(p0); }
#endif // __HLSL_ENABLE_16_BIT
// DXIL_CHECK: define noundef i1 @
// SPIR_CHECK: define spir_func noundef i1 @
-// DXIL_NATIVE_HALF: %hlsl.all = call i1 @llvm.dx.all.f16
-// SPIR_NATIVE_HALF: %hlsl.all = call i1 @llvm.spv.all.f16
-// DXIL_NO_HALF: %hlsl.all = call i1 @llvm.dx.all.f32
-// SPIR_NO_HALF: %hlsl.all = call i1 @llvm.spv.all.f32
+// DXIL_NATIVE_HALF: %hlsl.all = call i1 @llvm.[[ICF:dx]].all.f16
+// SPIR_NATIVE_HALF: %hlsl.all = call i1 @llvm.[[ICF:spv]].all.f16
+// DXIL_NO_HALF: %hlsl.all = call i1 @llvm.[[ICF:dx]].all.f32
+// SPIR_NO_HALF: %hlsl.all = call i1 @llvm.[[ICF:spv]].all.f32
// CHECK: ret i1 %hlsl.all
bool test_all_half(half p0) { return all(p0); }
// DXIL_CHECK: define noundef i1 @
// SPIR_CHECK: define spir_func noundef i1 @
-// DXIL_NATIVE_HALF: %hlsl.all = call i1 @llvm.dx.all.v2f16
-// SPIR_NATIVE_HALF: %hlsl.all = call i1 @llvm.spv.all.v2f16
-// DXIL_NO_HALF: %hlsl.all = call i1 @llvm.dx.all.v2f32
-// SPIR_NO_HALF: %hlsl.all = call i1 @llvm.spv.all.v2f32
+// DXIL_NATIVE_HALF: %hlsl.all = call i1 @llvm.[[ICF:dx]].all.v2f16
+// SPIR_NATIVE_HALF: %hlsl.all = call i1 @llvm.[[ICF:spv]].all.v2f16
+// DXIL_NO_HALF: %hlsl.all = call i1 @llvm.[[ICF:dx]].all.v2f32
+// SPIR_NO_HALF: %hlsl.all = call i1 @llvm.[[ICF:spv]].all.v2f32
// CHECK: ret i1 %hlsl.all
bool test_all_half2(half2 p0) { return all(p0); }
// DXIL_CHECK: define noundef i1 @
// SPIR_CHECK: define spir_func noundef i1 @
-// DXIL_NATIVE_HALF: %hlsl.all = call i1 @llvm.dx.all.v3f16
-// SPIR_NATIVE_HALF: %hlsl.all = call i1 @llvm.spv.all.v3f16
-// DXIL_NO_HALF: %hlsl.all = call i1 @llvm.dx.all.v3f32
-// SPIR_NO_HALF: %hlsl.all = call i1 @llvm.spv.all.v3f32
+// DXIL_NATIVE_HALF: %hlsl.all = call i1 @llvm.[[ICF:dx]].all.v3f16
+// SPIR_NATIVE_HALF: %hlsl.all = call i1 @llvm.[[ICF:spv]].all.v3f16
+// DXIL_NO_HALF: %hlsl.all = call i1 @llvm.[[ICF:dx]].all.v3f32
+// SPIR_NO_HALF: %hlsl.all = call i1 @llvm.[[ICF:spv]].all.v3f32
// CHECK: ret i1 %hlsl.all
bool test_all_half3(half3 p0) { return all(p0); }
// DXIL_CHECK: define noundef i1 @
// SPIR_CHECK: define spir_func noundef i1 @
-// DXIL_NATIVE_HALF: %hlsl.all = call i1 @llvm.dx.all.v4f16
-// SPIR_NATIVE_HALF: %hlsl.all = call i1 @llvm.spv.all.v4f16
-// DXIL_NO_HALF: %hlsl.all = call i1 @llvm.dx.all.v4f32
-// SPIR_NO_HALF: %hlsl.all = call i1 @llvm.spv.all.v4f32
+// DXIL_NATIVE_HALF: %hlsl.all = call i1 @llvm.[[ICF:dx]].all.v4f16
+// SPIR_NATIVE_HALF: %hlsl.all = call i1 @llvm.[[ICF:spv]].all.v4f16
+// DXIL_NO_HALF: %hlsl.all = call i1 @llvm.[[ICF:dx]].all.v4f32
+// SPIR_NO_HALF: %hlsl.all = call i1 @llvm.[[ICF:spv]].all.v4f32
// CHECK: ret i1 %hlsl.all
bool test_all_half4(half4 p0) { return all(p0); }
// DXIL_CHECK: define noundef i1 @
// SPIR_CHECK: define spir_func noundef i1 @
-// DXIL_CHECK: %hlsl.all = call i1 @llvm.dx.all.f32
-// SPIR_CHECK: %hlsl.all = call i1 @llvm.spv.all.f32
+// DXIL_CHECK: %hlsl.all = call i1 @llvm.[[ICF:dx]].all.f32
+// SPIR_CHECK: %hlsl.all = call i1 @llvm.[[ICF:spv]].all.f32
// CHECK: ret i1 %hlsl.all
bool test_all_float(float p0) { return all(p0); }
// DXIL_CHECK: define noundef i1 @
// SPIR_CHECK: define spir_func noundef i1 @
-// DXIL_CHECK: %hlsl.all = call i1 @llvm.dx.all.v2f32
-// SPIR_CHECK: %hlsl.all = call i1 @llvm.spv.all.v2f32
+// DXIL_CHECK: %hlsl.all = call i1 @llvm.[[ICF:dx]].all.v2f32
+// SPIR_CHECK: %hlsl.all = call i1 @llvm.[[ICF:spv]].all.v2f32
// CHECK: ret i1 %hlsl.all
bool test_all_float2(float2 p0) { return all(p0); }
// DXIL_CHECK: define noundef i1 @
// SPIR_CHECK: define spir_func noundef i1 @
-// DXIL_CHECK: %hlsl.all = call i1 @llvm.dx.all.v3f32
-// SPIR_CHECK: %hlsl.all = call i1 @llvm.spv.all.v3f32
+// DXIL_CHECK: %hlsl.all = call i1 @llvm.[[ICF:dx]].all.v3f32
+// SPIR_CHECK: %hlsl.all = call i1 @llvm.[[ICF:spv]].all.v3f32
// CHECK: ret i1 %hlsl.all
bool test_all_float3(float3 p0) { return all(p0); }
// DXIL_CHECK: define noundef i1 @
// SPIR_CHECK: define spir_func noundef i1 @
-// DXIL_CHECK: %hlsl.all = call i1 @llvm.dx.all.v4f32
-// SPIR_CHECK: %hlsl.all = call i1 @llvm.spv.all.v4f32
+// DXIL_CHECK: %hlsl.all = call i1 @llvm.[[ICF:dx]].all.v4f32
+// SPIR_CHECK: %hlsl.all = call i1 @llvm.[[ICF:spv]].all.v4f32
// CHECK: ret i1 %hlsl.all
bool test_all_float4(float4 p0) { return all(p0); }
// DXIL_CHECK: define noundef i1 @
// SPIR_CHECK: define spir_func noundef i1 @
-// DXIL_CHECK: %hlsl.all = call i1 @llvm.dx.all.f64
-// SPIR_CHECK: %hlsl.all = call i1 @llvm.spv.all.f64
+// DXIL_CHECK: %hlsl.all = call i1 @llvm.[[ICF:dx]].all.f64
+// SPIR_CHECK: %hlsl.all = call i1 @llvm.[[ICF:spv]].all.f64
// CHECK: ret i1 %hlsl.all
bool test_all_double(double p0) { return all(p0); }
// DXIL_CHECK: define noundef i1 @
// SPIR_CHECK: define spir_func noundef i1 @
-// DXIL_CHECK: %hlsl.all = call i1 @llvm.dx.all.v2f64
-// SPIR_CHECK: %hlsl.all = call i1 @llvm.spv.all.v2f64
+// DXIL_CHECK: %hlsl.all = call i1 @llvm.[[ICF:dx]].all.v2f64
+// SPIR_CHECK: %hlsl.all = call i1 @llvm.[[ICF:spv]].all.v2f64
// CHECK: ret i1 %hlsl.all
bool test_all_double2(double2 p0) { return all(p0); }
// DXIL_CHECK: define noundef i1 @
// SPIR_CHECK: define spir_func noundef i1 @
-// DXIL_CHECK: %hlsl.all = call i1 @llvm.dx.all.v3f64
-// SPIR_CHECK: %hlsl.all = call i1 @llvm.spv.all.v3f64
+// DXIL_CHECK: %hlsl.all = call i1 @llvm.[[ICF:dx]].all.v3f64
+// SPIR_CHECK: %hlsl.all = call i1 @llvm.[[ICF:spv]].all.v3f64
// CHECK: ret i1 %hlsl.all
bool test_all_double3(double3 p0) { return all(p0); }
// DXIL_CHECK: define noundef i1 @
// SPIR_CHECK: define spir_func noundef i1 @
-// DXIL_CHECK: %hlsl.all = call i1 @llvm.dx.all.v4f64
-// SPIR_CHECK: %hlsl.all = call i1 @llvm.spv.all.v4f64
+// DXIL_CHECK: %hlsl.all = call i1 @llvm.[[ICF:dx]].all.v4f64
+// SPIR_CHECK: %hlsl.all = call i1 @llvm.[[ICF:spv]].all.v4f64
// CHECK: ret i1 %hlsl.all
bool test_all_double4(double4 p0) { return all(p0); }
// DXIL_CHECK: define noundef i1 @
// SPIR_CHECK: define spir_func noundef i1 @
-// DXIL_CHECK: %hlsl.all = call i1 @llvm.dx.all.i32
-// SPIR_CHECK: %hlsl.all = call i1 @llvm.spv.all.i32
+// DXIL_CHECK: %hlsl.all = call i1 @llvm.[[ICF:dx]].all.i32
+// SPIR_CHECK: %hlsl.all = call i1 @llvm.[[ICF:spv]].all.i32
// CHECK: ret i1 %hlsl.all
bool test_all_int(int p0) { return all(p0); }
// DXIL_CHECK: define noundef i1 @
// SPIR_CHECK: define spir_func noundef i1 @
-// DXIL_CHECK: %hlsl.all = call i1 @llvm.dx.all.v2i32
-// SPIR_CHECK: %hlsl.all = call i1 @llvm.spv.all.v2i32
+// DXIL_CHECK: %hlsl.all = call i1 @llvm.[[ICF:dx]].all.v2i32
+// SPIR_CHECK: %hlsl.all = call i1 @llvm.[[ICF:spv]].all.v2i32
// CHECK: ret i1 %hlsl.all
bool test_all_int2(int2 p0) { return all(p0); }
// DXIL_CHECK: define noundef i1 @
// SPIR_CHECK: define spir_func noundef i1 @
-// DXIL_CHECK: %hlsl.all = call i1 @llvm.dx.all.v3i32
-// SPIR_CHECK: %hlsl.all = call i1 @llvm.spv.all.v3i32
+// DXIL_CHECK: %hlsl.all = call i1 @llvm.[[ICF:dx]].all.v3i32
+// SPIR_CHECK: %hlsl.all = call i1 @llvm.[[ICF:spv]].all.v3i32
// CHECK: ret i1 %hlsl.all
bool test_all_int3(int3 p0) { return all(p0); }
// DXIL_CHECK: define noundef i1 @
// SPIR_CHECK: define spir_func noundef i1 @
-// DXIL_CHECK: %hlsl.all = call i1 @llvm.dx.all.v4i32
-// SPIR_CHECK: %hlsl.all = call i1 @llvm.spv.all.v4i32
+// DXIL_CHECK: %hlsl.all = call i1 @llvm.[[ICF:dx]].all.v4i32
+// SPIR_CHECK: %hlsl.all = call i1 @llvm.[[ICF:spv]].all.v4i32
// CHECK: ret i1 %hlsl.all
bool test_all_int4(int4 p0) { return all(p0); }
// DXIL_CHECK: define noundef i1 @
// SPIR_CHECK: define spir_func noundef i1 @
-// DXIL_CHECK: %hlsl.all = call i1 @llvm.dx.all.i32
-// SPIR_CHECK: %hlsl.all = call i1 @llvm.spv.all.i32
+// DXIL_CHECK: %hlsl.all = call i1 @llvm.[[ICF:dx]].all.i32
+// SPIR_CHECK: %hlsl.all = call i1 @llvm.[[ICF:spv]].all.i32
// CHECK: ret i1 %hlsl.all
bool test_all_uint(uint p0) { return all(p0); }
// DXIL_CHECK: define noundef i1 @
// SPIR_CHECK: define spir_func noundef i1 @
-// DXIL_CHECK: %hlsl.all = call i1 @llvm.dx.all.v2i32
-// SPIR_CHECK: %hlsl.all = call i1 @llvm.spv.all.v2i32
+// DXIL_CHECK: %hlsl.all = call i1 @llvm.[[ICF:dx]].all.v2i32
+// SPIR_CHECK: %hlsl.all = call i1 @llvm.[[ICF:spv]].all.v2i32
// CHECK: ret i1 %hlsl.all
bool test_all_uint2(uint2 p0) { return all(p0); }
// DXIL_CHECK: define noundef i1 @
// SPIR_CHECK: define spir_func noundef i1 @
-// DXIL_CHECK: %hlsl.all = call i1 @llvm.dx.all.v3i32
-// SPIR_CHECK: %hlsl.all = call i1 @llvm.spv.all.v3i32
+// DXIL_CHECK: %hlsl.all = call i1 @llvm.[[ICF:dx]].all.v3i32
+// SPIR_CHECK: %hlsl.all = call i1 @llvm.[[ICF:spv]].all.v3i32
// CHECK: ret i1 %hlsl.all
bool test_all_uint3(uint3 p0) { return all(p0); }
// DXIL_CHECK: define noundef i1 @
// SPIR_CHECK: define spir_func noundef i1 @
-// DXIL_CHECK: %hlsl.all = call i1 @llvm.dx.all.v4i32
-// SPIR_CHECK: %hlsl.all = call i1 @llvm.spv.all.v4i32
+// DXIL_CHECK: %hlsl.all = call i1 @llvm.[[ICF:dx]].all.v4i32
+// SPIR_CHECK: %hlsl.all = call i1 @llvm.[[ICF:spv]].all.v4i32
// CHECK: ret i1 %hlsl.all
bool test_all_uint4(uint4 p0) { return all(p0); }
// DXIL_CHECK: define noundef i1 @
// SPIR_CHECK: define spir_func noundef i1 @
-// DXIL_CHECK: %hlsl.all = call i1 @llvm.dx.all.i64
-// SPIR_CHECK: %hlsl.all = call i1 @llvm.spv.all.i64
+// DXIL_CHECK: %hlsl.all = call i1 @llvm.[[ICF:dx]].all.i64
+// SPIR_CHECK: %hlsl.all = call i1 @llvm.[[ICF:spv]].all.i64
// CHECK: ret i1 %hlsl.all
bool test_all_int64_t(int64_t p0) { return all(p0); }
// DXIL_CHECK: define noundef i1 @
// SPIR_CHECK: define spir_func noundef i1 @
-// DXIL_CHECK: %hlsl.all = call i1 @llvm.dx.all.v2i64
-// SPIR_CHECK: %hlsl.all = call i1 @llvm.spv.all.v2i64
+// DXIL_CHECK: %hlsl.all = call i1 @llvm.[[ICF:dx]].all.v2i64
+// SPIR_CHECK: %hlsl.all = call i1 @llvm.[[ICF:spv]].all.v2i64
// CHECK: ret i1 %hlsl.all
bool test_all_int64_t2(int64_t2 p0) { return all(p0); }
// DXIL_CHECK: define noundef i1 @
// SPIR_CHECK: define spir_func noundef i1 @
-// DXIL_CHECK: %hlsl.all = call i1 @llvm.dx.all.v3i64
-// SPIR_CHECK: %hlsl.all = call i1 @llvm.spv.all.v3i64
+// DXIL_CHECK: %hlsl.all = call i1 @llvm.[[ICF:dx]].all.v3i64
+// SPIR_CHECK: %hlsl.all = call i1 @llvm.[[ICF:spv]].all.v3i64
// CHECK: ret i1 %hlsl.all
bool test_all_int64_t3(int64_t3 p0) { return all(p0); }
// DXIL_CHECK: define noundef i1 @
// SPIR_CHECK: define spir_func noundef i1 @
-// DXIL_CHECK: %hlsl.all = call i1 @llvm.dx.all.v4i64
-// SPIR_CHECK: %hlsl.all = call i1 @llvm.spv.all.v4i64
+// DXIL_CHECK: %hlsl.all = call i1 @llvm.[[ICF:dx]].all.v4i64
+// SPIR_CHECK: %hlsl.all = call i1 @llvm.[[ICF:spv]].all.v4i64
// CHECK: ret i1 %hlsl.all
bool test_all_int64_t4(int64_t4 p0) { return all(p0); }
// DXIL_CHECK: define noundef i1 @
// SPIR_CHECK: define spir_func noundef i1 @
-// DXIL_CHECK: %hlsl.all = call i1 @llvm.dx.all.i64
-// SPIR_CHECK: %hlsl.all = call i1 @llvm.spv.all.i64
+// DXIL_CHECK: %hlsl.all = call i1 @llvm.[[ICF:dx]].all.i64
+// SPIR_CHECK: %hlsl.all = call i1 @llvm.[[ICF:spv]].all.i64
// CHECK: ret i1 %hlsl.all
bool test_all_uint64_t(uint64_t p0) { return all(p0); }
// DXIL_CHECK: define noundef i1 @
// SPIR_CHECK: define spir_func noundef i1 @
-// DXIL_CHECK: %hlsl.all = call i1 @llvm.dx.all.v2i64
-// SPIR_CHECK: %hlsl.all = call i1 @llvm.spv.all.v2i64
+// DXIL_CHECK: %hlsl.all = call i1 @llvm.[[ICF:dx]].all.v2i64
+// SPIR_CHECK: %hlsl.all = call i1 @llvm.[[ICF:spv]].all.v2i64
// CHECK: ret i1 %hlsl.all
bool test_all_uint64_t2(uint64_t2 p0) { return all(p0); }
// DXIL_CHECK: define noundef i1 @
// SPIR_CHECK: define spir_func noundef i1 @
-// DXIL_CHECK: %hlsl.all = call i1 @llvm.dx.all.v3i64
-// SPIR_CHECK: %hlsl.all = call i1 @llvm.spv.all.v3i64
+// DXIL_CHECK: %hlsl.all = call i1 @llvm.[[ICF:dx]].all.v3i64
+// SPIR_CHECK: %hlsl.all = call i1 @llvm.[[ICF:spv]].all.v3i64
// CHECK: ret i1 %hlsl.all
bool test_all_uint64_t3(uint64_t3 p0) { return all(p0); }
// DXIL_CHECK: define noundef i1 @
// SPIR_CHECK: define spir_func noundef i1 @
-// DXIL_CHECK: %hlsl.all = call i1 @llvm.dx.all.v4i64
-// SPIR_CHECK: %hlsl.all = call i1 @llvm.spv.all.v4i64
+// DXIL_CHECK: %hlsl.all = call i1 @llvm.[[ICF:dx]].all.v4i64
+// SPIR_CHECK: %hlsl.all = call i1 @llvm.[[ICF:spv]].all.v4i64
// CHECK: ret i1 %hlsl.all
bool test_all_uint64_t4(uint64_t4 p0) { return all(p0); }
// DXIL_CHECK: define noundef i1 @
// SPIR_CHECK: define spir_func noundef i1 @
-// DXIL_CHECK: %hlsl.all = call i1 @llvm.dx.all.i1
-// SPIR_CHECK: %hlsl.all = call i1 @llvm.spv.all.i1
+// DXIL_CHECK: %hlsl.all = call i1 @llvm.[[ICF:dx]].all.i1
+// SPIR_CHECK: %hlsl.all = call i1 @llvm.[[ICF:spv]].all.i1
// CHECK: ret i1 %hlsl.all
bool test_all_bool(bool p0) { return all(p0); }
// DXIL_CHECK: define noundef i1 @
// SPIR_CHECK: define spir_func noundef i1 @
-// DXIL_CHECK: %hlsl.all = call i1 @llvm.dx.all.v2i1
-// SPIR_CHECK: %hlsl.all = call i1 @llvm.spv.all.v2i1
+// DXIL_CHECK: %hlsl.all = call i1 @llvm.[[ICF:dx]].all.v2i1
+// SPIR_CHECK: %hlsl.all = call i1 @llvm.[[ICF:spv]].all.v2i1
// CHECK: ret i1 %hlsl.all
bool test_all_bool2(bool2 p0) { return all(p0); }
// DXIL_CHECK: define noundef i1 @
// SPIR_CHECK: define spir_func noundef i1 @
-// DXIL_CHECK: %hl...
[truncated]
|
6f7b394
to
4568aab
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @AmrDeveloper ! Really appreciate your initiative to take this on!
I think it might be helpful to use this excellent documentation resource https://github.com/llvm/llvm-project/blob/main/llvm/docs/CommandGuide/FileCheck.rst#filecheck-string-substitution-blocks
// 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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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:
// 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 | |
// 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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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: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.
Yes you are right, thank you
@@ -25,7 +25,7 @@ void main(unsigned GI : SV_GroupIndex) {} | |||
//CHECK-NEXT: entry: | |||
//CHECK-NEXT: call void @"?call_me_first@@YAXXZ"() | |||
//CHECK-NEXT: call void @"?then_call_me@@YAXXZ"() | |||
//CHECK-NEXT: %0 = call i32 @llvm.dx.flattened.thread.id.in.group() | |||
//CHECK-NEXT: %0 = call i32 @llvm.[[ICF:dx]].flattened.thread.id.in.group() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can skip tests like this that don't yet have a SPIRV run line. That is, if there's no -triple spirv-*
in a RUN:
line at the top, you can skip the test for now.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you done
f161a06
to
4520735
Compare
// RUN: %clang_cc1 -triple spirv-vulkan-library -x hlsl -emit-llvm -disable-llvm-passes -o - %s | FileCheck %s --check-prefix=CHECK-SPIRV | ||
// RUN: %clang_cc1 -triple dxil-pc-shadermodel6.3-library -x hlsl -emit-llvm -disable-llvm-passes -o - %s | FileCheck %s --check-prefixes=DXCHECK | ||
|
||
// RUN: %clang_cc1 -triple spirv-vulkan-library -x hlsl -emit-llvm -disable-llvm-passes -o - %s | FileCheck %s --check-prefixes=SPVCHECK |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note that these --check-prefixes
don't include "CHECK", so none of the "CHECK:" lines here are executed at all. This may also imply that this test is broken before your change.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes it broken now when i include CHECK in the prefixes, so i will keep it as it is maybe for other pr
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
// DXIL_NATIVE_HALF: %hlsl.all = call i1 @llvm.dx.all.i16 | ||
// SPIR_NATIVE_HALF: %hlsl.all = call i1 @llvm.spv.all.i16 | ||
// DXIL_NATIVE_HALF: %hlsl.all = call i1 @llvm.[[ICF:dx]].all.i16 | ||
// SPIR_NATIVE_HALF: %hlsl.all = call i1 @llvm.[[ICF:spv]].all.i16 | ||
// NATIVE_HALF: ret i1 %hlsl.all | ||
bool test_all_int16_t(int16_t p0) { return all(p0); } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can simplify this test significantly more by passing in the expected prefixes on the FileCheck command line via -D
. Consider, if we invoked FileCheck in the following four ways:
FileCheck %s --check-prefixes=CHECK,CHECK-HALF -DFNATTRS="spir_func noundef" -DTARGET=spv
FileCheck %s --check-prefixes=CHECK,CHECK-NOHALF -DFNATTRS="spir_func noundef" -DTARGET=spv
FileCheck %s --check-prefixes=CHECK,CHECK-HALF -DFNATTRS=noundef -DTARGET=dx
FileCheck %s --check-prefixes=CHECK,CHECK-NOHALF -DFNATTRS=noundef -DTARGET=dx
Then the integer checks inside the __HLSL_ENABLE_16_BIT
ifdef would simpy be
// CHECK-HALF: define [[FNATTRS]] i1 @
// CHECK-HALF: %hlsl.all = call i1 @llvm.[[TARGET]].all.i16
// CHECK-HALF: ret i1 %hlsl.all
where the type of the all.XYZ
is the only thing that needs to change, and the later f16 checks would similarly be
// CHECK: define [[FNATTRS]] i1 @
// CHECK-HALF: %hlsl.all = call i1 @llvm.[[TARGET]].all.f16
// CHECK-NOHALF: %hlsl.all = call i1 @llvm.[[TARGET]].all.f32
// CHECK: ret i1 %hlsl.all
with the same caveat.
Finally, the checks that don't depend on 16 bit types would simply be
// CHECK: define [[FNATTRS]] i1 @
// CHECK: %hlsl.all = call i1 @llvm.[[TARGET]].all.XYZ
// CHECK: ret i1 %hlsl.all
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thats a lot better i did that for all.hlsl tests and will check other files
Thank you
1bcddd6
to
f2e483e
Compare
// DXIL_CHECK: %hlsl.normalize = call <2 x float> @llvm.[[TARGET]].normalize.v2f32( | ||
// SPIR_CHECK: %hlsl.normalize = call <2 x float> @llvm.[[TARGET]].normalize.v2f32(<2 x float> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@bogner, is there is a way to use CHECK with those lines because SPIR has extra (<2 x float>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Check the output by running the clang -cc1
commands manually. I would expect both the DXIL and SPIR variants to have <2 x float>
as the type of the first argument here, so there shouldn't be a need to differ.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great, i updated it
Thank you
6ae18c6
to
ff7bbba
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great, thanks! Do you need someone to commit this for you?
@@ -15,49 +15,49 @@ | |||
// RUN: -o - | FileCheck %s --check-prefixes=CHECK,NO_HALF,SPIR_CHECK | |||
|
|||
#ifdef __HLSL_ENABLE_16_BIT | |||
// DXIL_NATIVE_HALF: %dx.umad = call i16 @llvm.dx.umad.i16(i16 %0, i16 %1, i16 %2) | |||
// DXIL_NATIVE_HALF: %dx.umad = call i16 @llvm.[[ICF:dx]].umad.i16(i16 %0, i16 %1, i16 %2) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think capturing the "dx" in a variable really helps in this one since it doesn't actually allow us to combine any checks. Let's just leave this test as is.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
Update all hybird DXIL/SPIRV codegen tests to use temp variable representing interchange target
ff7bbba
to
67beeaf
Compare
Yes please, i don't have commit access yet :D |
…lvm#105930) Update all hybird DXIL/SPIRV codegen tests to use temp variable representing interchange target Fixes: llvm#105710
Update all hybird DXIL/SPIRV codegen tests to use temp variable representing interchange target
Fixes: #105710