SIMD/intrinsincs questions
Don
nospam at nospam.com
Tue Nov 10 02:41:57 PST 2009
Walter Bright wrote:
> Don wrote:
>> The bad news: The DMD back-end is a state-of-the-art backend from the
>> late 90's. Despite its age, its treatment of integer operations is, in
>> general, still quite respectable.
>
> Modern compilers don't do much better. The point of diminishing returns
> was clearly reached.
Yup. The only integer operation modern compilers still don't do well is
-- array operations!
>> However, it _never_ generates SSE instructions. Ever. However, array
>> operations _are_ detected, and they become to calls to library
>> functions which use SSE if available. That's not bad for moderately
>> large arrays -- 200 elements or so -- but of course it's completely
>> non-optimal for short arrays.
>>
>> The good news: Now that static arrays are passed by value, introducing
>> inline SSE support for short arrays suddenly makes a lot of sense --
>> there can be a big performance benefit for a small backend change; it
>> could be done without introducing SSE anywhere else. Most importantly,
>> it doesn't require any auto-vectorisation support.
>
> What the library functions also do is have a runtime switch based on the
> capabilities of the processor, switching to operations tailored to that
> processor. To generate the code directly, assuming the existence of SSE,
> is to mean the code will only run on modern chips. Whether or not this
> is a problem depends on your application.
I'd say it's not a problem to use MMX or even SSE1. It's really, really
difficult to find a processor that doesn't support them. I've tried.
I've really tried. I don't think many are still around: they all have
motherboards which require really small hard disks that you can no
longer buy. Certainly no-one is putting new software on them.
Earlier this year I had to install Windows3.1 (!!!) on an ancient PC at
work, to support an ancient but expensive bit of lab equipment. Even it
was a Pentium II. Getting the spare parts for it was a nightmare*; we
had to ship them from 600km away. Hard disks just don't last that long.
SSE2 is a different story, since AMD never made a 32 bit CPU with SSE2.
*Actually it was more of a horror comedy. It was hard to take it seriously.
More information about the Digitalmars-d
mailing list