On Fri, 3 Jan 2014, Jakub Jelinek wrote:

> I've noticed that especially with the AVX512F introduction we use
> GET_MODE_SIZE (<MODE>mode) quite heavily in the i386 *.md files, and
> the problem with that is GET_MODE_SIZE isn't a compile time constant,
> needs to read mode_size array (non-const) at runtime.

It would seem better to me for genmodes to generate appropriate macro / 
inline function definitions that can be used by GET_MODE_SIZE (along the 
lines of (__builtin_constant_p (MODE) && !mode_size_variable (MODE) ? 
get_mode_size_constant (MODE) : (unsigned short) mode_size[MODE]), where 
mode_size_variable and get_mode_size_constant are always_inline functions 
generated by genmodes) - that way all targets are covered automatically, 
without needing such duplication of mode sizes.  (Of course such 
optimizations wouldn't apply for a first-stage compiler bootstrapped by a 
compiler not supporting __builtin_constant_p, but lack of optimization in 
the first stage of a bootstrap is not a particular concern.)

-- 
Joseph S. Myers
jos...@codesourcery.com

Reply via email to