www.delorie.com/archives/browse.cgi   search  
Mail Archives: pgcc/1999/04/22/00:25:54

Sender: root AT delorie DOT com
Message-ID: <371EB113.2FA5F007@access1.net>
Date: Thu, 22 Apr 1999 05:18:12 +0000
From: Rodric Glaser <nihility AT access1 DOT net>
X-Mailer: Mozilla 4.51 [en] (X11; I; Linux 2.2.5 i586)
X-Accept-Language: en
MIME-Version: 1.0
To: pgcc AT delorie DOT com
Subject: Quick fix(?) for pgcc-1.1.2
Reply-To: pgcc AT delorie DOT com

Well, I'm no expert as this is the first time I've looked at the gcc
code.  Seems like there is a problem with the signed extension (insn
extendsidi2) in pgcc-1.1.2.  The following patch just reverts to the
egcs-1.1.2 machine definition but it got me through a bootstrap and
built the window manager im using :)
    -Rodric

--- gcc/config/i386/i386.md.orig Wed Apr 21 16:30:25 1999
+++ gcc/config/i386/i386.md Wed Apr 21 16:31:04 1999
@@ -2146,40 +2146,26 @@
 ;;- sign extension instructions

 (define_insn "extendsidi2"
-  [(set (match_operand:DI 0 "nonimmediate_operand" "=A,?r,?Ar,*o")
- (sign_extend:DI (match_operand:SI 1 "register_operand" "0,0,r,*r")))
-   (clobber (match_scratch:SI 2 "=X,X,X,&r"))]
+  [(set (match_operand:DI 0 "register_operand" "=r")
+       (sign_extend:DI (match_operand:SI 1 "register_operand" "0")))]
   ""
-  "#")

-;; Extend to register case.  Optimize case where source and destination

-;; registers match and cases where we can use cltd.
-(define_split
-  [(set (match_operand:DI 0 "register_operand" "")
- (sign_extend:DI (match_operand:SI 1 "register_operand" "")))
-   (clobber (match_scratch:SI 2 ""))]
-  "reload_completed"
-  [(const_int 0)]
-  "
+  "*
 {
-  split_di (&operands[0], 1, &operands[3], &operands[4]);

-  if (true_regnum (operands[3]) != true_regnum (operands[1]))
-    emit_move_insn (operands[3], operands[1]);

-  /* Generate a cltd if possible and doing so it profitable.  */
-  if (true_regnum (operands[3]) == 0
-      && (optimize_size || !TARGET_PENTIUM))
+  if (REGNO (operands[0]) == 0)
     {
-      emit_insn (gen_ashrsi3_31 (operands[4], operands[3]));
-      DONE;
+      /* This used to be cwtl, but that extends HI to SI somehow.  */
+#ifdef INTEL_SYNTAX
+      return \"cdq\";
+#else
+      return \"cltd\";
+#endif
     }

-  if (true_regnum (operands[4]) != true_regnum (operands[1]))
-    emit_move_insn (operands[4], operands[1]);
+  operands[1] = gen_rtx_REG (SImode, REGNO (operands[0]) + 1);
+  output_asm_insn (AS2 (mov%L0,%0,%1), operands);

-  emit_insn (gen_ashrsi3_31 (operands[4], operands[4]));
-  DONE;
+  operands[0] = GEN_INT (31);
+  return AS2 (sar%L1,%0,%1);
 }")

 ;; Note that the i386 programmers' manual says that the opcodes


- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019