When emit_no_conflict_block is handed these insns:

(insn 597 0 598 (set (reg:SI 405)
        (mem/i:SI (reg/f:SI 154 virtual-stack-vars) [0 x+0 S4 A32])) -1 (nil)
    (nil))

(insn 598 597 599 (parallel [
            (set (reg:SI 404)
                (ashift:SI (reg:SI 405)
                    (const_int 1 [0x1])))
            (clobber (reg:SI 147 t))
        ]) -1 (nil)
    (nil))

(insn 599 598 600 (set (reg:SI 406)
        (mem/i:SI (plus:SI (reg/f:SI 154 virtual-stack-vars)
                (const_int 4 [0x4])) [0 x+4 S4 A32])) -1 (nil)
    (nil))

(insn 600 599 601 (parallel [
            (set (subreg:SI (reg:DI 403) 4)
                (lshiftrt:SI (reg:SI 406)
                    (const_int 31 [0x1f])))
            (clobber (reg:SI 147 t))
        ]) -1 (nil)
    (nil))

(insn 601 600 602 (set (subreg:SI (reg:DI 403) 4)
        (ior:SI (subreg:SI (reg:DI 403) 4)
            (reg:SI 404))) -1 (nil)
    (nil))

(insn 602 601 603 (set (reg:SI 407)
        (mem/i:SI (reg/f:SI 154 virtual-stack-vars) [0 x+0 S4 A32])) -1 (nil)
    (nil))

(insn 603 602 604 (set (reg:SI 408)
        (const_int 0 [0x0])) -1 (nil)
    (nil))

(insn 604 603 605 (set (reg:SI 147 t)
        (gt:SI (reg:SI 408)
            (reg:SI 407))) -1 (nil)
    (nil))

(insn 605 604 0 (set (subreg:SI (reg:DI 403) 0)
        (neg:SI (reg:SI 147 t))) -1 (nil)
    (expr_list:REG_EQUAL (ashiftrt:SI (reg:SI 407)
            (const_int 31 [0x1f]))
        (nil)))

What it emits is this:

(insn 597 595 598 (set (reg:SI 405)
        (mem/i:SI (reg/f:SI 154 virtual-stack-vars) [0 x+0 S4 A32])) -1 (nil)
    (nil))

(insn 598 597 599 (parallel [
            (set (reg:SI 404)
                (ashift:SI (reg:SI 405)
                    (const_int 1 [0x1])))
            (clobber (reg:SI 147 t))
        ]) -1 (nil)
    (nil))

(insn 599 598 602 (set (reg:SI 406)
        (mem/i:SI (plus:SI (reg/f:SI 154 virtual-stack-vars)
                (const_int 4 [0x4])) [0 x+4 S4 A32])) -1 (nil)
    (nil))

(insn 602 599 603 (set (reg:SI 407)
        (mem/i:SI (reg/f:SI 154 virtual-stack-vars) [0 x+0 S4 A32])) -1 (nil)
    (nil))

(insn 603 602 604 (set (reg:SI 408)
        (const_int 0 [0x0])) -1 (nil)
    (nil))

(insn 604 603 606 (set (reg:SI 147 t)
        (gt:SI (reg:SI 408)
            (reg:SI 407))) -1 (nil)
    (nil))

(insn 606 604 600 (clobber (reg:DI 403)) -1 (nil)
    (insn_list:REG_LIBCALL 607 (nil)))

(insn 600 606 601 (parallel [
            (set (subreg:SI (reg:DI 403) 4)
                (lshiftrt:SI (reg:SI 406)
                    (const_int 31 [0x1f])))
            (clobber (reg:SI 147 t))
        ]) -1 (nil)
    (nil))

(insn 601 600 605 (set (subreg:SI (reg:DI 403) 4)
        (ior:SI (subreg:SI (reg:DI 403) 4)
            (reg:SI 404))) -1 (nil)
    (nil))

(insn 605 601 607 (set (subreg:SI (reg:DI 403) 0)
        (neg:SI (reg:SI 147 t))) -1 (nil)
    (expr_list:REG_EQUAL (ashiftrt:SI (reg:SI 407)
            (const_int 31 [0x1f]))
        (nil)))

(insn 607 605 0 (set (reg:DI 403)
        (reg:DI 403)) -1 (nil)
    (insn_list:REG_RETVAL 606 (expr_list:REG_EQUAL (ashiftrt:DI (mem/i:DI
(reg/f:SI 154 virtual-stack-vars) [0 x+0 S8 A32])
                (const_int 31 [0x1f]))
            (nil))))

Note that insn 600 clobbers the fixed register T that had been set by insn
604 and is needed in insn 605.

FWIW, 600 has been generated by lshrsi3, and 603-605 has been generated by
ashrsi3.

-- 
           Summary: emit_no_conflict_block does invalid reordering
           Product: gcc
           Version: 4.1.0
            Status: UNCONFIRMED
          Keywords: wrong-code
          Severity: normal
          Priority: P2
         Component: middle-end
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: amylaar at gcc dot gnu dot org
                CC: gcc-bugs at gcc dot gnu dot org


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

Reply via email to