PowerPC can do store(extract-element) in one instruction. Enable this hook first, and then combiner may explore this kind of opportunities.
Thank you. Implementing this function for PPC makes sense to me.
Should we add an opt test since the function is only called in an IR pass? And maybe also good to show the final assembly change with a llc test. See example when the function was introduced in ARM target https://reviews.llvm.org/D5921.
For the most part, the code produced for vector-promotion.ll is worse as we're forcing the operations into the vector space rather than doing it in scalar registers. Perhaps we should return false from this query if the input vector is the result of a load and the only user is the extract instruction. This would of course require that we change the interface of the query to take the extract instruction rather than the type.
The idea is that if we are loading the vector, extracting an element, performing an operation and then storing, we won't really load the vector but will load only the single element. Promoting the operation will force us to load the vector which is counter productive.
Why an integer type? stxsd[x]/stfiwx/stxsiwx don't really care about whether the input vector is integer or floating point.