diff options
author | Richard Sandiford <richard.sandiford@arm.com> | 2019-09-18 09:43:29 +0000 |
---|---|---|
committer | Richard Sandiford <rsandifo@gcc.gnu.org> | 2019-09-18 09:43:29 +0000 |
commit | defc6f266c1dd625cc64ad1ecfbd1eacbcd66e4f (patch) | |
tree | 2028d6fd91fae2de03ce620c828cb09fcc7a354c /gcc/stor-layout.c | |
parent | ef20d2215067b1bfa8b3f9549ca0baed636a94a0 (diff) | |
download | gcc-defc6f266c1dd625cc64ad1ecfbd1eacbcd66e4f.zip gcc-defc6f266c1dd625cc64ad1ecfbd1eacbcd66e4f.tar.gz gcc-defc6f266c1dd625cc64ad1ecfbd1eacbcd66e4f.tar.bz2 |
Handle variable-length vectors in compute_record_mode
This patch makes compute_record_mode handle SVE vectors in the
same way as it would handle fixed-length vectors. There should
be no change in behaviour for other targets.
This is needed for the SVE equivalent of arm_neon.h types like
int8x8x2_t (i.e. a pair of int8x8_ts).
2019-09-18 Richard Sandiford <richard.sandiford@arm.com>
gcc/
* stor-layout.c (compute_record_mode): Operate on poly_uint64
sizes instead of uhwi sizes.
From-SVN: r275869
Diffstat (limited to 'gcc/stor-layout.c')
-rw-r--r-- | gcc/stor-layout.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/gcc/stor-layout.c b/gcc/stor-layout.c index 0e59cfb..9aada97 100644 --- a/gcc/stor-layout.c +++ b/gcc/stor-layout.c @@ -1811,7 +1811,8 @@ compute_record_mode (tree type) line. */ SET_TYPE_MODE (type, BLKmode); - if (! tree_fits_uhwi_p (TYPE_SIZE (type))) + poly_uint64 type_size; + if (!poly_int_tree_p (TYPE_SIZE (type), &type_size)) return; /* A record which has any BLKmode members must itself be @@ -1822,20 +1823,21 @@ compute_record_mode (tree type) if (TREE_CODE (field) != FIELD_DECL) continue; + poly_uint64 field_size; if (TREE_CODE (TREE_TYPE (field)) == ERROR_MARK || (TYPE_MODE (TREE_TYPE (field)) == BLKmode && ! TYPE_NO_FORCE_BLK (TREE_TYPE (field)) && !(TYPE_SIZE (TREE_TYPE (field)) != 0 && integer_zerop (TYPE_SIZE (TREE_TYPE (field))))) - || ! tree_fits_uhwi_p (bit_position (field)) + || !tree_fits_poly_uint64_p (bit_position (field)) || DECL_SIZE (field) == 0 - || ! tree_fits_uhwi_p (DECL_SIZE (field))) + || !poly_int_tree_p (DECL_SIZE (field), &field_size)) return; /* If this field is the whole struct, remember its mode so that, say, we can put a double in a class into a DF register instead of forcing it to live in the stack. */ - if (simple_cst_equal (TYPE_SIZE (type), DECL_SIZE (field)) + if (known_eq (field_size, type_size) /* Partial int types (e.g. __int20) may have TYPE_SIZE equal to wider types (e.g. int32), despite precision being less. Ensure that the TYPE_MODE of the struct does not get set to the partial @@ -1855,7 +1857,6 @@ compute_record_mode (tree type) For UNION_TYPE, if the widest field is MODE_INT then use that mode. If the widest field is MODE_PARTIAL_INT, and the union will be passed by reference, then use that mode. */ - poly_uint64 type_size; if ((TREE_CODE (type) == RECORD_TYPE || (TREE_CODE (type) == UNION_TYPE && (GET_MODE_CLASS (mode) == MODE_INT @@ -1864,7 +1865,6 @@ compute_record_mode (tree type) (pack_cumulative_args (0), function_arg_info (type, mode, /*named=*/false))))))) && mode != VOIDmode - && poly_int_tree_p (TYPE_SIZE (type), &type_size) && known_eq (GET_MODE_BITSIZE (mode), type_size)) ; else |