public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "crazylht at gmail dot com" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug target/104723] New: [12 regression] Redundant usage of stack
Date: Tue, 01 Mar 2022 08:35:42 +0000	[thread overview]
Message-ID: <bug-104723-4@http.gcc.gnu.org/bugzilla/> (raw)

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

            Bug ID: 104723
           Summary: [12 regression] Redundant usage of stack
           Product: gcc
           Version: 12.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: target
          Assignee: unassigned at gcc dot gnu.org
          Reporter: crazylht at gmail dot com
  Target Milestone: ---
              Host: x86_64-pc-linux-gnu
            Target: x86_64-*-* i?86-*-*

bool f256(char *a)
{
  char t[] = "012345678901234567890123456789012345678901234567";
  return __builtin_memcpy(a, &t[0], sizeof(t)) == 0;
}

https://godbolt.org/z/jcjbT4d8e

gcc12 generates

        vmovdqa64       ymm31, YMMWORD PTR .LC0[rip]
        xor     eax, eax
        vmovdqu64       YMMWORD PTR [rsp-72], ymm31
        vmovdqa64       ymm31, YMMWORD PTR .LC1[rip]
        vmovdqu64       YMMWORD PTR [rsp-55], ymm31
        vmovdqu64       ymm31, YMMWORD PTR [rsp-72]
        vmovdqu64       YMMWORD PTR [rdi], ymm31
        vmovdqu64       ymm31, YMMWORD PTR [rsp-55]
        vmovdqu64       YMMWORD PTR [rdi+17], ymm31

Why build “unaligned string" by stack instead of putting it directly into the
constant pool.

gcc 11 seems fine.

f256(char*):
        vmovdqa xmm0, XMMWORD PTR .LC0[rip]
        mov     BYTE PTR [rdi+48], 0
        vmovdqu XMMWORD PTR [rdi], xmm0
        vmovdqa xmm0, XMMWORD PTR .LC1[rip]
        xor     eax, eax
        vmovdqu XMMWORD PTR [rdi+16], xmm0
        vmovdqa xmm0, XMMWORD PTR .LC2[rip]
        vmovdqu XMMWORD PT

             reply	other threads:[~2022-03-01  8:35 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-03-01  8:35 crazylht at gmail dot com [this message]
2022-03-01  8:44 ` [Bug target/104723] " crazylht at gmail dot com
2022-03-01  8:47 ` crazylht at gmail dot com
2022-03-01 12:38 ` lili.cui at intel dot com
2022-03-01 13:41 ` rguenth at gcc dot gnu.org
2022-03-01 16:00 ` jakub at gcc dot gnu.org
2022-03-01 16:07 ` jakub at gcc dot gnu.org
2022-03-01 18:45 ` hjl.tools at gmail dot com
2022-03-01 18:50 ` hjl.tools at gmail dot com
2022-03-02  8:11 ` lili.cui at intel dot com
2022-04-22 16:28 ` jakub at gcc dot gnu.org
2022-04-24  7:37 ` lili.cui at intel dot com
2022-04-26  9:41 ` jakub at gcc dot gnu.org
2022-05-06  8:32 ` [Bug target/104723] [12/13 " jakub at gcc dot gnu.org
2022-07-26 12:58 ` rguenth at gcc dot gnu.org
2023-05-08 12:23 ` [Bug target/104723] [12/13/14 " rguenth 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-104723-4@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).