This is an archive of the discontinued LLVM Phabricator instance.

[X86] Prefer to form negate instructions instead of folding a load
Changes PlannedPublic

Authored by craig.topper on Jun 29 2018, 11:35 AM.

Details

Reviewers
spatel
RKSimon
Summary

Previously when given (sub 0, load), we were prefering to fold the load and materializing the 0 in a register. I think we should instead use negate and do the load as a separate instruction.

Diff Detail

Event Timeline

craig.topper created this revision.Jun 29 2018, 11:35 AM

Have you got any numbers to back this up?

I'll run our benchmark list. This was more of an observation that we were different than icc, gcc, and msvc.

There's a related question. Given the option of promoting a (i16 sub 0, load) to 32-bits, should we promote and use neg+movzwl or keep it as 16-bits so we can fold the load.

craig.topper planned changes to this revision.Jun 29 2018, 2:17 PM