yann@339: diff -durN gcc-3.4.6.orig/gcc/config/arm/arm.c gcc-3.4.6/gcc/config/arm/arm.c yann@339: --- gcc-3.4.6.orig/gcc/config/arm/arm.c 2005-10-01 15:31:38.000000000 +0200 yann@339: +++ gcc-3.4.6/gcc/config/arm/arm.c 2007-08-15 22:54:59.000000000 +0200 yann@339: @@ -4857,6 +4857,11 @@ yann@339: *load_offset = unsorted_offsets[order[0]]; yann@339: } yann@339: yann@339: + /* For XScale a two-word LDM is a performance loss, so only do this if yann@339: + size is more important. See comments in arm_gen_load_multiple. */ yann@339: + if (nops == 2 && arm_tune_xscale && !optimize_size) yann@339: + return 0; yann@339: + yann@339: if (unsorted_offsets[order[0]] == 0) yann@339: return 1; /* ldmia */ yann@339: yann@339: @@ -5083,6 +5088,11 @@ yann@339: *load_offset = unsorted_offsets[order[0]]; yann@339: } yann@339: yann@339: + /* For XScale a two-word LDM is a performance loss, so only do this if yann@339: + size is more important. See comments in arm_gen_load_multiple. */ yann@339: + if (nops == 2 && arm_tune_xscale && !optimize_size) yann@339: + return 0; yann@339: + yann@339: if (unsorted_offsets[order[0]] == 0) yann@339: return 1; /* stmia */ yann@339: yann@339: diff -durN gcc-3.4.6.orig/gcc/config/arm/arm.md gcc-3.4.6/gcc/config/arm/arm.md yann@339: --- gcc-3.4.6.orig/gcc/config/arm/arm.md 2005-10-01 15:31:38.000000000 +0200 yann@339: +++ gcc-3.4.6/gcc/config/arm/arm.md 2007-08-15 22:54:59.000000000 +0200 yann@339: @@ -8811,13 +8811,16 @@ yann@339: (set_attr "length" "4,8,8")] yann@339: ) yann@339: yann@339: +; Try to convert LDR+LDR+arith into [add+]LDM+arith yann@339: +; On XScale, LDM is always slower than two LDRs, so only do this if yann@339: +; optimising for size. yann@339: (define_insn "*arith_adjacentmem" yann@339: [(set (match_operand:SI 0 "s_register_operand" "=r") yann@339: (match_operator:SI 1 "shiftable_operator" yann@339: [(match_operand:SI 2 "memory_operand" "m") yann@339: (match_operand:SI 3 "memory_operand" "m")])) yann@339: (clobber (match_scratch:SI 4 "=r"))] yann@339: - "TARGET_ARM && adjacent_mem_locations (operands[2], operands[3])" yann@339: + "TARGET_ARM && (!arm_tune_xscale || optimize_size) && adjacent_mem_locations (operands[2], operands[3])" yann@339: "* yann@339: { yann@339: rtx ldm[3]; yann@339: @@ -8852,6 +8855,8 @@ yann@339: } yann@339: if (val1 && val2) yann@339: { yann@339: + /* This would be a loss on a Harvard core, but adjacent_mem_locations() yann@339: + will prevent it from happening. */ yann@339: rtx ops[3]; yann@339: ldm[0] = ops[0] = operands[4]; yann@339: ops[1] = XEXP (XEXP (operands[2], 0), 0); yann@339: diff -durN gcc-3.4.6.orig/gcc/genpeep.c gcc-3.4.6/gcc/genpeep.c yann@339: --- gcc-3.4.6.orig/gcc/genpeep.c 2003-07-05 07:27:22.000000000 +0200 yann@339: +++ gcc-3.4.6/gcc/genpeep.c 2007-08-15 22:54:59.000000000 +0200 yann@339: @@ -381,6 +381,7 @@ yann@339: printf ("#include \"recog.h\"\n"); yann@339: printf ("#include \"except.h\"\n\n"); yann@339: printf ("#include \"function.h\"\n\n"); yann@339: + printf ("#include \"flags.h\"\n\n"); yann@339: yann@339: printf ("#ifdef HAVE_peephole\n"); yann@339: printf ("extern rtx peep_operand[];\n\n");