[llvm] [SPIRV] Add support for `cl_khr_extended_bit_ops` (PR #120571)
Michal Paszkowski via llvm-commits
llvm-commits at lists.llvm.org
Thu Dec 19 07:45:07 PST 2024
================
@@ -983,6 +983,38 @@ 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) +
----------------
michalpaszkowski wrote:
Might be a good idea to add a single sentence to [SPIRVUsage](https://github.com/llvm/llvm-project/blob/main/llvm/docs/SPIRVUsage.rst) document, that the extension enables these builtins.
https://github.com/llvm/llvm-project/pull/120571
More information about the llvm-commits
mailing list