diff --git a/llvm/lib/Target/AArch64/AArch64ISelLowering.cpp b/llvm/lib/Target/AArch64/AArch64ISelLowering.cpp --- a/llvm/lib/Target/AArch64/AArch64ISelLowering.cpp +++ b/llvm/lib/Target/AArch64/AArch64ISelLowering.cpp @@ -15985,7 +15985,9 @@ if (DCI.isBeforeLegalizeOps() && Value.getOpcode() == ISD::FP_ROUND && Value.getNode()->hasOneUse() && ST->isUnindexed() && Subtarget->useSVEForFixedLengthVectors() && - Value.getValueType().isFixedLengthVector()) + Value.getValueType().isFixedLengthVector() && + Value.getValueType().getFixedSizeInBits() > + Subtarget->getMinSVEVectorSizeInBits()) return DAG.getTruncStore(Chain, SDLoc(N), Value.getOperand(0), Ptr, ST->getMemoryVT(), ST->getMemOperand()); @@ -17346,7 +17348,8 @@ // they can be split down into something legal. if (DCI.isBeforeLegalizeOps() && ISD::isNormalLoad(N0.getNode()) && N0.hasOneUse() && Subtarget->useSVEForFixedLengthVectors() && - VT.isFixedLengthVector()) { + VT.isFixedLengthVector() && + VT.getFixedSizeInBits() > Subtarget->getMinSVEVectorSizeInBits()) { LoadSDNode *LN0 = cast(N0); SDValue ExtLoad = DAG.getExtLoad(ISD::EXTLOAD, SDLoc(N), VT, LN0->getChain(), LN0->getBasePtr(), diff --git a/llvm/test/CodeGen/AArch64/sve-fpext-load.ll b/llvm/test/CodeGen/AArch64/sve-fpext-load.ll --- a/llvm/test/CodeGen/AArch64/sve-fpext-load.ll +++ b/llvm/test/CodeGen/AArch64/sve-fpext-load.ll @@ -83,3 +83,15 @@ %load.ext = fpext %load to ret %load.ext } + +; Fixed length vector regression test. +define <2 x double> @ext_v2f32_v2f64(<2 x float>* %ptr) { +; CHECK-LABEL: ext_v2f32_v2f64: +; CHECK: // %bb.0: +; CHECK-NEXT: ldr d0, [x0] +; CHECK-NEXT: fcvtl v0.2d, v0.2s +; CHECK-NEXT: ret + %load = load <2 x float>, <2 x float>* %ptr + %load.ext = fpext <2 x float> %load to <2 x double> + ret <2 x double> %load.ext +} diff --git a/llvm/test/CodeGen/AArch64/sve-fptrunc-store.ll b/llvm/test/CodeGen/AArch64/sve-fptrunc-store.ll --- a/llvm/test/CodeGen/AArch64/sve-fptrunc-store.ll +++ b/llvm/test/CodeGen/AArch64/sve-fptrunc-store.ll @@ -85,3 +85,16 @@ store %1, * %dst, align 2 ret void } + +; Fixed length vector regression test. +define void @fptrunc_v2f64_v2f32(<2 x double> %val, <2 x float>* %ptr) { +; CHECK-LABEL: fptrunc_v2f64_v2f32: +; CHECK: // %bb.0: // %entry +; CHECK-NEXT: fcvtn v0.2s, v0.2d +; CHECK-NEXT: str d0, [x0] +; CHECK-NEXT: ret +entry: + %trunc = fptrunc <2 x double> %val to <2 x float> + store <2 x float> %trunc, <2 x float>* %ptr + ret void +}