Jeff Law <l...@redhat.com> writes: > On 10/23/2017 05:16 AM, Richard Sandiford wrote: >> This patch adds helper functions for generating constant and >> non-constant vector duplicates. These routines help with SVE because >> it is then easier to use: >> >> (const:M (vec_duplicate:M X)) >> >> for a broadcast of X, even if the number of elements in M isn't known >> at compile time. It also makes it easier for general rtx code to treat >> constant and non-constant duplicates in the same way. >> >> In the target code, the patch uses gen_vec_duplicate instead of >> gen_rtx_VEC_DUPLICATE if handling constants correctly is potentially >> useful. It might be that some or all of the call sites only handle >> non-constants in practice, in which case the change is a harmless >> no-op (and a saving of a few characters). >> >> Otherwise, the target changes use gen_const_vec_duplicate instead >> of gen_rtx_CONST_VECTOR if the constant is obviously a duplicate. >> They also include some changes to use CONSTxx_RTX for easy global >> constants. >> >> >> 2017-10-23 Richard Sandiford <richard.sandif...@linaro.org> >> Alan Hayward <alan.hayw...@arm.com> >> David Sherwood <david.sherw...@arm.com> >> >> gcc/ >> * emit-rtl.h (gen_const_vec_duplicate): Declare. >> (gen_vec_duplicate): Likewise. >> * emit-rtl.c (gen_const_vec_duplicate_1): New function, split >> out from... >> (gen_const_vector): ...here. >> (gen_const_vec_duplicate, gen_vec_duplicate): New functions. >> (gen_rtx_CONST_VECTOR): Use gen_const_vec_duplicate for constants >> whose elements are all equal. >> * optabs.c (expand_vector_broadcast): Use gen_const_vec_duplicate. >> * simplify-rtx.c (simplify_const_unary_operation): Likewise. >> (simplify_relational_operation): Likewise. >> * config/aarch64/aarch64.c (aarch64_simd_gen_const_vector_dup): >> Likewise. >> (aarch64_simd_dup_constant): Use gen_vec_duplicate. >> (aarch64_expand_vector_init): Likewise. >> * config/arm/arm.c (neon_vdup_constant): Likewise. >> (neon_expand_vector_init): Likewise. >> (arm_expand_vec_perm): Use gen_const_vec_duplicate. >> (arm_block_set_unaligned_vect): Likewise. >> (arm_block_set_aligned_vect): Likewise. >> * config/arm/neon.md (neon_copysignf<mode>): Likewise. >> * config/i386/i386.c (ix86_expand_vec_perm): Likewise. >> (expand_vec_perm_even_odd_pack): Likewise. >> (ix86_vector_duplicate_value): Use gen_vec_duplicate. >> * config/i386/sse.md (one_cmpl<mode>2): Use CONSTM1_RTX. >> * config/ia64/ia64.c (ia64_expand_vecint_compare): Use >> gen_const_vec_duplicate. >> * config/ia64/vect.md (addv2sf3, subv2sf3): Use CONST1_RTX. >> * config/mips/mips.c (mips_gen_const_int_vector): Use >> gen_const_vec_duplicate. >> (mips_expand_vector_init): Use CONST0_RTX. >> * config/powerpcspe/altivec.md (abs<mode>2, nabs<mode>2): Likewise. >> (define_split): Use gen_const_vec_duplicate. >> * config/rs6000/altivec.md (abs<mode>2, nabs<mode>2): Use CONST0_RTX. >> (define_split): Use gen_const_vec_duplicate. >> * config/s390/vx-builtins.md (vec_genmask<mode>): Likewise. >> (vec_ctd_s64, vec_ctd_u64, vec_ctsl, vec_ctul): Likewise. >> * config/spu/spu.c (spu_const): Likewise. > I'd started looking at this a couple times when it was originally > submitted, but never seemed to get through it. It seems like a nice > cleanup. > > So in gen_const_vector we had an assert to verify that const_tiny_rtx > was set up. That seems to have been lost. It's probably not a big > deal, but I mention it in case the loss was unintentional.
This morphed into: +static rtx +gen_const_vector (machine_mode mode, int constant) +{ + machine_mode inner = GET_MODE_INNER (mode); + + gcc_assert (!DECIMAL_FLOAT_MODE_P (inner)); + + rtx el = const_tiny_rtx[constant][(int) inner]; + gcc_assert (el); but it wasn't obvious due to the way the unified diff mixed up the functions. I should have posted that one as context, sorry... Richard