From 37f5242b58f51568fcb60fd2fb35ca61c92b2305 Mon Sep 17 00:00:00 2001 From: Roger Sayle Date: Thu, 6 Mar 2003 21:59:09 +0000 Subject: [PATCH] emit-rtl.c (gen_lowpart): When requesting the low-part of a MEM... * emit-rtl.c (gen_lowpart): When requesting the low-part of a MEM, try loading the MEM into a register and taking the low-part of that, to help CSE see the use of the MEM in its true mode. From-SVN: r63907 --- gcc/ChangeLog | 6 ++++++ gcc/emit-rtl.c | 6 ++++++ 2 files changed, 12 insertions(+) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 8af66894ea2..3850c9814b1 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2003-03-06 Roger Sayle + + * emit-rtl.c (gen_lowpart): When requesting the low-part of a + MEM, try loading the MEM into a register and taking the low-part + of that, to help CSE see the use of the MEM in its true mode. + 2002-03-05 Tom Tromey * config/stormy16/stormy16.h (DWARF_LINE_MIN_INSTR_LENGTH): diff --git a/gcc/emit-rtl.c b/gcc/emit-rtl.c index dbc0a372a3b..c96bc4e200e 100644 --- a/gcc/emit-rtl.c +++ b/gcc/emit-rtl.c @@ -1371,6 +1371,12 @@ gen_lowpart (mode, x) { /* The only additional case we can do is MEM. */ int offset = 0; + + /* The following exposes the use of "x" to CSE. */ + if (GET_MODE_SIZE (GET_MODE (x)) <= UNITS_PER_WORD + && ! no_new_pseudos) + return gen_lowpart (mode, force_reg (GET_MODE (x), x)); + if (WORDS_BIG_ENDIAN) offset = (MAX (GET_MODE_SIZE (GET_MODE (x)), UNITS_PER_WORD) - MAX (GET_MODE_SIZE (mode), UNITS_PER_WORD)); -- 2.30.2