[AArch64] Don't treat SVE scalable extends as free widening instructions
authorDavid Green <david.green@arm.com>
Wed, 30 Nov 2022 13:09:48 +0000 (13:09 +0000)
committerDavid Green <david.green@arm.com>
Wed, 30 Nov 2022 13:09:48 +0000 (13:09 +0000)
commitf2a92db29eb7519a5eef8792b9c8622aa17e5853
treedb191b81e407984aca7d0bfb686e833a5e6afa99
parent0e6f0b7cc38391f3365a862266a8aef50d093135
[AArch64] Don't treat SVE scalable extends as free widening instructions

The logic in isWideningInstruction handles instructions like uaddw and
smull, where 'add(x, zext(y))' or 'mul(sext(x), sext(y))' can be
converted to single instructions, making the extends free. This doesn't
apply the same to SVE instructions though.
https://godbolt.org/z/695d3nhGd

(There are instructions like SMULLT/B, but they require top/bottom lane
interleaving. That is similar to MVE instructions, which required a
special pass to perform the lane interleaving).

This patch just bails out of the call to isWideningInstruction if the
vector is scalable, getting a more accurate cost.

Differential Revision: https://reviews.llvm.org/D138591
llvm/lib/Target/AArch64/AArch64TargetTransformInfo.cpp
llvm/test/Analysis/CostModel/AArch64/sve-widening-instruction.ll