64-bit and SSE
Don
nospam at nospam.com
Wed Mar 3 06:07:35 PST 2010
Rainer Deyke wrote:
> On 3/2/2010 14:28, Don wrote:
>> retard wrote:
>>> Why not dynamic code path selection:
>>>
>>> if (cpu_capabilities && SSE4_2)
>>> run_fast_method();
>>> else if (cpu_capabilities && SSE2)
>>> run_medium_fast_method();
>>> else
>>> run_slow_method();
>>>
>>> One could also use higher level design patterns like abstract
>>> factories here.
>> The method needs to be fairly large for that to be beneficial. For
>> fine-grained stuff, like basic operations on 3D vectors, it doesn't work
>> at all. And that's one of the primary use cases for SSE.
>
> Why not do it at the largest possible level of granularity?
>
> int main() {
> if (cpu_capabilities && SSE4_2) {
> return run_fast_main();
> } else if (cpu_capabilities && SSE2) {
> return run_medium_fast_main();
> } else {
> return run_slow_main();
> }
> }
>
> The compiler should be able to do this automatically by compiling every
> single function in the program N times with N different code generation
> setting. Executable size will skyrocket, but it won't matter because
> executable size is rarely a significant concern.
I don't think that ever makes sense. I'd just compile multiple
executables with different settings, and select which one to use at
install time.
More information about the Digitalmars-d
mailing list