diff --git a/llvm/lib/CodeGen/SelectionDAG/LegalizeVectorTypes.cpp b/llvm/lib/CodeGen/SelectionDAG/LegalizeVectorTypes.cpp --- a/llvm/lib/CodeGen/SelectionDAG/LegalizeVectorTypes.cpp +++ b/llvm/lib/CodeGen/SelectionDAG/LegalizeVectorTypes.cpp @@ -5627,7 +5627,6 @@ EVT VT = N->getValueType(0); EVT EltVT = VT.getVectorElementType(); SDLoc dl(N); - unsigned NumElts = VT.getVectorNumElements(); SDValue InOp = N->getOperand(N->isStrictFPOpcode() ? 1 : 0); assert(getTypeAction(InOp.getValueType()) == TargetLowering::TypeWidenVector && @@ -5639,7 +5638,7 @@ // See if a widened result type would be legal, if so widen the node. // FIXME: This isn't safe for StrictFP. Other optimization here is needed. EVT WideVT = EVT::getVectorVT(*DAG.getContext(), EltVT, - InVT.getVectorNumElements()); + InVT.getVectorElementCount()); if (TLI.isTypeLegal(WideVT) && !N->isStrictFPOpcode()) { SDValue Res; if (N->isStrictFPOpcode()) { @@ -5665,6 +5664,7 @@ EVT InEltVT = InVT.getVectorElementType(); // Unroll the convert into some scalar code and create a nasty build vector. + unsigned NumElts = VT.getVectorNumElements(); SmallVector Ops(NumElts); if (N->isStrictFPOpcode()) { SmallVector NewOps(N->op_begin(), N->op_end()); @@ -6055,7 +6055,7 @@ // The result type is legal, if its vXi1, keep vXi1 for the new SETCC. if (VT.getScalarType() == MVT::i1) SVT = EVT::getVectorVT(*DAG.getContext(), MVT::i1, - SVT.getVectorNumElements()); + SVT.getVectorElementCount()); SDValue WideSETCC = DAG.getNode(ISD::SETCC, SDLoc(N), SVT, InOp0, InOp1, N->getOperand(2)); @@ -6063,7 +6063,7 @@ // Extract the needed results from the result vector. EVT ResVT = EVT::getVectorVT(*DAG.getContext(), SVT.getVectorElementType(), - VT.getVectorNumElements()); + VT.getVectorElementCount()); SDValue CC = DAG.getNode(ISD::EXTRACT_SUBVECTOR, dl, ResVT, WideSETCC, DAG.getVectorIdxConstant(0, dl)); diff --git a/llvm/test/CodeGen/AArch64/sve-intrinsics-int-compares.ll b/llvm/test/CodeGen/AArch64/sve-intrinsics-int-compares.ll --- a/llvm/test/CodeGen/AArch64/sve-intrinsics-int-compares.ll +++ b/llvm/test/CodeGen/AArch64/sve-intrinsics-int-compares.ll @@ -1035,6 +1035,16 @@ ret %out } +define @cmpne_ir_q( %a, %b) { +; CHECK-LABEL: cmpne_ir_q: +; CHECK: ptrue p0.d +; CHECK-NEXT: cmpne p0.d, p0/z, z0.d, z1.d +; CHECK-NEXT: punpklo p0.h, p0.b +; CHECK-NEXT: ret + %out = icmp ne %a, %b + ret %out +} + define @cmpgt_wide_splat_b( %pg, %a, i64 %b) { ; CHECK-LABEL: cmpgt_wide_splat_b: diff --git a/llvm/test/CodeGen/AArch64/sve-trunc.ll b/llvm/test/CodeGen/AArch64/sve-trunc.ll --- a/llvm/test/CodeGen/AArch64/sve-trunc.ll +++ b/llvm/test/CodeGen/AArch64/sve-trunc.ll @@ -187,6 +187,19 @@ ret %out } +define @trunc_nxv1i32_to_nxv1i1( %in) { +; CHECK-LABEL: trunc_nxv1i32_to_nxv1i1: +; CHECK: // %bb.0: +; CHECK-NEXT: ptrue p0.s +; CHECK-NEXT: and z0.s, z0.s, #0x1 +; CHECK-NEXT: cmpne p0.s, p0/z, z0.s, #0 +; CHECK-NEXT: punpklo p0.h, p0.b +; CHECK-NEXT: punpklo p0.h, p0.b +; CHECK-NEXT: ret + %out = trunc %in to + ret %out +} + define void @trunc_promoteIntRes( %0, i16* %ptr) { ; CHECK-LABEL: trunc_promoteIntRes: ; CHECK: // %bb.0: // %entry