Use 15 byte long nops on modern Intel processors
authorPhilip Reames <listmail@philipreames.com>
Fri, 13 Mar 2020 17:49:38 +0000 (10:49 -0700)
committerPhilip Reames <listmail@philipreames.com>
Fri, 13 Mar 2020 17:51:09 +0000 (10:51 -0700)
commit1b86ad27a7d38c3751c1cbe65827cc6819dfb4fd
treee129e68f32031cdcf78d8ebb499a90c215b1c584
parenta26bd4ec1652da20872e55d0bf468f52149a2ec9
Use 15 byte long nops on modern Intel processors

Back in D42616, we switched our default nop length from 15 to 10 bytes because some platforms have painful decode stalls when encountering multiple instruction prefixes. (10 byte long nops come from the fact that prefixes are used to pad after 8 bytes, and some platforms have issues w/more than two prefixes.)

Based on Agner's guides, it appears to be the case that modern Intel (SandyBridge and later) can decode an arbitrary number of prefixes without issue. Intel's guide only provides up to 9 bytes; I read that as providing a safe default for all their chips. Older chips and Atom series have serious decode stalls. I can't find a conclusive reference beyond those two.

Differential Revision: https://reviews.llvm.org/D75945
llvm/lib/Target/X86/X86.td
llvm/test/CodeGen/X86/align-branch-boundary-suppressions.ll
llvm/test/MC/X86/align-via-relaxation.s
llvm/test/MC/X86/x86_long_nop.s