X86 can reduce the bytes of NOP by padding instructions with prefixes to get a better peformance in some cases. So a private member function determinePaddingPrefix is added to determine which prefix is the most suitable.
Details
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
@craig.topper the logic of checking the existing segment override prefix for instruction is kind of complicated, does it look good to you?
Do you have a plan how determinePaddingPrefix will be used? Without a plan, there may be some churn that moves things around. The plan should also include how the complex logic will be tested eventually.
Philip prototyped what prefix padding for relaxable instructions might look like in D75203, determinePaddingPrefix is planed to be used to determine the appropriate prefix in the framework.
llvm/lib/Target/X86/MCTargetDesc/X86AsmBackend.cpp | ||
---|---|---|
359 | Prefer to keep unchanged. |
llvm/lib/Target/X86/MCTargetDesc/X86AsmBackend.cpp | ||
---|---|---|
350 | Hi Shengchen, Out of curiosity, why does this feature use CS instead of DS for instruction padding? Also, is there an easy way to trigger this behavior in Clang? I couldn't find any tests for this functionality. Thanks! |
llvm/lib/Target/X86/MCTargetDesc/X86AsmBackend.cpp | ||
---|---|---|
350 | Hi @glider. the behavior here is to align with GAS, I don't know if there is a specific reason to use CS here. I doubt it's more like a decision. You can find the tests here llvm/test/MC/X86/prefix-padding-64.s |
Hi Shengchen,
Out of curiosity, why does this feature use CS instead of DS for instruction padding?
Also, is there an easy way to trigger this behavior in Clang? I couldn't find any tests for this functionality.
Thanks!