On Mon, Mar 17, 2014 at 10:11 AM, H.J. Lu <hjl.to...@gmail.com> wrote: > On Mon, Mar 17, 2014 at 9:52 AM, Uros Bizjak <ubiz...@gmail.com> wrote: >> On Mon, Mar 17, 2014 at 4:12 PM, H.J. Lu <hjl.to...@gmail.com> wrote: >> >>>> Patch in the bottom allows to use ymmXX and zmmXX >>>> register names in inline asm statements as well as >>>> in `register` variables definitions. >>>> >>>> New tests pass. >>>> Bootstrap pass. >>>> >>>> Is it ok for trunk? >>>> Do we need to backport it to 4.8? >>>> >>>> gcc/ >>>> * config/i386/i386.h (ADDITIONAL_REGISTER_NAMES): Add >>>> ymm and zmm register names. >>>> >>>> testsuite/ >>>> * gcc.target/i386/avx-additional-reg-names.c: New. >>>> * gcc.target/i386/avx512f-additional-reg-names.c: Ditto. >> >>> Doesn't GCC generate the same code with xmm? >>> >>>> diff --git a/gcc/testsuite/gcc.target/i386/avx512f-additional-reg-names.c >>>> b/gcc/testsuite/gcc.target/i386/avx512f-additional-reg-names.c >>>> new file mode 100644 >>>> index 0000000..1bd428a >>>> --- /dev/null >>>> +++ b/gcc/testsuite/gcc.target/i386/avx512f-additional-reg-names.c >>>> @@ -0,0 +1,9 @@ >>>> +/* { dg-do compile } */ >>>> +/* { dg-options "-mavx512f" } */ >>>> + >>>> +void foo () >>>> +{ >>>> + register int zmm_var asm ("zmm9"); >>>> + >>>> + __asm__ __volatile__("vxorpd %%zmm0, %%zmm0, %%zmm7\n" : : : "zmm7" ); >>>> +} >>> >>> Doesn't GCC generate the same code with xmm? >> >> It does, but the situation is the same as with %eax vs. %rax names. >> So, I think the patch is OK for mainline, and similar patch involving >> only %ymm names for AVX-enabled branches. >> > > If I want to write codes with asm statements which can > be compiled with GCC 4.6 and above, I will use xmm > instead of ymm. It makes ymm less attractive. >
BTW, in glibc, there are asm volatile ("vmovdqa64 %0, %%zmm0" : : "x" (zmm) : "xmm0" ); and asm volatile ("vmovdqa %0, %%ymm0" : : "x" (ymm) : "xmm0" ); -- H.J.