yann@1: --- gcc-3.4.0/gcc/config/arm/arm.md.arm-ldm-peephole 2004-01-13 08:24:37.000000000 -0500 yann@1: +++ gcc-3.4.0/gcc/config/arm/arm.md 2004-04-24 18:18:04.000000000 -0400 yann@1: @@ -8810,13 +8810,16 @@ yann@1: (set_attr "length" "4,8,8")] yann@1: ) yann@1: yann@1: +; Try to convert LDR+LDR+arith into [add+]LDM+arith yann@1: +; On XScale, LDM is always slower than two LDRs, so only do this if yann@1: +; optimising for size. yann@1: (define_insn "*arith_adjacentmem" yann@1: [(set (match_operand:SI 0 "s_register_operand" "=r") yann@1: (match_operator:SI 1 "shiftable_operator" yann@1: [(match_operand:SI 2 "memory_operand" "m") yann@1: (match_operand:SI 3 "memory_operand" "m")])) yann@1: (clobber (match_scratch:SI 4 "=r"))] yann@1: - "TARGET_ARM && adjacent_mem_locations (operands[2], operands[3])" yann@1: + "TARGET_ARM && (!arm_tune_xscale || optimize_size) && adjacent_mem_locations (operands[2], operands[3])" yann@1: "* yann@1: { yann@1: rtx ldm[3]; yann@1: @@ -8851,6 +8854,8 @@ yann@1: } yann@1: if (val1 && val2) yann@1: { yann@1: + /* This would be a loss on a Harvard core, but adjacent_mem_locations() yann@1: + will prevent it from happening. */ yann@1: rtx ops[3]; yann@1: ldm[0] = ops[0] = operands[4]; yann@1: ops[1] = XEXP (XEXP (operands[2], 0), 0); yann@1: --- gcc-3.4.0/gcc/config/arm/arm.c.arm-ldm-peephole 2004-04-24 18:16:25.000000000 -0400 yann@1: +++ gcc-3.4.0/gcc/config/arm/arm.c 2004-04-24 18:18:04.000000000 -0400 yann@1: @@ -4838,6 +4841,11 @@ yann@1: *load_offset = unsorted_offsets[order[0]]; yann@1: } yann@1: yann@1: + /* For XScale a two-word LDM is a performance loss, so only do this if yann@1: + size is more important. See comments in arm_gen_load_multiple. */ yann@1: + if (nops == 2 && arm_tune_xscale && !optimize_size) yann@1: + return 0; yann@1: + yann@1: if (unsorted_offsets[order[0]] == 0) yann@1: return 1; /* ldmia */ yann@1: yann@1: @@ -5064,6 +5072,11 @@ yann@1: *load_offset = unsorted_offsets[order[0]]; yann@1: } yann@1: yann@1: + /* For XScale a two-word LDM is a performance loss, so only do this if yann@1: + size is more important. See comments in arm_gen_load_multiple. */ yann@1: + if (nops == 2 && arm_tune_xscale && !optimize_size) yann@1: + return 0; yann@1: + yann@1: if (unsorted_offsets[order[0]] == 0) yann@1: return 1; /* stmia */ yann@1: yann@1: --- gcc-3.4.0/gcc/genpeep.c.arm-ldm-peephole 2003-07-05 01:27:22.000000000 -0400 yann@1: +++ gcc-3.4.0/gcc/genpeep.c 2004-04-24 18:18:04.000000000 -0400 yann@1: @@ -381,6 +381,7 @@ yann@1: printf ("#include \"recog.h\"\n"); yann@1: printf ("#include \"except.h\"\n\n"); yann@1: printf ("#include \"function.h\"\n\n"); yann@1: + printf ("#include \"flags.h\"\n\n"); yann@1: yann@1: printf ("#ifdef HAVE_peephole\n"); yann@1: printf ("extern rtx peep_operand[];\n\n");