[clang] [llvm] [HLSL][DXIL][SPIRV] QuadReadAcrossY intrinsic support (PR #187440)

via cfe-commits cfe-commits at lists.llvm.org
Wed Mar 25 01:49:14 PDT 2026


================
@@ -0,0 +1,46 @@
+// 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_int
+int test_int(int expr) {
+  // CHECK-SPIRV:  %[[RET:.*]] = call spir_func [[TY:.*]] @llvm.spv.quad.read.across.y.i32([[TY]] %[[#]])
+  // CHECK-DXIL:  %[[RET:.*]] = call [[TY:.*]] @llvm.dx.quad.read.across.y.i32([[TY]] %[[#]])
+  // CHECK:  ret [[TY]] %[[RET]]
+  return QuadReadAcrossY(expr);
+}
+
+// CHECK-DXIL: declare [[TY]] @llvm.dx.quad.read.across.y.i32([[TY]]) #[[#attr:]]
+// CHECK-SPIRV: declare [[TY]] @llvm.spv.quad.read.across.y.i32([[TY]]) #[[#attr:]]
----------------
kcloudy0717 wrote:

That's a neat trick! I didn't know about this, thanks for letting me know. I updated the codegen tests for the intrinsic, it now uses the ICF capture (as well as CC capture for spir_func calling convention) and it should have tests for all supported types including 16bit tests as well for the intrinsic. Could you give it a read?

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


More information about the cfe-commits mailing list