Current custom lowering of truncate vector handles a source of up to 128 bits, but that only uses one of the two shuffle vector operands. Extend it to use both operands to handle 256 bit sources.
- Group Reviewers
- rGb6d7ed469f2f: [PowerPC] Extend custom lower of vector truncate to handle wider input
I believe DAG.getTargetLoweringInfo() is just *this so we should be able to just call getVectorIdxTy() unqualified.
Isn't SplitVT just SrcVT.getHalfNumVectorElementsVT(*DAG.getContext())?
Seems that all of the definitions here can just be something like:
EVT VecIdxTy = getVectorIdxTy(DAG.getDataLayout()); EVT SplitVT = N1.getValueType().getHalfNumVectorElementsVT(*DAG.getContext()); unsigned SplitNumElts = SplitVT.getVectorNumElements();
We check that the number of elements in the wide input is a power of 2 as well as that the target element type width is a power of 2.
Please add a check that shows how we produced v3. Presumably this is a shift from v2?
Other than a couple of minor nits, LGTM. I am so sorry about the delay in reviewing this.
I realize that we don't need to bitcast Op1 here because it already gets bitcasted below. But I think it is one of those things that a reader looking at this code thinks "Huh? How come only one is bitcasted?" (until they get to the bottom of the function).
So my minor nit here would be to just do both bicasts at the same point below unconditionally. Bitcasting to the same type should not produce a new node.
It's bizarre that the script put the checks inside the signature of the function.