public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "cvs-commit at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug target/102125] (ARM Cortex-M3 and newer) missed optimization. memcpy not needed operations
Date: Mon, 13 Sep 2021 10:27:23 +0000	[thread overview]
Message-ID: <bug-102125-4-aMCUDb3dzj@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-102125-4@http.gcc.gnu.org/bugzilla/>

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

--- Comment #9 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Richard Earnshaw <rearnsha@gcc.gnu.org>:

https://gcc.gnu.org/g:5f6a6c91d7c592cb49f7c519f289777eac09bb74

commit r12-3482-g5f6a6c91d7c592cb49f7c519f289777eac09bb74
Author: Richard Earnshaw <rearnsha@arm.com>
Date:   Fri Sep 3 17:06:15 2021 +0100

    gimple: allow more folding of memcpy [PR102125]

    The current restriction on folding memcpy to a single element of size
    MOVE_MAX is excessively cautious on most machines and limits some
    significant further optimizations.  So relax the restriction provided
    the copy size does not exceed MOVE_MAX * MOVE_RATIO and that a SET
    insn exists for moving the value into machine registers.

    Note that there were already checks in place for having misaligned
    move operations when one or more of the operands were unaligned.

    On Arm this now permits optimizing

    uint64_t bar64(const uint8_t *rData1)
    {
        uint64_t buffer;
        memcpy(&buffer, rData1, sizeof(buffer));
        return buffer;
    }

    from
            ldr     r2, [r0]        @ unaligned
            sub     sp, sp, #8
            ldr     r3, [r0, #4]    @ unaligned
            strd    r2, [sp]
            ldrd    r0, [sp]
            add     sp, sp, #8

    to
            mov     r3, r0
            ldr     r0, [r0]        @ unaligned
            ldr     r1, [r3, #4]    @ unaligned

    PR target/102125 - (ARM Cortex-M3 and newer) missed optimization. memcpy
not needed operations

    gcc/ChangeLog:

            PR target/102125
            * gimple-fold.c (gimple_fold_builtin_memory_op): Allow folding
            memcpy if the size is not more than MOVE_MAX * MOVE_RATIO.

  parent reply	other threads:[~2021-09-13 10:27 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-08-30  8:27 [Bug c/102125] New: " jankowski938 at gmail dot com
2021-08-30  8:32 ` [Bug c/102125] " jankowski938 at gmail dot com
2021-08-30 11:40 ` [Bug target/102125] " rguenth at gcc dot gnu.org
2021-08-30 19:29 ` pinskia at gcc dot gnu.org
2021-08-30 20:14 ` jankowski938 at gmail dot com
2021-08-31 11:54 ` rearnsha at gcc dot gnu.org
2021-08-31 16:42 ` rearnsha at gcc dot gnu.org
2021-09-13 10:27 ` cvs-commit at gcc dot gnu.org
2021-09-13 10:27 ` cvs-commit at gcc dot gnu.org
2021-09-13 10:27 ` cvs-commit at gcc dot gnu.org [this message]
2021-09-13 10:29 ` rearnsha at gcc dot gnu.org
2022-03-23 14:57 ` cvs-commit at gcc dot gnu.org

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=bug-102125-4-aMCUDb3dzj@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /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).