public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
From: Alexandre Oliva <aoliva@gcc.gnu.org>
To: gcc-cvs@gcc.gnu.org
Subject: [gcc(refs/users/aoliva/heads/testme)] -finline-stringops: don't assume ptr_mode ptr in memset [PR112804]
Date: Sat,  9 Dec 2023 01:37:59 +0000 (GMT)	[thread overview]
Message-ID: <20231209013759.B79A03858C53@sourceware.org> (raw)

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

commit fcf66065b6d7865aeff47678db37670e4575a95d
Author: Alexandre Oliva <oliva@adacore.com>
Date:   Fri Dec 8 21:41:50 2023 -0300

    -finline-stringops: don't assume ptr_mode ptr in memset [PR112804]
    
    On aarch64 -milp32, and presumably on other such targets, ptr can be
    in a different mode than ptr_mode in the testcase.  Cope with it.
    
    
    for  gcc/ChangeLog
    
            PR target/112804
            * builtins.cc (try_store_by_multiple_pieces): Use ptr's mode
            for the increment.
    
    for  gcc/testsuite/ChangeLog
    
            PR target/112804
            * gcc.target/aarch64/inline-mem-set-pr112804.c: New.

Diff:
---
 gcc/builtins.cc                                            | 2 +-
 gcc/testsuite/gcc.target/aarch64/inline-mem-set-pr112804.c | 7 +++++++
 2 files changed, 8 insertions(+), 1 deletion(-)

diff --git a/gcc/builtins.cc b/gcc/builtins.cc
index d5135ca162a..4c3a93fb42f 100644
--- a/gcc/builtins.cc
+++ b/gcc/builtins.cc
@@ -4548,7 +4548,7 @@ try_store_by_multiple_pieces (rtx to, rtx len, unsigned int ctz_len,
 	  to = change_address (to, QImode, 0);
 	  emit_move_insn (to, val);
 	  if (update_needed)
-	    next_ptr = plus_constant (ptr_mode, ptr, blksize);
+	    next_ptr = plus_constant (GET_MODE (ptr), ptr, blksize);
 	}
       else
 	{
diff --git a/gcc/testsuite/gcc.target/aarch64/inline-mem-set-pr112804.c b/gcc/testsuite/gcc.target/aarch64/inline-mem-set-pr112804.c
new file mode 100644
index 00000000000..fe841455986
--- /dev/null
+++ b/gcc/testsuite/gcc.target/aarch64/inline-mem-set-pr112804.c
@@ -0,0 +1,7 @@
+/* { dg-do compile } */
+/* { dg-options "-finline-stringops -mabi=ilp32 -ftrivial-auto-var-init=zero" } */
+
+short m(unsigned k) {
+  const unsigned short *n[65];
+  return 0;
+}

             reply	other threads:[~2023-12-09  1:37 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-12-09  1:37 Alexandre Oliva [this message]
2023-12-09  1:49 Alexandre Oliva
2023-12-11 16:09 Alexandre Oliva

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=20231209013759.B79A03858C53@sourceware.org \
    --to=aoliva@gcc.gnu.org \
    --cc=gcc-cvs@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).