This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH] Assorted -masm=intel fixes (PR target/85281)
- From: "Jan Beulich" <jbeulich at suse dot com>
- To: <hjl dot tools at gmail dot com>,<jakub at redhat dot com>
- Cc: <gcc-patches at gcc dot gnu dot org>,<kirill dot yukhin at gmail dot com>, <ubizjak at gmail dot com>
- Date: Mon, 09 Apr 2018 23:50:14 -0600
- Subject: Re: [PATCH] Assorted -masm=intel fixes (PR target/85281)
- References: <20180409183702.GX8577@tucnak> <CAMe9rOp+1AEzi5P5_zq8F4VqRGDZ5a_0CG3Udzf0zACnh1NeYw@mail.gmail.com>
>>> "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