gcc and xgetbv
Michael Dickens
michaelld at macports.org
Fri Jan 25 05:50:30 PST 2013
On Jan 24, 2013, at 10:02 PM, Michael Dickens <michaelld at macports.org>
wrote:
> I've been told, and a quick internet search ("xgetbv") agrees, that the following code snippet should be appropriate to use for GCC >= 4.4:
>
> {{{
> #if __GNUC__ > 4 || __GNUC__ == 4 && __GNUC_MINOR__ >= 4
> static inline unsigned long long _xgetbv(unsigned int index){
> unsigned int eax, edx;
> __asm__ __volatile__("xgetbv" : "=a"(eax), "=d"(edx) : "c"(index));
> return ((unsigned long long)edx << 32) | eax;
> }
> #else
> #define _xgetbv() 0
> #endif
> }}}
>
> but, this code does not compile using MacPorts' gcc 4.7; it errors out with "no such instruction: `xgetbv'".
Maybe the answer is still found in this thread from a couple years back?
<
http://lists.macosforge.org/pipermail/macports-dev/2011-October/016335.html
>
On Oct 3, 2011, at 3:50 PM, vincent habchi <vince at macports.org> wrote:
> Ok, finally I figured out a way to compile AVX instructions. But it is somewhat crooked. The old ‘as’ assembler in /usr/bin/as must be discarded and replaced by this script, that uses the clang assembler:
More information about the macports-dev
mailing list