summaryrefslogtreecommitdiffstats
path: root/recipes-devtools/gcc/gcc-4.5/linaro/gcc-4.5-linaro-r99421.patch
diff options
context:
space:
mode:
Diffstat (limited to 'recipes-devtools/gcc/gcc-4.5/linaro/gcc-4.5-linaro-r99421.patch')
-rw-r--r--recipes-devtools/gcc/gcc-4.5/linaro/gcc-4.5-linaro-r99421.patch94
1 files changed, 94 insertions, 0 deletions
diff --git a/recipes-devtools/gcc/gcc-4.5/linaro/gcc-4.5-linaro-r99421.patch b/recipes-devtools/gcc/gcc-4.5/linaro/gcc-4.5-linaro-r99421.patch
new file mode 100644
index 0000000000..3a45ee5026
--- /dev/null
+++ b/recipes-devtools/gcc/gcc-4.5/linaro/gcc-4.5-linaro-r99421.patch
@@ -0,0 +1,94 @@
12010-10-20 Nathan Froyd <froydnj@codesourcery.com>
2
3 Issue #9781
4
5 Backport from mainline:
6
7 gcc/
8 2010-10-20 Nathan Froyd <froydnj@codesourcery.com>
9
10 * ifcvt.c (noce_emit_cmove): If both of the values are SUBREGs, try
11 emitting the conditional move in the inner mode of the SUBREG.
12
13
14=== modified file 'gcc/ifcvt.c'
15--- old/gcc/ifcvt.c 2010-10-15 10:01:07 +0000
16+++ new/gcc/ifcvt.c 2010-11-04 12:11:15 +0000
17@@ -1338,6 +1338,9 @@
18 noce_emit_cmove (struct noce_if_info *if_info, rtx x, enum rtx_code code,
19 rtx cmp_a, rtx cmp_b, rtx vfalse, rtx vtrue)
20 {
21+ rtx target;
22+ int unsignedp;
23+
24 /* If earliest == jump, try to build the cmove insn directly.
25 This is helpful when combine has created some complex condition
26 (like for alpha's cmovlbs) that we can't hope to regenerate
27@@ -1372,10 +1375,62 @@
28 return NULL_RTX;
29
30 #if HAVE_conditional_move
31- return emit_conditional_move (x, code, cmp_a, cmp_b, VOIDmode,
32- vtrue, vfalse, GET_MODE (x),
33- (code == LTU || code == GEU
34- || code == LEU || code == GTU));
35+ unsignedp = (code == LTU || code == GEU
36+ || code == LEU || code == GTU);
37+
38+ target = emit_conditional_move (x, code, cmp_a, cmp_b, VOIDmode,
39+ vtrue, vfalse, GET_MODE (x),
40+ unsignedp);
41+ if (target)
42+ return target;
43+
44+ /* We might be faced with a situation like:
45+
46+ x = (reg:M TARGET)
47+ vtrue = (subreg:M (reg:N VTRUE) BYTE)
48+ vfalse = (subreg:M (reg:N VFALSE) BYTE)
49+
50+ We can't do a conditional move in mode M, but it's possible that we
51+ could do a conditional move in mode N instead and take a subreg of
52+ the result.
53+
54+ If we can't create new pseudos, though, don't bother. */
55+ if (reload_completed)
56+ return NULL_RTX;
57+
58+ if (GET_CODE (vtrue) == SUBREG && GET_CODE (vfalse) == SUBREG)
59+ {
60+ rtx reg_vtrue = SUBREG_REG (vtrue);
61+ rtx reg_vfalse = SUBREG_REG (vfalse);
62+ unsigned int byte_vtrue = SUBREG_BYTE (vtrue);
63+ unsigned int byte_vfalse = SUBREG_BYTE (vfalse);
64+ rtx promoted_target;
65+
66+ if (GET_MODE (reg_vtrue) != GET_MODE (reg_vfalse)
67+ || byte_vtrue != byte_vfalse
68+ || (SUBREG_PROMOTED_VAR_P (vtrue)
69+ != SUBREG_PROMOTED_VAR_P (vfalse))
70+ || (SUBREG_PROMOTED_UNSIGNED_P (vtrue)
71+ != SUBREG_PROMOTED_UNSIGNED_P (vfalse)))
72+ return NULL_RTX;
73+
74+ promoted_target = gen_reg_rtx (GET_MODE (reg_vtrue));
75+
76+ target = emit_conditional_move (promoted_target, code, cmp_a, cmp_b,
77+ VOIDmode, reg_vtrue, reg_vfalse,
78+ GET_MODE (reg_vtrue), unsignedp);
79+ /* Nope, couldn't do it in that mode either. */
80+ if (!target)
81+ return NULL_RTX;
82+
83+ target = gen_rtx_SUBREG (GET_MODE (vtrue), promoted_target, byte_vtrue);
84+ SUBREG_PROMOTED_VAR_P (target) = SUBREG_PROMOTED_VAR_P (vtrue);
85+ SUBREG_PROMOTED_UNSIGNED_SET (target, SUBREG_PROMOTED_UNSIGNED_P (vtrue));
86+ emit_move_insn (x, target);
87+ return x;
88+ }
89+ else
90+ return NULL_RTX;
91 #else
92 /* We'll never get here, as noce_process_if_block doesn't call the
93 functions involved. Ifdef code, however, should be discouraged
94