[llvm] Nvptx port LowerBITCAST to SelectionDAG (PR #120903)
Simon Pilgrim via llvm-commits
llvm-commits at lists.llvm.org
Thu Jan 16 04:48:40 PST 2025
================
@@ -910,6 +910,38 @@ SDValue DAGTypeLegalizer::CreateStackStoreLoad(SDValue Op,
return DAG.getLoad(DestVT, dl, Store, StackPtr, MachinePointerInfo(), Align);
}
+static SDValue MaybeBitcast(SelectionDAG &DAG, SDLoc DL, EVT VT,
+ SDValue Value) {
+ if (Value->getValueType(0) == VT)
+ return Value;
+ return DAG.getNode(ISD::BITCAST, DL, VT, Value);
+}
+
+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) {
+ return SDValue();
+ }
----------------
RKSimon wrote:
Are we gaining anything from having PackBitcastInRegister/UnpackBitcastInRegister vs merging them inside LowerBitcastInRegister?
https://github.com/llvm/llvm-project/pull/120903
More information about the llvm-commits
mailing list