This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

SH: add sign-extension of literal constant


0xf0000008 is not a valid sign-extended constant for Pmode, when
Pmode==SImode are 32-bits wide and HOST_WIDE_INT is 64-bits wide.
This patch fixes this bug.  Tested on athlon-pc-linux-gnu-x-sh-elf.

Index: gcc/ChangeLog
from  Alexandre Oliva  <aoliva@redhat.com>

	* config/sh/sh.md (ic_invalidate_line): Make sure the immediate
	constant is a valid sign-extension for Pmode.

Index: gcc/config/sh/sh.md
===================================================================
RCS file: /cvs/gcc/egcs/gcc/config/sh/sh.md,v
retrieving revision 1.94
diff -u -p -r1.94 sh.md
--- gcc/config/sh/sh.md 2002/01/24 20:52:10 1.94
+++ gcc/config/sh/sh.md 2002/02/03 00:43:20
@@ -2501,7 +2501,8 @@
   "
 {
   operands[0] = force_reg (Pmode, operands[0]);
-  operands[1] = force_reg (Pmode, GEN_INT (0xf0000008));
+  operands[1] = force_reg (Pmode, GEN_INT (trunc_int_for_mode (0xf0000008,
+							       Pmode)));
 }")
 
 ;; The address %0 is assumed to be 4-aligned at least.  Thus, by ORing

-- 
Alexandre Oliva   Enjoy Guarana', see http://www.ic.unicamp.br/~oliva/
Red Hat GCC Developer                  aoliva@{cygnus.com, redhat.com}
CS PhD student at IC-Unicamp        oliva@{lsd.ic.unicamp.br, gnu.org}
Free Software Evangelist                Professional serial bug killer

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]