On Thu, Oct 23, 2014 at 11:06:24AM -0700, Andrew Pinski wrote: > On Thu, Oct 23, 2014 at 11:00 AM, Andrew Pinski <pins...@gmail.com> wrote: > > On Thu, Oct 23, 2014 at 10:52 AM, Charles Baylis > > <charles.bay...@linaro.org> wrote: > >> Hi > >> > >> ( tl;dr: How do I handle intrinsic or builtin functions where there > >> are restrictions on the arguments which can't be represented in a C > >> function prototype? Do other ports have this problem, how do they > >> solve it? Language extension for C++98 to provide static_assert?) > > > > The attribute __artificial__ . > > Long example: > extern __inline void __attribute__((__gnu_inline__, __always_inline__, > __artificial__)) > _mm_stream_sd (double * __P, __m128d __Y) > { > __builtin_ia32_movntsd (__P, (__v2df) __Y); > } > > Don't use static inline either because it is not valid thing to do > from a template in C++98.
And the argument checking (compile time constant, what range etc.) can be done either when expanding the builtin, or when folding it (there are target hooks for both generic and gimple foldings of builtin), you can report it in either of those (and fold to constant or similar if there are errors). Jakub