new ia32 and asms

Richard Henderson rth@cygnus.com
Thu Sep 2 13:11:00 GMT 1999


I just discovered a patch from the Cygnus branch that got missed.
I'm really surprised this didn't get noticed on new_ia32_branch,
as I recall it showing up on both glibc and kernel builds before.

Anyway, the issue is one of source compatibility -- when the 
port was using cc0, the code in final to remove redundant compares
simply didn't search backward across an asm.  Now that we have
an explicit flags register we get a similar but different problem
in that a compare can get scheduled before a non-volatile asm.

One stance that could be taken is that we require "cc" to appear
in the clobber list, as documented in the gcc manuals.  In practice
we merely break large quantities of code with no discernable
performance benefit.

So my solution is just to add "flags" and "fpcr" to the clobber
list of every asm.  Note that the MD_ASM_CLOBBERS definition
already made it in, just the actual bits to use it got missed.


r~


        * stmt.c (expand_asm_operands): Invoke MD_ASM_CLOBBERS if present.
        * tm.texi (MD_ASM_CLOBBERS): Document it.

Index: stmt.c
===================================================================
RCS file: /egcs/carton/cvsfiles/egcs/gcc/stmt.c,v
retrieving revision 1.80
diff -c -p -d -r1.80 stmt.c
*** stmt.c	1999/08/19 22:33:38	1.80
--- stmt.c	1999/09/02 20:00:39
*************** expand_asm_operands (string, outputs, in
*** 1153,1158 ****
--- 1153,1166 ----
        return;
      }
  
+ #ifdef MD_ASM_CLOBBERS
+   /* Sometimes we wish to automatically clobber registers across an asm.
+      Case in point is when the i386 backend moved from cc0 to a hard reg --
+      maintaining source-level compatability means automatically clobbering
+      the flags register.  */
+   MD_ASM_CLOBBERS (clobbers);
+ #endif
+ 
    /* Count the number of meaningful clobbered registers, ignoring what
       we would ignore later.  */
    nclobbers = 0;
Index: tm.texi
===================================================================
RCS file: /egcs/carton/cvsfiles/egcs/gcc/tm.texi,v
retrieving revision 1.91
diff -c -p -d -r1.91 tm.texi
*** tm.texi	1999/09/02 05:42:04	1.91
--- tm.texi	1999/09/02 20:00:40
*************** unit may not be bound to undefined symbo
*** 7713,7718 ****
--- 7713,7723 ----
  without user intervention.  For instance, under Microsoft Windows
  symbols must be explicitly imported from shared libraries (DLLs).
  
+ @findex MD_ASM_CLOBBERS
+ @item MD_ASM_CLOBBERS
+ A C statement that adds to @var{CLOBBERS} @code{STRING_CST} trees for
+ any hard regs the port wishes to automatically clobber for all asms.
+ 
  @findex ISSUE_RATE
  @item ISSUE_RATE
  A C expression that returns how many instructions can be issued at the


More information about the Gcc-patches mailing list