public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug rtl-optimization/47253] New: Conditional jump to tail function is not generated
@ 2011-01-11  0:54 zsojka at seznam dot cz
  2011-01-11  1:06 ` [Bug rtl-optimization/47253] " zsojka at seznam dot cz
                   ` (7 more replies)
  0 siblings, 8 replies; 9+ messages in thread
From: zsojka at seznam dot cz @ 2011-01-11  0:54 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=47253

           Summary: Conditional jump to tail function is not generated
           Product: gcc
           Version: 4.6.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: rtl-optimization
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: zsojka@seznam.cz
              Host: x86_64-pc-linux-gnu
            Target: x86_64-pc-linux-gnu


I hope the summary is descriptive enough.
Take the following code:

----- testcase.c -----
void bar(void);

void foo(int c)
{
    if (c) bar();
}
----------------------

With -O3, gcc generated this code:
foo:
.LFB0:
    .cfi_startproc
    test    edi, edi    # c
    jne    .L4    #,
    rep
    ret
    .p2align 4,,10
    .p2align 3
.L4:
    jmp    bar    #
    .cfi_endproc


and with -Os:
foo:
.LFB0:
    .cfi_startproc
    test    edi, edi    # c
    je    .L1    #,
    jmp    bar    #
.L1:
    ret
    .cfi_endproc


while better would be:
foo:
    test    edi, edi
    jne    .L1
    rep # only without -Os
    ret

I tested 3.3.6, 3.4.6, 4.4.5, 4.6.0, neither generates the "better" code.


^ permalink raw reply	[flat|nested] 9+ messages in thread

* [Bug rtl-optimization/47253] Conditional jump to tail function is not generated
  2011-01-11  0:54 [Bug rtl-optimization/47253] New: Conditional jump to tail function is not generated zsojka at seznam dot cz
@ 2011-01-11  1:06 ` zsojka at seznam dot cz
  2011-01-11  5:19 ` hjl.tools at gmail dot com
                   ` (6 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: zsojka at seznam dot cz @ 2011-01-11  1:06 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=47253

Zdenek Sojka <zsojka at seznam dot cz> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |missed-optimization
      Known to fail|                            |3.3.6, 3.4.6, 4.4.5, 4.6.0
           Severity|normal                      |enhancement


^ permalink raw reply	[flat|nested] 9+ messages in thread

* [Bug rtl-optimization/47253] Conditional jump to tail function is not generated
  2011-01-11  0:54 [Bug rtl-optimization/47253] New: Conditional jump to tail function is not generated zsojka at seznam dot cz
  2011-01-11  1:06 ` [Bug rtl-optimization/47253] " zsojka at seznam dot cz
@ 2011-01-11  5:19 ` hjl.tools at gmail dot com
  2011-01-11  8:37 ` zsojka at seznam dot cz
                   ` (5 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: hjl.tools at gmail dot com @ 2011-01-11  5:19 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=47253

H.J. Lu <hjl.tools at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |hjl.tools at gmail dot com

--- Comment #1 from H.J. Lu <hjl.tools at gmail dot com> 2011-01-11 03:16:32 UTC ---
(In reply to comment #0)
> I hope the summary is descriptive enough.
> Take the following code:
> 
> ----- testcase.c -----
> void bar(void);
> 
> void foo(int c)
> {
>     if (c) bar();
> }
..
> while better would be:
> foo:
>     test    edi, edi
>     jne    .L1
>     rep # only without -Os
>     ret
> 

Where is .L1?


^ permalink raw reply	[flat|nested] 9+ messages in thread

* [Bug rtl-optimization/47253] Conditional jump to tail function is not generated
  2011-01-11  0:54 [Bug rtl-optimization/47253] New: Conditional jump to tail function is not generated zsojka at seznam dot cz
  2011-01-11  1:06 ` [Bug rtl-optimization/47253] " zsojka at seznam dot cz
  2011-01-11  5:19 ` hjl.tools at gmail dot com
@ 2011-01-11  8:37 ` zsojka at seznam dot cz
  2011-01-11 13:38 ` hjl.tools at gmail dot com
                   ` (4 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: zsojka at seznam dot cz @ 2011-01-11  8:37 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=47253

--- Comment #2 from Zdenek Sojka <zsojka at seznam dot cz> 2011-01-11 07:02:14 UTC ---
(In reply to comment #1)
> 
> Where is .L1?

Thanks, it should be:

foo:
    test    edi, edi
    jne    bar
    rep # only without -Os
    ret


^ permalink raw reply	[flat|nested] 9+ messages in thread

* [Bug rtl-optimization/47253] Conditional jump to tail function is not generated
  2011-01-11  0:54 [Bug rtl-optimization/47253] New: Conditional jump to tail function is not generated zsojka at seznam dot cz
                   ` (2 preceding siblings ...)
  2011-01-11  8:37 ` zsojka at seznam dot cz
@ 2011-01-11 13:38 ` hjl.tools at gmail dot com
  2011-01-11 14:06 ` zsojka at seznam dot cz
                   ` (3 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: hjl.tools at gmail dot com @ 2011-01-11 13:38 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=47253

H.J. Lu <hjl.tools at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|                            |INVALID

--- Comment #3 from H.J. Lu <hjl.tools at gmail dot com> 2011-01-11 13:35:10 UTC ---
jne only takes 8bit displacement.


^ permalink raw reply	[flat|nested] 9+ messages in thread

* [Bug rtl-optimization/47253] Conditional jump to tail function is not generated
  2011-01-11  0:54 [Bug rtl-optimization/47253] New: Conditional jump to tail function is not generated zsojka at seznam dot cz
                   ` (3 preceding siblings ...)
  2011-01-11 13:38 ` hjl.tools at gmail dot com
@ 2011-01-11 14:06 ` zsojka at seznam dot cz
  2011-01-11 14:11 ` hjl.tools at gmail dot com
                   ` (2 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: zsojka at seznam dot cz @ 2011-01-11 14:06 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=47253

Zdenek Sojka <zsojka at seznam dot cz> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|RESOLVED                    |UNCONFIRMED
         Resolution|INVALID                     |

--- Comment #4 from Zdenek Sojka <zsojka at seznam dot cz> 2011-01-11 14:04:13 UTC ---
(In reply to comment #3)
> jne only takes 8bit displacement.

There are two opcodes for jne - 0x75 taking 8bit displacement, and 0x0f 0x85
taking 16/32bit displacement:

(pasted from IA-32 Intel Architecture Software Developer’s Manual Volume 2:
Instruction Set Reference)

75 cb
JNE rel8
Jump short if not equal (ZF=0)

0F 85 cw/cd
JNE rel16/32
Jump near if not equal (ZF=0)


Jcc is no different from JMP, both can take 8/(16/)32bit displacement - even in
64bit mode.


^ permalink raw reply	[flat|nested] 9+ messages in thread

* [Bug rtl-optimization/47253] Conditional jump to tail function is not generated
  2011-01-11  0:54 [Bug rtl-optimization/47253] New: Conditional jump to tail function is not generated zsojka at seznam dot cz
                   ` (4 preceding siblings ...)
  2011-01-11 14:06 ` zsojka at seznam dot cz
@ 2011-01-11 14:11 ` hjl.tools at gmail dot com
  2021-08-19  3:31 ` [Bug target/47253] " pinskia at gcc dot gnu.org
  2023-05-13 17:51 ` pinskia at gcc dot gnu.org
  7 siblings, 0 replies; 9+ messages in thread
From: hjl.tools at gmail dot com @ 2011-01-11 14:11 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=47253

H.J. Lu <hjl.tools at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2011.01.11 14:09:17
     Ever Confirmed|0                           |1


^ permalink raw reply	[flat|nested] 9+ messages in thread

* [Bug target/47253] Conditional jump to tail function is not generated
  2011-01-11  0:54 [Bug rtl-optimization/47253] New: Conditional jump to tail function is not generated zsojka at seznam dot cz
                   ` (5 preceding siblings ...)
  2011-01-11 14:11 ` hjl.tools at gmail dot com
@ 2021-08-19  3:31 ` pinskia at gcc dot gnu.org
  2023-05-13 17:51 ` pinskia at gcc dot gnu.org
  7 siblings, 0 replies; 9+ messages in thread
From: pinskia at gcc dot gnu.org @ 2021-08-19  3:31 UTC (permalink / raw)
  To: gcc-bugs

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

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jay.foad at gmail dot com

--- Comment #6 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
*** Bug 60159 has been marked as a duplicate of this bug. ***

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [Bug target/47253] Conditional jump to tail function is not generated
  2011-01-11  0:54 [Bug rtl-optimization/47253] New: Conditional jump to tail function is not generated zsojka at seznam dot cz
                   ` (6 preceding siblings ...)
  2021-08-19  3:31 ` [Bug target/47253] " pinskia at gcc dot gnu.org
@ 2023-05-13 17:51 ` pinskia at gcc dot gnu.org
  7 siblings, 0 replies; 9+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-05-13 17:51 UTC (permalink / raw)
  To: gcc-bugs

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

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |chfast at gmail dot com

--- Comment #7 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
*** Bug 109844 has been marked as a duplicate of this bug. ***

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2023-05-13 17:51 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-01-11  0:54 [Bug rtl-optimization/47253] New: Conditional jump to tail function is not generated zsojka at seznam dot cz
2011-01-11  1:06 ` [Bug rtl-optimization/47253] " zsojka at seznam dot cz
2011-01-11  5:19 ` hjl.tools at gmail dot com
2011-01-11  8:37 ` zsojka at seznam dot cz
2011-01-11 13:38 ` hjl.tools at gmail dot com
2011-01-11 14:06 ` zsojka at seznam dot cz
2011-01-11 14:11 ` hjl.tools at gmail dot com
2021-08-19  3:31 ` [Bug target/47253] " pinskia at gcc dot gnu.org
2023-05-13 17:51 ` pinskia at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).