Re: optimization of switch statements on i386

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Even if I placed a call to a 'noreturn' function in the default: case,
the compiler couldn't optimize the default branch away. (It won't
produce any code to continue after the function call, but my desire is
to eliminate the test leading to the default: branch.)

Following on the original topic of discussion, how about if I use
computed gotos?

If the reasoning of gcc's developers is correct, and it's the lack of
a casesi instruction on x86 that set the minimum of arm to use a table
jump to 5, then I may be able to produce faster code for 4 arms using
computed gotos; especially since I cannot convince gcc to eliminate
the check for the default case. Do you agree with that?

 - Godmar

On Feb 11, 2008 1:47 PM, Diego Novillo <dnovillo@xxxxxxxxxx> wrote:
> On 11 Feb 2008 09:54:19 -0800, Ian Lance Taylor <iant@xxxxxxxxxx> wrote:
>
> >  gcc_unreachable means nothing special to gcc.
>
> But it does have control-flow connotations.  The function ultimately
> expands into fancy_abort, which is marked noreturn. We do use that
> fact in the optimizer.
>
>
> Diego.
>

[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux