[llvm] [HLSL][SPIRV] Add error test for unpackhalf2x16 (PR #166969)
via llvm-commits
llvm-commits at lists.llvm.org
Fri Nov 7 09:29:35 PST 2025
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-backend-spir-v
Author: Tim Corringham (tcorringham)
<details>
<summary>Changes</summary>
Add an error test to check that a suitable error diagnostic is generated for the use of the GL::unpackhalf2x16 operation in
invalid contexts.
Fixes #<!-- -->166965
---
Full diff: https://github.com/llvm/llvm-project/pull/166969.diff
1 Files Affected:
- (added) llvm/test/CodeGen/SPIRV/opencl/unpackhalf2x16-error.ll (+11)
``````````diff
diff --git a/llvm/test/CodeGen/SPIRV/opencl/unpackhalf2x16-error.ll b/llvm/test/CodeGen/SPIRV/opencl/unpackhalf2x16-error.ll
new file mode 100644
index 0000000000000..1d3ba2a38e55b
--- /dev/null
+++ b/llvm/test/CodeGen/SPIRV/opencl/unpackhalf2x16-error.ll
@@ -0,0 +1,11 @@
+; RUN: not llc -verify-machineinstrs -O0 -mtriple=spirv64-unknown-unknown %s -o /dev/null 2>&1 | FileCheck %s
+; RUN: not llc -verify-machineinstrs -O0 -mtriple=spirv32-unknown-unknown %s -o /dev/null 2>&1 | FileCheck %s
+
+; CHECK: LLVM ERROR: %5:vfid(<2 x s64>) = nnan ninf nsz arcp afn reassoc G_INTRINSIC intrinsic(@llvm.spv.unpackhalf2x16), %0:iid(s64) is only supported with the GLSL extended instruction set.
+
+define hidden spir_func noundef nofpclass(nan inf) float @_Z9test_funcj(i32 noundef %0) local_unnamed_addr #0 {
+ %2 = tail call reassoc nnan ninf nsz arcp afn <2 x float> @llvm.spv.unpackhalf2x16.v2f32(i32 %0)
+ %3 = extractelement <2 x float> %2, i64 0
+ ret float %3
+}
+
``````````
</details>
https://github.com/llvm/llvm-project/pull/166969
More information about the llvm-commits
mailing list