The CRIS port no longer emits an addi insn for (a << N) + b, where N = {1, 2}. Trivial test-case: /* Make sure ADDI is combined and emitted successfully. See also PRXXXXX. */ /* { dg-do compile } */ /* { dg-options "-O2" } */ /* { dg-final { scan-assembler "addi" } } */ /* { dg-final { scan-assembler-not "lsl" } } */ int xyzzy (int r10, int r11) { return r11 * 4 + r10; } This insn was created and emitted for e.g. 3.2.1 A look at the combine dump shows that the cost for the individual insns is 5 for the shift (the constant counts as 1 as per cris_rtx_costs) and 4 for the add. However, the combined cost is 10, also as per cris_rtx_costs, because the insn is (perhaps wrongly) specified as (plus (mult 4 reg1) reg2) and the MULT cost is 6 as per cris_rtx_costs and the PLUS counts as 4. The way the target address cost function is called has changed, and cris_address_cost needs adjustment. Actually, it needs a rewrite, but an adjustment will do for the 4.3 and 4.4/trunk, being in stage 3. Patch in progress.
Forgot to mention that combine "simplifies" the ASHIFT to a MULT, despite not being in an address. The corresponding address mode exists, and having the same shape for both the separate insns and the addressing mode serves the purpose for the time being, but it might be seen as an RTX canonicalization bug on part of the combine pass.
...and the ASHIFT is what is incoming to combine, despite there being a multiplication in the code, all fine and by definition.
Subject: Bug 37939 Author: hp Date: Sat Nov 1 22:16:09 2008 New Revision: 141524 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=141524 Log: PR target/37939 * config/cris/cris.c (cris_rtx_costs) <MULT>: Return 0 for an ADDI operand. Modified: trunk/gcc/ChangeLog trunk/gcc/config/cris/cris.c
Subject: Bug 37939 Author: hp Date: Sat Nov 1 22:19:26 2008 New Revision: 141525 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=141525 Log: PR target/37939 * gcc.target/cris/biap.c: New test. Added: trunk/gcc/testsuite/gcc.target/cris/biap.c Modified: trunk/gcc/testsuite/ChangeLog
Subject: Bug 37939 Author: hp Date: Sat Nov 1 22:26:43 2008 New Revision: 141526 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=141526 Log: PR target/37939 * config/cris/cris.c (cris_rtx_costs) <MULT>: Return 0 for an ADDI operand. Modified: branches/gcc-4_3-branch/gcc/ChangeLog branches/gcc-4_3-branch/gcc/config/cris/cris.c
Subject: Bug 37939 Author: hp Date: Sat Nov 1 22:28:28 2008 New Revision: 141527 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=141527 Log: PR target/37939 * gcc.target/cris/biap.c: New test. Added: branches/gcc-4_3-branch/gcc/testsuite/gcc.target/cris/biap.c Modified: branches/gcc-4_3-branch/gcc/testsuite/ChangeLog
Fixed as per <http://gcc.gnu.org/ml/gcc-patches/2008-11/msg00025.html>. (I'm dropping 4.2).