Add an instance combine optimization for expressions of the form:
(%arg u< C1) & ((%arg & C2) != C2) -> %arg u< C2
Where C1 is a power-of-2 and C2 is a contiguous mask starting 1 bit below C1.
This commit resolves GitHub missed-optimization issue #54856.
All test have been verified with alive2.
Scalar tests:
- @masked_icmps_mask_allzeros_bmask_notmixed_and_notallones_2147483648_1610612736 + swapped
- @masked_icmps_mask_allzeros_bmask_notmixed_and_notallones_2147483648_2147483647 + swapped
- @masked_icmps_mask_allzeros_bmask_notmixed_and_notallones_2147483648_805306368 + swapped
- @masked_icmps_mask_allzeros_bmask_notmixed_and_notallones_1073741824_1073741823 + swapped
- @masked_icmps_mask_allzeros_bmask_notmixed_and_notallones_8_7 + swapped
- @masked_icmps_mask_allzeros_bmask_notmixed_and_notallones_8_6 + swapped
Vector tests:
- @masked_icmps_mask_allzeros_bmask_notmixed_and_notallones_vector_2147483648_2147483647 + swapped
- @masked_icmps_mask_allzeros_bmask_notmixed_and_notallones_vector_2147483648_1610612736_2147483647 + swapped
- @masked_icmps_mask_allzeros_bmask_notmixed_and_notallones_vector_splat_2147483648_1610612736_2147483647
- @masked_icmps_mask_allzeros_bmask_notmixed_and_notallones_vector_128_others + swapped
- @masked_icmps_mask_allzeros_bmask_notmixed_and_notallones_vector_64_others + swapped
Can you be explicit about what you are transforming this into (ult).
Also shouldn't it be (icmp (A & B) == 0) & (icmp (A & D) != E)?