From: Jeff Law <law@redhat.com>
To: gcc-patches@gcc.gnu.org, richard.sandiford@arm.com
Subject: Re: Add utility functions for rtx broadcast/duplicate constants
Date: Thu, 20 Aug 2015 18:41:00 -0000 [thread overview]
Message-ID: <55D61941.3070102@redhat.com> (raw)
In-Reply-To: <878u969rl1.fsf@e105548-lin.cambridge.arm.com>
On 08/20/2015 04:34 AM, Richard Sandiford wrote:
> Several pieces of code want to know whether all elements of a CONST_VECTOR
> are equal, and I'm about to add some more to simplify-rtx.c. This patch
> adds some utility functions for that.
>
> I don't think we're really helping ourselves by having the shift
> amount in "v16qi << 3" be:
>
> (const_vector:V16QI [
> (const_int 3)
> (const_int 3)
> (const_int 3)
> (const_int 3)
> (const_int 3)
> (const_int 3)
> (const_int 3)
> (const_int 3)
> (const_int 3)
> (const_int 3)
> (const_int 3)
> (const_int 3)
> (const_int 3)
> (const_int 3)
> (const_int 3)
> (const_int 3)
> ])
>
> so I wanted to leave open the possibility of using:
>
> (const:V16QI (vec_duplicate:V16QI (const_int 3)))
>
> in future. The interface therefore passes back the duplicated element
> rather than leaving callers to use CONST_VECTOR_ELT (c, 0)
> (== XVECEXP (c, 0, 0)).
>
> unwrap_const_vec_duplicate is mostly for code that handles vector
> operations equivalently to scalar ops. The follow-on simplify-rtx.c
> code makes more use of this. It also came in useful for the tilegx/
> tilepro predicates.
>
> Tested on x86_64-linux-gnu, arm-linux-gnueabi and aarch64-linux-gnu.
> I also built cross-compilers for s390x-linux-gnu, spu-elf, tilepro-elf
> and tilegx-elf and checked by hand that the affected code still worked.
> (Well, except for the SPU case. That's handling vector constants in
> which the elements are symbolic addresses, such as
> { &foo, &foo, &foo, &foo }. Such vectors don't seem to be treated as
> constants at the gimple level and the initial rtl code that we generate
> is too complex for later optimisations to convert back to a constant,
> so I wasn't sure how best to trigger it.)
>
> OK to install?
>
> Thanks,
> Richard
>
> gcc/
> * rtl.h (rtvec_all_equal_p): Declare.
> (const_vec_duplicate_p, unwrap_const_vec_duplicate): New functions.
> * rtl.c (rtvec_all_equal_p): New function.
> * expmed.c (expand_mult): Use unwrap_const_vec_duplicate.
> * config/aarch64/aarch64.c (aarch64_vect_float_const_representable_p)
> (aarch64_simd_dup_constant): Use const_vec_duplicate_p.
> * config/arm/arm.c (neon_vdup_constant): Likewise.
> * config/s390/s390.c (s390_contiguous_bitmask_vector_p): Likewise.
> * config/tilegx/constraints.md (W, Y): Likewise.
> * config/tilepro/constraints.md (W, Y): Likewise.
> * config/spu/spu.c (spu_legitimate_constant_p): Likewise.
> (classify_immediate): Use unwrap_const_vec_duplicate.
> * config/tilepro/predicates.md (reg_or_v4s8bit_operand): Likewise.
> (reg_or_v2s8bit_operand): Likewise.
> * config/tilegx/predicates.md (reg_or_v8s8bit_operand): Likewise.
> (reg_or_v4s8bit_operand): Likewise.
OK.
Jeff
prev parent reply other threads:[~2015-08-20 18:15 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-08-20 10:38 Richard Sandiford
2015-08-20 18:41 ` Jeff Law [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=55D61941.3070102@redhat.com \
--to=law@redhat.com \
--cc=gcc-patches@gcc.gnu.org \
--cc=richard.sandiford@arm.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).