From 90db942b2752c1fea3a3b6f4a623710e1b88abd7 Mon Sep 17 00:00:00 2001
From: Richard Sandiford <rsandifo@redhat.com>
Date: Wed, 19 Nov 2003 08:23:43 +0000
Subject: [PATCH] emit-rtl.c (gen_lowpart): Don't force MEMs into a register
 unless the register lowpart is a...

	* emit-rtl.c (gen_lowpart): Don't force MEMs into a register unless
	the register lowpart is a TRULY_NOOP_TRUNCATION.

From-SVN: r73731
---
 gcc/ChangeLog  | 5 +++++
 gcc/emit-rtl.c | 2 ++
 2 files changed, 7 insertions(+)

diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 931f74c2aeb8..9c1b245aee8c 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,8 @@
+2003-11-19  Richard SAndiford  <rsandifo@redhat.com>
+
+	* emit-rtl.c (gen_lowpart): Don't force MEMs into a register unless
+	the register lowpart is a TRULY_NOOP_TRUNCATION.
+
 2003-11-19  Richard Henderson  <rth@redhat.com>
 
 	* config/i386/i386.c (print_reg): Handle QI and HI modes for
diff --git a/gcc/emit-rtl.c b/gcc/emit-rtl.c
index 9c50e2371fd6..a528641a6f98 100644
--- a/gcc/emit-rtl.c
+++ b/gcc/emit-rtl.c
@@ -1356,6 +1356,8 @@ gen_lowpart (enum machine_mode mode, rtx x)
       /* The following exposes the use of "x" to CSE.  */
       if (GET_MODE_SIZE (GET_MODE (x)) <= UNITS_PER_WORD
 	  && SCALAR_INT_MODE_P (GET_MODE (x))
+	  && TRULY_NOOP_TRUNCATION (GET_MODE_BITSIZE (mode),
+				    GET_MODE_BITSIZE (GET_MODE (x)))
 	  && ! no_new_pseudos)
 	return gen_lowpart (mode, force_reg (GET_MODE (x), x));
 
-- 
GitLab