[llvm] [SPIRV] Add 64 bit lowering for bitreverse (PR #193068)

Dmitry Sidorov via llvm-commits llvm-commits at lists.llvm.org
Mon Apr 27 05:46:36 PDT 2026


================
@@ -3576,6 +3579,53 @@ bool SPIRVInstructionSelector::handle64BitOverflow(
                           SPIRV::OpCompositeConstruct);
 }
 
+bool SPIRVInstructionSelector::selectBitreverse64(Register ResVReg,
+                                                  SPIRVTypeInst ResType,
+                                                  MachineInstr &I,
+                                                  Register SrcReg) const {
+  unsigned ComponentCount = GR.getScalarOrVectorComponentCount(ResType);
+  if (ComponentCount > 2)
+    return handle64BitOverflow(
+        ResVReg, ResType, I, SrcReg, SPIRV::OpBitReverse,
+        [this](Register R, SPIRVTypeInst T, MachineInstr &I, Register S,
+               unsigned O) { return this->selectBitreverse64(R, T, I, S); });
+
+  MachineIRBuilder MIRBuilder(I);
+
+  // ---- Types ----
----------------
MrSidims wrote:

@joaosaffran I believe my request of keeping pre-existing in the file comment style was not addressed. Before https://github.com/joaosaffran/llvm-project/commit/bfa4de2fb858f493471aba68b8e2b9bb030f10e4 there were no comments like `// ---- Stage N ----`.

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


More information about the llvm-commits mailing list