summaryrefslogtreecommitdiffstats
path: root/meta/recipes-devtools/gcc/gcc-7.2/0001-PR-rtl-optimization-81803.patch
blob: 292e734a2fb9285ba7e6835773a7f996fd8cf031 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
From 5cbb8e6b1122092b3eaabd4270b2f316aa40407c Mon Sep 17 00:00:00 2001
From: ebotcazou <ebotcazou@138bc75d-0d04-0410-961f-82ee72b054a4>
Date: Tue, 31 Oct 2017 18:27:52 +0000
Subject: [PATCH] 	PR rtl-optimization/81803 	* lra-constraints.c
 (curr_insn_transform): Also reload the whole 	register for a strict subreg
 no wider than a word if this is for 	a WORD_REGISTER_OPERATIONS target.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@254275 138bc75d-0d04-0410-961f-82ee72b054a4

Upstream-Status: Backport

This patch removes changes to Changelog from the original patch upstream. This is
because we are backporting a patch to a stable version, making changes to Changelog,
especially up '* GCC 7.2.0 released.', feels a little weird.

Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
---
 gcc/lra-constraints.c | 11 ++++++++---
 2 files changed, 16 insertions(+), 3 deletions(-)

diff --git a/gcc/lra-constraints.c b/gcc/lra-constraints.c
index a423f069836..3758409bb9c 100644
--- a/gcc/lra-constraints.c
+++ b/gcc/lra-constraints.c
@@ -4207,8 +4207,9 @@ curr_insn_transform (bool check_only_p)
 	      reg = SUBREG_REG (*loc);
 	      byte = SUBREG_BYTE (*loc);
 	      if (REG_P (reg)
-		  /* Strict_low_part requires reload the register not
-		     the sub-register.	*/
+		  /* Strict_low_part requires reloading the register and not
+		     just the subreg.  Likewise for a strict subreg no wider
+		     than a word for WORD_REGISTER_OPERATIONS targets.  */
 		  && (curr_static_id->operand[i].strict_low
 		      || (!paradoxical_subreg_p (mode, GET_MODE (reg))
 			  && (hard_regno
@@ -4219,7 +4220,11 @@ curr_insn_transform (bool check_only_p)
 			  && (goal_alt[i] == NO_REGS
 			      || (simplify_subreg_regno
 				  (ira_class_hard_regs[goal_alt[i]][0],
-				   GET_MODE (reg), byte, mode) >= 0)))))
+				   GET_MODE (reg), byte, mode) >= 0)))
+		      || (GET_MODE_PRECISION (mode)
+			  < GET_MODE_PRECISION (GET_MODE (reg))
+			  && GET_MODE_SIZE (GET_MODE (reg)) <= UNITS_PER_WORD
+			  && WORD_REGISTER_OPERATIONS)))
 		{
 		  /* An OP_INOUT is required when reloading a subreg of a
 		     mode wider than a word to ensure that data beyond the
-- 
2.13.0