|
@@ -1,70 +0,0 @@
|
1
|
|
-diff -urN a/gcc/tree-ssa-math-opts.c b/gcc/tree-ssa-math-opts.c
|
2
|
|
---- a/gcc/tree-ssa-math-opts.c 2012-12-12 18:05:23.000000000 +0100
|
3
|
|
-+++ b/gcc/tree-ssa-math-opts.c 2013-04-29 15:54:00.051998936 +0200
|
4
|
|
-@@ -1280,6 +1280,47 @@
|
5
|
|
- return result;
|
6
|
|
- }
|
7
|
|
-
|
8
|
|
-+/* Return true if stmt is a type conversion operation that can be stripped
|
9
|
|
-+ when used in a widening multiply operation. */
|
10
|
|
-+static bool
|
11
|
|
-+widening_mult_conversion_strippable_p (tree result_type, gimple stmt)
|
12
|
|
-+{
|
13
|
|
-+ enum tree_code rhs_code = gimple_assign_rhs_code (stmt);
|
14
|
|
-+
|
15
|
|
-+ if (TREE_CODE (result_type) == INTEGER_TYPE)
|
16
|
|
-+ {
|
17
|
|
-+ tree op_type;
|
18
|
|
-+ tree inner_op_type;
|
19
|
|
-+
|
20
|
|
-+ if (!CONVERT_EXPR_CODE_P (rhs_code))
|
21
|
|
-+ return false;
|
22
|
|
-+
|
23
|
|
-+ op_type = TREE_TYPE (gimple_assign_lhs (stmt));
|
24
|
|
-+
|
25
|
|
-+ /* If the type of OP has the same precision as the result, then
|
26
|
|
-+ we can strip this conversion. The multiply operation will be
|
27
|
|
-+ selected to create the correct extension as a by-product. */
|
28
|
|
-+ if (TYPE_PRECISION (result_type) == TYPE_PRECISION (op_type))
|
29
|
|
-+ return true;
|
30
|
|
-+
|
31
|
|
-+ /* We can also strip a conversion if it preserves the signed-ness of
|
32
|
|
-+ the operation and doesn't narrow the range. */
|
33
|
|
-+ inner_op_type = TREE_TYPE (gimple_assign_rhs1 (stmt));
|
34
|
|
-+
|
35
|
|
-+ /* If the inner-most type is unsigned, then we can strip any
|
36
|
|
-+ intermediate widening operation. If it's signed, then the
|
37
|
|
-+ intermediate widening operation must also be signed. */
|
38
|
|
-+ if ((TYPE_UNSIGNED (inner_op_type)
|
39
|
|
-+ || TYPE_UNSIGNED (op_type) == TYPE_UNSIGNED (inner_op_type))
|
40
|
|
-+ && TYPE_PRECISION (op_type) > TYPE_PRECISION (inner_op_type))
|
41
|
|
-+ return true;
|
42
|
|
-+
|
43
|
|
-+ return false;
|
44
|
|
-+ }
|
45
|
|
-+
|
46
|
|
-+ return rhs_code == FIXED_CONVERT_EXPR;
|
47
|
|
-+}
|
48
|
|
-+
|
49
|
|
- /* Return true if RHS is a suitable operand for a widening multiplication,
|
50
|
|
- assuming a target type of TYPE.
|
51
|
|
- There are two cases:
|
52
|
|
-@@ -1296,17 +1337,13 @@
|
53
|
|
- {
|
54
|
|
- gimple stmt;
|
55
|
|
- tree type1, rhs1;
|
56
|
|
-- enum tree_code rhs_code;
|
57
|
|
-
|
58
|
|
- if (TREE_CODE (rhs) == SSA_NAME)
|
59
|
|
- {
|
60
|
|
- stmt = SSA_NAME_DEF_STMT (rhs);
|
61
|
|
- if (is_gimple_assign (stmt))
|
62
|
|
- {
|
63
|
|
-- rhs_code = gimple_assign_rhs_code (stmt);
|
64
|
|
-- if (TREE_CODE (type) == INTEGER_TYPE
|
65
|
|
-- ? !CONVERT_EXPR_CODE_P (rhs_code)
|
66
|
|
-- : rhs_code != FIXED_CONVERT_EXPR)
|
67
|
|
-+ if (! widening_mult_conversion_strippable_p (type, stmt))
|
68
|
|
- rhs1 = rhs;
|
69
|
|
- else
|
70
|
|
- {
|