]> git.ipfire.org Git - thirdparty/gcc.git/commit
recog: Handle some mode-changing hardreg propagations
authorRichard Sandiford <richard.sandiford@arm.com>
Wed, 10 Jul 2024 16:01:29 +0000 (17:01 +0100)
committerRichard Sandiford <richard.sandiford@arm.com>
Wed, 10 Jul 2024 16:01:29 +0000 (17:01 +0100)
commit9d20529d94b23275885f380d155fe8671ab5353a
tree359bdd40cbbfece37d81423527ee117cf053b47d
parente08ebd7d77a216ee2313b585c370333c66497b53
recog: Handle some mode-changing hardreg propagations

insn_propagation would previously only replace (reg:M H) with X
for some hard register H if the uses of H were also in mode M.
This patch extends it to handle simple mode punning too.

The original motivation was to try to get rid of the execution
frequency test in aarch64_split_simd_shift_p, but doing that is
follow-up work.

I tried this on at least one target per CPU directory (as for
the late-combine patches) and it seems to be a small win for
all of them.

The patch includes a couple of updates to the ia32 results.
In pr105033.c, foo3 replaced:

       vmovq       8(%esp), %xmm1
       vpunpcklqdq %xmm1, %xmm0, %xmm0

with:

       vmovhps     8(%esp), %xmm0, %xmm0

In vect-bfloat16-2b.c, 5 of the vec_extract_v32bf_* routines
(specifically the ones with nonzero even indices) replaced
things like:

       movl    28(%esp), %eax
       vmovd   %eax, %xmm0

with:

       vpinsrw $0, 28(%esp), %xmm0, %xmm0

(These functions return a bf16, and so only the low 16 bits matter.)

gcc/
* recog.cc (insn_propagation::apply_to_rvalue_1): Handle simple
cases of hardreg propagation in which the register is set and
used in different modes.

gcc/testsuite/
* gcc.target/i386/pr105033.c: Expect vmovhps for the ia32 version
of foo.
* gcc.target/i386/vect-bfloat16-2b.c: Expect more vpinsrws.
gcc/recog.cc
gcc/testsuite/gcc.target/i386/pr105033.c
gcc/testsuite/gcc.target/i386/vect-bfloat16-2b.c