patches/gcc/3.4.6/600-gcc34-arm-ldm-peephole.patch
changeset 746 b150d6f590fc
parent 745 e445c00d134d
child 747 d3e603e7c17c
     1.1 --- a/patches/gcc/3.4.6/600-gcc34-arm-ldm-peephole.patch	Mon Jul 28 20:17:48 2008 +0000
     1.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.3 @@ -1,68 +0,0 @@
     1.4 -diff -durN gcc-3.4.6.orig/gcc/config/arm/arm.c gcc-3.4.6/gcc/config/arm/arm.c
     1.5 ---- gcc-3.4.6.orig/gcc/config/arm/arm.c	2005-10-01 15:31:38.000000000 +0200
     1.6 -+++ gcc-3.4.6/gcc/config/arm/arm.c	2007-08-15 22:54:59.000000000 +0200
     1.7 -@@ -4857,6 +4857,11 @@
     1.8 -       *load_offset = unsorted_offsets[order[0]];
     1.9 -     }
    1.10 - 
    1.11 -+  /* For XScale a two-word LDM is a performance loss, so only do this if
    1.12 -+     size is more important.  See comments in arm_gen_load_multiple.  */
    1.13 -+  if (nops == 2 && arm_tune_xscale && !optimize_size)
    1.14 -+    return 0;
    1.15 -+
    1.16 -   if (unsorted_offsets[order[0]] == 0)
    1.17 -     return 1; /* ldmia */
    1.18 - 
    1.19 -@@ -5083,6 +5088,11 @@
    1.20 -       *load_offset = unsorted_offsets[order[0]];
    1.21 -     }
    1.22 - 
    1.23 -+  /* For XScale a two-word LDM is a performance loss, so only do this if
    1.24 -+     size is more important.  See comments in arm_gen_load_multiple.  */
    1.25 -+  if (nops == 2 && arm_tune_xscale && !optimize_size)
    1.26 -+    return 0;
    1.27 -+
    1.28 -   if (unsorted_offsets[order[0]] == 0)
    1.29 -     return 1; /* stmia */
    1.30 - 
    1.31 -diff -durN gcc-3.4.6.orig/gcc/config/arm/arm.md gcc-3.4.6/gcc/config/arm/arm.md
    1.32 ---- gcc-3.4.6.orig/gcc/config/arm/arm.md	2005-10-01 15:31:38.000000000 +0200
    1.33 -+++ gcc-3.4.6/gcc/config/arm/arm.md	2007-08-15 22:54:59.000000000 +0200
    1.34 -@@ -8811,13 +8811,16 @@
    1.35 -    (set_attr "length" "4,8,8")]
    1.36 - )
    1.37 - 
    1.38 -+; Try to convert LDR+LDR+arith into [add+]LDM+arith
    1.39 -+; On XScale, LDM is always slower than two LDRs, so only do this if
    1.40 -+; optimising for size.
    1.41 - (define_insn "*arith_adjacentmem"
    1.42 -   [(set (match_operand:SI 0 "s_register_operand" "=r")
    1.43 - 	(match_operator:SI 1 "shiftable_operator"
    1.44 - 	 [(match_operand:SI 2 "memory_operand" "m")
    1.45 - 	  (match_operand:SI 3 "memory_operand" "m")]))
    1.46 -    (clobber (match_scratch:SI 4 "=r"))]
    1.47 --  "TARGET_ARM && adjacent_mem_locations (operands[2], operands[3])"
    1.48 -+  "TARGET_ARM && (!arm_tune_xscale || optimize_size) && adjacent_mem_locations (operands[2], operands[3])"
    1.49 -   "*
    1.50 -   {
    1.51 -     rtx ldm[3];
    1.52 -@@ -8852,6 +8855,8 @@
    1.53 -       }
    1.54 -    if (val1 && val2)
    1.55 -       {
    1.56 -+	/* This would be a loss on a Harvard core, but adjacent_mem_locations()
    1.57 -+	   will prevent it from happening.  */
    1.58 - 	rtx ops[3];
    1.59 - 	ldm[0] = ops[0] = operands[4];
    1.60 - 	ops[1] = XEXP (XEXP (operands[2], 0), 0);
    1.61 -diff -durN gcc-3.4.6.orig/gcc/genpeep.c gcc-3.4.6/gcc/genpeep.c
    1.62 ---- gcc-3.4.6.orig/gcc/genpeep.c	2003-07-05 07:27:22.000000000 +0200
    1.63 -+++ gcc-3.4.6/gcc/genpeep.c	2007-08-15 22:54:59.000000000 +0200
    1.64 -@@ -381,6 +381,7 @@
    1.65 -   printf ("#include \"recog.h\"\n");
    1.66 -   printf ("#include \"except.h\"\n\n");
    1.67 -   printf ("#include \"function.h\"\n\n");
    1.68 -+  printf ("#include \"flags.h\"\n\n");
    1.69 - 
    1.70 -   printf ("#ifdef HAVE_peephole\n");
    1.71 -   printf ("extern rtx peep_operand[];\n\n");