Depends on D102498
I've added a recommendation that I believe will also simplify D102777.
Although correct can I recommend a different approach. Rather than "any_extending" the scalable value you should be able to actually ISD::ANY_EXTEND the fixed length operand directly. This simplifies the lowering and means the any_extend->uunplo transform is kept in one place. The flow can be something like:
src = bit cast(src_as_int, src) src = any_extend(dst_as_int, src) src = convertToScalable(src) src = svesafecast(src) src = fpextend(src)
The legaliser will then transform the any_extend separately.
Although this is more direct, if you wanted to loose the line wrapping you can use changeTypeToInteger().
As above, by doing an actual ISD::TRUNCATE of the fixed length result you get to reuse the existing mechanism to lower fixed length truncates. I'm thinking:
Val = convertFromScalableVector(DAG, SrcVT.changeTypeToInteger(), Val); Val = DAG.getNode(ISD::TRUNCATE, DL, VT.changeTypeToInteger(), Val); return DAG.getNode(ISD::BITCAST, DL, VT, Val);
This change looks unnecessary.
This can be SrcVT, which when combined with the next comment means ContainerSrcVT is no longer required.
I'm surprised this works as ContainerSrcVT and Val have different element types? Either way it seems safer to use ContainerDstVT.changeTypeToInteger().
This can be VT, which means ContainerDstVT is no longer needed.
In general for the fixed length arith tests we've added VBITS_EQ_256 CHECK lines to the 512bit tests, just to show sensible type legalisation (see sve-fixed-length-fp-reduce.ll).