[llvm] Nvptx port LowerBITCAST to SelectionDAG (PR #120903)

Matt Arsenault via llvm-commits llvm-commits at lists.llvm.org
Sun Dec 22 23:07:27 PST 2024


================
@@ -910,6 +910,35 @@ SDValue DAGTypeLegalizer::CreateStackStoreLoad(SDValue Op,
   return DAG.getLoad(DestVT, dl, Store, StackPtr, MachinePointerInfo(), Align);
 }
 
+SDValue DAGTypeLegalizer::LowerBitcast(SDNode *Node) const {
+  assert(Node->getOpcode() == ISD::BITCAST && "Unexpected opcode!");
+  // Handle bitcasting from v2i8 without hitting the default promotion
+  // strategy which goes through stack memory.
+  EVT FromVT = Node->getOperand(0)->getValueType(0);
+  if (FromVT != MVT::v2i8)
----------------
arsenm wrote:

This is too specific of a type check for the generic legalizer. This code should be generalized over the types supported 

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


More information about the llvm-commits mailing list