[llvm] [SPARC] Use hardware byteswapper when we have V9 (PR #191720)

Sergei Barannikov via llvm-commits llvm-commits at lists.llvm.org
Tue Apr 14 05:45:45 PDT 2026


================
@@ -3001,6 +3004,37 @@ static SDValue LowerF128Load(SDValue Op, SelectionDAG &DAG)
   return DAG.getMergeValues(Ops, dl);
 }
 
+SDValue SparcTargetLowering::LowerBSWAP(SDValue Op, SelectionDAG &DAG) const {
+  // We don't have an in-register bswap, so expand bswap(x) into
+  // load(store-swapped(x)). The reason the swap is done during the store is
+  // that on some implementations (mainly older ones) ASI-tagged memory
+  // operations are not pipelined, and generally stores finish faster than
+  // loads.
+
+  MachineFunction &MF = DAG.getMachineFunction();
+  MachineFrameInfo &MFI = MF.getFrameInfo();
+  auto PtrVT = getPointerTy(DAG.getDataLayout());
----------------
s-barannikov wrote:

(style) Avoid `auto`

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


More information about the llvm-commits mailing list