Operating System - OpenVMS
Showing results for 
Search instead for 
Did you mean: 

Does "MISALGNDSTRCT" affect CPU performance

John Reagan
Respected Contributor

Re: Does "MISALGNDSTRCT" affect CPU performance

Yes, your example generates alignment faults and does NOT generate "MISALGNDSTRCT" messages.

FYI: here is where the code lies to the compiler:

p = (genlink *)(((char *)(&base[i])) + offset);

My point is that the OP asked about the compiler message and everybody jumped to alignment faults.

The message essentially means: "the compiler generated 4 or 5 instructions instead of a single instruction".

How much does that cost? Depends on how often you execute it. The first memory load will probably pull all the data into the cache so the others will be faster. The compiler will probably have to use a temp register for the shift/mask operations. However, the memory fetch overshadows the whole mess. So how much slower? I'll guess 15% with a 50/50 confidence factor.
Jean-François Piéronne
Trusted Contributor

Re: Does "MISALGNDSTRCT" affect CPU performance

Ok but the test execute pass where it lie to the compiler and pass where it not using the "__unaligned" option.
In this case the cost is 15% as you have expected (last stat of the run).