aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRichard Sandiford <richard.sandiford@arm.com>2017-05-08 16:18:49 +0000
committerRichard Sandiford <rsandifo@gcc.gnu.org>2017-05-08 16:18:49 +0000
commit564cf83d79d6199de7ea9eb047aa3a244d9bb52e (patch)
treec00db1079680faf7d686217a0571e3bf935577cc
parent06aa5490059800ce9253abecf6135478e96cc28c (diff)
downloadgcc-564cf83d79d6199de7ea9eb047aa3a244d9bb52e.zip
gcc-564cf83d79d6199de7ea9eb047aa3a244d9bb52e.tar.gz
gcc-564cf83d79d6199de7ea9eb047aa3a244d9bb52e.tar.bz2
[AArch64] Tighten move constraints for symbolic operands
The movsi and movdi constraints allowed the source to be any absolute symbolic expression ("S"). That's OK for operands that have already been vetted by the aarch64_mov_operand predicate but causes problems if the register allocator substitutes an equivalence (the usual "the constraints can't accept more than the predicates" restriction). Although all other uses of "S" in the backend are redundant and could in principle be removed, "S" itself is a publicly-documented constraint and so we'd have to keep its definition. This patch therefore adds a new "Usa" constraint for legitimate absolute address operands. 2017-05-08 Richard Sandiford <richard.sandiford@arm.com> gcc/ * config/aarch64/constraints.md (Usa): New constraint. * config/aarch64/aarch64.md (*movsi_aarch64, *movdi_aarch64): Use it. From-SVN: r247746
-rw-r--r--gcc/ChangeLog5
-rw-r--r--gcc/config/aarch64/aarch64.md4
-rw-r--r--gcc/config/aarch64/constraints.md8
3 files changed, 15 insertions, 2 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index fdc1511..58693c5 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,8 @@
+2017-05-08 Richard Sandiford <richard.sandiford@arm.com>
+
+ * config/aarch64/constraints.md (Usa): New constraint.
+ * config/aarch64/aarch64.md (*movsi_aarch64, *movdi_aarch64): Use it.
+
2017-05-08 Thomas Preud'homme <thomas.preudhomme@arm.com>
* config.gcc (arm*-*-*): Set TM_MULTILIB_CONFIG from
diff --git a/gcc/config/aarch64/aarch64.md b/gcc/config/aarch64/aarch64.md
index c522e87..7cc32dd 100644
--- a/gcc/config/aarch64/aarch64.md
+++ b/gcc/config/aarch64/aarch64.md
@@ -1031,7 +1031,7 @@
(define_insn_and_split "*movsi_aarch64"
[(set (match_operand:SI 0 "nonimmediate_operand" "=r,k,r,r,r,r,*w,m, m,r,r ,*w,r,*w")
- (match_operand:SI 1 "aarch64_mov_operand" " r,r,k,M,n,m, m,rZ,*w,S,Ush,rZ,w,*w"))]
+ (match_operand:SI 1 "aarch64_mov_operand" " r,r,k,M,n,m, m,rZ,*w,Usa,Ush,rZ,w,*w"))]
"(register_operand (operands[0], SImode)
|| aarch64_reg_or_zero (operands[1], SImode))"
"@
@@ -1063,7 +1063,7 @@
(define_insn_and_split "*movdi_aarch64"
[(set (match_operand:DI 0 "nonimmediate_operand" "=r,k,r,r,r,r,*w,m, m,r,r, *w,r,*w,w")
- (match_operand:DI 1 "aarch64_mov_operand" " r,r,k,N,n,m, m,rZ,*w,S,Ush,rZ,w,*w,Dd"))]
+ (match_operand:DI 1 "aarch64_mov_operand" " r,r,k,N,n,m, m,rZ,*w,Usa,Ush,rZ,w,*w,Dd"))]
"(register_operand (operands[0], DImode)
|| aarch64_reg_or_zero (operands[1], DImode))"
"@
diff --git a/gcc/config/aarch64/constraints.md b/gcc/config/aarch64/constraints.md
index b829337..b43f08b 100644
--- a/gcc/config/aarch64/constraints.md
+++ b/gcc/config/aarch64/constraints.md
@@ -98,6 +98,14 @@
(and (match_code "high")
(match_test "aarch64_valid_symref (XEXP (op, 0), GET_MODE (XEXP (op, 0)))")))
+(define_constraint "Usa"
+ "@internal
+ A constraint that matches an absolute symbolic address that can be
+ loaded by a single ADR."
+ (and (match_code "const,symbol_ref,label_ref")
+ (match_test "aarch64_symbolic_address_p (op)")
+ (match_test "aarch64_mov_operand_p (op, GET_MODE (op))")))
+
(define_constraint "Uss"
"@internal
A constraint that matches an immediate shift constant in SImode."