This is an archive of the discontinued LLVM Phabricator instance.

[X86] Disable combineToExtendVectorInReg under -x86-experimental-vector-widening-legalization. Add custom type legalization for extends.
ClosedPublic

Authored by craig.topper on Nov 13 2018, 12:38 AM.

Details

Summary

If we widen illegal types instead of promoting, we should be able to rely on the type legalizer to create the vector_inreg operations for us with some caveats.

This patch disables combineToExtendVectorInReg when we are using widening.

I've enabled custom legalization for v8i8->v8i64 extends under avx512f since the type legalizer would want to create a vector_inreg with a v64i8 input type which isn't legal without avx512bw. So we go to v16i8 with custom code using the relaxation of rules we get from D54346.

I've also enable custom legalization of v8i64 and v16i32 operations with with AVX. When the input type is 128 bits, the default splitting legalization would extend first 128->256, then do the a split to two 128 pieces. Extend each half to 256 and then concat the result. The custom legalization I've added instead uses a 128->256 bit vector_inreg extend that only reads the lower 64-bits for the low half of the split. Then shuffles the high 64-bits to the low 64-bits and does another vector_inreg extend.

Diff Detail

Event Timeline

craig.topper created this revision.Nov 13 2018, 12:38 AM
craig.topper added inline comments.Nov 13 2018, 12:41 AM
test/CodeGen/X86/vec_int_to_fp-widen.ll
5446

We split the load here instead of doing loading and shuffling. I think I know what the issue is and will fix in a follow up.

RKSimon added inline comments.Nov 15 2018, 10:59 AM
lib/Target/X86/X86ISelLowering.cpp
26213

Use is128BitVector() ?

26229

NumElts / 2

26230

Use SM_SentinelUndef instead of -1

26235

Worth using getExtendInVec ?

Address review comments

RKSimon accepted this revision.Nov 18 2018, 5:27 AM

LGTM with one minor and the followup fix for aggregate_sitofp_8i16_to_8f32

lib/Target/X86/X86ISelLowering.cpp
26213

Move the assert directly after EVT VT.

This revision is now accepted and ready to land.Nov 18 2018, 5:27 AM
craig.topper closed this revision.Nov 18 2018, 8:38 PM

Committed in r347172