This is a set of patches to reduce the compile-time overhead of immediate generation on AArch64. There have been discussions and investigations into reducing the overhead of immediate generation using various caching strategies. However the statistics showed some of the expensive immediate loops are not beneficial, and the algorithms can be improved significantly. The resulting speedups are so large that caching can no longer show a measurable benefit.
aarch64_bitmask_imm is rewritten to use bitwise arithmetic rather than binary search. aarch64_internal_mov_immediate is rewritten to remove slow linear and quadratic loops with constant time logic, reduce the number of special cases and simplify the overall logic. There are slight differences in the generated sequences however all immediate are the same size (no codesize difference in SPEC2006). Overall buildtime improvement is 0.3% when building SPEC2006.