This patch adds an exported function for testing whether a mode is an SVE mode. The ACLE will make more use of it, but there's already one place that can benefit.
Tested on aarch64-linux-gnu (with and without SVE) and aarch64_be-elf. Applied as r274523. Richard 2019-08-15 Richard Sandiford <richard.sandif...@arm.com> gcc/ * config/aarch64/aarch64-protos.h (aarch64_sve_mode_p): Declare. * config/aarch64/aarch64.c (aarch64_sve_mode_p): New function. (aarch64_select_early_remat_modes): Use it. Index: gcc/config/aarch64/aarch64-protos.h =================================================================== --- gcc/config/aarch64/aarch64-protos.h 2019-08-15 09:47:20.176358327 +0100 +++ gcc/config/aarch64/aarch64-protos.h 2019-08-15 09:59:17.543066285 +0100 @@ -475,6 +475,7 @@ bool aarch64_masks_and_shift_for_bfi_p ( bool aarch64_zero_extend_const_eq (machine_mode, rtx, machine_mode, rtx); bool aarch64_move_imm (HOST_WIDE_INT, machine_mode); opt_machine_mode aarch64_sve_pred_mode (unsigned int); +bool aarch64_sve_mode_p (machine_mode); bool aarch64_sve_cnt_immediate_p (rtx); bool aarch64_sve_scalar_inc_dec_immediate_p (rtx); bool aarch64_sve_addvl_addpl_immediate_p (rtx); Index: gcc/config/aarch64/aarch64.c =================================================================== --- gcc/config/aarch64/aarch64.c 2019-08-15 09:57:26.035888821 +0100 +++ gcc/config/aarch64/aarch64.c 2019-08-15 09:59:17.547066257 +0100 @@ -1606,6 +1606,14 @@ aarch64_vector_data_mode_p (machine_mode return aarch64_classify_vector_mode (mode) & VEC_ANY_DATA; } +/* Return true if MODE is any form of SVE mode, including predicates, + vectors and structures. */ +bool +aarch64_sve_mode_p (machine_mode mode) +{ + return aarch64_classify_vector_mode (mode) & VEC_ANY_SVE; +} + /* Return true if MODE is an SVE data vector mode; either a single vector or a structure of vectors. */ static bool @@ -19962,12 +19970,8 @@ aarch64_select_early_remat_modes (sbitma /* SVE values are not normally live across a call, so it should be worth doing early rematerialization even in VL-specific mode. */ for (int i = 0; i < NUM_MACHINE_MODES; ++i) - { - machine_mode mode = (machine_mode) i; - unsigned int vec_flags = aarch64_classify_vector_mode (mode); - if (vec_flags & VEC_ANY_SVE) - bitmap_set_bit (modes, i); - } + if (aarch64_sve_mode_p ((machine_mode) i)) + bitmap_set_bit (modes, i); } /* Override the default target speculation_safe_value. */