Re: __ucmpdi2

From: Jeremy Higdon (jeremy@classic.engr.sgi.com)
Date: Wed Sep 20 2000 - 00:10:24 EST


On Sep 19, 8:39am, Richard Henderson wrote:
>
> On Tue, Sep 19, 2000 at 12:22:41PM +0200, Andreas Schwab wrote:
> > IMHO it's a bug in gcc that it does not inline the comparison inside the
> > switch expression, since it already does it in all other places. Perhaps
> > some problem with the patterns in the machine description.
>
> Perhaps, but without a test case it's hard to know. My guess is that
> he's using gcc 2.7.2 or something decrepit like that; I couldn't reproduce
> the problem on current source with a simple test case.

haze 334% gcc -dumpversion
egcs-2.91.66

The code is:

uint64_t
user_of___ucmpdi2(uint64_t node, uint64_t port)
{
        switch (node)
        {
        case 1:
            if (node == port)
                return 0;
            break;

        case 2: /* variation in either 59-48 or 23-0 to reflect port number */
            /*
             * 63-60, 47-0 same in node and port;
             * 59-48 is 0 in node, port # in port
             */
            if (node == (port & ~((uint64_t) 0xFFF << 48)))
                return ((port >> 56) & 0xF) | ((port >> 44) & 0xFF0);

            /*
             * 63-24 same in node and port;
             * 23-0 of port minus 23-0 of node is effective port number
             */
            if ((node & (0xFFFFFFFFFF << 24)) == (port & (0xFFFFFFFFFF << 24)))
                return (port - node) & 0x1FFFFFF;
            break;
        }
        return port;
}

In reality, the switch does a 60 bit shift right, so I can cast to a
uint, which is the right thing to do on old architectures :-), solving
the problem. I had originally thought that the problem was in all the
masks, shifts, and compares, but they are all inlined.

jeremy
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
Please read the FAQ at http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Sat Sep 23 2000 - 21:00:22 EST