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 target/27971] eliminate shift in array[(x>>2)&3]



------- Comment #4 from raksit at google dot com  2007-12-05 19:27 -------
For the rtl emitted on x86 processors, the combiner is almost able to optimize
the shift away. It combines and simplifies the 3 instructions down to:

Failed to match this instruction:
(set (reg:SI 64)
   (mem/s:SI (plus:SI (and:SI (reg/v:SI 59 [ x ])
               (const_int 12 [0xc]))
           (symbol_ref:SI ("array") <var_decl 0xf7ef20b0 array>)) [3
array S4 A32]))

It gives up at this point. The solution is to introduce a split to do the AND,
followed by the load. This can be done in machine-independent way by modifying
find_split_point in combine.c. Patch coming up shortly.

-raksit


-- 


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


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