[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 06:50:27 PST 2025


================
@@ -1441,6 +1442,16 @@ defm : DemangledNativeBuiltin<"__spirv_SatConvertSToU", OpenCL_std, Convert, 1,
 defm : DemangledNativeBuiltin<"__spirv_SatConvertUToS", OpenCL_std, Convert, 1, 1, OpSatConvertUToS>;
 defm : DemangledNativeBuiltin<"__spirv_ConvertUToPtr", OpenCL_std, Convert, 1, 1, OpConvertUToPtr>;
 
+// cl_khr_extended_bit_ops / SPV_KHR_bit_instructions
+defm : DemangledNativeBuiltin<"bitfield_insert", OpenCL_std, ExtendedBitOps, 4, 4, OpBitFieldInsert>;
+defm : DemangledNativeBuiltin<"__spirv_BitFieldInsert", OpenCL_std, ExtendedBitOps, 4, 4, OpBitFieldInsert>;
----------------
MrSidims wrote:

Is SPIR-V friendly naming tested anywhere? This PR doesn't add them and on my machine grep doesn't show any tests:
```
LLVM/llvm-project/llvm$ grep -rn BitFieldInsert
lib/CodeGen/GlobalISel/LegalizerHelper.cpp:3665:static Register buildBitFieldInsert(MachineIRBuilder &B,
lib/CodeGen/GlobalISel/LegalizerHelper.cpp:3739:    Register InsertedElt = buildBitFieldInsert(MIRBuilder, ExtractedElt,
lib/Target/SPIRV/SPIRVModuleAnalysis.cpp:1243:  case SPIRV::OpBitFieldInsert:
lib/Target/SPIRV/SPIRVInstrInfo.td:547:def OpBitFieldInsert: Op<201, (outs ID:$res),
lib/Target/SPIRV/SPIRVInstrInfo.td:549:                  "$res = OpBitFieldInsert $ty $base $insert $offset $count">;
```


https://github.com/llvm/llvm-project/pull/120571


More information about the llvm-commits mailing list