patches/gcc/3.4.4/600-gcc34-arm-ldm-peephole.patch
changeset 1 eeea35fbf182
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/patches/gcc/3.4.4/600-gcc34-arm-ldm-peephole.patch	Sat Feb 24 11:00:05 2007 +0000
     1.3 @@ -0,0 +1,65 @@
     1.4 +--- gcc-3.4.0/gcc/config/arm/arm.md.arm-ldm-peephole	2004-01-13 08:24:37.000000000 -0500
     1.5 ++++ gcc-3.4.0/gcc/config/arm/arm.md	2004-04-24 18:18:04.000000000 -0400
     1.6 +@@ -8810,13 +8810,16 @@
     1.7 +    (set_attr "length" "4,8,8")]
     1.8 + )
     1.9 + 
    1.10 ++; Try to convert LDR+LDR+arith into [add+]LDM+arith
    1.11 ++; On XScale, LDM is always slower than two LDRs, so only do this if
    1.12 ++; optimising for size.
    1.13 + (define_insn "*arith_adjacentmem"
    1.14 +   [(set (match_operand:SI 0 "s_register_operand" "=r")
    1.15 + 	(match_operator:SI 1 "shiftable_operator"
    1.16 + 	 [(match_operand:SI 2 "memory_operand" "m")
    1.17 + 	  (match_operand:SI 3 "memory_operand" "m")]))
    1.18 +    (clobber (match_scratch:SI 4 "=r"))]
    1.19 +-  "TARGET_ARM && adjacent_mem_locations (operands[2], operands[3])"
    1.20 ++  "TARGET_ARM && (!arm_tune_xscale || optimize_size) && adjacent_mem_locations (operands[2], operands[3])"
    1.21 +   "*
    1.22 +   {
    1.23 +     rtx ldm[3];
    1.24 +@@ -8851,6 +8854,8 @@
    1.25 +       }
    1.26 +    if (val1 && val2)
    1.27 +       {
    1.28 ++	/* This would be a loss on a Harvard core, but adjacent_mem_locations()
    1.29 ++	   will prevent it from happening.  */
    1.30 + 	rtx ops[3];
    1.31 + 	ldm[0] = ops[0] = operands[4];
    1.32 + 	ops[1] = XEXP (XEXP (operands[2], 0), 0);
    1.33 +--- gcc-3.4.0/gcc/config/arm/arm.c.arm-ldm-peephole	2004-04-24 18:16:25.000000000 -0400
    1.34 ++++ gcc-3.4.0/gcc/config/arm/arm.c	2004-04-24 18:18:04.000000000 -0400
    1.35 +@@ -4838,6 +4841,11 @@
    1.36 +       *load_offset = unsorted_offsets[order[0]];
    1.37 +     }
    1.38 + 
    1.39 ++  /* For XScale a two-word LDM is a performance loss, so only do this if
    1.40 ++     size is more important.  See comments in arm_gen_load_multiple.  */
    1.41 ++  if (nops == 2 && arm_tune_xscale && !optimize_size)
    1.42 ++    return 0;
    1.43 ++
    1.44 +   if (unsorted_offsets[order[0]] == 0)
    1.45 +     return 1; /* ldmia */
    1.46 + 
    1.47 +@@ -5064,6 +5072,11 @@
    1.48 +       *load_offset = unsorted_offsets[order[0]];
    1.49 +     }
    1.50 + 
    1.51 ++  /* For XScale a two-word LDM is a performance loss, so only do this if
    1.52 ++     size is more important.  See comments in arm_gen_load_multiple.  */
    1.53 ++  if (nops == 2 && arm_tune_xscale && !optimize_size)
    1.54 ++    return 0;
    1.55 ++
    1.56 +   if (unsorted_offsets[order[0]] == 0)
    1.57 +     return 1; /* stmia */
    1.58 + 
    1.59 +--- gcc-3.4.0/gcc/genpeep.c.arm-ldm-peephole	2003-07-05 01:27:22.000000000 -0400
    1.60 ++++ gcc-3.4.0/gcc/genpeep.c	2004-04-24 18:18:04.000000000 -0400
    1.61 +@@ -381,6 +381,7 @@
    1.62 +   printf ("#include \"recog.h\"\n");
    1.63 +   printf ("#include \"except.h\"\n\n");
    1.64 +   printf ("#include \"function.h\"\n\n");
    1.65 ++  printf ("#include \"flags.h\"\n\n");
    1.66 + 
    1.67 +   printf ("#ifdef HAVE_peephole\n");
    1.68 +   printf ("extern rtx peep_operand[];\n\n");