------- Comment #4 from rguenth at gcc dot gnu dot org 2009-03-27 17:26 ------- The issue is that TER does not build large trees for the multiplications as the factors are used multiple times (and come from memory). Thus the expander does not see the widened multiplication and appearantly combine / lower-subreg is not able to optimize this.
I think with expand-from-SSA we could enable this optimization during expand. Simplified testcase: long long foo (int i, int j) { return (long long)i * (long long)j * (long long)i; } because we CSE (long long)i we don't optimize this case. Disabling tree-level CSE re-enables the optimizations: -fno-tree-fre -fno-tree-pre -fno-tree-dominator-opts -- rguenth at gcc dot gnu dot org changed: What |Removed |Added ---------------------------------------------------------------------------- Component|target |middle-end GCC target triplet|arm-unkown-elf |arm-unkown-elf, i?86-*-* Keywords| |missed-optimization Summary|4.1, 4.2 (possibly 4.0?) not|[4.2/4.3/4.4 Regression] not |using mulsidi3 |using mulsidi3 Target Milestone|--- |4.2.5 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=29274