optimization/966: snapshots slower than 2.95.2 on i386 on this code

dana@boi.hp.com dana@boi.hp.com
Sat Dec 2 21:16:00 GMT 2000


>Number:         966
>Category:       optimization
>Synopsis:       snapshots slower than 2.95.2 on i386 on this code
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          pessimizes-code
>Submitter-Id:   net
>Arrival-Date:   Sat Dec 02 21:16:01 PST 2000
>Closed-Date:
>Last-Modified:
>Originator:     Dana Jacobsen
>Release:        gcc version 2.97 20001126
>Organization:
>Environment:
i386, Linux 2.2.14 (Red Hat 6.2)
>Description:
I have noticed that a portion of our code is now 4x slower on i386 with the snapshot gcc than with 2.95.2.
This is a severely cut down portion, and does not seem to be the whole problem (it shows a 1.5x to 2x slowdown), but one thing at a time.
I see this behavior relative to 2.95.2 in the latest snapshot (20001126) as well as a fairly old one (20000222).

Also, the pessimization occurs at all optimization levels: -O0, -O1, -O2, and -O3.
>How-To-Repeat:

#define DO_CALC(n, r, v, d)      \
 ( (  r & (                      \
  ( v&(  ( d&(0-  (n>>7)    ))   \
       | (~d&(0- ((n>>6)&1) )))) \
  |                              \
  (~v&(  ( d&(0- ((n>>5)&1) ))   \
       | (~d&(0- ((n>>4)&1) )))) \
 ) ) )

int main(void)
{
   unsigned char dest[1000];
   unsigned char dval;
   int i, j;

   for (j = 0; j < 1000000; j++) {
      for (i = 0; i < 100; i++) {
         dval = DO_CALC(i, i, 0xFF, dest[i]);
         dest[i] = dval;
      }
   }
}
>Fix:

>Release-Note:
>Audit-Trail:
>Unformatted:


More information about the Gcc-prs mailing list