[llvm] [TTI] Include scalarization overhead for icmp/fcmp result (PR #206697)
David Green via llvm-commits
llvm-commits at lists.llvm.org
Thu Jul 23 02:29:59 PDT 2026
https://github.com/davemgreen commented:
Hmm. Hello. First up I don't think the exact values is too far off for a lot for the tests that are changing on Arm / AArch64. They intended to say "highish" in the past and they still say "highish", especially for i64 vectors on MVE. So I'm not super against.
But this seems to say that if you have a scalarized cmp, the select using it will _not_ be scalarized too. The first test that is changing is a llvm.fshl.v2i128, where you would expect both the select and the cmp to scalarize at the same time for i128 types. There then would not be a cost needed to pack the i1 elements into a vector.
We tend to use the fallback costs for a lot of types that are not specifically handled, that the target doesn't have legal types for, and a lot of those (like i128) will be scalarized for both operations. I think I would expect the default cost model to take that as the default.
The connection between cmp and select in llvm has never been great, as v2i1 doesn't tell you anything about the types that will actually use (v2bf16 vs v2i32 vs v2i128 etc). And the types on the cmp and select can always be different, leading to an adjustment of the mask that isn't always accounted for.
https://github.com/llvm/llvm-project/pull/206697
More information about the llvm-commits
mailing list