Hi Richard, I've recently experimented with TARGET_SHIFT_TRUNCATION_MASK macro and have posted a patch defining it for S/390. On S/390 only the least significant six bits of a shift count operand are used and I therefore expected the modulo operation in the following example to be optimized away:
long f (long t, unsigned int shift_count) { return t << (shift_count % 64); } But I understand that this optimization can't simply be added to simplify_rtx.c. The macro only applies to rtxes coming from named patterns and not to shifts emitted anywhere else in the optimization process because combine and co are currently not aware that macro exists. Because nobody is able to determine the origin of a shift rtx it would lead to wrong code performing that kind of optimization in simplify-rtx for all incoming shifts. In: http://gcc.gnu.org/ml/gcc-patches/2004-09/msg00456.html you proposed to take care of this in the 4.1 (formerly 3.6) timeframe fixing all places where shift rtxes are generated besides optabs. Is this still on your todo list? Bye, -Andreas-