@@ -446,18 +446,11 @@ bool NVPTXDAGToDAGISel::tryUNPACK_VECTOR(SDNode *N) {
446
446
bool NVPTXDAGToDAGISel::tryEXTRACT_VECTOR_ELEMENT (SDNode *N) {
447
447
SDValue Vector = N->getOperand (0 );
448
448
449
+ // We only care about 16x2 as it's the only real vector type we
450
+ // need to deal with.
449
451
MVT VT = Vector.getSimpleValueType ();
450
- if (!( NVPTX::isPackedVectorTy (VT) && VT. getVectorNumElements () == 2 ))
452
+ if (!Isv2x16VT (VT ))
451
453
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
-
461
454
// Find and record all uses of this vector that extract element 0 or 1.
462
455
SmallVector<SDNode *, 4 > E0 , E1 ;
463
456
for (auto *U : Vector.getNode ()->users ()) {
@@ -481,11 +474,11 @@ bool NVPTXDAGToDAGISel::tryEXTRACT_VECTOR_ELEMENT(SDNode *N) {
481
474
if (E0 .empty () || E1 .empty ())
482
475
return false ;
483
476
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)
486
479
MVT EltVT = VT.getVectorElementType ();
487
480
SDNode *ScatterOp =
488
- CurDAG->getMachineNode (Opcode , SDLoc (N), EltVT, EltVT, Vector);
481
+ CurDAG->getMachineNode (NVPTX::I32toV2I16 , SDLoc (N), EltVT, EltVT, Vector);
489
482
for (auto *Node : E0 )
490
483
ReplaceUses (SDValue (Node, 0 ), SDValue (ScatterOp, 0 ));
491
484
for (auto *Node : E1 )
@@ -1036,7 +1029,6 @@ pickOpcodeForVT(MVT::SimpleValueType VT, std::optional<unsigned> Opcode_i8,
1036
1029
case MVT::i32 :
1037
1030
case MVT::f32 :
1038
1031
return Opcode_i32;
1039
- case MVT::v2f32:
1040
1032
case MVT::i64 :
1041
1033
case MVT::f64 :
1042
1034
return Opcode_i64;
0 commit comments