x86: Converts vector load to constant integer load.
The x86 compiler now converts vector loads to constant integer loads for better optimization.
The x86 compiler can now convert vector loads to constant integer loads in certain cases, which enables better optimization. This commit introduces a new optimization pass that identifies vector loads of constant integers and replaces them with scalar integer loads. A new test case, gcc.target/i386/pr125238.c, validates the optimization.
In Details
This commit, addressing PR target/125238, modifies config/i386/i386-features.cc to enable the conversion of vector loads to constant integer loads. The ix86_broadcast_inner function now sets the X86_CSE_CONST_VECTOR kind when a vector load can be converted to a constant integer load. This optimization leverages the x86 combine/CSE passes. It is specific to the x86 backend.
For Context
This commit introduces an optimization to the x86 compiler that can improve performance in certain situations. Vector loads are used to load multiple values into a register at once. By converting vector loads of constant values into scalar integer loads, the compiler can sometimes generate more efficient code.