https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109257

Jakub Jelinek <jakub at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |hjl.tools at gmail dot com,
                   |                            |jakub at gcc dot gnu.org,
                   |                            |jbeulich at suse dot com

--- Comment #1 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
It isn't just for sibcalls, but also for calls:
extern int (*foo) (int, int);
int bar (int a, int b) { return foo (a, b);  }
int baz (int a, int b) { foo (a, b); return 0; }
gcc emits
        jmp     [QWORD PTR foo[rip]]
and
        call    [QWORD PTR foo[rip]]
icc emits
        mov       rax, QWORD PTR foo[rip]                       #2.33
        jmp       rax                                           #2.33
and
        call      QWORD PTR foo[rip]                            #3.26
clang emits
        mov     rax, qword ptr [rip + foo]
        jmp     rax                             # TAILCALL
and
        call    qword ptr [rip + foo]
gas testsuite doesn't have any tests with the []s around the whole thing, but
accepts it the same as without those.
And on the gcc side it is hardcoded that way in lots of spots:
grep '\[[QD]\?WORD' i386.cc i386.md 
i386.cc:                    xasm = "{%p0@GOTPCREL(%%rip)|[QWORD PTR
%p0@GOTPCREL[rip]]}";
i386.cc:                    xasm = "%!jmp\t{*%p0@GOTPCREL(%%rip)|[QWORD PTR
%p0@GOTPCREL[rip]]}";
i386.cc:                    xasm = "{%p0@GOT|[DWORD PTR %p0@GOT]}";
i386.cc:                    xasm = "%!jmp\t{*%p0@GOT|[DWORD PTR %p0@GOT]}";
i386.cc:                xasm = "{%p0@GOTPCREL(%%rip)|[QWORD PTR
%p0@GOTPCREL[rip]]}";
i386.cc:                xasm = "%!call\t{*%p0@GOTPCREL(%%rip)|[QWORD PTR
%p0@GOTPCREL[rip]]}";
i386.cc:                xasm = "{%p0@GOT|[DWORD PTR %p0@GOT]}";
i386.cc:                xasm = "%!call\t{*%p0@GOT|[DWORD PTR %p0@GOT]}";
i386.md:  return "call\t{*%p3@GOT(%1)|[DWORD PTR %p3@GOT[%1]]}";
i386.md:  return "call\t{*%p2@GOTPCREL(%%rip)|[QWORD PTR %p2@GOTPCREL[rip]]}";
i386.md:  return "call\t{*%p2@GOT(%1)|[DWORD PTR %p2@GOT[%1]]}";
i386.md:  return "call\t{*%p1@GOTPCREL(%%rip)|[QWORD PTR %p1@GOTPCREL[rip]]}";
i386.md:  "call\t{*%a1@TLSCALL(%2)|[DWORD PTR [%2+%a1@TLSCALL]]}"
i386.md:  "call\t{*%a1@TLSCALL(%2)|[QWORD PTR [%2+%a1@TLSCALL]]}"
and I'm sure I'm missing some.

Reply via email to