core.intrinsics

Johan Engelen via Digitalmars-d digitalmars-d at puremagic.com
Fri Oct 14 02:24:17 PDT 2016


On Friday, 14 October 2016 at 04:49:30 UTC, Stefan Koch wrote:
> On Friday, 14 October 2016 at 04:44:46 UTC, Patrick Schluter 
> wrote:
>>
>> core.hints
>>
>> short and simple
>
> core.hints ?
> That sounds to weak.

I like "hints". It's immediately clear that the functions don't 
do anything and don't change the meaning of your program, they 
are just hints.

> If I tell the compiler to group function a and function b 
> together and position them as close as possible to each other 
> it damn well better do it.
> Because If I went trough the trouble of determining that this 
> has to be done.
> I want to use that knowledge.

What you want is much more than what triggered this discussion.
I think for grouping functions, you'll have to fight with the 
linker.

If you tell the compiler to expect "true" for a certain bool 
expression, it can try to find a better "polarity" of cmp-jmp 
code. Note that expected values can propagate. If you force it to 
use one polarity or another, I think very quickly you'll end up 
having to rewrite your hints when slightly change function 
control-flow, e.g. by adding an if-statement that makes it more 
profitable to invert the polarity compared to what it was before.



More information about the Digitalmars-d mailing list