Index: llvm/lib/Target/AArch64/AArch64TargetTransformInfo.cpp =================================================================== --- llvm/lib/Target/AArch64/AArch64TargetTransformInfo.cpp +++ llvm/lib/Target/AArch64/AArch64TargetTransformInfo.cpp @@ -1563,8 +1563,11 @@ }; // Exit early if DstTy is not a vector type whose elements are at least - // 16-bits wide. - if (!DstTy->isVectorTy() || DstTy->getScalarSizeInBits() < 16) + // 16-bits wide. SVE doesn't generally have the same set of instructions to + // perform an extend with the add/sub/mul. There are SMULLB style + // instructions, but they operate on top/bottom, requiring some sort of lane + // interleaving to be used with zext/sext. + if (!useNeonVector(DstTy) || DstTy->getScalarSizeInBits() < 16) return false; // Determine if the operation has a widening variant. We consider both the Index: llvm/test/Analysis/CostModel/AArch64/sve-widening-instruction.ll =================================================================== --- llvm/test/Analysis/CostModel/AArch64/sve-widening-instruction.ll +++ llvm/test/Analysis/CostModel/AArch64/sve-widening-instruction.ll @@ -20,8 +20,8 @@ define @widening_nxv8i16( %in1, %in2) { ; CHECK-LABEL: 'widening_nxv8i16' -; CHECK-NEXT: Cost Model: Found an estimated cost of 0 for instruction: %in1.ext = zext %in2 to -; CHECK-NEXT: Cost Model: Found an estimated cost of 0 for instruction: %in2.ext = zext %in2 to +; CHECK-NEXT: Cost Model: Found an estimated cost of 3 for instruction: %in1.ext = zext %in2 to +; CHECK-NEXT: Cost Model: Found an estimated cost of 3 for instruction: %in2.ext = zext %in2 to ; CHECK-NEXT: Cost Model: Found an estimated cost of 2 for instruction: %in.add = add %in1.ext, %in2.ext ; CHECK-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret %in.add ; @@ -33,8 +33,8 @@ define <8 x i32> @widening_v8i16_svevl2(<8 x i16> %in1, <8 x i16> %in2) vscale_range(2,16) { ; CHECK-LABEL: 'widening_v8i16_svevl2' -; CHECK-NEXT: Cost Model: Found an estimated cost of 0 for instruction: %in1.ext = zext <8 x i16> %in2 to <8 x i32> -; CHECK-NEXT: Cost Model: Found an estimated cost of 0 for instruction: %in2.ext = zext <8 x i16> %in2 to <8 x i32> +; CHECK-NEXT: Cost Model: Found an estimated cost of 2 for instruction: %in1.ext = zext <8 x i16> %in2 to <8 x i32> +; CHECK-NEXT: Cost Model: Found an estimated cost of 2 for instruction: %in2.ext = zext <8 x i16> %in2 to <8 x i32> ; CHECK-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %in.add = add <8 x i32> %in1.ext, %in2.ext ; CHECK-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret <8 x i32> %in.add ;