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]

Re: PATCH: Fix CSE handling of COMPARE


On Monday 19 March 2001 19:55, Mark Mitchell wrote:
> This patch (apparently) fixes the ARM bootstrap problem.
>
> However, the fix caused a few tests for the optimization of
> __builtin_abs to fail on GNU/Linux.  I enhanced `fold' so that the
> tests would pass again.
>
> However, there are still going to be cases that GCC optimized before
> that are not optimized now.  Those optimizations were in general
> unsafe, so there's not much we can do, for now.
>
> While I was in the code, I added/improved the documentation a little
> bit.
>
> Bootstrapped, tested on i686-pc-linux-gnu.  Installed on the mainline
> and the branch.
>
> --
> Mark Mitchell                   mark@codesourcery.com
> CodeSourcery, LLC               http://www.codesourcery.com
>
> 2001-03-19  Mark Mitchell  <mark@codesourcery.com>
>
> 	* cse.c (find_comparison_args): Update documentation.  Fix
> 	mishandling of COMPARE operations.

Mark,

the cse part breaks linux-2.4 kernel compiles on powerpc-linux-gnu, the 
appended code fragment fails to optimize away the call to __bad_udelay.

Franz.


extern unsigned long loops_per_jiffy;
 
extern void __delay(unsigned int loops);
 
extern __inline__ void __const_udelay(unsigned int secs)
{
  unsigned int loops;
 
  __asm__("" : "=r" (loops) :
                          "r" (secs), "r" (loops_per_jiffy));
}
 
extern __inline__ void __udelay(unsigned int usecs)
{
 
          __const_udelay(usecs * 4294);
}
 
static __inline__ void wait_ms(unsigned int ms)
{
    ( (__builtin_constant_p(ms) && (ms)<=5) ?
     (__builtin_constant_p((ms)*1000)?
      (((ms)*1000) > 1000000?
       __bad_udelay():
       __const_udelay(((ms)*1000) * 4294u)) :
      __udelay((ms)*1000)) :
     (
      {
        unsigned long msec=(ms); while (msec--) (__builtin_constant_p(1000)?
                                                 ((1000) > 1000000?
                                                  __bad_udelay():
                                                  __const_udelay((1000) * 
4294u)) :
                                                 __udelay(1000));
      }
      ));
}
 
static int usb_hub_port_wait_reset(unsigned int delay)
{
  int delay_time;
 
  for (delay_time = 0; delay_time < 500; delay_time += delay)
    {
      wait_ms(delay);
    }
 
  return -1;
}


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