Skip to content

Conversation

@tcorringham
Copy link
Contributor

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

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 llvm#166965
@llvmbot
Copy link
Member

llvmbot commented Nov 7, 2025

@llvm/pr-subscribers-backend-spir-v

Author: Tim Corringham (tcorringham)

Changes

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 --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 +} + 
@tcorringham tcorringham merged commit be84705 into llvm:main Nov 10, 2025
13 checks passed
@tcorringham tcorringham deleted the unpackhalf2x16 branch November 10, 2025 13:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

2 participants