Skip to content
Snippets Groups Projects
Commit 48f3f27f authored by Wilco Dijkstra's avatar Wilco Dijkstra Committed by Wilco Dijkstra
Browse files

AArch64: Improve rotate patterns

Improve and generalize rotate patterns. Rotates by more than half the
bitwidth of a register are canonicalized to rotate left. Many existing
shift patterns don't handle this case correctly, so add rotate left to
the shift iterator and convert rotate left into ror during assembly
output. Add missing zero_extend patterns for shifted BIC, ORN and EON.

gcc/
	* config/aarch64/aarch64.md
	(and_<SHIFT:optab><mode>3_compare0): Support rotate left.
	(and_<SHIFT:optab>si3_compare0_uxtw): Likewise.
	(<LOGICAL:optab>_<SHIFT:optab><mode>3): Likewise.
	(<LOGICAL:optab>_<SHIFT:optab>si3_uxtw): Likewise.
	(one_cmpl_<optab><mode>2): Likewise.
	(<LOGICAL:optab>_one_cmpl_<SHIFT:optab><mode>3): Likewise.
	(<LOGICAL:optab>_one_cmpl_<SHIFT:optab>sidi_uxtw): New pattern.
	(eor_one_cmpl_<SHIFT:optab><mode>3_alt): Support rotate left.
	(eor_one_cmpl_<SHIFT:optab>sidi3_alt_ze): Likewise.
	(and_one_cmpl_<SHIFT:optab><mode>3_compare0): Likewise.
	(and_one_cmpl_<SHIFT:optab>si3_compare0_uxtw): Likewise.
	(and_one_cmpl_<SHIFT:optab><mode>3_compare0_no_reuse): Likewise.
	(and_<SHIFT:optab><mode>3nr_compare0): Likewise.
	(*<optab>si3_insn_uxtw): Use SHIFT_no_rotate.
	(rolsi3_insn_uxtw): New pattern.
	* config/aarch64/iterators.md (SHIFT): Add rotate left.
	(SHIFT_no_rotate): Add new iterator.
	(SHIFT:shift): Print rotate left as ror.
	(is_rotl): Add test for left rotate.

gcc/testsuite/
	* gcc.target/aarch64/ror_2.c: New test.
	* gcc.target/aarch64/ror_3.c: New test.
parent 1be715f3
No related branches found
No related tags found
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment