patches/gcc/3.4.4/600-gcc34-arm-ldm-peephole.patch
author "Yann E. MORIN" <yann.morin.1998@anciens.enib.fr>
Sat Feb 24 11:00:05 2007 +0000 (2007-02-24)
changeset 1 eeea35fbf182
permissions -rw-r--r--
Add the full crosstool-NG sources to the new repository of its own.
You might just say: 'Yeah! crosstool-NG's got its own repo!".
Unfortunately, that's because the previous repo got damaged beyond repair and I had no backup.
That means I'm putting backups in place in the afternoon.
That also means we've lost history... :-(
     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")]
     5  )
     6  
     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])"
    18    "*
    19    {
    20      rtx ldm[3];
    21 @@ -8851,6 +8854,8 @@
    22        }
    23     if (val1 && val2)
    24        {
    25 +	/* This would be a loss on a Harvard core, but adjacent_mem_locations()
    26 +	   will prevent it from happening.  */
    27  	rtx ops[3];
    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 @@ -4838,6 +4841,11 @@
    33        *load_offset = unsorted_offsets[order[0]];
    34      }
    35  
    36 +  /* For XScale a two-word LDM is a performance loss, so only do this if
    37 +     size is more important.  See comments in arm_gen_load_multiple.  */
    38 +  if (nops == 2 && arm_tune_xscale && !optimize_size)
    39 +    return 0;
    40 +
    41    if (unsorted_offsets[order[0]] == 0)
    42      return 1; /* ldmia */
    43  
    44 @@ -5064,6 +5072,11 @@
    45        *load_offset = unsorted_offsets[order[0]];
    46      }
    47  
    48 +  /* For XScale a two-word LDM is a performance loss, so only do this if
    49 +     size is more important.  See comments in arm_gen_load_multiple.  */
    50 +  if (nops == 2 && arm_tune_xscale && !optimize_size)
    51 +    return 0;
    52 +
    53    if (unsorted_offsets[order[0]] == 0)
    54      return 1; /* stmia */
    55  
    56 --- gcc-3.4.0/gcc/genpeep.c.arm-ldm-peephole	2003-07-05 01:27:22.000000000 -0400
    57 +++ gcc-3.4.0/gcc/genpeep.c	2004-04-24 18:18:04.000000000 -0400
    58 @@ -381,6 +381,7 @@
    59    printf ("#include \"recog.h\"\n");
    60    printf ("#include \"except.h\"\n\n");
    61    printf ("#include \"function.h\"\n\n");
    62 +  printf ("#include \"flags.h\"\n\n");
    63  
    64    printf ("#ifdef HAVE_peephole\n");
    65    printf ("extern rtx peep_operand[];\n\n");