avx register variables

View: New views
4 Messages — Rating Filter:   Alert me  

avx register variables

by Gábor Buella :: Rate this Message:

| View Threaded | Show Only this Message

Hello,

With gcc 4.7, on Intel 64 I have trouble using avx register global variables:

register unsigned int something __asm__("xmm2") __attribute__
((__vector_size__ (16)));

works fine, but

register unsigned int something __asm__("ymm2") __attribute__
((__vector_size__ (32)));

results in "error: invalid register name for something"

Is it at all possible to use the YMM registers as variables? If yes, how?

ps the ralated builtin functions are recognized, -mavx argument used.

- Gabor

Re: avx register variables

by Marc Glisse-6 :: Rate this Message:

| View Threaded | Show Only this Message

On Sat, 2 Jun 2012, Gábor Buella wrote:

> Hello,
>
> With gcc 4.7, on Intel 64 I have trouble using avx register global variables:
>
> register unsigned int something __asm__("xmm2") __attribute__
> ((__vector_size__ (16)));
>
> works fine, but
>
> register unsigned int something __asm__("ymm2") __attribute__
> ((__vector_size__ (32)));
>
> results in "error: invalid register name for something"
>
> Is it at all possible to use the YMM registers as variables? If yes, how?

Did you try calling it "xmm2"?

--
Marc Glisse

Re: avx register variables

by Gábor Buella :: Rate this Message:

| View Threaded | Show Only this Message

Thank you,
Now I tried

register unsigned int something __asm__("xmm2") __attribute__
((__vector_size__ (32)));

It seems to work, and also found out, that if I use -mno-vzeroupper ,
I wont always lose the upper bits.

BTW, I'm no expert in assembly at all, I can't figure out why is it
XMM , why not YMM ?

Gabor

On Sat, Jun 2, 2012 at 8:49 PM, Marc Glisse <marc.glisse@...> wrote:

> On Sat, 2 Jun 2012, Gábor Buella wrote:
>
>> Hello,
>>
>> With gcc 4.7, on Intel 64 I have trouble using avx register global
>> variables:
>>
>> register unsigned int something __asm__("xmm2") __attribute__
>> ((__vector_size__ (16)));
>>
>> works fine, but
>>
>> register unsigned int something __asm__("ymm2") __attribute__
>> ((__vector_size__ (32)));
>>
>> results in "error: invalid register name for something"
>>
>> Is it at all possible to use the YMM registers as variables? If yes, how?
>
>
> Did you try calling it "xmm2"?
>
> --
> Marc Glisse

Re: avx register variables

by Ian Lance Taylor-3 :: Rate this Message:

| View Threaded | Show Only this Message

Gábor Buella <gbuella@...> writes:

> register unsigned int something __asm__("xmm2") __attribute__
> ((__vector_size__ (32)));
>
> It seems to work, and also found out, that if I use -mno-vzeroupper ,
> I wont always lose the upper bits.
>
> BTW, I'm no expert in assembly at all, I can't figure out why is it
> XMM , why not YMM ?

Well, they are the same registers, after all.

Still, GCC ought to accept the YMM names.  Please file a bug report at
http://gcc.gnu.org/bugzilla/ for this.  Thanks.

Ian