This is an archive of the discontinued LLVM Phabricator instance.

Make processLogicalImmediate in AArch64AddressingModes.h more efficient
ClosedPublic

Authored by ahatanak on Oct 31 2014, 1:00 PM.

Details

Summary

Hi Tim,

While I was working on the AArch64 bitmask immediate optimization patch, I noticed the code in processLogicalImmediate, which determines whether an immediate value can be encoded as the immediate operand of a logical instruction, isn't using an efficient algorithm. The attached patch attempts to make it more efficient.

Diff Detail

Repository
rL LLVM

Event Timeline

ahatanak updated this revision to Diff 15639.Oct 31 2014, 1:00 PM
ahatanak retitled this revision from to Make processLogicalImmediate in AArch64AddressingModes.h more efficient.
ahatanak updated this object.
ahatanak edited the test plan for this revision. (Show Details)
ahatanak added a reviewer: t.p.northover.
ahatanak added a subscriber: Unknown Object (MLST).Oct 31 2014, 1:00 PM
t.p.northover edited edge metadata.Nov 3 2014, 2:30 PM

Hi,

I think it'd be good to convert this function to LLVM style (mainly local variables begin with a capital letter) since we're already changing so much of it.

Other than that, a couple of minor nits:

lib/Target/AArch64/MCTargetDesc/AArch64AddressingModes.h
224 ↗(On Diff #15639)

This is undefined behaviour if size > 62. I think "(1ULL << size) - 1" is OK.

226 ↗(On Diff #15639)

This is an equality comparison: I think "(Imm & Mask) != (Imm >> Size) & Mask" is clearer.

ahatanak closed this revision.Nov 3 2014, 3:35 PM
ahatanak updated this revision to Diff 15738.

Closed by commit rL221204 (authored by @ahatanak).