aboutsummaryrefslogtreecommitdiff
path: root/gcc/expmed.c
diff options
context:
space:
mode:
authorRichard Sandiford <richard.sandiford@linaro.org>2017-08-30 11:19:17 +0000
committerRichard Sandiford <rsandifo@gcc.gnu.org>2017-08-30 11:19:17 +0000
commitd21cefc26f716395b03e3c0d379ecac04656f963 (patch)
tree23cc0255a69adb29141d859194421f1c78fc961d /gcc/expmed.c
parent90970acd061f18e5e97162a36b92555ad162ed34 (diff)
downloadgcc-d21cefc26f716395b03e3c0d379ecac04656f963.zip
gcc-d21cefc26f716395b03e3c0d379ecac04656f963.tar.gz
gcc-d21cefc26f716395b03e3c0d379ecac04656f963.tar.bz2
[64/77] Add a scalar_mode class
This patch adds a scalar_mode class that can hold any scalar mode, specifically: - scalar integers - scalar floating-point values - scalar fractional modes - scalar accumulator modes - pointer bounds modes To start with this patch uses this type for GET_MODE_INNER. Later patches add more uses. 2017-08-30 Richard Sandiford <richard.sandiford@linaro.org> Alan Hayward <alan.hayward@arm.com> David Sherwood <david.sherwood@arm.com> gcc/ * coretypes.h (scalar_mode): New class. * machmode.h (scalar_mode): Likewise. (scalar_mode::includes_p): New function. (mode_to_inner): Return a scalar_mode rather than a machine_mode. * gdbhooks.py (build_pretty_printers): Handle scalar_mode. * genmodes.c (get_mode_class): Handle remaining scalar modes. * cfgexpand.c (expand_debug_expr): Use scalar_mode. * expmed.c (store_bit_field_1): Likewise. (extract_bit_field_1): Likewise. * expr.c (write_complex_part): Likewise. (read_complex_part): Likewise. (emit_move_complex_push): Likewise. (expand_expr_real_2): Likewise. * function.c (assign_parm_setup_reg): Likewise. (assign_parms_unsplit_complex): Likewise. * optabs.c (expand_binop): Likewise. * rtlanal.c (subreg_get_info): Likewise. * simplify-rtx.c (simplify_immed_subreg): Likewise. * varasm.c (output_constant_pool_2): Likewise. Co-Authored-By: Alan Hayward <alan.hayward@arm.com> Co-Authored-By: David Sherwood <david.sherwood@arm.com> From-SVN: r251515
Diffstat (limited to 'gcc/expmed.c')
-rw-r--r--gcc/expmed.c27
1 files changed, 13 insertions, 14 deletions
diff --git a/gcc/expmed.c b/gcc/expmed.c
index 10cf59c..f38fb31 100644
--- a/gcc/expmed.c
+++ b/gcc/expmed.c
@@ -761,16 +761,16 @@ store_bit_field_1 (rtx str_rtx, unsigned HOST_WIDE_INT bitsize,
/* Use vec_set patterns for inserting parts of vectors whenever
available. */
- if (VECTOR_MODE_P (GET_MODE (op0))
+ machine_mode outermode = GET_MODE (op0);
+ scalar_mode innermode = GET_MODE_INNER (outermode);
+ if (VECTOR_MODE_P (outermode)
&& !MEM_P (op0)
- && optab_handler (vec_set_optab, GET_MODE (op0)) != CODE_FOR_nothing
- && fieldmode == GET_MODE_INNER (GET_MODE (op0))
- && bitsize == GET_MODE_UNIT_BITSIZE (GET_MODE (op0))
- && !(bitnum % GET_MODE_UNIT_BITSIZE (GET_MODE (op0))))
+ && optab_handler (vec_set_optab, outermode) != CODE_FOR_nothing
+ && fieldmode == innermode
+ && bitsize == GET_MODE_BITSIZE (innermode)
+ && !(bitnum % GET_MODE_BITSIZE (innermode)))
{
struct expand_operand ops[3];
- machine_mode outermode = GET_MODE (op0);
- machine_mode innermode = GET_MODE_INNER (outermode);
enum insn_code icode = optab_handler (vec_set_optab, outermode);
int pos = bitnum / GET_MODE_BITSIZE (innermode);
@@ -1672,17 +1672,16 @@ extract_bit_field_1 (rtx str_rtx, unsigned HOST_WIDE_INT bitsize,
/* Use vec_extract patterns for extracting parts of vectors whenever
available. */
- if (VECTOR_MODE_P (GET_MODE (op0))
+ machine_mode outermode = GET_MODE (op0);
+ scalar_mode innermode = GET_MODE_INNER (outermode);
+ if (VECTOR_MODE_P (outermode)
&& !MEM_P (op0)
- && (convert_optab_handler (vec_extract_optab, GET_MODE (op0),
- GET_MODE_INNER (GET_MODE (op0)))
+ && (convert_optab_handler (vec_extract_optab, outermode, innermode)
!= CODE_FOR_nothing)
- && ((bitnum + bitsize - 1) / GET_MODE_UNIT_BITSIZE (GET_MODE (op0))
- == bitnum / GET_MODE_UNIT_BITSIZE (GET_MODE (op0))))
+ && ((bitnum + bitsize - 1) / GET_MODE_BITSIZE (innermode)
+ == bitnum / GET_MODE_BITSIZE (innermode)))
{
struct expand_operand ops[3];
- machine_mode outermode = GET_MODE (op0);
- machine_mode innermode = GET_MODE_INNER (outermode);
enum insn_code icode
= convert_optab_handler (vec_extract_optab, outermode, innermode);
unsigned HOST_WIDE_INT pos = bitnum / GET_MODE_BITSIZE (innermode);