This is an archive of the discontinued LLVM Phabricator instance.

[X86] LowerTRUNCATE - improve handling during type legalization to PACKSS/PACKUS patterns
ClosedPublic

Authored by RKSimon on Jul 6 2023, 3:33 AM.

Details

Summary

Extend coverage for lowering wide vector types during type legalization to allow us to use PACKSS/PACKUS patterns instead of dropping down to shuffle lowering.

First step towards avoiding premature folds of TRUNCATE to PACKSS/PACKUS nodes as described on Issue #63710 - which causes a large number of regressions on D152928 - we will next need to tweak the TRUNCATE widening in ReplaceNodeResults

Diff Detail

Event Timeline

RKSimon created this revision.Jul 6 2023, 3:33 AM
Herald added a project: Restricted Project. · View Herald TranscriptJul 6 2023, 3:33 AM
Herald added a subscriber: hiraditya. · View Herald Transcript
RKSimon requested review of this revision.Jul 6 2023, 3:33 AM
Herald added a project: Restricted Project. · View Herald TranscriptJul 6 2023, 3:33 AM

any comments/thoughts?

pengfei accepted this revision.Jul 11 2023, 1:39 AM

LGTM.

llvm/lib/Target/X86/X86ISelLowering.cpp
1242

Why no v2i64 and v4i64?

llvm/test/CodeGen/X86/cast-vsel.ll
322

This seems a little worse that addps?

This revision is now accepted and ready to land.Jul 11 2023, 1:39 AM

Thanks @pengfei

llvm/lib/Target/X86/X86ISelLowering.cpp
1242

This tends to affect legal destination types or ones that are widened (via ReplaceNodeResults etc.) - so will need to be addressed in the next patch.

llvm/test/CodeGen/X86/cast-vsel.ll
322

Yes, I'll see if I can clean this up in a followup - its strange that xmm4 is being shifted but xmm3 still uses the and - I'd expect both to have been affected in the same manner.

This revision was landed with ongoing or failed builds.Jul 11 2023, 2:39 AM
This revision was automatically updated to reflect the committed changes.