[ET Trac] [Einstein Toolkit] #437: Correct autoconfiguration of restrict keyword; add support for builtin_expect

Einstein Toolkit trac-noreply at einsteintoolkit.org
Mon May 23 12:41:48 CDT 2011


#437: Correct autoconfiguration of restrict keyword; add support for
builtin_expect
-----------------------+----------------------------------------------------
 Reporter:  anonymous  |        Type:  defect
   Status:  new        |    Priority:  minor 
Milestone:             |   Component:  Cactus
  Version:             |    Keywords:        
-----------------------+----------------------------------------------------
 While experimenting with several different compilers on Hopper, I noticed
 that some compilers do not support all the ways in which the "restrict"
 keyword can be used. I updated our autoconf macro to test more cases.

 I now also think it is not worthwhile to require the compiler to support
 the array syntax for function arguments, i.e. the syntax

 void foo (double A[restrict]);

 which (essentially) declares a pointer A using array syntax. One can
 instead use the syntax

 void foo (double *restrict const A);

 which is identical in almost all respects. The PGI compiler does not seem
 to support the array syntax, and disabling support for the restrict
 keyword does not seem to be worth the cost.

 I also add support for the gcc built-in function "builtin_expect", which
 tells the compiler the value that an expression is most likely to have,
 allowing compile-time optimisations based on this heuristic, and maybe
 avoiding branch penalties at run time.

 I also enabled the (currently commented out) definitions for
 attribute(hot) and attribute(cold), which tell the compiler that a
 function is either executed very often, or very rarely. This can also
 influence the optimiser.

 I attach a patch.

-- 
Ticket URL: <https://trac.einsteintoolkit.org/ticket/437>
Einstein Toolkit <http://einsteintoolkit.org>
The Einstein Toolkit


More information about the Trac mailing list