This is the mail archive of the 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: [RFC 0/6] Flags outputs for asms

On 05/08/2015 09:23 AM, Richard Henderson wrote:
On 05/07/2015 06:20 PM, H. Peter Anvin wrote:
This is a separate issue which really shouldn't have anything to do with
this, but is there a specific reason why:

void good1(int x, int y)
   _Bool pf;

   asm("cmpl %2,%1"
       : "=@ccp" (pf)
       : "r" (x), "g" (y));

   if (pf)

... ends up generating a jump to a jump?

0000000000000000 <good1>:
    0:   39 f7                   cmp    %esi,%edi
    2:   7a 0c                   jp     10 <good1+0x10>
    4:   f3 c3                   repz retq
    6:   66 2e 0f 1f 84 00 00    nopw   %cs:0x0(%rax,%rax,1)
    d:   00 00 00
   10:   e9 00 00 00 00          jmpq   15 <good1+0x15>
                         11: R_X86_64_PC32       beta-0x4
   15:   66 66 2e 0f 1f 84 00    data32 nopw %cs:0x0(%rax,%rax,1)
   1c:   00 00 00 00

Yes, the i386 backend has not implemented conditional sibcalls.  AFAIK the only
targets that have done that are ones with predication: ia64 and maybe arm32.

It could certainly be done; I've no idea off hand how difficult it might be.  I
suspect that some new code has to be written generically in order to enable it.
Kai looked at this last year, it's possible, but rather tedious to do in GCC due to the separation of JUMP_INSN vs CALL_INSN and the need to duplicate the conditional jumps as conditional sibcalls.

There's a BZ about this, I'm not sure if Kai put all his thoughts on the topic into the BZ or not.


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