On 8/27/26 3:13 PM, Hans-Peter Nilsson wrote:
Let's harmonize canonicalization for NOT-on-ROTATE and NOT-on-ROTATERT
with that of BSWAP and BITREVERSE, and document the canonical
form. Tested cross to cris-elf, native on x86_64-pc-linux-gnu.
Ok to commit?
brgds, H-P
-- >8 --
Before this patch, the combine pass would match (bitreverse:SI (not:SI
reg)) but not (rotate:SI (not:SI reg (const_int 16)))), instead
requiring (not:SI (rotate:SI reg (const_int 16))) for the compound
operation to be recognized. That looked inconsistent considering that
both are bit-rearrangement operations commutative with bitwise negation.
I was about to write "operations with which bitwise negation is
commutative", but thought better list the operations explicitly.
* doc/md.texi (Insn Canonicalizations): Document BITREVERSE,
BSWAP, ROTATE, and ROTATERT as having the canonical form of
NOT moved inside the first operand.
* simplify-rtx.cc (simplify_context::simplify_unary_operation_1):
Move a NOT to the inside of ROTATE and ROTATERT, like for BITREVERSE
and BSWAP.
* config/cris/cris.md (*rotsi2_16_not<setcc><setnz><setnzvc>): Adjust
accordingly.
OK
Jeff