diff options
Diffstat (limited to 'recipes-devtools/gcc/gcc-4.5/linaro/gcc-4.5-linaro-r99465.patch')
| -rw-r--r-- | recipes-devtools/gcc/gcc-4.5/linaro/gcc-4.5-linaro-r99465.patch | 94 |
1 files changed, 94 insertions, 0 deletions
diff --git a/recipes-devtools/gcc/gcc-4.5/linaro/gcc-4.5-linaro-r99465.patch b/recipes-devtools/gcc/gcc-4.5/linaro/gcc-4.5-linaro-r99465.patch new file mode 100644 index 0000000000..32c2999a7c --- /dev/null +++ b/recipes-devtools/gcc/gcc-4.5/linaro/gcc-4.5-linaro-r99465.patch | |||
| @@ -0,0 +1,94 @@ | |||
| 1 | 2011-01-18 Ulrich Weigand <uweigand@de.ibm.com> | ||
| 2 | |||
| 3 | LP: #685352 | ||
| 4 | Backport from mainline: | ||
| 5 | |||
| 6 | 2011-01-18 Jakub Jelinek <jakub@redhat.com> | ||
| 7 | |||
| 8 | gcc/ | ||
| 9 | PR rtl-optimization/47299 | ||
| 10 | * expr.c (expand_expr_real_2) <case WIDEN_MULT_EXPR>: Don't use | ||
| 11 | subtarget. Use normal multiplication if both operands are | ||
| 12 | constants. | ||
| 13 | * expmed.c (expand_widening_mult): Don't try to optimize constant | ||
| 14 | multiplication if op0 has VOIDmode. Convert op1 constant to mode | ||
| 15 | before using it. | ||
| 16 | |||
| 17 | gcc/testsuite/ | ||
| 18 | PR rtl-optimization/47299 | ||
| 19 | * gcc.c-torture/execute/pr47299.c: New test. | ||
| 20 | |||
| 21 | === modified file 'gcc/expmed.c' | ||
| 22 | Index: gcc-4_5-branch/gcc/expmed.c | ||
| 23 | =================================================================== | ||
| 24 | --- gcc-4_5-branch.orig/gcc/expmed.c | ||
| 25 | +++ gcc-4_5-branch/gcc/expmed.c | ||
| 26 | @@ -3355,12 +3355,17 @@ expand_widening_mult (enum machine_mode | ||
| 27 | int unsignedp, optab this_optab) | ||
| 28 | { | ||
| 29 | bool speed = optimize_insn_for_speed_p (); | ||
| 30 | + rtx cop1; | ||
| 31 | |||
| 32 | if (CONST_INT_P (op1) | ||
| 33 | - && (INTVAL (op1) >= 0 | ||
| 34 | + && GET_MODE (op0) != VOIDmode | ||
| 35 | + && (cop1 = convert_modes (mode, GET_MODE (op0), op1, | ||
| 36 | + this_optab == umul_widen_optab)) | ||
| 37 | + && CONST_INT_P (cop1) | ||
| 38 | + && (INTVAL (cop1) >= 0 | ||
| 39 | || GET_MODE_BITSIZE (mode) <= HOST_BITS_PER_WIDE_INT)) | ||
| 40 | { | ||
| 41 | - HOST_WIDE_INT coeff = INTVAL (op1); | ||
| 42 | + HOST_WIDE_INT coeff = INTVAL (cop1); | ||
| 43 | int max_cost; | ||
| 44 | enum mult_variant variant; | ||
| 45 | struct algorithm algorithm; | ||
| 46 | Index: gcc-4_5-branch/gcc/expr.c | ||
| 47 | =================================================================== | ||
| 48 | --- gcc-4_5-branch.orig/gcc/expr.c | ||
| 49 | +++ gcc-4_5-branch/gcc/expr.c | ||
| 50 | @@ -7624,10 +7624,10 @@ expand_expr_real_2 (sepops ops, rtx targ | ||
| 51 | if (optab_handler (this_optab, mode)->insn_code != CODE_FOR_nothing) | ||
| 52 | { | ||
| 53 | if (TYPE_UNSIGNED (TREE_TYPE (treeop0))) | ||
| 54 | - expand_operands (treeop0, treeop1, subtarget, &op0, &op1, | ||
| 55 | + expand_operands (treeop0, treeop1, NULL_RTX, &op0, &op1, | ||
| 56 | EXPAND_NORMAL); | ||
| 57 | else | ||
| 58 | - expand_operands (treeop0, treeop1, subtarget, &op1, &op0, | ||
| 59 | + expand_operands (treeop0, treeop1, NULL_RTX, &op1, &op0, | ||
| 60 | EXPAND_NORMAL); | ||
| 61 | goto binop3; | ||
| 62 | } | ||
| 63 | @@ -7645,7 +7645,8 @@ expand_expr_real_2 (sepops ops, rtx targ | ||
| 64 | optab other_optab = zextend_p ? smul_widen_optab : umul_widen_optab; | ||
| 65 | this_optab = zextend_p ? umul_widen_optab : smul_widen_optab; | ||
| 66 | |||
| 67 | - if (mode == GET_MODE_2XWIDER_MODE (innermode)) | ||
| 68 | + if (mode == GET_MODE_2XWIDER_MODE (innermode) | ||
| 69 | + && TREE_CODE (treeop0) != INTEGER_CST) | ||
| 70 | { | ||
| 71 | if (optab_handler (this_optab, mode)->insn_code != CODE_FOR_nothing) | ||
| 72 | { | ||
| 73 | Index: gcc-4_5-branch/gcc/testsuite/gcc.c-torture/execute/pr47299.c | ||
| 74 | =================================================================== | ||
| 75 | --- /dev/null | ||
| 76 | +++ gcc-4_5-branch/gcc/testsuite/gcc.c-torture/execute/pr47299.c | ||
| 77 | @@ -0,0 +1,17 @@ | ||
| 78 | +/* PR rtl-optimization/47299 */ | ||
| 79 | + | ||
| 80 | +extern void abort (void); | ||
| 81 | + | ||
| 82 | +__attribute__ ((noinline, noclone)) unsigned short | ||
| 83 | +foo (unsigned char x) | ||
| 84 | +{ | ||
| 85 | + return x * 255; | ||
| 86 | +} | ||
| 87 | + | ||
| 88 | +int | ||
| 89 | +main () | ||
| 90 | +{ | ||
| 91 | + if (foo (0x40) != 0x3fc0) | ||
| 92 | + abort (); | ||
| 93 | + return 0; | ||
| 94 | +} | ||
