core.intrinsics

Guillaume Piolat via Digitalmars-d digitalmars-d at puremagic.com
Fri Oct 14 05:55:17 PDT 2016


On Friday, 14 October 2016 at 11:51:32 UTC, Johan Engelen wrote:
> On Friday, 14 October 2016 at 11:17:55 UTC, Andrei Alexandrescu 
> wrote:
>> On 10/14/2016 05:24 AM, Johan Engelen wrote:
>>> I like "hints".
>>
>> How many other hints are out there? -- Andrei
>
> Things that come to mind:
> - this value is probably X  (bool, int, pointer)
> - this type is probably Y
> - this function is likely hot/cold (UDA)
> - this data is likely to be accessed soon (_could_ lead to a 
> prefetch)
> - this member field is hot/cold (iirc, Class members may be 
> re-ordered) (UDA)

- this pointer is aligned to N bytes
- this pointer doesn't alias with this pointer

There are also loop hints:

- this loop has no loop dependency, go wild auto-vectorizer!
- this loop is better unrolled by N

These hints are all dangerous. Manual prefetching, manual branch 
hints, forced unrolling count: I've seen those 3 hints reduce 
performance by being worse than the processor/compiler.



More information about the Digitalmars-d mailing list