From: Eric Botcazou <ebotca...@adacore.com>
Date: Thu, 27 Oct 2011 23:11:33 +0200

>> Sorry, the final path component should be "mzero2.c"
> 
> Thanks.  I think we that need the same treatment in:
 ...
> as:
 ...
> i.e. we need to bail out if we are narrowing and this is a big-endian target.

I quickly tried the patch below, but this does not prevent the
transformation.

diff --git a/gcc/regcprop.c b/gcc/regcprop.c
index ad92a64..54e008b 100644
--- a/gcc/regcprop.c
+++ b/gcc/regcprop.c
@@ -448,6 +448,14 @@ find_oldest_value_reg (enum reg_class cl, rtx reg, struct 
value_data *vd)
       if (hard_regno_nregs[regno][mode]
          > hard_regno_nregs[regno][vd->e[regno].mode])
        return NULL_RTX;
+
+      /* And likewise, if we are narrowing on big endian the transformation
+        is also invalid.  */
+      if (hard_regno_nregs[regno][mode]
+         < hard_regno_nregs[regno][vd->e[regno].mode]
+         && (GET_MODE_SIZE (vd->e[regno].mode) > UNITS_PER_WORD
+             ? WORDS_BIG_ENDIAN : BYTES_BIG_ENDIAN))
+       return NULL_RTX;
     }
 
   for (i = vd->e[regno].oldest_regno; i != regno; i = vd->e[i].next_regno)

Reply via email to