From 4dff2f4248ad165f840a5ece4f88ffbd716a76cd Mon Sep 17 00:00:00 2001
From: Iain Sandoe <iain@sandoe.co.uk>
Date: Tue, 25 Aug 2020 21:20:12 +0100
Subject: [PATCH] aarch64 : Mark rotate immediates with '#' as per DDI0487iFc.

The armv8_arm manual [C6.2.226, ROR (immediate)] uses a # in front
of the immediate rotation quantity.

Although, it seems, GAS is able to infer the # (or is leninent about
its absence) assemblers based on the LLVM back end expect it.

gcc/ChangeLog:

	* config/aarch64/aarch64.md (<optab>_rol<mode>3): Add a '#'
	mark in front of the immediate quantity.
	(<optab>_rolsi3_uxtw): Likewise.

(cherry picked from commit 5051c12173713c81921ed133ef5a218e46ab11d1)
Signed-off-by: Kirill A. Korinsky <kirill@korins.ky>
---
 gcc/config/aarch64/aarch64.md | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git gcc/config/aarch64/aarch64.md gcc/config/aarch64/aarch64.md
index 7b5e6313d55..e39fad1bc8a 100644
--- gcc/config/aarch64/aarch64.md
+++ gcc/config/aarch64/aarch64.md
@@ -4366,7 +4366,7 @@ (define_insn "*<optab>_rol<mode>3"
 		      (match_operand:QI 2 "aarch64_shift_imm_<mode>" "n"))
 		     (match_operand:GPI 3 "register_operand" "r")))]
   ""
-  "<logical>\\t%<w>0, %<w>3, %<w>1, ror (<sizen> - %2)"
+  "<logical>\\t%<w>0, %<w>3, %<w>1, ror #(<sizen> - %2)"
   [(set_attr "type" "logic_shift_imm")]
 )
 
@@ -4391,7 +4391,7 @@ (define_insn "*<optab>_rolsi3_uxtw"
 		      (match_operand:QI 2 "aarch64_shift_imm_si" "n"))
 		     (match_operand:SI 3 "register_operand" "r"))))]
   ""
-  "<logical>\\t%w0, %w3, %w1, ror (32 - %2)"
+  "<logical>\\t%w0, %w3, %w1, ror #(32 - %2)"
   [(set_attr "type" "logic_shift_imm")]
 )
 
-- 
2.42.1

