[PATCH] D32706: [AArch64] Consider widening instructions in cast cost calculation

Matthew Simpson via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed May 3 14:26:12 PDT 2017


mssimpso added a comment.

In https://reviews.llvm.org/D32706#745289, @evandro wrote:

> It shouldn't be assumed that such widening instructions are always free.  Their latency may be longer than the equivalent instruction sequences.  Preferably, the cost of both choices should weighed after consulting the backend.


Hi Evandro,

Thanks for the comment.

We mean "free" in the sense that the extends considered in this patch don't exist in the generated code. They're only there in the IR to make it well-typed (i.e., an IR "add" can't operate on <2 x i32> vectors and produce a <2 x i64> result). This is consistent with the way we use "free" in other places in the cost model, when applied to extends.

If you're suggesting, for example, that an ADD and a UADDL might in theory have different max latencies, I suppose this could be true for some hardware, but in a quick look through the sub-target scheduling models, none of them seem make a distinction that I saw. I think we generally prefer to omit sub-target details from the cost-model unless necessary.

I'm not sure what you mean by "both choices" since there's only once code sequence that is generated. Do you mean that the backed should decide whether to generate, for example, an extend plus ADD vs. UADDL based on cost? I don't think that's something we can do today,


https://reviews.llvm.org/D32706





More information about the llvm-commits mailing list