This is an archive of the discontinued LLVM Phabricator instance.

[X86] Add Jcc branch hint (2E, 3E) MC support.
Needs ReviewPublic

Authored by ab on Jun 23 2015, 11:37 AM.
This revision needs review, but there are no reviewers specified.

Details

Reviewers
None
Summary

Vaguely documented as CS/DS segment prefixes (2Eh,3Eh) on branches, these are used to indicate static predicted not-taken/taken hints on conditional branches, and look like:

jne,pn <target>
je,pt  <target>

Adding instructions isn't ideal; implementation alternatives welcome. I thought about:

  • adding a context, but that seems overkill, and would increase the size of the context table for no good reason
  • adding operands, but we don't want to carry those around in the Jcc common case, so we'll end up in the
  • passing this otherwise, say TSFlags? not sure what that would look like, since all these are associated to an opcode, so we need different ones anyway.
  • adding a standalone prefix, like we do for rep/lock, but that's tricky to do with the textual assembly suffix

Jcc only for now; should we have JECXZ and LOOP as well?

Also, I'm not sure these have had any effect (but larger instructions) since Pentium 4, but we still need to assemble/disassemble them.

Diff Detail

Event Timeline

ab updated this revision to Diff 28271.Jun 23 2015, 11:37 AM
ab retitled this revision from to [X86] Add Jcc branch hint (2E, 3E) MC support..
ab updated this object.
ab edited the test plan for this revision. (Show Details)
ab added a reviewer: craig.topper.
ab added a subscriber: Unknown Object (MLST).
ab updated this revision to Diff 48753.Feb 22 2016, 4:25 PM

Rebase and changed to use TSFlags instead of new formats: the latter spares bits, but the former seems cleaner.

ab updated this revision to Diff 48754.Feb 22 2016, 4:26 PM
ab updated this revision to Diff 48756.Feb 22 2016, 4:45 PM

Add back disassembler tests.

craig.topper resigned from this revision.Mar 3 2017, 2:17 PM