https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93171
--- Comment #5 from GCC Commits <cvs-commit at gcc dot gnu.org> --- The master branch has been updated by kishan parmar <[email protected]>: https://gcc.gnu.org/g:d88781e6fb9786e7bb0bc8d34e7f15316b450c4b commit r17-5181-gd88781e6fb9786e7bb0bc8d34e7f15316b450c4b Author: Kishan Parmar <[email protected]> Date: Wed Oct 14 13:49:53 2026 +0530 rs6000: New splitter to combine two rotates into rldic+rldimi sequence GCC currently emits three instructions (rldic/rldic/or) for RTL of the form: (ior (and (ashift S1 sh1) mask1) (and (ashift S2 sh2) mask2)) even when the two masks select disjoint bitfields that can be merged using a single `rldic` (rotate-and-mask) followed by an `rldimi` (rotate-and-insert) instruction. This patch adds a `define_split` pattern that recognizes such cases and rewrites them into a two-instruction sequence that performs the same operation more efficiently: rldic dest, S2, sh2, mb2 rldimi dest, S1, sh1, mb1 The splitter checks that: * both rotated fields have valid insert/shift masks, * the masks are non-overlapping, and * safety guard to check pseudos can be created at this stage (`can_create_pseudo_p()`). This transformation allows combine to generate the higher-level (ior(and(rotate), and(rotate))) form, while the new splitter breaks it down pre-reload into efficient PowerPC field-merge instructions. 2026-10-14 Kishan Parmar <[email protected]> gcc/ChangeLog: PR target/93171 * config/rs6000/rs6000.md (New merge field splitter): New define_split pattern. Split disjoint rotate-and-mask OR sequences into rldic + rldimi when both masks are valid and non-overlapping. gcc/testsuite/ChangeLog: * gcc.target/powerpc/pr93171.c: New testcase.
