diff options
Diffstat (limited to 'meta/packages/gcc/gcc-4.3.1/debian/pr33148.dpatch')
-rw-r--r-- | meta/packages/gcc/gcc-4.3.1/debian/pr33148.dpatch | 94 |
1 files changed, 94 insertions, 0 deletions
diff --git a/meta/packages/gcc/gcc-4.3.1/debian/pr33148.dpatch b/meta/packages/gcc/gcc-4.3.1/debian/pr33148.dpatch new file mode 100644 index 0000000000..bcf30ffb56 --- /dev/null +++ b/meta/packages/gcc/gcc-4.3.1/debian/pr33148.dpatch | |||
@@ -0,0 +1,94 @@ | |||
1 | #! /bin/sh -e | ||
2 | |||
3 | # DP: Fix (neg (lt X 0)) optimization (PR rtl-optimization/33148) | ||
4 | |||
5 | dir= | ||
6 | if [ $# -eq 3 -a "$2" = '-d' ]; then | ||
7 | pdir="-d $3" | ||
8 | dir="$3/" | ||
9 | elif [ $# -ne 1 ]; then | ||
10 | echo >&2 "`basename $0`: script expects -patch|-unpatch as argument" | ||
11 | exit 1 | ||
12 | fi | ||
13 | case "$1" in | ||
14 | -patch) | ||
15 | patch $pdir -f --no-backup-if-mismatch -p0 < $0 | ||
16 | ;; | ||
17 | -unpatch) | ||
18 | patch $pdir -f --no-backup-if-mismatch -R -p0 < $0 | ||
19 | ;; | ||
20 | *) | ||
21 | echo >&2 "`basename $0`: script expects -patch|-unpatch as argument" | ||
22 | exit 1 | ||
23 | esac | ||
24 | exit 0 | ||
25 | |||
26 | |||
27 | From: Jakub Jelinek <jakub@redhat.com> | ||
28 | Sender: gcc-patches-owner@gcc.gnu.org | ||
29 | To: gcc-patches@gcc.gnu.org | ||
30 | Subject: [PATCH] Fix (neg (lt X 0)) optimization (PR rtl-optimization/33148) | ||
31 | Date: Mon, 27 Aug 2007 07:22:44 -0400 | ||
32 | |||
33 | Hi! | ||
34 | |||
35 | PR25600 change introduced an optimization of (neg (lt x 0)) to | ||
36 | (ashirtrt x C), but it is not checking whether x's mode is suitable | ||
37 | for it. As it checks that op1 is const0_rtx, I believe MODE_FLOAT | ||
38 | or VECTOR_MODE_P modes are not a problem, CC modes can certainly appear | ||
39 | in LT's first operand with second operand const0_rtx. | ||
40 | So, when we optimize | ||
41 | (neg:DI (lt:DI (reg:CC ...) (const_int 0))) | ||
42 | we create something like | ||
43 | (sign_extend:DI (ashirtrt:CC (reg:CC ...) (const_int 31))) | ||
44 | which is IMHO invalid RTL, ashirtrt is documented on fixed point modes | ||
45 | only (guess vector modes aren't listed just by omission) and so is | ||
46 | sign_extend. | ||
47 | |||
48 | Ok for 4.2/trunk? | ||
49 | |||
50 | 2007-08-27 Jakub Jelinek <jakub@redhat.com> | ||
51 | |||
52 | PR rtl-optimization/33148 | ||
53 | * simplify-rtx.c (simplify_unary_operation_1): Only optimize | ||
54 | (neg (lt X 0)) if X has scalar int mode. | ||
55 | |||
56 | * gcc.c-torture/compile/20070827-1.c: New test. | ||
57 | |||
58 | --- gcc/simplify-rtx.c.jj 2007-08-27 10:15:33.000000000 +0200 | ||
59 | +++ gcc/simplify-rtx.c 2007-08-27 12:12:51.000000000 +0200 | ||
60 | @@ -583,7 +583,8 @@ simplify_unary_operation_1 (enum rtx_cod | ||
61 | /* (neg (lt x 0)) is (ashiftrt X C) if STORE_FLAG_VALUE is 1. */ | ||
62 | /* (neg (lt x 0)) is (lshiftrt X C) if STORE_FLAG_VALUE is -1. */ | ||
63 | if (GET_CODE (op) == LT | ||
64 | - && XEXP (op, 1) == const0_rtx) | ||
65 | + && XEXP (op, 1) == const0_rtx | ||
66 | + && SCALAR_INT_MODE_P (GET_MODE (XEXP (op, 0)))) | ||
67 | { | ||
68 | enum machine_mode inner = GET_MODE (XEXP (op, 0)); | ||
69 | int isize = GET_MODE_BITSIZE (inner); | ||
70 | --- gcc/testsuite/gcc.c-torture/compile/20070827-1.c.jj 2007-08-27 12:17:20.000000000 +0200 | ||
71 | +++ gcc/testsuite/gcc.c-torture/compile/20070827-1.c 2007-08-27 12:15:45.000000000 +0200 | ||
72 | @@ -0,0 +1,20 @@ | ||
73 | +/* PR rtl-optimization/33148 */ | ||
74 | + | ||
75 | +int | ||
76 | +foo (unsigned int *p, int *q, unsigned int w, unsigned int b) | ||
77 | +{ | ||
78 | + unsigned int i; | ||
79 | + int mask; | ||
80 | + | ||
81 | + if (q[0] < q[1]) | ||
82 | + mask = 0xff; | ||
83 | + else | ||
84 | + mask = 0; | ||
85 | + | ||
86 | + for (i = 0; 8 * i < w; i++) | ||
87 | + { | ||
88 | + b ^= mask; | ||
89 | + *p++ = b; | ||
90 | + } | ||
91 | + return 0; | ||
92 | +} | ||
93 | |||
94 | Jakub | ||