public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* get frv-uclinux to build on x86_64-linux-gnu host
@ 2004-10-25  8:56 Alexandre Oliva
  0 siblings, 0 replies; only message in thread
From: Alexandre Oliva @ 2004-10-25  8:56 UTC (permalink / raw)
  To: gcc-patches

[-- Attachment #1: Type: text/plain, Size: 154 bytes --]

I needed this patch to avoid inappropriate truncation of 64-bit
CONST_INTs.  Build-tested on x86_64-linux-gnu and i686-pc-linux-gnu.
I'm checking it in.


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: gcc-frv-64bitHWI-mov-splits.patch --]
[-- Type: text/x-patch, Size: 2162 bytes --]

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

	* config/frv/frv.md (movdi, movdf): Handle wide-constant splits
	with wider-than-32-bit HOST_WIDE_INTs.

Index: gcc/config/frv/frv.md
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/frv/frv.md,v
retrieving revision 1.25
diff -u -p -r1.25 frv.md
--- gcc/config/frv/frv.md 11 Oct 2004 12:13:33 -0000 1.25
+++ gcc/config/frv/frv.md 25 Oct 2004 08:27:30 -0000
@@ -1833,7 +1833,7 @@
 	(match_operand:DI 1 "const_int_operand" ""))]
   "reload_completed"
   [(set (match_dup 2) (match_dup 4))
-   (set (match_dup 3) (match_dup 1))]
+   (set (match_dup 3) (match_dup 5))]
   "
 {
   rtx op0 = operands[0];
@@ -1841,7 +1841,18 @@
 
   operands[2] = gen_highpart (SImode, op0);
   operands[3] = gen_lowpart (SImode, op0);
-  operands[4] = GEN_INT ((INTVAL (op1) < 0) ? -1 : 0);
+  if (HOST_BITS_PER_WIDE_INT <= 32)
+    {
+      operands[4] = GEN_INT ((INTVAL (op1) < 0) ? -1 : 0);
+      operands[5] = op1;
+    }
+  else
+    {
+      operands[4] = GEN_INT ((((unsigned HOST_WIDE_INT)INTVAL (op1) >> 16)
+			      >> 16) ^ ((unsigned HOST_WIDE_INT)1 << 31)
+			     - ((unsigned HOST_WIDE_INT)1 << 31));
+      operands[5] = GEN_INT (trunc_int_for_mode (INTVAL (op1), SImode));
+    }
 }")
 
 (define_split
@@ -2031,7 +2042,7 @@
 	(match_operand:DF 1 "const_int_operand" ""))]
   "reload_completed"
   [(set (match_dup 2) (match_dup 4))
-   (set (match_dup 3) (match_dup 1))]
+   (set (match_dup 3) (match_dup 5))]
   "
 {
   rtx op0 = operands[0];
@@ -2039,7 +2050,18 @@
 
   operands[2] = gen_highpart (SImode, op0);
   operands[3] = gen_lowpart (SImode, op0);
-  operands[4] = GEN_INT ((INTVAL (op1) < 0) ? -1 : 0);
+  if (HOST_BITS_PER_WIDE_INT <= 32)
+    {
+      operands[4] = GEN_INT ((INTVAL (op1) < 0) ? -1 : 0);
+      operands[5] = op1;
+    }
+  else
+    {
+      operands[4] = GEN_INT ((((unsigned HOST_WIDE_INT)INTVAL (op1) >> 16)
+			      >> 16) ^ ((unsigned HOST_WIDE_INT)1 << 31)
+			     - ((unsigned HOST_WIDE_INT)1 << 31));
+      operands[5] = GEN_INT (trunc_int_for_mode (INTVAL (op1), SImode));
+    }
 }")
 
 (define_split

[-- Attachment #3: Type: text/plain, Size: 188 bytes --]


-- 
Alexandre Oliva             http://www.ic.unicamp.br/~oliva/
Red Hat Compiler Engineer   aoliva@{redhat.com, gcc.gnu.org}
Free Software Evangelist  oliva@{lsd.ic.unicamp.br, gnu.org}

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2004-10-25  8:31 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-10-25  8:56 get frv-uclinux to build on x86_64-linux-gnu host Alexandre Oliva

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).