summaryrefslogtreecommitdiff
path: root/gcc/gcc-3.3.3/arm-14558.dpatch
blob: 9d15eaecd88e791a8bb1d92548aba606c70f81ec (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
#! /bin/sh -e

# DP: Patch for invalid QImode insn resulting from HImode reload on ARMv3

dir=
if [ $# -eq 3 -a "$2" = '-d' ]; then
    pdir="-d $3"
    dir="$3/"
elif [ $# -ne 1 ]; then
    echo >&2 "`basename $0`: script expects -patch|-unpatch as argument"
    exit 1
fi
case "$1" in
    -patch)
        patch $pdir -f --no-backup-if-mismatch -p0 < $0
        #cd ${dir}gcc && autoconf
        ;;
    -unpatch)
        patch $pdir -f --no-backup-if-mismatch -R -p0 < $0
        #rm ${dir}gcc/configure
        ;;
    *)
        echo >&2 "`basename $0`: script expects -patch|-unpatch as argument"
        exit 1
esac
exit 0

--- gcc/config/arm/arm.h.old	Thu Feb 19 13:48:41 2004
+++ gcc/config/arm/arm.h	Thu Feb 19 13:56:31 2004
@@ -2003,10 +2003,17 @@
 		  && INTVAL (op) <= 31)					\
 		goto LABEL;						\
 	    }								\
-	  /* NASTY: Since this limits the addressing of unsigned	\
-	     byte loads.  */						\
-	  range = ((MODE) == HImode || (MODE) == QImode)		\
-	    ? (arm_arch4 ? 256 : 4095) : 4096;				\
+  	  /* XXX For ARM v4 we may be doing a sign-extend operation	\
+	     during the load, but that has a restricted addressing	\
+	     range and we are unable to tell here whether that is the	\
+	     case.  To be safe we restrict all loads to that		\
+	     range.  */							\
+          if (arm_arch4)						\
+	    range = (mode == HImode || mode == QImode) ? 256 : 4096;	\
+	  else if (mode == HImode)					\
+	    range = 4095;						\
+	  else								\
+	    range = 4096;						\
 	  if (code == CONST_INT && INTVAL (INDEX) < range		\
 	      && INTVAL (INDEX) > -range)				\
 	    goto LABEL;							\