[all-commits] [llvm/llvm-project] 98727f: [SPIRV] Print split 64-bit OpSwitch operands as a ...

Nick Sarnie via All-commits all-commits at lists.llvm.org
Mon Oct 27 09:04:07 PDT 2025


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 98727f6a8f85481e1772fc73187d9a9274e57ce4
      https://github.com/llvm/llvm-project/commit/98727f6a8f85481e1772fc73187d9a9274e57ce4
  Author: Nick Sarnie <nick.sarnie at intel.com>
  Date:   2025-10-27 (Mon, 27 Oct 2025)

  Changed paths:
    M llvm/lib/Target/SPIRV/MCTargetDesc/SPIRVBaseInfo.h
    M llvm/lib/Target/SPIRV/MCTargetDesc/SPIRVInstPrinter.cpp
    M llvm/lib/Target/SPIRV/SPIRVInstrInfo.h
    M llvm/lib/Target/SPIRV/SPIRVMCInstLower.cpp
    M llvm/lib/Target/SPIRV/SPIRVUtils.cpp
    M llvm/test/CodeGen/SPIRV/branching/OpSwitch64.ll

  Log Message:
  -----------
  [SPIRV] Print split 64-bit OpSwitch operands as a single operand for text output (#164886)

In binary form, 64-bit values are split into two 32-bit values as per
the spec. Naturally this works fine with all tools.

However, the text format does not have a formal specification but
SPIR-V-Tools, which we already rely on in the SPIRV workflow (clang
calls `spirv-as` for example), expects the full 64 bit value, but today
we print the two 32-bit values. causing the tool to error and report
that the format is invalid.

The SPIR-V Translator also prints a single 64-bit value for text format.

This case is already handled specifically for `OpConstant`, but
`OpSwitch` was missed. The SPIR-V translator also has special code in
`OpSwitch` handling for this case.

Recombine the two 32-bit operands into a single 64-bit value to print in
`AsmPrinter`. The actual ASM (aka binary form) emission is unchanged.

---------

Signed-off-by: Sarnie, Nick <nick.sarnie at intel.com>



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list