[PATCH] D81301: [X86] Emit two-byte NOP when possible

Eli Friedman via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Jun 5 15:10:55 PDT 2020


efriedma added inline comments.


================
Comment at: llvm/lib/Target/X86/X86MCInstLower.cpp:1102
+    if (Subtarget->is32Bit() && NumBytes >= 2) {
+      OS.emitInstruction(
+          MCInstBuilder(X86::XCHG16ar).addReg(X86::AX).addReg(X86::AX),
----------------
MaskRay wrote:
> Can the x86-64 code path below be reused?
I see three issues with using the 64-bit codepath on 32-bit:

1. We can't use the patterns based on REX prefixes.
2. The X86::NOOPL opcode requires FeatureNOPL.
3. If Mode16Bit is enabled, XCHG16ar is actually a one-byte instruction.

So we could sort of reuse the code below, but it would require a lot of refactoring.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D81301/new/

https://reviews.llvm.org/D81301





More information about the llvm-commits mailing list