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

Ahmed Bougacha ahmed.bougacha at gmail.com
Tue Jun 23 11:37:56 PDT 2015


Hi craig.topper,

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.

http://reviews.llvm.org/D10668

Files:
  lib/Target/X86/AsmParser/X86AsmParser.cpp
  lib/Target/X86/Disassembler/X86Disassembler.cpp
  lib/Target/X86/MCTargetDesc/X86BaseInfo.h
  lib/Target/X86/MCTargetDesc/X86MCCodeEmitter.cpp
  lib/Target/X86/X86InstrControl.td
  lib/Target/X86/X86InstrFormats.td
  test/MC/Disassembler/X86/branch-hint-prefix.s
  test/MC/X86/branch-hint-prefix.s
  utils/TableGen/X86RecognizableInstr.cpp

EMAIL PREFERENCES
  http://reviews.llvm.org/settings/panel/emailpreferences/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D10668.28271.patch
Type: text/x-patch
Size: 12780 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20150623/8c903128/attachment.bin>


More information about the llvm-commits mailing list