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

via llvm-commits llvm-commits at lists.llvm.org
Mon Dec 23 09:03:50 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)
----------------
GrumpyPigSkin wrote:

What other types do you think we should support? Or would this be the preferred method from int->vec and vice versa? ie.
```llvm
<2 x i8>  to i16
<4 x i8>  to i32
<2 x i16> to i32
; etc
``` 
I could see that changing a lot of code though.

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


More information about the llvm-commits mailing list