public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "pinskia at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug target/110406] d: Wrong code-gen returning POD structs by value
Date: Mon, 26 Jun 2023 04:28:28 +0000	[thread overview]
Message-ID: <bug-110406-4-BLGYkSqMrm@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-110406-4@http.gcc.gnu.org/bugzilla/>

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

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |ABI

--- Comment #6 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
(In reply to Andrew Pinski from comment #5)
> (In reply to ibuclaw from comment #3)
> > (In reply to Andrew Pinski from comment #2)
> > > >structs have been set the wrong mode
> > > 
> > > No, they don't have wrong mode, just the x86_64 backend is broken, see bug
> > > 102027 comment #7 specifically.
> > I think they do.
> > 
> > On 64-bit,  I expect the mode set by compute_record_mode to be TImode. 
> > However what I'm instead seeing is BLKmode. This tells me I might be calling
> > it too early, and some fields yet to have their DECL_SIZE set.
> 
> Unless the struct has the alignment of TImode, it should be BLKmode ...

here is a C testcase to get it returned into vector register (incorrectly due
to the alignment being set to 32):
```
typedef unsigned uint;
struct  cpuid_abcd_t
{
    uint eax;
    uint ebx;
    uint ecx;
    uint edx;
}  __attribute__((aligned(8*4)));

struct cpuid_abcd_t
cpuid_insn(const uint in_eax)
{
        struct cpuid_abcd_t ret={};

        asm (
            "cpuid"
            :
                "=a" ( ret.eax ),
                "=b" ( ret.ebx ),
                "=c" ( ret.ecx ),
                "=d" ( ret.edx )
            :
                "a"  ( in_eax )
            :
    );
        return ret;
}
```

Which itself is GCC 12+ regression too ...

  parent reply	other threads:[~2023-06-26  4:28 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-06-26  2:25 [Bug d/110406] New: " ibuclaw at gcc dot gnu.org
2023-06-26  2:33 ` [Bug d/110406] " pinskia at gcc dot gnu.org
2023-06-26  2:44 ` [Bug target/110406] " pinskia at gcc dot gnu.org
2023-06-26  3:06 ` ibuclaw at gcc dot gnu.org
2023-06-26  3:10 ` ibuclaw at gcc dot gnu.org
2023-06-26  4:21 ` pinskia at gcc dot gnu.org
2023-06-26  4:28 ` pinskia at gcc dot gnu.org [this message]
2023-06-26  4:32 ` pinskia at gcc dot gnu.org
2023-06-26  9:37 ` ibuclaw at gcc dot gnu.org
2023-06-26  9:38 ` ibuclaw at gcc dot gnu.org
2023-06-26 20:55 ` ibuclaw at gcc dot gnu.org
2023-06-27  8:52 ` iains at gcc dot gnu.org
2023-06-27  9:27 ` iains at gcc dot gnu.org
2023-06-28 16:33 ` ibuclaw at gcc dot gnu.org
2023-06-28 18:19 ` cvs-commit at gcc dot gnu.org
2023-06-28 18:52 ` cvs-commit at gcc dot gnu.org
2023-06-28 18:55 ` ibuclaw 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-110406-4-BLGYkSqMrm@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).