public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug middle-end/38740]  New: Incorrect delayed branch optimization
@ 2009-01-06  4:25 danglin at gcc dot gnu dot org
  2009-01-06  4:27 ` [Bug middle-end/38740] " dave at hiauly1 dot hia dot nrc dot ca
                   ` (18 more replies)
  0 siblings, 19 replies; 20+ messages in thread
From: danglin at gcc dot gnu dot org @ 2009-01-06  4:25 UTC (permalink / raw)
  To: gcc-bugs

.L1018:
        ldi 1105,%r19
        cmpb,= %r19,%r28,.L1015
        ldw 48(%r3),%r28
        cmpb,<< %r19,%r28,.L1019
        ldi 1104,%r19

The "ldw 48(%r3),%r28" instruction placed in the delay slot of the preceding
cmpb instruction clobbers %r28 and the following cmpb fails if the first
branch is not taken.

The above code snippet is from lzma.  The compilation command is:

g++ -DHAVE_CONFIG_H -I. -I../../../../../../src/sdk/7zip/Compress/LZMA
-I../../../../..    -DCOMPRESS_MF_BT -DCOMPRESS_MF_BT4 -DCOMPRESS_MF_HC -O0
-march=2.0 -g -fdelayed-branch -MT LZMAEncoder.o -MD -MP -MF
.deps/LZMAEncoder.Tpo -S -o LZMAEncoder.s
../../../../../../src/sdk/7zip/Compress/LZMA/LZMAEncoder.cpp -da

This is the rtl from LZMAEncoder.cpp.199r.barriers:

(insn 36 453 37
../../../../../../src/sdk/7zip/Compress/LZMA/LZMAEncoder.cpp:381 (set (reg:SI
19 %r19 [140])
        (const_int 1105 [0x451])) 37 {*pa.md:2552} (nil))

(jump_insn 37 36 454
../../../../../../src/sdk/7zip/Compress/LZMA/LZMAEncoder.cpp:381 (set (pc)
        (if_then_else (eq (reg:SI 28 %r28 [orig:124 D.7781 ] [124])
                (reg:SI 19 %r19 [140]))
            (label_ref 124)
            (pc))) 25 {*pa.md:1780} (nil))

(note 454 37 38 [bb 10] NOTE_INSN_BASIC_BLOCK)

(insn 38 454 39
../../../../../../src/sdk/7zip/Compress/LZMA/LZMAEncoder.cpp:381 (set (reg:SI
19 %r19 [141])
        (const_int 1105 [0x451])) 37 {*pa.md:2552} (nil))

(jump_insn 39 38 455
../../../../../../src/sdk/7zip/Compress/LZMA/LZMAEncoder.cpp:381 (set (pc)
        (if_then_else (gtu (reg:SI 28 %r28 [orig:124 D.7781 ] [124])
                (reg:SI 19 %r19 [141]))
            (label_ref 44)
            (pc))) 25 {*pa.md:1780} (nil))

This is the rtl from LZMAEncoder.cpp.200r.dbr:

(insn 36 453 655
../../../../../../src/sdk/7zip/Compress/LZMA/LZMAEncoder.cpp:38
1 (set (reg:SI 19 %r19 [140])
        (const_int 1105 [0x451])) 37 {*pa.md:2552} (nil))
(insn 655 36 454
../../../../../../src/sdk/7zip/Compress/LZMA/LZMAEncoder.cpp:381 (sequence [
            (jump_insn 37 36 126
../../../../../../src/sdk/7zip/Compress/LZMA/LZ
MAEncoder.cpp:381 (set (pc)
                    (if_then_else (eq (reg:SI 28 %r28 [orig:124 D.7781 ] [124])
                            (reg:SI 19 %r19 [140]))                       
(label_ref 124)
                        (pc))) 25 {*pa.md:1780} (expr_list:REG_BR_PRED
(const_in
t 17 [0x11])
                    (nil)))
            (insn/s 126 37 454 (set (reg/f:SI 28 %r28 [177])                   
(mem/f/c/i:SI (plus:SI (reg/f:SI 3 %r3)
                            (const_int 48 [0x30])) [0 prop+0 S4 A64])) 37
{*pa.m
d:2552} (nil))
        ]) -1 (nil))

(note 454 655 657 [bb 10] NOTE_INSN_BASIC_BLOCK)

(insn 657 454 455
../../../../../../src/sdk/7zip/Compress/LZMA/LZMAEncoder.cpp:381 (sequence [
            (jump_insn 39 454 40
../../../../../../src/sdk/7zip/Compress/LZMA/LZMAEncoder.cpp:381 (set (pc)
                    (if_then_else (gtu (reg:SI 28 %r28 [orig:124 D.7781 ]
[124])
                            (reg:SI 19 %r19 [141]))
                        (label_ref 44)
                        (pc))) 25 {*pa.md:1780} (expr_list:REG_BR_PRED
(const_int 17 [0x11])
                    (nil)))
            (insn 40 39 455 (set (reg:SI 19 %r19 [142])
                    (const_int 1104 [0x450])) 37 {*pa.md:2552} (nil))
        ]) -1 (nil))


-- 
           Summary: Incorrect delayed branch optimization
           Product: gcc
           Version: 4.4.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: middle-end
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: danglin at gcc dot gnu dot org
 GCC build triplet: hppa-unknown-linux-gnu
  GCC host triplet: hppa-unknown-linux-gnu
GCC target triplet: hppa-unknown-linux-gnu


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


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

end of thread, other threads:[~2009-01-29 13:05 UTC | newest]

Thread overview: 20+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-01-06  4:25 [Bug middle-end/38740] New: Incorrect delayed branch optimization danglin at gcc dot gnu dot org
2009-01-06  4:27 ` [Bug middle-end/38740] " dave at hiauly1 dot hia dot nrc dot ca
2009-01-06 13:24 ` ebotcazou at gcc dot gnu dot org
2009-01-06 13:27 ` [Bug rtl-optimization/38740] " ebotcazou at gcc dot gnu dot org
2009-01-06 14:57 ` dave at hiauly1 dot hia dot nrc dot ca
2009-01-07 17:27 ` dave at hiauly1 dot hia dot nrc dot ca
2009-01-08  4:15 ` [Bug rtl-optimization/38740] [4.4 Regression] " danglin at gcc dot gnu dot org
2009-01-12 15:02 ` carlos at systemhalted dot org
2009-01-12 18:01 ` dave at hiauly1 dot hia dot nrc dot ca
2009-01-17 22:34 ` danglin at gcc dot gnu dot org
2009-01-18 23:02 ` dave at hiauly1 dot hia dot nrc dot ca
2009-01-23 16:23 ` rguenth at gcc dot gnu dot org
2009-01-25 17:54 ` rguenth at gcc dot gnu dot org
2009-01-25 18:02 ` ebotcazou at gcc dot gnu dot org
2009-01-28 13:34 ` jakub at gcc dot gnu dot org
2009-01-28 15:21 ` jakub at gcc dot gnu dot org
2009-01-28 16:06 ` jakub at gcc dot gnu dot org
2009-01-28 16:06 ` jakub at gcc dot gnu dot org
2009-01-28 18:20 ` vapier at gentoo dot org
2009-01-29 13:05 ` danglin at gcc dot gnu dot 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).