public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug target/104723] New: [12 regression] Redundant usage of stack
@ 2022-03-01  8:35 crazylht at gmail dot com
  2022-03-01  8:44 ` [Bug target/104723] " crazylht at gmail dot com
                   ` (14 more replies)
  0 siblings, 15 replies; 16+ messages in thread
From: crazylht at gmail dot com @ 2022-03-01  8:35 UTC (permalink / raw)
  To: gcc-bugs

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

^ permalink raw reply	[flat|nested] 16+ messages in thread

end of thread, other threads:[~2023-05-08 12:23 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-03-01  8:35 [Bug target/104723] New: [12 regression] Redundant usage of stack crazylht at gmail dot com
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

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).