diff options
author | rsandifo <rsandifo@138bc75d-0d04-0410-961f-82ee72b054a4> | 2017-10-22 21:39:29 +0000 |
---|---|---|
committer | rsandifo <rsandifo@138bc75d-0d04-0410-961f-82ee72b054a4> | 2017-10-22 21:39:29 +0000 |
commit | 1048c15588636609c35c11bd401e073d47e7cd54 (patch) | |
tree | 4eaaa8513cdd739b4ec805e56e182a356e6d60b9 /gcc/cfgexpand.c | |
parent | b8510cb117780365a38216d22de7cb49b3f54fbb (diff) |
Make more use of GET_MODE_UNIT_PRECISION
This patch is like the earlier GET_MODE_UNIT_SIZE one,
but for precisions rather than sizes. There is one behavioural
change in expand_debug_expr: we shouldn't use lowpart subregs
for non-scalar truncations, since that would just reinterpret
some of the scalars and drop the rest. (This probably doesn't
trigger in practice.) Using TRUNCATE is fine for scalars,
since simplify_gen_unary knows when a subreg can be used.
2017-10-22 Richard Sandiford <richard.sandiford@linaro.org>
Alan Hayward <alan.hayward@arm.com>
David Sherwood <david.sherwood@arm.com>
gcc/
* cfgexpand.c (expand_debug_expr): Use GET_MODE_UNIT_PRECISION.
(expand_debug_source_expr): Likewise.
* combine.c (combine_simplify_rtx): Likewise.
* cse.c (fold_rtx): Likewise.
* optabs.c (expand_float): Likewise.
* simplify-rtx.c (simplify_unary_operation_1): Likewise.
(simplify_binary_operation_1): Likewise.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@253991 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/cfgexpand.c')
-rw-r--r-- | gcc/cfgexpand.c | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/gcc/cfgexpand.c b/gcc/cfgexpand.c index d0e07821489..79204bd49e4 100644 --- a/gcc/cfgexpand.c +++ b/gcc/cfgexpand.c @@ -4361,9 +4361,12 @@ expand_debug_expr (tree exp) else op0 = simplify_gen_unary (FIX, mode, op0, inner_mode); } - else if (CONSTANT_P (op0) - || GET_MODE_PRECISION (mode) <= GET_MODE_PRECISION (inner_mode)) + else if (GET_MODE_UNIT_PRECISION (mode) + == GET_MODE_UNIT_PRECISION (inner_mode)) op0 = lowpart_subreg (mode, op0, inner_mode); + else if (GET_MODE_UNIT_PRECISION (mode) + < GET_MODE_UNIT_PRECISION (inner_mode)) + op0 = simplify_gen_unary (TRUNCATE, mode, op0, inner_mode); else if (UNARY_CLASS_P (exp) ? TYPE_UNSIGNED (TREE_TYPE (TREE_OPERAND (exp, 0))) : unsignedp) @@ -5222,9 +5225,12 @@ expand_debug_source_expr (tree exp) else op0 = simplify_gen_unary (FIX, mode, op0, inner_mode); } - else if (CONSTANT_P (op0) - || GET_MODE_BITSIZE (mode) <= GET_MODE_BITSIZE (inner_mode)) + else if (GET_MODE_UNIT_PRECISION (mode) + == GET_MODE_UNIT_PRECISION (inner_mode)) op0 = lowpart_subreg (mode, op0, inner_mode); + else if (GET_MODE_UNIT_PRECISION (mode) + < GET_MODE_UNIT_PRECISION (inner_mode)) + op0 = simplify_gen_unary (TRUNCATE, mode, op0, inner_mode); else if (TYPE_UNSIGNED (TREE_TYPE (exp))) op0 = simplify_gen_unary (ZERO_EXTEND, mode, op0, inner_mode); else |