[llvm] [SPIRV] Add support for `cl_khr_extended_bit_ops` (PR #120571)
Dmitry Sidorov via llvm-commits
llvm-commits at lists.llvm.org
Thu Jan 9 07:10:09 PST 2025
================
@@ -983,6 +983,37 @@ static bool buildBarrierInst(const SPIRV::IncomingCall *Call, unsigned Opcode,
return true;
}
+/// Helper function for building extended bit operations.
+static bool buildExtendedBitOpsInst(const SPIRV::IncomingCall *Call,
+ unsigned Opcode,
+ MachineIRBuilder &MIRBuilder,
+ SPIRVGlobalRegistry *GR) {
+ const SPIRV::DemangledBuiltin *Builtin = Call->Builtin;
+ const auto *ST =
+ static_cast<const SPIRVSubtarget *>(&MIRBuilder.getMF().getSubtarget());
+ if ((Opcode == SPIRV::OpBitFieldInsert ||
+ Opcode == SPIRV::OpBitFieldSExtract ||
+ Opcode == SPIRV::OpBitFieldUExtract || Opcode == SPIRV::OpBitReverse) &&
+ !ST->canUseExtension(SPIRV::Extension::SPV_KHR_bit_instructions)) {
+ std::string DiagMsg = std::string(Builtin->Name) +
+ ": the builtin requires the following SPIR-V "
+ "extension: SPV_KHR_bit_instructions";
+ report_fatal_error(DiagMsg.c_str(), false);
----------------
MrSidims wrote:
And for scenarios 1 and 2 I don't expect **Shader** capability to appear.
https://github.com/llvm/llvm-project/pull/120571
More information about the llvm-commits
mailing list