Previously if we had a bitcast vector output type that needs promotion and a vector input type that needs widening we would just do a stack store and load to handle the conversion. We can do a little better if we can widen the bitcast to a legal vector type the same size as the widened input type. Then we can do the bitcast between this widened type and the widened input type. Afterwards we can extract_subvector back to the original output and any_extend that. Type legalization will then circle back and handle promotion of the extract_subvector and the any_extend will just be removed. This will avoid going through the stack and allows us to remove a custom version of this legalization from X86.
Details
Details
Diff Detail
Diff Detail
Event Timeline
Comment Actions
I'd like to see more test coverage for this, I think. If I'm following correctly, this should affect something like the following on AArch64?
define <2 x i16> @foo(<2 x half> %x) { %y = bitcast <2 x half> %x to <2 x i16> ret <2 x i16> %y }
lib/CodeGen/SelectionDAG/LegalizeIntegerTypes.cpp | ||
---|---|---|
326 | Should we just generate an ANY_EXTEND_VECTOR_INREG directly here? |
Comment Actions
Add a test case for AArch64. I wasn't sure what file to put it in so I made a new file and put the diff of the old vs new code here.
lib/CodeGen/SelectionDAG/LegalizeIntegerTypes.cpp | ||
---|---|---|
326 | I don't think I can. I don't have any guarantee of vectors of the same size here. |
Comment Actions
LGTM
lib/CodeGen/SelectionDAG/LegalizeIntegerTypes.cpp | ||
---|---|---|
326 | Oh, good point. It looks like they are in the cases you've shown, but maybe not in general. |
Should we just generate an ANY_EXTEND_VECTOR_INREG directly here?