diff --git a/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp b/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp --- a/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp +++ b/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp @@ -4368,7 +4368,7 @@ Base = SDB->getValue(C); - unsigned NumElts = cast(Ptr->getType())->getNumElements(); + ElementCount NumElts = cast(Ptr->getType())->getElementCount(); EVT VT = EVT::getVectorVT(*DAG.getContext(), TLI.getPointerTy(DL), NumElts); Index = DAG.getConstant(0, SDB->getCurSDLoc(), VT); IndexType = ISD::SIGNED_SCALED; diff --git a/llvm/test/CodeGen/AArch64/sve-masked-scatter.ll b/llvm/test/CodeGen/AArch64/sve-masked-scatter.ll --- a/llvm/test/CodeGen/AArch64/sve-masked-scatter.ll +++ b/llvm/test/CodeGen/AArch64/sve-masked-scatter.ll @@ -73,6 +73,30 @@ ret void } +define i32 @masked_scatter_nxv4i32_nxvp0i32 () { +; CHECK-LABEL: masked_scatter_nxv4i32_nxvp0i32: +; CHECK: // %bb.0: // %vector.ph +; CHECK-NEXT: ptrue p0.s +; CHECK-NEXT: mov z0.d, #0 // =0x0 +; CHECK-NEXT: .LBB8_1: // %vector.body +; CHECK-NEXT: // =>This Inner Loop Header: Depth=1 +; CHECK-NEXT: pfalse p1.b +; CHECK-NEXT: zip1 p2.s, p0.s, p1.s +; CHECK-NEXT: zip2 p1.s, p0.s, p1.s +; CHECK-NEXT: st1w { z0.d }, p2, [x8, z0.d, lsl #2] +; CHECK-NEXT: st1w { z0.d }, p1, [x8, z0.d, lsl #2] +; CHECK-NEXT: b .LBB8_1 +vector.ph: + br label %vector.body + +vector.body: ; preds = %vector.body, %vector.ph + call void @llvm.masked.scatter.nxv4i32.nxv4p0i32( undef, + shufflevector ( insertelement ( poison, i32* undef, i32 0), poison, zeroinitializer), + i32 4, + shufflevector ( insertelement ( undef, i1 true, i32 0), undef, zeroinitializer)) + br label %vector.body +} + declare void @llvm.masked.scatter.nxv2f16(, , i32, ) declare void @llvm.masked.scatter.nxv2bf16(, , i32, ) declare void @llvm.masked.scatter.nxv2f32(, , i32, ) @@ -81,4 +105,5 @@ declare void @llvm.masked.scatter.nxv2i32(, , i32, ) declare void @llvm.masked.scatter.nxv2i64(, , i32, ) declare void @llvm.masked.scatter.nxv2i8(, , i32, ) +declare void @llvm.masked.scatter.nxv4i32.nxv4p0i32(, , i32, ) attributes #0 = { "target-features"="+sve,+bf16" }