This is an archive of the discontinued LLVM Phabricator instance.

X86TargetLowering::LowerToBT
Needs ReviewPublic

Authored by CSears on Feb 4 2015, 6:49 PM.
This revision needs review, but all specified reviewers are disabled or inactive.

Details

Summary

This is a patch to X86TargetLowering::LowerToBT() which was hashed over on the Developers list with Intel concurring. I'm finally figuring out Phabricator and I expect a few more problems there.

bt_pat generates the BT instruction for X86 bit testing in cases where code size is important. It checks whether the -Oz (optimize for size) flag is set or whether the containing function's PGO cold attribute is set. If either are true it emits BT for tests of bits 8-31 instead of TEST. Previously, TEST was always used for bits 0-31 and BT was always used for bits 32-63.

Since the BT instruction is 16b smaller than TEST for the bits 8-31 case, 32b vs 48b, and not irredeemably slower, it makes sense to use BT in cases where size matters.

Similar logic is possible for BTC and BTS. However, LowerToBTC and LowerToBTS would need to be written and used and that's a larger patch.

Diff Detail

Event Timeline

CSears updated this revision to Diff 19370.Feb 4 2015, 6:49 PM
CSears retitled this revision from to X86TargetLowering::LowerToBT.
CSears updated this object.
CSears edited the test plan for this revision. (Show Details)
CSears added a reviewer: joker-eph-DISABLED.
CSears added a subscriber: Unknown Object (MLST).

We need the non regression test to be a .ll with the appropriate "CHECK:" . Can you produce one from the .c?
You can take example on test/CodeGen/X86/xor.ll ; let me know if you need help on that.

CSears added a comment.Feb 4 2015, 7:12 PM

I tried figuring out how to construct a lit test from tst64.ll. I'll try
again.

How does one *attach* a file to review. On Chrome, when I dragged tst64.c
from the finder onto the comment area, as per the dialogs suggestion,
it just opened file:// blah blah /tst64.c as a new page in the browser.

I always use diff when interacting with Phabricator.
Usually I work locally with git and I generate my diff with it.

If you don’t want to use a VCS, you can look at: http://jungels.net/articles/diff-patch-ten-minutes.html "Creating patches with diff”.

Mehdi