This is an archive of the discontinued LLVM Phabricator instance.

[X86] Move splat addends from the gather/scatter index operand to the base address
ClosedPublic

Authored by pengfei on Oct 11 2021, 6:32 PM.

Details

Summary

This can avoid a vector add and a constant pool load. Or an explicit broadcast in case of non-constant.

Also reverse the transform any time we encounter a constant index addend that can't be moved to base. In that case pull the constant from base into the index. This reduces code size needed for the displacement since we needed the index add anyway. Limit this to scale of 1 to avoid divisibility and wrap issues.

Authored by Craig.

Diff Detail

Event Timeline

pengfei created this revision.Oct 11 2021, 6:32 PM
pengfei requested review of this revision.Oct 11 2021, 6:32 PM
Herald added a project: Restricted Project. · View Herald TranscriptOct 11 2021, 6:32 PM
craig.topper added inline comments.Oct 13 2021, 9:33 AM
llvm/lib/Target/X86/X86ISelDAGToDAG.cpp
2503

Please run clang-format

2526

"gather scatter" -> "gather/scatter" or "gather or scatter"

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

Drop the comma after possible.

"case case" -> "case,"

pengfei updated this revision to Diff 379569.Oct 13 2021, 5:40 PM
pengfei marked 3 inline comments as done.

Address review comments. Thanks Craig.

This revision is now accepted and ready to land.Oct 25 2021, 8:40 PM