1 --- gcc-3.4.0/gcc/config/arm/arm.md.arm-ldm-peephole 2004-01-13 08:24:37.000000000 -0500
2 +++ gcc-3.4.0/gcc/config/arm/arm.md 2004-04-24 18:18:04.000000000 -0400
3 @@ -8810,13 +8810,16 @@
4 (set_attr "length" "4,8,8")]
7 +; Try to convert LDR+LDR+arith into [add+]LDM+arith
8 +; On XScale, LDM is always slower than two LDRs, so only do this if
9 +; optimising for size.
10 (define_insn "*arith_adjacentmem"
11 [(set (match_operand:SI 0 "s_register_operand" "=r")
12 (match_operator:SI 1 "shiftable_operator"
13 [(match_operand:SI 2 "memory_operand" "m")
14 (match_operand:SI 3 "memory_operand" "m")]))
15 (clobber (match_scratch:SI 4 "=r"))]
16 - "TARGET_ARM && adjacent_mem_locations (operands[2], operands[3])"
17 + "TARGET_ARM && (!arm_tune_xscale || optimize_size) && adjacent_mem_locations (operands[2], operands[3])"
25 + /* This would be a loss on a Harvard core, but adjacent_mem_locations()
26 + will prevent it from happening. */
28 ldm[0] = ops[0] = operands[4];
29 ops[1] = XEXP (XEXP (operands[2], 0), 0);
30 --- gcc-3.4.0/gcc/config/arm/arm.c.arm-ldm-peephole 2004-04-24 18:16:25.000000000 -0400
31 +++ gcc-3.4.0/gcc/config/arm/arm.c 2004-04-24 18:18:04.000000000 -0400
32 @@ -4593,8 +4593,11 @@
33 arith_adjacentmem pattern to output an overlong sequence. */
34 if (!const_ok_for_op (PLUS, val0) || !const_ok_for_op (PLUS, val1))
37 - return (reg0 == reg1) && ((val1 - val0) == 4 || (val0 - val1) == 4);
39 + /* For Harvard cores, only accept pairs where one offset is zero.
40 + See comment in load_multiple_sequence. */
41 + return (reg0 == reg1) && ((val1 - val0) == 4 || (val0 - val1) == 4)
42 + && (!arm_ld_sched || val0 == 0 || val1 == 0);
46 @@ -4838,6 +4841,11 @@
47 *load_offset = unsorted_offsets[order[0]];
50 + /* For XScale a two-word LDM is a performance loss, so only do this if
51 + size is more important. See comments in arm_gen_load_multiple. */
52 + if (nops == 2 && arm_tune_xscale && !optimize_size)
55 if (unsorted_offsets[order[0]] == 0)
58 @@ -5064,6 +5072,11 @@
59 *load_offset = unsorted_offsets[order[0]];
62 + /* For XScale a two-word LDM is a performance loss, so only do this if
63 + size is more important. See comments in arm_gen_load_multiple. */
64 + if (nops == 2 && arm_tune_xscale && !optimize_size)
67 if (unsorted_offsets[order[0]] == 0)
70 --- gcc-3.4.0/gcc/genpeep.c.arm-ldm-peephole 2003-07-05 01:27:22.000000000 -0400
71 +++ gcc-3.4.0/gcc/genpeep.c 2004-04-24 18:18:04.000000000 -0400
73 printf ("#include \"recog.h\"\n");
74 printf ("#include \"except.h\"\n\n");
75 printf ("#include \"function.h\"\n\n");
76 + printf ("#include \"flags.h\"\n\n");
78 printf ("#ifdef HAVE_peephole\n");
79 printf ("extern rtx peep_operand[];\n\n");