This is an archive of the discontinued LLVM Phabricator instance.

[ARM] Treat cmn immediates as legal in isLegalICmpImmediate.
ClosedPublic

Authored by efriedma on Jul 3 2018, 5:08 PM.

Details

Summary

The original code attempted to do this, but the std::abs() call didn't actually do anything due to implicit type conversions. Fix the type conversions, and perform the correct check for negated immediates.

This probably has very little practical impact, but it's worth fixing just to avoid confusion in the future, I think.

Diff Detail

Repository
rL LLVM

Event Timeline

efriedma created this revision.Jul 3 2018, 5:08 PM
samparker added inline comments.Jul 4 2018, 2:37 AM
lib/Target/ARM/ARMISelLowering.cpp
3861 ↗(On Diff #154023)

I don't understand what this is trying to do, why the special case? Surely the fix in isLegalICmpImmediate is enough?

efriedma added inline comments.Jul 5 2018, 10:47 AM
lib/Target/ARM/ARMISelLowering.cpp
3861 ↗(On Diff #154023)

I probably should have added a comment to this.

The special case for "-1" isn't strictly necessary; it just prefers "cmp r0, #0" over "cmn r0, #1" like the old code does, to reduce the number of regression test changes. Maybe that doesn't matter?

samparker added inline comments.Jul 6 2018, 12:00 AM
lib/Target/ARM/ARMISelLowering.cpp
3861 ↗(On Diff #154023)

It really confused me, so I feel that changing the tests is a necessary chore to make the code easier to understand.

efriedma updated this revision to Diff 154442.Jul 6 2018, 11:31 AM

Remove special-case for -1.

samparker accepted this revision.Jul 10 2018, 2:49 AM

LGTM, thanks.

This revision is now accepted and ready to land.Jul 10 2018, 2:49 AM
This revision was automatically updated to reflect the committed changes.