@@ -461,6 +461,11 @@ Value *VPInstruction::generate(VPTransformState &State) {
461
461
Value *A = State.get (getOperand (0 ));
462
462
return Builder.CreateNot (A, Name);
463
463
}
464
+ case Instruction::ExtractElement: {
465
+ Value *Vec = State.get (getOperand (0 ));
466
+ Value *Idx = State.get (getOperand (1 ), true );
467
+ return Builder.CreateExtractElement (Vec, Idx, Name);
468
+ }
464
469
case Instruction::ICmp: {
465
470
bool OnlyFirstLaneUsed = vputils::onlyFirstLaneUsed (this );
466
471
Value *A = State.get (getOperand (0 ), OnlyFirstLaneUsed);
@@ -705,12 +710,10 @@ Value *VPInstruction::generate(VPTransformState &State) {
705
710
Value *A = State.get (getOperand (0 ));
706
711
return Builder.CreateOrReduce (A);
707
712
}
708
- case VPInstruction::ExtractFirstActive: {
709
- Value *Vec = State.get (getOperand (0 ));
710
- Value *Mask = State.get (getOperand (1 ));
711
- Value *Ctz = Builder.CreateCountTrailingZeroElems (
712
- Builder.getInt64Ty (), Mask, true , " first.active.lane" );
713
- return Builder.CreateExtractElement (Vec, Ctz, " early.exit.value" );
713
+ case VPInstruction::FirstActiveLane: {
714
+ Value *Mask = State.get (getOperand (0 ));
715
+ return Builder.CreateCountTrailingZeroElems (Builder.getInt64Ty (), Mask,
716
+ true , Name);
714
717
}
715
718
default :
716
719
llvm_unreachable (" Unsupported opcode for instruction" );
@@ -753,7 +756,8 @@ InstructionCost VPInstruction::computeCost(ElementCount VF,
753
756
754
757
bool VPInstruction::isVectorToScalar () const {
755
758
return getOpcode () == VPInstruction::ExtractFromEnd ||
756
- getOpcode () == VPInstruction::ExtractFirstActive ||
759
+ getOpcode () == Instruction::ExtractElement ||
760
+ getOpcode () == VPInstruction::FirstActiveLane ||
757
761
getOpcode () == VPInstruction::ComputeReductionResult ||
758
762
getOpcode () == VPInstruction::AnyOf;
759
763
}
@@ -812,13 +816,14 @@ bool VPInstruction::opcodeMayReadOrWriteFromMemory() const {
812
816
if (Instruction::isBinaryOp (getOpcode ()))
813
817
return false ;
814
818
switch (getOpcode ()) {
819
+ case Instruction::ExtractElement:
815
820
case Instruction::ICmp:
816
821
case Instruction::Select:
817
822
case VPInstruction::AnyOf:
818
823
case VPInstruction::CalculateTripCountMinusVF:
819
824
case VPInstruction::CanonicalIVIncrementForPart:
820
825
case VPInstruction::ExtractFromEnd:
821
- case VPInstruction::ExtractFirstActive :
826
+ case VPInstruction::FirstActiveLane :
822
827
case VPInstruction::FirstOrderRecurrenceSplice:
823
828
case VPInstruction::LogicalAnd:
824
829
case VPInstruction::Not:
@@ -927,7 +932,6 @@ void VPInstruction::print(raw_ostream &O, const Twine &Indent,
927
932
case VPInstruction::Broadcast:
928
933
O << " broadcast" ;
929
934
break ;
930
-
931
935
case VPInstruction::ExtractFromEnd:
932
936
O << " extract-from-end" ;
933
937
break ;
@@ -943,8 +947,8 @@ void VPInstruction::print(raw_ostream &O, const Twine &Indent,
943
947
case VPInstruction::AnyOf:
944
948
O << " any-of" ;
945
949
break ;
946
- case VPInstruction::ExtractFirstActive :
947
- O << " extract- first-active" ;
950
+ case VPInstruction::FirstActiveLane :
951
+ O << " first-active-lane " ;
948
952
break ;
949
953
default :
950
954
O << Instruction::getOpcodeName (getOpcode ());
0 commit comments