https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100305

--- Comment #10 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-11 branch has been updated by Richard Sandiford
<rsand...@gcc.gnu.org>:

https://gcc.gnu.org/g:cd0a059bd384da58d43674496a79ecb7de610800

commit r11-8323-gcd0a059bd384da58d43674496a79ecb7de610800
Author: Richard Sandiford <richard.sandif...@arm.com>
Date:   Thu Apr 29 09:27:52 2021 +0100

    aarch64: Fix address mode for vec_concat pattern [PR100305]

    The load_pair_lanes<mode> patterns match a vec_concat of two
    adjacent 64-bit memory locations as a single 128-bit load.
    The Utq constraint made sure that the address was suitable
    for a 128-bit vector, but this meant that it allowed some
    addresses that aren't valid for the 64-bit element mode.

    Two obvious fixes were:

    (1) Continue to accept addresses that aren't valid for the element
        modes.  This would mean changing the mode of operands[1] before
        printing it.  It would also mean using a custom predicate instead
        of the current memory_operand.

    (2) Restrict addresses to the intersection of those that are valid
        element and vector addresses.

    The problem with (1) is that, as well as being more complicated,
    it doesn't deal with the fact that we still have a memory_operand
    for the second element.  If we encourage the first operand to be
    outside the range of a normal element memory_operand, we'll have
    to reload the second operand to make it valid.  This reload will
    often be dead code, but will be kept around because the RTL
    pattern makes it look as though the second element address
    is still needed.

    This patch therefore does (2) instead.

    As mentioned in the PR notes, I think we have a general problem
    with the way that the aarch64 port deals with paired addresses.
    There's nothing to guarantee that the two addresses will be
    reloaded in a way that keeps them âobviouslyâ adjacent, so the
    rtx_equal_p conditions could fail if something rechecked them
    later.

    For this particular pattern, I think it would be better to teach
    simplify-rtx.c to fold the vec_concat to a normal vector memory
    reference, to remove any suggestion that targets should try to
    match the unsimplified form.  That obviously wouldn't be suitable
    for backports though.

    gcc/
            PR target/100305
            * config/aarch64/constraints.md (Utq): Require the address to
            be valid for both the element mode and for V2DImode.

    gcc/testsuite/
            PR target/100305
            * gcc.c-torture/compile/pr100305.c: New test.

    (cherry picked from commit 668df9e769e7d89bcefa07f72b68dcae9a8f3970)

Reply via email to