This is the mail archive of the gcc-patches@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: [PATCH] Assorted -masm=intel fixes (PR target/85281)


>>> "H.J. Lu" <hjl.tools@gmail.com> 04/09/18 9:09 PM >>>
>On Mon, Apr 9, 2018 at 11:37 AM, Jakub Jelinek <jakub@redhat.com> wrote:
>> BTW, -masm=intel seems to be in quite bad shape even in the assembler, in
>> various testcases I'm getting errors like on the following reduced one:
>> int k1, xmm0;
>> int foo (void) { return k1; }
>> int bar (void) { return xmm0; }
>> gcc -masm=intel -O2
>> /tmp/cch0mo1K.s: Assembler messages:
>> /tmp/cch0mo1K.s:10: Error: invalid use of register
>> /tmp/cch0mo1K.s:21: Error: invalid use of register
>> As ICC generates the same assembly on the instructions:
>>         mov     eax, DWORD PTR k1[rip]
>> ...
>>         mov     eax, DWORD PTR xmm0[rip]
>> I think either the intel syntax spec is faulty, or gas is buggy and should
>> figure out that after *WORD PTR and before [ there is symbol rather than
>> register name.  Some testcases e.g. have k1 as function name and that
>> results in other asm errors (about .size directive).
>
>How does Intel syntax support symbols like eax, k1 and xmm0 with
>".intel_syntax noprefix"?

I've noticed this problem about two weeks ago as well, and have a patch
mostly ready (but need to get around to both produce a proper testcase
and regression test the whole thing); that won't be until in a couple of
weeks time, though - if you think this is needed earlier, I can hand you
the fragments I have. As an aside - you realize this isn't an Intel syntax
only issue, as "noprefix" can as well be specified with .att_syntax.

I should note though that the fix won't go as far a Jakub suggests: Context
doesn't matter for recognizing whether a symbol is a register. For something
like the above to compile, .arch would need to be used to disable the
respective register groups (e.g. .arch .noavx512f to make k1 an ordinary
symbol).

Jan


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