[clang] [llvm] [DXIL][SPIRV] Lower WaveActiveCountBits intrinsic (PR #113382)

Greg Roth via cfe-commits cfe-commits at lists.llvm.org
Thu Oct 24 13:09:27 PDT 2024


================
@@ -0,0 +1,22 @@
+// RUN: %clang_cc1 -std=hlsl2021 -finclude-default-header -triple \
+// RUN:   dxil-pc-shadermodel6.3-compute %s -emit-llvm -disable-llvm-passes -o - | \
+// RUN:   FileCheck %s --check-prefixes=CHECK,CHECK-DXIL
+// RUN: %clang_cc1 -std=hlsl2021 -finclude-default-header -triple \
+// RUN:   spirv-pc-vulkan-compute %s -emit-llvm -disable-llvm-passes -o - | \
+// RUN:   FileCheck %s --check-prefixes=CHECK,CHECK-SPIRV
+
+// Test basic lowering to runtime function call.
+
+// CHECK-LABEL: test_bool
+int test_bool(bool expr) {
+  // CHECK-SPIRV: %[[#entry_tok:]] = call token @llvm.experimental.convergence.entry()
+  // CHECK-SPIRV:  %[[RET:.*]] = call spir_func i32 @llvm.spv.wave.active.countbits(i1 %{{.*}}) [ "convergencectrl"(token %[[#entry_tok]]) ]
----------------
pow2clk wrote:

I'm not saying this needs to change, but just in case you're unaware, the CHECK line doesn't have to match every character on that line. Youl could cut it off after the closing paren of `countbits` and match the specificity of the DXIL check and also give the opportunity to create a filecheck define that would be either `dx` or `spv` depending that you could check on the same common check line.

https://github.com/llvm/llvm-project/pull/113382


More information about the cfe-commits mailing list