aboutsummaryrefslogtreecommitdiff
path: root/gcc/stor-layout.c
diff options
context:
space:
mode:
authorRichard Sandiford <richard.sandiford@linaro.org>2017-12-16 14:26:43 +0000
committerRichard Sandiford <rsandifo@gcc.gnu.org>2017-12-16 14:26:43 +0000
commitb4d43553e9353de4fefb3a1fde1277eeb1bad7be (patch)
tree9ffc3f135f0fea7660029282f6928e0c8b706973 /gcc/stor-layout.c
parentb4ddce3663ce151423f81c9e2a206df3081d1071 (diff)
downloadgcc-b4d43553e9353de4fefb3a1fde1277eeb1bad7be.zip
gcc-b4d43553e9353de4fefb3a1fde1277eeb1bad7be.tar.gz
gcc-b4d43553e9353de4fefb3a1fde1277eeb1bad7be.tar.bz2
poly_int: mode query functions
This patch changes the bit size and vector count arguments to the machmode.h functions from unsigned int to poly_uint64. 2017-12-16 Richard Sandiford <richard.sandiford@linaro.org> Alan Hayward <alan.hayward@arm.com> David Sherwood <david.sherwood@arm.com> gcc/ * machmode.h (mode_for_size, int_mode_for_size, float_mode_for_size) (smallest_mode_for_size, smallest_int_mode_for_size): Take the mode size as a poly_uint64. (mode_for_vector, mode_for_int_vector): Take the number of vector elements as a poly_uint64. * stor-layout.c (mode_for_size, smallest_mode_for_size): Take the mode size as a poly_uint64. (mode_for_vector, mode_for_int_vector): Take the number of vector elements as a poly_uint64. Co-Authored-By: Alan Hayward <alan.hayward@arm.com> Co-Authored-By: David Sherwood <david.sherwood@arm.com> From-SVN: r255747
Diffstat (limited to 'gcc/stor-layout.c')
-rw-r--r--gcc/stor-layout.c29
1 files changed, 14 insertions, 15 deletions
diff --git a/gcc/stor-layout.c b/gcc/stor-layout.c
index 1eef578..6706219 100644
--- a/gcc/stor-layout.c
+++ b/gcc/stor-layout.c
@@ -298,22 +298,22 @@ finalize_size_functions (void)
MAX_FIXED_MODE_SIZE. */
opt_machine_mode
-mode_for_size (unsigned int size, enum mode_class mclass, int limit)
+mode_for_size (poly_uint64 size, enum mode_class mclass, int limit)
{
machine_mode mode;
int i;
- if (limit && size > MAX_FIXED_MODE_SIZE)
+ if (limit && maybe_gt (size, (unsigned int) MAX_FIXED_MODE_SIZE))
return opt_machine_mode ();
/* Get the first mode which has this size, in the specified class. */
FOR_EACH_MODE_IN_CLASS (mode, mclass)
- if (GET_MODE_PRECISION (mode) == size)
+ if (known_eq (GET_MODE_PRECISION (mode), size))
return mode;
if (mclass == MODE_INT || mclass == MODE_PARTIAL_INT)
for (i = 0; i < NUM_INT_N_ENTS; i ++)
- if (int_n_data[i].bitsize == size
+ if (known_eq (int_n_data[i].bitsize, size)
&& int_n_enabled_p[i])
return int_n_data[i].m;
@@ -341,7 +341,7 @@ mode_for_size_tree (const_tree size, enum mode_class mclass, int limit)
SIZE bits. Abort if no such mode exists. */
machine_mode
-smallest_mode_for_size (unsigned int size, enum mode_class mclass)
+smallest_mode_for_size (poly_uint64 size, enum mode_class mclass)
{
machine_mode mode = VOIDmode;
int i;
@@ -349,19 +349,18 @@ smallest_mode_for_size (unsigned int size, enum mode_class mclass)
/* Get the first mode which has at least this size, in the
specified class. */
FOR_EACH_MODE_IN_CLASS (mode, mclass)
- if (GET_MODE_PRECISION (mode) >= size)
+ if (known_ge (GET_MODE_PRECISION (mode), size))
break;
+ gcc_assert (mode != VOIDmode);
+
if (mclass == MODE_INT || mclass == MODE_PARTIAL_INT)
for (i = 0; i < NUM_INT_N_ENTS; i ++)
- if (int_n_data[i].bitsize >= size
- && int_n_data[i].bitsize < GET_MODE_PRECISION (mode)
+ if (known_ge (int_n_data[i].bitsize, size)
+ && known_lt (int_n_data[i].bitsize, GET_MODE_PRECISION (mode))
&& int_n_enabled_p[i])
mode = int_n_data[i].m;
- if (mode == VOIDmode)
- gcc_unreachable ();
-
return mode;
}
@@ -476,7 +475,7 @@ bitwise_type_for_mode (machine_mode mode)
either an integer mode or a vector mode. */
opt_machine_mode
-mode_for_vector (scalar_mode innermode, unsigned nunits)
+mode_for_vector (scalar_mode innermode, poly_uint64 nunits)
{
machine_mode mode;
@@ -497,14 +496,14 @@ mode_for_vector (scalar_mode innermode, unsigned nunits)
/* Do not check vector_mode_supported_p here. We'll do that
later in vector_type_mode. */
FOR_EACH_MODE_FROM (mode, mode)
- if (GET_MODE_NUNITS (mode) == nunits
+ if (known_eq (GET_MODE_NUNITS (mode), nunits)
&& GET_MODE_INNER (mode) == innermode)
return mode;
/* For integers, try mapping it to a same-sized scalar mode. */
if (GET_MODE_CLASS (innermode) == MODE_INT)
{
- unsigned int nbits = nunits * GET_MODE_BITSIZE (innermode);
+ poly_uint64 nbits = nunits * GET_MODE_BITSIZE (innermode);
if (int_mode_for_size (nbits, 0).exists (&mode)
&& have_regs_of_mode[mode])
return mode;
@@ -518,7 +517,7 @@ mode_for_vector (scalar_mode innermode, unsigned nunits)
an integer mode or a vector mode. */
opt_machine_mode
-mode_for_int_vector (unsigned int int_bits, unsigned int nunits)
+mode_for_int_vector (unsigned int int_bits, poly_uint64 nunits)
{
scalar_int_mode int_mode;
machine_mode vec_mode;