This is the mail archive of the gcc-help@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]
Other format: [Raw text]

Re: optimization of switch statements on i386


"Godmar Back" <godmar@gmail.com> writes:

> 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?

Given the branch prediction cache and out-of-order execution of modern
x86 processors, it's unlikely that you'll see much or any speedup.
But the only way to know for sure is to measure the execution time of
the code.

Ian


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