aboutsummaryrefslogtreecommitdiff
path: root/gcc/optabs.c
diff options
context:
space:
mode:
authorRichard Sandiford <richard.sandiford@linaro.org>2017-10-13 09:41:39 +0000
committerRichard Sandiford <rsandifo@gcc.gnu.org>2017-10-13 09:41:39 +0000
commitfb98441af9c84caef6a0e3210ace4b8ffc7e3840 (patch)
tree34cd9d3afa018eb2d3ab1f7ee4b142e66c6cda7f /gcc/optabs.c
parent90f2b7e220df8ce298b2cd8f853a02aaecdbff0b (diff)
downloadgcc-fb98441af9c84caef6a0e3210ace4b8ffc7e3840.zip
gcc-fb98441af9c84caef6a0e3210ace4b8ffc7e3840.tar.gz
gcc-fb98441af9c84caef6a0e3210ace4b8ffc7e3840.tar.bz2
Make more use of GET_MODE_UNIT_SIZE
This patch uses GET_MODE_UNIT_SIZE instead of GET_MODE_SIZE in cases where, for compound modes, the mode of the scalar elements is what matters. E.g. the choice between truncation and extension is really based on the modes of the consistuent scalars rather than the mode as a whole. None of the existing code was wrong. The patch simply makes things easier when converting to variable-sized modes. 2017-10-13 Richard Sandiford <richard.sandiford@linaro.org> Alan Hayward <alan.hayward@arm.com> David Sherwood <david.sherwood@arm.com> gcc/ * optabs.c (add_equal_note): Use GET_MODE_UNIT_SIZE. (widened_mode): Likewise. (expand_unop): Likewise. * ree.c (transform_ifelse): Likewise. (merge_def_and_ext): Likewise. (combine_reaching_defs): Likewise. * simplify-rtx.c (simplify_unary_operation_1): Likewise. Co-Authored-By: Alan Hayward <alan.hayward@arm.com> Co-Authored-By: David Sherwood <david.sherwood@arm.com> From-SVN: r253715
Diffstat (limited to 'gcc/optabs.c')
-rw-r--r--gcc/optabs.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/gcc/optabs.c b/gcc/optabs.c
index 67dfa58..75e3200 100644
--- a/gcc/optabs.c
+++ b/gcc/optabs.c
@@ -138,8 +138,8 @@ add_equal_note (rtx_insn *insns, rtx target, enum rtx_code code, rtx op0, rtx op
if (GET_MODE (op0) != VOIDmode && GET_MODE (target) != GET_MODE (op0))
{
note = gen_rtx_fmt_e (code, GET_MODE (op0), copy_rtx (op0));
- if (GET_MODE_SIZE (GET_MODE (op0))
- > GET_MODE_SIZE (GET_MODE (target)))
+ if (GET_MODE_UNIT_SIZE (GET_MODE (op0))
+ > GET_MODE_UNIT_SIZE (GET_MODE (target)))
note = simplify_gen_unary (TRUNCATE, GET_MODE (target),
note, GET_MODE (op0));
else
@@ -173,12 +173,12 @@ widened_mode (machine_mode to_mode, rtx op0, rtx op1)
if (m0 == VOIDmode && m1 == VOIDmode)
return to_mode;
- else if (m0 == VOIDmode || GET_MODE_SIZE (m0) < GET_MODE_SIZE (m1))
+ else if (m0 == VOIDmode || GET_MODE_UNIT_SIZE (m0) < GET_MODE_UNIT_SIZE (m1))
result = m1;
else
result = m0;
- if (GET_MODE_SIZE (result) > GET_MODE_SIZE (to_mode))
+ if (GET_MODE_UNIT_SIZE (result) > GET_MODE_UNIT_SIZE (to_mode))
return to_mode;
return result;
@@ -2977,9 +2977,9 @@ expand_unop (machine_mode mode, optab unoptab, rtx op0, rtx target,
else
{
eq_value = gen_rtx_fmt_e (optab_to_code (unoptab), mode, op0);
- if (GET_MODE_SIZE (outmode) < GET_MODE_SIZE (mode))
+ if (GET_MODE_UNIT_SIZE (outmode) < GET_MODE_UNIT_SIZE (mode))
eq_value = simplify_gen_unary (TRUNCATE, outmode, eq_value, mode);
- else if (GET_MODE_SIZE (outmode) > GET_MODE_SIZE (mode))
+ else if (GET_MODE_UNIT_SIZE (outmode) > GET_MODE_UNIT_SIZE (mode))
eq_value = simplify_gen_unary (ZERO_EXTEND,
outmode, eq_value, mode);
}