simplify-rtx: Reverse rotations with masked negative counts

Reverse rotations with masked negative counts in the generic RTL
simplifier. Keep the count mask so the reversed count stays in range.

gcc/ChangeLog:

	* simplify-rtx.cc (simplify_context::simplify_binary_operation_1):
	Reverse rotations with masked negative counts.
	(selftest::test_masked_negative_rotate): New function.
	(selftest::test_scalar_int_ops): Call it.

gcc/testsuite/ChangeLog:

	* gcc.target/riscv/zbb-rol-ror-10.c: New test.
	* gcc.target/aarch64/rotate-neg-mask.c: Ditto.
3 files changed