Maybe comments at the insn pattern who emit "rep\; ret" can explain it:
";; Used by x86_machine_dependent_reorg to avoid penalty on single byte RET
;; instruction Athlon and K8 have." 

Thanks - Joey

-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Etienne Lorrain
Sent: 2008年12月4日 18:31
To: gcc@gcc.gnu.org
Subject: ia32 gcc-Debian 4.3.2-1 "rep ret" ?


 Hello,

 I did not find any documentation of a "rep ret" instruction, at
http://www.intel.com/design/processor/manuals/253667.pdf
 they just say: "The behavior of the REP prefix is undefined when used with 
non-strings instructions".

 Any pointers?
 Thanks,
 Etienne.

etienne:~$ gcc --version
gcc (Debian 4.3.2-1) 4.3.2
Copyright (C) 2008 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

etienne:~$ cat tmp.c
void fct2(int);

void fct (int i, int a)
{
        a *= 2;
        if (i == 2)
                fct2(a);
}
etienne:~$ gcc -O2 -fomit-frame-pointer -S tmp.c -o tmp.s
etienne:~$ cat tmp.s
        .file   "tmp.c"
        .text
        .p2align 4,,15
.globl fct
        .type   fct, @function
fct:
        cmpl    $2, 4(%esp)
        movl    8(%esp), %eax
        je      .L5
        rep
        ret
        .p2align 4,,7
        .p2align 3
.L5:
        addl    %eax, %eax
        movl    %eax, 4(%esp)
        jmp     fct2
        .size   fct, .-fct
        .ident  "GCC: (Debian 4.3.2-1) 4.3.2"
        .section        .note.GNU-stack,"",@progbits
etienne:~$




Reply via email to