Merge lp:~uweigand/gcc-linaro/lp-685352 into lp:gcc-linaro/4.5

Proposed by Ulrich Weigand
Status: Merged
Merged at revision: 99465
Proposed branch: lp:~uweigand/gcc-linaro/lp-685352
Merge into: lp:gcc-linaro/4.5
Diff against target: 100 lines (+48/-5)
4 files modified
ChangeLog.linaro (+20/-0)
gcc/expmed.c (+7/-2)
gcc/expr.c (+4/-3)
gcc/testsuite/gcc.c-torture/execute/pr47299.c (+17/-0)
To merge this branch: bzr merge lp:~uweigand/gcc-linaro/lp-685352
Reviewer Review Type Date Requested Status
Linaro Toolchain Developers Pending
Review via email: mp+46663@code.launchpad.net

Description of the change

Fix LP #685352 by backporting mainline fix for PR rtl-optimization/47299.

To post a comment you must log in.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'ChangeLog.linaro'
2--- ChangeLog.linaro 2011-01-13 18:18:11 +0000
3+++ ChangeLog.linaro 2011-01-18 19:24:33 +0000
4@@ -1,3 +1,23 @@
5+2011-01-18 Ulrich Weigand <uweigand@de.ibm.com>
6+
7+ LP: #685352
8+ Backport from mainline:
9+
10+ 2011-01-18 Jakub Jelinek <jakub@redhat.com>
11+
12+ gcc/
13+ PR rtl-optimization/47299
14+ * expr.c (expand_expr_real_2) <case WIDEN_MULT_EXPR>: Don't use
15+ subtarget. Use normal multiplication if both operands are
16+ constants.
17+ * expmed.c (expand_widening_mult): Don't try to optimize constant
18+ multiplication if op0 has VOIDmode. Convert op1 constant to mode
19+ before using it.
20+
21+ gcc/testsuite/
22+ PR rtl-optimization/47299
23+ * gcc.c-torture/execute/pr47299.c: New test.
24+
25 2011-01-13 Andrew Stubbs <ams@codesourcery.com>
26
27 gcc/
28
29=== modified file 'gcc/expmed.c'
30--- gcc/expmed.c 2010-11-04 12:43:52 +0000
31+++ gcc/expmed.c 2011-01-18 19:24:33 +0000
32@@ -3355,12 +3355,17 @@
33 int unsignedp, optab this_optab)
34 {
35 bool speed = optimize_insn_for_speed_p ();
36+ rtx cop1;
37
38 if (CONST_INT_P (op1)
39- && (INTVAL (op1) >= 0
40+ && GET_MODE (op0) != VOIDmode
41+ && (cop1 = convert_modes (mode, GET_MODE (op0), op1,
42+ this_optab == umul_widen_optab))
43+ && CONST_INT_P (cop1)
44+ && (INTVAL (cop1) >= 0
45 || GET_MODE_BITSIZE (mode) <= HOST_BITS_PER_WIDE_INT))
46 {
47- HOST_WIDE_INT coeff = INTVAL (op1);
48+ HOST_WIDE_INT coeff = INTVAL (cop1);
49 int max_cost;
50 enum mult_variant variant;
51 struct algorithm algorithm;
52
53=== modified file 'gcc/expr.c'
54--- gcc/expr.c 2010-12-10 15:34:19 +0000
55+++ gcc/expr.c 2011-01-18 19:24:33 +0000
56@@ -7621,10 +7621,10 @@
57 if (optab_handler (this_optab, mode)->insn_code != CODE_FOR_nothing)
58 {
59 if (TYPE_UNSIGNED (TREE_TYPE (treeop0)))
60- expand_operands (treeop0, treeop1, subtarget, &op0, &op1,
61+ expand_operands (treeop0, treeop1, NULL_RTX, &op0, &op1,
62 EXPAND_NORMAL);
63 else
64- expand_operands (treeop0, treeop1, subtarget, &op1, &op0,
65+ expand_operands (treeop0, treeop1, NULL_RTX, &op1, &op0,
66 EXPAND_NORMAL);
67 goto binop3;
68 }
69@@ -7642,7 +7642,8 @@
70 optab other_optab = zextend_p ? smul_widen_optab : umul_widen_optab;
71 this_optab = zextend_p ? umul_widen_optab : smul_widen_optab;
72
73- if (mode == GET_MODE_2XWIDER_MODE (innermode))
74+ if (mode == GET_MODE_2XWIDER_MODE (innermode)
75+ && TREE_CODE (treeop0) != INTEGER_CST)
76 {
77 if (optab_handler (this_optab, mode)->insn_code != CODE_FOR_nothing)
78 {
79
80=== added file 'gcc/testsuite/gcc.c-torture/execute/pr47299.c'
81--- gcc/testsuite/gcc.c-torture/execute/pr47299.c 1970-01-01 00:00:00 +0000
82+++ gcc/testsuite/gcc.c-torture/execute/pr47299.c 2011-01-18 19:24:33 +0000
83@@ -0,0 +1,17 @@
84+/* PR rtl-optimization/47299 */
85+
86+extern void abort (void);
87+
88+__attribute__ ((noinline, noclone)) unsigned short
89+foo (unsigned char x)
90+{
91+ return x * 255;
92+}
93+
94+int
95+main ()
96+{
97+ if (foo (0x40) != 0x3fc0)
98+ abort ();
99+ return 0;
100+}

Subscribers

People subscribed via source and target branches