i386: Split MOVBE alternatives out of *bswaphi2_movbe to drop flags clobber
Improves i386 code generation by splitting MOVBE instructions to avoid unnecessary flag clobbering.
This change refactors the i386 backend to separate MOVBE instruction alternatives from the *bswaphi2_movbe pattern. The MOVBE instruction does not affect the EFLAGS register, but the original pattern included a flags clobber that was only needed by other alternatives. By splitting the MOVBE cases into a new *movbehi2 pattern, this unnecessary clobber is removed, leading to cleaner and potentially more efficient machine code.
In Details
The i386.md file's *bswaphi2_movbe pattern incorrectly included a (clobber (reg:CC FLAGS_REG)) for its MOVBE alternatives. This clobber is only relevant for other instructions sharing the pattern, such as ROL. Since MOVBE instructions do not modify EFLAGS, this clobber is superfluous. This commit splits the MOVBE (mem<->reg) alternatives into a new define_insn called *movbehi2 which lacks the flags clobber. This split occurs post-reload, ensuring that the correct instruction is chosen without impacting other parts of the pattern.
- MOVBE
- An x86 instruction that moves data from memory to a register or vice versa, with byte swapping. It is often used for Endianness conversion.
- flags clobber
- In machine description files, this indicates that an instruction modifies the processor's status flags (e.g., EFLAGS register). It's crucial for instruction scheduling and correctness.
- EFLAGS
- The x86 architecture's status register, which holds condition codes, flags, and system information resulting from arithmetic and logical operations.
- insn
- Abbreviation for 'instruction' in the context of GCC's machine description files (MD files), defining how source code constructs map to target machine code.
- define_insn_and_split
- A construct in GCC's machine description language that defines an instruction pattern and specifies how it should be split into simpler instructions if necessary, often after the reload pass.
- reload
- A phase in the GCC compiler pipeline where virtual registers are replaced with real hardware registers, and instructions are rearranged or split as needed to fit the target architecture's constraints.