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]

[PATCH, i386]: (output_387_ffreep): Create output from a template string


Hello!

This rather trivial patch creates output for ffreep "instruction" from a common template string, avoiding multiple string definition.
IMO this implementation is as much descriptive as is previous, but shaves a few bytes out of executable image...


Patch was bootstrapped for !HAVE_AS_IX86_FFREEP target, and the output was checked for correctnes by disassembling produced obj with gnu objdump.

2006-09-21 Uros Bizjak <uros@kss-loka.si>

       * config/i386/i386.c (output_387_ffreep): Create output from a
       template string for !HAVE_AS_IX86_FFREEP.

Uros.
Index: i386.c
===================================================================
--- i386.c	(revision 117111)
+++ i386.c	(working copy)
@@ -8667,17 +8667,15 @@
 #if HAVE_AS_IX86_FFREEP
     return opno ? "ffreep\t%y1" : "ffreep\t%y0";
 #else
-    switch (REGNO (operands[opno]))
-      {
-      case FIRST_STACK_REG + 0: return ".word\t0xc0df";
-      case FIRST_STACK_REG + 1: return ".word\t0xc1df";
-      case FIRST_STACK_REG + 2: return ".word\t0xc2df";
-      case FIRST_STACK_REG + 3: return ".word\t0xc3df";
-      case FIRST_STACK_REG + 4: return ".word\t0xc4df";
-      case FIRST_STACK_REG + 5: return ".word\t0xc5df";
-      case FIRST_STACK_REG + 6: return ".word\t0xc6df";
-      case FIRST_STACK_REG + 7: return ".word\t0xc7df";
-      }
+    {
+      static char retval[] = ".word\t0xc_df";
+      int regno = REGNO (operands[opno]);
+      
+      gcc_assert (FP_REGNO_P (regno));
+
+      retval[9] = '0' + (regno - FIRST_STACK_REG);
+      return retval;
+    }
 #endif
 
   return opno ? "fstp\t%y1" : "fstp\t%y0";

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