This is the mail archive of the
mailing list for the GCC project.
Re: Constexpr in intrinsics?
- From: Allan Sandfeld Jensen <linux at carewolf dot com>
- To: gcc at gcc dot gnu dot org
- Cc: Marc Glisse <marc dot glisse at inria dot fr>
- Date: Mon, 28 Mar 2016 02:34:31 +0200
- Subject: Re: Constexpr in intrinsics?
- Authentication-results: sourceware.org; auth=none
- References: <201603271216 dot 24068 dot linux at carewolf dot com> <alpine dot DEB dot 2 dot 20 dot 1603271243200 dot 8127 at laptop-mg dot saclay dot inria dot fr>
On Sunday 27 March 2016, Marc Glisse wrote:
> On Sun, 27 Mar 2016, Allan Sandfeld Jensen wrote:
> > Would it be possible to add constexpr to the intrinsics headers?
> > For instance _mm_set_XX and _mm_setzero intrinsics.
> Already suggested here:
> A patch would be welcome (I started doing it at some point, I don't
> remember if it was functional, the patch is attached).
That looks very similar to the patch I experimented with, and that at least
works for using them in C++11 constexpr functions.
> > Ideally it could also be added all intrinsics that can be evaluated at
> > compile time, but it is harder to tell which those are.
> > Does gcc have a C extension we can use to set constexpr?
> What for?
To have similar functionality in C. For instance to explicitly allow those
functions to be evaluated at compile time, and values with similar attributes
be optimized completely out. And of course avoid using precompiler noise, in
shared C/C++ headers like these are.