[X86][AsmParser] Refactor code and optimize more instructions from VEX3 to VEX2
authorShengchen Kan <shengchen.kan@intel.com>
Sun, 7 May 2023 14:20:36 +0000 (22:20 +0800)
committerShengchen Kan <shengchen.kan@intel.com>
Fri, 12 May 2023 14:50:17 +0000 (22:50 +0800)
commitc13ed1cc75781fccc7cec91017e84341c3047229
tree639fd877c8b5aa63dd6f65febd14d028d9dd8379
parentf4865c7c1795eb17b079e116791eb1419fea1620
[X86][AsmParser] Refactor code and optimize more instructions from VEX3 to VEX2

1. Share code `optimizeInstFromVEX3ToVEX2` with MCInstLower
2. Move the code of optimization for shift/rotate to a separate file
3. Since the function is shared, a side effect is that more encoding
   optimizations are done on the Asmparser side. Considering we already
   use reverse-encoding for optimization in AsmParser before this patch,
   I believe the change is positive and expected.

This is a reland of D150068 with the fix D150440.
llvm/lib/Target/X86/AsmParser/X86AsmParser.cpp
llvm/lib/Target/X86/MCTargetDesc/CMakeLists.txt
llvm/lib/Target/X86/MCTargetDesc/X86EncodingOptimization.cpp [new file with mode: 0644]
llvm/lib/Target/X86/MCTargetDesc/X86EncodingOptimization.h [new file with mode: 0644]
llvm/lib/Target/X86/X86InstrAsmAlias.td
llvm/lib/Target/X86/X86MCInstLower.cpp
llvm/test/MC/X86/x86_64-avx-encoding.s
llvm/test/tools/llvm-mca/X86/show-encoding.s