From 5c38705dbde776f68bf1f99a71657d0e21b772a5 Mon Sep 17 00:00:00 2001 From: Richard Sandiford Date: Thu, 15 Aug 2019 09:00:22 +0000 Subject: [PATCH] [AArch64] Add a aarch64_sve_mode_p query 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. 2019-08-15 Richard Sandiford 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. From-SVN: r274523 --- gcc/ChangeLog | 6 ++++++ gcc/config/aarch64/aarch64-protos.h | 1 + gcc/config/aarch64/aarch64.c | 16 ++++++++++------ 3 files changed, 17 insertions(+), 6 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index c5dbcf0aeaa..12c8dcd5cc9 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2019-08-15 Richard Sandiford + + * 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. + 2019-08-15 Richard Sandiford * config/aarch64/aarch64.c (aarch64_simd_vector_alignment): Return diff --git a/gcc/config/aarch64/aarch64-protos.h b/gcc/config/aarch64/aarch64-protos.h index 9191cfeb73d..89e5e28aeeb 100644 --- a/gcc/config/aarch64/aarch64-protos.h +++ b/gcc/config/aarch64/aarch64-protos.h @@ -475,6 +475,7 @@ bool aarch64_masks_and_shift_for_bfi_p (scalar_int_mode, unsigned HOST_WIDE_INT, 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); diff --git a/gcc/config/aarch64/aarch64.c b/gcc/config/aarch64/aarch64.c index 77794582fbc..84341c041cf 100644 --- a/gcc/config/aarch64/aarch64.c +++ b/gcc/config/aarch64/aarch64.c @@ -1606,6 +1606,14 @@ aarch64_vector_data_mode_p (machine_mode 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 (sbitmap modes) /* 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. */ -- 2.30.2