This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug target/27971] eliminate shift in array[(x>>2)&3]
- From: "pinskia at gcc dot gnu dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 9 Jun 2006 06:20:00 -0000
- Subject: [Bug target/27971] eliminate shift in array[(x>>2)&3]
- References: <bug-27971-5748@http.gcc.gnu.org/bugzilla/>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Comment #2 from pinskia at gcc dot gnu dot org 2006-06-09 06:20 -------
Here is the RTL we get on PPC:
(insn 6 9 7 2 (set (reg/v:SI 120 [ x ])
(reg:SI 3 r3 [ x ])) 327 {*movsi_internal1} (nil)
(expr_list:REG_DEAD (reg:SI 3 r3 [ x ])
(expr_list:REG_EQUIV (mem/c/i:SI (plus:SI (reg/f:SI 67 ap)
(const_int 24 [0x18])) [4 x+0 S4 A32])
(nil))))
...
(insn 13 12 14 2 (set (reg:SI 124)
(lshiftrt:SI (reg/v:SI 120 [ x ])
(const_int 2 [0x2]))) 195 {lshrsi3_no_power}
(insn_list:REG_DEP_TRUE 6 (nil))
(expr_list:REG_DEAD (reg/v:SI 120 [ x ])
(nil)))
(insn 14 13 15 2 (parallel [
(set (reg:SI 125)
(and:SI (reg:SI 124)
(const_int 3 [0x3])))
(clobber (scratch:CC))
]) 146 {andsi3} (insn_list:REG_DEP_TRUE 13 (nil))
(expr_list:REG_DEAD (reg:SI 124)
(expr_list:REG_UNUSED (scratch:CC)
(nil))))
(insn 15 14 17 2 (set (reg:SI 126)
(ashift:SI (reg:SI 125)
(const_int 2 [0x2]))) 189 {ashlsi3_no_power}
(insn_list:REG_DEP_TRUE 14 (nil))
(expr_list:REG_DEAD (reg:SI 125)
(nil)))
Which gets reduced to:
(insn 15 14 17 2 (parallel [
(set (reg:SI 126)
(and:SI (reg:SI 3 r3 [ x ])
(const_int 12 [0xc])))
(clobber (scratch:CC))
]) 146 {andsi3} (nil)
(expr_list:REG_UNUSED (scratch:CC)
(expr_list:REG_DEAD (reg:SI 3 r3 [ x ])
(nil))))
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=27971