This is an archive of the discontinued LLVM Phabricator instance.

[x86] try to lower multiply i8 with constant to LEA
AbandonedPublic

Authored by spatel on Nov 20 2018, 1:00 PM.

Details

Summary

This is an attempt to avoid regressions seen when D54640 is extended to include add ops, so it's another patch towards solving PR32023:
https://bugs.llvm.org/show_bug.cgi?id=32023

LEA formation is scattered between combines, DAG-to-DAG, and machine passes like "Two-Address instruction pass", so I'm not sure if this is the best solution.

The idea here is to rely on the existing DAG-to-DAG logic for 32-bit LEA formation; no edits needed in there. If this is the right approach, then I'd extend this to handle more constants; 3/5/9 are just the most obvious winners for size/speed regardless of uarch. GCC forms LEA for 8-bit mul much more aggressively.

Diff Detail

Event Timeline

spatel created this revision.Nov 20 2018, 1:00 PM
craig.topper added inline comments.Nov 21 2018, 9:15 AM
lib/Target/X86/X86ISelLowering.cpp
23430

Why ZERO_EXTEND and not ANY_EXTEND?

spatel added inline comments.Nov 21 2018, 9:32 AM
lib/Target/X86/X86ISelLowering.cpp
23430

No reason. I just didn't think of it. I'll change it if we're proceeding here, or better to just push ahead with D54803?

spatel abandoned this revision.Nov 26 2018, 6:39 AM

Abandoning in favor of D54803.