This is the mail archive of the gcc-bugs@gcc.gnu.org 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]

[Bug rtl-optimization/49799] gcc arm generates illegal sbfx instruction


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

--- Comment #8 from Carrot <carrot at google dot com> 2011-07-26 02:51:39 UTC ---
(In reply to comment #7)
> No, you miss the point.
> 
> Internally we must not generate (ashift (reg) (const_int)) where the const is
> negative.
> 
> Note that your testcasegenerates a reg shift.

There is no (ashift (reg) (const_int -1)) generated before combine. After
expand, I got:

(insn 6 5 7 3 (set (reg:SI 144)
        (plus:SI (reg/v:SI 141 [ tmp ])
            (const_int -1 [0xffffffffffffffff]))) auto_corr_to_refl_coef.i:7 -1
     (nil))

(insn 7 6 8 3 (set (reg/v:SI 134 [ tmp ])
        (zero_extend:SI (subreg:HI (reg:SI 144) 0)))
auto_corr_to_refl_coef.i:16 -1
     (nil))

(insn 8 7 9 3 (set (reg:SI 145)
        (sign_extend:SI (mem:HI (reg/v/f:SI 143 [ K ]) [2 *K_2(D)+0 S2 A16])))
auto_corr_to_refl_coef.i:17 -1
     (nil))

(insn 9 8 10 3 (set (reg:SI 146)
        (sign_extend:SI (subreg/s/u:HI (reg/v:SI 134 [ tmp ]) 0)))
auto_corr_to_refl_coef.i:17 -1
     (nil))

(insn 10 9 11 3 (set (reg:SI 147)
        (ashift:SI (reg:SI 145)
            (reg:SI 146))) auto_corr_to_refl_coef.i:17 -1
     (nil))

(insn 11 10 12 3 (set (reg:SI 148)
        (ashiftrt:SI (reg:SI 147)
            (const_int 16 [0x10]))) auto_corr_to_refl_coef.i:17 -1
     (nil))


Note that r141 is an uninitialized reg. So after init-regs pass following insn
is prepended to the previous insn sequence

(insn 45 3 6 2 (set (reg/v:SI 141 [ tmp ])
        (const_int 0 [0])) auto_corr_to_refl_coef.i:7 -1
     (nil))


Then in combine pass the whole sequence is combined to

(insn 8 7 9 2 (set (reg:SI 145 [ *K_2(D) ])
        (sign_extend:SI (mem:HI (reg/v/f:SI 143 [ K ]) [2 *K_2(D)+0 S2 A16])))
auto_corr_to_refl_coef.i:17 166 {*arm_extendhisi2_v6}
     (nil))

(note 9 8 10 2 NOTE_INSN_DELETED)

(note 10 9 11 2 NOTE_INSN_DELETED)

(insn 11 10 13 2 (set (reg:SI 148)
        (sign_extract:SI (reg:SI 145 [ *K_2(D) ])
            (const_int 16 [0x10])
            (const_int 17 [0x11]))) auto_corr_to_refl_coef.i:17 131 {extv}
     (expr_list:REG_DEAD (reg:SI 145 [ *K_2(D) ])
        (nil)))


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