diff --git a/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp b/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp index 529f3c6fd8e2..54e460f9349c 100644 --- a/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp +++ b/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp @@ -6602,7 +6602,7 @@ void SelectionDAGBuilder::visitIntrinsicCall(const CallInst &I, EVT OverflowVT = MVT::i1; if (ResultVT.isVector()) OverflowVT = EVT::getVectorVT( - *Context, OverflowVT, ResultVT.getVectorNumElements()); + *Context, OverflowVT, ResultVT.getVectorElementCount()); SDVTList VTs = DAG.getVTList(ResultVT, OverflowVT); setValue(&I, DAG.getNode(Op, sdl, VTs, Op1, Op2)); diff --git a/llvm/test/CodeGen/RISCV/rvv/saddo-sdnode.ll b/llvm/test/CodeGen/RISCV/rvv/saddo-sdnode.ll new file mode 100644 index 000000000000..11c4cbf42cc2 --- /dev/null +++ b/llvm/test/CodeGen/RISCV/rvv/saddo-sdnode.ll @@ -0,0 +1,23 @@ +; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py +; RUN: llc -mtriple=riscv64 -mattr=+experimental-v -verify-machineinstrs < %s | FileCheck %s + +declare { , } @llvm.sadd.with.overflow.nxv2i32(, ) + +define @saddo_nvx2i32( %x, %y) { +; CHECK-LABEL: saddo_nvx2i32: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli a0, zero, e32,m1,ta,mu +; CHECK-NEXT: vmslt.vx v25, v17, zero +; CHECK-NEXT: vadd.vv v26, v16, v17 +; CHECK-NEXT: vmslt.vv v27, v26, v16 +; CHECK-NEXT: vsetvli a0, zero, e8,mf4,ta,mu +; CHECK-NEXT: vmxor.mm v0, v25, v27 +; CHECK-NEXT: vsetvli a0, zero, e32,m1,ta,mu +; CHECK-NEXT: vmerge.vim v16, v26, 0, v0 +; CHECK-NEXT: ret + %a = call { , } @llvm.sadd.with.overflow.nxv2i32( %x, %y) + %b = extractvalue { , } %a, 0 + %c = extractvalue { , } %a, 1 + %d = select %c, zeroinitializer, %b + ret %d +}