@@ -446,18 +446,11 @@ bool NVPTXDAGToDAGISel::tryUNPACK_VECTOR(SDNode *N) {
446446bool NVPTXDAGToDAGISel::tryEXTRACT_VECTOR_ELEMENT (SDNode *N) {
447447 SDValue Vector = N->getOperand (0 );
448448
449+ // We only care about 16x2 as it's the only real vector type we
450+ // need to deal with.
449451 MVT VT = Vector.getSimpleValueType ();
450- if (!( NVPTX::isPackedVectorTy (VT) && VT. getVectorNumElements () == 2 ))
452+ if (!Isv2x16VT (VT ))
451453 return false ;
452-
453- unsigned Opcode;
454- if (VT.is32BitVector ())
455- Opcode = NVPTX::I32toV2I16;
456- else if (VT.is64BitVector ())
457- Opcode = NVPTX::I64toV2I32;
458- else
459- llvm_unreachable (" Unhandled packed type" );
460-
461454 // Find and record all uses of this vector that extract element 0 or 1.
462455 SmallVector<SDNode *, 4 > E0 , E1 ;
463456 for (auto *U : Vector.getNode ()->users ()) {
@@ -481,11 +474,11 @@ bool NVPTXDAGToDAGISel::tryEXTRACT_VECTOR_ELEMENT(SDNode *N) {
481474 if (E0 .empty () || E1 .empty ())
482475 return false ;
483476
484- // Merge (EltTy extractelt(V, 0), EltTy extractelt(V,1))
485- // into EltTy,EltTy Split[EltTy]x2 (V)
477+ // Merge (f16 extractelt(V, 0), f16 extractelt(V,1))
478+ // into f16,f16 SplitF16x2 (V)
486479 MVT EltVT = VT.getVectorElementType ();
487480 SDNode *ScatterOp =
488- CurDAG->getMachineNode (Opcode , SDLoc (N), EltVT, EltVT, Vector);
481+ CurDAG->getMachineNode (NVPTX::I32toV2I16 , SDLoc (N), EltVT, EltVT, Vector);
489482 for (auto *Node : E0 )
490483 ReplaceUses (SDValue (Node, 0 ), SDValue (ScatterOp, 0 ));
491484 for (auto *Node : E1 )
@@ -1036,7 +1029,6 @@ pickOpcodeForVT(MVT::SimpleValueType VT, std::optional<unsigned> Opcode_i8,
10361029 case MVT::i32 :
10371030 case MVT::f32 :
10381031 return Opcode_i32;
1039- case MVT::v2f32:
10401032 case MVT::i64 :
10411033 case MVT::f64 :
10421034 return Opcode_i64;
0 commit comments