This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Restricting arguments to intrinsic functions


On Thu, Oct 23, 2014 at 11:06:24AM -0700, Andrew Pinski wrote:
> On Thu, Oct 23, 2014 at 11:00 AM, Andrew Pinski <pinskia@gmail.com> wrote:
> > On Thu, Oct 23, 2014 at 10:52 AM, Charles Baylis
> > <charles.baylis@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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]